@vinihcrosa/lumem-os 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +107 -0
- package/bin/lumem.mjs +4605 -0
- package/bin/postinstall.mjs +55 -0
- package/dist/server/main.mjs +95446 -0
- package/dist/web/assets/codemirror-setup-Csmyc9rQ.js +18 -0
- package/dist/web/assets/core-rofTMs1b.js +12 -0
- package/dist/web/assets/css-CLj8gQPS.js +1 -0
- package/dist/web/assets/diff-D97Zzqfu.js +1 -0
- package/dist/web/assets/docker-BcOcwvcX.js +1 -0
- package/dist/web/assets/engine-javascript-DBd1bXLz.js +141 -0
- package/dist/web/assets/html-pp8916En.js +1 -0
- package/dist/web/assets/index-BlWx0v0O.js +101 -0
- package/dist/web/assets/index-jS7lSqBc.css +32 -0
- package/dist/web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/dist/web/assets/javascript-wDzz0qaB.js +1 -0
- package/dist/web/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dist/web/assets/json-Cp-IABpG.js +1 -0
- package/dist/web/assets/jsx-g9-lgVsj.js +1 -0
- package/dist/web/assets/make-CHLpvVh8.js +1 -0
- package/dist/web/assets/markdown-Cvjx9yec.js +1 -0
- package/dist/web/assets/python-B6aJPvgy.js +1 -0
- package/dist/web/assets/shellscript-Yzrsuije.js +1 -0
- package/dist/web/assets/sql-CRqJ_cUM.js +1 -0
- package/dist/web/assets/toml-vGWfd6FD.js +1 -0
- package/dist/web/assets/tsx-COt5Ahok.js +1 -0
- package/dist/web/assets/typescript-BPQ3VLAy.js +1 -0
- package/dist/web/assets/yaml-Buea-lGh.js +1 -0
- package/dist/web/index.html +13 -0
- package/drizzle/0000_initial.sql +68 -0
- package/drizzle/0001_adorable_joshua_kane.sql +71 -0
- package/drizzle/0002_striped_trish_tilby.sql +1 -0
- package/drizzle/0003_memoria_do_workspace.sql +127 -0
- package/drizzle/0004_memoria_no_nucleo.sql +1 -0
- package/drizzle/0005_playbooks.sql +21 -0
- package/drizzle/0006_consumo_por_turno.sql +15 -0
- package/drizzle/0007_project_origin_and_management.sql +2 -0
- package/drizzle/0008_sessao_de_script.sql +40 -0
- package/drizzle/0009_porta_por_checkout.sql +13 -0
- package/drizzle/0010_confianca_no_scripts.sql +1 -0
- package/drizzle/0011_fase_de_teste.sql +40 -0
- package/drizzle/meta/0000_snapshot.json +450 -0
- package/drizzle/meta/0001_snapshot.json +515 -0
- package/drizzle/meta/0002_snapshot.json +522 -0
- package/drizzle/meta/0003_snapshot.json +1292 -0
- package/drizzle/meta/0004_snapshot.json +1300 -0
- package/drizzle/meta/0005_snapshot.json +1445 -0
- package/drizzle/meta/0006_snapshot.json +1544 -0
- package/drizzle/meta/0007_snapshot.json +1559 -0
- package/drizzle/meta/0008_snapshot.json +1570 -0
- package/drizzle/meta/0009_snapshot.json +1649 -0
- package/drizzle/meta/0010_snapshot.json +1656 -0
- package/drizzle/meta/0011_snapshot.json +1656 -0
- package/drizzle/meta/_journal.json +90 -0
- package/package.json +47 -0
|
@@ -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 Eb=e=>{throw TypeError(e)};var Wf=(e,t,i)=>t.has(e)||Eb("Cannot "+i);var E=(e,t,i)=>(Wf(e,t,"read from private field"),i?i.call(e):t.get(e)),fe=(e,t,i)=>t.has(e)?Eb("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),ne=(e,t,i,n)=>(Wf(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),je=(e,t,i)=>(Wf(e,t,"access private method"),i);var Nu=(e,t,i,n)=>({set _(a){ne(e,t,a,i)},get _(){return E(e,t,n)}});(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const h of l.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&n(h)}).observe(document,{childList:!0,subtree:!0});function i(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function n(a){if(a.ep)return;a.ep=!0;const l=i(a);fetch(a.href,l)}})();const rk="modulepreload",nk=function(e){return"/"+e},Nb={},Ut=function(t,i,n){let a=Promise.resolve();if(i&&i.length>0){let h=function(m){return Promise.all(m.map(v=>Promise.resolve(v).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),_=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));a=h(i.map(m=>{if(m=nk(m),m in Nb)return;Nb[m]=!0;const v=m.endsWith(".css"),g=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const b=document.createElement("link");if(b.rel=v?"stylesheet":rk,v||(b.as="script"),b.crossOrigin="",b.href=m,_&&b.setAttribute("nonce",_),document.head.appendChild(b),v)return new Promise((S,x)=>{b.addEventListener("load",S),b.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${m}`)))})}))}function l(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"&&l(d.reason);return t().catch(l)})};var Vf={exports:{}},Sl={};/**
|
|
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 Tb;function ak(){if(Tb)return Sl;Tb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function i(n,a,l){var h=null;if(l!==void 0&&(h=""+l),a.key!==void 0&&(h=""+a.key),"key"in a){l={};for(var d in a)d!=="key"&&(l[d]=a[d])}else l=a;return a=l.ref,{$$typeof:e,type:n,key:h,ref:a!==void 0?a:null,props:l}}return Sl.Fragment=t,Sl.jsx=i,Sl.jsxs=i,Sl}var Ob;function ok(){return Ob||(Ob=1,Vf.exports=ak()),Vf.exports}var c=ok(),la=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Fn,Jr,so,YS,lk=(YS=class extends la{constructor(){super();fe(this,Fn);fe(this,Jr);fe(this,so);ne(this,so,t=>{if(typeof window<"u"&&window.addEventListener){const i=()=>t();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}})}onSubscribe(){E(this,Jr)||this.setEventListener(E(this,so))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,Jr))==null||t.call(this),ne(this,Jr,void 0))}setEventListener(t){var i;ne(this,so,t),(i=E(this,Jr))==null||i.call(this),ne(this,Jr,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){E(this,Fn)!==t&&(ne(this,Fn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(i=>{i(t)})}isFocused(){var t;return typeof E(this,Fn)=="boolean"?E(this,Fn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Fn=new WeakMap,Jr=new WeakMap,so=new WeakMap,YS),K_=new lk,ck={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},en,F_,GS,uk=(GS=class{constructor(){fe(this,en,ck);fe(this,F_,!1)}setTimeoutProvider(e){ne(this,en,e)}setTimeout(e,t){return E(this,en).setTimeout(e,t)}clearTimeout(e){E(this,en).clearTimeout(e)}setInterval(e,t){return E(this,en).setInterval(e,t)}clearInterval(e){E(this,en).clearInterval(e)}},en=new WeakMap,F_=new WeakMap,GS),In=new uk;function hk(e){setTimeout(e,0)}var dk=typeof window>"u"||"Deno"in globalThis;function ds(){}function fk(e,t){return typeof e=="function"?e(t):e}function Cm(e){return typeof e=="number"&&e>=0&&e!==1/0}function cx(e,t){return Math.max(e+(t||0)-Date.now(),0)}function mn(e,t){return typeof e=="function"?e(t):e}function Ws(e,t){return typeof e=="function"?e(t):e}function Ab(e,t){const{type:i="all",exact:n,fetchStatus:a,predicate:l,queryKey:h,stale:d}=e;if(h){if(n){if(t.queryHash!==$_(h,t.options))return!1}else if(!go(t.queryKey,h))return!1}if(i!=="all"){const _=t.isActive();if(i==="active"&&!_||i==="inactive"&&_)return!1}return!(typeof d=="boolean"&&t.isStale()!==d||a&&a!==t.state.fetchStatus||l&&!l(t))}function Rb(e,t){const{exact:i,status:n,predicate:a,mutationKey:l}=e;if(l){if(!t.options.mutationKey)return!1;if(i){if(ea(t.options.mutationKey)!==ea(l))return!1}else if(!go(t.options.mutationKey,l))return!1}return!(n&&t.state.status!==n||a&&!a(t))}function $_(e,t){return((t==null?void 0:t.queryKeyHashFn)||ea)(e)}function ea(e){return JSON.stringify(e,(t,i)=>jm(i)?Object.keys(i).sort().reduce((n,a)=>(n[a]=i[a],n),{}):i)}function go(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(!go(e[n],t[n]))return!1;return!0}const i=Object.keys(t);for(const n of i)if(!go(e[n],t[n]))return!1;return!0}return!1}var mk=Object.prototype.hasOwnProperty;function W_(e,t,i=0){if(e===t)return e;if(i>500)return t;const n=Mb(e)&&Mb(t);if(!n&&!(jm(e)&&jm(t)))return t;const l=(n?e:Object.keys(e)).length,h=n?t:Object.keys(t),d=h.length,_=n?new Array(d):{};let m=0;for(let v=0;v<d;v++){const g=n?v:h[v],b=e[g],S=t[g];if(b===S){_[g]=b,(n?v<l:mk.call(e,g))&&m++;continue}if(b===null||S===null||typeof b!="object"||typeof S!="object"){_[g]=S;continue}const x=W_(b,S,i+1);_[g]=x,x===b&&m++}return l===d&&m===l?e:_}function Pl(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 Mb(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function jm(e){if(!Db(e))return!1;const t=e.constructor;if(t===void 0)return!0;const i=t.prototype;return!(!Db(i)||!i.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Db(e){return Object.prototype.toString.call(e)==="[object Object]"}function _k(e){return new Promise(t=>{In.setTimeout(t,e)})}function km(e,t,i){return typeof i.structuralSharing=="function"?i.structuralSharing(e,t):i.structuralSharing!==!1?W_(e,t):t}function pk(e,t,i=0){const n=[...e,t];return i&&n.length>i?n.slice(1):n}function vk(e,t,i=0){const n=[t,...e];return i&&n.length>i?n.slice(0,-1):n}var V_=Symbol();function ux(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===V_?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Y_(e,t){return typeof e=="function"?e(...t):!!e}function gk(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 Hl=(()=>{let e=()=>dk;return{isServer(){return e()},setIsServer(t){e=t}}})();function Em(){let e,t;const i=new Promise((a,l)=>{e=a,t=l});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 yk=hk;function bk(){let e=[],t=0,i=d=>{d()},n=d=>{d()},a=yk;const l=d=>{t?e.push(d):a(()=>{i(d)})},h=()=>{const d=e;e=[],d.length&&a(()=>{n(()=>{d.forEach(_=>{i(_)})})})};return{batch:d=>{let _;t++;try{_=d()}finally{t--,t||h()}return _},batchCalls:d=>(..._)=>{l(()=>{d(..._)})},schedule:l,setNotifyFunction:d=>{i=d},setBatchNotifyFunction:d=>{n=d},setScheduler:d=>{a=d}}}var Ct=bk(),io,tn,ro,QS,Sk=(QS=class extends la{constructor(){super();fe(this,io,!0);fe(this,tn);fe(this,ro);ne(this,ro,t=>{if(typeof window<"u"&&window.addEventListener){const i=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",n)}}})}onSubscribe(){E(this,tn)||this.setEventListener(E(this,ro))}onUnsubscribe(){var t;this.hasListeners()||((t=E(this,tn))==null||t.call(this),ne(this,tn,void 0))}setEventListener(t){var i;ne(this,ro,t),(i=E(this,tn))==null||i.call(this),ne(this,tn,t(this.setOnline.bind(this)))}setOnline(t){E(this,io)!==t&&(ne(this,io,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return E(this,io)}},io=new WeakMap,tn=new WeakMap,ro=new WeakMap,QS),th=new Sk;function xk(e){return Math.min(1e3*2**e,3e4)}function hx(e){return(e??"online")==="online"?th.isOnline():!0}var Nm=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function dx(e){let t=!1,i=0,n;const a=Em(),l=()=>a.status!=="pending",h=C=>{var j;if(!l()){const N=new Nm(C);b(N),(j=e.onCancel)==null||j.call(e,N)}},d=()=>{t=!0},_=()=>{t=!1},m=()=>K_.isFocused()&&(e.networkMode==="always"||th.isOnline())&&e.canRun(),v=()=>hx(e.networkMode)&&e.canRun(),g=C=>{l()||(n==null||n(),a.resolve(C))},b=C=>{l()||(n==null||n(),a.reject(C))},S=()=>new Promise(C=>{var j;n=N=>{(l()||m())&&C(N)},(j=e.onPause)==null||j.call(e)}).then(()=>{var C;n=void 0,l()||(C=e.onContinue)==null||C.call(e)}),x=()=>{if(l())return;let C;const j=i===0?e.initialPromise:void 0;try{C=j??e.fn()}catch(N){C=Promise.reject(N)}Promise.resolve(C).then(g).catch(N=>{var ee;if(l())return;const z=e.retry??(Hl.isServer()?0:3),B=e.retryDelay??xk,M=typeof B=="function"?B(i,N):B,V=z===!0||typeof z=="number"&&i<z||typeof z=="function"&&z(i,N);if(t||!V){b(N);return}i++,(ee=e.onFail)==null||ee.call(e,i,N),_k(M).then(()=>m()?void 0:S()).then(()=>{t?b(N):x()})})};return{promise:a,status:()=>a.status,cancel:h,continue:()=>(n==null||n(),a),cancelRetry:d,continueRetry:_,canStart:v,start:()=>(v()?x():S().then(x),a)}}var Kn,ZS,fx=(ZS=class{constructor(){fe(this,Kn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Cm(this.gcTime)&&ne(this,Kn,In.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Hl.isServer()?1/0:300*1e3))}clearGcTimeout(){E(this,Kn)!==void 0&&(In.clearTimeout(E(this,Kn)),ne(this,Kn,void 0))}},Kn=new WeakMap,ZS);function wk(e){return{onFetch:(t,i)=>{var v,g,b,S,x;const n=t.options,a=(b=(g=(v=t.fetchOptions)==null?void 0:v.meta)==null?void 0:g.fetchMore)==null?void 0:b.direction,l=((S=t.state.data)==null?void 0:S.pages)||[],h=((x=t.state.data)==null?void 0:x.pageParams)||[];let d={pages:[],pageParams:[]},_=0;const m=async()=>{let C=!1;const j=B=>{gk(B,()=>t.signal,()=>C=!0)},N=ux(t.options,t.fetchOptions),z=async(B,M,V)=>{if(C)return Promise.reject(t.signal.reason);if(M==null&&B.pages.length)return Promise.resolve(B);const q=(()=>{const ge={client:t.client,queryKey:t.queryKey,pageParam:M,direction:V?"backward":"forward",meta:t.options.meta};return j(ge),ge})(),te=await N(q),{maxPages:he}=t.options,de=V?vk:pk;return{pages:de(B.pages,te,he),pageParams:de(B.pageParams,M,he)}};if(a&&l.length){const B=a==="backward",M=B?Ck:Bb,V={pages:l,pageParams:h},ee=M(n,V);d=await z(V,ee,B)}else{const B=e??l.length;do{const M=_===0?h[0]??n.initialPageParam:Bb(n,d);if(_>0&&M==null)break;d=await z(d,M),_++}while(_<B)}return d};t.options.persister?t.fetchFn=()=>{var C,j;return(j=(C=t.options).persister)==null?void 0:j.call(C,m,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},i)}:t.fetchFn=m}}}function Bb(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 Ck(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 no,$n,ao,li,Wn,Yt,Gl,Vn,$s,mx,or,XS,jk=(XS=class extends fx{constructor(t){super();fe(this,$s);fe(this,no);fe(this,$n);fe(this,ao);fe(this,li);fe(this,Wn);fe(this,Yt);fe(this,Gl);fe(this,Vn);ne(this,Vn,!1),ne(this,Gl,t.defaultOptions),this.setOptions(t.options),this.observers=[],ne(this,Wn,t.client),ne(this,li,E(this,Wn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ne(this,$n,zb(this.options)),this.state=t.state??E(this,$n),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return E(this,no)}get promise(){var t;return(t=E(this,Yt))==null?void 0:t.promise}setOptions(t){if(this.options={...E(this,Gl),...t},t!=null&&t._type&&ne(this,no,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=zb(this.options);i.data!==void 0&&(this.setState(Lb(i.data,i.dataUpdatedAt)),ne(this,$n,i))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&E(this,li).remove(this)}setData(t,i){const n=km(this.state.data,t,this.options);return je(this,$s,or).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,$s,or).call(this,{type:"setState",state:t})}cancel(t){var n,a;const i=(n=E(this,Yt))==null?void 0:n.promise;return(a=E(this,Yt))==null||a.cancel(t),i?i.then(ds).catch(ds):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return E(this,$n)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Ws(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===V_||!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:!cx(this.state.dataUpdatedAt,t)}onFocus(){var i;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(i=E(this,Yt))==null||i.continue()}onOnline(){var i;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(i=E(this,Yt))==null||i.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),E(this,li).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(i=>i!==t),this.observers.length||(E(this,Yt)&&(E(this,Vn)||je(this,$s,mx).call(this)?E(this,Yt).cancel({revert:!0}):E(this,Yt).cancelRetry()),this.scheduleGc()),E(this,li).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||je(this,$s,or).call(this,{type:"invalidate"})}async fetch(t,i){var m,v,g,b,S,x,C,j,N,z,B;if(this.state.fetchStatus!=="idle"&&((m=E(this,Yt))==null?void 0:m.status())!=="rejected"){if(this.state.data!==void 0&&(i!=null&&i.cancelRefetch))this.cancel({silent:!0});else if(E(this,Yt))return E(this,Yt).continueRetry(),E(this,Yt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const M=this.observers.find(V=>V.options.queryFn);M&&this.setOptions(M.options)}const n=new AbortController,a=M=>{Object.defineProperty(M,"signal",{enumerable:!0,get:()=>(ne(this,Vn,!0),n.signal)})},l=()=>{const M=ux(this.options,i),ee=(()=>{const q={client:E(this,Wn),queryKey:this.queryKey,meta:this.meta};return a(q),q})();return ne(this,Vn,!1),this.options.persister?this.options.persister(M,ee,this):M(ee)},d=(()=>{const M={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:E(this,Wn),state:this.state,fetchFn:l};return a(M),M})(),_=E(this,no)==="infinite"?wk(this.options.pages):this.options.behavior;_==null||_.onFetch(d,this),ne(this,ao,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((v=d.fetchOptions)==null?void 0:v.meta))&&je(this,$s,or).call(this,{type:"fetch",meta:(g=d.fetchOptions)==null?void 0:g.meta}),ne(this,Yt,dx({initialPromise:i==null?void 0:i.initialPromise,fn:d.fetchFn,onCancel:M=>{M instanceof Nm&&M.revert&&this.setState({...E(this,ao),fetchStatus:"idle"}),n.abort()},onFail:(M,V)=>{je(this,$s,or).call(this,{type:"failed",failureCount:M,error:V})},onPause:()=>{je(this,$s,or).call(this,{type:"pause"})},onContinue:()=>{je(this,$s,or).call(this,{type:"continue"})},retry:d.options.retry,retryDelay:d.options.retryDelay,networkMode:d.options.networkMode,canRun:()=>!0}));try{const M=await E(this,Yt).start();if(M===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(M),(S=(b=E(this,li).config).onSuccess)==null||S.call(b,M,this),(C=(x=E(this,li).config).onSettled)==null||C.call(x,M,this.state.error,this),M}catch(M){if(M instanceof Nm){if(M.silent)return E(this,Yt).promise;if(M.revert){if(this.state.data===void 0)throw M;return this.state.data}}throw je(this,$s,or).call(this,{type:"error",error:M}),(N=(j=E(this,li).config).onError)==null||N.call(j,M,this),(B=(z=E(this,li).config).onSettled)==null||B.call(z,this.state.data,M,this),M}finally{this.scheduleGc()}}},no=new WeakMap,$n=new WeakMap,ao=new WeakMap,li=new WeakMap,Wn=new WeakMap,Yt=new WeakMap,Gl=new WeakMap,Vn=new WeakMap,$s=new WeakSet,mx=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},or=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,..._x(n.data,this.options),fetchMeta:t.meta??null};case"success":const a={...n,...Lb(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ne(this,ao,t.manual?a:void 0),a;case"error":const l=t.error;return{...n,error:l,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:l,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=i(this.state),Ct.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),E(this,li).notify({query:this,type:"updated",action:t})})},XS);function _x(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:hx(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Lb(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function zb(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 Ns,We,Ql,_s,Yn,oo,cr,sn,Zl,lo,co,Gn,Qn,rn,uo,it,Tl,Tm,Om,Am,Rm,Mm,Dm,Bm,px,JS,G_=(JS=class extends la{constructor(t,i){super();fe(this,it);fe(this,Ns);fe(this,We);fe(this,Ql);fe(this,_s);fe(this,Yn);fe(this,oo);fe(this,cr);fe(this,sn);fe(this,Zl);fe(this,lo);fe(this,co);fe(this,Gn);fe(this,Qn);fe(this,rn);fe(this,uo,new Set);this.options=i,ne(this,Ns,t),ne(this,sn,null),ne(this,cr,Em()),this.bindMethods(),this.setOptions(i)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(E(this,We).addObserver(this),qb(E(this,We),this.options)?je(this,it,Tl).call(this):this.updateResult(),je(this,it,Rm).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Lm(E(this,We),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Lm(E(this,We),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,je(this,it,Mm).call(this),je(this,it,Dm).call(this),E(this,We).removeObserver(this)}setOptions(t){const i=this.options,n=E(this,We);if(this.options=E(this,Ns).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ws(this.options.enabled,E(this,We))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");je(this,it,Bm).call(this),E(this,We).setOptions(this.options),i._defaulted&&!Pl(this.options,i)&&E(this,Ns).getQueryCache().notify({type:"observerOptionsUpdated",query:E(this,We),observer:this});const a=this.hasListeners();a&&Pb(E(this,We),n,this.options,i)&&je(this,it,Tl).call(this),this.updateResult(),a&&(E(this,We)!==n||Ws(this.options.enabled,E(this,We))!==Ws(i.enabled,E(this,We))||mn(this.options.staleTime,E(this,We))!==mn(i.staleTime,E(this,We)))&&je(this,it,Tm).call(this);const l=je(this,it,Om).call(this);a&&(E(this,We)!==n||Ws(this.options.enabled,E(this,We))!==Ws(i.enabled,E(this,We))||l!==E(this,rn))&&je(this,it,Am).call(this,l)}getOptimisticResult(t){const i=E(this,Ns).getQueryCache().build(E(this,Ns),t),n=this.createResult(i,t);return Ek(this,n)&&(ne(this,_s,n),ne(this,oo,this.options),ne(this,Yn,E(this,We).state)),n}getCurrentResult(){return E(this,_s)}trackResult(t,i){return new Proxy(t,{get:(n,a)=>(this.trackProp(a),i==null||i(a),a==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&E(this,cr).status==="pending"&&E(this,cr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,a))})}trackProp(t){E(this,uo).add(t)}getCurrentQuery(){return E(this,We)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const i=E(this,Ns).defaultQueryOptions(t),n=E(this,Ns).getQueryCache().build(E(this,Ns),i);return n.fetch().then(()=>this.createResult(n,i))}fetch(t){return je(this,it,Tl).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),E(this,_s)))}createResult(t,i){var he;const n=E(this,We),a=this.options,l=E(this,_s),h=E(this,Yn),d=E(this,oo),m=t!==n?t.state:E(this,Ql),{state:v}=t;let g={...v},b=!1,S;if(i._optimisticResults){const de=this.hasListeners(),ge=!de&&qb(t,i),G=de&&Pb(t,n,i,a);(ge||G)&&(g={...g,..._x(v.data,t.options)}),i._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:x,errorUpdatedAt:C,status:j}=g;S=g.data;let N=!1;if(i.placeholderData!==void 0&&S===void 0&&j==="pending"){let de;l!=null&&l.isPlaceholderData&&i.placeholderData===(d==null?void 0:d.placeholderData)?(de=l.data,N=!0):de=typeof i.placeholderData=="function"?i.placeholderData((he=E(this,co))==null?void 0:he.state.data,E(this,co)):i.placeholderData,de!==void 0&&(j="success",S=km(l==null?void 0:l.data,de,i),b=!0)}if(i.select&&S!==void 0&&!N)if(l&&S===(h==null?void 0:h.data)&&i.select===E(this,Zl))S=E(this,lo);else try{ne(this,Zl,i.select),S=i.select(S),S=km(l==null?void 0:l.data,S,i),ne(this,lo,S),ne(this,sn,null)}catch(de){ne(this,sn,de)}E(this,sn)&&(x=E(this,sn),S=E(this,lo),C=Date.now(),j="error");const z=g.fetchStatus==="fetching",B=j==="pending",M=j==="error",V=B&&z,ee=S!==void 0,te={status:j,fetchStatus:g.fetchStatus,isPending:B,isSuccess:j==="success",isError:M,isInitialLoading:V,isLoading:V,data:S,dataUpdatedAt:g.dataUpdatedAt,error:x,errorUpdatedAt:C,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>m.dataUpdateCount||g.errorUpdateCount>m.errorUpdateCount,isFetching:z,isRefetching:z&&!B,isLoadingError:M&&!ee,isPaused:g.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:M&&ee,isStale:Q_(t,i),refetch:this.refetch,promise:E(this,cr),isEnabled:Ws(i.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const de=te.data!==void 0,ge=te.status==="error"&&!de,G=L=>{ge?L.reject(te.error):de&&L.resolve(te.data)},K=()=>{const L=ne(this,cr,te.promise=Em());G(L)},se=E(this,cr);switch(se.status){case"pending":t.queryHash===n.queryHash&&G(se);break;case"fulfilled":(ge||te.data!==se.value)&&K();break;case"rejected":(!ge||te.error!==se.reason)&&K();break}}return te}updateResult(){const t=E(this,_s),i=this.createResult(E(this,We),this.options);if(ne(this,Yn,E(this,We).state),ne(this,oo,this.options),E(this,Yn).data!==void 0&&ne(this,co,E(this,We)),Pl(i,t))return;ne(this,_s,i);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,l=typeof a=="function"?a():a;if(l==="all"||!l&&!E(this,uo).size)return!0;const h=new Set(l??E(this,uo));return this.options.throwOnError&&h.add("error"),Object.keys(E(this,_s)).some(d=>{const _=d;return E(this,_s)[_]!==t[_]&&h.has(_)})};je(this,it,px).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&je(this,it,Rm).call(this)}},Ns=new WeakMap,We=new WeakMap,Ql=new WeakMap,_s=new WeakMap,Yn=new WeakMap,oo=new WeakMap,cr=new WeakMap,sn=new WeakMap,Zl=new WeakMap,lo=new WeakMap,co=new WeakMap,Gn=new WeakMap,Qn=new WeakMap,rn=new WeakMap,uo=new WeakMap,it=new WeakSet,Tl=function(t){je(this,it,Bm).call(this);let i=E(this,We).fetch(this.options,t);return t!=null&&t.throwOnError||(i=i.catch(ds)),i},Tm=function(){je(this,it,Mm).call(this);const t=mn(this.options.staleTime,E(this,We));if(Hl.isServer()||E(this,_s).isStale||!Cm(t))return;const n=cx(E(this,_s).dataUpdatedAt,t)+1;ne(this,Gn,In.setTimeout(()=>{E(this,_s).isStale||this.updateResult()},n))},Om=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(E(this,We)):this.options.refetchInterval)??!1},Am=function(t){je(this,it,Dm).call(this),ne(this,rn,t),!(Hl.isServer()||Ws(this.options.enabled,E(this,We))===!1||!Cm(E(this,rn))||E(this,rn)===0)&&ne(this,Qn,In.setInterval(()=>{(this.options.refetchIntervalInBackground||K_.isFocused())&&je(this,it,Tl).call(this)},E(this,rn)))},Rm=function(){je(this,it,Tm).call(this),je(this,it,Am).call(this,je(this,it,Om).call(this))},Mm=function(){E(this,Gn)!==void 0&&(In.clearTimeout(E(this,Gn)),ne(this,Gn,void 0))},Dm=function(){E(this,Qn)!==void 0&&(In.clearInterval(E(this,Qn)),ne(this,Qn,void 0))},Bm=function(){const t=E(this,Ns).getQueryCache().build(E(this,Ns),this.options);if(t===E(this,We))return;const i=E(this,We);ne(this,We,t),ne(this,Ql,t.state),this.hasListeners()&&(i==null||i.removeObserver(this),t.addObserver(this))},px=function(t){Ct.batch(()=>{t.listeners&&this.listeners.forEach(i=>{i(E(this,_s))}),E(this,Ns).getQueryCache().notify({query:E(this,We),type:"observerResultsUpdated"})})},JS);function kk(e,t){return Ws(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Ws(t.retryOnMount,e)===!1)}function qb(e,t){return kk(e,t)||e.state.data!==void 0&&Lm(e,t,t.refetchOnMount)}function Lm(e,t,i){if(Ws(t.enabled,e)!==!1&&mn(t.staleTime,e)!=="static"){const n=typeof i=="function"?i(e):i;return n==="always"||n!==!1&&Q_(e,t)}return!1}function Pb(e,t,i,n){return(e!==t||Ws(n.enabled,e)===!1)&&(!i.suspense||e.state.status!=="error")&&Q_(e,i)}function Q_(e,t){return Ws(t.enabled,e)!==!1&&e.isStaleByTime(mn(t.staleTime,e))}function Ek(e,t){return!Pl(e.getCurrentResult(),t)}var Xl,Ai,hs,Zn,Ri,Yr,ex,Nk=(ex=class extends fx{constructor(t){super();fe(this,Ri);fe(this,Xl);fe(this,Ai);fe(this,hs);fe(this,Zn);ne(this,Xl,t.client),this.mutationId=t.mutationId,ne(this,hs,t.mutationCache),ne(this,Ai,[]),this.state=t.state||vx(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){E(this,Ai).includes(t)||(E(this,Ai).push(t),this.clearGcTimeout(),E(this,hs).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ne(this,Ai,E(this,Ai).filter(i=>i!==t)),this.scheduleGc(),E(this,hs).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){E(this,Ai).length||(this.state.status==="pending"?this.scheduleGc():E(this,hs).remove(this))}continue(){var t;return((t=E(this,Zn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var h,d,_,m,v,g,b,S,x,C,j,N,z,B,M,V,ee,q;const i=()=>{je(this,Ri,Yr).call(this,{type:"continue"})},n={client:E(this,Xl),meta:this.options.meta,mutationKey:this.options.mutationKey};ne(this,Zn,dx({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(te,he)=>{je(this,Ri,Yr).call(this,{type:"failed",failureCount:te,error:he})},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:()=>E(this,hs).canRun(this)}));const a=this.state.status==="pending",l=!E(this,Zn).canStart();try{if(a)i();else{je(this,Ri,Yr).call(this,{type:"pending",variables:t,isPaused:l}),E(this,hs).config.onMutate&&await E(this,hs).config.onMutate(t,this,n);const he=await((d=(h=this.options).onMutate)==null?void 0:d.call(h,t,n));he!==this.state.context&&je(this,Ri,Yr).call(this,{type:"pending",context:he,variables:t,isPaused:l})}const te=await E(this,Zn).start();return await((m=(_=E(this,hs).config).onSuccess)==null?void 0:m.call(_,te,t,this.state.context,this,n)),await((g=(v=this.options).onSuccess)==null?void 0:g.call(v,te,t,this.state.context,n)),await((S=(b=E(this,hs).config).onSettled)==null?void 0:S.call(b,te,null,this.state.variables,this.state.context,this,n)),await((C=(x=this.options).onSettled)==null?void 0:C.call(x,te,null,t,this.state.context,n)),je(this,Ri,Yr).call(this,{type:"success",data:te}),te}catch(te){try{await((N=(j=E(this,hs).config).onError)==null?void 0:N.call(j,te,t,this.state.context,this,n))}catch(he){Promise.reject(he)}try{await((B=(z=this.options).onError)==null?void 0:B.call(z,te,t,this.state.context,n))}catch(he){Promise.reject(he)}try{await((V=(M=E(this,hs).config).onSettled)==null?void 0:V.call(M,void 0,te,this.state.variables,this.state.context,this,n))}catch(he){Promise.reject(he)}try{await((q=(ee=this.options).onSettled)==null?void 0:q.call(ee,void 0,te,t,this.state.context,n))}catch(he){Promise.reject(he)}throw je(this,Ri,Yr).call(this,{type:"error",error:te}),te}finally{E(this,hs).runNext(this)}}},Xl=new WeakMap,Ai=new WeakMap,hs=new WeakMap,Zn=new WeakMap,Ri=new WeakSet,Yr=function(t){const i=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=i(this.state),Ct.batch(()=>{E(this,Ai).forEach(n=>{n.onMutationUpdate(t)}),E(this,hs).notify({mutation:this,type:"updated",action:t})})},ex);function vx(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ur,vi,Jl,tx,Tk=(tx=class extends la{constructor(t={}){super();fe(this,ur);fe(this,vi);fe(this,Jl);this.config=t,ne(this,ur,new Set),ne(this,vi,new Map),ne(this,Jl,0)}build(t,i,n){const a=new Nk({client:t,mutationCache:this,mutationId:++Nu(this,Jl)._,options:t.defaultMutationOptions(i),state:n});return this.add(a),a}add(t){E(this,ur).add(t);const i=Tu(t);if(typeof i=="string"){const n=E(this,vi).get(i);n?n.push(t):E(this,vi).set(i,[t])}this.notify({type:"added",mutation:t})}remove(t){if(E(this,ur).delete(t)){const i=Tu(t);if(typeof i=="string"){const n=E(this,vi).get(i);if(n)if(n.length>1){const a=n.indexOf(t);a!==-1&&n.splice(a,1)}else n[0]===t&&E(this,vi).delete(i)}}this.notify({type:"removed",mutation:t})}canRun(t){const i=Tu(t);if(typeof i=="string"){const n=E(this,vi).get(i),a=n==null?void 0:n.find(l=>l.state.status==="pending");return!a||a===t}else return!0}runNext(t){var n;const i=Tu(t);if(typeof i=="string"){const a=(n=E(this,vi).get(i))==null?void 0:n.find(l=>l!==t&&l.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Ct.batch(()=>{E(this,ur).forEach(t=>{this.notify({type:"removed",mutation:t})}),E(this,ur).clear(),E(this,vi).clear()})}getAll(){return Array.from(E(this,ur))}find(t){const i={exact:!0,...t};return this.getAll().find(n=>Rb(i,n))}findAll(t={}){return this.getAll().filter(i=>Rb(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(ds))))}},ur=new WeakMap,vi=new WeakMap,Jl=new WeakMap,tx);function Tu(e){var t;return(t=e.options.scope)==null?void 0:t.id}var hr,nn,Ts,dr,pr,Vu,zm,sx,Ok=(sx=class extends la{constructor(i,n){super();fe(this,pr);fe(this,hr);fe(this,nn);fe(this,Ts);fe(this,dr);ne(this,hr,i),this.setOptions(n),this.bindMethods(),je(this,pr,Vu).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(i){var a;const n=this.options;this.options=E(this,hr).defaultMutationOptions(i),Pl(this.options,n)||E(this,hr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:E(this,Ts),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&ea(n.mutationKey)!==ea(this.options.mutationKey)?this.reset():((a=E(this,Ts))==null?void 0:a.state.status)==="pending"&&E(this,Ts).setOptions(this.options)}onUnsubscribe(){var i;this.hasListeners()||(i=E(this,Ts))==null||i.removeObserver(this)}onMutationUpdate(i){je(this,pr,Vu).call(this),je(this,pr,zm).call(this,i)}getCurrentResult(){return E(this,nn)}reset(){var i;(i=E(this,Ts))==null||i.removeObserver(this),ne(this,Ts,void 0),je(this,pr,Vu).call(this),je(this,pr,zm).call(this)}mutate(i,n){var a;return ne(this,dr,n),(a=E(this,Ts))==null||a.removeObserver(this),ne(this,Ts,E(this,hr).getMutationCache().build(E(this,hr),this.options)),E(this,Ts).addObserver(this),E(this,Ts).execute(i)}},hr=new WeakMap,nn=new WeakMap,Ts=new WeakMap,dr=new WeakMap,pr=new WeakSet,Vu=function(){var n;const i=((n=E(this,Ts))==null?void 0:n.state)??vx();ne(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})},zm=function(i){Ct.batch(()=>{var n,a,l,h,d,_,m,v;if(E(this,dr)&&this.hasListeners()){const g=E(this,nn).variables,b=E(this,nn).context,S={client:E(this,hr),meta:this.options.meta,mutationKey:this.options.mutationKey};if((i==null?void 0:i.type)==="success"){try{(a=(n=E(this,dr)).onSuccess)==null||a.call(n,i.data,g,b,S)}catch(x){Promise.reject(x)}try{(h=(l=E(this,dr)).onSettled)==null||h.call(l,i.data,null,g,b,S)}catch(x){Promise.reject(x)}}else if((i==null?void 0:i.type)==="error"){try{(_=(d=E(this,dr)).onError)==null||_.call(d,i.error,g,b,S)}catch(x){Promise.reject(x)}try{(v=(m=E(this,dr)).onSettled)==null||v.call(m,void 0,i.error,g,b,S)}catch(x){Promise.reject(x)}}}this.listeners.forEach(g=>{g(E(this,nn))})})},sx);function Hb(e,t){const i=new Set(t);return e.filter(n=>!i.has(n))}function Ak(e,t,i){const n=e.slice(0);return n[t]=i,n}var ho,Os,fo,Xn,Ks,an,ec,tc,sc,ic,$t,qm,Pm,gx,Hm,Im,Um,ix,Rk=(ix=class extends la{constructor(t,i,n){super();fe(this,$t);fe(this,ho);fe(this,Os);fe(this,fo);fe(this,Xn);fe(this,Ks);fe(this,an);fe(this,ec);fe(this,tc);fe(this,sc);fe(this,ic,[]);ne(this,ho,t),ne(this,Xn,n),ne(this,fo,[]),ne(this,Ks,[]),ne(this,Os,[]),this.setQueries(i)}onSubscribe(){this.listeners.size===1&&E(this,Ks).forEach(t=>{t.subscribe(i=>{je(this,$t,Im).call(this,t,i)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,E(this,Ks).forEach(t=>{t.destroy()})}setQueries(t,i){ne(this,fo,t),ne(this,Xn,i),Ct.batch(()=>{const n=E(this,Ks),a=je(this,$t,Hm).call(this,E(this,fo));a.forEach(g=>g.observer.setOptions(g.defaultedQueryOptions));const l=a.map(g=>g.observer),h=l.map(g=>g.getCurrentResult()),d=n.length!==l.length,_=l.some((g,b)=>g!==n[b]),m=d||_,v=m?!0:h.some((g,b)=>{const S=E(this,Os)[b];return!S||!Pl(g,S)});!m&&!v||(m&&(ne(this,ic,a),ne(this,Ks,l)),ne(this,Os,h),this.hasListeners()&&(m&&(Hb(n,l).forEach(g=>{g.destroy()}),Hb(l,n).forEach(g=>{g.subscribe(b=>{je(this,$t,Im).call(this,g,b)})})),je(this,$t,Um).call(this)))})}getCurrentResult(){return E(this,Os)}getQueries(){return E(this,Ks).map(t=>t.getCurrentQuery())}getObservers(){return E(this,Ks)}getOptimisticResult(t,i){const n=je(this,$t,Hm).call(this,t),a=n.map(h=>h.observer.getOptimisticResult(h.defaultedQueryOptions)),l=n.map(h=>h.defaultedQueryOptions.queryHash);return[a,h=>je(this,$t,Pm).call(this,h??a,i,l),()=>je(this,$t,qm).call(this,a,n)]}},ho=new WeakMap,Os=new WeakMap,fo=new WeakMap,Xn=new WeakMap,Ks=new WeakMap,an=new WeakMap,ec=new WeakMap,tc=new WeakMap,sc=new WeakMap,ic=new WeakMap,$t=new WeakSet,qm=function(t,i){return i.map((n,a)=>{const l=t[a];return n.defaultedQueryOptions.notifyOnChangeProps?l:n.observer.trackResult(l,h=>{i.forEach(d=>{d.observer.trackProp(h)})})})},Pm=function(t,i,n){if(i){const a=E(this,sc),l=n!==void 0&&a!==void 0&&(a.length!==n.length||n.some((h,d)=>h!==a[d]));return(!E(this,an)||E(this,Os)!==E(this,tc)||l||i!==E(this,ec))&&(ne(this,ec,i),ne(this,tc,E(this,Os)),n!==void 0&&ne(this,sc,n),ne(this,an,W_(E(this,an),i(t)))),E(this,an)}return t},gx=function(){var t;return((t=E(this,Xn))==null?void 0:t.combine)!==void 0&&E(this,Ks).some((i,n)=>{var a;return i.options.suspense&&((a=E(this,Os)[n])==null?void 0:a.data)===void 0})},Hm=function(t){const i=new Map;E(this,Ks).forEach(a=>{const l=a.options.queryHash;if(!l)return;const h=i.get(l);h?h.push(a):i.set(l,[a])});const n=[];return t.forEach(a=>{var _;const l=E(this,ho).defaultQueryOptions(a),d=((_=i.get(l.queryHash))==null?void 0:_.shift())??new G_(E(this,ho),l);n.push({defaultedQueryOptions:l,observer:d})}),n},Im=function(t,i){const n=E(this,Ks).indexOf(t);n!==-1&&(ne(this,Os,Ak(E(this,Os),n,i)),je(this,$t,Um).call(this))},Um=function(){var t;if(this.hasListeners()){const i=je(this,$t,qm).call(this,E(this,Os),E(this,ic)),n=je(this,$t,gx).call(this),a=E(this,an),l=n?a:je(this,$t,Pm).call(this,i,(t=E(this,Xn))==null?void 0:t.combine);(n||a!==l)&&Ct.batch(()=>{this.listeners.forEach(h=>{h(E(this,Os))})})}},ix),Mi,rx,Mk=(rx=class extends la{constructor(t={}){super();fe(this,Mi);this.config=t,ne(this,Mi,new Map)}build(t,i,n){const a=i.queryKey,l=i.queryHash??$_(a,i);let h=this.get(l);return h||(h=new jk({client:t,queryKey:a,queryHash:l,options:t.defaultQueryOptions(i),state:n,defaultOptions:t.getQueryDefaults(a)}),this.add(h)),h}add(t){E(this,Mi).has(t.queryHash)||(E(this,Mi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const i=E(this,Mi).get(t.queryHash);i&&(t.destroy(),i===t&&E(this,Mi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ct.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return E(this,Mi).get(t)}getAll(){return[...E(this,Mi).values()]}find(t){const i={exact:!0,...t};return this.getAll().find(n=>Ab(i,n))}findAll(t={}){const i=this.getAll();return Object.keys(t).length>0?i.filter(n=>Ab(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,rx),xt,on,ln,mo,_o,cn,po,vo,nx,Dk=(nx=class{constructor(e={}){fe(this,xt);fe(this,on);fe(this,ln);fe(this,mo);fe(this,_o);fe(this,cn);fe(this,po);fe(this,vo);ne(this,xt,e.queryCache||new Mk),ne(this,on,e.mutationCache||new Tk),ne(this,ln,e.defaultOptions||{}),ne(this,mo,new Map),ne(this,_o,new Map),ne(this,cn,0)}mount(){Nu(this,cn)._++,E(this,cn)===1&&(ne(this,po,K_.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,xt).onFocus())})),ne(this,vo,th.subscribe(async e=>{e&&(await this.resumePausedMutations(),E(this,xt).onOnline())})))}unmount(){var e,t;Nu(this,cn)._--,E(this,cn)===0&&((e=E(this,po))==null||e.call(this),ne(this,po,void 0),(t=E(this,vo))==null||t.call(this),ne(this,vo,void 0))}isFetching(e){return E(this,xt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return E(this,on).findAll({...e,status:"pending"}).length}getQueryData(e){var i;const t=this.defaultQueryOptions({queryKey:e});return(i=E(this,xt).get(t.queryHash))==null?void 0:i.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),i=E(this,xt).build(this,t),n=i.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&i.isStaleByTime(mn(t.staleTime,i))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return E(this,xt).findAll(e).map(({queryKey:t,state:i})=>{const n=i.data;return[t,n]})}setQueryData(e,t,i){const n=this.defaultQueryOptions({queryKey:e}),a=E(this,xt).get(n.queryHash),l=a==null?void 0:a.state.data,h=fk(t,l);if(h!==void 0)return E(this,xt).build(this,n).setData(h,{...i,manual:!0})}setQueriesData(e,t,i){return Ct.batch(()=>E(this,xt).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,i)]))}getQueryState(e){var i;const t=this.defaultQueryOptions({queryKey:e});return(i=E(this,xt).get(t.queryHash))==null?void 0:i.state}removeQueries(e){const t=E(this,xt);Ct.batch(()=>{t.findAll(e).forEach(i=>{t.remove(i)})})}resetQueries(e,t){const i=E(this,xt);return Ct.batch(()=>(i.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const i={revert:!0,...t},n=Ct.batch(()=>E(this,xt).findAll(e).map(a=>a.cancel(i)));return Promise.all(n).then(ds).catch(ds)}invalidateQueries(e,t={}){return Ct.batch(()=>(E(this,xt).findAll(e).forEach(i=>{i.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const i={...t,cancelRefetch:t.cancelRefetch??!0},n=Ct.batch(()=>E(this,xt).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let l=a.fetch(void 0,i);return i.throwOnError||(l=l.catch(ds)),a.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(n).then(ds)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const i=E(this,xt).build(this,t);return i.isStaleByTime(mn(t.staleTime,i))?i.fetch(t):Promise.resolve(i.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ds).catch(ds)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ds).catch(ds)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return th.isOnline()?E(this,on).resumePausedMutations():Promise.resolve()}getQueryCache(){return E(this,xt)}getMutationCache(){return E(this,on)}getDefaultOptions(){return E(this,ln)}setDefaultOptions(e){ne(this,ln,e)}setQueryDefaults(e,t){E(this,mo).set(ea(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...E(this,mo).values()],i={};return t.forEach(n=>{go(e,n.queryKey)&&Object.assign(i,n.defaultOptions)}),i}setMutationDefaults(e,t){E(this,_o).set(ea(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...E(this,_o).values()],i={};return t.forEach(n=>{go(e,n.mutationKey)&&Object.assign(i,n.defaultOptions)}),i}defaultQueryOptions(e){if(e._defaulted)return e;const t={...E(this,ln).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=$_(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===V_&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...E(this,ln).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){E(this,xt).clear(),E(this,on).clear()}},xt=new WeakMap,on=new WeakMap,ln=new WeakMap,mo=new WeakMap,_o=new WeakMap,cn=new WeakMap,po=new WeakMap,vo=new WeakMap,nx),Yf={exports:{}},Oe={};/**
|
|
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 Ib;function Bk(){if(Ib)return Oe;Ib=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"),l=Symbol.for("react.consumer"),h=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function S(A){return A===null||typeof A!="object"?null:(A=b&&A[b]||A["@@iterator"],typeof A=="function"?A:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,j={};function N(A,Q,ae){this.props=A,this.context=Q,this.refs=j,this.updater=ae||x}N.prototype.isReactComponent={},N.prototype.setState=function(A,Q){if(typeof A!="object"&&typeof A!="function"&&A!=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,A,Q,"setState")},N.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function z(){}z.prototype=N.prototype;function B(A,Q,ae){this.props=A,this.context=Q,this.refs=j,this.updater=ae||x}var M=B.prototype=new z;M.constructor=B,C(M,N.prototype),M.isPureReactComponent=!0;var V=Array.isArray;function ee(){}var q={H:null,A:null,T:null,S:null},te=Object.prototype.hasOwnProperty;function he(A,Q,ae){var $=ae.ref;return{$$typeof:e,type:A,key:Q,ref:$!==void 0?$:null,props:ae}}function de(A,Q){return he(A.type,Q,A.props)}function ge(A){return typeof A=="object"&&A!==null&&A.$$typeof===e}function G(A){var Q={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(ae){return Q[ae]})}var K=/\/+/g;function se(A,Q){return typeof A=="object"&&A!==null&&A.key!=null?G(""+A.key):Q.toString(36)}function L(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(ee,ee):(A.status="pending",A.then(function(Q){A.status==="pending"&&(A.status="fulfilled",A.value=Q)},function(Q){A.status==="pending"&&(A.status="rejected",A.reason=Q)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function T(A,Q,ae,$,le){var ye=typeof A;(ye==="undefined"||ye==="boolean")&&(A=null);var Be=!1;if(A===null)Be=!0;else switch(ye){case"bigint":case"string":case"number":Be=!0;break;case"object":switch(A.$$typeof){case e:case t:Be=!0;break;case v:return Be=A._init,T(Be(A._payload),Q,ae,$,le)}}if(Be)return le=le(A),Be=$===""?"."+se(A,0):$,V(le)?(ae="",Be!=null&&(ae=Be.replace(K,"$&/")+"/"),T(le,Q,ae,"",function(As){return As})):le!=null&&(ge(le)&&(le=de(le,ae+(le.key==null||A&&A.key===le.key?"":(""+le.key).replace(K,"$&/")+"/")+Be)),Q.push(le)),1;Be=0;var kt=$===""?".":$+":";if(V(A))for(var Qe=0;Qe<A.length;Qe++)$=A[Qe],ye=kt+se($,Qe),Be+=T($,Q,ae,ye,le);else if(Qe=S(A),typeof Qe=="function")for(A=Qe.call(A),Qe=0;!($=A.next()).done;)$=$.value,ye=kt+se($,Qe++),Be+=T($,Q,ae,ye,le);else if(ye==="object"){if(typeof A.then=="function")return T(L(A),Q,ae,$,le);throw Q=String(A),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return Be}function U(A,Q,ae){if(A==null)return A;var $=[],le=0;return T(A,$,"","",function(ye){return Q.call(ae,ye,le++)}),$}function F(A){if(A._status===-1){var Q=A._result;Q=Q(),Q.then(function(ae){(A._status===0||A._status===-1)&&(A._status=1,A._result=ae)},function(ae){(A._status===0||A._status===-1)&&(A._status=2,A._result=ae)}),A._status===-1&&(A._status=0,A._result=Q)}if(A._status===1)return A._result.default;throw A._result}var me=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},Ce={map:U,forEach:function(A,Q,ae){U(A,function(){Q.apply(this,arguments)},ae)},count:function(A){var Q=0;return U(A,function(){Q++}),Q},toArray:function(A){return U(A,function(Q){return Q})||[]},only:function(A){if(!ge(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return Oe.Activity=g,Oe.Children=Ce,Oe.Component=N,Oe.Fragment=i,Oe.Profiler=a,Oe.PureComponent=B,Oe.StrictMode=n,Oe.Suspense=_,Oe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=q,Oe.__COMPILER_RUNTIME={__proto__:null,c:function(A){return q.H.useMemoCache(A)}},Oe.cache=function(A){return function(){return A.apply(null,arguments)}},Oe.cacheSignal=function(){return null},Oe.cloneElement=function(A,Q,ae){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var $=C({},A.props),le=A.key;if(Q!=null)for(ye in Q.key!==void 0&&(le=""+Q.key),Q)!te.call(Q,ye)||ye==="key"||ye==="__self"||ye==="__source"||ye==="ref"&&Q.ref===void 0||($[ye]=Q[ye]);var ye=arguments.length-2;if(ye===1)$.children=ae;else if(1<ye){for(var Be=Array(ye),kt=0;kt<ye;kt++)Be[kt]=arguments[kt+2];$.children=Be}return he(A.type,le,$)},Oe.createContext=function(A){return A={$$typeof:h,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:l,_context:A},A},Oe.createElement=function(A,Q,ae){var $,le={},ye=null;if(Q!=null)for($ in Q.key!==void 0&&(ye=""+Q.key),Q)te.call(Q,$)&&$!=="key"&&$!=="__self"&&$!=="__source"&&(le[$]=Q[$]);var Be=arguments.length-2;if(Be===1)le.children=ae;else if(1<Be){for(var kt=Array(Be),Qe=0;Qe<Be;Qe++)kt[Qe]=arguments[Qe+2];le.children=kt}if(A&&A.defaultProps)for($ in Be=A.defaultProps,Be)le[$]===void 0&&(le[$]=Be[$]);return he(A,ye,le)},Oe.createRef=function(){return{current:null}},Oe.forwardRef=function(A){return{$$typeof:d,render:A}},Oe.isValidElement=ge,Oe.lazy=function(A){return{$$typeof:v,_payload:{_status:-1,_result:A},_init:F}},Oe.memo=function(A,Q){return{$$typeof:m,type:A,compare:Q===void 0?null:Q}},Oe.startTransition=function(A){var Q=q.T,ae={};q.T=ae;try{var $=A(),le=q.S;le!==null&&le(ae,$),typeof $=="object"&&$!==null&&typeof $.then=="function"&&$.then(ee,me)}catch(ye){me(ye)}finally{Q!==null&&ae.types!==null&&(Q.types=ae.types),q.T=Q}},Oe.unstable_useCacheRefresh=function(){return q.H.useCacheRefresh()},Oe.use=function(A){return q.H.use(A)},Oe.useActionState=function(A,Q,ae){return q.H.useActionState(A,Q,ae)},Oe.useCallback=function(A,Q){return q.H.useCallback(A,Q)},Oe.useContext=function(A){return q.H.useContext(A)},Oe.useDebugValue=function(){},Oe.useDeferredValue=function(A,Q){return q.H.useDeferredValue(A,Q)},Oe.useEffect=function(A,Q){return q.H.useEffect(A,Q)},Oe.useEffectEvent=function(A){return q.H.useEffectEvent(A)},Oe.useId=function(){return q.H.useId()},Oe.useImperativeHandle=function(A,Q,ae){return q.H.useImperativeHandle(A,Q,ae)},Oe.useInsertionEffect=function(A,Q){return q.H.useInsertionEffect(A,Q)},Oe.useLayoutEffect=function(A,Q){return q.H.useLayoutEffect(A,Q)},Oe.useMemo=function(A,Q){return q.H.useMemo(A,Q)},Oe.useOptimistic=function(A,Q){return q.H.useOptimistic(A,Q)},Oe.useReducer=function(A,Q,ae){return q.H.useReducer(A,Q,ae)},Oe.useRef=function(A){return q.H.useRef(A)},Oe.useState=function(A){return q.H.useState(A)},Oe.useSyncExternalStore=function(A,Q,ae){return q.H.useSyncExternalStore(A,Q,ae)},Oe.useTransition=function(){return q.H.useTransition()},Oe.version="19.2.8",Oe}var Ub;function Z_(){return Ub||(Ub=1,Yf.exports=Bk()),Yf.exports}var k=Z_(),yx=k.createContext(void 0),Ye=e=>{const t=k.useContext(yx);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Lk=({client:e,children:t})=>(k.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(yx.Provider,{value:e,children:t})),bx=k.createContext(!1),Sx=()=>k.useContext(bx);bx.Provider;function zk(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var qk=k.createContext(zk()),xx=()=>k.useContext(qk),wx=(e,t,i)=>{const n=i!=null&&i.state.error&&typeof e.throwOnError=="function"?Y_(e.throwOnError,[i.state.error,i]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},Cx=e=>{k.useEffect(()=>{e.clearReset()},[e])},jx=({result:e,errorResetBoundary:t,throwOnError:i,query:n,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(a&&e.data===void 0||Y_(i,[e.error,n])),kx=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))}},Pk=(e,t)=>e.isLoading&&e.isFetching&&!t,Fm=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Km=(e,t,i)=>t.fetchOptimistic(e).catch(()=>{i.clearReset()});function Ex({queries:e,...t},i){const n=Ye(),a=Sx(),l=xx(),h=k.useMemo(()=>e.map(C=>{const j=n.defaultQueryOptions(C);return j._optimisticResults=a?"isRestoring":"optimistic",j}),[e,n,a]);h.forEach(C=>{kx(C);const j=n.getQueryCache().get(C.queryHash);wx(C,l,j)}),Cx(l);const[d]=k.useState(()=>new Rk(n,h,t)),[_,m,v]=d.getOptimisticResult(h,t.combine),g=!a&&t.subscribed!==!1;k.useSyncExternalStore(k.useCallback(C=>g?d.subscribe(Ct.batchCalls(C)):ds,[d,g]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),k.useEffect(()=>{d.setQueries(h,t)},[h,t,d]);const S=_.some((C,j)=>Fm(h[j],C))?_.flatMap((C,j)=>{const N=h[j];if(N&&Fm(N,C)){const z=new G_(n,N);return Km(N,z,l)}return[]}):[];if(S.length>0)throw Promise.all(S);const x=_.find((C,j)=>{const N=h[j];return N&&jx({result:C,errorResetBoundary:l,throwOnError:N.throwOnError,query:n.getQueryCache().get(N.queryHash),suspense:N.suspense})});if(x!=null&&x.error)throw x.error;return m(v())}function Hk(e,t,i){var S,x,C,j;const n=Sx(),a=xx(),l=Ye(),h=l.defaultQueryOptions(e);(x=(S=l.getDefaultOptions().queries)==null?void 0:S._experimental_beforeQuery)==null||x.call(S,h);const d=l.getQueryCache().get(h.queryHash),_=e.subscribed!==!1;h._optimisticResults=n?"isRestoring":_?"optimistic":void 0,kx(h),wx(h,a,d),Cx(a);const m=!l.getQueryCache().get(h.queryHash),[v]=k.useState(()=>new t(l,h)),g=v.getOptimisticResult(h),b=!n&&_;if(k.useSyncExternalStore(k.useCallback(N=>{const z=b?v.subscribe(Ct.batchCalls(N)):ds;return v.updateResult(),z},[v,b]),()=>v.getCurrentResult(),()=>v.getCurrentResult()),k.useEffect(()=>{v.setOptions(h)},[h,v]),Fm(h,g))throw Km(h,v,a);if(jx({result:g,errorResetBoundary:a,throwOnError:h.throwOnError,query:d,suspense:h.suspense}))throw g.error;if((j=(C=l.getDefaultOptions().queries)==null?void 0:C._experimental_afterQuery)==null||j.call(C,h,g),h.experimental_prefetchInRender&&!Hl.isServer()&&Pk(g,n)){const N=m?Km(h,v,a):d==null?void 0:d.promise;N==null||N.catch(ds).finally(()=>{v.updateResult()})}return h.notifyOnChangeProps?g:v.trackResult(g)}function Ae(e,t){return Hk(e,G_)}function Ve(e,t){const i=Ye(),[n]=k.useState(()=>new Ok(i,e));k.useEffect(()=>{n.setOptions(e)},[n,e]);const a=k.useSyncExternalStore(k.useCallback(h=>n.subscribe(Ct.batchCalls(h)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),l=k.useCallback((h,d)=>{n.mutate(h,d).catch(ds)},[n]);if(a.error&&Y_(n.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:l,mutateAsync:a.mutate}}var Gf={exports:{}},xl={},Qf={exports:{}},Zf={};/**
|
|
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 Fb;function Ik(){return Fb||(Fb=1,(function(e){function t(T,U){var F=T.length;T.push(U);e:for(;0<F;){var me=F-1>>>1,Ce=T[me];if(0<a(Ce,U))T[me]=U,T[F]=Ce,F=me;else break e}}function i(T){return T.length===0?null:T[0]}function n(T){if(T.length===0)return null;var U=T[0],F=T.pop();if(F!==U){T[0]=F;e:for(var me=0,Ce=T.length,A=Ce>>>1;me<A;){var Q=2*(me+1)-1,ae=T[Q],$=Q+1,le=T[$];if(0>a(ae,F))$<Ce&&0>a(le,ae)?(T[me]=le,T[$]=F,me=$):(T[me]=ae,T[Q]=F,me=Q);else if($<Ce&&0>a(le,F))T[me]=le,T[$]=F,me=$;else break e}}return U}function a(T,U){var F=T.sortIndex-U.sortIndex;return F!==0?F:T.id-U.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var h=Date,d=h.now();e.unstable_now=function(){return h.now()-d}}var _=[],m=[],v=1,g=null,b=3,S=!1,x=!1,C=!1,j=!1,N=typeof setTimeout=="function"?setTimeout:null,z=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function M(T){for(var U=i(m);U!==null;){if(U.callback===null)n(m);else if(U.startTime<=T)n(m),U.sortIndex=U.expirationTime,t(_,U);else break;U=i(m)}}function V(T){if(C=!1,M(T),!x)if(i(_)!==null)x=!0,ee||(ee=!0,G());else{var U=i(m);U!==null&&L(V,U.startTime-T)}}var ee=!1,q=-1,te=5,he=-1;function de(){return j?!0:!(e.unstable_now()-he<te)}function ge(){if(j=!1,ee){var T=e.unstable_now();he=T;var U=!0;try{e:{x=!1,C&&(C=!1,z(q),q=-1),S=!0;var F=b;try{t:{for(M(T),g=i(_);g!==null&&!(g.expirationTime>T&&de());){var me=g.callback;if(typeof me=="function"){g.callback=null,b=g.priorityLevel;var Ce=me(g.expirationTime<=T);if(T=e.unstable_now(),typeof Ce=="function"){g.callback=Ce,M(T),U=!0;break t}g===i(_)&&n(_),M(T)}else n(_);g=i(_)}if(g!==null)U=!0;else{var A=i(m);A!==null&&L(V,A.startTime-T),U=!1}}break e}finally{g=null,b=F,S=!1}U=void 0}}finally{U?G():ee=!1}}}var G;if(typeof B=="function")G=function(){B(ge)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,se=K.port2;K.port1.onmessage=ge,G=function(){se.postMessage(null)}}else G=function(){N(ge,0)};function L(T,U){q=N(function(){T(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(T){T.callback=null},e.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):te=0<T?Math.floor(1e3/T):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(T){switch(b){case 1:case 2:case 3:var U=3;break;default:U=b}var F=b;b=U;try{return T()}finally{b=F}},e.unstable_requestPaint=function(){j=!0},e.unstable_runWithPriority=function(T,U){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var F=b;b=T;try{return U()}finally{b=F}},e.unstable_scheduleCallback=function(T,U,F){var me=e.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?me+F:me):F=me,T){case 1:var Ce=-1;break;case 2:Ce=250;break;case 5:Ce=1073741823;break;case 4:Ce=1e4;break;default:Ce=5e3}return Ce=F+Ce,T={id:v++,callback:U,priorityLevel:T,startTime:F,expirationTime:Ce,sortIndex:-1},F>me?(T.sortIndex=F,t(m,T),i(_)===null&&T===i(m)&&(C?(z(q),q=-1):C=!0,L(V,F-me))):(T.sortIndex=Ce,t(_,T),x||S||(x=!0,ee||(ee=!0,G()))),T},e.unstable_shouldYield=de,e.unstable_wrapCallback=function(T){var U=b;return function(){var F=b;b=U;try{return T.apply(this,arguments)}finally{b=F}}}})(Zf)),Zf}var Kb;function Uk(){return Kb||(Kb=1,Qf.exports=Ik()),Qf.exports}var Xf={exports:{}},cs={};/**
|
|
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 $b;function Fk(){if($b)return cs;$b=1;var e=Z_();function t(_){var m="https://react.dev/errors/"+_;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)m+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+_+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var n={d:{f:i,r:function(){throw Error(t(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},a=Symbol.for("react.portal");function l(_,m,v){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:g==null?null:""+g,children:_,containerInfo:m,implementation:v}}var h=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(_,m){if(_==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return cs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,cs.createPortal=function(_,m){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(t(299));return l(_,m,null,v)},cs.flushSync=function(_){var m=h.T,v=n.p;try{if(h.T=null,n.p=2,_)return _()}finally{h.T=m,n.p=v,n.d.f()}},cs.preconnect=function(_,m){typeof _=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,n.d.C(_,m))},cs.prefetchDNS=function(_){typeof _=="string"&&n.d.D(_)},cs.preinit=function(_,m){if(typeof _=="string"&&m&&typeof m.as=="string"){var v=m.as,g=d(v,m.crossOrigin),b=typeof m.integrity=="string"?m.integrity:void 0,S=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;v==="style"?n.d.S(_,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:S}):v==="script"&&n.d.X(_,{crossOrigin:g,integrity:b,fetchPriority:S,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},cs.preinitModule=function(_,m){if(typeof _=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var v=d(m.as,m.crossOrigin);n.d.M(_,{crossOrigin:v,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&n.d.M(_)},cs.preload=function(_,m){if(typeof _=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var v=m.as,g=d(v,m.crossOrigin);n.d.L(_,v,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},cs.preloadModule=function(_,m){if(typeof _=="string")if(m){var v=d(m.as,m.crossOrigin);n.d.m(_,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:v,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else n.d.m(_)},cs.requestFormReset=function(_){n.d.r(_)},cs.unstable_batchedUpdates=function(_,m){return _(m)},cs.useFormState=function(_,m,v){return h.H.useFormState(_,m,v)},cs.useFormStatus=function(){return h.H.useHostTransitionStatus()},cs.version="19.2.8",cs}var Wb;function Kk(){if(Wb)return Xf.exports;Wb=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(),Xf.exports=Fk(),Xf.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 Vb;function $k(){if(Vb)return xl;Vb=1;var e=Uk(),t=Z_(),i=Kk();function n(s){var r="https://react.dev/errors/"+s;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)r+="&args[]="+encodeURIComponent(arguments[o])}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 l(s){var r=s,o=s;if(s.alternate)for(;r.return;)r=r.return;else{s=r;do r=s,(r.flags&4098)!==0&&(o=r.return),s=r.return;while(s)}return r.tag===3?o: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 _(s){if(l(s)!==s)throw Error(n(188))}function m(s){var r=s.alternate;if(!r){if(r=l(s),r===null)throw Error(n(188));return r!==s?null:s}for(var o=s,u=r;;){var f=o.return;if(f===null)break;var p=f.alternate;if(p===null){if(u=f.return,u!==null){o=u;continue}break}if(f.child===p.child){for(p=f.child;p;){if(p===o)return _(f),s;if(p===u)return _(f),r;p=p.sibling}throw Error(n(188))}if(o.return!==u.return)o=f,u=p;else{for(var y=!1,w=f.child;w;){if(w===o){y=!0,o=f,u=p;break}if(w===u){y=!0,u=f,o=p;break}w=w.sibling}if(!y){for(w=p.child;w;){if(w===o){y=!0,o=p,u=f;break}if(w===u){y=!0,u=p,o=f;break}w=w.sibling}if(!y)throw Error(n(189))}}if(o.alternate!==u)throw Error(n(190))}if(o.tag!==3)throw Error(n(188));return o.stateNode.current===o?s:r}function v(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s;for(s=s.child;s!==null;){if(r=v(s),r!==null)return r;s=s.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),B=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),ee=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),te=Symbol.for("react.lazy"),he=Symbol.for("react.activity"),de=Symbol.for("react.memo_cache_sentinel"),ge=Symbol.iterator;function G(s){return s===null||typeof s!="object"?null:(s=ge&&s[ge]||s["@@iterator"],typeof s=="function"?s:null)}var K=Symbol.for("react.client.reference");function se(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===K?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case C:return"Fragment";case N:return"Profiler";case j:return"StrictMode";case V:return"Suspense";case ee:return"SuspenseList";case he:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case x:return"Portal";case B:return s.displayName||"Context";case z: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 q:return r=s.displayName||null,r!==null?r:se(s.type)||"Memo";case te:r=s._payload,s=s._init;try{return se(s(r))}catch{}}return null}var L=Array.isArray,T=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,F={pending:!1,data:null,method:null,action:null},me=[],Ce=-1;function A(s){return{current:s}}function Q(s){0>Ce||(s.current=me[Ce],me[Ce]=null,Ce--)}function ae(s,r){Ce++,me[Ce]=s.current,s.current=r}var $=A(null),le=A(null),ye=A(null),Be=A(null);function kt(s,r){switch(ae(ye,r),ae(le,s),ae($,null),r.nodeType){case 9:case 11:s=(s=r.documentElement)&&(s=s.namespaceURI)?Qy(s):0;break;default:if(s=r.tagName,r=r.namespaceURI)r=Qy(r),s=Zy(r,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}Q($),ae($,s)}function Qe(){Q($),Q(le),Q(ye)}function As(s){s.memoizedState!==null&&ae(Be,s);var r=$.current,o=Zy(r,s.type);r!==o&&(ae(le,s),ae($,o))}function xi(s){le.current===s&&(Q($),Q(le)),Be.current===s&&(Q(Be),vl._currentValue=F)}var Gs,Je;function di(s){if(Gs===void 0)try{throw Error()}catch(o){var r=o.stack.trim().match(/\n( *(at )?)/);Gs=r&&r[1]||"",Je=-1<o.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+Gs+s+Je}var Nh=!1;function Th(s,r){if(!s||Nh)return"";Nh=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(r){var X=function(){throw Error()};if(Object.defineProperty(X.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(X,[])}catch(W){var I=W}Reflect.construct(s,[],X)}else{try{X.call()}catch(W){I=W}s.call(X.prototype)}}else{try{throw Error()}catch(W){I=W}(X=s())&&typeof X.catch=="function"&&X.catch(function(){})}}catch(W){if(W&&I&&typeof W.stack=="string")return[W.stack,I.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=u.DetermineComponentFrameRoot(),y=p[0],w=p[1];if(y&&w){var O=y.split(`
|
|
45
|
+
`),H=w.split(`
|
|
46
|
+
`);for(f=u=0;u<O.length&&!O[u].includes("DetermineComponentFrameRoot");)u++;for(;f<H.length&&!H[f].includes("DetermineComponentFrameRoot");)f++;if(u===O.length||f===H.length)for(u=O.length-1,f=H.length-1;1<=u&&0<=f&&O[u]!==H[f];)f--;for(;1<=u&&0<=f;u--,f--)if(O[u]!==H[f]){if(u!==1||f!==1)do if(u--,f--,0>f||O[u]!==H[f]){var Y=`
|
|
47
|
+
`+O[u].replace(" at new "," at ");return s.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",s.displayName)),Y}while(1<=u&&0<=f);break}}}finally{Nh=!1,Error.prepareStackTrace=o}return(o=s?s.displayName||s.name:"")?di(o):""}function B1(s,r){switch(s.tag){case 26:case 27:case 5:return di(s.type);case 16:return di("Lazy");case 13:return s.child!==r&&r!==null?di("Suspense Fallback"):di("Suspense");case 19:return di("SuspenseList");case 0:case 15:return Th(s.type,!1);case 11:return Th(s.type.render,!1);case 1:return Th(s.type,!0);case 31:return di("Activity");default:return""}}function Ep(s){try{var r="",o=null;do r+=B1(s,o),o=s,s=s.return;while(s);return r}catch(u){return`
|
|
48
|
+
Error generating stack: `+u.message+`
|
|
49
|
+
`+u.stack}}var Oh=Object.prototype.hasOwnProperty,Ah=e.unstable_scheduleCallback,Rh=e.unstable_cancelCallback,L1=e.unstable_shouldYield,z1=e.unstable_requestPaint,Rs=e.unstable_now,q1=e.unstable_getCurrentPriorityLevel,Np=e.unstable_ImmediatePriority,Tp=e.unstable_UserBlockingPriority,hc=e.unstable_NormalPriority,P1=e.unstable_LowPriority,Op=e.unstable_IdlePriority,H1=e.log,I1=e.unstable_setDisableYieldValue,To=null,Ms=null;function br(s){if(typeof H1=="function"&&I1(s),Ms&&typeof Ms.setStrictMode=="function")try{Ms.setStrictMode(To,s)}catch{}}var Ds=Math.clz32?Math.clz32:K1,U1=Math.log,F1=Math.LN2;function K1(s){return s>>>=0,s===0?32:31-(U1(s)/F1|0)|0}var dc=256,fc=262144,mc=4194304;function yn(s){var r=s&42;if(r!==0)return r;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function _c(s,r,o){var u=s.pendingLanes;if(u===0)return 0;var f=0,p=s.suspendedLanes,y=s.pingedLanes;s=s.warmLanes;var w=u&134217727;return w!==0?(u=w&~p,u!==0?f=yn(u):(y&=w,y!==0?f=yn(y):o||(o=w&~s,o!==0&&(f=yn(o))))):(w=u&~p,w!==0?f=yn(w):y!==0?f=yn(y):o||(o=u&~s,o!==0&&(f=yn(o)))),f===0?0:r!==0&&r!==f&&(r&p)===0&&(p=f&-f,o=r&-r,p>=o||p===32&&(o&4194048)!==0)?r:f}function Oo(s,r){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&r)===0}function $1(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 Ap(){var s=mc;return mc<<=1,(mc&62914560)===0&&(mc=4194304),s}function Mh(s){for(var r=[],o=0;31>o;o++)r.push(s);return r}function Ao(s,r){s.pendingLanes|=r,r!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function W1(s,r,o,u,f,p){var y=s.pendingLanes;s.pendingLanes=o,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=o,s.entangledLanes&=o,s.errorRecoveryDisabledLanes&=o,s.shellSuspendCounter=0;var w=s.entanglements,O=s.expirationTimes,H=s.hiddenUpdates;for(o=y&~o;0<o;){var Y=31-Ds(o),X=1<<Y;w[Y]=0,O[Y]=-1;var I=H[Y];if(I!==null)for(H[Y]=null,Y=0;Y<I.length;Y++){var W=I[Y];W!==null&&(W.lane&=-536870913)}o&=~X}u!==0&&Rp(s,u,0),p!==0&&f===0&&s.tag!==0&&(s.suspendedLanes|=p&~(y&~r))}function Rp(s,r,o){s.pendingLanes|=r,s.suspendedLanes&=~r;var u=31-Ds(r);s.entangledLanes|=r,s.entanglements[u]=s.entanglements[u]|1073741824|o&261930}function Mp(s,r){var o=s.entangledLanes|=r;for(s=s.entanglements;o;){var u=31-Ds(o),f=1<<u;f&r|s[u]&r&&(s[u]|=r),o&=~f}}function Dp(s,r){var o=r&-r;return o=(o&42)!==0?1:Dh(o),(o&(s.suspendedLanes|r))!==0?0:o}function Dh(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 Bh(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Bp(){var s=U.p;return s!==0?s:(s=window.event,s===void 0?32:bb(s.type))}function Lp(s,r){var o=U.p;try{return U.p=s,r()}finally{U.p=o}}var Sr=Math.random().toString(36).slice(2),es="__reactFiber$"+Sr,bs="__reactProps$"+Sr,fa="__reactContainer$"+Sr,Lh="__reactEvents$"+Sr,V1="__reactListeners$"+Sr,Y1="__reactHandles$"+Sr,zp="__reactResources$"+Sr,Ro="__reactMarker$"+Sr;function zh(s){delete s[es],delete s[bs],delete s[Lh],delete s[V1],delete s[Y1]}function ma(s){var r=s[es];if(r)return r;for(var o=s.parentNode;o;){if(r=o[fa]||o[es]){if(o=r.alternate,r.child!==null||o!==null&&o.child!==null)for(s=rb(s);s!==null;){if(o=s[es])return o;s=rb(s)}return r}s=o,o=s.parentNode}return null}function _a(s){if(s=s[es]||s[fa]){var r=s.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return s}return null}function Mo(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s.stateNode;throw Error(n(33))}function pa(s){var r=s[zp];return r||(r=s[zp]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function Wt(s){s[Ro]=!0}var qp=new Set,Pp={};function bn(s,r){va(s,r),va(s+"Capture",r)}function va(s,r){for(Pp[s]=r,s=0;s<r.length;s++)qp.add(r[s])}var G1=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]*$"),Hp={},Ip={};function Q1(s){return Oh.call(Ip,s)?!0:Oh.call(Hp,s)?!1:G1.test(s)?Ip[s]=!0:(Hp[s]=!0,!1)}function pc(s,r,o){if(Q1(r))if(o===null)s.removeAttribute(r);else{switch(typeof o){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,""+o)}}function vc(s,r,o){if(o===null)s.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(r);return}s.setAttribute(r,""+o)}}function Ui(s,r,o,u){if(u===null)s.removeAttribute(o);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(o);return}s.setAttributeNS(r,o,""+u)}}function Qs(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Up(s){var r=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Z1(s,r,o){var u=Object.getOwnPropertyDescriptor(s.constructor.prototype,r);if(!s.hasOwnProperty(r)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var f=u.get,p=u.set;return Object.defineProperty(s,r,{configurable:!0,get:function(){return f.call(this)},set:function(y){o=""+y,p.call(this,y)}}),Object.defineProperty(s,r,{enumerable:u.enumerable}),{getValue:function(){return o},setValue:function(y){o=""+y},stopTracking:function(){s._valueTracker=null,delete s[r]}}}}function qh(s){if(!s._valueTracker){var r=Up(s)?"checked":"value";s._valueTracker=Z1(s,r,""+s[r])}}function Fp(s){if(!s)return!1;var r=s._valueTracker;if(!r)return!0;var o=r.getValue(),u="";return s&&(u=Up(s)?s.checked?"true":"false":s.value),s=u,s!==o?(r.setValue(s),!0):!1}function gc(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 X1=/[\n"\\]/g;function Zs(s){return s.replace(X1,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Ph(s,r,o,u,f,p,y,w){s.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?s.type=y:s.removeAttribute("type"),r!=null?y==="number"?(r===0&&s.value===""||s.value!=r)&&(s.value=""+Qs(r)):s.value!==""+Qs(r)&&(s.value=""+Qs(r)):y!=="submit"&&y!=="reset"||s.removeAttribute("value"),r!=null?Hh(s,y,Qs(r)):o!=null?Hh(s,y,Qs(o)):u!=null&&s.removeAttribute("value"),f==null&&p!=null&&(s.defaultChecked=!!p),f!=null&&(s.checked=f&&typeof f!="function"&&typeof f!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?s.name=""+Qs(w):s.removeAttribute("name")}function Kp(s,r,o,u,f,p,y,w){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(s.type=p),r!=null||o!=null){if(!(p!=="submit"&&p!=="reset"||r!=null)){qh(s);return}o=o!=null?""+Qs(o):"",r=r!=null?""+Qs(r):o,w||r===s.value||(s.value=r),s.defaultValue=r}u=u??f,u=typeof u!="function"&&typeof u!="symbol"&&!!u,s.checked=w?s.checked:!!u,s.defaultChecked=!!u,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(s.name=y),qh(s)}function Hh(s,r,o){r==="number"&&gc(s.ownerDocument)===s||s.defaultValue===""+o||(s.defaultValue=""+o)}function ga(s,r,o,u){if(s=s.options,r){r={};for(var f=0;f<o.length;f++)r["$"+o[f]]=!0;for(o=0;o<s.length;o++)f=r.hasOwnProperty("$"+s[o].value),s[o].selected!==f&&(s[o].selected=f),f&&u&&(s[o].defaultSelected=!0)}else{for(o=""+Qs(o),r=null,f=0;f<s.length;f++){if(s[f].value===o){s[f].selected=!0,u&&(s[f].defaultSelected=!0);return}r!==null||s[f].disabled||(r=s[f])}r!==null&&(r.selected=!0)}}function $p(s,r,o){if(r!=null&&(r=""+Qs(r),r!==s.value&&(s.value=r),o==null)){s.defaultValue!==r&&(s.defaultValue=r);return}s.defaultValue=o!=null?""+Qs(o):""}function Wp(s,r,o,u){if(r==null){if(u!=null){if(o!=null)throw Error(n(92));if(L(u)){if(1<u.length)throw Error(n(93));u=u[0]}o=u}o==null&&(o=""),r=o}o=Qs(r),s.defaultValue=o,u=s.textContent,u===o&&u!==""&&u!==null&&(s.value=u),qh(s)}function ya(s,r){if(r){var o=s.firstChild;if(o&&o===s.lastChild&&o.nodeType===3){o.nodeValue=r;return}}s.textContent=r}var J1=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 Vp(s,r,o){var u=r.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?u?s.setProperty(r,""):r==="float"?s.cssFloat="":s[r]="":u?s.setProperty(r,o):typeof o!="number"||o===0||J1.has(r)?r==="float"?s.cssFloat=o:s[r]=(""+o).trim():s[r]=o+"px"}function Yp(s,r,o){if(r!=null&&typeof r!="object")throw Error(n(62));if(s=s.style,o!=null){for(var u in o)!o.hasOwnProperty(u)||r!=null&&r.hasOwnProperty(u)||(u.indexOf("--")===0?s.setProperty(u,""):u==="float"?s.cssFloat="":s[u]="");for(var f in r)u=r[f],r.hasOwnProperty(f)&&o[f]!==u&&Vp(s,f,u)}else for(var p in r)r.hasOwnProperty(p)&&Vp(s,p,r[p])}function Ih(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"]]),tC=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function yc(s){return tC.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Fi(){}var Uh=null;function Fh(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var ba=null,Sa=null;function Gp(s){var r=_a(s);if(r&&(s=r.stateNode)){var o=s[bs]||null;e:switch(s=r.stateNode,r.type){case"input":if(Ph(s,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),r=o.name,o.type==="radio"&&r!=null){for(o=s;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+Zs(""+r)+'"][type="radio"]'),r=0;r<o.length;r++){var u=o[r];if(u!==s&&u.form===s.form){var f=u[bs]||null;if(!f)throw Error(n(90));Ph(u,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(r=0;r<o.length;r++)u=o[r],u.form===s.form&&Fp(u)}break e;case"textarea":$p(s,o.value,o.defaultValue);break e;case"select":r=o.value,r!=null&&ga(s,!!o.multiple,r,!1)}}}var Kh=!1;function Qp(s,r,o){if(Kh)return s(r,o);Kh=!0;try{var u=s(r);return u}finally{if(Kh=!1,(ba!==null||Sa!==null)&&(au(),ba&&(r=ba,s=Sa,Sa=ba=null,Gp(r),s)))for(r=0;r<s.length;r++)Gp(s[r])}}function Do(s,r){var o=s.stateNode;if(o===null)return null;var u=o[bs]||null;if(u===null)return null;o=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(o&&typeof o!="function")throw Error(n(231,r,typeof o));return o}var Ki=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$h=!1;if(Ki)try{var Bo={};Object.defineProperty(Bo,"passive",{get:function(){$h=!0}}),window.addEventListener("test",Bo,Bo),window.removeEventListener("test",Bo,Bo)}catch{$h=!1}var xr=null,Wh=null,bc=null;function Zp(){if(bc)return bc;var s,r=Wh,o=r.length,u,f="value"in xr?xr.value:xr.textContent,p=f.length;for(s=0;s<o&&r[s]===f[s];s++);var y=o-s;for(u=1;u<=y&&r[o-u]===f[p-u];u++);return bc=f.slice(s,1<u?1-u:void 0)}function Sc(s){var r=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&r===13&&(s=13)):s=r,s===10&&(s=13),32<=s||s===13?s:0}function xc(){return!0}function Xp(){return!1}function Ss(s){function r(o,u,f,p,y){this._reactName=o,this._targetInst=f,this.type=u,this.nativeEvent=p,this.target=y,this.currentTarget=null;for(var w in s)s.hasOwnProperty(w)&&(o=s[w],this[w]=o?o(p):p[w]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?xc:Xp,this.isPropagationStopped=Xp,this}return g(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=xc)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=xc)},persist:function(){},isPersistent:xc}),r}var Sn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wc=Ss(Sn),Lo=g({},Sn,{view:0,detail:0}),sC=Ss(Lo),Vh,Yh,zo,Cc=g({},Lo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qh,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!==zo&&(zo&&s.type==="mousemove"?(Vh=s.screenX-zo.screenX,Yh=s.screenY-zo.screenY):Yh=Vh=0,zo=s),Vh)},movementY:function(s){return"movementY"in s?s.movementY:Yh}}),Jp=Ss(Cc),iC=g({},Cc,{dataTransfer:0}),rC=Ss(iC),nC=g({},Lo,{relatedTarget:0}),Gh=Ss(nC),aC=g({},Sn,{animationName:0,elapsedTime:0,pseudoElement:0}),oC=Ss(aC),lC=g({},Sn,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),cC=Ss(lC),uC=g({},Sn,{data:0}),ev=Ss(uC),hC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},dC={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"},fC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function mC(s){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(s):(s=fC[s])?!!r[s]:!1}function Qh(){return mC}var _C=g({},Lo,{key:function(s){if(s.key){var r=hC[s.key]||s.key;if(r!=="Unidentified")return r}return s.type==="keypress"?(s=Sc(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?dC[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qh,charCode:function(s){return s.type==="keypress"?Sc(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Sc(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),pC=Ss(_C),vC=g({},Cc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),tv=Ss(vC),gC=g({},Lo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qh}),yC=Ss(gC),bC=g({},Sn,{propertyName:0,elapsedTime:0,pseudoElement:0}),SC=Ss(bC),xC=g({},Cc,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),wC=Ss(xC),CC=g({},Sn,{newState:0,oldState:0}),jC=Ss(CC),kC=[9,13,27,32],Zh=Ki&&"CompositionEvent"in window,qo=null;Ki&&"documentMode"in document&&(qo=document.documentMode);var EC=Ki&&"TextEvent"in window&&!qo,sv=Ki&&(!Zh||qo&&8<qo&&11>=qo),iv=" ",rv=!1;function nv(s,r){switch(s){case"keyup":return kC.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function av(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var xa=!1;function NC(s,r){switch(s){case"compositionend":return av(r);case"keypress":return r.which!==32?null:(rv=!0,iv);case"textInput":return s=r.data,s===iv&&rv?null:s;default:return null}}function TC(s,r){if(xa)return s==="compositionend"||!Zh&&nv(s,r)?(s=Zp(),bc=Wh=xr=null,xa=!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 sv&&r.locale!=="ko"?null:r.data;default:return null}}var OC={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 ov(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r==="input"?!!OC[s.type]:r==="textarea"}function lv(s,r,o,u){ba?Sa?Sa.push(u):Sa=[u]:ba=u,r=fu(r,"onChange"),0<r.length&&(o=new wc("onChange","change",null,o,u),s.push({event:o,listeners:r}))}var Po=null,Ho=null;function AC(s){Ky(s,0)}function jc(s){var r=Mo(s);if(Fp(r))return s}function cv(s,r){if(s==="change")return r}var uv=!1;if(Ki){var Xh;if(Ki){var Jh="oninput"in document;if(!Jh){var hv=document.createElement("div");hv.setAttribute("oninput","return;"),Jh=typeof hv.oninput=="function"}Xh=Jh}else Xh=!1;uv=Xh&&(!document.documentMode||9<document.documentMode)}function dv(){Po&&(Po.detachEvent("onpropertychange",fv),Ho=Po=null)}function fv(s){if(s.propertyName==="value"&&jc(Ho)){var r=[];lv(r,Ho,s,Fh(s)),Qp(AC,r)}}function RC(s,r,o){s==="focusin"?(dv(),Po=r,Ho=o,Po.attachEvent("onpropertychange",fv)):s==="focusout"&&dv()}function MC(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return jc(Ho)}function DC(s,r){if(s==="click")return jc(r)}function BC(s,r){if(s==="input"||s==="change")return jc(r)}function LC(s,r){return s===r&&(s!==0||1/s===1/r)||s!==s&&r!==r}var Bs=typeof Object.is=="function"?Object.is:LC;function Io(s,r){if(Bs(s,r))return!0;if(typeof s!="object"||s===null||typeof r!="object"||r===null)return!1;var o=Object.keys(s),u=Object.keys(r);if(o.length!==u.length)return!1;for(u=0;u<o.length;u++){var f=o[u];if(!Oh.call(r,f)||!Bs(s[f],r[f]))return!1}return!0}function mv(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function _v(s,r){var o=mv(s);s=0;for(var u;o;){if(o.nodeType===3){if(u=s+o.textContent.length,s<=r&&u>=r)return{node:o,offset:r-s};s=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=mv(o)}}function pv(s,r){return s&&r?s===r?!0:s&&s.nodeType===3?!1:r&&r.nodeType===3?pv(s,r.parentNode):"contains"in s?s.contains(r):s.compareDocumentPosition?!!(s.compareDocumentPosition(r)&16):!1:!1}function vv(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var r=gc(s.document);r instanceof s.HTMLIFrameElement;){try{var o=typeof r.contentWindow.location.href=="string"}catch{o=!1}if(o)s=r.contentWindow;else break;r=gc(s.document)}return r}function ed(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 zC=Ki&&"documentMode"in document&&11>=document.documentMode,wa=null,td=null,Uo=null,sd=!1;function gv(s,r,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;sd||wa==null||wa!==gc(u)||(u=wa,"selectionStart"in u&&ed(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}),Uo&&Io(Uo,u)||(Uo=u,u=fu(td,"onSelect"),0<u.length&&(r=new wc("onSelect","select",null,r,o),s.push({event:r,listeners:u}),r.target=wa)))}function xn(s,r){var o={};return o[s.toLowerCase()]=r.toLowerCase(),o["Webkit"+s]="webkit"+r,o["Moz"+s]="moz"+r,o}var Ca={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")},id={},yv={};Ki&&(yv=document.createElement("div").style,"AnimationEvent"in window||(delete Ca.animationend.animation,delete Ca.animationiteration.animation,delete Ca.animationstart.animation),"TransitionEvent"in window||delete Ca.transitionend.transition);function wn(s){if(id[s])return id[s];if(!Ca[s])return s;var r=Ca[s],o;for(o in r)if(r.hasOwnProperty(o)&&o in yv)return id[s]=r[o];return s}var bv=wn("animationend"),Sv=wn("animationiteration"),xv=wn("animationstart"),qC=wn("transitionrun"),PC=wn("transitionstart"),HC=wn("transitioncancel"),wv=wn("transitionend"),Cv=new Map,rd="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(" ");rd.push("scrollEnd");function fi(s,r){Cv.set(s,r),bn(r,[s])}var kc=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Xs=[],ja=0,nd=0;function Ec(){for(var s=ja,r=nd=ja=0;r<s;){var o=Xs[r];Xs[r++]=null;var u=Xs[r];Xs[r++]=null;var f=Xs[r];Xs[r++]=null;var p=Xs[r];if(Xs[r++]=null,u!==null&&f!==null){var y=u.pending;y===null?f.next=f:(f.next=y.next,y.next=f),u.pending=f}p!==0&&jv(o,f,p)}}function Nc(s,r,o,u){Xs[ja++]=s,Xs[ja++]=r,Xs[ja++]=o,Xs[ja++]=u,nd|=u,s.lanes|=u,s=s.alternate,s!==null&&(s.lanes|=u)}function ad(s,r,o,u){return Nc(s,r,o,u),Tc(s)}function Cn(s,r){return Nc(s,null,null,r),Tc(s)}function jv(s,r,o){s.lanes|=o;var u=s.alternate;u!==null&&(u.lanes|=o);for(var f=!1,p=s.return;p!==null;)p.childLanes|=o,u=p.alternate,u!==null&&(u.childLanes|=o),p.tag===22&&(s=p.stateNode,s===null||s._visibility&1||(f=!0)),s=p,p=p.return;return s.tag===3?(p=s.stateNode,f&&r!==null&&(f=31-Ds(o),s=p.hiddenUpdates,u=s[f],u===null?s[f]=[r]:u.push(r),r.lane=o|536870912),p):null}function Tc(s){if(50<ul)throw ul=0,pf=null,Error(n(185));for(var r=s.return;r!==null;)s=r,r=s.return;return s.tag===3?s.stateNode:null}var ka={};function IC(s,r,o,u){this.tag=s,this.key=o,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 Ls(s,r,o,u){return new IC(s,r,o,u)}function od(s){return s=s.prototype,!(!s||!s.isReactComponent)}function $i(s,r){var o=s.alternate;return o===null?(o=Ls(s.tag,r,s.key,s.mode),o.elementType=s.elementType,o.type=s.type,o.stateNode=s.stateNode,o.alternate=s,s.alternate=o):(o.pendingProps=r,o.type=s.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=s.flags&65011712,o.childLanes=s.childLanes,o.lanes=s.lanes,o.child=s.child,o.memoizedProps=s.memoizedProps,o.memoizedState=s.memoizedState,o.updateQueue=s.updateQueue,r=s.dependencies,o.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},o.sibling=s.sibling,o.index=s.index,o.ref=s.ref,o.refCleanup=s.refCleanup,o}function kv(s,r){s.flags&=65011714;var o=s.alternate;return o===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=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,r=o.dependencies,s.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),s}function Oc(s,r,o,u,f,p){var y=0;if(u=s,typeof s=="function")od(s)&&(y=1);else if(typeof s=="string")y=Wj(s,o,$.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case he:return s=Ls(31,o,r,f),s.elementType=he,s.lanes=p,s;case C:return jn(o.children,f,p,r);case j:y=8,f|=24;break;case N:return s=Ls(12,o,r,f|2),s.elementType=N,s.lanes=p,s;case V:return s=Ls(13,o,r,f),s.elementType=V,s.lanes=p,s;case ee:return s=Ls(19,o,r,f),s.elementType=ee,s.lanes=p,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case B:y=10;break e;case z:y=9;break e;case M:y=11;break e;case q:y=14;break e;case te:y=16,u=null;break e}y=29,o=Error(n(130,s===null?"null":typeof s,"")),u=null}return r=Ls(y,o,r,f),r.elementType=s,r.type=u,r.lanes=p,r}function jn(s,r,o,u){return s=Ls(7,s,u,r),s.lanes=o,s}function ld(s,r,o){return s=Ls(6,s,null,r),s.lanes=o,s}function Ev(s){var r=Ls(18,null,null,0);return r.stateNode=s,r}function cd(s,r,o){return r=Ls(4,s.children!==null?s.children:[],s.key,r),r.lanes=o,r.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},r}var Nv=new WeakMap;function Js(s,r){if(typeof s=="object"&&s!==null){var o=Nv.get(s);return o!==void 0?o:(r={value:s,source:r,stack:Ep(r)},Nv.set(s,r),r)}return{value:s,source:r,stack:Ep(r)}}var Ea=[],Na=0,Ac=null,Fo=0,ei=[],ti=0,wr=null,wi=1,Ci="";function Wi(s,r){Ea[Na++]=Fo,Ea[Na++]=Ac,Ac=s,Fo=r}function Tv(s,r,o){ei[ti++]=wi,ei[ti++]=Ci,ei[ti++]=wr,wr=s;var u=wi;s=Ci;var f=32-Ds(u)-1;u&=~(1<<f),o+=1;var p=32-Ds(r)+f;if(30<p){var y=f-f%5;p=(u&(1<<y)-1).toString(32),u>>=y,f-=y,wi=1<<32-Ds(r)+f|o<<f|u,Ci=p+s}else wi=1<<p|o<<f|u,Ci=s}function ud(s){s.return!==null&&(Wi(s,1),Tv(s,1,0))}function hd(s){for(;s===Ac;)Ac=Ea[--Na],Ea[Na]=null,Fo=Ea[--Na],Ea[Na]=null;for(;s===wr;)wr=ei[--ti],ei[ti]=null,Ci=ei[--ti],ei[ti]=null,wi=ei[--ti],ei[ti]=null}function Ov(s,r){ei[ti++]=wi,ei[ti++]=Ci,ei[ti++]=wr,wi=r.id,Ci=r.overflow,wr=s}var ts=null,ft=null,$e=!1,Cr=null,si=!1,dd=Error(n(519));function jr(s){var r=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ko(Js(r,s)),dd}function Av(s){var r=s.stateNode,o=s.type,u=s.memoizedProps;switch(r[es]=s,r[bs]=u,o){case"dialog":Ue("cancel",r),Ue("close",r);break;case"iframe":case"object":case"embed":Ue("load",r);break;case"video":case"audio":for(o=0;o<dl.length;o++)Ue(dl[o],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),Kp(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),Wp(r,u.value,u.defaultValue,u.children)}o=u.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||r.textContent===""+o||u.suppressHydrationWarning===!0||Yy(r.textContent,o)?(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=Fi),r=!0):r=!1,r||jr(s,!0)}function Rv(s){for(ts=s.return;ts;)switch(ts.tag){case 5:case 31:case 13:si=!1;return;case 27:case 3:si=!0;return;default:ts=ts.return}}function Ta(s){if(s!==ts)return!1;if(!$e)return Rv(s),$e=!0,!1;var r=s.tag,o;if((o=r!==3&&r!==27)&&((o=r===5)&&(o=s.type,o=!(o!=="form"&&o!=="button")||Af(s.type,s.memoizedProps)),o=!o),o&&ft&&jr(s),Rv(s),r===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));ft=ib(s)}else if(r===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));ft=ib(s)}else r===27?(r=ft,Pr(s.type)?(s=Lf,Lf=null,ft=s):ft=r):ft=ts?ri(s.stateNode.nextSibling):null;return!0}function kn(){ft=ts=null,$e=!1}function fd(){var s=Cr;return s!==null&&(js===null?js=s:js.push.apply(js,s),Cr=null),s}function Ko(s){Cr===null?Cr=[s]:Cr.push(s)}var md=A(null),En=null,Vi=null;function kr(s,r,o){ae(md,r._currentValue),r._currentValue=o}function Yi(s){s._currentValue=md.current,Q(md)}function _d(s,r,o){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===o)break;s=s.return}}function pd(s,r,o,u){var f=s.child;for(f!==null&&(f.return=s);f!==null;){var p=f.dependencies;if(p!==null){var y=f.child;p=p.firstContext;e:for(;p!==null;){var w=p;p=f;for(var O=0;O<r.length;O++)if(w.context===r[O]){p.lanes|=o,w=p.alternate,w!==null&&(w.lanes|=o),_d(p.return,o,s),u||(y=null);break e}p=w.next}}else if(f.tag===18){if(y=f.return,y===null)throw Error(n(341));y.lanes|=o,p=y.alternate,p!==null&&(p.lanes|=o),_d(y,o,s),y=null}else y=f.child;if(y!==null)y.return=f;else for(y=f;y!==null;){if(y===s){y=null;break}if(f=y.sibling,f!==null){f.return=y.return,y=f;break}y=y.return}f=y}}function Oa(s,r,o,u){s=null;for(var f=r,p=!1;f!==null;){if(!p){if((f.flags&524288)!==0)p=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var y=f.alternate;if(y===null)throw Error(n(387));if(y=y.memoizedProps,y!==null){var w=f.type;Bs(f.pendingProps.value,y.value)||(s!==null?s.push(w):s=[w])}}else if(f===Be.current){if(y=f.alternate,y===null)throw Error(n(387));y.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(s!==null?s.push(vl):s=[vl])}f=f.return}s!==null&&pd(r,s,o,u),r.flags|=262144}function Rc(s){for(s=s.firstContext;s!==null;){if(!Bs(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 Mv(En,s)}function Mc(s,r){return En===null&&Nn(s),Mv(s,r)}function Mv(s,r){var o=r._currentValue;if(r={context:r,memoizedValue:o,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 o}var UC=typeof AbortController<"u"?AbortController:function(){var s=[],r=this.signal={aborted:!1,addEventListener:function(o,u){s.push(u)}};this.abort=function(){r.aborted=!0,s.forEach(function(o){return o()})}},FC=e.unstable_scheduleCallback,KC=e.unstable_NormalPriority,At={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function vd(){return{controller:new UC,data:new Map,refCount:0}}function $o(s){s.refCount--,s.refCount===0&&FC(KC,function(){s.controller.abort()})}var Wo=null,gd=0,Aa=0,Ra=null;function $C(s,r){if(Wo===null){var o=Wo=[];gd=0,Aa=xf(),Ra={status:"pending",value:void 0,then:function(u){o.push(u)}}}return gd++,r.then(Dv,Dv),r}function Dv(){if(--gd===0&&Wo!==null){Ra!==null&&(Ra.status="fulfilled");var s=Wo;Wo=null,Aa=0,Ra=null;for(var r=0;r<s.length;r++)(0,s[r])()}}function WC(s,r){var o=[],u={status:"pending",value:null,reason:null,then:function(f){o.push(f)}};return s.then(function(){u.status="fulfilled",u.value=r;for(var f=0;f<o.length;f++)(0,o[f])(r)},function(f){for(u.status="rejected",u.reason=f,f=0;f<o.length;f++)(0,o[f])(void 0)}),u}var Bv=T.S;T.S=function(s,r){gy=Rs(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&$C(s,r),Bv!==null&&Bv(s,r)};var Tn=A(null);function yd(){var s=Tn.current;return s!==null?s:ht.pooledCache}function Dc(s,r){r===null?ae(Tn,Tn.current):ae(Tn,r.pool)}function Lv(){var s=yd();return s===null?null:{parent:At._currentValue,pool:s}}var Ma=Error(n(460)),bd=Error(n(474)),Bc=Error(n(542)),Lc={then:function(){}};function zv(s){return s=s.status,s==="fulfilled"||s==="rejected"}function qv(s,r,o){switch(o=s[o],o===void 0?s.push(r):o!==r&&(r.then(Fi,Fi),r=o),r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,Hv(s),s;default:if(typeof r.status=="string")r.then(Fi,Fi);else{if(s=ht,s!==null&&100<s.shellSuspendCounter)throw Error(n(482));s=r,s.status="pending",s.then(function(u){if(r.status==="pending"){var f=r;f.status="fulfilled",f.value=u}},function(u){if(r.status==="pending"){var f=r;f.status="rejected",f.reason=u}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,Hv(s),s}throw An=r,Ma}}function On(s){try{var r=s._init;return r(s._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(An=o,Ma):o}}var An=null;function Pv(){if(An===null)throw Error(n(459));var s=An;return An=null,s}function Hv(s){if(s===Ma||s===Bc)throw Error(n(483))}var Da=null,Vo=0;function zc(s){var r=Vo;return Vo+=1,Da===null&&(Da=[]),qv(Da,s,r)}function Yo(s,r){r=r.props.ref,s.ref=r!==void 0?r:null}function qc(s,r){throw r.$$typeof===b?Error(n(525)):(s=Object.prototype.toString.call(r),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":s)))}function Iv(s){function r(D,R){if(s){var P=D.deletions;P===null?(D.deletions=[R],D.flags|=16):P.push(R)}}function o(D,R){if(!s)return null;for(;R!==null;)r(D,R),R=R.sibling;return null}function u(D){for(var R=new Map;D!==null;)D.key!==null?R.set(D.key,D):R.set(D.index,D),D=D.sibling;return R}function f(D,R){return D=$i(D,R),D.index=0,D.sibling=null,D}function p(D,R,P){return D.index=P,s?(P=D.alternate,P!==null?(P=P.index,P<R?(D.flags|=67108866,R):P):(D.flags|=67108866,R)):(D.flags|=1048576,R)}function y(D){return s&&D.alternate===null&&(D.flags|=67108866),D}function w(D,R,P,Z){return R===null||R.tag!==6?(R=ld(P,D.mode,Z),R.return=D,R):(R=f(R,P),R.return=D,R)}function O(D,R,P,Z){var we=P.type;return we===C?Y(D,R,P.props.children,Z,P.key):R!==null&&(R.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===te&&On(we)===R.type)?(R=f(R,P.props),Yo(R,P),R.return=D,R):(R=Oc(P.type,P.key,P.props,null,D.mode,Z),Yo(R,P),R.return=D,R)}function H(D,R,P,Z){return R===null||R.tag!==4||R.stateNode.containerInfo!==P.containerInfo||R.stateNode.implementation!==P.implementation?(R=cd(P,D.mode,Z),R.return=D,R):(R=f(R,P.children||[]),R.return=D,R)}function Y(D,R,P,Z,we){return R===null||R.tag!==7?(R=jn(P,D.mode,Z,we),R.return=D,R):(R=f(R,P),R.return=D,R)}function X(D,R,P){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=ld(""+R,D.mode,P),R.return=D,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case S:return P=Oc(R.type,R.key,R.props,null,D.mode,P),Yo(P,R),P.return=D,P;case x:return R=cd(R,D.mode,P),R.return=D,R;case te:return R=On(R),X(D,R,P)}if(L(R)||G(R))return R=jn(R,D.mode,P,null),R.return=D,R;if(typeof R.then=="function")return X(D,zc(R),P);if(R.$$typeof===B)return X(D,Mc(D,R),P);qc(D,R)}return null}function I(D,R,P,Z){var we=R!==null?R.key:null;if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return we!==null?null:w(D,R,""+P,Z);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case S:return P.key===we?O(D,R,P,Z):null;case x:return P.key===we?H(D,R,P,Z):null;case te:return P=On(P),I(D,R,P,Z)}if(L(P)||G(P))return we!==null?null:Y(D,R,P,Z,null);if(typeof P.then=="function")return I(D,R,zc(P),Z);if(P.$$typeof===B)return I(D,R,Mc(D,P),Z);qc(D,P)}return null}function W(D,R,P,Z,we){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return D=D.get(P)||null,w(R,D,""+Z,we);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case S:return D=D.get(Z.key===null?P:Z.key)||null,O(R,D,Z,we);case x:return D=D.get(Z.key===null?P:Z.key)||null,H(R,D,Z,we);case te:return Z=On(Z),W(D,R,P,Z,we)}if(L(Z)||G(Z))return D=D.get(P)||null,Y(R,D,Z,we,null);if(typeof Z.then=="function")return W(D,R,P,zc(Z),we);if(Z.$$typeof===B)return W(D,R,P,Mc(R,Z),we);qc(R,Z)}return null}function _e(D,R,P,Z){for(var we=null,et=null,be=R,Le=R=0,Ke=null;be!==null&&Le<P.length;Le++){be.index>Le?(Ke=be,be=null):Ke=be.sibling;var tt=I(D,be,P[Le],Z);if(tt===null){be===null&&(be=Ke);break}s&&be&&tt.alternate===null&&r(D,be),R=p(tt,R,Le),et===null?we=tt:et.sibling=tt,et=tt,be=Ke}if(Le===P.length)return o(D,be),$e&&Wi(D,Le),we;if(be===null){for(;Le<P.length;Le++)be=X(D,P[Le],Z),be!==null&&(R=p(be,R,Le),et===null?we=be:et.sibling=be,et=be);return $e&&Wi(D,Le),we}for(be=u(be);Le<P.length;Le++)Ke=W(be,D,Le,P[Le],Z),Ke!==null&&(s&&Ke.alternate!==null&&be.delete(Ke.key===null?Le:Ke.key),R=p(Ke,R,Le),et===null?we=Ke:et.sibling=Ke,et=Ke);return s&&be.forEach(function(Kr){return r(D,Kr)}),$e&&Wi(D,Le),we}function ke(D,R,P,Z){if(P==null)throw Error(n(151));for(var we=null,et=null,be=R,Le=R=0,Ke=null,tt=P.next();be!==null&&!tt.done;Le++,tt=P.next()){be.index>Le?(Ke=be,be=null):Ke=be.sibling;var Kr=I(D,be,tt.value,Z);if(Kr===null){be===null&&(be=Ke);break}s&&be&&Kr.alternate===null&&r(D,be),R=p(Kr,R,Le),et===null?we=Kr:et.sibling=Kr,et=Kr,be=Ke}if(tt.done)return o(D,be),$e&&Wi(D,Le),we;if(be===null){for(;!tt.done;Le++,tt=P.next())tt=X(D,tt.value,Z),tt!==null&&(R=p(tt,R,Le),et===null?we=tt:et.sibling=tt,et=tt);return $e&&Wi(D,Le),we}for(be=u(be);!tt.done;Le++,tt=P.next())tt=W(be,D,Le,tt.value,Z),tt!==null&&(s&&tt.alternate!==null&&be.delete(tt.key===null?Le:tt.key),R=p(tt,R,Le),et===null?we=tt:et.sibling=tt,et=tt);return s&&be.forEach(function(ik){return r(D,ik)}),$e&&Wi(D,Le),we}function ct(D,R,P,Z){if(typeof P=="object"&&P!==null&&P.type===C&&P.key===null&&(P=P.props.children),typeof P=="object"&&P!==null){switch(P.$$typeof){case S:e:{for(var we=P.key;R!==null;){if(R.key===we){if(we=P.type,we===C){if(R.tag===7){o(D,R.sibling),Z=f(R,P.props.children),Z.return=D,D=Z;break e}}else if(R.elementType===we||typeof we=="object"&&we!==null&&we.$$typeof===te&&On(we)===R.type){o(D,R.sibling),Z=f(R,P.props),Yo(Z,P),Z.return=D,D=Z;break e}o(D,R);break}else r(D,R);R=R.sibling}P.type===C?(Z=jn(P.props.children,D.mode,Z,P.key),Z.return=D,D=Z):(Z=Oc(P.type,P.key,P.props,null,D.mode,Z),Yo(Z,P),Z.return=D,D=Z)}return y(D);case x:e:{for(we=P.key;R!==null;){if(R.key===we)if(R.tag===4&&R.stateNode.containerInfo===P.containerInfo&&R.stateNode.implementation===P.implementation){o(D,R.sibling),Z=f(R,P.children||[]),Z.return=D,D=Z;break e}else{o(D,R);break}else r(D,R);R=R.sibling}Z=cd(P,D.mode,Z),Z.return=D,D=Z}return y(D);case te:return P=On(P),ct(D,R,P,Z)}if(L(P))return _e(D,R,P,Z);if(G(P)){if(we=G(P),typeof we!="function")throw Error(n(150));return P=we.call(P),ke(D,R,P,Z)}if(typeof P.then=="function")return ct(D,R,zc(P),Z);if(P.$$typeof===B)return ct(D,R,Mc(D,P),Z);qc(D,P)}return typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint"?(P=""+P,R!==null&&R.tag===6?(o(D,R.sibling),Z=f(R,P),Z.return=D,D=Z):(o(D,R),Z=ld(P,D.mode,Z),Z.return=D,D=Z),y(D)):o(D,R)}return function(D,R,P,Z){try{Vo=0;var we=ct(D,R,P,Z);return Da=null,we}catch(be){if(be===Ma||be===Bc)throw be;var et=Ls(29,be,null,D.mode);return et.lanes=Z,et.return=D,et}finally{}}}var Rn=Iv(!0),Uv=Iv(!1),Er=!1;function Sd(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function xd(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,o){var u=s.updateQueue;if(u===null)return null;if(u=u.shared,(st&2)!==0){var f=u.pending;return f===null?r.next=r:(r.next=f.next,f.next=r),u.pending=r,r=Tc(s),jv(s,null,o),r}return Nc(s,u,r,o),Tc(s)}function Go(s,r,o){if(r=r.updateQueue,r!==null&&(r=r.shared,(o&4194048)!==0)){var u=r.lanes;u&=s.pendingLanes,o|=u,r.lanes=o,Mp(s,o)}}function wd(s,r){var o=s.updateQueue,u=s.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var f=null,p=null;if(o=o.firstBaseUpdate,o!==null){do{var y={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};p===null?f=p=y:p=p.next=y,o=o.next}while(o!==null);p===null?f=p=r:p=p.next=r}else f=p=r;o={baseState:u.baseState,firstBaseUpdate:f,lastBaseUpdate:p,shared:u.shared,callbacks:u.callbacks},s.updateQueue=o;return}s=o.lastBaseUpdate,s===null?o.firstBaseUpdate=r:s.next=r,o.lastBaseUpdate=r}var Cd=!1;function Qo(){if(Cd){var s=Ra;if(s!==null)throw s}}function Zo(s,r,o,u){Cd=!1;var f=s.updateQueue;Er=!1;var p=f.firstBaseUpdate,y=f.lastBaseUpdate,w=f.shared.pending;if(w!==null){f.shared.pending=null;var O=w,H=O.next;O.next=null,y===null?p=H:y.next=H,y=O;var Y=s.alternate;Y!==null&&(Y=Y.updateQueue,w=Y.lastBaseUpdate,w!==y&&(w===null?Y.firstBaseUpdate=H:w.next=H,Y.lastBaseUpdate=O))}if(p!==null){var X=f.baseState;y=0,Y=H=O=null,w=p;do{var I=w.lane&-536870913,W=I!==w.lane;if(W?(Fe&I)===I:(u&I)===I){I!==0&&I===Aa&&(Cd=!0),Y!==null&&(Y=Y.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var _e=s,ke=w;I=r;var ct=o;switch(ke.tag){case 1:if(_e=ke.payload,typeof _e=="function"){X=_e.call(ct,X,I);break e}X=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=ke.payload,I=typeof _e=="function"?_e.call(ct,X,I):_e,I==null)break e;X=g({},X,I);break e;case 2:Er=!0}}I=w.callback,I!==null&&(s.flags|=64,W&&(s.flags|=8192),W=f.callbacks,W===null?f.callbacks=[I]:W.push(I))}else W={lane:I,tag:w.tag,payload:w.payload,callback:w.callback,next:null},Y===null?(H=Y=W,O=X):Y=Y.next=W,y|=I;if(w=w.next,w===null){if(w=f.shared.pending,w===null)break;W=w,w=W.next,W.next=null,f.lastBaseUpdate=W,f.shared.pending=null}}while(!0);Y===null&&(O=X),f.baseState=O,f.firstBaseUpdate=H,f.lastBaseUpdate=Y,p===null&&(f.shared.lanes=0),Dr|=y,s.lanes=y,s.memoizedState=X}}function Fv(s,r){if(typeof s!="function")throw Error(n(191,s));s.call(r)}function Kv(s,r){var o=s.callbacks;if(o!==null)for(s.callbacks=null,s=0;s<o.length;s++)Fv(o[s],r)}var Ba=A(null),Pc=A(0);function $v(s,r){s=ir,ae(Pc,s),ae(Ba,r),ir=s|r.baseLanes}function jd(){ae(Pc,ir),ae(Ba,Ba.current)}function kd(){ir=Pc.current,Q(Ba),Q(Pc)}var zs=A(null),ii=null;function Or(s){var r=s.alternate;ae(Et,Et.current&1),ae(zs,s),ii===null&&(r===null||Ba.current!==null||r.memoizedState!==null)&&(ii=s)}function Ed(s){ae(Et,Et.current),ae(zs,s),ii===null&&(ii=s)}function Wv(s){s.tag===22?(ae(Et,Et.current),ae(zs,s),ii===null&&(ii=s)):Ar()}function Ar(){ae(Et,Et.current),ae(zs,zs.current)}function qs(s){Q(zs),ii===s&&(ii=null),Q(Et)}var Et=A(0);function Hc(s){for(var r=s;r!==null;){if(r.tag===13){var o=r.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||Df(o)||Bf(o)))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,Me=null,ot=null,Rt=null,Ic=!1,La=!1,Mn=!1,Uc=0,Xo=0,za=null,VC=0;function bt(){throw Error(n(321))}function Nd(s,r){if(r===null)return!1;for(var o=0;o<r.length&&o<s.length;o++)if(!Bs(s[o],r[o]))return!1;return!0}function Td(s,r,o,u,f,p){return Gi=p,Me=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,T.H=s===null||s.memoizedState===null?Tg:Kd,Mn=!1,p=o(u,f),Mn=!1,La&&(p=Yv(r,o,u,f)),Vv(s),p}function Vv(s){T.H=tl;var r=ot!==null&&ot.next!==null;if(Gi=0,Rt=ot=Me=null,Ic=!1,Xo=0,za=null,r)throw Error(n(300));s===null||Mt||(s=s.dependencies,s!==null&&Rc(s)&&(Mt=!0))}function Yv(s,r,o,u){Me=s;var f=0;do{if(La&&(za=null),Xo=0,La=!1,25<=f)throw Error(n(301));if(f+=1,Rt=ot=null,s.updateQueue!=null){var p=s.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}T.H=Og,p=r(o,u)}while(La);return p}function YC(){var s=T.H,r=s.useState()[0];return r=typeof r.then=="function"?Jo(r):r,s=s.useState()[0],(ot!==null?ot.memoizedState:null)!==s&&(Me.flags|=1024),r}function Od(){var s=Uc!==0;return Uc=0,s}function Ad(s,r,o){r.updateQueue=s.updateQueue,r.flags&=-2053,s.lanes&=~o}function Rd(s){if(Ic){for(s=s.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}Ic=!1}Gi=0,Rt=ot=Me=null,La=!1,Xo=Uc=0,za=null}function fs(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rt===null?Me.memoizedState=Rt=s:Rt=Rt.next=s,Rt}function Nt(){if(ot===null){var s=Me.alternate;s=s!==null?s.memoizedState:null}else s=ot.next;var r=Rt===null?Me.memoizedState:Rt.next;if(r!==null)Rt=r,ot=s;else{if(s===null)throw Me.alternate===null?Error(n(467)):Error(n(310));ot=s,s={memoizedState:ot.memoizedState,baseState:ot.baseState,baseQueue:ot.baseQueue,queue:ot.queue,next:null},Rt===null?Me.memoizedState=Rt=s:Rt=Rt.next=s}return Rt}function Fc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Jo(s){var r=Xo;return Xo+=1,za===null&&(za=[]),s=qv(za,s,r),r=Me,(Rt===null?r.memoizedState:Rt.next)===null&&(r=r.alternate,T.H=r===null||r.memoizedState===null?Tg:Kd),s}function Kc(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Jo(s);if(s.$$typeof===B)return ss(s)}throw Error(n(438,String(s)))}function Md(s){var r=null,o=Me.updateQueue;if(o!==null&&(r=o.memoCache),r==null){var u=Me.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(r={data:u.data.map(function(f){return f.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),o===null&&(o=Fc(),Me.updateQueue=o),o.memoCache=r,o=r.data[r.index],o===void 0)for(o=r.data[r.index]=Array(s),u=0;u<s;u++)o[u]=de;return r.index++,o}function Qi(s,r){return typeof r=="function"?r(s):r}function $c(s){var r=Nt();return Dd(r,ot,s)}function Dd(s,r,o){var u=s.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=o;var f=s.baseQueue,p=u.pending;if(p!==null){if(f!==null){var y=f.next;f.next=p.next,p.next=y}r.baseQueue=f=p,u.pending=null}if(p=s.baseState,f===null)s.memoizedState=p;else{r=f.next;var w=y=null,O=null,H=r,Y=!1;do{var X=H.lane&-536870913;if(X!==H.lane?(Fe&X)===X:(Gi&X)===X){var I=H.revertLane;if(I===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null}),X===Aa&&(Y=!0);else if((Gi&I)===I){H=H.next,I===Aa&&(Y=!0);continue}else X={lane:0,revertLane:H.revertLane,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},O===null?(w=O=X,y=p):O=O.next=X,Me.lanes|=I,Dr|=I;X=H.action,Mn&&o(p,X),p=H.hasEagerState?H.eagerState:o(p,X)}else I={lane:X,revertLane:H.revertLane,gesture:H.gesture,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},O===null?(w=O=I,y=p):O=O.next=I,Me.lanes|=X,Dr|=X;H=H.next}while(H!==null&&H!==r);if(O===null?y=p:O.next=w,!Bs(p,s.memoizedState)&&(Mt=!0,Y&&(o=Ra,o!==null)))throw o;s.memoizedState=p,s.baseState=y,s.baseQueue=O,u.lastRenderedState=p}return f===null&&(u.lanes=0),[s.memoizedState,u.dispatch]}function Bd(s){var r=Nt(),o=r.queue;if(o===null)throw Error(n(311));o.lastRenderedReducer=s;var u=o.dispatch,f=o.pending,p=r.memoizedState;if(f!==null){o.pending=null;var y=f=f.next;do p=s(p,y.action),y=y.next;while(y!==f);Bs(p,r.memoizedState)||(Mt=!0),r.memoizedState=p,r.baseQueue===null&&(r.baseState=p),o.lastRenderedState=p}return[p,u]}function Gv(s,r,o){var u=Me,f=Nt(),p=$e;if(p){if(o===void 0)throw Error(n(407));o=o()}else o=r();var y=!Bs((ot||f).memoizedState,o);if(y&&(f.memoizedState=o,Mt=!0),f=f.queue,qd(Xv.bind(null,u,f,s),[s]),f.getSnapshot!==r||y||Rt!==null&&Rt.memoizedState.tag&1){if(u.flags|=2048,qa(9,{destroy:void 0},Zv.bind(null,u,f,o,r),null),ht===null)throw Error(n(349));p||(Gi&127)!==0||Qv(u,r,o)}return o}function Qv(s,r,o){s.flags|=16384,s={getSnapshot:r,value:o},r=Me.updateQueue,r===null?(r=Fc(),Me.updateQueue=r,r.stores=[s]):(o=r.stores,o===null?r.stores=[s]:o.push(s))}function Zv(s,r,o,u){r.value=o,r.getSnapshot=u,Jv(r)&&eg(s)}function Xv(s,r,o){return o(function(){Jv(r)&&eg(s)})}function Jv(s){var r=s.getSnapshot;s=s.value;try{var o=r();return!Bs(s,o)}catch{return!0}}function eg(s){var r=Cn(s,2);r!==null&&ks(r,s,2)}function Ld(s){var r=fs();if(typeof s=="function"){var o=s;if(s=o(),Mn){br(!0);try{o()}finally{br(!1)}}}return r.memoizedState=r.baseState=s,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qi,lastRenderedState:s},r}function tg(s,r,o,u){return s.baseState=o,Dd(s,ot,typeof u=="function"?u:Qi)}function GC(s,r,o,u,f){if(Yc(s))throw Error(n(485));if(s=r.action,s!==null){var p={payload:f,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){p.listeners.push(y)}};T.T!==null?o(!0):p.isTransition=!1,u(p),o=r.pending,o===null?(p.next=r.pending=p,sg(r,p)):(p.next=o.next,r.pending=o.next=p)}}function sg(s,r){var o=r.action,u=r.payload,f=s.state;if(r.isTransition){var p=T.T,y={};T.T=y;try{var w=o(f,u),O=T.S;O!==null&&O(y,w),ig(s,r,w)}catch(H){zd(s,r,H)}finally{p!==null&&y.types!==null&&(p.types=y.types),T.T=p}}else try{p=o(f,u),ig(s,r,p)}catch(H){zd(s,r,H)}}function ig(s,r,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(u){rg(s,r,u)},function(u){return zd(s,r,u)}):rg(s,r,o)}function rg(s,r,o){r.status="fulfilled",r.value=o,ng(r),s.state=o,r=s.pending,r!==null&&(o=r.next,o===r?s.pending=null:(o=o.next,r.next=o,sg(s,o)))}function zd(s,r,o){var u=s.pending;if(s.pending=null,u!==null){u=u.next;do r.status="rejected",r.reason=o,ng(r),r=r.next;while(r!==u)}s.action=null}function ng(s){s=s.listeners;for(var r=0;r<s.length;r++)(0,s[r])()}function ag(s,r){return r}function og(s,r){if($e){var o=ht.formState;if(o!==null){e:{var u=Me;if($e){if(ft){t:{for(var f=ft,p=si;f.nodeType!==8;){if(!p){f=null;break t}if(f=ri(f.nextSibling),f===null){f=null;break t}}p=f.data,f=p==="F!"||p==="F"?f:null}if(f){ft=ri(f.nextSibling),u=f.data==="F!";break e}}jr(u)}u=!1}u&&(r=o[0])}}return o=fs(),o.memoizedState=o.baseState=r,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ag,lastRenderedState:r},o.queue=u,o=kg.bind(null,Me,u),u.dispatch=o,u=Ld(!1),p=Fd.bind(null,Me,!1,u.queue),u=fs(),f={state:r,dispatch:null,action:s,pending:null},u.queue=f,o=GC.bind(null,Me,f,p,o),f.dispatch=o,u.memoizedState=s,[r,o,!1]}function lg(s){var r=Nt();return cg(r,ot,s)}function cg(s,r,o){if(r=Dd(s,r,ag)[0],s=$c(Qi)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var u=Jo(r)}catch(y){throw y===Ma?Bc:y}else u=r;r=Nt();var f=r.queue,p=f.dispatch;return o!==r.memoizedState&&(Me.flags|=2048,qa(9,{destroy:void 0},QC.bind(null,f,o),null)),[u,p,s]}function QC(s,r){s.action=r}function ug(s){var r=Nt(),o=ot;if(o!==null)return cg(r,o,s);Nt(),r=r.memoizedState,o=Nt();var u=o.queue.dispatch;return o.memoizedState=s,[r,u,!1]}function qa(s,r,o,u){return s={tag:s,create:o,deps:u,inst:r,next:null},r=Me.updateQueue,r===null&&(r=Fc(),Me.updateQueue=r),o=r.lastEffect,o===null?r.lastEffect=s.next=s:(u=o.next,o.next=s,s.next=u,r.lastEffect=s),s}function hg(){return Nt().memoizedState}function Wc(s,r,o,u){var f=fs();Me.flags|=s,f.memoizedState=qa(1|r,{destroy:void 0},o,u===void 0?null:u)}function Vc(s,r,o,u){var f=Nt();u=u===void 0?null:u;var p=f.memoizedState.inst;ot!==null&&u!==null&&Nd(u,ot.memoizedState.deps)?f.memoizedState=qa(r,p,o,u):(Me.flags|=s,f.memoizedState=qa(1|r,p,o,u))}function dg(s,r){Wc(8390656,8,s,r)}function qd(s,r){Vc(2048,8,s,r)}function ZC(s){Me.flags|=4;var r=Me.updateQueue;if(r===null)r=Fc(),Me.updateQueue=r,r.events=[s];else{var o=r.events;o===null?r.events=[s]:o.push(s)}}function fg(s){var r=Nt().memoizedState;return ZC({ref:r,nextImpl:s}),function(){if((st&2)!==0)throw Error(n(440));return r.impl.apply(void 0,arguments)}}function mg(s,r){return Vc(4,2,s,r)}function _g(s,r){return Vc(4,4,s,r)}function pg(s,r){if(typeof r=="function"){s=s();var o=r(s);return function(){typeof o=="function"?o():r(null)}}if(r!=null)return s=s(),r.current=s,function(){r.current=null}}function vg(s,r,o){o=o!=null?o.concat([s]):null,Vc(4,4,pg.bind(null,r,s),o)}function Pd(){}function gg(s,r){var o=Nt();r=r===void 0?null:r;var u=o.memoizedState;return r!==null&&Nd(r,u[1])?u[0]:(o.memoizedState=[s,r],s)}function yg(s,r){var o=Nt();r=r===void 0?null:r;var u=o.memoizedState;if(r!==null&&Nd(r,u[1]))return u[0];if(u=s(),Mn){br(!0);try{s()}finally{br(!1)}}return o.memoizedState=[u,r],u}function Hd(s,r,o){return o===void 0||(Gi&1073741824)!==0&&(Fe&261930)===0?s.memoizedState=r:(s.memoizedState=o,s=by(),Me.lanes|=s,Dr|=s,o)}function bg(s,r,o,u){return Bs(o,r)?o:Ba.current!==null?(s=Hd(s,o,u),Bs(s,r)||(Mt=!0),s):(Gi&42)===0||(Gi&1073741824)!==0&&(Fe&261930)===0?(Mt=!0,s.memoizedState=o):(s=by(),Me.lanes|=s,Dr|=s,r)}function Sg(s,r,o,u,f){var p=U.p;U.p=p!==0&&8>p?p:8;var y=T.T,w={};T.T=w,Fd(s,!1,r,o);try{var O=f(),H=T.S;if(H!==null&&H(w,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var Y=WC(O,u);el(s,r,Y,Is(s))}else el(s,r,u,Is(s))}catch(X){el(s,r,{then:function(){},status:"rejected",reason:X},Is())}finally{U.p=p,y!==null&&w.types!==null&&(y.types=w.types),T.T=y}}function XC(){}function Id(s,r,o,u){if(s.tag!==5)throw Error(n(476));var f=xg(s).queue;Sg(s,f,r,F,o===null?XC:function(){return wg(s),o(u)})}function xg(s){var r=s.memoizedState;if(r!==null)return r;r={memoizedState:F,baseState:F,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qi,lastRenderedState:F},next:null};var o={};return r.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qi,lastRenderedState:o},next:null},s.memoizedState=r,s=s.alternate,s!==null&&(s.memoizedState=r),r}function wg(s){var r=xg(s);r.next===null&&(r=s.alternate.memoizedState),el(s,r.next.queue,{},Is())}function Ud(){return ss(vl)}function Cg(){return Nt().memoizedState}function jg(){return Nt().memoizedState}function JC(s){for(var r=s.return;r!==null;){switch(r.tag){case 24:case 3:var o=Is();s=Nr(o);var u=Tr(r,s,o);u!==null&&(ks(u,r,o),Go(u,r,o)),r={cache:vd()},s.payload=r;return}r=r.return}}function ej(s,r,o){var u=Is();o={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Yc(s)?Eg(r,o):(o=ad(s,r,o,u),o!==null&&(ks(o,s,u),Ng(o,r,u)))}function kg(s,r,o){var u=Is();el(s,r,o,u)}function el(s,r,o,u){var f={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Yc(s))Eg(r,f);else{var p=s.alternate;if(s.lanes===0&&(p===null||p.lanes===0)&&(p=r.lastRenderedReducer,p!==null))try{var y=r.lastRenderedState,w=p(y,o);if(f.hasEagerState=!0,f.eagerState=w,Bs(w,y))return Nc(s,r,f,0),ht===null&&Ec(),!1}catch{}finally{}if(o=ad(s,r,f,u),o!==null)return ks(o,s,u),Ng(o,r,u),!0}return!1}function Fd(s,r,o,u){if(u={lane:2,revertLane:xf(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Yc(s)){if(r)throw Error(n(479))}else r=ad(s,o,u,2),r!==null&&ks(r,s,2)}function Yc(s){var r=s.alternate;return s===Me||r!==null&&r===Me}function Eg(s,r){La=Ic=!0;var o=s.pending;o===null?r.next=r:(r.next=o.next,o.next=r),s.pending=r}function Ng(s,r,o){if((o&4194048)!==0){var u=r.lanes;u&=s.pendingLanes,o|=u,r.lanes=o,Mp(s,o)}}var tl={readContext:ss,use:Kc,useCallback:bt,useContext:bt,useEffect:bt,useImperativeHandle:bt,useLayoutEffect:bt,useInsertionEffect:bt,useMemo:bt,useReducer:bt,useRef:bt,useState:bt,useDebugValue:bt,useDeferredValue:bt,useTransition:bt,useSyncExternalStore:bt,useId:bt,useHostTransitionStatus:bt,useFormState:bt,useActionState:bt,useOptimistic:bt,useMemoCache:bt,useCacheRefresh:bt};tl.useEffectEvent=bt;var Tg={readContext:ss,use:Kc,useCallback:function(s,r){return fs().memoizedState=[s,r===void 0?null:r],s},useContext:ss,useEffect:dg,useImperativeHandle:function(s,r,o){o=o!=null?o.concat([s]):null,Wc(4194308,4,pg.bind(null,r,s),o)},useLayoutEffect:function(s,r){return Wc(4194308,4,s,r)},useInsertionEffect:function(s,r){Wc(4,2,s,r)},useMemo:function(s,r){var o=fs();r=r===void 0?null:r;var u=s();if(Mn){br(!0);try{s()}finally{br(!1)}}return o.memoizedState=[u,r],u},useReducer:function(s,r,o){var u=fs();if(o!==void 0){var f=o(r);if(Mn){br(!0);try{o(r)}finally{br(!1)}}}else f=r;return u.memoizedState=u.baseState=f,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:f},u.queue=s,s=s.dispatch=ej.bind(null,Me,s),[u.memoizedState,s]},useRef:function(s){var r=fs();return s={current:s},r.memoizedState=s},useState:function(s){s=Ld(s);var r=s.queue,o=kg.bind(null,Me,r);return r.dispatch=o,[s.memoizedState,o]},useDebugValue:Pd,useDeferredValue:function(s,r){var o=fs();return Hd(o,s,r)},useTransition:function(){var s=Ld(!1);return s=Sg.bind(null,Me,s.queue,!0,!1),fs().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,r,o){var u=Me,f=fs();if($e){if(o===void 0)throw Error(n(407));o=o()}else{if(o=r(),ht===null)throw Error(n(349));(Fe&127)!==0||Qv(u,r,o)}f.memoizedState=o;var p={value:o,getSnapshot:r};return f.queue=p,dg(Xv.bind(null,u,p,s),[s]),u.flags|=2048,qa(9,{destroy:void 0},Zv.bind(null,u,p,o,r),null),o},useId:function(){var s=fs(),r=ht.identifierPrefix;if($e){var o=Ci,u=wi;o=(u&~(1<<32-Ds(u)-1)).toString(32)+o,r="_"+r+"R_"+o,o=Uc++,0<o&&(r+="H"+o.toString(32)),r+="_"}else o=VC++,r="_"+r+"r_"+o.toString(32)+"_";return s.memoizedState=r},useHostTransitionStatus:Ud,useFormState:og,useActionState:og,useOptimistic:function(s){var r=fs();r.memoizedState=r.baseState=s;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=o,r=Fd.bind(null,Me,!0,o),o.dispatch=r,[s,r]},useMemoCache:Md,useCacheRefresh:function(){return fs().memoizedState=JC.bind(null,Me)},useEffectEvent:function(s){var r=fs(),o={impl:s};return r.memoizedState=o,function(){if((st&2)!==0)throw Error(n(440));return o.impl.apply(void 0,arguments)}}},Kd={readContext:ss,use:Kc,useCallback:gg,useContext:ss,useEffect:qd,useImperativeHandle:vg,useInsertionEffect:mg,useLayoutEffect:_g,useMemo:yg,useReducer:$c,useRef:hg,useState:function(){return $c(Qi)},useDebugValue:Pd,useDeferredValue:function(s,r){var o=Nt();return bg(o,ot.memoizedState,s,r)},useTransition:function(){var s=$c(Qi)[0],r=Nt().memoizedState;return[typeof s=="boolean"?s:Jo(s),r]},useSyncExternalStore:Gv,useId:Cg,useHostTransitionStatus:Ud,useFormState:lg,useActionState:lg,useOptimistic:function(s,r){var o=Nt();return tg(o,ot,s,r)},useMemoCache:Md,useCacheRefresh:jg};Kd.useEffectEvent=fg;var Og={readContext:ss,use:Kc,useCallback:gg,useContext:ss,useEffect:qd,useImperativeHandle:vg,useInsertionEffect:mg,useLayoutEffect:_g,useMemo:yg,useReducer:Bd,useRef:hg,useState:function(){return Bd(Qi)},useDebugValue:Pd,useDeferredValue:function(s,r){var o=Nt();return ot===null?Hd(o,s,r):bg(o,ot.memoizedState,s,r)},useTransition:function(){var s=Bd(Qi)[0],r=Nt().memoizedState;return[typeof s=="boolean"?s:Jo(s),r]},useSyncExternalStore:Gv,useId:Cg,useHostTransitionStatus:Ud,useFormState:ug,useActionState:ug,useOptimistic:function(s,r){var o=Nt();return ot!==null?tg(o,ot,s,r):(o.baseState=s,[s,o.queue.dispatch])},useMemoCache:Md,useCacheRefresh:jg};Og.useEffectEvent=fg;function $d(s,r,o,u){r=s.memoizedState,o=o(u,r),o=o==null?r:g({},r,o),s.memoizedState=o,s.lanes===0&&(s.updateQueue.baseState=o)}var Wd={enqueueSetState:function(s,r,o){s=s._reactInternals;var u=Is(),f=Nr(u);f.payload=r,o!=null&&(f.callback=o),r=Tr(s,f,u),r!==null&&(ks(r,s,u),Go(r,s,u))},enqueueReplaceState:function(s,r,o){s=s._reactInternals;var u=Is(),f=Nr(u);f.tag=1,f.payload=r,o!=null&&(f.callback=o),r=Tr(s,f,u),r!==null&&(ks(r,s,u),Go(r,s,u))},enqueueForceUpdate:function(s,r){s=s._reactInternals;var o=Is(),u=Nr(o);u.tag=2,r!=null&&(u.callback=r),r=Tr(s,u,o),r!==null&&(ks(r,s,o),Go(r,s,o))}};function Ag(s,r,o,u,f,p,y){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(u,p,y):r.prototype&&r.prototype.isPureReactComponent?!Io(o,u)||!Io(f,p):!0}function Rg(s,r,o,u){s=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(o,u),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(o,u),r.state!==s&&Wd.enqueueReplaceState(r,r.state,null)}function Dn(s,r){var o=r;if("ref"in r){o={};for(var u in r)u!=="ref"&&(o[u]=r[u])}if(s=s.defaultProps){o===r&&(o=g({},o));for(var f in s)o[f]===void 0&&(o[f]=s[f])}return o}function Mg(s){kc(s)}function Dg(s){console.error(s)}function Bg(s){kc(s)}function Gc(s,r){try{var o=s.onUncaughtError;o(r.value,{componentStack:r.stack})}catch(u){setTimeout(function(){throw u})}}function Lg(s,r,o){try{var u=s.onCaughtError;u(o.value,{componentStack:o.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Vd(s,r,o){return o=Nr(o),o.tag=3,o.payload={element:null},o.callback=function(){Gc(s,r)},o}function zg(s){return s=Nr(s),s.tag=3,s}function qg(s,r,o,u){var f=o.type.getDerivedStateFromError;if(typeof f=="function"){var p=u.value;s.payload=function(){return f(p)},s.callback=function(){Lg(r,o,u)}}var y=o.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(s.callback=function(){Lg(r,o,u),typeof f!="function"&&(Br===null?Br=new Set([this]):Br.add(this));var w=u.stack;this.componentDidCatch(u.value,{componentStack:w!==null?w:""})})}function tj(s,r,o,u,f){if(o.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(r=o.alternate,r!==null&&Oa(r,o,f,!0),o=zs.current,o!==null){switch(o.tag){case 31:case 13:return ii===null?ou():o.alternate===null&&St===0&&(St=3),o.flags&=-257,o.flags|=65536,o.lanes=f,u===Lc?o.flags|=16384:(r=o.updateQueue,r===null?o.updateQueue=new Set([u]):r.add(u),yf(s,u,f)),!1;case 22:return o.flags|=65536,u===Lc?o.flags|=16384:(r=o.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([u])},o.updateQueue=r):(o=r.retryQueue,o===null?r.retryQueue=new Set([u]):o.add(u)),yf(s,u,f)),!1}throw Error(n(435,o.tag))}return yf(s,u,f),ou(),!1}if($e)return r=zs.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=f,u!==dd&&(s=Error(n(422),{cause:u}),Ko(Js(s,o)))):(u!==dd&&(r=Error(n(423),{cause:u}),Ko(Js(r,o))),s=s.current.alternate,s.flags|=65536,f&=-f,s.lanes|=f,u=Js(u,o),f=Vd(s.stateNode,u,f),wd(s,f),St!==4&&(St=2)),!1;var p=Error(n(520),{cause:u});if(p=Js(p,o),cl===null?cl=[p]:cl.push(p),St!==4&&(St=2),r===null)return!0;u=Js(u,o),o=r;do{switch(o.tag){case 3:return o.flags|=65536,s=f&-f,o.lanes|=s,s=Vd(o.stateNode,u,s),wd(o,s),!1;case 1:if(r=o.type,p=o.stateNode,(o.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(Br===null||!Br.has(p))))return o.flags|=65536,f&=-f,o.lanes|=f,f=zg(f),qg(f,s,o,u),wd(o,f),!1}o=o.return}while(o!==null);return!1}var Yd=Error(n(461)),Mt=!1;function is(s,r,o,u){r.child=s===null?Uv(r,null,o,u):Rn(r,s.child,o,u)}function Pg(s,r,o,u,f){o=o.render;var p=r.ref;if("ref"in u){var y={};for(var w in u)w!=="ref"&&(y[w]=u[w])}else y=u;return Nn(r),u=Td(s,r,o,y,p,f),w=Od(),s!==null&&!Mt?(Ad(s,r,f),Zi(s,r,f)):($e&&w&&ud(r),r.flags|=1,is(s,r,u,f),r.child)}function Hg(s,r,o,u,f){if(s===null){var p=o.type;return typeof p=="function"&&!od(p)&&p.defaultProps===void 0&&o.compare===null?(r.tag=15,r.type=p,Ig(s,r,p,u,f)):(s=Oc(o.type,null,u,r,r.mode,f),s.ref=r.ref,s.return=r,r.child=s)}if(p=s.child,!sf(s,f)){var y=p.memoizedProps;if(o=o.compare,o=o!==null?o:Io,o(y,u)&&s.ref===r.ref)return Zi(s,r,f)}return r.flags|=1,s=$i(p,u),s.ref=r.ref,s.return=r,r.child=s}function Ig(s,r,o,u,f){if(s!==null){var p=s.memoizedProps;if(Io(p,u)&&s.ref===r.ref)if(Mt=!1,r.pendingProps=u=p,sf(s,f))(s.flags&131072)!==0&&(Mt=!0);else return r.lanes=s.lanes,Zi(s,r,f)}return Gd(s,r,o,u,f)}function Ug(s,r,o,u){var f=u.children,p=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(p=p!==null?p.baseLanes|o:o,s!==null){for(u=r.child=s.child,f=0;u!==null;)f=f|u.lanes|u.childLanes,u=u.sibling;u=f&~p}else u=0,r.child=null;return Fg(s,r,p,o,u)}if((o&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},s!==null&&Dc(r,p!==null?p.cachePool:null),p!==null?$v(r,p):jd(),Wv(r);else return u=r.lanes=536870912,Fg(s,r,p!==null?p.baseLanes|o:o,o,u)}else p!==null?(Dc(r,p.cachePool),$v(r,p),Ar(),r.memoizedState=null):(s!==null&&Dc(r,null),jd(),Ar());return is(s,r,f,o),r.child}function sl(s,r){return s!==null&&s.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function Fg(s,r,o,u,f){var p=yd();return p=p===null?null:{parent:At._currentValue,pool:p},r.memoizedState={baseLanes:o,cachePool:p},s!==null&&Dc(r,null),jd(),Wv(r),s!==null&&Oa(s,r,u,!0),r.childLanes=f,null}function Qc(s,r){return r=Xc({mode:r.mode,children:r.children},s.mode),r.ref=s.ref,s.child=r,r.return=s,r}function Kg(s,r,o){return Rn(r,s.child,null,o),s=Qc(r,r.pendingProps),s.flags|=2,qs(r),r.memoizedState=null,s}function sj(s,r,o){var u=r.pendingProps,f=(r.flags&128)!==0;if(r.flags&=-129,s===null){if($e){if(u.mode==="hidden")return s=Qc(r,u),r.lanes=536870912,sl(null,s);if(Ed(r),(s=ft)?(s=sb(s,si),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},o=Ev(s),o.return=r,r.child=o,ts=r,ft=null)):s=null,s===null)throw jr(r);return r.lanes=536870912,null}return Qc(r,u)}var p=s.memoizedState;if(p!==null){var y=p.dehydrated;if(Ed(r),f)if(r.flags&256)r.flags&=-257,r=Kg(s,r,o);else if(r.memoizedState!==null)r.child=s.child,r.flags|=128,r=null;else throw Error(n(558));else if(Mt||Oa(s,r,o,!1),f=(o&s.childLanes)!==0,Mt||f){if(u=ht,u!==null&&(y=Dp(u,o),y!==0&&y!==p.retryLane))throw p.retryLane=y,Cn(s,y),ks(u,s,y),Yd;ou(),r=Kg(s,r,o)}else s=p.treeContext,ft=ri(y.nextSibling),ts=r,$e=!0,Cr=null,si=!1,s!==null&&Ov(r,s),r=Qc(r,u),r.flags|=4096;return r}return s=$i(s.child,{mode:u.mode,children:u.children}),s.ref=r.ref,r.child=s,s.return=r,s}function Zc(s,r){var o=r.ref;if(o===null)s!==null&&s.ref!==null&&(r.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(n(284));(s===null||s.ref!==o)&&(r.flags|=4194816)}}function Gd(s,r,o,u,f){return Nn(r),o=Td(s,r,o,u,void 0,f),u=Od(),s!==null&&!Mt?(Ad(s,r,f),Zi(s,r,f)):($e&&u&&ud(r),r.flags|=1,is(s,r,o,f),r.child)}function $g(s,r,o,u,f,p){return Nn(r),r.updateQueue=null,o=Yv(r,u,o,f),Vv(s),u=Od(),s!==null&&!Mt?(Ad(s,r,p),Zi(s,r,p)):($e&&u&&ud(r),r.flags|=1,is(s,r,o,p),r.child)}function Wg(s,r,o,u,f){if(Nn(r),r.stateNode===null){var p=ka,y=o.contextType;typeof y=="object"&&y!==null&&(p=ss(y)),p=new o(u,p),r.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Wd,r.stateNode=p,p._reactInternals=r,p=r.stateNode,p.props=u,p.state=r.memoizedState,p.refs={},Sd(r),y=o.contextType,p.context=typeof y=="object"&&y!==null?ss(y):ka,p.state=r.memoizedState,y=o.getDerivedStateFromProps,typeof y=="function"&&($d(r,o,y,u),p.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(y=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),y!==p.state&&Wd.enqueueReplaceState(p,p.state,null),Zo(r,u,p,f),Qo(),p.state=r.memoizedState),typeof p.componentDidMount=="function"&&(r.flags|=4194308),u=!0}else if(s===null){p=r.stateNode;var w=r.memoizedProps,O=Dn(o,w);p.props=O;var H=p.context,Y=o.contextType;y=ka,typeof Y=="object"&&Y!==null&&(y=ss(Y));var X=o.getDerivedStateFromProps;Y=typeof X=="function"||typeof p.getSnapshotBeforeUpdate=="function",w=r.pendingProps!==w,Y||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w||H!==y)&&Rg(r,p,u,y),Er=!1;var I=r.memoizedState;p.state=I,Zo(r,u,p,f),Qo(),H=r.memoizedState,w||I!==H||Er?(typeof X=="function"&&($d(r,o,X,u),H=r.memoizedState),(O=Er||Ag(r,o,O,u,I,H,y))?(Y||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(r.flags|=4194308)):(typeof p.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=u,r.memoizedState=H),p.props=u,p.state=H,p.context=y,u=O):(typeof p.componentDidMount=="function"&&(r.flags|=4194308),u=!1)}else{p=r.stateNode,xd(s,r),y=r.memoizedProps,Y=Dn(o,y),p.props=Y,X=r.pendingProps,I=p.context,H=o.contextType,O=ka,typeof H=="object"&&H!==null&&(O=ss(H)),w=o.getDerivedStateFromProps,(H=typeof w=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(y!==X||I!==O)&&Rg(r,p,u,O),Er=!1,I=r.memoizedState,p.state=I,Zo(r,u,p,f),Qo();var W=r.memoizedState;y!==X||I!==W||Er||s!==null&&s.dependencies!==null&&Rc(s.dependencies)?(typeof w=="function"&&($d(r,o,w,u),W=r.memoizedState),(Y=Er||Ag(r,o,Y,u,I,W,O)||s!==null&&s.dependencies!==null&&Rc(s.dependencies))?(H||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(u,W,O),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(u,W,O)),typeof p.componentDidUpdate=="function"&&(r.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof p.componentDidUpdate!="function"||y===s.memoizedProps&&I===s.memoizedState||(r.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||y===s.memoizedProps&&I===s.memoizedState||(r.flags|=1024),r.memoizedProps=u,r.memoizedState=W),p.props=u,p.state=W,p.context=O,u=Y):(typeof p.componentDidUpdate!="function"||y===s.memoizedProps&&I===s.memoizedState||(r.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||y===s.memoizedProps&&I===s.memoizedState||(r.flags|=1024),u=!1)}return p=u,Zc(s,r),u=(r.flags&128)!==0,p||u?(p=r.stateNode,o=u&&typeof o.getDerivedStateFromError!="function"?null:p.render(),r.flags|=1,s!==null&&u?(r.child=Rn(r,s.child,null,f),r.child=Rn(r,null,o,f)):is(s,r,o,f),r.memoizedState=p.state,s=r.child):s=Zi(s,r,f),s}function Vg(s,r,o,u){return kn(),r.flags|=256,is(s,r,o,u),r.child}var Qd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Zd(s){return{baseLanes:s,cachePool:Lv()}}function Xd(s,r,o){return s=s!==null?s.childLanes&~o:0,r&&(s|=Hs),s}function Yg(s,r,o){var u=r.pendingProps,f=!1,p=(r.flags&128)!==0,y;if((y=p)||(y=s!==null&&s.memoizedState===null?!1:(Et.current&2)!==0),y&&(f=!0,r.flags&=-129),y=(r.flags&32)!==0,r.flags&=-33,s===null){if($e){if(f?Or(r):Ar(),(s=ft)?(s=sb(s,si),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},o=Ev(s),o.return=r,r.child=o,ts=r,ft=null)):s=null,s===null)throw jr(r);return Bf(s)?r.lanes=32:r.lanes=536870912,null}var w=u.children;return u=u.fallback,f?(Ar(),f=r.mode,w=Xc({mode:"hidden",children:w},f),u=jn(u,f,o,null),w.return=r,u.return=r,w.sibling=u,r.child=w,u=r.child,u.memoizedState=Zd(o),u.childLanes=Xd(s,y,o),r.memoizedState=Qd,sl(null,u)):(Or(r),Jd(r,w))}var O=s.memoizedState;if(O!==null&&(w=O.dehydrated,w!==null)){if(p)r.flags&256?(Or(r),r.flags&=-257,r=ef(s,r,o)):r.memoizedState!==null?(Ar(),r.child=s.child,r.flags|=128,r=null):(Ar(),w=u.fallback,f=r.mode,u=Xc({mode:"visible",children:u.children},f),w=jn(w,f,o,null),w.flags|=2,u.return=r,w.return=r,u.sibling=w,r.child=u,Rn(r,s.child,null,o),u=r.child,u.memoizedState=Zd(o),u.childLanes=Xd(s,y,o),r.memoizedState=Qd,r=sl(null,u));else if(Or(r),Bf(w)){if(y=w.nextSibling&&w.nextSibling.dataset,y)var H=y.dgst;y=H,u=Error(n(419)),u.stack="",u.digest=y,Ko({value:u,source:null,stack:null}),r=ef(s,r,o)}else if(Mt||Oa(s,r,o,!1),y=(o&s.childLanes)!==0,Mt||y){if(y=ht,y!==null&&(u=Dp(y,o),u!==0&&u!==O.retryLane))throw O.retryLane=u,Cn(s,u),ks(y,s,u),Yd;Df(w)||ou(),r=ef(s,r,o)}else Df(w)?(r.flags|=192,r.child=s.child,r=null):(s=O.treeContext,ft=ri(w.nextSibling),ts=r,$e=!0,Cr=null,si=!1,s!==null&&Ov(r,s),r=Jd(r,u.children),r.flags|=4096);return r}return f?(Ar(),w=u.fallback,f=r.mode,O=s.child,H=O.sibling,u=$i(O,{mode:"hidden",children:u.children}),u.subtreeFlags=O.subtreeFlags&65011712,H!==null?w=$i(H,w):(w=jn(w,f,o,null),w.flags|=2),w.return=r,u.return=r,u.sibling=w,r.child=u,sl(null,u),u=r.child,w=s.child.memoizedState,w===null?w=Zd(o):(f=w.cachePool,f!==null?(O=At._currentValue,f=f.parent!==O?{parent:O,pool:O}:f):f=Lv(),w={baseLanes:w.baseLanes|o,cachePool:f}),u.memoizedState=w,u.childLanes=Xd(s,y,o),r.memoizedState=Qd,sl(s.child,u)):(Or(r),o=s.child,s=o.sibling,o=$i(o,{mode:"visible",children:u.children}),o.return=r,o.sibling=null,s!==null&&(y=r.deletions,y===null?(r.deletions=[s],r.flags|=16):y.push(s)),r.child=o,r.memoizedState=null,o)}function Jd(s,r){return r=Xc({mode:"visible",children:r},s.mode),r.return=s,s.child=r}function Xc(s,r){return s=Ls(22,s,null,r),s.lanes=0,s}function ef(s,r,o){return Rn(r,s.child,null,o),s=Jd(r,r.pendingProps.children),s.flags|=2,r.memoizedState=null,s}function Gg(s,r,o){s.lanes|=r;var u=s.alternate;u!==null&&(u.lanes|=r),_d(s.return,r,o)}function tf(s,r,o,u,f,p){var y=s.memoizedState;y===null?s.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:u,tail:o,tailMode:f,treeForkCount:p}:(y.isBackwards=r,y.rendering=null,y.renderingStartTime=0,y.last=u,y.tail=o,y.tailMode=f,y.treeForkCount=p)}function Qg(s,r,o){var u=r.pendingProps,f=u.revealOrder,p=u.tail;u=u.children;var y=Et.current,w=(y&2)!==0;if(w?(y=y&1|2,r.flags|=128):y&=1,ae(Et,y),is(s,r,u,o),u=$e?Fo:0,!w&&s!==null&&(s.flags&128)!==0)e:for(s=r.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Gg(s,o,r);else if(s.tag===19)Gg(s,o,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(f){case"forwards":for(o=r.child,f=null;o!==null;)s=o.alternate,s!==null&&Hc(s)===null&&(f=o),o=o.sibling;o=f,o===null?(f=r.child,r.child=null):(f=o.sibling,o.sibling=null),tf(r,!1,f,o,p,u);break;case"backwards":case"unstable_legacy-backwards":for(o=null,f=r.child,r.child=null;f!==null;){if(s=f.alternate,s!==null&&Hc(s)===null){r.child=f;break}s=f.sibling,f.sibling=o,o=f,f=s}tf(r,!0,o,null,p,u);break;case"together":tf(r,!1,null,null,void 0,u);break;default:r.memoizedState=null}return r.child}function Zi(s,r,o){if(s!==null&&(r.dependencies=s.dependencies),Dr|=r.lanes,(o&r.childLanes)===0)if(s!==null){if(Oa(s,r,o,!1),(o&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,o=$i(s,s.pendingProps),r.child=o,o.return=r;s.sibling!==null;)s=s.sibling,o=o.sibling=$i(s,s.pendingProps),o.return=r;o.sibling=null}return r.child}function sf(s,r){return(s.lanes&r)!==0?!0:(s=s.dependencies,!!(s!==null&&Rc(s)))}function ij(s,r,o){switch(r.tag){case 3:kt(r,r.stateNode.containerInfo),kr(r,At,s.memoizedState.cache),kn();break;case 27:case 5:As(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,Ed(r),null;break;case 13:var u=r.memoizedState;if(u!==null)return u.dehydrated!==null?(Or(r),r.flags|=128,null):(o&r.child.childLanes)!==0?Yg(s,r,o):(Or(r),s=Zi(s,r,o),s!==null?s.sibling:null);Or(r);break;case 19:var f=(s.flags&128)!==0;if(u=(o&r.childLanes)!==0,u||(Oa(s,r,o,!1),u=(o&r.childLanes)!==0),f){if(u)return Qg(s,r,o);r.flags|=128}if(f=r.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),ae(Et,Et.current),u)break;return null;case 22:return r.lanes=0,Ug(s,r,o,r.pendingProps);case 24:kr(r,At,s.memoizedState.cache)}return Zi(s,r,o)}function Zg(s,r,o){if(s!==null)if(s.memoizedProps!==r.pendingProps)Mt=!0;else{if(!sf(s,o)&&(r.flags&128)===0)return Mt=!1,ij(s,r,o);Mt=(s.flags&131072)!==0}else Mt=!1,$e&&(r.flags&1048576)!==0&&Tv(r,Fo,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")od(s)?(u=Dn(s,u),r.tag=1,r=Wg(null,r,s,u,o)):(r.tag=0,r=Gd(null,r,s,u,o));else{if(s!=null){var f=s.$$typeof;if(f===M){r.tag=11,r=Pg(null,r,s,u,o);break e}else if(f===q){r.tag=14,r=Hg(null,r,s,u,o);break e}}throw r=se(s)||s,Error(n(306,r,""))}}return r;case 0:return Gd(s,r,r.type,r.pendingProps,o);case 1:return u=r.type,f=Dn(u,r.pendingProps),Wg(s,r,u,f,o);case 3:e:{if(kt(r,r.stateNode.containerInfo),s===null)throw Error(n(387));u=r.pendingProps;var p=r.memoizedState;f=p.element,xd(s,r),Zo(r,u,null,o);var y=r.memoizedState;if(u=y.cache,kr(r,At,u),u!==p.cache&&pd(r,[At],o,!0),Qo(),u=y.element,p.isDehydrated)if(p={element:u,isDehydrated:!1,cache:y.cache},r.updateQueue.baseState=p,r.memoizedState=p,r.flags&256){r=Vg(s,r,u,o);break e}else if(u!==f){f=Js(Error(n(424)),r),Ko(f),r=Vg(s,r,u,o);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=ri(s.firstChild),ts=r,$e=!0,Cr=null,si=!0,o=Uv(r,null,u,o),r.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling}else{if(kn(),u===f){r=Zi(s,r,o);break e}is(s,r,u,o)}r=r.child}return r;case 26:return Zc(s,r),s===null?(o=lb(r.type,null,r.pendingProps,null))?r.memoizedState=o:$e||(o=r.type,s=r.pendingProps,u=mu(ye.current).createElement(o),u[es]=r,u[bs]=s,rs(u,o,s),Wt(u),r.stateNode=u):r.memoizedState=lb(r.type,s.memoizedProps,r.pendingProps,s.memoizedState),null;case 27:return As(r),s===null&&$e&&(u=r.stateNode=nb(r.type,r.pendingProps,ye.current),ts=r,si=!0,f=ft,Pr(r.type)?(Lf=f,ft=ri(u.firstChild)):ft=f),is(s,r,r.pendingProps.children,o),Zc(s,r),s===null&&(r.flags|=4194304),r.child;case 5:return s===null&&$e&&((f=u=ft)&&(u=Mj(u,r.type,r.pendingProps,si),u!==null?(r.stateNode=u,ts=r,ft=ri(u.firstChild),si=!1,f=!0):f=!1),f||jr(r)),As(r),f=r.type,p=r.pendingProps,y=s!==null?s.memoizedProps:null,u=p.children,Af(f,p)?u=null:y!==null&&Af(f,y)&&(r.flags|=32),r.memoizedState!==null&&(f=Td(s,r,YC,null,null,o),vl._currentValue=f),Zc(s,r),is(s,r,u,o),r.child;case 6:return s===null&&$e&&((s=o=ft)&&(o=Dj(o,r.pendingProps,si),o!==null?(r.stateNode=o,ts=r,ft=null,s=!0):s=!1),s||jr(r)),null;case 13:return Yg(s,r,o);case 4:return kt(r,r.stateNode.containerInfo),u=r.pendingProps,s===null?r.child=Rn(r,null,u,o):is(s,r,u,o),r.child;case 11:return Pg(s,r,r.type,r.pendingProps,o);case 7:return is(s,r,r.pendingProps,o),r.child;case 8:return is(s,r,r.pendingProps.children,o),r.child;case 12:return is(s,r,r.pendingProps.children,o),r.child;case 10:return u=r.pendingProps,kr(r,r.type,u.value),is(s,r,u.children,o),r.child;case 9:return f=r.type._context,u=r.pendingProps.children,Nn(r),f=ss(f),u=u(f),r.flags|=1,is(s,r,u,o),r.child;case 14:return Hg(s,r,r.type,r.pendingProps,o);case 15:return Ig(s,r,r.type,r.pendingProps,o);case 19:return Qg(s,r,o);case 31:return sj(s,r,o);case 22:return Ug(s,r,o,r.pendingProps);case 24:return Nn(r),u=ss(At),s===null?(f=yd(),f===null&&(f=ht,p=vd(),f.pooledCache=p,p.refCount++,p!==null&&(f.pooledCacheLanes|=o),f=p),r.memoizedState={parent:u,cache:f},Sd(r),kr(r,At,f)):((s.lanes&o)!==0&&(xd(s,r),Zo(r,null,null,o),Qo()),f=s.memoizedState,p=r.memoizedState,f.parent!==u?(f={parent:u,cache:u},r.memoizedState=f,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=f),kr(r,At,u)):(u=p.cache,kr(r,At,u),u!==f.cache&&pd(r,[At],o,!0))),is(s,r,r.pendingProps.children,o),r.child;case 29:throw r.pendingProps}throw Error(n(156,r.tag))}function Xi(s){s.flags|=4}function rf(s,r,o,u,f){if((r=(s.mode&32)!==0)&&(r=!1),r){if(s.flags|=16777216,(f&335544128)===f)if(s.stateNode.complete)s.flags|=8192;else if(Cy())s.flags|=8192;else throw An=Lc,bd}else s.flags&=-16777217}function Xg(s,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!fb(r))if(Cy())s.flags|=8192;else throw An=Lc,bd}function Jc(s,r){r!==null&&(s.flags|=4),s.flags&16384&&(r=s.tag!==22?Ap():536870912,s.lanes|=r,Ua|=r)}function il(s,r){if(!$e)switch(s.tailMode){case"hidden":r=s.tail;for(var o=null;r!==null;)r.alternate!==null&&(o=r),r=r.sibling;o===null?s.tail=null:o.sibling=null;break;case"collapsed":o=s.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.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,o=0,u=0;if(r)for(var f=s.child;f!==null;)o|=f.lanes|f.childLanes,u|=f.subtreeFlags&65011712,u|=f.flags&65011712,f.return=s,f=f.sibling;else for(f=s.child;f!==null;)o|=f.lanes|f.childLanes,u|=f.subtreeFlags,u|=f.flags,f.return=s,f=f.sibling;return s.subtreeFlags|=u,s.childLanes=o,r}function rj(s,r,o){var u=r.pendingProps;switch(hd(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 o=r.stateNode,u=null,s!==null&&(u=s.memoizedState.cache),r.memoizedState.cache!==u&&(r.flags|=2048),Yi(At),Qe(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(s===null||s.child===null)&&(Ta(r)?Xi(r):s===null||s.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,fd())),mt(r),null;case 26:var f=r.type,p=r.memoizedState;return s===null?(Xi(r),p!==null?(mt(r),Xg(r,p)):(mt(r),rf(r,f,null,u,o))):p?p!==s.memoizedState?(Xi(r),mt(r),Xg(r,p)):(mt(r),r.flags&=-16777217):(s=s.memoizedProps,s!==u&&Xi(r),mt(r),rf(r,f,s,u,o)),null;case 27:if(xi(r),o=ye.current,f=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==u&&Xi(r);else{if(!u){if(r.stateNode===null)throw Error(n(166));return mt(r),null}s=$.current,Ta(r)?Av(r):(s=nb(f,u,o),r.stateNode=s,Xi(r))}return mt(r),null;case 5:if(xi(r),f=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(p=$.current,Ta(r))Av(r);else{var y=mu(ye.current);switch(p){case 1:p=y.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:p=y.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":p=y.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":p=y.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":p=y.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof u.is=="string"?y.createElement("select",{is:u.is}):y.createElement("select"),u.multiple?p.multiple=!0:u.size&&(p.size=u.size);break;default:p=typeof u.is=="string"?y.createElement(f,{is:u.is}):y.createElement(f)}}p[es]=r,p[bs]=u;e:for(y=r.child;y!==null;){if(y.tag===5||y.tag===6)p.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=p;e:switch(rs(p,f,u),f){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),rf(r,r.type,s===null?null:s.memoizedProps,r.pendingProps,o),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=ye.current,Ta(r)){if(s=r.stateNode,o=r.memoizedProps,u=null,f=ts,f!==null)switch(f.tag){case 27:case 5:u=f.memoizedProps}s[es]=r,s=!!(s.nodeValue===o||u!==null&&u.suppressHydrationWarning===!0||Yy(s.nodeValue,o)),s||jr(r,!0)}else s=mu(s).createTextNode(u),s[es]=r,r.stateNode=s}return mt(r),null;case 31:if(o=r.memoizedState,s===null||s.memoizedState!==null){if(u=Ta(r),o!==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 o=fd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=o),s=!0;if(!s)return r.flags&256?(qs(r),r):(qs(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(f=Ta(r),u!==null&&u.dehydrated!==null){if(s===null){if(!f)throw Error(n(318));if(f=r.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(n(317));f[es]=r}else kn(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;mt(r),f=!1}else f=fd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=f),f=!0;if(!f)return r.flags&256?(qs(r),r):(qs(r),null)}return qs(r),(r.flags&128)!==0?(r.lanes=o,r):(o=u!==null,s=s!==null&&s.memoizedState!==null,o&&(u=r.child,f=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(f=u.alternate.memoizedState.cachePool.pool),p=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(p=u.memoizedState.cachePool.pool),p!==f&&(u.flags|=2048)),o!==s&&o&&(r.child.flags|=8192),Jc(r,r.updateQueue),mt(r),null);case 4:return Qe(),s===null&&kf(r.stateNode.containerInfo),mt(r),null;case 10:return Yi(r.type),mt(r),null;case 19:if(Q(Et),u=r.memoizedState,u===null)return mt(r),null;if(f=(r.flags&128)!==0,p=u.rendering,p===null)if(f)il(u,!1);else{if(St!==0||s!==null&&(s.flags&128)!==0)for(s=r.child;s!==null;){if(p=Hc(s),p!==null){for(r.flags|=128,il(u,!1),s=p.updateQueue,r.updateQueue=s,Jc(r,s),r.subtreeFlags=0,s=o,o=r.child;o!==null;)kv(o,s),o=o.sibling;return ae(Et,Et.current&1|2),$e&&Wi(r,u.treeForkCount),r.child}s=s.sibling}u.tail!==null&&Rs()>ru&&(r.flags|=128,f=!0,il(u,!1),r.lanes=4194304)}else{if(!f)if(s=Hc(p),s!==null){if(r.flags|=128,f=!0,s=s.updateQueue,r.updateQueue=s,Jc(r,s),il(u,!0),u.tail===null&&u.tailMode==="hidden"&&!p.alternate&&!$e)return mt(r),null}else 2*Rs()-u.renderingStartTime>ru&&o!==536870912&&(r.flags|=128,f=!0,il(u,!1),r.lanes=4194304);u.isBackwards?(p.sibling=r.child,r.child=p):(s=u.last,s!==null?s.sibling=p:r.child=p,u.last=p)}return u.tail!==null?(s=u.tail,u.rendering=s,u.tail=s.sibling,u.renderingStartTime=Rs(),s.sibling=null,o=Et.current,ae(Et,f?o&1|2:o&1),$e&&Wi(r,u.treeForkCount),s):(mt(r),null);case 22:case 23:return qs(r),kd(),u=r.memoizedState!==null,s!==null?s.memoizedState!==null!==u&&(r.flags|=8192):u&&(r.flags|=8192),u?(o&536870912)!==0&&(r.flags&128)===0&&(mt(r),r.subtreeFlags&6&&(r.flags|=8192)):mt(r),o=r.updateQueue,o!==null&&Jc(r,o.retryQueue),o=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(o=s.memoizedState.cachePool.pool),u=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),u!==o&&(r.flags|=2048),s!==null&&Q(Tn),null;case 24:return o=null,s!==null&&(o=s.memoizedState.cache),r.memoizedState.cache!==o&&(r.flags|=2048),Yi(At),mt(r),null;case 25:return null;case 30:return null}throw Error(n(156,r.tag))}function nj(s,r){switch(hd(r),r.tag){case 1:return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 3:return Yi(At),Qe(),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(qs(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(qs(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 Q(Et),null;case 4:return Qe(),null;case 10:return Yi(r.type),null;case 22:case 23:return qs(r),kd(),s!==null&&Q(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 Jg(s,r){switch(hd(r),r.tag){case 3:Yi(At),Qe();break;case 26:case 27:case 5:xi(r);break;case 4:Qe();break;case 31:r.memoizedState!==null&&qs(r);break;case 13:qs(r);break;case 19:Q(Et);break;case 10:Yi(r.type);break;case 22:case 23:qs(r),kd(),s!==null&&Q(Tn);break;case 24:Yi(At)}}function rl(s,r){try{var o=r.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var f=u.next;o=f;do{if((o.tag&s)===s){u=void 0;var p=o.create,y=o.inst;u=p(),y.destroy=u}o=o.next}while(o!==f)}}catch(w){nt(r,r.return,w)}}function Rr(s,r,o){try{var u=r.updateQueue,f=u!==null?u.lastEffect:null;if(f!==null){var p=f.next;u=p;do{if((u.tag&s)===s){var y=u.inst,w=y.destroy;if(w!==void 0){y.destroy=void 0,f=r;var O=o,H=w;try{H()}catch(Y){nt(f,O,Y)}}}u=u.next}while(u!==p)}}catch(Y){nt(r,r.return,Y)}}function ey(s){var r=s.updateQueue;if(r!==null){var o=s.stateNode;try{Kv(r,o)}catch(u){nt(s,s.return,u)}}}function ty(s,r,o){o.props=Dn(s.type,s.memoizedProps),o.state=s.memoizedState;try{o.componentWillUnmount()}catch(u){nt(s,r,u)}}function nl(s,r){try{var o=s.ref;if(o!==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 o=="function"?s.refCleanup=o(u):o.current=u}}catch(f){nt(s,r,f)}}function ji(s,r){var o=s.ref,u=s.refCleanup;if(o!==null)if(typeof u=="function")try{u()}catch(f){nt(s,r,f)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(f){nt(s,r,f)}else o.current=null}function sy(s){var r=s.type,o=s.memoizedProps,u=s.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":o.autoFocus&&u.focus();break e;case"img":o.src?u.src=o.src:o.srcSet&&(u.srcset=o.srcSet)}}catch(f){nt(s,s.return,f)}}function nf(s,r,o){try{var u=s.stateNode;Ej(u,s.type,o,r),u[bs]=r}catch(f){nt(s,s.return,f)}}function iy(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Pr(s.type)||s.tag===4}function af(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||iy(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 of(s,r,o){var u=s.tag;if(u===5||u===6)s=s.stateNode,r?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(s,r):(r=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,r.appendChild(s),o=o._reactRootContainer,o!=null||r.onclick!==null||(r.onclick=Fi));else if(u!==4&&(u===27&&Pr(s.type)&&(o=s.stateNode,r=null),s=s.child,s!==null))for(of(s,r,o),s=s.sibling;s!==null;)of(s,r,o),s=s.sibling}function eu(s,r,o){var u=s.tag;if(u===5||u===6)s=s.stateNode,r?o.insertBefore(s,r):o.appendChild(s);else if(u!==4&&(u===27&&Pr(s.type)&&(o=s.stateNode),s=s.child,s!==null))for(eu(s,r,o),s=s.sibling;s!==null;)eu(s,r,o),s=s.sibling}function ry(s){var r=s.stateNode,o=s.memoizedProps;try{for(var u=s.type,f=r.attributes;f.length;)r.removeAttributeNode(f[0]);rs(r,u,o),r[es]=s,r[bs]=o}catch(p){nt(s,s.return,p)}}var Ji=!1,Dt=!1,lf=!1,ny=typeof WeakSet=="function"?WeakSet:Set,Vt=null;function aj(s,r){if(s=s.containerInfo,Tf=Su,s=vv(s),ed(s)){if("selectionStart"in s)var o={start:s.selectionStart,end:s.selectionEnd};else e:{o=(o=s.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var f=u.anchorOffset,p=u.focusNode;u=u.focusOffset;try{o.nodeType,p.nodeType}catch{o=null;break e}var y=0,w=-1,O=-1,H=0,Y=0,X=s,I=null;t:for(;;){for(var W;X!==o||f!==0&&X.nodeType!==3||(w=y+f),X!==p||u!==0&&X.nodeType!==3||(O=y+u),X.nodeType===3&&(y+=X.nodeValue.length),(W=X.firstChild)!==null;)I=X,X=W;for(;;){if(X===s)break t;if(I===o&&++H===f&&(w=y),I===p&&++Y===u&&(O=y),(W=X.nextSibling)!==null)break;X=I,I=X.parentNode}X=W}o=w===-1||O===-1?null:{start:w,end:O}}else o=null}o=o||{start:0,end:0}}else o=null;for(Of={focusedElem:s,selectionRange:o},Su=!1,Vt=r;Vt!==null;)if(r=Vt,s=r.child,(r.subtreeFlags&1028)!==0&&s!==null)s.return=r,Vt=s;else for(;Vt!==null;){switch(r=Vt,p=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(o=0;o<s.length;o++)f=s[o],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&p!==null){s=void 0,o=r,f=p.memoizedProps,p=p.memoizedState,u=o.stateNode;try{var _e=Dn(o.type,f);s=u.getSnapshotBeforeUpdate(_e,p),u.__reactInternalSnapshotBeforeUpdate=s}catch(ke){nt(o,o.return,ke)}}break;case 3:if((s&1024)!==0){if(s=r.stateNode.containerInfo,o=s.nodeType,o===9)Mf(s);else if(o===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Mf(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,Vt=s;break}Vt=r.return}}function ay(s,r,o){var u=o.flags;switch(o.tag){case 0:case 11:case 15:tr(s,o),u&4&&rl(5,o);break;case 1:if(tr(s,o),u&4)if(s=o.stateNode,r===null)try{s.componentDidMount()}catch(y){nt(o,o.return,y)}else{var f=Dn(o.type,r.memoizedProps);r=r.memoizedState;try{s.componentDidUpdate(f,r,s.__reactInternalSnapshotBeforeUpdate)}catch(y){nt(o,o.return,y)}}u&64&&ey(o),u&512&&nl(o,o.return);break;case 3:if(tr(s,o),u&64&&(s=o.updateQueue,s!==null)){if(r=null,o.child!==null)switch(o.child.tag){case 27:case 5:r=o.child.stateNode;break;case 1:r=o.child.stateNode}try{Kv(s,r)}catch(y){nt(o,o.return,y)}}break;case 27:r===null&&u&4&&ry(o);case 26:case 5:tr(s,o),r===null&&u&4&&sy(o),u&512&&nl(o,o.return);break;case 12:tr(s,o);break;case 31:tr(s,o),u&4&&cy(s,o);break;case 13:tr(s,o),u&4&&uy(s,o),u&64&&(s=o.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(o=_j.bind(null,o),Bj(s,o))));break;case 22:if(u=o.memoizedState!==null||Ji,!u){r=r!==null&&r.memoizedState!==null||Dt,f=Ji;var p=Dt;Ji=u,(Dt=r)&&!p?sr(s,o,(o.subtreeFlags&8772)!==0):tr(s,o),Ji=f,Dt=p}break;case 30:break;default:tr(s,o)}}function oy(s){var r=s.alternate;r!==null&&(s.alternate=null,oy(r)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(r=s.stateNode,r!==null&&zh(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 pt=null,xs=!1;function er(s,r,o){for(o=o.child;o!==null;)ly(s,r,o),o=o.sibling}function ly(s,r,o){if(Ms&&typeof Ms.onCommitFiberUnmount=="function")try{Ms.onCommitFiberUnmount(To,o)}catch{}switch(o.tag){case 26:Dt||ji(o,r),er(s,r,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:Dt||ji(o,r);var u=pt,f=xs;Pr(o.type)&&(pt=o.stateNode,xs=!1),er(s,r,o),ml(o.stateNode),pt=u,xs=f;break;case 5:Dt||ji(o,r);case 6:if(u=pt,f=xs,pt=null,er(s,r,o),pt=u,xs=f,pt!==null)if(xs)try{(pt.nodeType===9?pt.body:pt.nodeName==="HTML"?pt.ownerDocument.body:pt).removeChild(o.stateNode)}catch(p){nt(o,r,p)}else try{pt.removeChild(o.stateNode)}catch(p){nt(o,r,p)}break;case 18:pt!==null&&(xs?(s=pt,eb(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,o.stateNode),Qa(s)):eb(pt,o.stateNode));break;case 4:u=pt,f=xs,pt=o.stateNode.containerInfo,xs=!0,er(s,r,o),pt=u,xs=f;break;case 0:case 11:case 14:case 15:Rr(2,o,r),Dt||Rr(4,o,r),er(s,r,o);break;case 1:Dt||(ji(o,r),u=o.stateNode,typeof u.componentWillUnmount=="function"&&ty(o,r,u)),er(s,r,o);break;case 21:er(s,r,o);break;case 22:Dt=(u=Dt)||o.memoizedState!==null,er(s,r,o),Dt=u;break;default:er(s,r,o)}}function cy(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Qa(s)}catch(o){nt(r,r.return,o)}}}function uy(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Qa(s)}catch(o){nt(r,r.return,o)}}function oj(s){switch(s.tag){case 31:case 13:case 19:var r=s.stateNode;return r===null&&(r=s.stateNode=new ny),r;case 22:return s=s.stateNode,r=s._retryCache,r===null&&(r=s._retryCache=new ny),r;default:throw Error(n(435,s.tag))}}function tu(s,r){var o=oj(s);r.forEach(function(u){if(!o.has(u)){o.add(u);var f=pj.bind(null,s,u);u.then(f,f)}})}function ws(s,r){var o=r.deletions;if(o!==null)for(var u=0;u<o.length;u++){var f=o[u],p=s,y=r,w=y;e:for(;w!==null;){switch(w.tag){case 27:if(Pr(w.type)){pt=w.stateNode,xs=!1;break e}break;case 5:pt=w.stateNode,xs=!1;break e;case 3:case 4:pt=w.stateNode.containerInfo,xs=!0;break e}w=w.return}if(pt===null)throw Error(n(160));ly(p,y,f),pt=null,xs=!1,p=f.alternate,p!==null&&(p.return=null),f.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)hy(r,s),r=r.sibling}var mi=null;function hy(s,r){var o=s.alternate,u=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:ws(r,s),Cs(s),u&4&&(Rr(3,s,s.return),rl(3,s),Rr(5,s,s.return));break;case 1:ws(r,s),Cs(s),u&512&&(Dt||o===null||ji(o,o.return)),u&64&&Ji&&(s=s.updateQueue,s!==null&&(u=s.callbacks,u!==null&&(o=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=o===null?u:o.concat(u))));break;case 26:var f=mi;if(ws(r,s),Cs(s),u&512&&(Dt||o===null||ji(o,o.return)),u&4){var p=o!==null?o.memoizedState:null;if(u=s.memoizedState,o===null)if(u===null)if(s.stateNode===null){e:{u=s.type,o=s.memoizedProps,f=f.ownerDocument||f;t:switch(u){case"title":p=f.getElementsByTagName("title")[0],(!p||p[Ro]||p[es]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=f.createElement(u),f.head.insertBefore(p,f.querySelector("head > title"))),rs(p,u,o),p[es]=s,Wt(p),u=p;break e;case"link":var y=hb("link","href",f).get(u+(o.href||""));if(y){for(var w=0;w<y.length;w++)if(p=y[w],p.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&p.getAttribute("rel")===(o.rel==null?null:o.rel)&&p.getAttribute("title")===(o.title==null?null:o.title)&&p.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){y.splice(w,1);break t}}p=f.createElement(u),rs(p,u,o),f.head.appendChild(p);break;case"meta":if(y=hb("meta","content",f).get(u+(o.content||""))){for(w=0;w<y.length;w++)if(p=y[w],p.getAttribute("content")===(o.content==null?null:""+o.content)&&p.getAttribute("name")===(o.name==null?null:o.name)&&p.getAttribute("property")===(o.property==null?null:o.property)&&p.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&p.getAttribute("charset")===(o.charSet==null?null:o.charSet)){y.splice(w,1);break t}}p=f.createElement(u),rs(p,u,o),f.head.appendChild(p);break;default:throw Error(n(468,u))}p[es]=s,Wt(p),u=p}s.stateNode=u}else db(f,s.type,s.stateNode);else s.stateNode=ub(f,u,s.memoizedProps);else p!==u?(p===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):p.count--,u===null?db(f,s.type,s.stateNode):ub(f,u,s.memoizedProps)):u===null&&s.stateNode!==null&&nf(s,s.memoizedProps,o.memoizedProps)}break;case 27:ws(r,s),Cs(s),u&512&&(Dt||o===null||ji(o,o.return)),o!==null&&u&4&&nf(s,s.memoizedProps,o.memoizedProps);break;case 5:if(ws(r,s),Cs(s),u&512&&(Dt||o===null||ji(o,o.return)),s.flags&32){f=s.stateNode;try{ya(f,"")}catch(_e){nt(s,s.return,_e)}}u&4&&s.stateNode!=null&&(f=s.memoizedProps,nf(s,f,o!==null?o.memoizedProps:f)),u&1024&&(lf=!0);break;case 6:if(ws(r,s),Cs(s),u&4){if(s.stateNode===null)throw Error(n(162));u=s.memoizedProps,o=s.stateNode;try{o.nodeValue=u}catch(_e){nt(s,s.return,_e)}}break;case 3:if(vu=null,f=mi,mi=_u(r.containerInfo),ws(r,s),mi=f,Cs(s),u&4&&o!==null&&o.memoizedState.isDehydrated)try{Qa(r.containerInfo)}catch(_e){nt(s,s.return,_e)}lf&&(lf=!1,dy(s));break;case 4:u=mi,mi=_u(s.stateNode.containerInfo),ws(r,s),Cs(s),mi=u;break;case 12:ws(r,s),Cs(s);break;case 31:ws(r,s),Cs(s),u&4&&(u=s.updateQueue,u!==null&&(s.updateQueue=null,tu(s,u)));break;case 13:ws(r,s),Cs(s),s.child.flags&8192&&s.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(iu=Rs()),u&4&&(u=s.updateQueue,u!==null&&(s.updateQueue=null,tu(s,u)));break;case 22:f=s.memoizedState!==null;var O=o!==null&&o.memoizedState!==null,H=Ji,Y=Dt;if(Ji=H||f,Dt=Y||O,ws(r,s),Dt=Y,Ji=H,Cs(s),u&8192)e:for(r=s.stateNode,r._visibility=f?r._visibility&-2:r._visibility|1,f&&(o===null||O||Ji||Dt||Bn(s)),o=null,r=s;;){if(r.tag===5||r.tag===26){if(o===null){O=o=r;try{if(p=O.stateNode,f)y=p.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{w=O.stateNode;var X=O.memoizedProps.style,I=X!=null&&X.hasOwnProperty("display")?X.display:null;w.style.display=I==null||typeof I=="boolean"?"":(""+I).trim()}}catch(_e){nt(O,O.return,_e)}}}else if(r.tag===6){if(o===null){O=r;try{O.stateNode.nodeValue=f?"":O.memoizedProps}catch(_e){nt(O,O.return,_e)}}}else if(r.tag===18){if(o===null){O=r;try{var W=O.stateNode;f?tb(W,!0):tb(O.stateNode,!1)}catch(_e){nt(O,O.return,_e)}}}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;o===r&&(o=null),r=r.return}o===r&&(o=null),r.sibling.return=r.return,r=r.sibling}u&4&&(u=s.updateQueue,u!==null&&(o=u.retryQueue,o!==null&&(u.retryQueue=null,tu(s,o))));break;case 19:ws(r,s),Cs(s),u&4&&(u=s.updateQueue,u!==null&&(s.updateQueue=null,tu(s,u)));break;case 30:break;case 21:break;default:ws(r,s),Cs(s)}}function Cs(s){var r=s.flags;if(r&2){try{for(var o,u=s.return;u!==null;){if(iy(u)){o=u;break}u=u.return}if(o==null)throw Error(n(160));switch(o.tag){case 27:var f=o.stateNode,p=af(s);eu(s,p,f);break;case 5:var y=o.stateNode;o.flags&32&&(ya(y,""),o.flags&=-33);var w=af(s);eu(s,w,y);break;case 3:case 4:var O=o.stateNode.containerInfo,H=af(s);of(s,H,O);break;default:throw Error(n(161))}}catch(Y){nt(s,s.return,Y)}s.flags&=-3}r&4096&&(s.flags&=-4097)}function dy(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var r=s;dy(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;)ay(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 o=r.stateNode;typeof o.componentWillUnmount=="function"&&ty(r,r.return,o),Bn(r);break;case 27:ml(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,o){for(o=o&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var u=r.alternate,f=s,p=r,y=p.flags;switch(p.tag){case 0:case 11:case 15:sr(f,p,o),rl(4,p);break;case 1:if(sr(f,p,o),u=p,f=u.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(H){nt(u,u.return,H)}if(u=p,f=u.updateQueue,f!==null){var w=u.stateNode;try{var O=f.shared.hiddenCallbacks;if(O!==null)for(f.shared.hiddenCallbacks=null,f=0;f<O.length;f++)Fv(O[f],w)}catch(H){nt(u,u.return,H)}}o&&y&64&&ey(p),nl(p,p.return);break;case 27:ry(p);case 26:case 5:sr(f,p,o),o&&u===null&&y&4&&sy(p),nl(p,p.return);break;case 12:sr(f,p,o);break;case 31:sr(f,p,o),o&&y&4&&cy(f,p);break;case 13:sr(f,p,o),o&&y&4&&uy(f,p);break;case 22:p.memoizedState===null&&sr(f,p,o),nl(p,p.return);break;case 30:break;default:sr(f,p,o)}r=r.sibling}}function cf(s,r){var o=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(o=s.memoizedState.cachePool.pool),s=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(s=r.memoizedState.cachePool.pool),s!==o&&(s!=null&&s.refCount++,o!=null&&$o(o))}function uf(s,r){s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&$o(s))}function _i(s,r,o,u){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)fy(s,r,o,u),r=r.sibling}function fy(s,r,o,u){var f=r.flags;switch(r.tag){case 0:case 11:case 15:_i(s,r,o,u),f&2048&&rl(9,r);break;case 1:_i(s,r,o,u);break;case 3:_i(s,r,o,u),f&2048&&(s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&$o(s)));break;case 12:if(f&2048){_i(s,r,o,u),s=r.stateNode;try{var p=r.memoizedProps,y=p.id,w=p.onPostCommit;typeof w=="function"&&w(y,r.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(O){nt(r,r.return,O)}}else _i(s,r,o,u);break;case 31:_i(s,r,o,u);break;case 13:_i(s,r,o,u);break;case 23:break;case 22:p=r.stateNode,y=r.alternate,r.memoizedState!==null?p._visibility&2?_i(s,r,o,u):al(s,r):p._visibility&2?_i(s,r,o,u):(p._visibility|=2,Pa(s,r,o,u,(r.subtreeFlags&10256)!==0||!1)),f&2048&&cf(y,r);break;case 24:_i(s,r,o,u),f&2048&&uf(r.alternate,r);break;default:_i(s,r,o,u)}}function Pa(s,r,o,u,f){for(f=f&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var p=s,y=r,w=o,O=u,H=y.flags;switch(y.tag){case 0:case 11:case 15:Pa(p,y,w,O,f),rl(8,y);break;case 23:break;case 22:var Y=y.stateNode;y.memoizedState!==null?Y._visibility&2?Pa(p,y,w,O,f):al(p,y):(Y._visibility|=2,Pa(p,y,w,O,f)),f&&H&2048&&cf(y.alternate,y);break;case 24:Pa(p,y,w,O,f),f&&H&2048&&uf(y.alternate,y);break;default:Pa(p,y,w,O,f)}r=r.sibling}}function al(s,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var o=s,u=r,f=u.flags;switch(u.tag){case 22:al(o,u),f&2048&&cf(u.alternate,u);break;case 24:al(o,u),f&2048&&uf(u.alternate,u);break;default:al(o,u)}r=r.sibling}}var ol=8192;function Ha(s,r,o){if(s.subtreeFlags&ol)for(s=s.child;s!==null;)my(s,r,o),s=s.sibling}function my(s,r,o){switch(s.tag){case 26:Ha(s,r,o),s.flags&ol&&s.memoizedState!==null&&Vj(o,mi,s.memoizedState,s.memoizedProps);break;case 5:Ha(s,r,o);break;case 3:case 4:var u=mi;mi=_u(s.stateNode.containerInfo),Ha(s,r,o),mi=u;break;case 22:s.memoizedState===null&&(u=s.alternate,u!==null&&u.memoizedState!==null?(u=ol,ol=16777216,Ha(s,r,o),ol=u):Ha(s,r,o));break;default:Ha(s,r,o)}}function _y(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 ll(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var o=0;o<r.length;o++){var u=r[o];Vt=u,vy(u,s)}_y(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)py(s),s=s.sibling}function py(s){switch(s.tag){case 0:case 11:case 15:ll(s),s.flags&2048&&Rr(9,s,s.return);break;case 3:ll(s);break;case 12:ll(s);break;case 22:var r=s.stateNode;s.memoizedState!==null&&r._visibility&2&&(s.return===null||s.return.tag!==13)?(r._visibility&=-3,su(s)):ll(s);break;default:ll(s)}}function su(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var o=0;o<r.length;o++){var u=r[o];Vt=u,vy(u,s)}_y(s)}for(s=s.child;s!==null;){switch(r=s,r.tag){case 0:case 11:case 15:Rr(8,r,r.return),su(r);break;case 22:o=r.stateNode,o._visibility&2&&(o._visibility&=-3,su(r));break;default:su(r)}s=s.sibling}}function vy(s,r){for(;Vt!==null;){var o=Vt;switch(o.tag){case 0:case 11:case 15:Rr(8,o,r);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var u=o.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:$o(o.memoizedState.cache)}if(u=o.child,u!==null)u.return=o,Vt=u;else e:for(o=s;Vt!==null;){u=Vt;var f=u.sibling,p=u.return;if(oy(u),u===o){Vt=null;break e}if(f!==null){f.return=p,Vt=f;break e}Vt=p}}}var lj={getCacheForType:function(s){var r=ss(At),o=r.data.get(s);return o===void 0&&(o=s(),r.data.set(s,o)),o},cacheSignal:function(){return ss(At).controller.signal}},cj=typeof WeakMap=="function"?WeakMap:Map,st=0,ht=null,Ie=null,Fe=0,rt=0,Ps=null,Mr=!1,Ia=!1,hf=!1,ir=0,St=0,Dr=0,Ln=0,df=0,Hs=0,Ua=0,cl=null,js=null,ff=!1,iu=0,gy=0,ru=1/0,nu=null,Br=null,Pt=0,Lr=null,Fa=null,rr=0,mf=0,_f=null,yy=null,ul=0,pf=null;function Is(){return(st&2)!==0&&Fe!==0?Fe&-Fe:T.T!==null?xf():Bp()}function by(){if(Hs===0)if((Fe&536870912)===0||$e){var s=fc;fc<<=1,(fc&3932160)===0&&(fc=262144),Hs=s}else Hs=536870912;return s=zs.current,s!==null&&(s.flags|=32),Hs}function ks(s,r,o){(s===ht&&(rt===2||rt===9)||s.cancelPendingCommit!==null)&&(Ka(s,0),zr(s,Fe,Hs,!1)),Ao(s,o),((st&2)===0||s!==ht)&&(s===ht&&((st&2)===0&&(Ln|=o),St===4&&zr(s,Fe,Hs,!1)),ki(s))}function Sy(s,r,o){if((st&6)!==0)throw Error(n(327));var u=!o&&(r&127)===0&&(r&s.expiredLanes)===0||Oo(s,r),f=u?dj(s,r):gf(s,r,!0),p=u;do{if(f===0){Ia&&!u&&zr(s,r,0,!1);break}else{if(o=s.current.alternate,p&&!uj(o)){f=gf(s,r,!1),p=!1;continue}if(f===2){if(p=r,s.errorRecoveryDisabledLanes&p)var y=0;else y=s.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){r=y;e:{var w=s;f=cl;var O=w.current.memoizedState.isDehydrated;if(O&&(Ka(w,y).flags|=256),y=gf(w,y,!1),y!==2){if(hf&&!O){w.errorRecoveryDisabledLanes|=p,Ln|=p,f=4;break e}p=js,js=f,p!==null&&(js===null?js=p:js.push.apply(js,p))}f=y}if(p=!1,f!==2)continue}}if(f===1){Ka(s,0),zr(s,r,0,!0);break}e:{switch(u=s,p=f,p){case 0:case 1:throw Error(n(345));case 4:if((r&4194048)!==r)break;case 6:zr(u,r,Hs,!Mr);break e;case 2:js=null;break;case 3:case 5:break;default:throw Error(n(329))}if((r&62914560)===r&&(f=iu+300-Rs(),10<f)){if(zr(u,r,Hs,!Mr),_c(u,0,!0)!==0)break e;rr=r,u.timeoutHandle=Xy(xy.bind(null,u,o,js,nu,ff,r,Hs,Ln,Ua,Mr,p,"Throttled",-0,0),f);break e}xy(u,o,js,nu,ff,r,Hs,Ln,Ua,Mr,p,null,-0,0)}}break}while(!0);ki(s)}function xy(s,r,o,u,f,p,y,w,O,H,Y,X,I,W){if(s.timeoutHandle=-1,X=r.subtreeFlags,X&8192||(X&16785408)===16785408){X={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Fi},my(r,p,X);var _e=(p&62914560)===p?iu-Rs():(p&4194048)===p?gy-Rs():0;if(_e=Yj(X,_e),_e!==null){rr=p,s.cancelPendingCommit=_e(Oy.bind(null,s,r,p,o,u,f,y,w,O,Y,X,null,I,W)),zr(s,p,y,!H);return}}Oy(s,r,p,o,u,f,y,w,O)}function uj(s){for(var r=s;;){var o=r.tag;if((o===0||o===11||o===15)&&r.flags&16384&&(o=r.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var u=0;u<o.length;u++){var f=o[u],p=f.getSnapshot;f=f.value;try{if(!Bs(p(),f))return!1}catch{return!1}}if(o=r.child,r.subtreeFlags&16384&&o!==null)o.return=r,r=o;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,o,u){r&=~df,r&=~Ln,s.suspendedLanes|=r,s.pingedLanes&=~r,u&&(s.warmLanes|=r),u=s.expirationTimes;for(var f=r;0<f;){var p=31-Ds(f),y=1<<p;u[p]=-1,f&=~y}o!==0&&Rp(s,o,r)}function au(){return(st&6)===0?(hl(0),!1):!0}function vf(){if(Ie!==null){if(rt===0)var s=Ie.return;else s=Ie,Vi=En=null,Rd(s),Da=null,Vo=0,s=Ie;for(;s!==null;)Jg(s.alternate,s),s=s.return;Ie=null}}function Ka(s,r){var o=s.timeoutHandle;o!==-1&&(s.timeoutHandle=-1,Oj(o)),o=s.cancelPendingCommit,o!==null&&(s.cancelPendingCommit=null,o()),rr=0,vf(),ht=s,Ie=o=$i(s.current,null),Fe=r,rt=0,Ps=null,Mr=!1,Ia=Oo(s,r),hf=!1,Ua=Hs=df=Ln=Dr=St=0,js=cl=null,ff=!1,(r&8)!==0&&(r|=r&32);var u=s.entangledLanes;if(u!==0)for(s=s.entanglements,u&=r;0<u;){var f=31-Ds(u),p=1<<f;r|=s[f],u&=~p}return ir=r,Ec(),o}function wy(s,r){Me=null,T.H=tl,r===Ma||r===Bc?(r=Pv(),rt=3):r===bd?(r=Pv(),rt=4):rt=r===Yd?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Ps=r,Ie===null&&(St=1,Gc(s,Js(r,s.current)))}function Cy(){var s=zs.current;return s===null?!0:(Fe&4194048)===Fe?ii===null:(Fe&62914560)===Fe||(Fe&536870912)!==0?s===ii:!1}function jy(){var s=T.H;return T.H=tl,s===null?tl:s}function ky(){var s=T.A;return T.A=lj,s}function ou(){St=4,Mr||(Fe&4194048)!==Fe&&zs.current!==null||(Ia=!0),(Dr&134217727)===0&&(Ln&134217727)===0||ht===null||zr(ht,Fe,Hs,!1)}function gf(s,r,o){var u=st;st|=2;var f=jy(),p=ky();(ht!==s||Fe!==r)&&(nu=null,Ka(s,r)),r=!1;var y=St;e:do try{if(rt!==0&&Ie!==null){var w=Ie,O=Ps;switch(rt){case 8:vf(),y=6;break e;case 3:case 2:case 9:case 6:zs.current===null&&(r=!0);var H=rt;if(rt=0,Ps=null,$a(s,w,O,H),o&&Ia){y=0;break e}break;default:H=rt,rt=0,Ps=null,$a(s,w,O,H)}}hj(),y=St;break}catch(Y){wy(s,Y)}while(!0);return r&&s.shellSuspendCounter++,Vi=En=null,st=u,T.H=f,T.A=p,Ie===null&&(ht=null,Fe=0,Ec()),y}function hj(){for(;Ie!==null;)Ey(Ie)}function dj(s,r){var o=st;st|=2;var u=jy(),f=ky();ht!==s||Fe!==r?(nu=null,ru=Rs()+500,Ka(s,r)):Ia=Oo(s,r);e:do try{if(rt!==0&&Ie!==null){r=Ie;var p=Ps;t:switch(rt){case 1:rt=0,Ps=null,$a(s,r,p,1);break;case 2:case 9:if(zv(p)){rt=0,Ps=null,Ny(r);break}r=function(){rt!==2&&rt!==9||ht!==s||(rt=7),ki(s)},p.then(r,r);break e;case 3:rt=7;break e;case 4:rt=5;break e;case 7:zv(p)?(rt=0,Ps=null,Ny(r)):(rt=0,Ps=null,$a(s,r,p,7));break;case 5:var y=null;switch(Ie.tag){case 26:y=Ie.memoizedState;case 5:case 27:var w=Ie;if(y?fb(y):w.stateNode.complete){rt=0,Ps=null;var O=w.sibling;if(O!==null)Ie=O;else{var H=w.return;H!==null?(Ie=H,lu(H)):Ie=null}break t}}rt=0,Ps=null,$a(s,r,p,5);break;case 6:rt=0,Ps=null,$a(s,r,p,6);break;case 8:vf(),St=6;break e;default:throw Error(n(462))}}fj();break}catch(Y){wy(s,Y)}while(!0);return Vi=En=null,T.H=u,T.A=f,st=o,Ie!==null?0:(ht=null,Fe=0,Ec(),St)}function fj(){for(;Ie!==null&&!L1();)Ey(Ie)}function Ey(s){var r=Zg(s.alternate,s,ir);s.memoizedProps=s.pendingProps,r===null?lu(s):Ie=r}function Ny(s){var r=s,o=r.alternate;switch(r.tag){case 15:case 0:r=$g(o,r,r.pendingProps,r.type,void 0,Fe);break;case 11:r=$g(o,r,r.pendingProps,r.type.render,r.ref,Fe);break;case 5:Rd(r);default:Jg(o,r),r=Ie=kv(r,ir),r=Zg(o,r,ir)}s.memoizedProps=s.pendingProps,r===null?lu(s):Ie=r}function $a(s,r,o,u){Vi=En=null,Rd(r),Da=null,Vo=0;var f=r.return;try{if(tj(s,f,r,o,Fe)){St=1,Gc(s,Js(o,s.current)),Ie=null;return}}catch(p){if(f!==null)throw Ie=f,p;St=1,Gc(s,Js(o,s.current)),Ie=null;return}r.flags&32768?($e||u===1?s=!0:Ia||(Fe&536870912)!==0?s=!1:(Mr=s=!0,(u===2||u===9||u===3||u===6)&&(u=zs.current,u!==null&&u.tag===13&&(u.flags|=16384))),Ty(r,s)):lu(r)}function lu(s){var r=s;do{if((r.flags&32768)!==0){Ty(r,Mr);return}s=r.return;var o=rj(r.alternate,r,ir);if(o!==null){Ie=o;return}if(r=r.sibling,r!==null){Ie=r;return}Ie=r=s}while(r!==null);St===0&&(St=5)}function Ty(s,r){do{var o=nj(s.alternate,s);if(o!==null){o.flags&=32767,Ie=o;return}if(o=s.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!r&&(s=s.sibling,s!==null)){Ie=s;return}Ie=s=o}while(s!==null);St=6,Ie=null}function Oy(s,r,o,u,f,p,y,w,O){s.cancelPendingCommit=null;do cu();while(Pt!==0);if((st&6)!==0)throw Error(n(327));if(r!==null){if(r===s.current)throw Error(n(177));if(p=r.lanes|r.childLanes,p|=nd,W1(s,o,p,y,w,O),s===ht&&(Ie=ht=null,Fe=0),Fa=r,Lr=s,rr=o,mf=p,_f=f,yy=u,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,vj(hc,function(){return By(),null})):(s.callbackNode=null,s.callbackPriority=0),u=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||u){u=T.T,T.T=null,f=U.p,U.p=2,y=st,st|=4;try{aj(s,r,o)}finally{st=y,U.p=f,T.T=u}}Pt=1,Ay(),Ry(),My()}}function Ay(){if(Pt===1){Pt=0;var s=Lr,r=Fa,o=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||o){o=T.T,T.T=null;var u=U.p;U.p=2;var f=st;st|=4;try{hy(r,s);var p=Of,y=vv(s.containerInfo),w=p.focusedElem,O=p.selectionRange;if(y!==w&&w&&w.ownerDocument&&pv(w.ownerDocument.documentElement,w)){if(O!==null&&ed(w)){var H=O.start,Y=O.end;if(Y===void 0&&(Y=H),"selectionStart"in w)w.selectionStart=H,w.selectionEnd=Math.min(Y,w.value.length);else{var X=w.ownerDocument||document,I=X&&X.defaultView||window;if(I.getSelection){var W=I.getSelection(),_e=w.textContent.length,ke=Math.min(O.start,_e),ct=O.end===void 0?ke:Math.min(O.end,_e);!W.extend&&ke>ct&&(y=ct,ct=ke,ke=y);var D=_v(w,ke),R=_v(w,ct);if(D&&R&&(W.rangeCount!==1||W.anchorNode!==D.node||W.anchorOffset!==D.offset||W.focusNode!==R.node||W.focusOffset!==R.offset)){var P=X.createRange();P.setStart(D.node,D.offset),W.removeAllRanges(),ke>ct?(W.addRange(P),W.extend(R.node,R.offset)):(P.setEnd(R.node,R.offset),W.addRange(P))}}}}for(X=[],W=w;W=W.parentNode;)W.nodeType===1&&X.push({element:W,left:W.scrollLeft,top:W.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<X.length;w++){var Z=X[w];Z.element.scrollLeft=Z.left,Z.element.scrollTop=Z.top}}Su=!!Tf,Of=Tf=null}finally{st=f,U.p=u,T.T=o}}s.current=r,Pt=2}}function Ry(){if(Pt===2){Pt=0;var s=Lr,r=Fa,o=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||o){o=T.T,T.T=null;var u=U.p;U.p=2;var f=st;st|=4;try{ay(s,r.alternate,r)}finally{st=f,U.p=u,T.T=o}}Pt=3}}function My(){if(Pt===4||Pt===3){Pt=0,z1();var s=Lr,r=Fa,o=rr,u=yy;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Pt=5:(Pt=0,Fa=Lr=null,Dy(s,s.pendingLanes));var f=s.pendingLanes;if(f===0&&(Br=null),Bh(o),r=r.stateNode,Ms&&typeof Ms.onCommitFiberRoot=="function")try{Ms.onCommitFiberRoot(To,r,void 0,(r.current.flags&128)===128)}catch{}if(u!==null){r=T.T,f=U.p,U.p=2,T.T=null;try{for(var p=s.onRecoverableError,y=0;y<u.length;y++){var w=u[y];p(w.value,{componentStack:w.stack})}}finally{T.T=r,U.p=f}}(rr&3)!==0&&cu(),ki(s),f=s.pendingLanes,(o&261930)!==0&&(f&42)!==0?s===pf?ul++:(ul=0,pf=s):ul=0,hl(0)}}function Dy(s,r){(s.pooledCacheLanes&=r)===0&&(r=s.pooledCache,r!=null&&(s.pooledCache=null,$o(r)))}function cu(){return Ay(),Ry(),My(),By()}function By(){if(Pt!==5)return!1;var s=Lr,r=mf;mf=0;var o=Bh(rr),u=T.T,f=U.p;try{U.p=32>o?32:o,T.T=null,o=_f,_f=null;var p=Lr,y=rr;if(Pt=0,Fa=Lr=null,rr=0,(st&6)!==0)throw Error(n(331));var w=st;if(st|=4,py(p.current),fy(p,p.current,y,o),st=w,hl(0,!1),Ms&&typeof Ms.onPostCommitFiberRoot=="function")try{Ms.onPostCommitFiberRoot(To,p)}catch{}return!0}finally{U.p=f,T.T=u,Dy(s,r)}}function Ly(s,r,o){r=Js(o,r),r=Vd(s.stateNode,r,2),s=Tr(s,r,2),s!==null&&(Ao(s,2),ki(s))}function nt(s,r,o){if(s.tag===3)Ly(s,s,o);else for(;r!==null;){if(r.tag===3){Ly(r,s,o);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=Js(o,s),o=zg(2),u=Tr(r,o,2),u!==null&&(qg(o,u,r,s),Ao(u,2),ki(u));break}}r=r.return}}function yf(s,r,o){var u=s.pingCache;if(u===null){u=s.pingCache=new cj;var f=new Set;u.set(r,f)}else f=u.get(r),f===void 0&&(f=new Set,u.set(r,f));f.has(o)||(hf=!0,f.add(o),s=mj.bind(null,s,r,o),r.then(s,s))}function mj(s,r,o){var u=s.pingCache;u!==null&&u.delete(r),s.pingedLanes|=s.suspendedLanes&o,s.warmLanes&=~o,ht===s&&(Fe&o)===o&&(St===4||St===3&&(Fe&62914560)===Fe&&300>Rs()-iu?(st&2)===0&&Ka(s,0):df|=o,Ua===Fe&&(Ua=0)),ki(s)}function zy(s,r){r===0&&(r=Ap()),s=Cn(s,r),s!==null&&(Ao(s,r),ki(s))}function _j(s){var r=s.memoizedState,o=0;r!==null&&(o=r.retryLane),zy(s,o)}function pj(s,r){var o=0;switch(s.tag){case 31:case 13:var u=s.stateNode,f=s.memoizedState;f!==null&&(o=f.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),zy(s,o)}function vj(s,r){return Ah(s,r)}var uu=null,Wa=null,bf=!1,hu=!1,Sf=!1,qr=0;function ki(s){s!==Wa&&s.next===null&&(Wa===null?uu=Wa=s:Wa=Wa.next=s),hu=!0,bf||(bf=!0,yj())}function hl(s,r){if(!Sf&&hu){Sf=!0;do for(var o=!1,u=uu;u!==null;){if(s!==0){var f=u.pendingLanes;if(f===0)var p=0;else{var y=u.suspendedLanes,w=u.pingedLanes;p=(1<<31-Ds(42|s)+1)-1,p&=f&~(y&~w),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(o=!0,Iy(u,p))}else p=Fe,p=_c(u,u===ht?p:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(p&3)===0||Oo(u,p)||(o=!0,Iy(u,p));u=u.next}while(o);Sf=!1}}function gj(){qy()}function qy(){hu=bf=!1;var s=0;qr!==0&&Tj()&&(s=qr);for(var r=Rs(),o=null,u=uu;u!==null;){var f=u.next,p=Py(u,r);p===0?(u.next=null,o===null?uu=f:o.next=f,f===null&&(Wa=o)):(o=u,(s!==0||(p&3)!==0)&&(hu=!0)),u=f}Pt!==0&&Pt!==5||hl(s),qr!==0&&(qr=0)}function Py(s,r){for(var o=s.suspendedLanes,u=s.pingedLanes,f=s.expirationTimes,p=s.pendingLanes&-62914561;0<p;){var y=31-Ds(p),w=1<<y,O=f[y];O===-1?((w&o)===0||(w&u)!==0)&&(f[y]=$1(w,r)):O<=r&&(s.expiredLanes|=w),p&=~w}if(r=ht,o=Fe,o=_c(s,s===r?o:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),u=s.callbackNode,o===0||s===r&&(rt===2||rt===9)||s.cancelPendingCommit!==null)return u!==null&&u!==null&&Rh(u),s.callbackNode=null,s.callbackPriority=0;if((o&3)===0||Oo(s,o)){if(r=o&-o,r===s.callbackPriority)return r;switch(u!==null&&Rh(u),Bh(o)){case 2:case 8:o=Tp;break;case 32:o=hc;break;case 268435456:o=Op;break;default:o=hc}return u=Hy.bind(null,s),o=Ah(o,u),s.callbackPriority=r,s.callbackNode=o,r}return u!==null&&u!==null&&Rh(u),s.callbackPriority=2,s.callbackNode=null,2}function Hy(s,r){if(Pt!==0&&Pt!==5)return s.callbackNode=null,s.callbackPriority=0,null;var o=s.callbackNode;if(cu()&&s.callbackNode!==o)return null;var u=Fe;return u=_c(s,s===ht?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),u===0?null:(Sy(s,u,r),Py(s,Rs()),s.callbackNode!=null&&s.callbackNode===o?Hy.bind(null,s):null)}function Iy(s,r){if(cu())return null;Sy(s,r,!0)}function yj(){Aj(function(){(st&6)!==0?Ah(Np,gj):qy()})}function xf(){if(qr===0){var s=Aa;s===0&&(s=dc,dc<<=1,(dc&261888)===0&&(dc=256)),qr=s}return qr}function Uy(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:yc(""+s)}function Fy(s,r){var o=r.ownerDocument.createElement("input");return o.name=r.name,o.value=r.value,s.id&&o.setAttribute("form",s.id),r.parentNode.insertBefore(o,r),s=new FormData(s),o.parentNode.removeChild(o),s}function bj(s,r,o,u,f){if(r==="submit"&&o&&o.stateNode===f){var p=Uy((f[bs]||null).action),y=u.submitter;y&&(r=(r=y[bs]||null)?Uy(r.formAction):y.getAttribute("formAction"),r!==null&&(p=r,y=null));var w=new wc("action","action",null,u,f);s.push({event:w,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(qr!==0){var O=y?Fy(f,y):new FormData(f);Id(o,{pending:!0,data:O,method:f.method,action:p},null,O)}}else typeof p=="function"&&(w.preventDefault(),O=y?Fy(f,y):new FormData(f),Id(o,{pending:!0,data:O,method:f.method,action:p},p,O))},currentTarget:f}]})}}for(var wf=0;wf<rd.length;wf++){var Cf=rd[wf],Sj=Cf.toLowerCase(),xj=Cf[0].toUpperCase()+Cf.slice(1);fi(Sj,"on"+xj)}fi(bv,"onAnimationEnd"),fi(Sv,"onAnimationIteration"),fi(xv,"onAnimationStart"),fi("dblclick","onDoubleClick"),fi("focusin","onFocus"),fi("focusout","onBlur"),fi(qC,"onTransitionRun"),fi(PC,"onTransitionStart"),fi(HC,"onTransitionCancel"),fi(wv,"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 dl="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(" "),wj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(dl));function Ky(s,r){r=(r&4)!==0;for(var o=0;o<s.length;o++){var u=s[o],f=u.event;u=u.listeners;e:{var p=void 0;if(r)for(var y=u.length-1;0<=y;y--){var w=u[y],O=w.instance,H=w.currentTarget;if(w=w.listener,O!==p&&f.isPropagationStopped())break e;p=w,f.currentTarget=H;try{p(f)}catch(Y){kc(Y)}f.currentTarget=null,p=O}else for(y=0;y<u.length;y++){if(w=u[y],O=w.instance,H=w.currentTarget,w=w.listener,O!==p&&f.isPropagationStopped())break e;p=w,f.currentTarget=H;try{p(f)}catch(Y){kc(Y)}f.currentTarget=null,p=O}}}}function Ue(s,r){var o=r[Lh];o===void 0&&(o=r[Lh]=new Set);var u=s+"__bubble";o.has(u)||($y(r,s,2,!1),o.add(u))}function jf(s,r,o){var u=0;r&&(u|=4),$y(o,s,u,r)}var du="_reactListening"+Math.random().toString(36).slice(2);function kf(s){if(!s[du]){s[du]=!0,qp.forEach(function(o){o!=="selectionchange"&&(wj.has(o)||jf(o,!1,s),jf(o,!0,s))});var r=s.nodeType===9?s:s.ownerDocument;r===null||r[du]||(r[du]=!0,jf("selectionchange",!1,r))}}function $y(s,r,o,u){switch(bb(r)){case 2:var f=Zj;break;case 8:f=Xj;break;default:f=If}o=f.bind(null,r,o,s),f=void 0,!$h||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(f=!0),u?f!==void 0?s.addEventListener(r,o,{capture:!0,passive:f}):s.addEventListener(r,o,!0):f!==void 0?s.addEventListener(r,o,{passive:f}):s.addEventListener(r,o,!1)}function Ef(s,r,o,u,f){var p=u;if((r&1)===0&&(r&2)===0&&u!==null)e:for(;;){if(u===null)return;var y=u.tag;if(y===3||y===4){var w=u.stateNode.containerInfo;if(w===f)break;if(y===4)for(y=u.return;y!==null;){var O=y.tag;if((O===3||O===4)&&y.stateNode.containerInfo===f)return;y=y.return}for(;w!==null;){if(y=ma(w),y===null)return;if(O=y.tag,O===5||O===6||O===26||O===27){u=p=y;continue e}w=w.parentNode}}u=u.return}Qp(function(){var H=p,Y=Fh(o),X=[];e:{var I=Cv.get(s);if(I!==void 0){var W=wc,_e=s;switch(s){case"keypress":if(Sc(o)===0)break e;case"keydown":case"keyup":W=pC;break;case"focusin":_e="focus",W=Gh;break;case"focusout":_e="blur",W=Gh;break;case"beforeblur":case"afterblur":W=Gh;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":W=Jp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":W=rC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":W=yC;break;case bv:case Sv:case xv:W=oC;break;case wv:W=SC;break;case"scroll":case"scrollend":W=sC;break;case"wheel":W=wC;break;case"copy":case"cut":case"paste":W=cC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":W=tv;break;case"toggle":case"beforetoggle":W=jC}var ke=(r&4)!==0,ct=!ke&&(s==="scroll"||s==="scrollend"),D=ke?I!==null?I+"Capture":null:I;ke=[];for(var R=H,P;R!==null;){var Z=R;if(P=Z.stateNode,Z=Z.tag,Z!==5&&Z!==26&&Z!==27||P===null||D===null||(Z=Do(R,D),Z!=null&&ke.push(fl(R,Z,P))),ct)break;R=R.return}0<ke.length&&(I=new W(I,_e,null,o,Y),X.push({event:I,listeners:ke}))}}if((r&7)===0){e:{if(I=s==="mouseover"||s==="pointerover",W=s==="mouseout"||s==="pointerout",I&&o!==Uh&&(_e=o.relatedTarget||o.fromElement)&&(ma(_e)||_e[fa]))break e;if((W||I)&&(I=Y.window===Y?Y:(I=Y.ownerDocument)?I.defaultView||I.parentWindow:window,W?(_e=o.relatedTarget||o.toElement,W=H,_e=_e?ma(_e):null,_e!==null&&(ct=l(_e),ke=_e.tag,_e!==ct||ke!==5&&ke!==27&&ke!==6)&&(_e=null)):(W=null,_e=H),W!==_e)){if(ke=Jp,Z="onMouseLeave",D="onMouseEnter",R="mouse",(s==="pointerout"||s==="pointerover")&&(ke=tv,Z="onPointerLeave",D="onPointerEnter",R="pointer"),ct=W==null?I:Mo(W),P=_e==null?I:Mo(_e),I=new ke(Z,R+"leave",W,o,Y),I.target=ct,I.relatedTarget=P,Z=null,ma(Y)===H&&(ke=new ke(D,R+"enter",_e,o,Y),ke.target=P,ke.relatedTarget=ct,Z=ke),ct=Z,W&&_e)t:{for(ke=Cj,D=W,R=_e,P=0,Z=D;Z;Z=ke(Z))P++;Z=0;for(var we=R;we;we=ke(we))Z++;for(;0<P-Z;)D=ke(D),P--;for(;0<Z-P;)R=ke(R),Z--;for(;P--;){if(D===R||R!==null&&D===R.alternate){ke=D;break t}D=ke(D),R=ke(R)}ke=null}else ke=null;W!==null&&Wy(X,I,W,ke,!1),_e!==null&&ct!==null&&Wy(X,ct,_e,ke,!0)}}e:{if(I=H?Mo(H):window,W=I.nodeName&&I.nodeName.toLowerCase(),W==="select"||W==="input"&&I.type==="file")var et=cv;else if(ov(I))if(uv)et=BC;else{et=MC;var be=RC}else W=I.nodeName,!W||W.toLowerCase()!=="input"||I.type!=="checkbox"&&I.type!=="radio"?H&&Ih(H.elementType)&&(et=cv):et=DC;if(et&&(et=et(s,H))){lv(X,et,o,Y);break e}be&&be(s,I,H),s==="focusout"&&H&&I.type==="number"&&H.memoizedProps.value!=null&&Hh(I,"number",I.value)}switch(be=H?Mo(H):window,s){case"focusin":(ov(be)||be.contentEditable==="true")&&(wa=be,td=H,Uo=null);break;case"focusout":Uo=td=wa=null;break;case"mousedown":sd=!0;break;case"contextmenu":case"mouseup":case"dragend":sd=!1,gv(X,o,Y);break;case"selectionchange":if(zC)break;case"keydown":case"keyup":gv(X,o,Y)}var Le;if(Zh)e:{switch(s){case"compositionstart":var Ke="onCompositionStart";break e;case"compositionend":Ke="onCompositionEnd";break e;case"compositionupdate":Ke="onCompositionUpdate";break e}Ke=void 0}else xa?nv(s,o)&&(Ke="onCompositionEnd"):s==="keydown"&&o.keyCode===229&&(Ke="onCompositionStart");Ke&&(sv&&o.locale!=="ko"&&(xa||Ke!=="onCompositionStart"?Ke==="onCompositionEnd"&&xa&&(Le=Zp()):(xr=Y,Wh="value"in xr?xr.value:xr.textContent,xa=!0)),be=fu(H,Ke),0<be.length&&(Ke=new ev(Ke,s,null,o,Y),X.push({event:Ke,listeners:be}),Le?Ke.data=Le:(Le=av(o),Le!==null&&(Ke.data=Le)))),(Le=EC?NC(s,o):TC(s,o))&&(Ke=fu(H,"onBeforeInput"),0<Ke.length&&(be=new ev("onBeforeInput","beforeinput",null,o,Y),X.push({event:be,listeners:Ke}),be.data=Le)),bj(X,s,H,o,Y)}Ky(X,r)})}function fl(s,r,o){return{instance:s,listener:r,currentTarget:o}}function fu(s,r){for(var o=r+"Capture",u=[];s!==null;){var f=s,p=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||p===null||(f=Do(s,o),f!=null&&u.unshift(fl(s,f,p)),f=Do(s,r),f!=null&&u.push(fl(s,f,p))),s.tag===3)return u;s=s.return}return[]}function Cj(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function Wy(s,r,o,u,f){for(var p=r._reactName,y=[];o!==null&&o!==u;){var w=o,O=w.alternate,H=w.stateNode;if(w=w.tag,O!==null&&O===u)break;w!==5&&w!==26&&w!==27||H===null||(O=H,f?(H=Do(o,p),H!=null&&y.unshift(fl(o,H,O))):f||(H=Do(o,p),H!=null&&y.push(fl(o,H,O)))),o=o.return}y.length!==0&&s.push({event:r,listeners:y})}var jj=/\r\n?/g,kj=/\u0000|\uFFFD/g;function Vy(s){return(typeof s=="string"?s:""+s).replace(jj,`
|
|
50
|
+
`).replace(kj,"")}function Yy(s,r){return r=Vy(r),Vy(s)===r}function lt(s,r,o,u,f,p){switch(o){case"children":typeof u=="string"?r==="body"||r==="textarea"&&u===""||ya(s,u):(typeof u=="number"||typeof u=="bigint")&&r!=="body"&&ya(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,o,u);break;case"style":Yp(s,u,p);break;case"data":if(r!=="object"){vc(s,"data",u);break}case"src":case"href":if(u===""&&(r!=="a"||o!=="href")){s.removeAttribute(o);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){s.removeAttribute(o);break}u=yc(""+u),s.setAttribute(o,u);break;case"action":case"formAction":if(typeof u=="function"){s.setAttribute(o,"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 p=="function"&&(o==="formAction"?(r!=="input"&<(s,r,"name",f.name,f,null),lt(s,r,"formEncType",f.formEncType,f,null),lt(s,r,"formMethod",f.formMethod,f,null),lt(s,r,"formTarget",f.formTarget,f,null)):(lt(s,r,"encType",f.encType,f,null),lt(s,r,"method",f.method,f,null),lt(s,r,"target",f.target,f,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){s.removeAttribute(o);break}u=yc(""+u),s.setAttribute(o,u);break;case"onClick":u!=null&&(s.onclick=Fi);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(o=u.__html,o!=null){if(f.children!=null)throw Error(n(60));s.innerHTML=o}}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}o=yc(""+u),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);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(o,""+u):s.removeAttribute(o);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(o,""):s.removeAttribute(o);break;case"capture":case"download":u===!0?s.setAttribute(o,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?s.setAttribute(o,u):s.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?s.setAttribute(o,u):s.removeAttribute(o);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?s.removeAttribute(o):s.setAttribute(o,u);break;case"popover":Ue("beforetoggle",s),Ue("toggle",s),pc(s,"popover",u);break;case"xlinkActuate":Ui(s,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Ui(s,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Ui(s,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Ui(s,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Ui(s,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Ui(s,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Ui(s,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Ui(s,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Ui(s,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":pc(s,"is",u);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=eC.get(o)||o,pc(s,o,u))}}function Nf(s,r,o,u,f,p){switch(o){case"style":Yp(s,u,p);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(n(61));if(o=u.__html,o!=null){if(f.children!=null)throw Error(n(60));s.innerHTML=o}}break;case"children":typeof u=="string"?ya(s,u):(typeof u=="number"||typeof u=="bigint")&&ya(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=Fi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Pp.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(f=o.endsWith("Capture"),r=o.slice(2,f?o.length-7:void 0),p=s[bs]||null,p=p!=null?p[o]:null,typeof p=="function"&&s.removeEventListener(r,p,f),typeof u=="function")){typeof p!="function"&&p!==null&&(o in s?s[o]=null:s.hasAttribute(o)&&s.removeAttribute(o)),s.addEventListener(r,u,f);break e}o in s?s[o]=u:u===!0?s.setAttribute(o,""):pc(s,o,u)}}}function rs(s,r,o){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,f=!1,p;for(p in o)if(o.hasOwnProperty(p)){var y=o[p];if(y!=null)switch(p){case"src":u=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,r));default:lt(s,r,p,y,o,null)}}f&<(s,r,"srcSet",o.srcSet,o,null),u&<(s,r,"src",o.src,o,null);return;case"input":Ue("invalid",s);var w=p=y=f=null,O=null,H=null;for(u in o)if(o.hasOwnProperty(u)){var Y=o[u];if(Y!=null)switch(u){case"name":f=Y;break;case"type":y=Y;break;case"checked":O=Y;break;case"defaultChecked":H=Y;break;case"value":p=Y;break;case"defaultValue":w=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(n(137,r));break;default:lt(s,r,u,Y,o,null)}}Kp(s,p,w,O,H,y,f,!1);return;case"select":Ue("invalid",s),u=y=p=null;for(f in o)if(o.hasOwnProperty(f)&&(w=o[f],w!=null))switch(f){case"value":p=w;break;case"defaultValue":y=w;break;case"multiple":u=w;default:lt(s,r,f,w,o,null)}r=p,o=y,s.multiple=!!u,r!=null?ga(s,!!u,r,!1):o!=null&&ga(s,!!u,o,!0);return;case"textarea":Ue("invalid",s),p=f=u=null;for(y in o)if(o.hasOwnProperty(y)&&(w=o[y],w!=null))switch(y){case"value":u=w;break;case"defaultValue":f=w;break;case"children":p=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(n(91));break;default:lt(s,r,y,w,o,null)}Wp(s,u,f,p);return;case"option":for(O in o)if(o.hasOwnProperty(O)&&(u=o[O],u!=null))switch(O){case"selected":s.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:lt(s,r,O,u,o,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<dl.length;u++)Ue(dl[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(H in o)if(o.hasOwnProperty(H)&&(u=o[H],u!=null))switch(H){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,r));default:lt(s,r,H,u,o,null)}return;default:if(Ih(r)){for(Y in o)o.hasOwnProperty(Y)&&(u=o[Y],u!==void 0&&Nf(s,r,Y,u,o,void 0));return}}for(w in o)o.hasOwnProperty(w)&&(u=o[w],u!=null&<(s,r,w,u,o,null))}function Ej(s,r,o,u){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,p=null,y=null,w=null,O=null,H=null,Y=null;for(W in o){var X=o[W];if(o.hasOwnProperty(W)&&X!=null)switch(W){case"checked":break;case"value":break;case"defaultValue":O=X;default:u.hasOwnProperty(W)||lt(s,r,W,null,u,X)}}for(var I in u){var W=u[I];if(X=o[I],u.hasOwnProperty(I)&&(W!=null||X!=null))switch(I){case"type":p=W;break;case"name":f=W;break;case"checked":H=W;break;case"defaultChecked":Y=W;break;case"value":y=W;break;case"defaultValue":w=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(n(137,r));break;default:W!==X&<(s,r,I,W,u,X)}}Ph(s,y,w,O,H,Y,p,f);return;case"select":W=y=w=I=null;for(p in o)if(O=o[p],o.hasOwnProperty(p)&&O!=null)switch(p){case"value":break;case"multiple":W=O;default:u.hasOwnProperty(p)||lt(s,r,p,null,u,O)}for(f in u)if(p=u[f],O=o[f],u.hasOwnProperty(f)&&(p!=null||O!=null))switch(f){case"value":I=p;break;case"defaultValue":w=p;break;case"multiple":y=p;default:p!==O&<(s,r,f,p,u,O)}r=w,o=y,u=W,I!=null?ga(s,!!o,I,!1):!!u!=!!o&&(r!=null?ga(s,!!o,r,!0):ga(s,!!o,o?[]:"",!1));return;case"textarea":W=I=null;for(w in o)if(f=o[w],o.hasOwnProperty(w)&&f!=null&&!u.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:lt(s,r,w,null,u,f)}for(y in u)if(f=u[y],p=o[y],u.hasOwnProperty(y)&&(f!=null||p!=null))switch(y){case"value":I=f;break;case"defaultValue":W=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(n(91));break;default:f!==p&<(s,r,y,f,u,p)}$p(s,I,W);return;case"option":for(var _e in o)if(I=o[_e],o.hasOwnProperty(_e)&&I!=null&&!u.hasOwnProperty(_e))switch(_e){case"selected":s.selected=!1;break;default:lt(s,r,_e,null,u,I)}for(O in u)if(I=u[O],W=o[O],u.hasOwnProperty(O)&&I!==W&&(I!=null||W!=null))switch(O){case"selected":s.selected=I&&typeof I!="function"&&typeof I!="symbol";break;default:lt(s,r,O,I,u,W)}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 o)I=o[ke],o.hasOwnProperty(ke)&&I!=null&&!u.hasOwnProperty(ke)&<(s,r,ke,null,u,I);for(H in u)if(I=u[H],W=o[H],u.hasOwnProperty(H)&&I!==W&&(I!=null||W!=null))switch(H){case"children":case"dangerouslySetInnerHTML":if(I!=null)throw Error(n(137,r));break;default:lt(s,r,H,I,u,W)}return;default:if(Ih(r)){for(var ct in o)I=o[ct],o.hasOwnProperty(ct)&&I!==void 0&&!u.hasOwnProperty(ct)&&Nf(s,r,ct,void 0,u,I);for(Y in u)I=u[Y],W=o[Y],!u.hasOwnProperty(Y)||I===W||I===void 0&&W===void 0||Nf(s,r,Y,I,u,W);return}}for(var D in o)I=o[D],o.hasOwnProperty(D)&&I!=null&&!u.hasOwnProperty(D)&<(s,r,D,null,u,I);for(X in u)I=u[X],W=o[X],!u.hasOwnProperty(X)||I===W||I==null&&W==null||lt(s,r,X,I,u,W)}function Gy(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Nj(){if(typeof performance.getEntriesByType=="function"){for(var s=0,r=0,o=performance.getEntriesByType("resource"),u=0;u<o.length;u++){var f=o[u],p=f.transferSize,y=f.initiatorType,w=f.duration;if(p&&w&&Gy(y)){for(y=0,w=f.responseEnd,u+=1;u<o.length;u++){var O=o[u],H=O.startTime;if(H>w)break;var Y=O.transferSize,X=O.initiatorType;Y&&Gy(X)&&(O=O.responseEnd,y+=Y*(O<w?1:(w-H)/(O-H)))}if(--u,r+=8*(p+y)/(f.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 Tf=null,Of=null;function mu(s){return s.nodeType===9?s:s.ownerDocument}function Qy(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 Zy(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 Af(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 Rf=null;function Tj(){var s=window.event;return s&&s.type==="popstate"?s===Rf?!1:(Rf=s,!0):(Rf=null,!1)}var Xy=typeof setTimeout=="function"?setTimeout:void 0,Oj=typeof clearTimeout=="function"?clearTimeout:void 0,Jy=typeof Promise=="function"?Promise:void 0,Aj=typeof queueMicrotask=="function"?queueMicrotask:typeof Jy<"u"?function(s){return Jy.resolve(null).then(s).catch(Rj)}:Xy;function Rj(s){setTimeout(function(){throw s})}function Pr(s){return s==="head"}function eb(s,r){var o=r,u=0;do{var f=o.nextSibling;if(s.removeChild(o),f&&f.nodeType===8)if(o=f.data,o==="/$"||o==="/&"){if(u===0){s.removeChild(f),Qa(r);return}u--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")u++;else if(o==="html")ml(s.ownerDocument.documentElement);else if(o==="head"){o=s.ownerDocument.head,ml(o);for(var p=o.firstChild;p;){var y=p.nextSibling,w=p.nodeName;p[Ro]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&p.rel.toLowerCase()==="stylesheet"||o.removeChild(p),p=y}}else o==="body"&&ml(s.ownerDocument.body);o=f}while(o);Qa(r)}function tb(s,r){var o=s;s=0;do{var u=o.nextSibling;if(o.nodeType===1?r?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(r?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),u&&u.nodeType===8)if(o=u.data,o==="/$"){if(s===0)break;s--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||s++;o=u}while(o)}function Mf(s){var r=s.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var o=r;switch(r=r.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":Mf(o),zh(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}s.removeChild(o)}}function Mj(s,r,o,u){for(;s.nodeType===1;){var f=o;if(s.nodeName.toLowerCase()!==r.toLowerCase()){if(!u&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(u){if(!s[Ro])switch(r){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(p=s.getAttribute("rel"),p==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(p!==f.rel||s.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||s.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||s.getAttribute("title")!==(f.title==null?null:f.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(p=s.getAttribute("src"),(p!==(f.src==null?null:f.src)||s.getAttribute("type")!==(f.type==null?null:f.type)||s.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&p&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(r==="input"&&s.type==="hidden"){var p=f.name==null?null:""+f.name;if(f.type==="hidden"&&s.getAttribute("name")===p)return s}else return s;if(s=ri(s.nextSibling),s===null)break}return null}function Dj(s,r,o){if(r==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!o||(s=ri(s.nextSibling),s===null))return null;return s}function sb(s,r){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!r||(s=ri(s.nextSibling),s===null))return null;return s}function Df(s){return s.data==="$?"||s.data==="$~"}function Bf(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function Bj(s,r){var o=s.ownerDocument;if(s.data==="$~")s._reactRetry=r;else if(s.data!=="$?"||o.readyState!=="loading")r();else{var u=function(){r(),o.removeEventListener("DOMContentLoaded",u)};o.addEventListener("DOMContentLoaded",u),s._reactRetry=u}}function ri(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 Lf=null;function ib(s){s=s.nextSibling;for(var r=0;s;){if(s.nodeType===8){var o=s.data;if(o==="/$"||o==="/&"){if(r===0)return ri(s.nextSibling);r--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||r++}s=s.nextSibling}return null}function rb(s){s=s.previousSibling;for(var r=0;s;){if(s.nodeType===8){var o=s.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(r===0)return s;r--}else o!=="/$"&&o!=="/&"||r++}s=s.previousSibling}return null}function nb(s,r,o){switch(r=mu(o),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 ml(s){for(var r=s.attributes;r.length;)s.removeAttributeNode(r[0]);zh(s)}var ni=new Map,ab=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:Lj,r:zj,D:qj,C:Pj,L:Hj,m:Ij,X:Fj,S:Uj,M:Kj};function Lj(){var s=nr.f(),r=au();return s||r}function zj(s){var r=_a(s);r!==null&&r.tag===5&&r.type==="form"?wg(r):nr.r(s)}var Va=typeof document>"u"?null:document;function ob(s,r,o){var u=Va;if(u&&typeof r=="string"&&r){var f=Zs(r);f='link[rel="'+s+'"][href="'+f+'"]',typeof o=="string"&&(f+='[crossorigin="'+o+'"]'),ab.has(f)||(ab.add(f),s={rel:s,crossOrigin:o,href:r},u.querySelector(f)===null&&(r=u.createElement("link"),rs(r,"link",s),Wt(r),u.head.appendChild(r)))}}function qj(s){nr.D(s),ob("dns-prefetch",s,null)}function Pj(s,r){nr.C(s,r),ob("preconnect",s,r)}function Hj(s,r,o){nr.L(s,r,o);var u=Va;if(u&&s&&r){var f='link[rel="preload"][as="'+Zs(r)+'"]';r==="image"&&o&&o.imageSrcSet?(f+='[imagesrcset="'+Zs(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(f+='[imagesizes="'+Zs(o.imageSizes)+'"]')):f+='[href="'+Zs(s)+'"]';var p=f;switch(r){case"style":p=Ya(s);break;case"script":p=Ga(s)}ni.has(p)||(s=g({rel:"preload",href:r==="image"&&o&&o.imageSrcSet?void 0:s,as:r},o),ni.set(p,s),u.querySelector(f)!==null||r==="style"&&u.querySelector(_l(p))||r==="script"&&u.querySelector(pl(p))||(r=u.createElement("link"),rs(r,"link",s),Wt(r),u.head.appendChild(r)))}}function Ij(s,r){nr.m(s,r);var o=Va;if(o&&s){var u=r&&typeof r.as=="string"?r.as:"script",f='link[rel="modulepreload"][as="'+Zs(u)+'"][href="'+Zs(s)+'"]',p=f;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Ga(s)}if(!ni.has(p)&&(s=g({rel:"modulepreload",href:s},r),ni.set(p,s),o.querySelector(f)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(pl(p)))return}u=o.createElement("link"),rs(u,"link",s),Wt(u),o.head.appendChild(u)}}}function Uj(s,r,o){nr.S(s,r,o);var u=Va;if(u&&s){var f=pa(u).hoistableStyles,p=Ya(s);r=r||"default";var y=f.get(p);if(!y){var w={loading:0,preload:null};if(y=u.querySelector(_l(p)))w.loading=5;else{s=g({rel:"stylesheet",href:s,"data-precedence":r},o),(o=ni.get(p))&&zf(s,o);var O=y=u.createElement("link");Wt(O),rs(O,"link",s),O._p=new Promise(function(H,Y){O.onload=H,O.onerror=Y}),O.addEventListener("load",function(){w.loading|=1}),O.addEventListener("error",function(){w.loading|=2}),w.loading|=4,pu(y,r,u)}y={type:"stylesheet",instance:y,count:1,state:w},f.set(p,y)}}}function Fj(s,r){nr.X(s,r);var o=Va;if(o&&s){var u=pa(o).hoistableScripts,f=Ga(s),p=u.get(f);p||(p=o.querySelector(pl(f)),p||(s=g({src:s,async:!0},r),(r=ni.get(f))&&qf(s,r),p=o.createElement("script"),Wt(p),rs(p,"link",s),o.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},u.set(f,p))}}function Kj(s,r){nr.M(s,r);var o=Va;if(o&&s){var u=pa(o).hoistableScripts,f=Ga(s),p=u.get(f);p||(p=o.querySelector(pl(f)),p||(s=g({src:s,async:!0,type:"module"},r),(r=ni.get(f))&&qf(s,r),p=o.createElement("script"),Wt(p),rs(p,"link",s),o.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},u.set(f,p))}}function lb(s,r,o,u){var f=(f=ye.current)?_u(f):null;if(!f)throw Error(n(446));switch(s){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(r=Ya(o.href),o=pa(f).hoistableStyles,u=o.get(r),u||(u={type:"style",instance:null,count:0,state:null},o.set(r,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){s=Ya(o.href);var p=pa(f).hoistableStyles,y=p.get(s);if(y||(f=f.ownerDocument||f,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(s,y),(p=f.querySelector(_l(s)))&&!p._p&&(y.instance=p,y.state.loading=5),ni.has(s)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},ni.set(s,o),p||$j(f,s,o,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=o.async,o=o.src,typeof o=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Ga(o),o=pa(f).hoistableScripts,u=o.get(r),u||(u={type:"script",instance:null,count:0,state:null},o.set(r,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,s))}}function Ya(s){return'href="'+Zs(s)+'"'}function _l(s){return'link[rel="stylesheet"]['+s+"]"}function cb(s){return g({},s,{"data-precedence":s.precedence,precedence:null})}function $j(s,r,o,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",o),Wt(r),s.head.appendChild(r))}function Ga(s){return'[src="'+Zs(s)+'"]'}function pl(s){return"script[async]"+s}function ub(s,r,o){if(r.count++,r.instance===null)switch(r.type){case"style":var u=s.querySelector('style[data-href~="'+Zs(o.href)+'"]');if(u)return r.instance=u,Wt(u),u;var f=g({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return u=(s.ownerDocument||s).createElement("style"),Wt(u),rs(u,"style",f),pu(u,o.precedence,s),r.instance=u;case"stylesheet":f=Ya(o.href);var p=s.querySelector(_l(f));if(p)return r.state.loading|=4,r.instance=p,Wt(p),p;u=cb(o),(f=ni.get(f))&&zf(u,f),p=(s.ownerDocument||s).createElement("link"),Wt(p);var y=p;return y._p=new Promise(function(w,O){y.onload=w,y.onerror=O}),rs(p,"link",u),r.state.loading|=4,pu(p,o.precedence,s),r.instance=p;case"script":return p=Ga(o.src),(f=s.querySelector(pl(p)))?(r.instance=f,Wt(f),f):(u=o,(f=ni.get(p))&&(u=g({},o),qf(u,f)),s=s.ownerDocument||s,f=s.createElement("script"),Wt(f),rs(f,"link",u),s.head.appendChild(f),r.instance=f);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,pu(u,o.precedence,s));return r.instance}function pu(s,r,o){for(var u=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=u.length?u[u.length-1]:null,p=f,y=0;y<u.length;y++){var w=u[y];if(w.dataset.precedence===r)p=w;else if(p!==f)break}p?p.parentNode.insertBefore(s,p.nextSibling):(r=o.nodeType===9?o.head:o,r.insertBefore(s,r.firstChild))}function zf(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.title==null&&(s.title=r.title)}function qf(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 hb(s,r,o){if(vu===null){var u=new Map,f=vu=new Map;f.set(o,u)}else f=vu,u=f.get(o),u||(u=new Map,f.set(o,u));if(u.has(s))return u;for(u.set(s,null),o=o.getElementsByTagName(s),f=0;f<o.length;f++){var p=o[f];if(!(p[Ro]||p[es]||s==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var y=p.getAttribute(r)||"";y=s+y;var w=u.get(y);w?w.push(p):u.set(y,[p])}}return u}function db(s,r,o){s=s.ownerDocument||s,s.head.insertBefore(o,r==="title"?s.querySelector("head > title"):null)}function Wj(s,r,o){if(o===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 fb(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function Vj(s,r,o,u){if(o.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var f=Ya(u.href),p=r.querySelector(_l(f));if(p){r=p._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(s.count++,s=gu.bind(s),r.then(s,s)),o.state.loading|=4,o.instance=p,Wt(p);return}p=r.ownerDocument||r,u=cb(u),(f=ni.get(f))&&zf(u,f),p=p.createElement("link"),Wt(p);var y=p;y._p=new Promise(function(w,O){y.onload=w,y.onerror=O}),rs(p,"link",u),o.instance=p}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(o,r),(r=o.state.preload)&&(o.state.loading&3)===0&&(s.count++,o=gu.bind(s),r.addEventListener("load",o),r.addEventListener("error",o))}}var Pf=0;function Yj(s,r){return s.stylesheets&&s.count===0&&bu(s,s.stylesheets),0<s.count||0<s.imgCount?function(o){var u=setTimeout(function(){if(s.stylesheets&&bu(s,s.stylesheets),s.unsuspend){var p=s.unsuspend;s.unsuspend=null,p()}},6e4+r);0<s.imgBytes&&Pf===0&&(Pf=62500*Nj());var f=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&bu(s,s.stylesheets),s.unsuspend)){var p=s.unsuspend;s.unsuspend=null,p()}},(s.imgBytes>Pf?50:800)+r);return s.unsuspend=o,function(){s.unsuspend=null,clearTimeout(u),clearTimeout(f)}}:null}function gu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)bu(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var yu=null;function bu(s,r){s.stylesheets=null,s.unsuspend!==null&&(s.count++,yu=new Map,r.forEach(Gj,s),yu=null,gu.call(s))}function Gj(s,r){if(!(r.state.loading&4)){var o=yu.get(s);if(o)var u=o.get(null);else{o=new Map,yu.set(s,o);for(var f=s.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<f.length;p++){var y=f[p];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(o.set(y.dataset.precedence,y),u=y)}u&&o.set(null,u)}f=r.instance,y=f.getAttribute("data-precedence"),p=o.get(y)||u,p===u&&o.set(null,f),o.set(y,f),this.count++,u=gu.bind(this),f.addEventListener("load",u),f.addEventListener("error",u),p?p.parentNode.insertBefore(f,p.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(f,s.firstChild)),r.state.loading|=4}}var vl={$$typeof:B,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function Qj(s,r,o,u,f,p,y,w,O){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Mh(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mh(0),this.hiddenUpdates=Mh(null),this.identifierPrefix=u,this.onUncaughtError=f,this.onCaughtError=p,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function mb(s,r,o,u,f,p,y,w,O,H,Y,X){return s=new Qj(s,r,o,y,O,H,Y,X,w),r=1,p===!0&&(r|=24),p=Ls(3,null,null,r),s.current=p,p.stateNode=s,r=vd(),r.refCount++,s.pooledCache=r,r.refCount++,p.memoizedState={element:u,isDehydrated:o,cache:r},Sd(p),s}function _b(s){return s?(s=ka,s):ka}function pb(s,r,o,u,f,p){f=_b(f),u.context===null?u.context=f:u.pendingContext=f,u=Nr(r),u.payload={element:o},p=p===void 0?null:p,p!==null&&(u.callback=p),o=Tr(s,u,r),o!==null&&(ks(o,s,r),Go(o,s,r))}function vb(s,r){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var o=s.retryLane;s.retryLane=o!==0&&o<r?o:r}}function Hf(s,r){vb(s,r),(s=s.alternate)&&vb(s,r)}function gb(s){if(s.tag===13||s.tag===31){var r=Cn(s,67108864);r!==null&&ks(r,s,67108864),Hf(s,67108864)}}function yb(s){if(s.tag===13||s.tag===31){var r=Is();r=Dh(r);var o=Cn(s,r);o!==null&&ks(o,s,r),Hf(s,r)}}var Su=!0;function Zj(s,r,o,u){var f=T.T;T.T=null;var p=U.p;try{U.p=2,If(s,r,o,u)}finally{U.p=p,T.T=f}}function Xj(s,r,o,u){var f=T.T;T.T=null;var p=U.p;try{U.p=8,If(s,r,o,u)}finally{U.p=p,T.T=f}}function If(s,r,o,u){if(Su){var f=Uf(u);if(f===null)Ef(s,r,u,xu,o),Sb(s,u);else if(ek(f,s,r,o,u))u.stopPropagation();else if(Sb(s,u),r&4&&-1<Jj.indexOf(s)){for(;f!==null;){var p=_a(f);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var y=yn(p.pendingLanes);if(y!==0){var w=p;for(w.pendingLanes|=2,w.entangledLanes|=2;y;){var O=1<<31-Ds(y);w.entanglements[1]|=O,y&=~O}ki(p),(st&6)===0&&(ru=Rs()+500,hl(0))}}break;case 31:case 13:w=Cn(p,2),w!==null&&ks(w,p,2),au(),Hf(p,2)}if(p=Uf(u),p===null&&Ef(s,r,u,xu,o),p===f)break;f=p}f!==null&&u.stopPropagation()}else Ef(s,r,u,null,o)}}function Uf(s){return s=Fh(s),Ff(s)}var xu=null;function Ff(s){if(xu=null,s=ma(s),s!==null){var r=l(s);if(r===null)s=null;else{var o=r.tag;if(o===13){if(s=h(r),s!==null)return s;s=null}else if(o===31){if(s=d(r),s!==null)return s;s=null}else if(o===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;s=null}else r!==s&&(s=null)}}return xu=s,null}function bb(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(q1()){case Np:return 2;case Tp:return 8;case hc:case P1:return 32;case Op:return 268435456;default:return 32}default:return 32}}var Kf=!1,Hr=null,Ir=null,Ur=null,gl=new Map,yl=new Map,Fr=[],Jj="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 Sb(s,r){switch(s){case"focusin":case"focusout":Hr=null;break;case"dragenter":case"dragleave":Ir=null;break;case"mouseover":case"mouseout":Ur=null;break;case"pointerover":case"pointerout":gl.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":yl.delete(r.pointerId)}}function bl(s,r,o,u,f,p){return s===null||s.nativeEvent!==p?(s={blockedOn:r,domEventName:o,eventSystemFlags:u,nativeEvent:p,targetContainers:[f]},r!==null&&(r=_a(r),r!==null&&gb(r)),s):(s.eventSystemFlags|=u,r=s.targetContainers,f!==null&&r.indexOf(f)===-1&&r.push(f),s)}function ek(s,r,o,u,f){switch(r){case"focusin":return Hr=bl(Hr,s,r,o,u,f),!0;case"dragenter":return Ir=bl(Ir,s,r,o,u,f),!0;case"mouseover":return Ur=bl(Ur,s,r,o,u,f),!0;case"pointerover":var p=f.pointerId;return gl.set(p,bl(gl.get(p)||null,s,r,o,u,f)),!0;case"gotpointercapture":return p=f.pointerId,yl.set(p,bl(yl.get(p)||null,s,r,o,u,f)),!0}return!1}function xb(s){var r=ma(s.target);if(r!==null){var o=l(r);if(o!==null){if(r=o.tag,r===13){if(r=h(o),r!==null){s.blockedOn=r,Lp(s.priority,function(){yb(o)});return}}else if(r===31){if(r=d(o),r!==null){s.blockedOn=r,Lp(s.priority,function(){yb(o)});return}}else if(r===3&&o.stateNode.current.memoizedState.isDehydrated){s.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}s.blockedOn=null}function wu(s){if(s.blockedOn!==null)return!1;for(var r=s.targetContainers;0<r.length;){var o=Uf(s.nativeEvent);if(o===null){o=s.nativeEvent;var u=new o.constructor(o.type,o);Uh=u,o.target.dispatchEvent(u),Uh=null}else return r=_a(o),r!==null&&gb(r),s.blockedOn=o,!1;r.shift()}return!0}function wb(s,r,o){wu(s)&&o.delete(r)}function tk(){Kf=!1,Hr!==null&&wu(Hr)&&(Hr=null),Ir!==null&&wu(Ir)&&(Ir=null),Ur!==null&&wu(Ur)&&(Ur=null),gl.forEach(wb),yl.forEach(wb)}function Cu(s,r){s.blockedOn===r&&(s.blockedOn=null,Kf||(Kf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,tk)))}var ju=null;function Cb(s){ju!==s&&(ju=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ju===s&&(ju=null);for(var r=0;r<s.length;r+=3){var o=s[r],u=s[r+1],f=s[r+2];if(typeof u!="function"){if(Ff(u||o)===null)continue;break}var p=_a(o);p!==null&&(s.splice(r,3),r-=3,Id(p,{pending:!0,data:f,method:o.method,action:u},u,f))}}))}function Qa(s){function r(O){return Cu(O,s)}Hr!==null&&Cu(Hr,s),Ir!==null&&Cu(Ir,s),Ur!==null&&Cu(Ur,s),gl.forEach(r),yl.forEach(r);for(var o=0;o<Fr.length;o++){var u=Fr[o];u.blockedOn===s&&(u.blockedOn=null)}for(;0<Fr.length&&(o=Fr[0],o.blockedOn===null);)xb(o),o.blockedOn===null&&Fr.shift();if(o=(s.ownerDocument||s).$$reactFormReplay,o!=null)for(u=0;u<o.length;u+=3){var f=o[u],p=o[u+1],y=f[bs]||null;if(typeof p=="function")y||Cb(o);else if(y){var w=null;if(p&&p.hasAttribute("formAction")){if(f=p,y=p[bs]||null)w=y.formAction;else if(Ff(f)!==null)continue}else w=y.action;typeof w=="function"?o[u+1]=w:(o.splice(u,3),u-=3),Cb(o)}}}function jb(){function s(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(y){return f=y})},focusReset:"manual",scroll:"manual"})}function r(){f!==null&&(f(),f=null),u||setTimeout(o,20)}function o(){if(!u&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,f=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(o,100),function(){u=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),f!==null&&(f(),f=null)}}}function $f(s){this._internalRoot=s}ku.prototype.render=$f.prototype.render=function(s){var r=this._internalRoot;if(r===null)throw Error(n(409));var o=r.current,u=Is();pb(o,u,s,r,null,null)},ku.prototype.unmount=$f.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var r=s.containerInfo;pb(s.current,2,null,s,null,null),au(),r[fa]=null}};function ku(s){this._internalRoot=s}ku.prototype.unstable_scheduleHydration=function(s){if(s){var r=Bp();s={blockedOn:null,target:s,priority:r};for(var o=0;o<Fr.length&&r!==0&&r<Fr[o].priority;o++);Fr.splice(o,0,s),o===0&&xb(s)}};var kb=t.version;if(kb!=="19.2.8")throw Error(n(527,kb,"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=m(r),s=s!==null?v(s):null,s=s===null?null:s.stateNode,s};var sk={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:T,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Eu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Eu.isDisabled&&Eu.supportsFiber)try{To=Eu.inject(sk),Ms=Eu}catch{}}return xl.createRoot=function(s,r){if(!a(s))throw Error(n(299));var o=!1,u="",f=Mg,p=Dg,y=Bg;return r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(f=r.onUncaughtError),r.onCaughtError!==void 0&&(p=r.onCaughtError),r.onRecoverableError!==void 0&&(y=r.onRecoverableError)),r=mb(s,1,!1,null,null,o,u,null,f,p,y,jb),s[fa]=r.current,kf(s),new $f(r)},xl.hydrateRoot=function(s,r,o){if(!a(s))throw Error(n(299));var u=!1,f="",p=Mg,y=Dg,w=Bg,O=null;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(f=o.identifierPrefix),o.onUncaughtError!==void 0&&(p=o.onUncaughtError),o.onCaughtError!==void 0&&(y=o.onCaughtError),o.onRecoverableError!==void 0&&(w=o.onRecoverableError),o.formState!==void 0&&(O=o.formState)),r=mb(s,1,!0,r,o??null,u,f,O,p,y,w,jb),r.context=_b(null),o=r.current,u=Is(),u=Dh(u),f=Nr(u),f.callback=null,Tr(o,f,u),o=u,r.current.lanes=o,Ao(r,o),ki(r),s[fa]=r.current,kf(s),new ku(r)},xl.version="19.2.8",xl}var Yb;function Wk(){if(Yb)return Gf.exports;Yb=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(),Gf.exports=$k(),Gf.exports}var Vk=Wk();const mr=["workspace","list"];function ca(e){return["project","listByWorkspace",e]}function xo(e){return["worktree","listByProject",e]}function Yk(e){return["project","detail",e]}function X_(e){return["worktree","detail",e]}function Hi(e,t){return["session","listByScope",e,t]}function Nx(e,t){return["scripts","status",e,t]}function J_(e,t,i){return["files","listDir",e,t,i]}function Ou(e,t,i){return["files","read",e,t,i]}function Gk(e,t,i){return["files","deletePreview",e,t,i]}function Qk(e,t,i){return["changes","list",e,t,i]}function Zk(e,t,i,n){return["changes","patch",e,t,i,n]}function Xk(e,t){return["memory","list",e??"-",t??"-"]}function Jk(e){return["memory","proposals",e]}function eE(e,t){return["memory","core",e??"-",t??"-"]}function tE(e,t,i){return["memory","search",e??"-",t??"-",i]}const sE=["memory","decisions"],iE=["memory","usage"],rE=["memory","settings"];function nE(e,t){return["usage","byProject",e,t]}function aE(e,t){return["usage","byWorktree",e,t]}function oE(e,t){return["memory","playbooks",e??"-",t?"arquivados":"ativos"]}function yh(e){return["project","cloneJobs",e]}var lE=Object.create,Tx=Object.defineProperty,cE=Object.getOwnPropertyDescriptor,Ox=Object.getOwnPropertyNames,uE=Object.getPrototypeOf,hE=Object.prototype.hasOwnProperty,Ii=(e,t)=>function(){return t||(0,e[Ox(e)[0]])((t={exports:{}}).exports,t),t.exports},dE=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var a=Ox(t),l=0,h=a.length,d;l<h;l++)d=a[l],!hE.call(e,d)&&d!==i&&Tx(e,d,{get:(_=>t[_]).bind(null,d),enumerable:!(n=cE(t,d))||n.enumerable});return e},Ot=(e,t,i)=>(i=e!=null?lE(uE(e)):{},dE(t||!e||!e.__esModule?Tx(i,"default",{value:e,enumerable:!0}):i,e)),Ax=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}}),fE=Ii({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var i=Ax().default;function n(a,l){if(i(a)!="object"||!a)return a;var h=a[Symbol.toPrimitive];if(h!==void 0){var d=h.call(a,l||"default");if(i(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(a)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),mE=Ii({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var i=Ax().default,n=fE();function a(l){var h=n(l,"string");return i(h)=="symbol"?h:h+""}t.exports=a,t.exports.__esModule=!0,t.exports.default=t.exports}}),ua=Ii({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var i=mE();function n(a,l,h){return(l=i(l))in a?Object.defineProperty(a,l,{value:h,enumerable:!0,configurable:!0,writable:!0}):a[l]=h,a}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),yi=Ii({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var i=ua();function n(l,h){var d=Object.keys(l);if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(l);h&&(_=_.filter(function(m){return Object.getOwnPropertyDescriptor(l,m).enumerable})),d.push.apply(d,_)}return d}function a(l){for(var h=1;h<arguments.length;h++){var d=arguments[h]!=null?arguments[h]:{};h%2?n(Object(d),!0).forEach(function(_){i(l,_,d[_])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(d)):n(Object(d)).forEach(function(_){Object.defineProperty(l,_,Object.getOwnPropertyDescriptor(d,_))})}return l}t.exports=a,t.exports.__esModule=!0,t.exports.default=t.exports}});function wo(e){const t={subscribe(i){let n=null,a=!1,l=!1,h=!1;function d(){if(n===null){h=!0;return}l||(l=!0,typeof n=="function"?n():n&&n.unsubscribe())}return n=e({next(_){var m;a||(m=i.next)===null||m===void 0||m.call(i,_)},error(_){var m;a||(a=!0,(m=i.error)===null||m===void 0||m.call(i,_),d())},complete(){var _;a||(a=!0,(_=i.complete)===null||_===void 0||_.call(i),d())}}),h&&d(),{unsubscribe:d}},pipe(...i){return i.reduce(_E,t)}};return t}function _E(e,t){return t(e)}function pE(e){const t=new AbortController;return new Promise((n,a)=>{let l=!1;function h(){l||(l=!0,d.unsubscribe())}t.signal.addEventListener("abort",()=>{a(t.signal.reason)});const d=e.subscribe({next(_){l=!0,n(_),h()},error(_){a(_)},complete(){t.abort(),h()}})})}function vE(e){return t=>{let i=0,n=null;const a=[];function l(){n||(n=t.subscribe({next(d){for(const m of a){var _;(_=m.next)===null||_===void 0||_.call(m,d)}},error(d){for(const m of a){var _;(_=m.error)===null||_===void 0||_.call(m,d)}},complete(){for(const _ of a){var d;(d=_.complete)===null||d===void 0||d.call(_)}}}))}function h(){if(i===0&&n){const d=n;n=null,d.unsubscribe()}}return wo(d=>(i++,a.push(d),l(),{unsubscribe(){i--,h();const _=a.findIndex(m=>m===d);_>-1&&a.splice(_,1)}}))}}function Rx(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)},l=wo(h=>(n(h),()=>{a(h)}));return l.next=h=>{if(t!==h){t=h;for(const d of i)d.next(h)}},l.get=()=>t,l}function Mx(e){return wo(t=>{function i(a=0,l=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:l,next(_){return i(a+1,_)}})}return i().subscribe(t)})}function Gb(e){return Array.isArray(e)?e:[e]}function gE(e){return t=>{const i=Gb(e.true).map(a=>a(t)),n=Gb(e.false).map(a=>a(t));return a=>wo(l=>{const h=e.condition(a.op)?i:n;return Mx({op:a.op,links:h}).subscribe(l)})}}function Il(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}function Dx(){return Object.create(null)}const Bx=e=>e(),Au={INTERNAL_SERVER_ERROR:-32603,BAD_GATEWAY:-32603,SERVICE_UNAVAILABLE:-32603,GATEWAY_TIMEOUT:-32603},yE=[Au.BAD_GATEWAY,Au.SERVICE_UNAVAILABLE,Au.GATEWAY_TIMEOUT,Au.INTERNAL_SERVER_ERROR];var bE=Object.create,Lx=Object.defineProperty,SE=Object.getOwnPropertyDescriptor,zx=Object.getOwnPropertyNames,xE=Object.getPrototypeOf,wE=Object.prototype.hasOwnProperty,bi=(e,t)=>function(){return t||(0,e[zx(e)[0]])((t={exports:{}}).exports,t),t.exports},CE=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var a=zx(t),l=0,h=a.length,d;l<h;l++)d=a[l],!wE.call(e,d)&&d!==i&&Lx(e,d,{get:(_=>t[_]).bind(null,d),enumerable:!(n=SE(t,d))||n.enumerable});return e},dt=(e,t,i)=>(i=e!=null?bE(xE(e)):{},CE(Lx(i,"default",{value:e,enumerable:!0}),e));const qx=()=>{},Qb=e=>{Object.freeze&&Object.freeze(e)};function Px(e,t,i){var n;const a=t.join(".");return(n=i[a])!==null&&n!==void 0||(i[a]=new Proxy(qx,{get(l,h){if(!(typeof h!="string"||h==="then"))return Px(e,[...t,h],i)},apply(l,h,d){const _=t[t.length-1];if(_==="valueOf"||_==="toString"||_==="toJSON")return`tRPC.proxy(${t.slice(0,-1).join(".")})`;let m={args:d,path:t};return _==="call"?m={args:d.length>=2?[d[1]]:[],path:t.slice(0,-1)}:_==="apply"&&(m={args:d.length>=2?d[1]:[],path:t.slice(0,-1)}),Qb(m.args),Qb(m.path),e(m)}})),i[a]}const jE=e=>Px(e,[],Dx()),kE=e=>new Proxy(qx,{get(t,i){if(i!=="then")return e(i)}});var Hx=bi({"../../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}}),EE=bi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var i=Hx().default;function n(a,l){if(i(a)!="object"||!a)return a;var h=a[Symbol.toPrimitive];if(h!==void 0){var d=h.call(a,l||"default");if(i(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(a)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),NE=bi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var i=Hx().default,n=EE();function a(l){var h=n(l,"string");return i(h)=="symbol"?h:h+""}t.exports=a,t.exports.__esModule=!0,t.exports.default=t.exports}}),ep=bi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var i=NE();function n(a,l,h){return(l=i(l))in a?Object.defineProperty(a,l,{value:h,enumerable:!0,configurable:!0,writable:!0}):a[l]=h,a}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),rc=bi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var i=ep();function n(l,h){var d=Object.keys(l);if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(l);h&&(_=_.filter(function(m){return Object.getOwnPropertyDescriptor(l,m).enumerable})),d.push.apply(d,_)}return d}function a(l){for(var h=1;h<arguments.length;h++){var d=arguments[h]!=null?arguments[h]:{};h%2?n(Object(d),!0).forEach(function(_){i(l,_,d[_])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(d)):n(Object(d)).forEach(function(_){Object.defineProperty(l,_,Object.getOwnPropertyDescriptor(d,_))})}return l}t.exports=a,t.exports.__esModule=!0,t.exports.default=t.exports}});dt(rc());dt(ep());var Ru=dt(rc());function TE(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:(0,Ru.default)((0,Ru.default)({},e),{},{error:n})}}return{ok:!0,result:(0,Ru.default)((0,Ru.default)({},e.result),(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)})}}var Jf=class extends Error{constructor(){super("Unable to transform response from server")}};function OE(e,t){let i;try{i=TE(e,t)}catch{throw new Jf}if(!i.ok&&(!Il(i.error.error)||typeof i.error.error.code!="number"))throw new Jf;if(i.ok&&!Il(i.result))throw new Jf;return i}dt(rc());dt(rc());var Mu=dt(ep());let Ix;const em=new WeakMap,AE=()=>{};Ix=Symbol.toStringTag;var Ux=class qn{constructor(t){(0,Mu.default)(this,"promise",void 0),(0,Mu.default)(this,"subscribers",[]),(0,Mu.default)(this,"settlement",null),(0,Mu.default)(this,Ix,"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:l})=>{l(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:l})=>{l(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=ME();this.subscribers=DE(this.subscribers,a),t=a.promise,i=()=>{this.subscribers!==null&&(this.subscribers=LE(this.subscribers,a))}}else{const{status:a}=n;a==="fulfilled"?t=Promise.resolve(n.value):t=Promise.reject(n.reason),i=AE}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 em.set(t,i),em.set(i,i),i}static getSubscribablePromise(t){return em.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(RE);try{return await Promise.race(i)}finally{for(const n of i)n.unsubscribe()}}};function RE(e){return Ux.proxy(e).then(()=>[e])}function ME(){let e,t;return{promise:new Promise((n,a)=>{e=n,t=a}),resolve:e,reject:t}}function DE(e,t){return[...e,t]}function BE(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function LE(e,t){const i=e.indexOf(t);return i!==-1?BE(e,i):e}var Zb,Xb,Jb,e0;(Xb=(Zb=Symbol).dispose)!==null&&Xb!==void 0||(Zb.dispose=Symbol());(e0=(Jb=Symbol).asyncDispose)!==null&&e0!==void 0||(Jb.asyncDispose=Symbol());function zE(e,t){const i=e,n=i[Symbol.dispose];return i[Symbol.dispose]=()=>{t(),n==null||n()},i}function qE(e,t){const i=e,n=i[Symbol.asyncDispose];return i[Symbol.asyncDispose]=async()=>{await t(),await(n==null?void 0:n())},i}const Fx=Symbol();function PE(e){let t=null;return zE({start(){if(t)throw new Error("Timer already started");return new Promise(n=>{t=setTimeout(()=>n(Fx),e)})}},()=>{t&&clearTimeout(t)})}var nc=bi({"../../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,_){var m=Error();return m.name="SuppressedError",m.error=d,m.suppressed=_,m},a={},l=[];function h(d,_){if(_!=null){if(Object(_)!==_)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(d)var m=_[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(m===void 0&&(m=_[Symbol.dispose||Symbol.for("Symbol.dispose")],d))var v=m;if(typeof m!="function")throw new TypeError("Object is not disposable.");v&&(m=function(){try{v.call(_)}catch(b){return Promise.reject(b)}}),l.push({v:_,d:m,a:d})}else d&&l.push({d:_,a:d});return _}return{e:a,u:h.bind(null,!1),a:h.bind(null,!0),d:function(){var _,m=this.e,v=0;function g(){for(;_=l.pop();)try{if(!_.a&&v===1)return v=0,l.push(_),Promise.resolve().then(g);if(_.d){var S=_.d.call(_.v);if(_.a)return v|=2,Promise.resolve(S).then(g,b)}else v|=1}catch(x){return b(x)}if(v===1)return m!==a?Promise.reject(m):Promise.resolve();if(m!==a)throw m}function b(S){return m=m!==a?new n(S,m):S,g()}return g()}}}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),tp=bi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(e,t){function i(n,a){this.v=n,this.k=a}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),ac=bi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var i=tp();function n(a){return new i(a,0)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),Co=bi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var i=tp();function n(l){return function(){return new a(l.apply(this,arguments))}}function a(l){var h,d;function _(v,g){try{var b=l[v](g),S=b.value,x=S instanceof i;Promise.resolve(x?S.v:S).then(function(C){if(x){var j=v==="return"?"return":"next";if(!S.k||C.done)return _(j,C);C=l[j](C).value}m(b.done?"return":"normal",C)},function(C){_("throw",C)})}catch(C){m("throw",C)}}function m(v,g){switch(v){case"return":h.resolve({value:g,done:!0});break;case"throw":h.reject(g);break;default:h.resolve({value:g,done:!1})}(h=h.next)?_(h.key,h.arg):d=null}this._invoke=function(v,g){return new Promise(function(b,S){var x={key:v,arg:g,resolve:b,reject:S,next:null};d?d=d.next=x:(h=d=x,_(v,g))})},typeof l.return!="function"&&(this.return=void 0)}a.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},a.prototype.next=function(l){return this._invoke("next",l)},a.prototype.throw=function(l){return this._invoke("throw",l)},a.prototype.return=function(l){return this._invoke("return",l)},t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}});dt(nc());dt(ac());dt(Co());dt(nc());dt(ac());dt(Co());dt(nc());dt(ac());dt(Co());var Kx=bi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(e,t){function i(a){var l,h,d,_=2;for(typeof Symbol<"u"&&(h=Symbol.asyncIterator,d=Symbol.iterator);_--;){if(h&&(l=a[h])!=null)return l.call(a);if(d&&(l=a[d])!=null)return new n(l.call(a));h="@@asyncIterator",d="@@iterator"}throw new TypeError("Object is not async iterable")}function n(a){function l(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(_){return{value:_,done:d}})}return n=function(d){this.s=d,this.n=d.next},n.prototype={s:null,n:null,next:function(){return l(this.n.apply(this.s,arguments))},return:function(d){var _=this.s.return;return _===void 0?Promise.resolve({value:d,done:!0}):l(_.apply(this.s,arguments))},throw:function(d){var _=this.s.return;return _===void 0?Promise.reject(d):l(_.apply(this.s,arguments))}},new n(a)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}});dt(ac());dt(Co());dt(nc());dt(Kx());var HE=bi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncGeneratorDelegate.js"(e,t){var i=tp();function n(a){var l={},h=!1;function d(_,m){return h=!0,m=new Promise(function(v){v(a[_](m))}),{done:!1,value:new i(m,1)}}return l[typeof Symbol<"u"&&Symbol.iterator||"@@iterator"]=function(){return this},l.next=function(_){return h?(h=!1,_):d("next",_)},typeof a.throw=="function"&&(l.throw=function(_){if(h)throw h=!1,_;return d("throw",_)}),typeof a.return=="function"&&(l.return=function(_){return h?(h=!1,_):d("return",_)}),l}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}});dt(Kx());var t0=dt(ac()),IE=dt(Co());dt(HE());var $x=dt(nc());const UE="ping",FE="serialized-error",KE="connected",$E="return";async function WE(e){try{var t=(0,$x.default)();const i=t.u(PE(e.timeoutMs)),n=await Ux.race([e.promise,i.start()]);return n===Fx?await e.onTimeout():n}catch(i){t.e=i}finally{t.d()}}function VE(e){const{deserialize:t=d=>d}=e;let i=Dx();const n=e.signal;let a=null;const l=()=>new ReadableStream({async start(d){const[_,m]=await Promise.all([e.url(),e.init()]),v=a=new e.EventSource(_,m);d.enqueue({type:"connecting",eventSource:a,event:null}),v.addEventListener(KE,b=>{const x=JSON.parse(b.data);i=x,d.enqueue({type:"connected",options:x,eventSource:v})}),v.addEventListener(FE,b=>{const S=b;d.enqueue({type:"serialized-error",error:t(JSON.parse(S.data)),eventSource:v})}),v.addEventListener(UE,()=>{d.enqueue({type:"ping",eventSource:v})}),v.addEventListener($E,()=>{v.close(),d.close(),a=null}),v.addEventListener("error",b=>{v.readyState===v.CLOSED?d.error(b):d.enqueue({type:"connecting",eventSource:v,event:b})}),v.addEventListener("message",b=>{const S=b,C={data:t(JSON.parse(S.data))};S.lastEventId&&(C.id=S.lastEventId),d.enqueue({type:"data",data:C,eventSource:v})});const g=()=>{try{v.close(),d.close()}catch{}};n.aborted?g():n.addEventListener("abort",g)},cancel(){a==null||a.close()}}),h=()=>{let d=l(),_=d.getReader();async function m(){await _.cancel(),a=null}return qE({read(){return _.read()},async recreate(){await m(),d=l(),_=d.getReader()}},m)};return Bx((0,IE.default)(function*(){try{var d=(0,$x.default)();const _=d.a(h());for(;;){let m=_.read();const v=i.reconnectAfterInactivityMs;v&&(m=WE({promise:m,timeoutMs:v,onTimeout:async()=>{const b={value:{type:"timeout",ms:v,eventSource:a},done:!1};return await _.recreate(),b}}));const g=yield(0,t0.default)(m);if(g.done)return g.value;yield g.value}}catch(_){d.e=_}finally{yield(0,t0.default)(d.d())}}))}dt(Co());dt(rc());var Du=Ot(ua(),1),Za=Ot(yi(),1);function YE(e){return e instanceof un}function GE(e){return Il(e)&&Il(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function QE(e,t){return typeof e=="string"?e:Il(e)&&typeof e.message=="string"?e.message:t}var un=class Yu extends Error{constructor(t,i){var n,a;const l=i==null?void 0:i.cause;super(t,{cause:l}),(0,Du.default)(this,"cause",void 0),(0,Du.default)(this,"shape",void 0),(0,Du.default)(this,"data",void 0),(0,Du.default)(this,"meta",void 0),this.meta=i==null?void 0:i.meta,this.cause=l,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,Yu.prototype)}static from(t,i={}){const n=t;return YE(n)?(i.meta&&(n.meta=(0,Za.default)((0,Za.default)({},n.meta),i.meta)),n):GE(n)?new Yu(n.error.message,(0,Za.default)((0,Za.default)({},i),{},{result:n,cause:i.cause})):new Yu(QE(n,"Unknown error"),(0,Za.default)((0,Za.default)({},i),{},{cause:n}))}};function Wx(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 s0=e=>typeof e=="function";function ZE(e){if(e)return e;if(typeof window<"u"&&s0(window.fetch))return window.fetch;if(typeof globalThis<"u"&&s0(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var zl=Ot(yi());function XE(e){return{url:e.url.toString(),fetch:e.fetch,transformer:Wx(e.transformer),methodOverride:e.methodOverride}}function JE(e){const t={};for(let i=0;i<e.length;i++){const n=e[i];t[i]=n}return t}const e2={query:"GET",mutation:"POST",subscription:"PATCH"};function Vx(e){return"input"in e?e.transformer.input.serialize(e.input):JE(e.inputs.map(t=>e.transformer.input.serialize(t)))}const sp=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 l=Vx(e);l!==void 0&&e.methodOverride!=="POST"&&a.push(`input=${encodeURIComponent(JSON.stringify(l))}`)}return a.length&&(n+="?"+a.join("&")),n},t2=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=Vx(e);return t!==void 0?JSON.stringify(t):void 0},s2=e=>a2((0,zl.default)((0,zl.default)({},e),{},{contentTypeHeader:"application/json",getUrl:sp,getBody:t2}));var i2=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const r2=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 i2};async function n2(e){var t,i;r2(e.signal);const n=e.getUrl(e),a=e.getBody(e),l=(t=e.methodOverride)!==null&&t!==void 0?t:e2[e.type],h=await(async()=>{const _=await e.headers();return Symbol.iterator in _?Object.fromEntries(_):_})(),d=(0,zl.default)((0,zl.default)((0,zl.default)({},e.contentTypeHeader&&l!=="GET"?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{[(i=e.trpcAcceptHeaderKey)!==null&&i!==void 0?i:"trpc-accept"]:e.trpcAcceptHeader}:void 0),h);return ZE(e.fetch)(n,{method:l,signal:e.signal,body:a,headers:d})}async function a2(e){const t={},i=await n2(e);t.response=i;const n=await i.json();return t.responseJSON=n,{json:n,meta:t}}Ot(yi(),1);const i0=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function r0(e){let t=null,i=null;const n=()=>{clearTimeout(i),i=null,t=null};function a(d){const _=[[]];let m=0;for(;;){const b=d[m];if(!b)break;const S=_[_.length-1];if(b.aborted){var v;(v=b.reject)===null||v===void 0||v.call(b,new Error("Aborted")),m++;continue}if(e.validate(S.concat(b).map(C=>C.key))){S.push(b),m++;continue}if(S.length===0){var g;(g=b.reject)===null||g===void 0||g.call(b,new Error("Input is too big for a single dispatch")),m++;continue}_.push([])}return _}function l(){const d=a(t);n();for(const _ of d){if(!_.length)continue;const m={items:_};for(const g of _)g.batch=m;e.fetch(m.items.map(g=>g.key)).then(async g=>{await Promise.all(g.map(async(S,x)=>{const C=m.items[x];try{var j;const z=await Promise.resolve(S);(j=C.resolve)===null||j===void 0||j.call(C,z)}catch(z){var N;(N=C.reject)===null||N===void 0||N.call(C,z)}C.batch=null,C.reject=null,C.resolve=null}));for(const S of m.items){var b;(b=S.reject)===null||b===void 0||b.call(S,new Error("Missing result")),S.batch=null}}).catch(g=>{for(const S of m.items){var b;(b=S.reject)===null||b===void 0||b.call(S,g),S.batch=null}})}}function h(d){var _;const m={aborted:!1,key:d,batch:null,resolve:i0,reject:i0},v=new Promise((g,b)=>{var S;m.reject=b,m.resolve=g,(S=t)!==null&&S!==void 0||(t=[]),t.push(m)});return(_=i)!==null&&_!==void 0||(i=setTimeout(l)),v}return{load:h}}function o2(...e){const t=new AbortController,i=e.length;let n=0;const a=()=>{++n===i&&t.abort()};for(const l of e)l!=null&&l.aborted?a():l==null||l.addEventListener("abort",a,{once:!0});return t.signal}function l2(...e){const t=new AbortController;for(const i of e)i!=null&&i.aborted?t.abort():i==null||i.addEventListener("abort",()=>t.abort(),{once:!0});return t.signal}var Bu=Ot(yi(),1);function c2(e){var t,i;const n=XE(e),a=(t=e.maxURLLength)!==null&&t!==void 0?t:1/0,l=(i=e.maxItems)!==null&&i!==void 0?i:1/0;return()=>{const h=v=>({validate(g){if(a===1/0&&l===1/0)return!0;if(g.length>l)return!1;const b=g.map(C=>C.path).join(","),S=g.map(C=>C.input);return sp((0,Bu.default)((0,Bu.default)({},n),{},{type:v,path:b,inputs:S,signal:null})).length<=a},async fetch(g){const b=g.map(z=>z.path).join(","),S=g.map(z=>z.input),x=o2(...g.map(z=>z.signal)),C=await s2((0,Bu.default)((0,Bu.default)({},n),{},{path:b,inputs:S,type:v,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:g}):e.headers:{}},signal:x}));return(Array.isArray(C.json)?C.json:g.map(()=>C.json)).map(z=>({meta:C.meta,json:z}))}}),d=r0(h("query")),_=r0(h("mutation")),m={query:d,mutation:_};return({op:v})=>wo(g=>{/* istanbul ignore if -- @preserve */if(v.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const S=m[v.type].load(v);let x;return S.then(C=>{x=C;const j=OE(C.json,n.transformer.output);if(!j.ok){g.error(un.from(j.error,{meta:C.meta}));return}g.next({context:C.meta,result:j.result}),g.complete()}).catch(C=>{g.error(un.from(C,{meta:x==null?void 0:x.meta}))}),()=>{}})}}Ot(yi(),1);const Ul=(e,...t)=>typeof e=="function"?e(...t):e;Ot(ua(),1);function u2(){let e,t;return{promise:new Promise((n,a)=>{e=n,t=a}),resolve:e,reject:t}}async function h2(e){const t=await Ul(e.url);if(!e.connectionParams)return t;const n=`${t.includes("?")?"&":"?"}connectionParams=1`;return t+n}async function d2(e,t){const i={method:"connectionParams",data:await Ul(e)};return t.encode(i)}Ot(ua(),1);var Gr=Ot(ua(),1);function f2(e){const{promise:t,resolve:i,reject:n}=u2();return e.addEventListener("open",()=>{e.removeEventListener("error",n),i()}),e.addEventListener("error",n),t}function m2(e,{intervalMs:t,pongTimeoutMs:i}){let n,a;function l(){n=setTimeout(()=>{e.send("PING"),a=setTimeout(()=>{e.close()},i)},t)}function h(){clearTimeout(n),l()}function d(){clearTimeout(a),h()}e.addEventListener("open",l),e.addEventListener("message",({data:_})=>{clearTimeout(n),l(),_==="PONG"&&d()}),e.addEventListener("close",()=>{clearTimeout(n),clearTimeout(a)})}var _2=class $m{constructor(t){var i;if((0,Gr.default)(this,"id",++$m.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",Rx(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=++$m.connectCount;const i=h2(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&&m2(n,t.keepAliveOpts),n.addEventListener("close",()=>{t.ws===n&&(t.ws=null)}),await f2(n),t.urlOptions.connectionParams&&n.send(await d2(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)(_2,"connectCount",0);Ot(ua(),1);Ot(yi(),1);var tm=Ot(ua(),1),n0=Ot(yi(),1),p2=class{constructor(e){(0,tm.default)(this,"links",void 0),(0,tm.default)(this,"runtime",void 0),(0,tm.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(t=>t(this.runtime))}$request(e){var t;return Mx({links:this.links,op:(0,n0.default)((0,n0.default)({},e),{},{context:(t=e.context)!==null&&t!==void 0?t:{},id:++this.requestId})}).pipe(vE())}async requestAsPromise(e){var t=this;try{const i=t.$request(e);return(await pE(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 l;(l=i.onConnectionStateChange)===null||l===void 0||l.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 _;(_=i.onData)===null||_===void 0||_.call(i,a.result.data);break}}},error(a){var l;(l=i.onError)===null||l===void 0||l.call(i,a)},complete(){var a;(a=i.onComplete)===null||a===void 0||a.call(i)}})}};const v2=Symbol.for("trpc_untypedClient"),g2={query:"query",mutate:"mutation",subscribe:"subscription"},y2=e=>g2[e];function b2(e){const t=jE(({path:i,args:n})=>{const a=[...i],l=y2(a.pop()),h=a.join(".");return e[l](h,...n)});return kE(i=>i===v2?e:t[i])}function S2(e){const t=new p2(e);return b2(t)}Ot(yi(),1);var a0=Ot(yi(),1);function x2(e,t){return!t||e!=null&&typeof e!="object"?e:(0,a0.default)((0,a0.default)({},e??{}),{},{lastEventId:t})}var w2=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 l,h,d,_=2;for(typeof Symbol<"u"&&(h=Symbol.asyncIterator,d=Symbol.iterator);_--;){if(h&&(l=a[h])!=null)return l.call(a);if(d&&(l=a[d])!=null)return new n(l.call(a));h="@@asyncIterator",d="@@iterator"}throw new TypeError("Object is not async iterable")}function n(a){function l(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(_){return{value:_,done:d}})}return n=function(d){this.s=d,this.n=d.next},n.prototype={s:null,n:null,next:function(){return l(this.n.apply(this.s,arguments))},return:function(d){var _=this.s.return;return _===void 0?Promise.resolve({value:d,done:!0}):l(_.apply(this.s,arguments))},throw:function(d){var _=this.s.return;return _===void 0?Promise.reject(d):l(_.apply(this.s,arguments))}},new n(a)}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),C2=Ot(w2(),1);async function j2(e){let t=await Ul(e.url);if(e.connectionParams){const i=await Ul(e.connectionParams),n=t.includes("?")?"&":"?";t+=n+"connectionParams="+encodeURIComponent(JSON.stringify(i))}return t}function k2(e){const t=Wx(e.transformer);return()=>({op:i})=>wo(n=>{var a;const{type:l,path:h,input:d}=i;/* istanbul ignore if -- @preserve */if(l!=="subscription")throw new Error("httpSubscriptionLink only supports subscriptions");let _;const m=new AbortController,v=l2(i.signal,m.signal),g=VE({url:async()=>sp({transformer:t,url:await j2(e),input:x2(d,_),path:h,type:l,signal:null}),init:()=>Ul(e.eventSourceOptions,{op:i}),signal:v,deserialize:x=>t.output.deserialize(x),EventSource:(a=e.EventSource)!==null&&a!==void 0?a:globalThis.EventSource}),b=Rx({type:"state",state:"connecting",error:null}),S=b.subscribe({next(x){n.next({result:x})}});return Bx(async()=>{var x=!1,C=!1,j;try{for(var N=(0,C2.default)(g),z;x=!(z=await N.next()).done;x=!1){const B=z.value;switch(B.type){case"ping":break;case"data":const M=B.data;let V;M.id?(_=M.id,V={id:M.id,data:M}):V={data:M.data},n.next({result:V,context:{eventSource:B.eventSource}});break;case"connected":{n.next({result:{type:"started"},context:{eventSource:B.eventSource}}),b.next({type:"state",state:"pending",error:null});break}case"serialized-error":{const ee=un.from({error:B.error});if(yE.includes(B.error.code)){b.next({type:"state",state:"connecting",error:ee});break}throw ee}case"connecting":{const ee=b.get(),q=B.event&&un.from(B.event);if(!q&&ee.state==="connecting")break;b.next({type:"state",state:"connecting",error:q});break}case"timeout":b.next({type:"state",state:"connecting",error:new un(`Timeout of ${B.ms}ms reached while waiting for a response`)})}}}catch(B){C=!0,j=B}finally{try{x&&N.return!=null&&await N.return()}finally{if(C)throw j}}n.next({result:{type:"stopped"}}),b.next({type:"state",state:"idle",error:null}),n.complete()}).catch(x=>{n.error(un.from(x))}),()=>{n.complete(),m.abort(),S.unsubscribe()}})}Ot(yi(),1);var E2=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,_){var m=Error();return m.name="SuppressedError",m.error=d,m.suppressed=_,m},a={},l=[];function h(d,_){if(_!=null){if(Object(_)!==_)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(d)var m=_[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(m===void 0&&(m=_[Symbol.dispose||Symbol.for("Symbol.dispose")],d))var v=m;if(typeof m!="function")throw new TypeError("Object is not disposable.");v&&(m=function(){try{v.call(_)}catch(b){return Promise.reject(b)}}),l.push({v:_,d:m,a:d})}else d&&l.push({d:_,a:d});return _}return{e:a,u:h.bind(null,!1),a:h.bind(null,!0),d:function(){var _,m=this.e,v=0;function g(){for(;_=l.pop();)try{if(!_.a&&v===1)return v=0,l.push(_),Promise.resolve().then(g);if(_.d){var S=_.d.call(_.v);if(_.a)return v|=2,Promise.resolve(S).then(g,b)}else v|=1}catch(x){return b(x)}if(v===1)return m!==a?Promise.reject(m):Promise.resolve();if(m!==a)throw m}function b(S){return m=m!==a?new n(S,m):S,g()}return g()}}}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports}}),Yx=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}}),N2=Ii({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var i=Yx();function n(a){return new i(a,0)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),T2=Ii({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var i=Yx();function n(l){return function(){return new a(l.apply(this,arguments))}}function a(l){var h,d;function _(v,g){try{var b=l[v](g),S=b.value,x=S instanceof i;Promise.resolve(x?S.v:S).then(function(C){if(x){var j=v==="return"?"return":"next";if(!S.k||C.done)return _(j,C);C=l[j](C).value}m(b.done?"return":"normal",C)},function(C){_("throw",C)})}catch(C){m("throw",C)}}function m(v,g){switch(v){case"return":h.resolve({value:g,done:!0});break;case"throw":h.reject(g);break;default:h.resolve({value:g,done:!1})}(h=h.next)?_(h.key,h.arg):d=null}this._invoke=function(v,g){return new Promise(function(b,S){var x={key:v,arg:g,resolve:b,reject:S,next:null};d?d=d.next=x:(h=d=x,_(v,g))})},typeof l.return!="function"&&(this.return=void 0)}a.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},a.prototype.next=function(l){return this._invoke("next",l)},a.prototype.throw=function(l){return this._invoke("throw",l)},a.prototype.return=function(l){return this._invoke("return",l)},t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}});Ot(E2(),1);Ot(N2(),1);Ot(T2(),1);Ot(yi(),1);const ie=S2({links:[gE({condition:e=>e.type==="subscription",true:k2({url:"/trpc"}),false:c2({url:"/trpc"})})]}),O2={connecting:"conectando",counting:"contando objetos",compressing:"comprimindo",receiving:"recebendo objetos",resolving:"resolvendo deltas",checkout:"preparando arquivos"},A2=new Set(["done","failed","cancelled"]);function bh(e){return A2.has(e)}function Gx(e){const t=Ae({queryKey:yh(e),queryFn:()=>ie.project.cloneJobs.query({workspaceId:e})});return R2(t.data??[])}function R2(e){const t=e.find(i=>!bh(i.state));return t!==void 0?t:e.reduce((i,n)=>i===null||n.updatedAt>i.updatedAt?n:i,null)}function M2(e){const t=Ye(),i=Gx(e),n=i!==null&&!bh(i.state)?i.id:null;return k.useEffect(()=>{if(n===null)return;const a=ie.project.cloneProgress.subscribe({jobId:n},{onData:l=>{const h=l;t.setQueryData(yh(e),d=>[...(d??[]).filter(m=>m.id!==h.id),h])}});return()=>a.unsubscribe()},[n,e,t]),i}const D2={info:"◆",warning:"⚠",danger:"⚠"};function Re({tone:e,children:t,actions:i}){return c.jsxs("div",{className:`banner banner--${e}`,role:e==="danger"?"alert":"status",children:[c.jsx("span",{className:"banner__glyph","aria-hidden":"true",children:D2[e]}),c.jsx("span",{children:t}),i!==void 0&&c.jsx("span",{className:"banner__actions",children:i})]})}function pe({variant:e="default",size:t="md",glyph:i,className:n,children:a,type:l="button",...h}){const d=["btn",e==="default"?"":`btn--${e}`,t==="sm"?"btn--sm":"",n??""].filter(Boolean).join(" ");return c.jsxs("button",{type:l,className:d,...h,children:[i,a]})}function Sh({title:e,lede:t,children:i}){return c.jsxs("div",{className:"card",children:[e!==void 0&&c.jsx("h2",{className:"card__title",children:e}),t!==void 0&&c.jsx("p",{className:"card__lede",children:t}),i]})}const B2={ok:"✓",warn:"⚠",fail:"✕",running:"◐"};function Vs({state:e,what:t,value:i,status:n,action:a}){return c.jsxs("div",{className:`ck ck--${e}`,children:[c.jsx("span",{className:"ck__glyph","aria-hidden":"true",children:B2[e]}),c.jsx("span",{className:"ck__what",children:t}),c.jsx("span",{className:"ck__val",children:i}),c.jsx("span",{className:"ck__st",children:n}),a!==void 0&&c.jsx("span",{className:"ck__act",children:a})]})}function Fl({label:e,children:t}){return c.jsx("div",{className:"check",role:"group","aria-label":e,children:t})}function Ft({tone:e="neutral",dot:t=!1,children:i}){const n=e==="neutral"?"":` chip--${e}`;return c.jsxs("span",{className:`chip${n}`,children:[t&&c.jsx("span",{className:"chip__dot","aria-hidden":"true"}),i]})}function o0({title:e,description:t,meta:i,glyph:n,selected:a,onSelect:l,disabled:h=!1}){return c.jsxs("button",{type:"button",role:"radio","aria-checked":a,className:`choice${a?" is-on":""}`,disabled:h,onClick:l,children:[c.jsxs("span",{className:"choice__top",children:[n,c.jsx("span",{className:"choice__t",children:e}),c.jsx("span",{className:"choice__mark","aria-hidden":"true",children:a?"◉":"○"})]}),t!==void 0&&c.jsx("span",{className:"choice__d",children:t}),i!==void 0&&c.jsx("span",{className:"choice__meta",children:i})]})}function L2({label:e,columns:t=2,children:i}){return c.jsx("div",{className:`choices${t===2?" choices--2":""}`,role:"radiogroup","aria-label":e,children:i})}function z2({title:e,children:t,onUnderstood:i,onNever:n}){return c.jsxs("div",{className:"coach",role:"note",children:[c.jsxs("span",{className:"coach__t",children:[c.jsx("span",{"aria-hidden":"true",children:"◆"}),e]}),c.jsx("span",{className:"coach__b",children:t}),c.jsxs("span",{className:"coach__acts",children:[c.jsx(pe,{size:"sm",variant:"primary",onClick:i,children:"entendi"}),n!==void 0&&c.jsx(pe,{size:"sm",variant:"ghost",onClick:n,children:"não mostrar de novo"})]})]})}function Qx({command:e}){const[t,i]=k.useState(!1);k.useEffect(()=>i(!1),[e]),k.useEffect(()=>{if(!t)return;const a=setTimeout(()=>i(!1),1500);return()=>clearTimeout(a)},[t]);const n=navigator.clipboard;return c.jsxs("div",{className:"copy",children:[c.jsx("code",{className:"copy__cmd",children:e}),n!==void 0&&c.jsx(pe,{size:"sm",variant:"ghost",onClick:()=>{n.writeText(e).then(()=>i(!0),()=>i(!1))},children:t?"copiado":"copiar"})]})}function vs({title:e,children:t,action:i}){return c.jsxs("div",{className:"empty",children:[c.jsx("span",{className:"empty__title",children:e}),t!==void 0&&c.jsx("span",{children:t}),i]})}function gi({widths:e=["70%","40%","100%","70%"],label:t="carregando"}){return c.jsx("div",{role:"status","aria-label":t,children:e.map((i,n)=>c.jsx("div",{className:"skeleton",style:{width:i}},n))})}function as({id:e,label:t,error:i,children:n}){return c.jsxs("div",{className:"field",children:[c.jsx("label",{className:"field__label",htmlFor:e,children:t}),n,i!==void 0&&c.jsx("span",{className:"field__error",id:`${e}-error`,role:"alert",children:i})]})}function ps({invalid:e=!1,className:t,id:i,...n}){const a=["input",e?"input--error":"",t??""].filter(Boolean).join(" ");return c.jsx("input",{id:i,className:a,"aria-invalid":e||void 0,"aria-describedby":e&&i!==void 0?`${i}-error`:void 0,...n})}function at({tone:e="none",children:t}){const i=e==="none"?"":` glyph--${e}`;return c.jsx("span",{className:`glyph${i}`,"aria-hidden":"true",children:t})}function Zx({name:e,glyph:t,detail:i,state:n,age:a,onSelect:l,action:h}){const d=c.jsxs(c.Fragment,{children:[t,c.jsx("span",{className:"item__name",children:e}),i!==void 0&&c.jsx("span",{className:"item__detail",title:i,children:i}),n!==void 0&&c.jsx("span",{className:`item__state state--${n.tone}`,children:n.label}),a!==void 0&&c.jsx("span",{className:"item__age",children:a})]});return c.jsxs("div",{className:"item",children:[l===void 0?c.jsx("span",{className:"item__main",children:d}):c.jsx("button",{type:"button",className:"item__main",onClick:l,children:d}),h!==void 0&&c.jsx("span",{className:"item__act",children:h})]})}function ip({label:e,children:t}){return c.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 c.jsxs("button",{type:"button",role:"menuitem",className:"menu__item",disabled:a,onClick:t,children:[i,e,n!==void 0&&c.jsx("span",{className:"menu__hint",children:n})]})}function ha({entries:e,variant:t="meta"}){return t==="recap"?c.jsx("dl",{className:"recap",children:e.map(i=>c.jsxs("div",{className:"recap__r",children:[c.jsx("dt",{className:"recap__k",children:i.label}),c.jsx("dd",{className:"recap__v",title:i.title,children:i.value})]},i.label))}):c.jsx("dl",{className:"meta",children:e.map(i=>c.jsxs(k.Fragment,{children:[c.jsx("dt",{children:i.label}),c.jsx("dd",{title:i.title,children:i.value})]},i.label))})}function rp({depth:e,label:t,onSelect:i,selected:n=!1,muted:a=!1,emphasis:l=!1,expanded:h,onToggle:d,glyph:_,meta:m,count:v,countTone:g="running"}){const b=["row",n?"row--selected":"",a?"row--muted":"",l?"row--emphasis":""].filter(Boolean).join(" "),S=h!==void 0&&d!==void 0;return c.jsxs("div",{className:b,style:{"--depth":e},children:[S?c.jsx("button",{type:"button",className:"row__twist","aria-expanded":h,"aria-label":`${h?"recolher":"expandir"} ${t}`,onClick:d,children:c.jsx("span",{"aria-hidden":"true",children:h?"▾":"▸"})}):c.jsx("span",{className:"row__twist row__twist--empty","aria-hidden":"true"}),c.jsxs("button",{type:"button",className:"row__main","aria-current":n,onClick:i,children:[_,c.jsx("span",{className:"row__label",children:t}),m!==void 0&&c.jsx("span",{className:"row__meta",children:m}),v!==void 0&&v>0&&c.jsxs("span",{className:`row__count row__count--${g}`,children:[c.jsx("span",{className:"row__count__dot","aria-hidden":"true"}),v,c.jsx("span",{className:"sr-only",children:g==="asking"?v===1?" sessão esperando permissão":" sessões esperando permissão":v===1?" sessão rodando":" sessões rodando"})]})]})]})}function xh({title:e,count:t,aside:i}){return c.jsxs("div",{className:"section-head",children:[c.jsx("span",{className:"section-head__title",children:e}),t!==void 0&&c.jsx("span",{className:"section-head__count",children:t}),i!==void 0&&c.jsx("span",{className:"section-head__aside",children:i})]})}function q2({steps:e,current:t}){return c.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 c.jsxs(k.Fragment,{children:[c.jsxs("span",{className:`steps__i${a}`,children:[c.jsx("span",{className:"steps__n",children:n<t?"✓":n+1}),c.jsx("span",{className:"steps__l",children:i})]}),n<e.length-1&&c.jsx("span",{className:"steps__bar"})]},i)})})}function l0({label:e,onSelect:t,glyph:i,ordinal:n,active:a=!1,state:l,note:h,onClose:d}){return c.jsxs("div",{className:`tab-item${a?" tab-item--active":""}`,children:[c.jsxs("button",{type:"button",role:"tab","aria-selected":a,className:"tab-item__main",onClick:t,children:[i,c.jsx("span",{className:"tab-item__label",children:e}),n!==void 0&&c.jsx("span",{className:"tab-item__ord",children:n}),h!==void 0&&c.jsx("span",{className:"tab-item__note",children:h}),l!==void 0&&c.jsx("span",{className:`tab-item__dot tab-item__dot--${l}`})]}),d!==void 0&&c.jsx("button",{type:"button",className:"tab-item__close","aria-label":`fechar ${e}`,onClick:d,children:c.jsx("span",{"aria-hidden":"true",children:"✕"})})]})}function P2({label:e,lead:t,children:i,action:n}){return c.jsxs("div",{className:"tabs-bar",role:"tablist","aria-label":e,children:[t!==void 0&&c.jsxs(c.Fragment,{children:[t,c.jsx("span",{className:"tabs-bar__sep","aria-hidden":"true"})]}),c.jsx("div",{className:"tabs-bar__scroll",children:i}),n!==void 0&&c.jsx("span",{className:"tabs-bar__action",children:n})]})}function H2({eyebrow:e,title:t,lede:i,narrow:n=!1,children:a,footer:l}){return c.jsxs("div",{className:`wizard__card${n?" wizard__card--narrow":""}`,children:[c.jsxs("div",{className:"wizard__head",children:[e!==void 0&&c.jsx("span",{className:"wizard__eyebrow",children:e}),c.jsx("h2",{className:"wizard__title",children:t}),i!==void 0&&c.jsx("p",{className:"wizard__lede",children:i})]}),a,l!==void 0&&c.jsx("div",{className:"wizard__foot",children:l})]})}function ta({title:e,children:t}){return c.jsxs("section",{className:"wizard__sec",children:[c.jsx("span",{className:"wizard__sec-t",children:e}),t]})}const I2=250;function U2({workspaceId:e,onAdded:t,prefill:i=null,onPrefillConsumed:n}){const a=Ye(),[l,h]=k.useState(!1),[d,_]=k.useState(""),[m,v]=k.useState(""),g=Gx(e),b=g!==null&&!bh(g.state)?g:null,S=K2(e,d,m);k.useEffect(()=>{i!==null&&(_(i),v(""),h(!0),n==null||n())},[i,n]);const x=Ve({mutationFn:()=>ie.project.add.mutate({workspaceId:e,path:(S==null?void 0:S.kind)==="path"?S.path:d.trim(),...m.trim()===""?{}:{name:m.trim()}}),onSuccess:async te=>{await a.invalidateQueries({queryKey:ca(e)}),t(te.id),j()}}),C=Ve({mutationFn:()=>ie.project.clone.mutate({workspaceId:e,source:d.trim(),...m.trim()===""?{}:{name:m.trim()}}),onSuccess:async()=>{await a.invalidateQueries({queryKey:yh(e)}),j()}});function j(){h(!1),_(""),v(""),x.reset(),C.reset()}const N=(S==null?void 0:S.kind)==="url",z=(S==null?void 0:S.kind)==="refused",B=d.trim().startsWith("/")||d.trim().startsWith("~"),M=S===null&&!B&&d.trim()!=="",V=x.isPending||C.isPending,ee=x.isError?x.error.message:C.isError?C.error.message:void 0,q=te=>{te.preventDefault(),!(d.trim()===""||z||M)&&(N?C.mutate():x.mutate())};return l?c.jsx("form",{className:"add-project",onSubmit:q,children:c.jsxs(Sh,{children:[c.jsx(as,{id:"project-source",label:"Caminho ou URL",error:ee,children:c.jsx(ps,{id:"project-source",value:d,onChange:te=>_(te.target.value),placeholder:"git@gitlab.interno:time/api.git",invalid:z||x.isError||C.isError,autoFocus:!0})}),S!==null&&c.jsx(F2,{plan:S}),c.jsx(as,{id:"project-name",label:"Nome",children:c.jsx(ps,{id:"project-name",value:m,onChange:te=>v(te.target.value),placeholder:N?S.name??"o nome do repositório":"o nome da pasta"})}),N&&c.jsxs("p",{className:"add-project__answer",children:[c.jsx("span",{className:"add-project__answer-label",children:"Vai em"}),c.jsx("span",{className:"add-project__answer-path",children:S.targetPath})]}),c.jsxs("div",{className:"add-project__actions",children:[c.jsx(pe,{type:"submit",variant:"primary",disabled:V||d.trim()===""||z||M||N&&b!==null,children:C.isPending?"clonando…":x.isPending?"validando…":N?"clonar":"adicionar"}),c.jsx(pe,{variant:"ghost",onClick:j,children:"cancelar"})]}),N&&b!==null&&c.jsxs("p",{className:"add-project__blocked",role:"status",children:[b.name," ainda está sendo clonado"]})]})}):c.jsxs("button",{type:"button",className:"sidebar__add",onClick:()=>h(!0),children:[c.jsx(at,{children:"+"}),"adicionar projeto"]})}function F2({plan:e}){return e.kind==="refused"?c.jsxs("p",{className:"echo echo--refused",role:"status",children:[c.jsx("span",{className:"echo__arrow","aria-hidden":"true",children:"↳"}),e.message]}):e.kind==="path"?c.jsxs("p",{className:"echo",children:[c.jsx("span",{className:"echo__arrow","aria-hidden":"true",children:"↳"}),"registrar o repositório em ",c.jsx("strong",{children:e.path})]}):c.jsxs("p",{className:"echo",children:[c.jsx("span",{className:"echo__arrow","aria-hidden":"true",children:"↳"}),"clonar via ",e.scheme,e.insecure===!0&&c.jsx(Ft,{tone:"insecure",children:"sem TLS"})]})}function K2(e,t,i){const[n,a]=k.useState("");return k.useEffect(()=>{const h=setTimeout(()=>a(t.trim()),I2);return()=>clearTimeout(h)},[t]),Ae({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 Xe;(function(e){e.assertEqual=a=>{};function t(a){}e.assertIs=t;function i(a){throw new Error}e.assertNever=i,e.arrayToEnum=a=>{const l={};for(const h of a)l[h]=h;return l},e.getValidEnumValues=a=>{const l=e.objectKeys(a).filter(d=>typeof a[a[d]]!="number"),h={};for(const d of l)h[d]=a[d];return e.objectValues(h)},e.objectValues=a=>e.objectKeys(a).map(function(l){return a[l]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const l=[];for(const h in a)Object.prototype.hasOwnProperty.call(a,h)&&l.push(h);return l},e.find=(a,l)=>{for(const h of a)if(l(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,l=" | "){return a.map(h=>typeof h=="string"?`'${h}'`:h).join(l)}e.joinValues=n,e.jsonStringifyReplacer=(a,l)=>typeof l=="bigint"?l.toString():l})(Xe||(Xe={}));var c0;(function(e){e.mergeShapes=(t,i)=>({...t,...i})})(c0||(c0={}));const ve=Xe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Qr=e=>{switch(typeof e){case"undefined":return ve.undefined;case"string":return ve.string;case"number":return Number.isNaN(e)?ve.nan:ve.number;case"boolean":return ve.boolean;case"function":return ve.function;case"bigint":return ve.bigint;case"symbol":return ve.symbol;case"object":return Array.isArray(e)?ve.array:e===null?ve.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ve.promise:typeof Map<"u"&&e instanceof Map?ve.map:typeof Set<"u"&&e instanceof Set?ve.set:typeof Date<"u"&&e instanceof Date?ve.date:ve.object;default:return ve.unknown}},re=Xe.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 vr 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(l){return l.message},n={_errors:[]},a=l=>{for(const h of l.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,_=0;for(;_<h.path.length;){const m=h.path[_];_===h.path.length-1?(d[m]=d[m]||{_errors:[]},d[m]._errors.push(i(h))):d[m]=d[m]||{_errors:[]},d=d[m],_++}}};return a(this),n}static assert(t){if(!(t instanceof vr))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Xe.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 l=a.path[0];i[l]=i[l]||[],i[l].push(t(a))}else n.push(t(a));return{formErrors:n,fieldErrors:i}}get formErrors(){return this.flatten()}}vr.create=e=>new vr(e);const Wm=(e,t)=>{let i;switch(e.code){case re.invalid_type:e.received===ve.undefined?i="Required":i=`Expected ${e.expected}, received ${e.received}`;break;case re.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(e.expected,Xe.jsonStringifyReplacer)}`;break;case re.unrecognized_keys:i=`Unrecognized key(s) in object: ${Xe.joinValues(e.keys,", ")}`;break;case re.invalid_union:i="Invalid input";break;case re.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${Xe.joinValues(e.options)}`;break;case re.invalid_enum_value:i=`Invalid enum value. Expected ${Xe.joinValues(e.options)}, received '${e.received}'`;break;case re.invalid_arguments:i="Invalid function arguments";break;case re.invalid_return_type:i="Invalid function return type";break;case re.invalid_date:i="Invalid date";break;case re.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}"`:Xe.assertNever(e.validation):e.validation!=="regex"?i=`Invalid ${e.validation}`:i="Invalid";break;case re.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 re.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 re.custom:i="Invalid input";break;case re.invalid_intersection_types:i="Intersection results could not be merged";break;case re.not_multiple_of:i=`Number must be a multiple of ${e.multipleOf}`;break;case re.not_finite:i="Number must be finite";break;default:i=t.defaultError,Xe.assertNever(e)}return{message:i}};let $2=Wm;function W2(){return $2}const V2=e=>{const{data:t,path:i,errorMaps:n,issueData:a}=e,l=[...i,...a.path||[]],h={...a,path:l};if(a.message!==void 0)return{...a,path:l,message:a.message};let d="";const _=n.filter(m=>!!m).slice().reverse();for(const m of _)d=m(h,{data:t,defaultError:d}).message;return{...a,path:l,message:d}};function ce(e,t){const i=W2(),n=V2({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,i,i===Wm?void 0:Wm].filter(a=>!!a)});e.common.issues.push(n)}class Ys{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 Ne;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 l=await a.key,h=await a.value;n.push({key:l,value:h})}return Ys.mergeObjectSync(t,n)}static mergeObjectSync(t,i){const n={};for(const a of i){const{key:l,value:h}=a;if(l.status==="aborted"||h.status==="aborted")return Ne;l.status==="dirty"&&t.dirty(),h.status==="dirty"&&t.dirty(),l.value!=="__proto__"&&(typeof h.value<"u"||a.alwaysSet)&&(n[l.value]=h.value)}return{status:t.value,value:n}}}const Ne=Object.freeze({status:"aborted"}),Ol=e=>({status:"dirty",value:e}),hi=e=>({status:"valid",value:e}),u0=e=>e.status==="aborted",h0=e=>e.status==="dirty",yo=e=>e.status==="valid",sh=e=>typeof Promise<"u"&&e instanceof Promise;var Se;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Se||(Se={}));class pn{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 d0=(e,t)=>{if(yo(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 vr(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:_}=e;return h.code==="invalid_enum_value"?{message:_??d.defaultError}:typeof d.data>"u"?{message:_??n??d.defaultError}:h.code!=="invalid_type"?{message:d.defaultError}:{message:_??i??d.defaultError}},description:a}}class Ge{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 Ys,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(sh(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 d0(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 l=this._parseSync({data:t,path:[],parent:i});return yo(l)?{value:l.value}:{issues:i.common.issues}}catch(l){(a=(n=l==null?void 0:l.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(l=>yo(l)?{value:l.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}),l=await(sh(a)?a:Promise.resolve(a));return d0(n,l)}refine(t,i){const n=a=>typeof i=="string"||typeof i>"u"?{message:i}:typeof i=="function"?i(a):i;return this._refinement((a,l)=>{const h=t(a),d=()=>l.addIssue({code:re.custom,...n(a)});return typeof Promise<"u"&&h instanceof Promise?h.then(_=>_?!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 ra({schema:this,typeName:Te.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 _r.create(this,this._def)}nullable(){return na.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return zi.create(this)}promise(){return oh.create(this,this._def)}or(t){return rh.create([this,t],this._def)}and(t){return nh.create(this,t,this._def)}transform(t){return new ra({...Pe(this._def),schema:this,typeName:Te.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const i=typeof t=="function"?t:()=>t;return new lh({...Pe(this._def),innerType:this,defaultValue:i,typeName:Te.ZodDefault})}brand(){return new tw({typeName:Te.ZodBranded,type:this,...Pe(this._def)})}catch(t){const i=typeof t=="function"?t:()=>t;return new ch({...Pe(this._def),innerType:this,catchValue:i,typeName:Te.ZodCatch})}describe(t){const i=this.constructor;return new i({...this._def,description:t})}pipe(t){return ap.create(this,t)}readonly(){return uh.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Y2=/^c[^\s-]{8,}$/i,G2=/^[0-9a-z]+$/,Q2=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Z2=/^[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,X2=/^[a-z0-9_-]{21}$/i,J2=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,eN=/^[-+]?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)?)??$/,tN=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sN="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let sm;const iN=/^(?:(?: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])$/,rN=/^(?:(?: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])$/,nN=/^(([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]))$/,aN=/^(([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])$/,oN=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,lN=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Xx="((\\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])))",cN=new RegExp(`^${Xx}$`);function Jx(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 uN(e){return new RegExp(`^${Jx(e)}$`)}function hN(e){let t=`${Xx}T${Jx(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 dN(e,t){return!!((t==="v4"||!t)&&iN.test(e)||(t==="v6"||!t)&&nN.test(e))}function fN(e,t){if(!J2.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 mN(e,t){return!!((t==="v4"||!t)&&rN.test(e)||(t==="v6"||!t)&&aN.test(e))}class dn extends Ge{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ve.string){const l=this._getOrReturnCtx(t);return ce(l,{code:re.invalid_type,expected:ve.string,received:l.parsedType}),Ne}const n=new Ys;let a;for(const l of this._def.checks)if(l.kind==="min")t.data.length<l.value&&(a=this._getOrReturnCtx(t,a),ce(a,{code:re.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),n.dirty());else if(l.kind==="max")t.data.length>l.value&&(a=this._getOrReturnCtx(t,a),ce(a,{code:re.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),n.dirty());else if(l.kind==="length"){const h=t.data.length>l.value,d=t.data.length<l.value;(h||d)&&(a=this._getOrReturnCtx(t,a),h?ce(a,{code:re.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):d&&ce(a,{code:re.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),n.dirty())}else if(l.kind==="email")tN.test(t.data)||(a=this._getOrReturnCtx(t,a),ce(a,{validation:"email",code:re.invalid_string,message:l.message}),n.dirty());else if(l.kind==="emoji")sm||(sm=new RegExp(sN,"u")),sm.test(t.data)||(a=this._getOrReturnCtx(t,a),ce(a,{validation:"emoji",code:re.invalid_string,message:l.message}),n.dirty());else if(l.kind==="uuid")Z2.test(t.data)||(a=this._getOrReturnCtx(t,a),ce(a,{validation:"uuid",code:re.invalid_string,message:l.message}),n.dirty());else if(l.kind==="nanoid")X2.test(t.data)||(a=this._getOrReturnCtx(t,a),ce(a,{validation:"nanoid",code:re.invalid_string,message:l.message}),n.dirty());else if(l.kind==="cuid")Y2.test(t.data)||(a=this._getOrReturnCtx(t,a),ce(a,{validation:"cuid",code:re.invalid_string,message:l.message}),n.dirty());else if(l.kind==="cuid2")G2.test(t.data)||(a=this._getOrReturnCtx(t,a),ce(a,{validation:"cuid2",code:re.invalid_string,message:l.message}),n.dirty());else if(l.kind==="ulid")Q2.test(t.data)||(a=this._getOrReturnCtx(t,a),ce(a,{validation:"ulid",code:re.invalid_string,message:l.message}),n.dirty());else if(l.kind==="url")try{new URL(t.data)}catch{a=this._getOrReturnCtx(t,a),ce(a,{validation:"url",code:re.invalid_string,message:l.message}),n.dirty()}else l.kind==="regex"?(l.regex.lastIndex=0,l.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),ce(a,{validation:"regex",code:re.invalid_string,message:l.message}),n.dirty())):l.kind==="trim"?t.data=t.data.trim():l.kind==="includes"?t.data.includes(l.value,l.position)||(a=this._getOrReturnCtx(t,a),ce(a,{code:re.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),n.dirty()):l.kind==="toLowerCase"?t.data=t.data.toLowerCase():l.kind==="toUpperCase"?t.data=t.data.toUpperCase():l.kind==="startsWith"?t.data.startsWith(l.value)||(a=this._getOrReturnCtx(t,a),ce(a,{code:re.invalid_string,validation:{startsWith:l.value},message:l.message}),n.dirty()):l.kind==="endsWith"?t.data.endsWith(l.value)||(a=this._getOrReturnCtx(t,a),ce(a,{code:re.invalid_string,validation:{endsWith:l.value},message:l.message}),n.dirty()):l.kind==="datetime"?hN(l).test(t.data)||(a=this._getOrReturnCtx(t,a),ce(a,{code:re.invalid_string,validation:"datetime",message:l.message}),n.dirty()):l.kind==="date"?cN.test(t.data)||(a=this._getOrReturnCtx(t,a),ce(a,{code:re.invalid_string,validation:"date",message:l.message}),n.dirty()):l.kind==="time"?uN(l).test(t.data)||(a=this._getOrReturnCtx(t,a),ce(a,{code:re.invalid_string,validation:"time",message:l.message}),n.dirty()):l.kind==="duration"?eN.test(t.data)||(a=this._getOrReturnCtx(t,a),ce(a,{validation:"duration",code:re.invalid_string,message:l.message}),n.dirty()):l.kind==="ip"?dN(t.data,l.version)||(a=this._getOrReturnCtx(t,a),ce(a,{validation:"ip",code:re.invalid_string,message:l.message}),n.dirty()):l.kind==="jwt"?fN(t.data,l.alg)||(a=this._getOrReturnCtx(t,a),ce(a,{validation:"jwt",code:re.invalid_string,message:l.message}),n.dirty()):l.kind==="cidr"?mN(t.data,l.version)||(a=this._getOrReturnCtx(t,a),ce(a,{validation:"cidr",code:re.invalid_string,message:l.message}),n.dirty()):l.kind==="base64"?oN.test(t.data)||(a=this._getOrReturnCtx(t,a),ce(a,{validation:"base64",code:re.invalid_string,message:l.message}),n.dirty()):l.kind==="base64url"?lN.test(t.data)||(a=this._getOrReturnCtx(t,a),ce(a,{validation:"base64url",code:re.invalid_string,message:l.message}),n.dirty()):Xe.assertNever(l);return{status:n.value,value:t.data}}_regex(t,i,n){return this.refinement(a=>t.test(a),{validation:i,code:re.invalid_string,...Se.errToObj(n)})}_addCheck(t){return new dn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Se.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Se.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Se.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Se.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Se.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Se.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Se.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Se.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Se.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Se.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Se.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Se.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Se.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,...Se.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,...Se.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Se.errToObj(t)})}regex(t,i){return this._addCheck({kind:"regex",regex:t,...Se.errToObj(i)})}includes(t,i){return this._addCheck({kind:"includes",value:t,position:i==null?void 0:i.position,...Se.errToObj(i==null?void 0:i.message)})}startsWith(t,i){return this._addCheck({kind:"startsWith",value:t,...Se.errToObj(i)})}endsWith(t,i){return this._addCheck({kind:"endsWith",value:t,...Se.errToObj(i)})}min(t,i){return this._addCheck({kind:"min",value:t,...Se.errToObj(i)})}max(t,i){return this._addCheck({kind:"max",value:t,...Se.errToObj(i)})}length(t,i){return this._addCheck({kind:"length",value:t,...Se.errToObj(i)})}nonempty(t){return this.min(1,Se.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:Te.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Pe(e)});function _N(e,t){const i=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=i>n?i:n,l=Number.parseInt(e.toFixed(a).replace(".","")),h=Number.parseInt(t.toFixed(a).replace(".",""));return l%h/10**a}class bo extends Ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ve.number){const l=this._getOrReturnCtx(t);return ce(l,{code:re.invalid_type,expected:ve.number,received:l.parsedType}),Ne}let n;const a=new Ys;for(const l of this._def.checks)l.kind==="int"?Xe.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ce(n,{code:re.invalid_type,expected:"integer",received:"float",message:l.message}),a.dirty()):l.kind==="min"?(l.inclusive?t.data<l.value:t.data<=l.value)&&(n=this._getOrReturnCtx(t,n),ce(n,{code:re.too_small,minimum:l.value,type:"number",inclusive:l.inclusive,exact:!1,message:l.message}),a.dirty()):l.kind==="max"?(l.inclusive?t.data>l.value:t.data>=l.value)&&(n=this._getOrReturnCtx(t,n),ce(n,{code:re.too_big,maximum:l.value,type:"number",inclusive:l.inclusive,exact:!1,message:l.message}),a.dirty()):l.kind==="multipleOf"?_N(t.data,l.value)!==0&&(n=this._getOrReturnCtx(t,n),ce(n,{code:re.not_multiple_of,multipleOf:l.value,message:l.message}),a.dirty()):l.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ce(n,{code:re.not_finite,message:l.message}),a.dirty()):Xe.assertNever(l);return{status:a.value,value:t.data}}gte(t,i){return this.setLimit("min",t,!0,Se.toString(i))}gt(t,i){return this.setLimit("min",t,!1,Se.toString(i))}lte(t,i){return this.setLimit("max",t,!0,Se.toString(i))}lt(t,i){return this.setLimit("max",t,!1,Se.toString(i))}setLimit(t,i,n,a){return new bo({...this._def,checks:[...this._def.checks,{kind:t,value:i,inclusive:n,message:Se.toString(a)}]})}_addCheck(t){return new bo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Se.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Se.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Se.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Se.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Se.toString(t)})}multipleOf(t,i){return this._addCheck({kind:"multipleOf",value:t,message:Se.toString(i)})}finite(t){return this._addCheck({kind:"finite",message:Se.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Se.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Se.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"&&Xe.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)}}bo.create=e=>new bo({checks:[],typeName:Te.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Pe(e)});class Kl extends Ge{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ve.bigint)return this._getInvalidInput(t);let n;const a=new Ys;for(const l of this._def.checks)l.kind==="min"?(l.inclusive?t.data<l.value:t.data<=l.value)&&(n=this._getOrReturnCtx(t,n),ce(n,{code:re.too_small,type:"bigint",minimum:l.value,inclusive:l.inclusive,message:l.message}),a.dirty()):l.kind==="max"?(l.inclusive?t.data>l.value:t.data>=l.value)&&(n=this._getOrReturnCtx(t,n),ce(n,{code:re.too_big,type:"bigint",maximum:l.value,inclusive:l.inclusive,message:l.message}),a.dirty()):l.kind==="multipleOf"?t.data%l.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),ce(n,{code:re.not_multiple_of,multipleOf:l.value,message:l.message}),a.dirty()):Xe.assertNever(l);return{status:a.value,value:t.data}}_getInvalidInput(t){const i=this._getOrReturnCtx(t);return ce(i,{code:re.invalid_type,expected:ve.bigint,received:i.parsedType}),Ne}gte(t,i){return this.setLimit("min",t,!0,Se.toString(i))}gt(t,i){return this.setLimit("min",t,!1,Se.toString(i))}lte(t,i){return this.setLimit("max",t,!0,Se.toString(i))}lt(t,i){return this.setLimit("max",t,!1,Se.toString(i))}setLimit(t,i,n,a){return new Kl({...this._def,checks:[...this._def.checks,{kind:t,value:i,inclusive:n,message:Se.toString(a)}]})}_addCheck(t){return new Kl({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Se.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Se.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Se.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Se.toString(t)})}multipleOf(t,i){return this._addCheck({kind:"multipleOf",value:t,message:Se.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}}Kl.create=e=>new Kl({checks:[],typeName:Te.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Pe(e)});class Vm extends Ge{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ve.boolean){const n=this._getOrReturnCtx(t);return ce(n,{code:re.invalid_type,expected:ve.boolean,received:n.parsedType}),Ne}return hi(t.data)}}Vm.create=e=>new Vm({typeName:Te.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Pe(e)});class ih extends Ge{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ve.date){const l=this._getOrReturnCtx(t);return ce(l,{code:re.invalid_type,expected:ve.date,received:l.parsedType}),Ne}if(Number.isNaN(t.data.getTime())){const l=this._getOrReturnCtx(t);return ce(l,{code:re.invalid_date}),Ne}const n=new Ys;let a;for(const l of this._def.checks)l.kind==="min"?t.data.getTime()<l.value&&(a=this._getOrReturnCtx(t,a),ce(a,{code:re.too_small,message:l.message,inclusive:!0,exact:!1,minimum:l.value,type:"date"}),n.dirty()):l.kind==="max"?t.data.getTime()>l.value&&(a=this._getOrReturnCtx(t,a),ce(a,{code:re.too_big,message:l.message,inclusive:!0,exact:!1,maximum:l.value,type:"date"}),n.dirty()):Xe.assertNever(l);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new ih({...this._def,checks:[...this._def.checks,t]})}min(t,i){return this._addCheck({kind:"min",value:t.getTime(),message:Se.toString(i)})}max(t,i){return this._addCheck({kind:"max",value:t.getTime(),message:Se.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}}ih.create=e=>new ih({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Te.ZodDate,...Pe(e)});class f0 extends Ge{_parse(t){if(this._getType(t)!==ve.symbol){const n=this._getOrReturnCtx(t);return ce(n,{code:re.invalid_type,expected:ve.symbol,received:n.parsedType}),Ne}return hi(t.data)}}f0.create=e=>new f0({typeName:Te.ZodSymbol,...Pe(e)});class Ym extends Ge{_parse(t){if(this._getType(t)!==ve.undefined){const n=this._getOrReturnCtx(t);return ce(n,{code:re.invalid_type,expected:ve.undefined,received:n.parsedType}),Ne}return hi(t.data)}}Ym.create=e=>new Ym({typeName:Te.ZodUndefined,...Pe(e)});class Gm extends Ge{_parse(t){if(this._getType(t)!==ve.null){const n=this._getOrReturnCtx(t);return ce(n,{code:re.invalid_type,expected:ve.null,received:n.parsedType}),Ne}return hi(t.data)}}Gm.create=e=>new Gm({typeName:Te.ZodNull,...Pe(e)});class m0 extends Ge{constructor(){super(...arguments),this._any=!0}_parse(t){return hi(t.data)}}m0.create=e=>new m0({typeName:Te.ZodAny,...Pe(e)});class _0 extends Ge{constructor(){super(...arguments),this._unknown=!0}_parse(t){return hi(t.data)}}_0.create=e=>new _0({typeName:Te.ZodUnknown,...Pe(e)});class vn extends Ge{_parse(t){const i=this._getOrReturnCtx(t);return ce(i,{code:re.invalid_type,expected:ve.never,received:i.parsedType}),Ne}}vn.create=e=>new vn({typeName:Te.ZodNever,...Pe(e)});class p0 extends Ge{_parse(t){if(this._getType(t)!==ve.undefined){const n=this._getOrReturnCtx(t);return ce(n,{code:re.invalid_type,expected:ve.void,received:n.parsedType}),Ne}return hi(t.data)}}p0.create=e=>new p0({typeName:Te.ZodVoid,...Pe(e)});class zi extends Ge{_parse(t){const{ctx:i,status:n}=this._processInputParams(t),a=this._def;if(i.parsedType!==ve.array)return ce(i,{code:re.invalid_type,expected:ve.array,received:i.parsedType}),Ne;if(a.exactLength!==null){const h=i.data.length>a.exactLength.value,d=i.data.length<a.exactLength.value;(h||d)&&(ce(i,{code:h?re.too_big:re.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&&(ce(i,{code:re.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&&(ce(i,{code:re.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 pn(i,h,i.path,d)))).then(h=>Ys.mergeArray(n,h));const l=[...i.data].map((h,d)=>a.type._parseSync(new pn(i,h,i.path,d)));return Ys.mergeArray(n,l)}get element(){return this._def.type}min(t,i){return new zi({...this._def,minLength:{value:t,message:Se.toString(i)}})}max(t,i){return new zi({...this._def,maxLength:{value:t,message:Se.toString(i)}})}length(t,i){return new zi({...this._def,exactLength:{value:t,message:Se.toString(i)}})}nonempty(t){return this.min(1,t)}}zi.create=(e,t)=>new zi({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Te.ZodArray,...Pe(t)});function eo(e){if(e instanceof zt){const t={};for(const i in e.shape){const n=e.shape[i];t[i]=_r.create(eo(n))}return new zt({...e._def,shape:()=>t})}else return e instanceof zi?new zi({...e._def,type:eo(e.element)}):e instanceof _r?_r.create(eo(e.unwrap())):e instanceof na?na.create(eo(e.unwrap())):e instanceof sa?sa.create(e.items.map(t=>eo(t))):e}class zt extends Ge{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=Xe.objectKeys(t);return this._cached={shape:t,keys:i},this._cached}_parse(t){if(this._getType(t)!==ve.object){const m=this._getOrReturnCtx(t);return ce(m,{code:re.invalid_type,expected:ve.object,received:m.parsedType}),Ne}const{status:n,ctx:a}=this._processInputParams(t),{shape:l,keys:h}=this._getCached(),d=[];if(!(this._def.catchall instanceof vn&&this._def.unknownKeys==="strip"))for(const m in a.data)h.includes(m)||d.push(m);const _=[];for(const m of h){const v=l[m],g=a.data[m];_.push({key:{status:"valid",value:m},value:v._parse(new pn(a,g,a.path,m)),alwaysSet:m in a.data})}if(this._def.catchall instanceof vn){const m=this._def.unknownKeys;if(m==="passthrough")for(const v of d)_.push({key:{status:"valid",value:v},value:{status:"valid",value:a.data[v]}});else if(m==="strict")d.length>0&&(ce(a,{code:re.unrecognized_keys,keys:d}),n.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const m=this._def.catchall;for(const v of d){const g=a.data[v];_.push({key:{status:"valid",value:v},value:m._parse(new pn(a,g,a.path,v)),alwaysSet:v in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const m=[];for(const v of _){const g=await v.key,b=await v.value;m.push({key:g,value:b,alwaysSet:v.alwaysSet})}return m}).then(m=>Ys.mergeObjectSync(n,m)):Ys.mergeObjectSync(n,_)}get shape(){return this._def.shape()}strict(t){return Se.errToObj,new zt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(i,n)=>{var l,h;const a=((h=(l=this._def).errorMap)==null?void 0:h.call(l,i,n).message)??n.defaultError;return i.code==="unrecognized_keys"?{message:Se.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:Te.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 Xe.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 Xe.objectKeys(this.shape))t[n]||(i[n]=this.shape[n]);return new zt({...this._def,shape:()=>i})}deepPartial(){return eo(this)}partial(t){const i={};for(const n of Xe.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 Xe.objectKeys(this.shape))if(t&&!t[n])i[n]=this.shape[n];else{let l=this.shape[n];for(;l instanceof _r;)l=l._def.innerType;i[n]=l}return new zt({...this._def,shape:()=>i})}keyof(){return ew(Xe.objectKeys(this.shape))}}zt.create=(e,t)=>new zt({shape:()=>e,unknownKeys:"strip",catchall:vn.create(),typeName:Te.ZodObject,...Pe(t)});zt.strictCreate=(e,t)=>new zt({shape:()=>e,unknownKeys:"strict",catchall:vn.create(),typeName:Te.ZodObject,...Pe(t)});zt.lazycreate=(e,t)=>new zt({shape:e,unknownKeys:"strip",catchall:vn.create(),typeName:Te.ZodObject,...Pe(t)});class rh extends Ge{_parse(t){const{ctx:i}=this._processInputParams(t),n=this._def.options;function a(l){for(const d of l)if(d.result.status==="valid")return d.result;for(const d of l)if(d.result.status==="dirty")return i.common.issues.push(...d.ctx.common.issues),d.result;const h=l.map(d=>new vr(d.ctx.common.issues));return ce(i,{code:re.invalid_union,unionErrors:h}),Ne}if(i.common.async)return Promise.all(n.map(async l=>{const h={...i,common:{...i.common,issues:[]},parent:null};return{result:await l._parseAsync({data:i.data,path:i.path,parent:h}),ctx:h}})).then(a);{let l;const h=[];for(const _ of n){const m={...i,common:{...i.common,issues:[]},parent:null},v=_._parseSync({data:i.data,path:i.path,parent:m});if(v.status==="valid")return v;v.status==="dirty"&&!l&&(l={result:v,ctx:m}),m.common.issues.length&&h.push(m.common.issues)}if(l)return i.common.issues.push(...l.ctx.common.issues),l.result;const d=h.map(_=>new vr(_));return ce(i,{code:re.invalid_union,unionErrors:d}),Ne}}get options(){return this._def.options}}rh.create=(e,t)=>new rh({options:e,typeName:Te.ZodUnion,...Pe(t)});const lr=e=>e instanceof Zm?lr(e.schema):e instanceof ra?lr(e.innerType()):e instanceof ah?[e.value]:e instanceof ia?e.options:e instanceof Xm?Xe.objectValues(e.enum):e instanceof lh?lr(e._def.innerType):e instanceof Ym?[void 0]:e instanceof Gm?[null]:e instanceof _r?[void 0,...lr(e.unwrap())]:e instanceof na?[null,...lr(e.unwrap())]:e instanceof tw||e instanceof uh?lr(e.unwrap()):e instanceof ch?lr(e._def.innerType):[];class np extends Ge{_parse(t){const{ctx:i}=this._processInputParams(t);if(i.parsedType!==ve.object)return ce(i,{code:re.invalid_type,expected:ve.object,received:i.parsedType}),Ne;const n=this.discriminator,a=i.data[n],l=this.optionsMap.get(a);return l?i.common.async?l._parseAsync({data:i.data,path:i.path,parent:i}):l._parseSync({data:i.data,path:i.path,parent:i}):(ce(i,{code:re.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ne)}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 l of i){const h=lr(l.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,l)}}return new np({typeName:Te.ZodDiscriminatedUnion,discriminator:t,options:i,optionsMap:a,...Pe(n)})}}function Qm(e,t){const i=Qr(e),n=Qr(t);if(e===t)return{valid:!0,data:e};if(i===ve.object&&n===ve.object){const a=Xe.objectKeys(t),l=Xe.objectKeys(e).filter(d=>a.indexOf(d)!==-1),h={...e,...t};for(const d of l){const _=Qm(e[d],t[d]);if(!_.valid)return{valid:!1};h[d]=_.data}return{valid:!0,data:h}}else if(i===ve.array&&n===ve.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let l=0;l<e.length;l++){const h=e[l],d=t[l],_=Qm(h,d);if(!_.valid)return{valid:!1};a.push(_.data)}return{valid:!0,data:a}}else return i===ve.date&&n===ve.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class nh extends Ge{_parse(t){const{status:i,ctx:n}=this._processInputParams(t),a=(l,h)=>{if(u0(l)||u0(h))return Ne;const d=Qm(l.value,h.value);return d.valid?((h0(l)||h0(h))&&i.dirty(),{status:i.value,value:d.data}):(ce(n,{code:re.invalid_intersection_types}),Ne)};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(([l,h])=>a(l,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}))}}nh.create=(e,t,i)=>new nh({left:e,right:t,typeName:Te.ZodIntersection,...Pe(i)});class sa extends Ge{_parse(t){const{status:i,ctx:n}=this._processInputParams(t);if(n.parsedType!==ve.array)return ce(n,{code:re.invalid_type,expected:ve.array,received:n.parsedType}),Ne;if(n.data.length<this._def.items.length)return ce(n,{code:re.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ne;!this._def.rest&&n.data.length>this._def.items.length&&(ce(n,{code:re.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),i.dirty());const l=[...n.data].map((h,d)=>{const _=this._def.items[d]||this._def.rest;return _?_._parse(new pn(n,h,n.path,d)):null}).filter(h=>!!h);return n.common.async?Promise.all(l).then(h=>Ys.mergeArray(i,h)):Ys.mergeArray(i,l)}get items(){return this._def.items}rest(t){return new sa({...this._def,rest:t})}}sa.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new sa({items:e,typeName:Te.ZodTuple,rest:null,...Pe(t)})};class v0 extends Ge{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:i,ctx:n}=this._processInputParams(t);if(n.parsedType!==ve.map)return ce(n,{code:re.invalid_type,expected:ve.map,received:n.parsedType}),Ne;const a=this._def.keyType,l=this._def.valueType,h=[...n.data.entries()].map(([d,_],m)=>({key:a._parse(new pn(n,d,n.path,[m,"key"])),value:l._parse(new pn(n,_,n.path,[m,"value"]))}));if(n.common.async){const d=new Map;return Promise.resolve().then(async()=>{for(const _ of h){const m=await _.key,v=await _.value;if(m.status==="aborted"||v.status==="aborted")return Ne;(m.status==="dirty"||v.status==="dirty")&&i.dirty(),d.set(m.value,v.value)}return{status:i.value,value:d}})}else{const d=new Map;for(const _ of h){const m=_.key,v=_.value;if(m.status==="aborted"||v.status==="aborted")return Ne;(m.status==="dirty"||v.status==="dirty")&&i.dirty(),d.set(m.value,v.value)}return{status:i.value,value:d}}}}v0.create=(e,t,i)=>new v0({valueType:t,keyType:e,typeName:Te.ZodMap,...Pe(i)});class $l extends Ge{_parse(t){const{status:i,ctx:n}=this._processInputParams(t);if(n.parsedType!==ve.set)return ce(n,{code:re.invalid_type,expected:ve.set,received:n.parsedType}),Ne;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(ce(n,{code:re.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&&(ce(n,{code:re.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),i.dirty());const l=this._def.valueType;function h(_){const m=new Set;for(const v of _){if(v.status==="aborted")return Ne;v.status==="dirty"&&i.dirty(),m.add(v.value)}return{status:i.value,value:m}}const d=[...n.data.values()].map((_,m)=>l._parse(new pn(n,_,n.path,m)));return n.common.async?Promise.all(d).then(_=>h(_)):h(d)}min(t,i){return new $l({...this._def,minSize:{value:t,message:Se.toString(i)}})}max(t,i){return new $l({...this._def,maxSize:{value:t,message:Se.toString(i)}})}size(t,i){return this.min(t,i).max(t,i)}nonempty(t){return this.min(1,t)}}$l.create=(e,t)=>new $l({valueType:e,minSize:null,maxSize:null,typeName:Te.ZodSet,...Pe(t)});class Zm extends Ge{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})}}Zm.create=(e,t)=>new Zm({getter:e,typeName:Te.ZodLazy,...Pe(t)});class ah extends Ge{_parse(t){if(t.data!==this._def.value){const i=this._getOrReturnCtx(t);return ce(i,{received:i.data,code:re.invalid_literal,expected:this._def.value}),Ne}return{status:"valid",value:t.data}}get value(){return this._def.value}}ah.create=(e,t)=>new ah({value:e,typeName:Te.ZodLiteral,...Pe(t)});function ew(e,t){return new ia({values:e,typeName:Te.ZodEnum,...Pe(t)})}class ia extends Ge{_parse(t){if(typeof t.data!="string"){const i=this._getOrReturnCtx(t),n=this._def.values;return ce(i,{expected:Xe.joinValues(n),received:i.parsedType,code:re.invalid_type}),Ne}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 ce(i,{received:i.data,code:re.invalid_enum_value,options:n}),Ne}return hi(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 ia.create(t,{...this._def,...i})}exclude(t,i=this._def){return ia.create(this.options.filter(n=>!t.includes(n)),{...this._def,...i})}}ia.create=ew;class Xm extends Ge{_parse(t){const i=Xe.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ve.string&&n.parsedType!==ve.number){const a=Xe.objectValues(i);return ce(n,{expected:Xe.joinValues(a),received:n.parsedType,code:re.invalid_type}),Ne}if(this._cache||(this._cache=new Set(Xe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const a=Xe.objectValues(i);return ce(n,{received:n.data,code:re.invalid_enum_value,options:a}),Ne}return hi(t.data)}get enum(){return this._def.values}}Xm.create=(e,t)=>new Xm({values:e,typeName:Te.ZodNativeEnum,...Pe(t)});class oh extends Ge{unwrap(){return this._def.type}_parse(t){const{ctx:i}=this._processInputParams(t);if(i.parsedType!==ve.promise&&i.common.async===!1)return ce(i,{code:re.invalid_type,expected:ve.promise,received:i.parsedType}),Ne;const n=i.parsedType===ve.promise?i.data:Promise.resolve(i.data);return hi(n.then(a=>this._def.type.parseAsync(a,{path:i.path,errorMap:i.common.contextualErrorMap})))}}oh.create=(e,t)=>new oh({type:e,typeName:Te.ZodPromise,...Pe(t)});class ra extends Ge{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Te.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:i,ctx:n}=this._processInputParams(t),a=this._def.effect||null,l={addIssue:h=>{ce(n,h),h.fatal?i.abort():i.dirty()},get path(){return n.path}};if(l.addIssue=l.addIssue.bind(l),a.type==="preprocess"){const h=a.transform(n.data,l);if(n.common.async)return Promise.resolve(h).then(async d=>{if(i.value==="aborted")return Ne;const _=await this._def.schema._parseAsync({data:d,path:n.path,parent:n});return _.status==="aborted"?Ne:_.status==="dirty"||i.value==="dirty"?Ol(_.value):_});{if(i.value==="aborted")return Ne;const d=this._def.schema._parseSync({data:h,path:n.path,parent:n});return d.status==="aborted"?Ne:d.status==="dirty"||i.value==="dirty"?Ol(d.value):d}}if(a.type==="refinement"){const h=d=>{const _=a.refinement(d,l);if(n.common.async)return Promise.resolve(_);if(_ 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"?Ne:(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"?Ne:(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(!yo(h))return Ne;const d=a.transform(h.value,l);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=>yo(h)?Promise.resolve(a.transform(h.value,l)).then(d=>({status:i.value,value:d})):Ne);Xe.assertNever(a)}}ra.create=(e,t,i)=>new ra({schema:e,typeName:Te.ZodEffects,effect:t,...Pe(i)});ra.createWithPreprocess=(e,t,i)=>new ra({schema:t,effect:{type:"preprocess",transform:e},typeName:Te.ZodEffects,...Pe(i)});class _r extends Ge{_parse(t){return this._getType(t)===ve.undefined?hi(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}_r.create=(e,t)=>new _r({innerType:e,typeName:Te.ZodOptional,...Pe(t)});class na extends Ge{_parse(t){return this._getType(t)===ve.null?hi(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}na.create=(e,t)=>new na({innerType:e,typeName:Te.ZodNullable,...Pe(t)});class lh extends Ge{_parse(t){const{ctx:i}=this._processInputParams(t);let n=i.data;return i.parsedType===ve.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:i.path,parent:i})}removeDefault(){return this._def.innerType}}lh.create=(e,t)=>new lh({innerType:e,typeName:Te.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Pe(t)});class ch extends Ge{_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 sh(a)?a.then(l=>({status:"valid",value:l.status==="valid"?l.value:this._def.catchValue({get error(){return new vr(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new vr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ch.create=(e,t)=>new ch({innerType:e,typeName:Te.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Pe(t)});class g0 extends Ge{_parse(t){if(this._getType(t)!==ve.nan){const n=this._getOrReturnCtx(t);return ce(n,{code:re.invalid_type,expected:ve.nan,received:n.parsedType}),Ne}return{status:"valid",value:t.data}}}g0.create=e=>new g0({typeName:Te.ZodNaN,...Pe(e)});class tw extends Ge{_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 ap extends Ge{_parse(t){const{status:i,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const l=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?Ne:l.status==="dirty"?(i.dirty(),Ol(l.value)):this._def.out._parseAsync({data:l.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Ne: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 ap({in:t,out:i,typeName:Te.ZodPipeline})}}class uh extends Ge{_parse(t){const i=this._def.innerType._parse(t),n=a=>(yo(a)&&(a.value=Object.freeze(a.value)),a);return sh(i)?i.then(a=>n(a)):n(i)}unwrap(){return this._def.innerType}}uh.create=(e,t)=>new uh({innerType:e,typeName:Te.ZodReadonly,...Pe(t)});var Te;(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"})(Te||(Te={}));const xe=dn.create,os=bo.create,sw=Vm.create;vn.create;const Oi=zi.create,De=zt.create,pN=rh.create,jo=np.create;nh.create;sa.create;const Ze=ah.create,Si=ia.create;oh.create;_r.create;na.create;const vN="/acp",gN="session",yN=4404,bN=Si(["running","exited"]),y0=Si(["pending","running","ok","failed","cancelled"]),SN=Si(["read","edit","delete","move","search","execute","think","fetch","switch_mode","other"]),b0=De({path:xe(),line:os().int().nullish()}),xN=jo("type",[De({type:Ze("content"),text:xe()}),De({type:Ze("diff"),path:xe(),oldText:xe().nullish(),newText:xe()}),De({type:Ze("terminal"),terminalId:xe()})]),wN=Si(["allow_once","allow_always","reject_once","reject_always"]),CN=De({optionId:xe(),name:xe(),kind:wN}),jN=Si(["end_turn","max_tokens","max_turn_requests","refusal","cancelled"]),kN=Si(["pending","in_progress","completed"]),EN=De({content:xe(),status:kN,priority:Si(["high","medium","low"]).nullish()}),NN=De({utilization:os(),surpassedThreshold:os().nullish(),isUsingOverage:sw(),resetsAt:os().int().nullish(),kind:xe().nullish()}),TN=De({value:xe(),name:xe(),description:xe().nullish()}),iw=De({id:xe(),name:xe(),category:xe().nullish(),currentValue:xe(),choices:Oi(TN)}),ON=De({name:xe(),description:xe(),takesInput:sw()}),rw=jo("type",[De({type:Ze("message"),messageId:xe(),role:Si(["user","agent"]),text:xe()}),De({type:Ze("thought"),messageId:xe(),text:xe()}),De({type:Ze("tool_call"),toolCallId:xe(),title:xe(),name:xe().nullish(),kind:SN,status:y0,locations:Oi(b0).default([])}),De({type:Ze("tool_call_update"),toolCallId:xe(),status:y0.optional(),title:xe().optional(),content:Oi(xN).optional(),locations:Oi(b0).optional()}),De({type:Ze("permission_request"),requestId:xe(),toolCallId:xe(),title:xe(),command:xe().nullish(),cwd:xe(),options:Oi(CN).min(1)}),De({type:Ze("permission_resolved"),requestId:xe(),outcome:pN([Ze("cancelled"),De({optionId:xe()})])}),De({type:Ze("plan"),entries:Oi(EN)}),De({type:Ze("plan_removed")}),De({type:Ze("usage"),used:os().int().nonnegative(),size:os().int().positive(),cost:De({amount:os(),currency:xe()}).nullish(),rateLimit:NN.nullish()}),De({type:Ze("config"),mode:xe(),options:Oi(iw)}),De({type:Ze("commands"),commands:Oi(ON)}),De({type:Ze("terminal"),terminalId:xe(),ptySessionId:xe(),command:xe()}),De({type:Ze("turn_end"),stopReason:jN}),De({type:Ze("resumed"),fromSessionId:xe()}),De({type:Ze("memory_core"),entries:os().int().nonnegative(),chars:os().int().nonnegative()}),De({type:Ze("unknown"),sessionUpdate:xe()})]),AN=De({at:os().int().nonnegative(),event:rw}),RN=Si(["SESSION_NOT_FOUND","SESSION_EXITED","INVALID_MESSAGE","ADAPTER_UNAVAILABLE","INTERNAL"]),MN=jo("type",[De({type:Ze("prompt"),text:xe().min(1)}),De({type:Ze("cancel")}),De({type:Ze("permission_response"),requestId:xe(),optionId:xe()}),De({type:Ze("set_config"),optionId:xe().min(1),value:xe().min(1)})]),DN=jo("type",[De({type:Ze("attached"),sessionId:xe(),state:bN,acpSessionId:xe(),model:xe(),mode:xe(),configOptions:Oi(iw).default([]),transcript:Oi(AN)}),De({type:Ze("event"),at:os().int().nonnegative(),event:rw}),De({type:Ze("error"),code:RN,message:xe(),remedy:xe().optional()})]);function BN(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(l=>`${l.path.join(".")||"<root>"}: ${l.message}`).join("; ")}}function LN(e){return BN(DN,e)}function zN(e){return JSON.stringify(e)}const qN="/pty",PN="session",HN=Si(["running","exited"]),IN=Si(["SESSION_NOT_FOUND","SESSION_EXITED","INVALID_MESSAGE","INTERNAL"]),S0=5e3;jo("type",[De({type:Ze("input"),data:xe()}),De({type:Ze("resize"),cols:os().int().min(1).max(S0),rows:os().int().min(1).max(S0)})]);const UN=jo("type",[De({type:Ze("attached"),sessionId:xe(),state:HN,cols:os().int(),rows:os().int(),snapshot:xe()}),De({type:Ze("output"),data:xe()}),De({type:Ze("exit"),exitCode:os().int(),signal:os().int().nullable()}),De({type:Ze("error"),code:IN,message:xe()})]);function FN(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(l=>`${l.path.join(".")||"<root>"}: ${l.message}`).join("; ")}}function KN(e){return FN(UN,e)}function x0(e){return JSON.stringify(e)}const $N=1;function WN(e,t){return`${t.protocol==="https:"?"wss:":"ws:"}//${t.host}${qN}?${PN}=${encodeURIComponent(e)}`}function nw(e,t,i={}){const{createWebSocket:n=d=>new WebSocket(d),origin:a=window.location}=i,l=n(WN(e,a));let h=[];return l.onopen=()=>{const d=h;h=[];for(const _ of d)l.send(x0(_))},l.onmessage=d=>{var m;const _=KN(String(d.data));_.ok?t.onMessage(_.message):(m=t.onDecodeError)==null||m.call(t,_.error)},l.onclose=d=>{var _;h=[],(_=t.onClose)==null||_.call(t,{code:d.code,clean:d.wasClean})},l.onerror=()=>{},{send(d){l.readyState===$N?l.send(x0(d)):h.push(d)},close(){l.onmessage=null,l.onclose=null,l.onopen=null,h=[],l.close()}}}const w0=12;function VN({ptySessionId:e,onFinished:t,connect:i=nw}){const[n,a]=k.useState([]),[l,h]=k.useState(null),[d,_]=k.useState(!1),m=k.useRef(t);return m.current=t,k.useEffect(()=>{if(e===null)return;a([]),h(null),_(!0);const v=i(e,{onMessage:g=>{if(g.type==="attached"||g.type==="output"){const b=g.type==="attached"?g.snapshot:g.data;a(S=>C0([...S,...YN(b)]));return}if(g.type==="exit"){_(!1),h(g.exitCode),m.current(g.exitCode);return}g.type==="error"&&a(b=>C0([...b,g.message]))},onClose:()=>_(!1)});return()=>v.close()},[e,i]),{output:n,exitCode:l,running:d}}function YN(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 C0(e){return e.length<=w0?e:e.slice(e.length-w0)}const im=["agentConfig","list"];function GN({embedded:e=!1,onClose:t}={}){const i=Ye(),[n,a]=k.useState(e),l=Ae({queryKey:im,queryFn:()=>ie.agentConfig.list.query(),enabled:n}),[h,d]=k.useState(""),[_,m]=k.useState(""),[v,g]=k.useState(""),[b,S]=k.useState("acp"),[x,C]=k.useState(""),[j,N]=k.useState(null),z=Ve({mutationFn:()=>ie.agentConfig.create.mutate({name:h.trim(),command:_.trim(),args:v.trim()===""?[]:v.trim().split(/\s+/),transport:b,...b==="acp"?{adapterVersion:x.trim()}:{}}),onSuccess:async()=>{await i.invalidateQueries({queryKey:im}),d(""),m(""),g(""),C("")}}),B=Ve({mutationFn:q=>ie.agentConfig.remove.mutate({id:q}),onSuccess:async()=>{N(null),await i.invalidateQueries({queryKey:im})}}),M=h.trim()!==""&&_.trim()!==""&&(b==="pty"||x.trim()!==""),V=q=>{q.preventDefault(),M&&z.mutate()};if(!n)return c.jsxs("button",{type:"button",className:"sidebar__add",onClick:()=>a(!0),children:[c.jsx(at,{tone:"agent",children:"◆"}),"agentes"]});const ee=l.data??[];return c.jsx("div",{className:"agents",children:c.jsxs(Sh,{children:[ee.length===0&&!l.isPending&&c.jsx("p",{className:"agents__empty",children:"nenhum agente configurado"}),ee.map(q=>{const te=q.transport==="acp";return c.jsxs("div",{className:"agents__row",children:[c.jsxs("div",{className:"agents__head",children:[c.jsx(at,{tone:te?"agent":"shell",children:te?"◆":"●"}),c.jsx("span",{className:"agents__name",children:q.name}),c.jsx(Ft,{children:te?"conversa":"terminal"}),!q.available&&c.jsx(Ft,{tone:"missing",children:"fora do PATH"})]}),c.jsxs("div",{className:"agents__foot",children:[c.jsxs("span",{className:"agents__cmd",title:q.command,children:[q.command,te&&q.adapterVersion?` @${q.adapterVersion}`:""]}),j===q.id?c.jsx(pe,{size:"sm",variant:"danger",disabled:B.isPending,onClick:()=>B.mutate(q.id),children:"confirmar"}):c.jsxs(pe,{size:"sm",variant:"ghost",onClick:()=>N(q.id),children:["remover ",c.jsx("span",{className:"sr-only",children:q.name})]})]})]},q.id)}),B.isError&&c.jsx(Re,{tone:"danger",children:B.error.message}),c.jsxs("form",{className:"agents__form",onSubmit:V,children:[c.jsx(as,{id:"agent-name",label:"Nome",error:z.isError?z.error.message:void 0,children:c.jsx(ps,{id:"agent-name",value:h,onChange:q=>d(q.target.value),placeholder:"claude-acp",invalid:z.isError,autoFocus:!0})}),c.jsx(as,{id:"agent-transport",label:"Transporte",children:c.jsxs("select",{id:"agent-transport",className:"input",value:b,onChange:q=>S(q.target.value),children:[c.jsx("option",{value:"acp",children:"conversa (ACP)"}),c.jsx("option",{value:"pty",children:"terminal (PTY)"})]})}),c.jsx(as,{id:"agent-command",label:"Comando",children:c.jsx(ps,{id:"agent-command",value:_,onChange:q=>m(q.target.value),placeholder:b==="acp"?"claude-agent-acp":"claude"})}),c.jsx(as,{id:"agent-args",label:"Argumentos (opcional)",children:c.jsx(ps,{id:"agent-args",value:v,onChange:q=>g(q.target.value),placeholder:"--flag valor"})}),b==="acp"&&c.jsx(as,{id:"agent-version",label:"Versão do adaptador",children:c.jsx(ps,{id:"agent-version",value:x,onChange:q=>C(q.target.value),placeholder:"0.40.0"})}),c.jsxs("div",{className:"agents__actions",children:[c.jsx(pe,{type:"submit",variant:"primary",disabled:z.isPending||!M,children:z.isPending?"criando…":"adicionar"}),c.jsx(pe,{variant:"ghost",onClick:()=>{e?t==null||t():a(!1)},children:"fechar"})]})]})]})})}const j0=["agentConfig","list"],k0=["setup","agents"],E0=["setup","probe"],QN="claude";function ZN(){var se;const e=Ye(),[t,i]=k.useState(!1),[n,a]=k.useState(!1),[l,h]=k.useState(!1),[d,_]=k.useState(null),[m,v]=k.useState("idle"),b=(se=Ae({queryKey:j0,queryFn:()=>ie.agentConfig.list.query()}).data)==null?void 0:se.find(L=>L.transport==="acp"),S=Ae({queryKey:k0,queryFn:()=>ie.setup.agents.query(),enabled:t,refetchOnWindowFocus:!1}),x=Ae({queryKey:[...E0,(b==null?void 0:b.command)??"default",((b==null?void 0:b.args)??[]).join(" ")],queryFn:()=>ie.setup.probe.query(b===void 0?void 0:{command:b.command,args:[...b.args]}),enabled:b!==void 0,retry:!1,refetchOnWindowFocus:!1,staleTime:5*6e4}),C=k.useCallback(async()=>{await e.invalidateQueries({queryKey:E0})},[e]),j=VN({ptySessionId:d,onFinished:()=>{_(null),C()}}),N=Ve({mutationFn:async()=>{var U,F;let L=((U=S.data)==null?void 0:U.adapter.path)??null;L===null&&(v("installing"),L=(await ie.setup.installAdapter.mutate()).path),v("handshaking");const T=await ie.setup.probe.query({command:L});return b===void 0&&await ie.agentConfig.create.mutate({name:QN,command:L,args:[],transport:"acp",adapterVersion:((F=T.agentInfo)==null?void 0:F.version)??null}),T},onSettled:async()=>{v("idle"),await e.invalidateQueries({queryKey:j0}),await e.invalidateQueries({queryKey:k0}),await C()}}),z=Ve({mutationFn:L=>ie.setup.login.mutate({methodId:L,...b===void 0?{}:{command:b.command,args:[...b.args]}}),onSuccess:L=>_(L.ptySessionId)}),B=M();if(!t)return c.jsxs("button",{type:"button",className:`foot-row foot-row--${B.tone}`,onClick:()=>i(!0),children:[c.jsx(at,{tone:"agent",children:"◆"}),c.jsx("span",{className:"foot-row__label",children:(b==null?void 0:b.name)??"conectar um agente"}),B.tone==="on"&&c.jsx("span",{className:"pip"}),c.jsx("span",{className:"foot-row__st",children:B.word})]});return c.jsxs("div",{className:"setup",role:"group","aria-label":"conectar um agente",children:[c.jsxs("div",{className:"setup__head",children:[c.jsx("span",{className:"setup__t",children:V()}),c.jsx("button",{type:"button",className:"setup__x","aria-label":"fechar",onClick:()=>i(!1),children:"✕"})]}),ee()]});function M(){var L;return N.isPending||z.isPending||j.running?{tone:"off",word:"entrando…"}:b===void 0?{tone:"off",word:"nenhum"}:x.isPending?{tone:"off",word:"verificando"}:x.isError?{tone:"err",word:"falhou"}:((L=x.data)==null?void 0:L.authRequired)===!0?{tone:"err",word:"expirado"}:{tone:"on",word:"conectado"}}function V(){var L;return n?"Outro agente ACP":l?"Adaptador":N.isPending?"Preparando o Claude Code":j.running?"Esperando o navegador":N.isError?"Não deu para conectar":b===void 0?"Conectar agente":x.isError?"Não deu para conectar":((L=x.data)==null?void 0:L.authRequired)===!0?"Entrar no Claude":"Claude Code"}function ee(){var L;return n?c.jsxs(c.Fragment,{children:[c.jsx(GN,{embedded:!0,onClose:()=>a(!1)}),c.jsx("button",{type:"button",className:"linkbtn",onClick:()=>a(!1),children:"voltar"})]}):l?G():N.isPending?te():j.running||d!==null?de():N.isError?K(N.error.message):b===void 0?q():x.isError?K(x.error.message):((L=x.data)==null?void 0:L.authRequired)===!0?he():ge()}function q(){var T;const L=(T=S.data)==null?void 0:T.claude;return c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",className:"opt opt--primary",disabled:N.isPending||S.isPending,onClick:()=>N.mutate(),children:[c.jsxs("span",{className:"opt__t",children:[c.jsx("span",{className:"opt__g","aria-hidden":"true",children:"◆"}),"Claude Code"]}),c.jsx("span",{className:"opt__d",children:S.isPending?"procurando na sua máquina…":(L==null?void 0:L.path)==null?"o CLI não está no PATH — o adaptador precisa dele para trabalhar":`encontrado na sua máquina · ${L.version??"versão não lida"}`})]}),c.jsxs("button",{type:"button",className:"opt",disabled:!0,children:[c.jsxs("span",{className:"opt__t",children:[c.jsx("span",{className:"opt__g","aria-hidden":"true",children:"◆"}),"Codex"]}),c.jsx("span",{className:"opt__d",children:"sem adaptador ACP publicado ainda"})]}),c.jsx("button",{type:"button",className:"linkbtn",onClick:()=>a(!0),children:"outro agente ACP…"})]})}function te(){var T;const L=[["CLI encontrado",((T=S.data)==null?void 0:T.claude.path)==null?"wait":"done"],["instalando o adaptador ACP",m==="installing"?"now":m==="handshaking"?"done":"wait"],["handshake",m==="handshaking"?"now":"wait"]];return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"prep",children:L.map(([U,F])=>c.jsxs("div",{className:`prep__r prep__r--${F}`,children:[c.jsx("span",{className:"prep__m","aria-hidden":"true",children:F==="done"?"✓":F==="now"?"◐":"○"}),U]},U))}),c.jsxs("span",{className:"setup__note",children:["Nada para rodar no terminal: o adaptador é instalado ",c.jsx("b",{children:"dentro da pasta do app"})," e fixado numa versão — nunca ",c.jsx("code",{children:"@latest"}),", para uma atualização de madrugada não mudar o comportamento do agente."]})]})}function he(){var U;const L=((U=x.data)==null?void 0:U.authMethods)??[],T=L.filter(F=>F.type==="terminal"&&F.command!==null);return T.length===0?c.jsxs(c.Fragment,{children:[c.jsxs(Re,{tone:"warning",children:["O adaptador não ofereceu nenhuma forma de entrar que o Lumem saiba executar",L.length>0&&c.jsxs(c.Fragment,{children:[" — ele listou ",L.length,", de outro tipo"]}),"."]}),c.jsx(pe,{size:"sm",variant:"ghost",onClick:()=>void C(),children:"verificar de novo"})]}):c.jsxs(c.Fragment,{children:[T.map((F,me)=>c.jsxs("button",{type:"button",className:me===0?"opt opt--primary":"opt",disabled:z.isPending,onClick:()=>z.mutate(F.id),children:[c.jsxs("span",{className:"opt__t",children:[c.jsx("span",{className:"opt__g","aria-hidden":"true",children:me===0?"◆":"⌘"}),F.name]}),c.jsx("span",{className:"opt__d",children:F.description??"abre o navegador"})]},F.id)),c.jsxs("span",{className:"setup__note",children:["Estas opções vieram ",c.jsx("b",{children:"do próprio adaptador"}),", no handshake. O Lumem não inventa método de login."]}),z.isError&&c.jsx(Re,{tone:"danger",children:z.error.message})]})}function de(){return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"prep",children:[c.jsxs("div",{className:"prep__r prep__r--done",children:[c.jsx("span",{className:"prep__m","aria-hidden":"true",children:"✓"}),"adaptador de pé"]}),c.jsxs("div",{className:"prep__r prep__r--now",children:[c.jsx("span",{className:"prep__m","aria-hidden":"true",children:"◐"}),"autorize no navegador e volte"]})]}),j.output.length>0&&c.jsx("div",{className:"out out--short",children:j.output.map((L,T)=>c.jsx("span",{className:"l",children:L},T))}),c.jsx("div",{className:"setup__acts",children:c.jsx(pe,{size:"sm",variant:"ghost",onClick:()=>_(null),children:"cancelar"})}),c.jsx("span",{className:"setup__note",children:"Terminou lá? Este painel muda sozinho — quem confirma é o adaptador respondendo, não você dizendo que entrou."})]})}function ge(){var T;const L=x.data;return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"acct",children:[c.jsxs("div",{className:"acct__r",children:[c.jsx("span",{className:"acct__k",children:"agente"}),c.jsxs("span",{className:"acct__v",children:[c.jsx("b",{children:((T=L==null?void 0:L.agentInfo)==null?void 0:T.title)??(b==null?void 0:b.name)}),(L==null?void 0:L.agentInfo)!==null&&(L==null?void 0:L.agentInfo)!==void 0&&c.jsxs(c.Fragment,{children:[" · ",L.agentInfo.version]})]})]}),c.jsxs("div",{className:"acct__r",children:[c.jsx("span",{className:"acct__k",children:"entrada"}),c.jsx("span",{className:"acct__v",children:(L==null?void 0:L.authMethods.length)===0?"credencial local, já válida":"credencial local"})]}),c.jsxs("div",{className:"acct__r",children:[c.jsx("span",{className:"acct__k",children:"padrão"}),c.jsx("span",{className:"acct__v",children:(L==null?void 0:L.currentMode)??"o padrão do agente"})]})]}),c.jsxs("div",{className:"setup__acts",children:[c.jsx(pe,{size:"sm",variant:"ghost",onClick:()=>void C(),children:"verificar de novo"}),c.jsx("button",{type:"button",className:"linkbtn",onClick:()=>h(!0),children:"avançado"}),c.jsx("button",{type:"button",className:"linkbtn",onClick:()=>a(!0),children:"outro agente ACP…"})]}),c.jsxs("span",{className:"setup__note",children:["Trocar de conta é ",c.jsx("code",{children:"claude /logout"})," no seu terminal: este adaptador não declara a capacidade ",c.jsx("code",{children:"auth.logout"}),", então um botão aqui não faria nada."]})]})}function G(){return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"acct",children:[c.jsxs("div",{className:"acct__r",children:[c.jsx("span",{className:"acct__k",children:"comando"}),c.jsx("span",{className:"acct__v",children:(b==null?void 0:b.command)??"—"})]}),c.jsxs("div",{className:"acct__r",children:[c.jsx("span",{className:"acct__k",children:"args"}),c.jsx("span",{className:"acct__v",children:b!=null&&b.args.length?b.args.join(" "):"nenhum"})]}),c.jsxs("div",{className:"acct__r",children:[c.jsx("span",{className:"acct__k",children:"versão"}),c.jsx("span",{className:"acct__v",children:(b==null?void 0:b.adapterVersion)??"não fixada"})]})]}),c.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 ",c.jsx("b",{children:"outro agente ACP…"})," e crie a sua."]}),c.jsx("button",{type:"button",className:"linkbtn",onClick:()=>h(!1),children:"voltar"})]})}function K(L){return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"fail",children:[c.jsxs("span",{className:"fail__title",children:[c.jsx("span",{"aria-hidden":"true",children:"✕"}),"não deu para conectar"]}),c.jsx("span",{className:"fail__body",children:"O adaptador não respondeu ao handshake. O que ele disse está abaixo."}),c.jsx("div",{className:"fail__cmd",children:L})]}),c.jsxs("div",{className:"setup__acts",children:[c.jsx(pe,{size:"sm",variant:"primary",onClick:()=>N.mutate(),children:"tentar de novo"}),c.jsx("button",{type:"button",className:"linkbtn",onClick:()=>a(!0),children:"outro agente ACP…"})]})]})}}const aw=[{id:"1d",label:"1d"},{id:"7d",label:"7d"},{id:"1m",label:"1m"},{id:"6m",label:"6m"},{id:"1y",label:"1a"}];function XN(e,t){return Ae({queryKey:nE(e,t),queryFn:()=>ie.usage.byProject.query({workspaceId:e,period:t})})}function JN(e,t){return Ae({queryKey:aE(e,t),queryFn:()=>ie.usage.byWorktree.query({projectId:e,period:t})})}function eT(e){return Ae({queryKey:Xk(e.workspaceId,e.projectId),queryFn:()=>ie.memory.list.query({...e.workspaceId?{workspaceId:e.workspaceId}:{},...e.projectId?{projectId:e.projectId}:{}})})}function op(e="pending"){return Ae({queryKey:Jk(e),queryFn:()=>ie.memory.proposals.query({status:e})})}function tT(e,t){const i=t.trim();return Ae({queryKey:tE(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 sT(){return Ae({queryKey:sE,queryFn:()=>ie.memory.decisions.query()})}function iT(e){return Ae({queryKey:eE(e.workspaceId,e.projectId),queryFn:()=>ie.memory.core.query({...e.workspaceId?{workspaceId:e.workspaceId}:{},...e.projectId?{projectId:e.projectId}:{}})})}function rT(){const e=Ye();return Ve({mutationFn:t=>ie.memory.pin.mutate(t),onSuccess:()=>e.invalidateQueries({queryKey:["memory"]})})}function nT(){return Ae({queryKey:rE,queryFn:()=>ie.memory.settings.query()})}function aT(e){const t=e.archived??!1;return Ae({queryKey:oE(e.workspaceId,t),queryFn:()=>ie.memory.playbooks.query({...e.workspaceId?{workspaceId:e.workspaceId}:{},archived:t})})}function oT(){const e=Ye();return Ve({mutationFn:t=>ie.memory.archivePlaybook.mutate(t),onSuccess:()=>e.invalidateQueries({queryKey:["memory"]})})}function lT(){return Ae({queryKey:iE,queryFn:()=>ie.memory.usage.query()})}function cT(){const e=Ye(),t=()=>e.invalidateQueries({queryKey:["memory"]}),i=Ve({mutationFn:a=>ie.memory.approveProposal.mutate(a),onSuccess:t}),n=Ve({mutationFn:a=>ie.memory.rejectProposal.mutate(a),onSuccess:t});return{approve:i,reject:n}}const uT=[{id:"entries",label:"Memória"},{id:"inbox",label:"Propostas"},{id:"playbooks",label:"Playbooks"},{id:"timeline",label:"Histórico"},{id:"numbers",label:"Números"}];function ow({workspaceId:e,projectId:t,tab:i,onTabChange:n}){const[a,l]=k.useState("entries"),h=i??a,d=v=>{l(v),n==null||n(v)},_=eT({workspaceId:e,projectId:t}),m=iT({workspaceId:e,projectId:t});return op("pending"),c.jsxs("section",{className:"mem-panel","aria-label":"Memória do workspace",children:[c.jsx("header",{className:"mem-head",children:c.jsx("div",{role:"tablist","aria-label":"Vistas da memória",className:"mem-tabs",children:uT.map(v=>c.jsx("button",{type:"button",role:"tab",id:`mem-tab-${v.id}`,"aria-selected":h===v.id,"aria-controls":"mem-panel-body",className:`mem-tab${h===v.id?" mem-tab--active":""}`,onClick:()=>{d(v.id)},children:v.label},v.id))})}),c.jsxs("div",{className:"mem-body",id:"mem-panel-body",role:"tabpanel","aria-labelledby":`mem-tab-${h}`,children:[h==="entries"?c.jsx(hT,{query:_,core:m,scope:{workspaceId:e,projectId:t}}):null,h==="inbox"?c.jsx(pT,{}):null,h==="playbooks"?c.jsx(NT,{workspaceId:e,projectId:t}):null,h==="timeline"?c.jsx(jT,{}):null,h==="numbers"?c.jsx(OT,{core:m}):null]})]})}const N0=4e3,lw={low:"baixa",medium:"média",high:"alta"},Jm={human:"você",agent:"agente",distiller:"destilação",auto_research:"auto-learn",import:"importação"},lp={global:"você · atravessa workspace",workspace:"workspace",project:"projeto"};function hT({query:e,core:t,scope:i}){var S;const[n,a]=k.useState(""),l=tT(i,n),h=c.jsx("div",{className:"mem-find",children:c.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 c.jsxs(c.Fragment,{children:[h,c.jsx(fT,{found:l})]});if(e.isPending)return c.jsx("p",{className:"mem-meta",children:"carregando…"});if(e.isError)return c.jsx(vs,{title:"Não deu para ler a memória",children:e.error.message});const{entries:d,shadowed:_}=e.data;if(d.length===0)return c.jsx(vs,{title:"Nada aprendido ainda",children:"A memória aparece aqui quando algo durável for salvo."});const m=new Map;for(const x of _)m.set(x.winner,[...m.get(x.winner)??[],x.identity]);const v=new Map((((S=t.data)==null?void 0:S.entries)??[]).map(x=>[x.path,x.chars])),b=["project","workspace","global"].map(x=>({scope:x,rows:d.filter(C=>C.scope===x)})).filter(x=>x.rows.length>0);return c.jsxs(c.Fragment,{children:[h,b.map(x=>c.jsxs("section",{children:[c.jsxs("h3",{className:"mem-group__t",children:[c.jsx("span",{className:"mem-scope","data-scope":x.scope,children:lp[x.scope]??x.scope}),c.jsx("span",{className:"mem-group__n",children:x.rows.length})]}),c.jsx("ul",{className:"mem-list",children:x.rows.map(C=>{var j;return c.jsxs("li",{className:"mem-item",children:[c.jsx(mT,{entry:C}),c.jsx("p",{className:"mem-desc",children:C.description}),c.jsxs("p",{className:"mem-meta",children:[c.jsx("span",{children:Jm[C.sourceActor]??C.sourceActor}),c.jsxs("span",{children:["confiança ",lw[C.confidence]??C.confidence]}),c.jsx(dT,{entry:C}),C.pinned&&v.get(C.path)!==void 0?c.jsxs("span",{className:"mem-pin-cost",children:[(v.get(C.path)??0).toLocaleString("pt-BR")," car."]}):null]}),(j=m.get(C.path))==null?void 0:j.map(N=>c.jsxs("p",{className:"mem-shadow-note",children:["sombreia ",c.jsx("strong",{children:N})," — continua no disco"]},N))]},C.path)})})]},x.scope))]})}function dT({entry:e}){const t=rT();return c.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 fT({found:e}){return e.isPending?c.jsx("p",{className:"mem-meta",children:"buscando…"}):e.isError?c.jsx(vs,{title:"Não deu para buscar",children:e.error.message}):e.data.skipped==="trivial_query"?c.jsx(vs,{title:"Busca não realizada",children:"Menos de dois termos significativos — dizer que não buscou é diferente de dizer que não achou."}):c.jsxs(c.Fragment,{children:[e.data.staleIndex?c.jsx("p",{className:"mem-stale",children:"índice desatualizado — o resultado pode estar curto"}):null,e.data.hits.length===0?c.jsx(vs,{title:"Nada encontrado",children:"Nenhuma memória casa com esses termos no escopo ativo."}):c.jsx("ul",{className:"mem-list",children:e.data.hits.map(t=>c.jsxs("li",{className:"mem-item",children:[c.jsxs("p",{className:"mem-row",children:[c.jsx("span",{className:"mem-scope","data-scope":t.entry.scope,children:lp[t.entry.scope]??t.entry.scope}),c.jsx("span",{className:"mem-kind",children:t.entry.type}),c.jsx("span",{className:"mem-name",children:t.entry.name})]}),c.jsx("p",{className:"mem-desc",children:t.entry.description}),c.jsx("p",{className:"mem-why",children:t.why.map(i=>c.jsx("span",{children:i},i))})]},t.entry.path))})]})}function mT({entry:e}){return c.jsxs("p",{className:"mem-row",children:[c.jsx("span",{className:"mem-kind",children:e.type}),c.jsx("span",{className:"mem-name",children:e.name})]})}const _T=[{id:"pending",label:"Pendentes"},{id:"resolved",label:"Resolvidas"}];function pT(){const[e,t]=k.useState("pending"),i=op(e);return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"mem-seg",role:"group","aria-label":"Propostas por estado",children:_T.map(n=>c.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))}),c.jsx(vT,{query:i,status:e})]})}function vT({query:e,status:t}){return e.isPending?c.jsx("p",{className:"mem-meta",children:"carregando…"}):e.isError?c.jsx(vs,{title:"Não deu para ler as propostas",children:e.error.message}):e.data.length===0?t==="pending"?c.jsx(vs,{title:"Nenhuma proposta pendente",children:"Escrita de workspace feita por agente cai aqui antes de valer."}):c.jsx(vs,{title:"Nada decidido ainda",children:"Aprovar ou rejeitar move a proposta para cá — recusar é histórico, não apagamento."}):c.jsx("ul",{className:"mem-list",children:e.data.map(i=>c.jsx("li",{className:"mem-item",children:i.status==="pending"?c.jsx(yT,{proposal:i}):c.jsx(xT,{proposal:i})},i.id))})}function gT({current:e,proposal:t}){return c.jsxs("div",{className:"mem-conflict",children:[c.jsxs("p",{className:"mem-conflict__t",children:[c.jsx("span",{className:"mem-warn",children:"conflito no mesmo escopo"}),"já existe memória aqui — aprovar substitui"]}),c.jsxs("div",{className:"mem-split",children:[c.jsxs("div",{children:[c.jsx("strong",{children:"A que está valendo"}),c.jsx("p",{className:"mem-desc",children:e.description}),c.jsxs("p",{className:"mem-meta",children:[c.jsx("span",{children:Jm[e.sourceActor]??e.sourceActor}),c.jsxs("span",{children:["confiança ",lw[e.confidence]??e.confidence]})]})]}),c.jsxs("div",{children:[c.jsx("strong",{children:"A que chegou"}),c.jsx("p",{className:"mem-desc",children:t.description}),c.jsxs("p",{className:"mem-meta",children:[c.jsx("span",{children:Jm[t.actor]??t.actor}),c.jsx("span",{children:t.evidence===null?"sem evidência":"com evidência"})]})]})]})]})}function yT({proposal:e}){const{approve:t,reject:i}=cT(),[n,a]=k.useState("none");return c.jsxs(c.Fragment,{children:[c.jsx(cw,{proposal:e}),c.jsx("p",{className:"mem-desc",children:e.description}),c.jsx("pre",{className:"mem-body-text",children:e.body===""?"(sem corpo — só nome e descrição)":e.body}),c.jsx(wT,{proposal:e}),e.current===null?null:c.jsx(gT,{current:e.current,proposal:e}),n==="edit"?c.jsx(bT,{proposal:e,approve:t,onCancel:()=>{a("none")}}):n==="reject"?c.jsx(ST,{proposal:e,reject:i,onCancel:()=>{a("none")}}):c.jsxs("div",{className:"mem-actions",children:[c.jsx(pe,{variant:"primary",disabled:t.isPending,onClick:()=>{t.mutate({id:e.id})},children:"Aprovar"}),c.jsx(pe,{onClick:()=>{a("edit")},children:"Editar e aprovar"}),c.jsx(pe,{variant:"ghost",onClick:()=>{a("reject")},children:"Rejeitar"})]}),t.isError?c.jsxs(Re,{tone:"danger",children:["não deu para aprovar: ",t.error.message]}):null,i.isError?c.jsxs(Re,{tone:"danger",children:["não deu para rejeitar: ",i.error.message]}):null]})}function bT({proposal:e,approve:t,onCancel:i}){const[n,a]=k.useState(e.name),[l,h]=k.useState(e.description),[d,_]=k.useState(e.body),m=n.trim()===""||l.trim()==="";return c.jsxs("div",{className:"mem-form",children:[c.jsx(as,{id:`prop-${e.id}-name`,label:"Nome",children:c.jsx(ps,{id:`prop-${e.id}-name`,value:n,onChange:v=>{a(v.target.value)}})}),c.jsx(as,{id:`prop-${e.id}-description`,label:"Descrição",children:c.jsx(ps,{id:`prop-${e.id}-description`,value:l,onChange:v=>{h(v.target.value)}})}),c.jsx(as,{id:`prop-${e.id}-body`,label:"Corpo",children:c.jsx("textarea",{id:`prop-${e.id}-body`,className:"mem-textarea",rows:6,value:d,onChange:v=>{_(v.target.value)}})}),c.jsxs("div",{className:"mem-actions",children:[c.jsx(pe,{variant:"primary",disabled:t.isPending||m,onClick:()=>{t.mutate({id:e.id,...n===e.name?{}:{name:n},...l===e.description?{}:{description:l},...d===e.body?{}:{body:d}})},children:"Aprovar com edição"}),c.jsx(pe,{variant:"ghost",onClick:i,children:"Cancelar"})]})]})}function ST({proposal:e,reject:t,onCancel:i}){const[n,a]=k.useState("");return c.jsxs("div",{className:"mem-form",children:[c.jsx(Re,{tone:"warning",children:"Rejeitar não tem volta: a proposta fica no histórico como recusada, e não há como reabri-la."}),c.jsx(as,{id:`prop-${e.id}-note`,label:"Por que não? (fica registrado)",children:c.jsx(ps,{id:`prop-${e.id}-note`,value:n,maxLength:500,placeholder:"isso é regra do api, não do produto",onChange:l=>{a(l.target.value)}})}),c.jsxs("div",{className:"mem-actions",children:[c.jsx(pe,{variant:"danger",disabled:t.isPending,onClick:()=>{t.mutate({id:e.id,...n.trim()===""?{}:{note:n.trim()}})},children:"Rejeitar"}),c.jsx(pe,{variant:"ghost",onClick:i,children:"Cancelar"})]})]})}function xT({proposal:e}){return c.jsxs(c.Fragment,{children:[c.jsx(cw,{proposal:e}),c.jsx("p",{className:"mem-desc",children:e.description}),c.jsxs("p",{className:"mem-meta",children:[c.jsx("span",{className:"mem-verdict","data-status":e.status,children:e.status==="approved"?"aprovada":"rejeitada"}),c.jsxs("span",{children:["proposta por ",e.actor]}),e.resolvedAt===null?null:c.jsx("span",{children:uw(e.resolvedAt)})]}),e.resolutionNote===null?null:c.jsx("p",{className:"mem-shadow-note",children:e.resolutionNote})]})}function wT({proposal:e}){return c.jsxs("div",{className:"mem-evidence",children:[e.evidence===null?c.jsxs(c.Fragment,{children:[c.jsx("strong",{children:"Sem evidência verificável"})," — o agente concluiu. Conclusão vira proposta; fato vira memória."]}):c.jsxs(c.Fragment,{children:[c.jsx("strong",{children:"Evidência"})," — ",c.jsx("code",{children:e.evidence})]}),c.jsx("br",{}),"proposta por ",c.jsx("strong",{children:e.actor}),e.fromProjectId===null?null:c.jsxs(c.Fragment,{children:[" · projeto ",e.fromProjectId]})]})}function cw({proposal:e}){return c.jsxs("p",{className:"mem-row",children:[c.jsx("span",{className:"mem-scope","data-scope":e.scope,children:e.scope==="global"?"você":e.scope}),c.jsx("span",{className:"mem-kind",children:e.type}),c.jsx("span",{className:"mem-name",children:e.name})]})}const CT={applied:"aprendeu",rejected:"recusou",noop:"nada a fazer"};function jT(){const e=sT();return e.isPending?c.jsx("p",{className:"mem-meta",children:"carregando…"}):e.isError?c.jsx(vs,{title:"Não deu para ler o histórico",children:e.error.message}):e.data.length===0?c.jsx(vs,{title:"Nada decidido ainda",children:"Cada escrita — e cada recusa — aparece aqui."}):c.jsx("ol",{className:"mem-tl",children:e.data.map(t=>c.jsxs("li",{className:"mem-tl-item","data-outcome":t.outcome,children:[c.jsx("span",{className:"mem-tl-when",children:kT(t)}),c.jsx("span",{className:"mem-tl-dot",children:t.outcome==="rejected"?"▲":"●"}),c.jsxs("span",{children:[c.jsx("span",{className:"mem-tl-verb",children:CT[t.outcome]??t.outcome})," ",c.jsx("span",{children:t.path}),t.reason===null?null:c.jsxs(c.Fragment,{children:[" — ",c.jsx("em",{children:t.reason})]})]})]},t.id))})}function kT(e){return uw(e.createdAt)}function uw(e){return new Date(e).toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})}const ET={active:"ativo",stale:"parado",archived:"arquivado"};function NT({workspaceId:e,projectId:t}){var h,d;const[i,n]=k.useState(!1),a=aT({workspaceId:e,archived:i}),l=oT();return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"mem-seg",role:"group","aria-label":"Vista dos playbooks",children:[{label:"ativos",value:!1},{label:"arquivados",value:!0}].map(_=>c.jsx("button",{type:"button",className:`mem-seg__item${i===_.value?" mem-seg__item--active":""}`,"aria-pressed":i===_.value,onClick:()=>n(_.value),children:_.label},_.label))}),a.isPending?c.jsx("p",{className:"mem-meta",children:"carregando…"}):null,a.isError?c.jsx(vs,{title:"Não deu para ler os playbooks",children:a.error.message}):null,((h=a.data)==null?void 0:h.length)===0?c.jsx(vs,{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(_=>c.jsxs("div",{className:"pb",children:[c.jsxs("p",{className:"pb__row",children:[c.jsx("span",{className:"life","data-life":_.lifecycle,children:ET[_.lifecycle]??_.lifecycle}),c.jsx("span",{className:"pb__class",children:_.taskClass})]}),c.jsx("p",{className:"pb__desc",children:_.description}),c.jsxs("p",{className:"pb__use",children:[c.jsxs("span",{className:"pb__loads",children:[_.loads,"×"]}),c.jsx("span",{children:_.lastLoadedAt===null?"nunca carregado":TT(_.lastLoadedAt)}),c.jsx("span",{className:"mem-scope","data-scope":_.scope,children:lp[_.scope]??_.scope}),c.jsx("button",{type:"button",className:"pb__act focus-ring",disabled:l.isPending,onClick:()=>l.mutate({path:_.path,archived:!_.archived}),children:_.archived?"desarquivar":"arquivar"})]}),_.lifecycle==="stale"?c.jsx("p",{className:"pb__suggest",children:"parado há muito tempo — talvez o procedimento tenha mudado. Arquivar não apaga: carregar de novo reativa."}):null]},_.path))]})}function TT(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 OT({core:e}){const t=lT(),i=nT();if(t.isPending)return c.jsx("p",{className:"mem-meta",children:"carregando…"});if(t.isError)return c.jsx(vs,{title:"Não deu para ler os números",children:t.error.message});const n=e.data;return c.jsxs("div",{className:"mem-stats",children:[n!==void 0&&n.entries.length>0?c.jsxs("div",{className:`mem-stat${n.chars>N0?" mem-stat--warn":""}`,children:[c.jsx("div",{className:"n",children:n.chars.toLocaleString("pt-BR")}),c.jsx("div",{className:"l",children:"caracteres no núcleo"}),c.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>N0?" · hora de consolidar":""]})]}):null,i.data!==void 0?c.jsxs("div",{className:"mem-stat",children:[c.jsx("div",{className:"n",children:i.data.distill?"on":"off"}),c.jsx("div",{className:"l",children:"destilação de fim de sessão"}),c.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?c.jsxs("div",{className:"mem-stat",children:[c.jsx("div",{className:"n",children:i.data.autoLearn?"on":"off"}),c.jsx("div",{className:"l",children:"pesquisa automática"}),c.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=>c.jsxs("div",{className:"mem-stat",children:[c.jsx("div",{className:"n",children:a.events}),c.jsxs("div",{className:"l",children:[a.kind," · ",a.totalAmount," no total · ",a.averageDurationMs," ms"]})]},a.kind)),t.data.length===0?c.jsxs("div",{className:"mem-stat",children:[c.jsx("div",{className:"n",children:"0"}),c.jsx("div",{className:"l",children:"uso registrado"}),c.jsx("div",{className:"hint",children:"os números aparecem depois da primeira busca"})]}):null]})}function T0(e,t){return t<=0?"0%":`${(Math.min(1,Math.max(0,e/t))*100).toFixed(2)}%`}function e_(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 O0(e,t){return`${t==="USD"?"US$":`${t} `} ${e.toFixed(4).replace(".",",")}`}function AT(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 RT(e){if(!e)return"quiet";if(e.isUsingOverage)return"over";const t=e.surpassedThreshold;return t!=null&&e.utilization>=t?"warn":"quiet"}function MT({usage:e,now:t=Date.now()}){var a;const{rateLimit:i}=e,n=RT(i);return c.jsxs(c.Fragment,{children:[n==="over"&&c.jsxs("div",{className:"overage",role:"status",children:[c.jsx("span",{"aria-hidden":"true",children:"⚠"}),c.jsxs("span",{children:["Você entrou no ",c.jsx("b",{children:"overage"})," do ciclo. A partir daqui a sessão cobra fora da assinatura."]})]}),c.jsxs("div",{className:"usage",children:[c.jsxs("span",{className:"u",children:[c.jsx("span",{className:"u__k",children:"janela"}),e_(e.used)," / ",e_(e.size),c.jsx(A0,{fraction:T0(e.used,e.size)})]}),c.jsxs("span",{className:`u${e.cost?" u--cost":""}`,children:[c.jsx("span",{className:"u__k",children:"turno"}),e.cost?O0(e.cost.amount,e.cost.currency):"—",e.currency&&e.totalCost>(((a=e.cost)==null?void 0:a.amount)??0)&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"u__k",children:"sessão"}),O0(e.totalCost,e.currency)]})]}),c.jsx("span",{className:"usage__spacer"}),i&&c.jsxs("span",{className:`u${n==="quiet"?"":` u--${n}`}`,children:[c.jsx("span",{className:"u__k",children:"assinatura"}),Math.round(i.utilization*100),"%",c.jsx(A0,{fraction:T0(i.utilization,1)}),i.isUsingOverage?"em overage":i.resetsAt!==null&&i.resetsAt!==void 0?AT(i.resetsAt,t):null]})]})]})}function A0({fraction:e}){return c.jsx("span",{className:"meter","data-fill":e,children:c.jsx("span",{className:"meter__f",style:{"--w":e}})})}function hw({rows:e}){const t=Math.max(...e.map(i=>i.tokens),0);return c.jsx("div",{className:"spend",children:e.map(i=>c.jsxs("div",{className:`spend__row${i.tokens===0?" spend__row--idle":""}${i.outside===!0?" spend__row--outside":""}`,children:[c.jsx(at,{tone:i.tokens===0?"off":i.kind,children:i.kind==="worktree"?"◫":"▣"}),c.jsx("span",{className:"spend__name",children:i.name}),c.jsx("span",{className:"spend__bar",children:t>0&&i.tokens>0&&c.jsx("span",{className:"spend__fill",style:{"--w":`${String(Math.round(i.tokens/t*100))}%`}})}),c.jsx("span",{className:"spend__tok",children:e_(i.tokens)}),i.cost===null?c.jsx("span",{className:"spend__cost spend__cost--none",children:"sem custo reportado"}):c.jsx("span",{className:"spend__cost",children:DT(i.cost,i.currency)}),c.jsx("span",{className:"spend__turns",children:i.turns===0?"nenhum turno":`${String(i.turns)} turnos`})]},i.id))})}function DT(e,t){const i=e.toFixed(4).replace(".",",");return t==="USD"||t===null?`US$ ${i}`:`${t} ${i}`}function BT({workspaceId:e,workspaceName:t,onRemoved:i}){const[n,a]=k.useState("7d"),l=Ae({queryKey:ca(e),queryFn:()=>ie.project.listByWorkspace.query({workspaceId:e})}),h=XN(e,n),d=l.data??[],_=(h.data??[]).map(m=>({id:m.projectId,name:m.name,tokens:m.tokens,cost:m.cost,currency:m.currency,turns:m.turns,kind:"project"}));return c.jsxs("div",{className:"pane wsp",children:[c.jsxs("div",{className:"detail__title",children:[c.jsx("h2",{children:t}),c.jsx("span",{className:"wsp__kind",children:"workspace"}),c.jsx("span",{className:"actions__spacer"}),c.jsx(LT,{id:e,name:t}),c.jsx(zT,{id:e,projects:l.isPending?"unknown":d.length,onRemoved:i})]}),c.jsx("div",{className:"chips",children:c.jsxs(Ft,{children:[d.length," ",d.length===1?"projeto":"projetos"]})}),l.isError&&c.jsx("div",{className:"detail__banner",children:c.jsx(Re,{tone:"danger",children:l.error.message})}),l.isPending?c.jsx(gi,{label:"carregando os projetos",widths:["70%","50%"]}):d.length===0?c.jsx(vs,{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."}):c.jsx(ha,{entries:[{label:"projetos",value:String(d.length)},{label:"sem diretório",value:d.filter(m=>!m.available).length===0?c.jsx("span",{className:"dim",children:"nenhum"}):`${String(d.filter(m=>!m.available).length)} de ${String(d.length)}`}]}),c.jsxs("section",{className:"section",children:[c.jsx(xh,{title:"Consumo",aside:c.jsx("div",{className:"seg",role:"group","aria-label":"Janela de tempo do consumo",children:aw.map(m=>c.jsx("button",{type:"button",className:"seg__btn","aria-pressed":n===m.id,onClick:()=>a(m.id),children:m.label},m.id))})}),h.isError?c.jsx(Re,{tone:"danger",children:h.error.message}):h.isPending?c.jsx(gi,{label:"somando o consumo",widths:["90%","70%"]}):_.length===0?c.jsx("p",{className:"detail__hint",children:"nada gasto ainda neste workspace"}):c.jsx(hw,{rows:_})]}),c.jsx("section",{className:"section",children:c.jsx(ow,{workspaceId:e,projectId:null})})]})}function LT({id:e,name:t}){const[i,n]=k.useState(!1),[a,l]=k.useState(t),h=Ye(),d=Ve({mutationFn:_=>ie.workspace.rename.mutate({id:e,name:_}),onSuccess:async()=>{await h.invalidateQueries({queryKey:mr}),n(!1)}});return i?c.jsxs("form",{className:"wsp__rename",onSubmit:_=>{_.preventDefault();const m=a.trim();if(m===""||m===t){n(!1);return}d.mutate(m)},children:[c.jsx("input",{className:"wsp__input focus-ring","aria-label":"Nome do workspace",value:a,autoFocus:!0,onChange:_=>l(_.target.value),onKeyDown:_=>{_.key==="Escape"&&n(!1)}}),c.jsx(pe,{variant:"primary",size:"sm",type:"submit",disabled:d.isPending,children:"salvar"}),d.isError&&c.jsx(Re,{tone:"danger",children:d.error.message})]}):c.jsx(pe,{variant:"ghost",size:"sm",onClick:()=>{l(t),n(!0)},children:"renomear"})}function zT({id:e,projects:t,onRemoved:i}){const n=Ye(),a=Ve({mutationFn:()=>ie.workspace.remove.mutate({id:e}),onSuccess:async()=>{await n.invalidateQueries({queryKey:mr}),i()}});return c.jsxs(c.Fragment,{children:[c.jsx(pe,{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&&c.jsxs("span",{className:"wsp__why",children:[t," ",t===1?"projeto dentro":"projetos dentro"]}),a.isError&&c.jsx(Re,{tone:"danger",children:a.error.message})]})}function dw(e,t="worktree"){return Ae({queryKey:Qk(e.scopeType,e.scopeId,t),queryFn:()=>ie.changes.list.query({scopeType:e.scopeType,scopeId:e.scopeId,ref:t}),refetchOnWindowFocus:!0})}function fw(e){switch(e){case"added":return"A";case"modified":return"M";case"deleted":return"D";case"renamed":return"R";case"untracked":return"?"}}function mw(e){switch(e){case"added":return"a";case"deleted":return"d";case"untracked":return"u";default:return"m"}}const t_=new Set;function qT(e){t_.add(e);const t=()=>t_.delete(e);e.then(t,t)}async function PT(){await Promise.allSettled([...t_])}function R0(e,t,i){return`${e}:${t}:${i??"context"}`}const _w=k.createContext(null);function HT({children:e}){const[t,i]=k.useState(null),[n,a]=k.useState({}),l=k.useCallback(_=>{a(m=>t===null?m:{...m,[t]:_})},[t]),h=k.useCallback(_=>{a(m=>{if(!(_ in m))return m;const v={...m};return delete v[_],v})},[]),d=k.useMemo(()=>({activeTab:t,setActiveTab:i,fileFor:_=>n[_]??null,open:l,close:h}),[t,n,l,h]);return c.jsx(_w.Provider,{value:d,children:e})}function cp(){const e=k.useContext(_w);if(e===null)throw new Error("useOpenFiles precisa de um OpenFilesProvider acima");return e}function Lu(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function M0(e,t){return t===e||t.startsWith(`${e}/`)}function IT(e){var he,de,ge;const t=Ye(),i=cp(),[n,a]=k.useState({kind:"idle"}),l=i.activeTab,h=l===null?null:i.fileFor(l),d=h!==null&&h.view==="file"?h.path:null,_=k.useRef(null),[m,v]=k.useState(0);k.useEffect(()=>{const G=_.current;G!==null&&(_.current=null,PT().then(G))},[m]);const g=k.useCallback(G=>{if(l===null){G();return}_.current=G,i.close(l),v(K=>K+1)},[i,l]),b=k.useCallback((...G)=>{t.invalidateQueries({queryKey:["changes"]});for(const K of new Set(G))t.invalidateQueries({queryKey:J_(e.scopeType,e.scopeId,K)})},[t,e.scopeType,e.scopeId]),S=Ve({mutationFn:G=>ie.files.create.mutate({scopeType:e.scopeType,scopeId:e.scopeId,path:G.path,kind:G.kind}),onSuccess:G=>{b(Lu(G.path)),a({kind:"idle"})}}),x=Ve({mutationFn:G=>ie.files.rename.mutate({scopeType:e.scopeType,scopeId:e.scopeId,from:G.from,to:G.to}),onSuccess:(G,K)=>{if(b(Lu(K.from),Lu(G.path)),K.reopen!==null){const se=K.reopen.slice(K.from.length);i.open({path:`${G.path}${se}`,view:"file"})}a({kind:"idle"})},onError:(G,K)=>{K.reopen!==null&&i.open({path:K.reopen,view:"file"})}}),C=Ve({mutationFn:G=>ie.files.remove.mutate({scopeType:e.scopeType,scopeId:e.scopeId,path:G.path,recursive:G.recursive}),onSuccess:(G,K)=>{b(Lu(K.path)),a({kind:"idle"})},onError:(G,K)=>{K.reopen!==null&&i.open({path:K.reopen,view:"file"})}}),j=n.kind==="delete"?n.path:null,N=Ae({queryKey:Gk(e.scopeType,e.scopeId,j??""),queryFn:()=>ie.files.deletePreview.query({scopeType:e.scopeType,scopeId:e.scopeId,path:j??""}),enabled:j!==null,gcTime:0}),z=S.reset,B=x.reset,M=C.reset,V=k.useCallback(G=>{z(),B(),M(),a(G)},[z,B,M]),ee=k.useCallback(()=>V({kind:"idle"}),[V]),q=k.useCallback(G=>{const K=G.trim();if(K==="")return;if(n.kind==="create"){const U=n.parent;S.mutate({path:U===""?K:`${U}/${K}`,kind:n.makes});return}if(n.kind!=="rename")return;const se=n.path,L=d!==null&&M0(se,d)?d:null,T=()=>x.mutate({from:se,to:K,reopen:L});L===null?T():g(T)},[S,n,g,x,d]),te=k.useCallback(()=>{if(n.kind!=="delete")return;const G=n.path,K=d!==null&&M0(G,d)?d:null,se=()=>C.mutate({path:G,recursive:n.directory,reopen:K});K===null?se():g(se)},[n,g,C,d]);return{gesture:n,ask:V,cancel:ee,refusal:((he=S.error)==null?void 0:he.message)??((de=x.error)==null?void 0:de.message)??((ge=C.error)==null?void 0:ge.message)??null,busy:S.isPending||x.isPending||C.isPending,submit:q,confirm:te,preview:N}}function UT(e){var a,l;const t=Ae({queryKey:X_(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:((l=Ae({queryKey:Yk(i??"-"),queryFn:()=>ie.project.get.query({id:i}),enabled:i!==null}).data)==null?void 0:l.workspaceId)??null,projectId:i}}function FT({scope:e,openPath:t,onOpenPatch:i,onRefChange:n}){var x,C;const[a,l]=k.useState("worktree"),h=dw(e,a),d=a==="base"&&h.isError?h.error.message:null,_=k.useRef("base");k.useEffect(()=>{h.data!==void 0&&(_.current=h.data.baseBranch)},[h.data]);const m=((x=h.data)==null?void 0:x.baseBranch)??_.current,v=((C=h.data)==null?void 0:C.files)??[],g=v.reduce((j,N)=>j+N.additions,0),b=v.reduce((j,N)=>j+N.deletions,0);function S(j){l(j),n==null||n(j)}return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"seg-wrap",children:c.jsxs("div",{className:"seg",role:"group","aria-label":"o que comparar",children:[c.jsx("button",{type:"button",className:`seg__btn${a==="worktree"?" seg__btn--on":""}`,"aria-pressed":a==="worktree",onClick:()=>S("worktree"),children:"não commitado"}),c.jsxs("button",{type:"button",className:`seg__btn${a==="base"?" seg__btn--on":""}${d===null?"":" seg__btn--off"}`,"aria-pressed":a==="base",onClick:()=>S("base"),children:["vs ",m]})]})}),d!==null&&c.jsxs("p",{className:"fnote",role:"alert",children:[c.jsx("span",{className:"fnote__glyph","aria-hidden":"true",children:"⚠"}),c.jsx("span",{children:d})]}),h.isPending?c.jsx("div",{className:"rp__scroll",children:c.jsx("p",{className:"fnote",children:"carregando…"})}):v.length===0&&d===null?$T(a,m):c.jsxs(c.Fragment,{children:[c.jsxs("p",{className:"sum",children:[c.jsxs("span",{children:[v.length," ",v.length===1?"arquivo":"arquivos"]}),g>0&&c.jsxs("span",{className:"plus",children:["+",g]}),b>0&&c.jsxs("span",{className:"minus",children:["−",b]})]}),c.jsx("div",{className:"rp__scroll",children:v.map(j=>c.jsx(KT,{file:j,open:t===j.path,onOpen:()=>i(j.path,a)},j.path))})]})]})}function KT({file:e,open:t,onOpen:i}){const n=e.path.lastIndexOf("/"),a=n===-1?"":e.path.slice(0,n+1),l=e.path.slice(n+1);return c.jsxs("button",{type:"button",className:`drow${t?" drow--open":""}`,onClick:i,children:[c.jsx("span",{className:`mark mark--${mw(e.status)}`,title:e.status,children:fw(e.status)}),c.jsxs("span",{className:"dpath",title:e.path,children:[c.jsx("span",{className:"dpath__dir",children:a}),c.jsx("span",{className:"dpath__name",children:l})]}),e.binary?c.jsx("span",{className:"dstat",children:"binário"}):c.jsxs(c.Fragment,{children:[e.additions>0&&c.jsxs("span",{className:"dstat plus",children:["+",e.additions]}),e.deletions>0&&c.jsxs("span",{className:"dstat minus",children:["−",e.deletions]})]}),e.oldPath!==null&&c.jsxs("span",{className:"drow__was",children:["era ",e.oldPath]}),c.jsx("span",{className:"drow__gap"})]})}function $T(e,t){return c.jsxs("div",{className:"empty",children:[c.jsx("span",{className:"empty__glyph","aria-hidden":"true",children:"✓"}),c.jsx("span",{className:"empty__title",children:e==="worktree"?"nada por commitar":`idêntica a ${t}`}),c.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 up(){const[e,t]=k.useState(!1),i=k.useRef(null),n=k.useRef(null),a=k.useCallback(()=>{t(h=>{var d;return h&&((d=i.current)==null||d.focus()),!1})},[]),l=k.useCallback(()=>t(h=>!h),[]);return k.useEffect(()=>{if(!e)return;const h=_=>{_.key==="Escape"&&a()},d=_=>{var v,g;const m=_.target;((v=n.current)==null?void 0:v.contains(m))!==!0&&((g=i.current)==null?void 0:g.contains(m))!==!0&&t(!1)};return document.addEventListener("keydown",h),document.addEventListener("pointerdown",d),()=>{document.removeEventListener("keydown",h),document.removeEventListener("pointerdown",d)}},[e,a]),{open:e,toggle:l,close:a,triggerRef:i,panelRef:n}}function WT({scope:e,openPath:t,onOpen:i,statusOf:n,edits:a}){const[l,h]=k.useState(new Set),d=k.useCallback(m=>{h(v=>{const g=new Set(v);return g.delete(m)||g.add(m),g})},[]),_=k.useCallback(m=>{h(v=>v.has(m)?v:new Set(v).add(m))},[]);return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"rp__scroll",role:"tree","aria-label":"arquivos",children:c.jsx(pw,{scope:e,path:"",depth:0,expanded:l,onToggle:d,onExpand:_,edits:a,openPath:t,onOpen:i,statusOf:n})}),c.jsx(GT,{edits:a})]})}function pw({scope:e,path:t,depth:i,expanded:n,onToggle:a,onExpand:l,edits:h,openPath:d,onOpen:_,statusOf:m}){const[v,g]=k.useState(void 0),b=Ae({queryKey:[...J_(e.scopeType,e.scopeId,t),v??"default"],queryFn:()=>ie.files.listDir.query({scopeType:e.scopeType,scopeId:e.scopeId,path:t,...v===void 0?{}:{limit:v}}),refetchOnWindowFocus:!0}),S=h.gesture,x=S.kind==="create"&&S.parent===t?c.jsx(D0,{depth:i,label:S.makes==="dir"?"nova pasta":"novo arquivo",initial:"",hint:c.jsxs(c.Fragment,{children:["enter cria em ",c.jsx("code",{children:t===""?"./":`${t}/`})," · esc cancela"]}),edits:h},`${t}:${S.makes}`):null;if(b.isPending)return c.jsxs(c.Fragment,{children:[x,c.jsx("p",{className:"fnote",style:{"--depth":i},children:"carregando…"})]});if(b.isError)return c.jsxs(c.Fragment,{children:[x,c.jsxs("p",{className:"fnote",style:{"--depth":i},role:"alert",children:[c.jsx("span",{className:"fnote__glyph","aria-hidden":"true",children:"⚠"}),c.jsx("span",{children:b.error.message})]})]});const{entries:C,total:j,truncated:N}=b.data;return C.length===0?c.jsxs(c.Fragment,{children:[x,c.jsx("p",{className:"fnote",style:{"--depth":i},children:"vazio"})]}):c.jsxs(c.Fragment,{children:[x,C.map(z=>{const B=t===""?z.name:`${t}/${z.name}`,M=z.kind==="dir",V=n.has(B),ee=m(B);return S.kind==="rename"&&S.path===B?c.jsx(D0,{depth:i,label:"renomear",initial:B,hint:c.jsx(c.Fragment,{children:"com barra, move · esc cancela"}),edits:h},B):c.jsxs("div",{role:"group",children:[c.jsxs("div",{className:"frow-wrap",children:[c.jsxs("button",{type:"button",className:["frow",M?"frow--dir":"",ee==="deleted"?"frow--dim":"",d===B?"frow--open":""].filter(Boolean).join(" "),"aria-expanded":M?V:void 0,onClick:()=>M?a(B):_(B),children:[c.jsx("span",{className:"frow__twist",style:{"--depth":i},"aria-hidden":"true",children:M?V?"▾":"▸":""}),c.jsx("span",{className:"frow__name",children:z.name}),ee!==void 0&&c.jsx("span",{className:`mark mark--${mw(ee)}`,title:ee,children:fw(ee)}),c.jsx("span",{className:"frow__gap"}),z.size!==null&&z.size>0&&c.jsx("span",{className:"frow__size",children:Al(z.size)})]}),c.jsx(YT,{path:B,isDir:M,edits:h,onExpand:l})]}),M&&V&&c.jsx(pw,{scope:e,path:B,depth:i+1,expanded:n,onToggle:a,onExpand:l,edits:h,openPath:d,onOpen:_,statusOf:m})]},B)}),N&&c.jsxs("p",{className:"fnote",style:{"--depth":i},children:[c.jsx("span",{className:"fnote__glyph","aria-hidden":"true",children:"⚠"}),c.jsxs("span",{children:[C.length," de ",j," entradas."," ",c.jsx("button",{type:"button",onClick:()=>g(j),children:"listar assim mesmo"})]})]})]})}function VT({edits:e}){const t=up(),i=n=>()=>{t.close(),e.ask({kind:"create",parent:"",makes:n})};return c.jsxs(c.Fragment,{children:[c.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&&c.jsx("div",{className:"rp__menu",ref:t.panelRef,children:c.jsxs(ip,{label:"criar na raiz",children:[c.jsx(hn,{glyph:c.jsx(at,{children:"+"}),onSelect:i("file"),children:"novo arquivo"}),c.jsx(hn,{glyph:c.jsx(at,{children:"▤"}),onSelect:i("dir"),children:"nova pasta"})]})})]})}function YT({path:e,isDir:t,edits:i,onExpand:n}){const a=up(),l=h=>()=>{a.close(),n(e),i.ask({kind:"create",parent:e,makes:h})};return c.jsxs(c.Fragment,{children:[c.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&&c.jsx("div",{className:"frow-menu",ref:a.panelRef,children:c.jsxs(ip,{label:`ações de ${e}`,children:[t&&c.jsxs(c.Fragment,{children:[c.jsx(hn,{glyph:c.jsx(at,{children:"+"}),onSelect:l("file"),children:"novo arquivo"}),c.jsx(hn,{glyph:c.jsx(at,{children:"▤"}),onSelect:l("dir"),children:"nova pasta"}),c.jsx("div",{className:"frow-menu__sep",role:"separator"})]}),c.jsx(hn,{glyph:c.jsx(at,{children:"✎"}),onSelect:()=>{a.close(),i.ask({kind:"rename",path:e})},children:"renomear"}),c.jsx(hn,{glyph:c.jsx(at,{tone:"warn",children:"✕"}),onSelect:()=>{a.close(),i.ask({kind:"delete",path:e,directory:t})},children:"apagar"})]})})]})}function D0({depth:e,label:t,initial:i,hint:n,edits:a}){const[l,h]=k.useState(i),d=a.refusal!==null;return c.jsxs(c.Fragment,{children:[c.jsxs("form",{className:"fedit",onSubmit:_=>{_.preventDefault(),a.submit(l)},children:[c.jsx("span",{className:"frow__twist",style:{"--depth":e},"aria-hidden":"true"}),c.jsx("input",{className:`finput${d?" finput--error":""}`,"aria-label":t,"aria-invalid":d,value:l,autoFocus:!0,disabled:a.busy,onChange:_=>h(_.target.value),onKeyDown:_=>{_.key==="Escape"&&a.cancel()}})]}),c.jsx("p",{className:`fhint${d?" fhint--error":""}`,style:{"--depth":e},role:d?"alert":void 0,children:a.refusal??n})]})}function GT({edits:e}){const{gesture:t,cancel:i}=e;if(k.useEffect(()=>{if(t.kind!=="delete")return;const _=m=>{m.key==="Escape"&&i()};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[t.kind,i]),t.kind!=="delete")return null;const n=e.preview,a=n.data??null,l=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 c.jsx("div",{className:"fdim",role:"dialog","aria-modal":"true","aria-label":`apagar ${t.path}`,children:c.jsxs(Sh,{title:d?"apagar esta pasta e o que tem dentro?":"apagar este arquivo?",children:[c.jsx("code",{className:"fdim__target",children:t.path}),n.isPending&&c.jsx("p",{className:"fdim__note",children:"consultando o git…"}),n.isError&&c.jsxs(Re,{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"&&c.jsx(QT,{path:t.path,tracked:a.tracked}),a!==null&&a.kind==="dir"&&c.jsxs(c.Fragment,{children:[c.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.":""]}),c.jsx(ZT,{path:t.path,files:a.files,untracked:a.untracked,truncated:a.truncated})]}),c.jsxs("div",{className:"fdim__actions",children:[c.jsx(pe,{variant:"ghost",onClick:i,children:"cancelar"}),c.jsx(pe,{variant:"danger",disabled:e.busy,onClick:e.confirm,children:l===null?"apagar":`apagar ${h?"pelo menos ":"as "}${Xr(l)} ${l===1?"entrada":"entradas"}`})]}),e.refusal!==null&&c.jsx(Re,{tone:"danger",children:e.refusal})]})})}function QT({path:e,tracked:t}){return t?c.jsxs(Re,{tone:"info",children:["o git tem uma cópia: ",c.jsxs("code",{children:["git checkout -- ",e]})," traz de volta o que está no índice."]}):c.jsxs(Re,{tone:"danger",children:[c.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 ZT({path:e,files:t,untracked:i,truncated:n}){if(n)return c.jsxs(Re,{tone:"danger",children:[c.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 c.jsxs(Re,{tone:"info",children:["o git tem cópia do que está aqui dentro: ",c.jsxs("code",{children:["git checkout -- ",e]})," traz de volta o que está no índice."]});const a=t-i;return c.jsxs(Re,{tone:"danger",children:[c.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 Al(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1).replace(".",",")} MB`}const vw="lumem.rightPanel",XT=360,JT=260,eO=720;function tO(){const e={open:!1,width:XT};try{const t=window.localStorage.getItem(vw);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"?hp(a):e.width}}catch{return e}}function B0(e){try{window.localStorage.setItem(vw,JSON.stringify(e))}catch{}}function hp(e){return Math.min(eO,Math.max(JT,Math.round(e)))}function sO(){const[e,t]=k.useState(tO),i=k.useCallback(()=>{t(a=>{const l={...a,open:!a.open};return B0(l),l})},[]),n=k.useCallback(a=>{t(l=>{const h={...l,width:hp(a)};return B0(h),h})},[]);return{open:e.open,width:e.width,toggle:i,setWidth:n}}function iO({proposalCount:e=null,tab:t,onSelectTab:i,changeCount:n,actions:a,onReload:l,onClose:h,onResize:d,dock:_,footLeft:m,footRight:v,children:g}){const b=k.useRef(!1),S=k.useRef(null),[x,C]=k.useState(!1),j=k.useCallback(N=>{var B;const z=(B=S.current)==null?void 0:B.getBoundingClientRect().right;z===void 0||!Number.isFinite(N)||d(hp(z-N))},[d]);return k.useEffect(()=>{if(!x)return;const N=B=>{b.current&&(B.preventDefault(),j(B.clientX))},z=()=>{b.current=!1,C(!1)};return window.addEventListener("pointermove",N),window.addEventListener("pointerup",z),()=>{window.removeEventListener("pointermove",N),window.removeEventListener("pointerup",z)}},[x,j]),c.jsxs("aside",{className:"rp","aria-label":"arquivos do checkout",ref:S,children:[c.jsx("span",{className:"rp__grip",role:"separator","aria-orientation":"vertical","aria-label":"largura da coluna",onPointerDown:N=>{N.preventDefault(),b.current=!0,C(!0)}}),c.jsxs("div",{className:"rp__bar",role:"tablist","aria-label":"conteúdo da coluna",children:[c.jsx("button",{type:"button",role:"tab","aria-selected":t==="files",className:`rtab${t==="files"?" rtab--active":""}`,onClick:()=>i("files"),children:"Arquivos"}),c.jsxs("button",{type:"button",role:"tab","aria-selected":t==="changes",className:`rtab${t==="changes"?" rtab--active":""}`,onClick:()=>i("changes"),children:["Mudanças",n!==null&&n>0&&c.jsx("span",{className:"rtab__count",children:n})]}),c.jsxs("button",{type:"button",role:"tab","aria-selected":t==="memory",className:`rtab${t==="memory"?" rtab--active":""}`,onClick:()=>i("memory"),children:["Memória",e!==null&&e>0&&c.jsx("span",{className:"rtab__count",children:e})]}),c.jsx("span",{className:"rp__spacer"}),a,c.jsxs("button",{type:"button",className:"rp__icon",onClick:l,title:"recarregar",children:["⟳",c.jsx("span",{className:"sr-only",children:"recarregar"})]}),c.jsxs("button",{type:"button",className:"rp__icon",onClick:h,title:"fechar a coluna",children:["›",c.jsx("span",{className:"sr-only",children:"fechar a coluna"})]})]}),c.jsxs("div",{className:"rp__body",children:[g,c.jsxs("div",{className:"rp__foot",children:[c.jsx("span",{children:m}),c.jsx("span",{className:"rp__spacer"}),c.jsx("span",{children:v})]}),_]})]})}const rO=2e3;function gw(e){return Ae({queryKey:Nx(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 l;return(l=a.last)==null?void 0:l.running})?rO:!1}})}function nO(e){const t=Ye(),i=()=>{t.invalidateQueries({queryKey:Nx(e.scopeType,e.scopeId)}),t.invalidateQueries({queryKey:["session"]})},n=Ve({mutationFn:h=>ie.scripts.start.mutate({...e,phase:h}),onSettled:i}),a=Ve({mutationFn:h=>ie.scripts.stop.mutate({...e,phase:h}),onSettled:i}),l=Ve({mutationFn:()=>ie.scripts.trust.mutate(e),onSettled:i});return{start:n,stop:a,trust:l}}const aO=3e3;function yw(e){return{queryKey:Hi(e.scopeType,e.scopeId),queryFn:()=>ie.session.listByScope.query(e),refetchInterval:aO}}function dp(e){return Ae(yw(e))}function fp(e){return Ex({queries:e.map(yw),combine:t=>t.reduce((i,n)=>i+(n.data??[]).filter(a=>a.state==="running").length,0)})}function s_(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 l=Math.floor(a/60);return l<24?`${l} h`:`${Math.floor(l/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 oO=2,lO=1,cO=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 g;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:((g=this._terminal.options.overviewRuler)==null?void 0:g.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(i.getPropertyValue("height")),a=Math.max(0,parseInt(i.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),h={top:parseInt(l.getPropertyValue("padding-top")),bottom:parseInt(l.getPropertyValue("padding-bottom")),right:parseInt(l.getPropertyValue("padding-right")),left:parseInt(l.getPropertyValue("padding-left"))},d=h.top+h.bottom,_=h.right+h.left,m=n-d,v=a-_-t;return{cols:Math.max(oO,Math.floor(v/e.css.cell.width)),rows:Math.max(lO,Math.floor(m/e.css.cell.height))}}};/**
|
|
62
|
+
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
63
|
+
* @license MIT
|
|
64
|
+
*
|
|
65
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
66
|
+
* @license MIT
|
|
67
|
+
*
|
|
68
|
+
* Originally forked from (with the author's permission):
|
|
69
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
70
|
+
* http://bellard.org/jslinux/
|
|
71
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
72
|
+
*/var bw=Object.defineProperty,uO=Object.getOwnPropertyDescriptor,hO=(e,t)=>{for(var i in t)bw(e,i,{get:t[i],enumerable:!0})},jt=(e,t,i,n)=>{for(var a=n>1?void 0:n?uO(t,i):t,l=e.length-1,h;l>=0;l--)(h=e[l])&&(a=(n?h(t,i,a):h(a))||a);return n&&a&&bw(t,i,a),a},ue=(e,t)=>(i,n)=>t(i,n,e),L0="Terminal input",i_={get:()=>L0,set:e=>L0=e},z0="Too much output to announce, navigate to rows manually to read",r_={get:()=>z0,set:e=>z0=e};function dO(e){return e.replace(/\r?\n/g,"\r")}function fO(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function mO(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function _O(e,t,i,n){if(e.stopPropagation(),e.clipboardData){let a=e.clipboardData.getData("text/plain");Sw(a,t,i,n)}}function Sw(e,t,i,n){e=dO(e),e=fO(e,i.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function xw(e,t,i){let n=i.getBoundingClientRect(),a=e.clientX-n.left-10,l=e.clientY-n.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${a}px`,t.style.top=`${l}px`,t.style.zIndex="1000",t.focus()}function q0(e,t,i,n,a){xw(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 wh(e,t=0,i=e.length){let n="";for(let a=t;a<i;++a){let l=e[a];l>65535?(l-=65536,n+=String.fromCharCode((l>>10)+55296)+String.fromCharCode(l%1024+56320)):n+=String.fromCharCode(l)}return n}var pO=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 l=e.charCodeAt(a++);56320<=l&&l<=57343?t[n++]=(this._interim-55296)*1024+l-56320+65536:(t[n++]=this._interim,t[n++]=l),this._interim=0}for(let l=a;l<i;++l){let h=e.charCodeAt(l);if(55296<=h&&h<=56319){if(++l>=i)return this._interim=h,n;let d=e.charCodeAt(l);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}},vO=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,l,h,d,_=0,m=0;if(this.interim[0]){let b=!1,S=this.interim[0];S&=(S&224)===192?31:(S&240)===224?15:7;let x=0,C;for(;(C=this.interim[++x]&63)&&x<4;)S<<=6,S|=C;let j=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,N=j-x;for(;m<N;){if(m>=i)return 0;if(C=e[m++],(C&192)!==128){m--,b=!0;break}else this.interim[x++]=C,S<<=6,S|=C&63}b||(j===2?S<128?m--:t[n++]=S:j===3?S<2048||S>=55296&&S<=57343||S===65279||(t[n++]=S):S<65536||S>1114111||(t[n++]=S)),this.interim.fill(0)}let v=i-4,g=m;for(;g<i;){for(;g<v&&!((a=e[g])&128)&&!((l=e[g+1])&128)&&!((h=e[g+2])&128)&&!((d=e[g+3])&128);)t[n++]=a,t[n++]=l,t[n++]=h,t[n++]=d,g+=4;if(a=e[g++],a<128)t[n++]=a;else if((a&224)===192){if(g>=i)return this.interim[0]=a,n;if(l=e[g++],(l&192)!==128){g--;continue}if(_=(a&31)<<6|l&63,_<128){g--;continue}t[n++]=_}else if((a&240)===224){if(g>=i)return this.interim[0]=a,n;if(l=e[g++],(l&192)!==128){g--;continue}if(g>=i)return this.interim[0]=a,this.interim[1]=l,n;if(h=e[g++],(h&192)!==128){g--;continue}if(_=(a&15)<<12|(l&63)<<6|h&63,_<2048||_>=55296&&_<=57343||_===65279)continue;t[n++]=_}else if((a&248)===240){if(g>=i)return this.interim[0]=a,n;if(l=e[g++],(l&192)!==128){g--;continue}if(g>=i)return this.interim[0]=a,this.interim[1]=l,n;if(h=e[g++],(h&192)!==128){g--;continue}if(g>=i)return this.interim[0]=a,this.interim[1]=l,this.interim[2]=h,n;if(d=e[g++],(d&192)!==128){g--;continue}if(_=(a&7)<<18|(l&63)<<12|(h&63)<<6|d&63,_<65536||_>1114111)continue;t[n++]=_}}return n}},ww="",fn=" ",oc=class Cw{constructor(){this.fg=0,this.bg=0,this.extended=new hh}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 Cw;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}},hh=class jw{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 jw(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ui=class kw extends oc{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new hh,this.combinedData=""}static fromCharData(t){let i=new kw;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()]}},P0="di$target",n_="di$dependencies",rm=new Map;function gO(e){return e[n_]||[]}function Jt(e){if(rm.has(e))return rm.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");yO(t,i,a)};return t._id=e,rm.set(e,t),t}function yO(e,t,i){t[P0]===t?t[n_].push({id:e,index:i}):(t[n_]=[{id:e,index:i}],t[P0]=t)}var gs=Jt("BufferService"),Ew=Jt("CoreMouseService"),da=Jt("CoreService"),bO=Jt("CharsetService"),mp=Jt("InstantiationService"),Nw=Jt("LogService"),ys=Jt("OptionsService"),Tw=Jt("OscLinkService"),SO=Jt("UnicodeService"),lc=Jt("DecorationService"),a_=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){var v;let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let n=[],a=this._optionsService.rawOptions.linkHandler,l=new ui,h=i.getTrimmedLength(),d=-1,_=-1,m=!1;for(let g=0;g<h;g++)if(!(_===-1&&!i.hasContent(g))){if(i.loadCell(g,l),l.hasExtendedAttrs()&&l.extended.urlId)if(_===-1){_=g,d=l.extended.urlId;continue}else m=l.extended.urlId!==d;else _!==-1&&(m=!0);if(m||_!==-1&&g===h-1){let b=(v=this._oscLinkService.getLinkData(d))==null?void 0:v.uri;if(b){let S={start:{x:_+1,y:e},end:{x:g+(!m&&g===h-1?1:0),y:e}},x=!1;if(!(a!=null&&a.allowNonHttpProtocols))try{let C=new URL(b);["http:","https:"].includes(C.protocol)||(x=!0)}catch{x=!0}x||n.push({text:b,range:S,activate:(C,j)=>a?a.activate(C,j,S):xO(C,j),hover:(C,j)=>{var N;return(N=a==null?void 0:a.hover)==null?void 0:N.call(a,C,j,S)},leave:(C,j)=>{var N;return(N=a==null?void 0:a.leave)==null?void 0:N.call(a,C,j,S)}})}m=!1,l.hasExtendedAttrs()&&l.extended.urlId?(_=g,d=l.extended.urlId):(_=-1,d=-1)}}t(n)}};a_=jt([ue(0,gs),ue(1,ys),ue(2,Tw)],a_);function xO(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 Ch=Jt("CharSizeService"),gr=Jt("CoreBrowserService"),_p=Jt("MouseService"),yr=Jt("RenderService"),wO=Jt("SelectionService"),Ow=Jt("CharacterJoinerService"),ko=Jt("ThemeService"),Aw=Jt("LinkProviderService"),CO=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?H0.isErrorNoTelemetry(e)?new H0(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)}},jO=new CO;function Gu(e){kO(e)||jO.onUnexpectedError(e)}var o_="Canceled";function kO(e){return e instanceof EO?!0:e instanceof Error&&e.name===o_&&e.message===o_}var EO=class extends Error{constructor(){super(o_),this.name=this.message}};function NO(e){return new Error(`Illegal argument: ${e}`)}var H0=class l_ extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof l_)return t;let i=new l_;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},c_=class Rw extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Rw.prototype)}};function Us(e,t=0){return e[e.length-(1+t)]}var TO;(e=>{function t(l){return l<0}e.isLessThan=t;function i(l){return l<=0}e.isLessThanOrEqual=i;function n(l){return l>0}e.isGreaterThan=n;function a(l){return l===0}e.isNeitherLessOrGreaterThan=a,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(TO||(TO={}));function OO(e,t){let i=this,n=!1,a;return function(){return n||(n=!0,t||(a=e.apply(i,arguments))),a}}var Mw;(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 l(M){return t(M)?M:a(M)}e.wrap=l;function h(M){return M||i}e.from=h;function*d(M){for(let V=M.length-1;V>=0;V--)yield M[V]}e.reverse=d;function _(M){return!M||M[Symbol.iterator]().next().done===!0}e.isEmpty=_;function m(M){return M[Symbol.iterator]().next().value}e.first=m;function v(M,V){let ee=0;for(let q of M)if(V(q,ee++))return!0;return!1}e.some=v;function g(M,V){for(let ee of M)if(V(ee))return ee}e.find=g;function*b(M,V){for(let ee of M)V(ee)&&(yield ee)}e.filter=b;function*S(M,V){let ee=0;for(let q of M)yield V(q,ee++)}e.map=S;function*x(M,V){let ee=0;for(let q of M)yield*V(q,ee++)}e.flatMap=x;function*C(...M){for(let V of M)yield*V}e.concat=C;function j(M,V,ee){let q=ee;for(let te of M)q=V(q,te);return q}e.reduce=j;function*N(M,V,ee=M.length){for(V<0&&(V+=M.length),ee<0?ee+=M.length:ee>M.length&&(ee=M.length);V<ee;V++)yield M[V]}e.slice=N;function z(M,V=Number.POSITIVE_INFINITY){let ee=[];if(V===0)return[ee,M];let q=M[Symbol.iterator]();for(let te=0;te<V;te++){let he=q.next();if(he.done)return[ee,e.empty()];ee.push(he.value)}return[ee,{[Symbol.iterator](){return q}}]}e.consume=z;async function B(M){let V=[];for await(let ee of M)V.push(ee);return Promise.resolve(V)}e.asyncToArray=B})(Mw||(Mw={}));function aa(e){if(Mw.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 AO(...e){return vt(()=>aa(e))}function vt(e){return{dispose:OO(()=>{e()})}}var Dw=class Bw{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{aa(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?Bw.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)}};Dw.DISABLE_DISPOSED_WARNING=!1;var _n=Dw,He=class{constructor(){this._store=new _n,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)}};He.None=Object.freeze({dispose(){}});var So=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,u_=class h_{constructor(t){this.element=t,this.next=h_.Undefined,this.prev=h_.Undefined}};u_.Undefined=new u_(void 0);var gt=u_,I0=class{constructor(){this._first=gt.Undefined,this._last=gt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===gt.Undefined}clear(){let e=this._first;for(;e!==gt.Undefined;){let t=e.next;e.prev=gt.Undefined,e.next=gt.Undefined,e=t}this._first=gt.Undefined,this._last=gt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new gt(e);if(this._first===gt.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!==gt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==gt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==gt.Undefined&&e.next!==gt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===gt.Undefined&&e.next===gt.Undefined?(this._first=gt.Undefined,this._last=gt.Undefined):e.next===gt.Undefined?(this._last=this._last.prev,this._last.next=gt.Undefined):e.prev===gt.Undefined&&(this._first=this._first.next,this._first.prev=gt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==gt.Undefined;)yield e.element,e=e.next}},RO=globalThis.performance&&typeof globalThis.performance.now=="function",MO=class Lw{static create(t){return new Lw(t)}constructor(t){this._now=RO&&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}},ls;(e=>{e.None=()=>He.None;function t(G,K){return g(G,()=>{},0,void 0,!0,void 0,K)}e.defer=t;function i(G){return(K,se=null,L)=>{let T=!1,U;return U=G(F=>{if(!T)return U?U.dispose():T=!0,K.call(se,F)},null,L),T&&U.dispose(),U}}e.once=i;function n(G,K,se){return m((L,T=null,U)=>G(F=>L.call(T,K(F)),null,U),se)}e.map=n;function a(G,K,se){return m((L,T=null,U)=>G(F=>{K(F),L.call(T,F)},null,U),se)}e.forEach=a;function l(G,K,se){return m((L,T=null,U)=>G(F=>K(F)&&L.call(T,F),null,U),se)}e.filter=l;function h(G){return G}e.signal=h;function d(...G){return(K,se=null,L)=>{let T=AO(...G.map(U=>U(F=>K.call(se,F))));return v(T,L)}}e.any=d;function _(G,K,se,L){let T=se;return n(G,U=>(T=K(T,U),T),L)}e.reduce=_;function m(G,K){let se,L={onWillAddFirstListener(){se=G(T.fire,T)},onDidRemoveLastListener(){se==null||se.dispose()}},T=new oe(L);return K==null||K.add(T),T.event}function v(G,K){return K instanceof Array?K.push(G):K&&K.add(G),G}function g(G,K,se=100,L=!1,T=!1,U,F){let me,Ce,A,Q=0,ae,$={leakWarningThreshold:U,onWillAddFirstListener(){me=G(ye=>{Q++,Ce=K(Ce,ye),L&&!A&&(le.fire(Ce),Ce=void 0),ae=()=>{let Be=Ce;Ce=void 0,A=void 0,(!L||Q>1)&&le.fire(Be),Q=0},typeof se=="number"?(clearTimeout(A),A=setTimeout(ae,se)):A===void 0&&(A=0,queueMicrotask(ae))})},onWillRemoveListener(){T&&Q>0&&(ae==null||ae())},onDidRemoveLastListener(){ae=void 0,me.dispose()}},le=new oe($);return F==null||F.add(le),le.event}e.debounce=g;function b(G,K=0,se){return e.debounce(G,(L,T)=>L?(L.push(T),L):[T],K,void 0,!0,void 0,se)}e.accumulate=b;function S(G,K=(L,T)=>L===T,se){let L=!0,T;return l(G,U=>{let F=L||!K(U,T);return L=!1,T=U,F},se)}e.latch=S;function x(G,K,se){return[e.filter(G,K,se),e.filter(G,L=>!K(L),se)]}e.split=x;function C(G,K=!1,se=[],L){let T=se.slice(),U=G(Ce=>{T?T.push(Ce):me.fire(Ce)});L&&L.add(U);let F=()=>{T==null||T.forEach(Ce=>me.fire(Ce)),T=null},me=new oe({onWillAddFirstListener(){U||(U=G(Ce=>me.fire(Ce)),L&&L.add(U))},onDidAddFirstListener(){T&&(K?setTimeout(F):F())},onDidRemoveLastListener(){U&&U.dispose(),U=null}});return L&&L.add(me),me.event}e.buffer=C;function j(G,K){return(se,L,T)=>{let U=K(new z);return G(function(F){let me=U.evaluate(F);me!==N&&se.call(L,me)},void 0,T)}}e.chain=j;let N=Symbol("HaltChainable");class z{constructor(){this.steps=[]}map(K){return this.steps.push(K),this}forEach(K){return this.steps.push(se=>(K(se),se)),this}filter(K){return this.steps.push(se=>K(se)?se:N),this}reduce(K,se){let L=se;return this.steps.push(T=>(L=K(L,T),L)),this}latch(K=(se,L)=>se===L){let se=!0,L;return this.steps.push(T=>{let U=se||!K(T,L);return se=!1,L=T,U?T:N}),this}evaluate(K){for(let se of this.steps)if(K=se(K),K===N)break;return K}}function B(G,K,se=L=>L){let L=(...me)=>F.fire(se(...me)),T=()=>G.on(K,L),U=()=>G.removeListener(K,L),F=new oe({onWillAddFirstListener:T,onDidRemoveLastListener:U});return F.event}e.fromNodeEventEmitter=B;function M(G,K,se=L=>L){let L=(...me)=>F.fire(se(...me)),T=()=>G.addEventListener(K,L),U=()=>G.removeEventListener(K,L),F=new oe({onWillAddFirstListener:T,onDidRemoveLastListener:U});return F.event}e.fromDOMEventEmitter=M;function V(G){return new Promise(K=>i(G)(K))}e.toPromise=V;function ee(G){let K=new oe;return G.then(se=>{K.fire(se)},()=>{K.fire(void 0)}).finally(()=>{K.dispose()}),K.event}e.fromPromise=ee;function q(G,K){return G(se=>K.fire(se))}e.forward=q;function te(G,K,se){return K(se),G(L=>K(L))}e.runAndSubscribe=te;class he{constructor(K,se){this._observable=K,this._counter=0,this._hasChanged=!1;let L={onWillAddFirstListener:()=>{K.addObserver(this)},onDidRemoveLastListener:()=>{K.removeObserver(this)}};this.emitter=new oe(L),se&&se.add(this.emitter)}beginUpdate(K){this._counter++}handlePossibleChange(K){}handleChange(K,se){this._hasChanged=!0}endUpdate(K){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function de(G,K){return new he(G,K).emitter.event}e.fromObservable=de;function ge(G){return(K,se,L)=>{let T=0,U=!1,F={beginUpdate(){T++},endUpdate(){T--,T===0&&(G.reportChanges(),U&&(U=!1,K.call(se)))},handlePossibleChange(){},handleChange(){U=!0}};G.addObserver(F),G.reportChanges();let me={dispose(){G.removeObserver(F)}};return L instanceof _n?L.add(me):Array.isArray(L)&&L.push(me),me}}e.fromObservableLight=ge})(ls||(ls={}));var d_=class f_{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${f_._idPool++}`,f_.all.add(this)}start(t){this._stopWatch=new MO,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}}};d_.all=new Set,d_._idPool=0;var DO=d_,BO=-1,zw=class qw{constructor(t,i,n=(qw._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[l,h]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${h}):`;console.warn(d),console.warn(l);let _=new qO(d,l);this._errorHandler(_)}return()=>{let l=this._stacks.get(t.value)||0;this._stacks.set(t.value,l-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}};zw._idPool=1;var LO=zw,zO=class Pw{constructor(t){this.value=t}static create(){let t=new Error;return new Pw(t.stack??"")}print(){console.warn(this.value.split(`
|
|
79
|
+
`).slice(2).join(`
|
|
80
|
+
`))}},qO=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},PO=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},HO=0,nm=class{constructor(e){this.value=e,this.id=HO++}},IO=2,UO,oe=class{constructor(e){var t,i,n,a;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new LO((e==null?void 0:e.onListenerError)??Gu,((i=this._options)==null?void 0:i.leakWarningThreshold)??BO):void 0,this._perfMon=(n=this._options)!=null&&n._profName?new DO(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,_,m,v;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let g=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(g);let b=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],S=new PO(`${g}. HINT: Stack shows most frequent listener (${b[1]}-times)`,b[0]);return(((h=this._options)==null?void 0:h.onListenerError)||Gu)(S),He.None}if(this._disposed)return He.None;t&&(e=e.bind(t));let n=new nm(e),a;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=zO.create(),a=this._leakageMon.check(n.stack,this._size+1)),this._listeners?this._listeners instanceof nm?(this._deliveryQueue??(this._deliveryQueue=new FO),this._listeners=[this._listeners,n]):this._listeners.push(n):((_=(d=this._options)==null?void 0:d.onWillAddFirstListener)==null||_.call(d,this),this._listeners=n,(v=(m=this._options)==null?void 0:m.onDidAddFirstListener)==null||v.call(m,this)),this._size++;let l=vt(()=>{a==null||a(),this._removeListener(n)});return i instanceof _n?i.add(l):Array.isArray(i)&&i.push(l),l}),this._event}_removeListener(e){var a,l,h,d;if((l=(a=this._options)==null?void 0:a.onWillRemoveListener)==null||l.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*IO<=t.length){let _=0;for(let m=0;m<t.length;m++)t[m]?t[_++]=t[m]:n&&(this._deliveryQueue.end--,_<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=_}}_deliver(e,t){var n;if(!e)return;let i=((n=this._options)==null?void 0:n.onListenerError)||Gu;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 nm)this._deliver(this._listeners,e);else{let l=this._deliveryQueue;l.enqueue(this,e,this._listeners.length),this._deliverQueue(l)}(a=this._perfMon)==null||a.stop()}hasListeners(){return this._size>0}},FO=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}},m_=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new oe,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new oe,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}};m_.INSTANCE=new m_;var pp=m_;function KO(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}pp.INSTANCE.onDidChangeZoomLevel;function $O(e){return pp.INSTANCE.getZoomFactor(e)}pp.INSTANCE.onDidChangeFullscreen;var Eo=typeof navigator=="object"?navigator.userAgent:"",__=Eo.indexOf("Firefox")>=0,WO=Eo.indexOf("AppleWebKit")>=0,vp=Eo.indexOf("Chrome")>=0,VO=!vp&&Eo.indexOf("Safari")>=0;Eo.indexOf("Electron/")>=0;Eo.indexOf("Android")>=0;var am=!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)");am=e.matches,KO(fr,e,({matches:i})=>{am&&t.matches||(am=i)})}var to="en",p_=!1,v_=!1,Qu=!1,Hw=!1,zu,Zu=to,U0=to,YO,pi,Jn=globalThis,ns,ax;typeof Jn.vscode<"u"&&typeof Jn.vscode.process<"u"?ns=Jn.vscode.process:typeof process<"u"&&typeof((ax=process==null?void 0:process.versions)==null?void 0:ax.node)=="string"&&(ns=process);var ox,GO=typeof((ox=ns==null?void 0:ns.versions)==null?void 0:ox.electron)=="string",QO=GO&&(ns==null?void 0:ns.type)==="renderer",lx;if(typeof ns=="object"){p_=ns.platform==="win32",v_=ns.platform==="darwin",Qu=ns.platform==="linux",Qu&&ns.env.SNAP&&ns.env.SNAP_REVISION,ns.env.CI||ns.env.BUILD_ARTIFACTSTAGINGDIRECTORY,zu=to,Zu=to;let e=ns.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);zu=t.userLocale,U0=t.osLocale,Zu=t.resolvedLanguage||to,YO=(lx=t.languagePack)==null?void 0:lx.translationsConfigFile}catch{}Hw=!0}else typeof navigator=="object"&&!QO?(pi=navigator.userAgent,p_=pi.indexOf("Windows")>=0,v_=pi.indexOf("Macintosh")>=0,(pi.indexOf("Macintosh")>=0||pi.indexOf("iPad")>=0||pi.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Qu=pi.indexOf("Linux")>=0,(pi==null?void 0:pi.indexOf("Mobi"))>=0,Zu=globalThis._VSCODE_NLS_LANGUAGE||to,zu=navigator.language.toLowerCase(),U0=zu):console.error("Unable to resolve platform.");var Iw=p_,qi=v_,ZO=Qu,F0=Hw,Pi=pi,$r=Zu,XO;(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})(XO||(XO={}));var JO=typeof Jn.postMessage=="function"&&!Jn.importScripts;(()=>{if(JO){let e=[];Jn.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let n=0,a=e.length;n<a;n++){let l=e[n];if(l.id===i.data.vscodeScheduleAsyncWork){e.splice(n,1),l.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 eA=!!(Pi&&Pi.indexOf("Chrome")>=0);Pi&&Pi.indexOf("Firefox")>=0;!eA&&Pi&&Pi.indexOf("Safari")>=0;Pi&&Pi.indexOf("Edg/")>=0;Pi&&Pi.indexOf("Android")>=0;var Xa=typeof navigator=="object"?navigator:{};F0||document.queryCommandSupported&&document.queryCommandSupported("copy")||Xa&&Xa.clipboard&&Xa.clipboard.writeText,F0||Xa&&Xa.clipboard&&Xa.clipboard.readText;var gp=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}},om=new gp,K0=new gp,$0=new gp,tA=new Array(230),Uw;(e=>{function t(d){return om.keyCodeToStr(d)}e.toString=t;function i(d){return om.strToKeyCode(d)}e.fromString=i;function n(d){return K0.keyCodeToStr(d)}e.toUserSettingsUS=n;function a(d){return $0.keyCodeToStr(d)}e.toUserSettingsGeneral=a;function l(d){return K0.strToKeyCode(d)||$0.strToKeyCode(d)}e.fromUserSettings=l;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 om.keyCodeToStr(d)}e.toElectronAccelerator=h})(Uw||(Uw={}));var sA=class Fw{constructor(t,i,n,a,l){this.ctrlKey=t,this.shiftKey=i,this.altKey=n,this.metaKey=a,this.keyCode=l}equals(t){return t instanceof Fw&&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 iA([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},iA=class{constructor(e){if(e.length===0)throw NO("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 rA(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return Uw.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(__)switch(t){case 59:return 85;case 60:if(ZO)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(WO&&(qi&&t===93||!qi&&t===92))return 57;return tA[t]||0}var nA=qi?256:2048,aA=512,oA=1024,lA=qi?2048:256,W0=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=rA(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|=nA),this.altKey&&(t|=aA),this.shiftKey&&(t|=oA),this.metaKey&&(t|=lA),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new sA(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},V0=new WeakMap;function cA(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 uA=class{static getSameOriginWindowChain(e){let t=V0.get(e);if(!t){t=[],V0.set(e,t);let i=e,n;do n=cA(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 l of a){let h=l.window.deref();if(i+=(h==null?void 0:h.scrollY)??0,n+=(h==null?void 0:h.scrollX)??0,h===t||!l.iframeElement)break;let d=l.iframeElement.getBoundingClientRect();i+=d.top,n+=d.left}return{top:i,left:n}}},qu=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=uA.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Y0=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(vp){let l=navigator.userAgent.match(/Chrome\/(\d+)/);n=(l?parseInt(l[1]):123)<=122}if(e){let l=e,h=e,d=((a=e.view)==null?void 0:a.devicePixelRatio)||1;if(typeof l.wheelDeltaY<"u")n?this.deltaY=l.wheelDeltaY/(120*d):this.deltaY=l.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 _=e;_.deltaMode===_.DOM_DELTA_LINE?__&&!qi?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof l.wheelDeltaX<"u")VO&&Iw?this.deltaX=-(l.wheelDeltaX/120):n?this.deltaX=l.wheelDeltaX/(120*d):this.deltaX=l.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 _=e;_.deltaMode===_.DOM_DELTA_LINE?__&&!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()}},Kw=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),hA;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof dA?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ls.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Kw})})(hA||(hA={}));var dA=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?Kw:(this._emitter||(this._emitter=new oe),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},yp=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 c_("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new c_("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},fA=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 c_("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let n=i.setInterval(()=>{e()},t);this.disposable=vt(()=>{i.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},mA;(e=>{async function t(n){let a,l=await Promise.all(n.map(h=>h.then(d=>d,d=>{a||(a=d)})));if(typeof a<"u")throw a;return l}e.settled=t;function i(n){return new Promise(async(a,l)=>{try{await n(a,l)}catch(h){l(h)}})}e.withAsyncBody=i})(mA||(mA={}));var G0=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 oe,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 ls.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())}};G0.EMPTY=G0.fromArray([]);var{getWindow:Bi,getWindowId:_A,onDidRegisterWindow:pA}=(function(){let e=new Map,t={window:fr,disposables:new _n};e.set(fr.vscodeWindowId,t);let i=new oe,n=new oe,a=new oe;function l(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 He.None;let d=new _n,_={window:h,disposables:d.add(new _n)};return e.set(h.vscodeWindowId,_),d.add(vt(()=>{e.delete(h.vscodeWindowId),n.fire(h)})),d.add(Ee(h,Gt.BEFORE_UNLOAD,()=>{a.fire(h)})),i.fire(_),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(h){return h.vscodeWindowId},hasWindow(h){return e.has(h)},getWindowById:l,getWindow(h){var m;let d=h;if((m=d==null?void 0:d.ownerDocument)!=null&&m.defaultView)return d.ownerDocument.defaultView.window;let _=h;return _!=null&&_.view?_.view.window:fr},getDocument(h){return Bi(h).document}}})(),vA=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 Ee(e,t,i,n){return new vA(e,t,i,n)}var Q0=function(e,t,i,n){return Ee(e,t,i,n)},bp,gA=class extends fA{constructor(e){super(),this.defaultTarget=e&&Bi(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},Z0=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){Gu(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=l=>{i.set(l,!1);let h=e.get(l)??[];for(t.set(l,h),e.set(l,[]),n.set(l,!0);h.length>0;)h.sort(Z0.sort),h.shift().execute();n.set(l,!1)};bp=(l,h,d=0)=>{let _=_A(l),m=new Z0(h,d),v=e.get(_);return v||(v=[],e.set(_,v)),v.push(m),i.get(_)||(i.set(_,!0),l.requestAnimationFrame(()=>a(_))),m}})();function yA(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 Gt={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"},bA=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=Es(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Es(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Es(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Es(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Es(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Es(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Es(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Es(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Es(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Es(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Es(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=Es(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=Es(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Es(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 Es(e){return typeof e=="number"?`${e}px`:e}function ql(e){return new bA(e)}var $w=class{constructor(){this._hooks=new _n,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 l=e;try{e.setPointerCapture(t),this._hooks.add(vt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{l=Bi(e)}this._hooks.add(Ee(l,Gt.POINTER_MOVE,h=>{if(h.buttons!==i){this.stopMonitoring(!0);return}h.preventDefault(),this._pointerMoveCallback(h)})),this._hooks.add(Ee(l,Gt.POINTER_UP,h=>this.stopMonitoring(!0)))}};function SA(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 l=`$memoize$${t}`;i[n]=function(...h){return this.hasOwnProperty(l)||Object.defineProperty(this,l,{configurable:!1,enumerable:!1,writable:!1,value:a.apply(this,h)}),this[l]}}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 Rl=class us extends He{constructor(){super(),this.dispatched=!1,this.targets=new I0,this.ignoreTargets=new I0,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ls.runAndSubscribe(pA,({window:t,disposables:i})=>{i.add(Ee(t.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),i.add(Ee(t.document,"touchend",n=>this.onTouchEnd(t,n))),i.add(Ee(t.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:fr,disposables:this._store}))}static addTarget(t){if(!us.isTouchDevice())return He.None;us.INSTANCE||(us.INSTANCE=new us);let i=us.INSTANCE.targets.push(t);return vt(i)}static ignoreTarget(t){if(!us.isTouchDevice())return He.None;us.INSTANCE||(us.INSTANCE=new us);let i=us.INSTANCE.ignoreTargets.push(t);return vt(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 l=t.targetTouches.item(n);this.activeTouches[l.identifier]={id:l.identifier,initialTarget:l.target,initialTimeStamp:i,initialPageX:l.pageX,initialPageY:l.pageY,rollingTimestamps:[i],rollingPageX:[l.pageX],rollingPageY:[l.pageY]};let h=this.newGestureEvent(Ti.Start,l.target);h.pageX=l.pageX,h.pageY=l.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 l=0,h=i.changedTouches.length;l<h;l++){let d=i.changedTouches.item(l);if(!this.activeTouches.hasOwnProperty(String(d.identifier))){console.warn("move of an UNKNOWN touch",d);continue}let _=this.activeTouches[d.identifier],m=Date.now()-_.initialTimeStamp;if(m<us.HOLD_DELAY&&Math.abs(_.initialPageX-Us(_.rollingPageX))<30&&Math.abs(_.initialPageY-Us(_.rollingPageY))<30){let v=this.newGestureEvent(Ti.Tap,_.initialTarget);v.pageX=Us(_.rollingPageX),v.pageY=Us(_.rollingPageY),this.dispatchEvent(v)}else if(m>=us.HOLD_DELAY&&Math.abs(_.initialPageX-Us(_.rollingPageX))<30&&Math.abs(_.initialPageY-Us(_.rollingPageY))<30){let v=this.newGestureEvent(Ti.Contextmenu,_.initialTarget);v.pageX=Us(_.rollingPageX),v.pageY=Us(_.rollingPageY),this.dispatchEvent(v)}else if(a===1){let v=Us(_.rollingPageX),g=Us(_.rollingPageY),b=Us(_.rollingTimestamps)-_.rollingTimestamps[0],S=v-_.rollingPageX[0],x=g-_.rollingPageY[0],C=[...this.targets].filter(j=>_.initialTarget instanceof Node&&j.contains(_.initialTarget));this.inertia(t,C,n,Math.abs(S)/b,S>0?1:-1,v,Math.abs(x)/b,x>0?1:-1,g)}this.dispatchEvent(this.newGestureEvent(Ti.End,_.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>us.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,l=t.initialTarget;for(;l&&l!==n;)a++,l=l.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,l,h,d,_,m){this.handle=bp(t,()=>{let v=Date.now(),g=v-n,b=0,S=0,x=!0;a+=us.SCROLL_FRICTION*g,d+=us.SCROLL_FRICTION*g,a>0&&(x=!1,b=l*a*g),d>0&&(x=!1,S=_*d*g);let C=this.newGestureEvent(Ti.Change);C.translationX=b,C.translationY=S,i.forEach(j=>j.dispatchEvent(C)),x||this.inertia(t,i,v,a,l,h+b,d,_,m+S)})}onTouchMove(t){let i=Date.now();for(let n=0,a=t.changedTouches.length;n<a;n++){let l=t.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("end of an UNKNOWN touch",l);continue}let h=this.activeTouches[l.identifier],d=this.newGestureEvent(Ti.Change,h.initialTarget);d.translationX=l.pageX-Us(h.rollingPageX),d.translationY=l.pageY-Us(h.rollingPageY),d.pageX=l.pageX,d.pageY=l.pageY,this.dispatchEvent(d),h.rollingPageX.length>3&&(h.rollingPageX.shift(),h.rollingPageY.shift(),h.rollingTimestamps.shift()),h.rollingPageX.push(l.pageX),h.rollingPageY.push(l.pageY),h.rollingTimestamps.push(i)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Rl.SCROLL_FRICTION=-.005,Rl.HOLD_DELAY=700,Rl.CLEAR_TAP_COUNT_TIME=400,jt([SA],Rl,"isTouchDevice",1);var xA=Rl,Sp=class extends He{onclick(e,t){this._register(Ee(e,Gt.CLICK,i=>t(new qu(Bi(e),i))))}onmousedown(e,t){this._register(Ee(e,Gt.MOUSE_DOWN,i=>t(new qu(Bi(e),i))))}onmouseover(e,t){this._register(Ee(e,Gt.MOUSE_OVER,i=>t(new qu(Bi(e),i))))}onmouseleave(e,t){this._register(Ee(e,Gt.MOUSE_LEAVE,i=>t(new qu(Bi(e),i))))}onkeydown(e,t){this._register(Ee(e,Gt.KEY_DOWN,i=>t(new W0(i))))}onkeyup(e,t){this._register(Ee(e,Gt.KEY_UP,i=>t(new W0(i))))}oninput(e,t){this._register(Ee(e,Gt.INPUT,t))}onblur(e,t){this._register(Ee(e,Gt.BLUR,t))}onfocus(e,t){this._register(Ee(e,Gt.FOCUS,t))}onchange(e,t){this._register(Ee(e,Gt.CHANGE,t))}ignoreGesture(e){return xA.ignoreTarget(e)}},X0=11,wA=class extends Sp{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=X0+"px",this.domNode.style.height=X0+"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 $w),this._register(Q0(this.bgDomNode,Gt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Q0(this.domNode,Gt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new gA),this._pointerdownScheduleRepeatTimer=this._register(new yp)}_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()}},CA=class g_{constructor(t,i,n,a,l,h,d){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,n=n|0,a=a|0,l=l|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),l<0&&(l=0),d+l>h&&(d=h-l),d<0&&(d=0),this.width=i,this.scrollWidth=n,this.scrollLeft=a,this.height=l,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 g_(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 g_(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,l=this.scrollLeft!==t.scrollLeft,h=this.height!==t.height,d=this.scrollHeight!==t.scrollHeight,_=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:l,heightChanged:h,scrollHeightChanged:d,scrollTopChanged:_}}},jA=class extends He{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new oe),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new CA(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 eS(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=eS.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)))}},J0=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function lm(e,t){let i=t-e;return function(n){return e+i*NA(n)}}function kA(e,t,i){return function(n){return n<i?e(n/i):t((n-i)/(1-i))}}var eS=class y_{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,l;return t<i?(a=t+.75*n,l=i-.75*n):(a=t-.75*n,l=i+.75*n),kA(lm(t,a),lm(l,i),.33)}return lm(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 J0(n,a,!1)}return new J0(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,n){return y_.start(t,i,n)}static start(t,i,n){n=n+10;let a=Date.now()-10;return new y_(t,i,a,n)}};function EA(e){return Math.pow(e,3)}function NA(e){return 1-EA(1-e)}var TA=class extends He{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 yp)}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":"")))}},OA=140,Ww=class extends Sp{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 TA(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new $w),this._shouldRender=!0,this.domNode=ql(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(Ee(this.domNode.domNode,Gt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new wA(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,n){this.slider=ql(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(Ee(this.slider.domNode,Gt.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=yA(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 l=this._sliderOrthogonalPointerPosition(a),h=Math.abs(l-i);if(Iw&&h>OA){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()}},Vw=class b_{constructor(t,i,n,a,l,h){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(t),this._visibleSize=a,this._scrollSize=l,this._scrollPosition=h,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new b_(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,l){let h=Math.max(0,n-t),d=Math.max(0,h-2*i),_=a>0&&a>n;if(!_)return{computedAvailableSize:Math.round(h),computedIsNeeded:_,computedSliderSize:Math.round(d),computedSliderRatio:0,computedSliderPosition:0};let m=Math.round(Math.max(20,Math.floor(n*d/a))),v=(d-m)/(a-n),g=l*v;return{computedAvailableSize:Math.round(h),computedIsNeeded:_,computedSliderSize:Math.round(m),computedSliderRatio:v,computedSliderPosition:Math.round(g)}}_refreshComputedValues(){let t=b_._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)}},AA=class extends Ww{constructor(e,t,i){let n=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new Vw(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}},RA=class extends Ww{constructor(e,t,i){let n=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new Vw(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}},MA=500,tS=50,DA=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},S_=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 l=a===this._front?t:Math.pow(2,-n);if(t-=l,i+=this._memory[a].score*l,a===this._front)break;a=(this._capacity+a-1)%this._capacity,n++}while(!0);return i<=.5}acceptStandardWheelEvent(t){if(vp){let i=Bi(t.browserEvent),n=$O(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,l=new DA(t,i,n);this._front===-1&&this._rear===-1?(this._memory[0]=l,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]=l),l.score=this._computeScore(l,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),l=Math.abs(t.deltaY),h=Math.abs(i.deltaX),d=Math.abs(i.deltaY),_=Math.max(Math.min(a,h),1),m=Math.max(Math.min(l,d),1),v=Math.max(a,h),g=Math.max(l,d);v%_===0&&g%m===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};S_.INSTANCE=new S_;var BA=S_,LA=class extends Sp{constructor(e,t,i){super(),this._onScroll=this._register(new oe),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new oe),this.onWillScroll=this._onWillScroll.event,this._options=qA(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 RA(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new AA(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=ql(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=ql(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=ql(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 yp),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=aa(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 Y0(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=aa(this._mouseWheelToDispose),e)){let t=i=>{this._onMouseWheel(new Y0(i))};this._mouseWheelToDispose.push(Ee(this._listenOnDomNode,Gt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var a;if((a=e.browserEvent)!=null&&a.defaultPrevented)return;let t=BA.INSTANCE;t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let l=e.deltaY*this._options.mouseWheelScrollSensitivity,h=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&h+l===0?h=l=0:Math.abs(l)>=Math.abs(h)?h=0:l=0),this._options.flipAxes&&([l,h]=[h,l]);let d=!qi&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!h&&(h=l,l=0),e.browserEvent&&e.browserEvent.altKey&&(h=h*this._options.fastScrollSensitivity,l=l*this._options.fastScrollSensitivity);let _=this._scrollable.getFutureScrollPosition(),m={};if(l){let v=tS*l,g=_.scrollTop-(v<0?Math.floor(v):Math.ceil(v));this._verticalScrollbar.writeScrollPosition(m,g)}if(h){let v=tS*h,g=_.scrollLeft-(v<0?Math.floor(v):Math.ceil(v));this._horizontalScrollbar.writeScrollPosition(m,g)}m=this._scrollable.validateScrollPosition(m),(_.scrollLeft!==m.scrollLeft||_.scrollTop!==m.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(m):this._scrollable.setScrollPositionNow(m),i=!0)}let n=i;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,n=i?" left":"",a=t?" top":"",l=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${a}`),this._topLeftShadowDomNode.setClassName(`shadow${l}${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(),MA)}},zA=class extends LA{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 qA(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 x_=class extends He{constructor(e,t,i,n,a,l,h,d){super(),this._bufferService=i,this._optionsService=h,this._renderService=d,this._onRequestScrollLines=this._register(new oe),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let _=this._register(new jA({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:m=>bp(n.window,m)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{_.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new zA(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},_)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(a.onProtocolChange(m=>{this._scrollableElement.updateOptions({handleMouseWheel:!(m&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(ls.runAndSubscribe(l.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=l.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(vt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=n.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(vt(()=>this._styleElement.remove())),this._register(ls.runAndSubscribe(l.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${l.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${l.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${l.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
81
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(m=>this._handleScroll(m)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),i=t-this._bufferService.buffer.ydisp;i!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};x_=jt([ue(2,gs),ue(3,gr),ue(4,Ew),ue(5,ko),ue(6,ys),ue(7,yr)],x_);var w_=class extends He{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(l=>this._removeDecoration(l))),this._register(vt(()=>{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()}};w_=jt([ue(1,gs),ue(2,gr),ue(3,lc),ue(4,yr)],w_);var PA=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},wl={full:0,left:0,center:0,right:0},dh=class extends He{constructor(e,t,i,n,a,l,h,d){var m;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=n,this._renderService=a,this._optionsService=l,this._themeService=h,this._coreBrowserService=d,this._colorZoneStore=new PA,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(m=this._viewportElement.parentElement)==null||m.insertBefore(this._canvas,this._viewportElement),this._register(vt(()=>{var v;return(v=this._canvas)==null?void 0:v.remove()}));let _=this._canvas.getContext("2d");if(_)this._ctx=_;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(),wl.full=1,wl.left=1,wl.center=1+Wr.left,wl.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(wl[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}))}};dh=jt([ue(2,gs),ue(3,lc),ue(4,yr),ue(5,ys),ue(6,ko),ue(7,gr)],dh);var J;(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=""))(J||(J={}));var Xu;(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=""))(Xu||(Xu={}));var Yw;(e=>e.ST=`${J.ESC}\\`)(Yw||(Yw={}));var C_=class{constructor(e,t,i,n,a,l){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=n,this._coreService=a,this._renderService=l,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(`${J.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 l=this._compositionView.getBoundingClientRect();this._textarea.style.left=a+"px",this._textarea.style.top=n+"px",this._textarea.style.width=Math.max(l.width,1)+"px",this._textarea.style.height=Math.max(l.height,1)+"px",this._textarea.style.lineHeight=l.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};C_=jt([ue(2,gs),ue(3,ys),ue(4,da),ue(5,yr)],C_);var Qt=0,Zt=0,Xt=0,wt=0,sS={css:"#00000000",rgba:0},qt;(e=>{function t(a,l,h,d){return d!==void 0?`#${zn(a)}${zn(l)}${zn(h)}${zn(d)}`:`#${zn(a)}${zn(l)}${zn(h)}`}e.toCss=t;function i(a,l,h,d=255){return(a<<24|l<<16|h<<8|d)>>>0}e.toRgba=i;function n(a,l,h,d){return{css:e.toCss(a,l,h,d),rgba:e.toRgba(a,l,h,d)}}e.toColor=n})(qt||(qt={}));var _t;(e=>{function t(_,m){if(wt=(m.rgba&255)/255,wt===1)return{css:m.css,rgba:m.rgba};let v=m.rgba>>24&255,g=m.rgba>>16&255,b=m.rgba>>8&255,S=_.rgba>>24&255,x=_.rgba>>16&255,C=_.rgba>>8&255;Qt=S+Math.round((v-S)*wt),Zt=x+Math.round((g-x)*wt),Xt=C+Math.round((b-C)*wt);let j=qt.toCss(Qt,Zt,Xt),N=qt.toRgba(Qt,Zt,Xt);return{css:j,rgba:N}}e.blend=t;function i(_){return(_.rgba&255)===255}e.isOpaque=i;function n(_,m,v){let g=Ju.ensureContrastRatio(_.rgba,m.rgba,v);if(g)return qt.toColor(g>>24&255,g>>16&255,g>>8&255)}e.ensureContrastRatio=n;function a(_){let m=(_.rgba|255)>>>0;return[Qt,Zt,Xt]=Ju.toChannels(m),{css:qt.toCss(Qt,Zt,Xt),rgba:m}}e.opaque=a;function l(_,m){return wt=Math.round(m*255),[Qt,Zt,Xt]=Ju.toChannels(_.rgba),{css:qt.toCss(Qt,Zt,Xt,wt),rgba:qt.toRgba(Qt,Zt,Xt,wt)}}e.opacity=l;function h(_,m){return wt=_.rgba&255,l(_,wt*m/255)}e.multiplyOpacity=h;function d(_){return[_.rgba>>24&255,_.rgba>>16&255,_.rgba>>8&255]}e.toColorRGB=d})(_t||(_t={}));var yt;(e=>{let t,i;try{let a=document.createElement("canvas");a.width=1,a.height=1;let l=a.getContext("2d",{willReadFrequently:!0});l&&(t=l,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 Qt=parseInt(a.slice(1,2).repeat(2),16),Zt=parseInt(a.slice(2,3).repeat(2),16),Xt=parseInt(a.slice(3,4).repeat(2),16),qt.toColor(Qt,Zt,Xt);case 5:return Qt=parseInt(a.slice(1,2).repeat(2),16),Zt=parseInt(a.slice(2,3).repeat(2),16),Xt=parseInt(a.slice(3,4).repeat(2),16),wt=parseInt(a.slice(4,5).repeat(2),16),qt.toColor(Qt,Zt,Xt,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 l=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(l)return Qt=parseInt(l[1]),Zt=parseInt(l[2]),Xt=parseInt(l[3]),wt=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),qt.toColor(Qt,Zt,Xt,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),[Qt,Zt,Xt,wt]=t.getImageData(0,0,1,1).data,wt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:qt.toRgba(Qt,Zt,Xt,wt),css:a}}e.toColor=n})(yt||(yt={}));var ms;(e=>{function t(n){return i(n>>16&255,n>>8&255,n&255)}e.relativeLuminance=t;function i(n,a,l){let h=n/255,d=a/255,_=l/255,m=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),v=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),g=_<=.03928?_/12.92:Math.pow((_+.055)/1.055,2.4);return m*.2126+v*.7152+g*.0722}e.relativeLuminance2=i})(ms||(ms={}));var Ju;(e=>{function t(h,d){if(wt=(d&255)/255,wt===1)return d;let _=d>>24&255,m=d>>16&255,v=d>>8&255,g=h>>24&255,b=h>>16&255,S=h>>8&255;return Qt=g+Math.round((_-g)*wt),Zt=b+Math.round((m-b)*wt),Xt=S+Math.round((v-S)*wt),qt.toRgba(Qt,Zt,Xt)}e.blend=t;function i(h,d,_){let m=ms.relativeLuminance(h>>8),v=ms.relativeLuminance(d>>8);if(ar(m,v)<_){if(v<m){let S=n(h,d,_),x=ar(m,ms.relativeLuminance(S>>8));if(x<_){let C=a(h,d,_),j=ar(m,ms.relativeLuminance(C>>8));return x>j?S:C}return S}let g=a(h,d,_),b=ar(m,ms.relativeLuminance(g>>8));if(b<_){let S=n(h,d,_),x=ar(m,ms.relativeLuminance(S>>8));return b>x?g:S}return g}}e.ensureContrastRatio=i;function n(h,d,_){let m=h>>24&255,v=h>>16&255,g=h>>8&255,b=d>>24&255,S=d>>16&255,x=d>>8&255,C=ar(ms.relativeLuminance2(b,S,x),ms.relativeLuminance2(m,v,g));for(;C<_&&(b>0||S>0||x>0);)b-=Math.max(0,Math.ceil(b*.1)),S-=Math.max(0,Math.ceil(S*.1)),x-=Math.max(0,Math.ceil(x*.1)),C=ar(ms.relativeLuminance2(b,S,x),ms.relativeLuminance2(m,v,g));return(b<<24|S<<16|x<<8|255)>>>0}e.reduceLuminance=n;function a(h,d,_){let m=h>>24&255,v=h>>16&255,g=h>>8&255,b=d>>24&255,S=d>>16&255,x=d>>8&255,C=ar(ms.relativeLuminance2(b,S,x),ms.relativeLuminance2(m,v,g));for(;C<_&&(b<255||S<255||x<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),C=ar(ms.relativeLuminance2(b,S,x),ms.relativeLuminance2(m,v,g));return(b<<24|S<<16|x<<8|255)>>>0}e.increaseLuminance=a;function l(h){return[h>>24&255,h>>16&255,h>>8&255,h&255]}e.toChannels=l})(Ju||(Ju={}));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 HA=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()]}},fh=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new ui}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,l=0,h=0,d=t.getFg(0),_=t.getBg(0);for(let m=0;m<t.getTrimmedLength();m++)if(t.loadCell(m,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==d||this._workCell.bg!==_){if(m-a>1){let v=this._getJoinedRanges(n,h,l,t,a);for(let g=0;g<v.length;g++)i.push(v[g])}a=m,h=l,d=this._workCell.fg,_=this._workCell.bg}l+=this._workCell.getChars().length||fn.length}if(this._bufferService.cols-a>1){let m=this._getJoinedRanges(n,h,l,t,a);for(let v=0;v<m.length;v++)i.push(m[v])}return i}_getJoinedRanges(e,t,i,n,a){let l=e.substring(t,i),h=[];try{h=this._characterJoiners[0].handler(l)}catch(d){console.error(d)}for(let d=1;d<this._characterJoiners.length;d++)try{let _=this._characterJoiners[d].handler(l);for(let m=0;m<_.length;m++)fh._mergeRanges(h,_[m])}catch(_){console.error(_)}return this._stringRangesToCellRanges(h,n,a),h}_stringRangesToCellRanges(e,t,i){let n=0,a=!1,l=0,h=e[n];if(h){for(let d=i;d<this._bufferService.cols;d++){let _=t.getWidth(d),m=t.getString(d).length||fn.length;if(_!==0){if(!a&&h[0]<=l&&(h[0]=d,a=!0),h[1]<=l){if(h[1]=d,h=e[++n],!h)break;h[0]<=l?(h[0]=d,a=!0):a=!1}l+=m}}h&&(h[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let i=!1;for(let n=0;n<e.length;n++){let a=e[n];if(i){if(t[1]<=a[0])return e[n-1][1]=t[1],e;if(t[1]<=a[1])return e[n-1][1]=Math.max(t[1],a[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=a[0])return e.splice(n,0,t),e;if(t[1]<=a[1])return a[0]=Math.min(t[0],a[0]),e;t[0]<a[1]&&(a[0]=Math.min(t[0],a[0]),i=!0);continue}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};fh=jt([ue(0,gs)],fh);function IA(e){return 57508<=e&&e<=57558}function UA(e){return 9472<=e&&e<=9631}function FA(e){return IA(e)||UA(e)}function KA(){return{css:{canvas:Pu(),cell:Pu()},device:{canvas:Pu(),cell:Pu(),char:{width:0,height:0,left:0,top:0}}}}function Pu(){return{width:0,height:0}}var j_=class{constructor(e,t,i,n,a,l,h){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=n,this._coreService=a,this._decorationService=l,this._themeService=h,this._workCell=new ui,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,l,h,d,_,m,v){let g=[],b=this._characterJoinerService.getJoinedCharacters(t),S=this._themeService.colors,x=e.getNoBgTrimmedLength();i&&x<l+1&&(x=l+1);let C,j=0,N="",z=0,B=0,M=0,V=0,ee=!1,q=0,te=!1,he=0,de=0,ge=[],G=m!==-1&&v!==-1;for(let K=0;K<x;K++){e.loadCell(K,this._workCell);let se=this._workCell.getWidth();if(se===0)continue;let L=!1,T=K>=de,U=K,F=this._workCell;if(b.length>0&&K===b[0][0]&&T){let Je=b.shift(),di=this._isCellInSelection(Je[0],t);for(z=Je[0]+1;z<Je[1];z++)T&&(T=di===this._isCellInSelection(z,t));T&&(T=!i||l<Je[0]||l>=Je[1]),T?(L=!0,F=new HA(this._workCell,e.translateToString(!0,Je[0],Je[1]),Je[1]-Je[0]),U=Je[1]-1,se=F.getWidth()):de=Je[1]}let me=this._isCellInSelection(K,t),Ce=i&&K===l,A=G&&K>=m&&K<=v,Q=!1;this._decorationService.forEachDecorationAtCell(K,t,void 0,Je=>{Q=!0});let ae=F.getChars()||fn;if(ae===" "&&(F.isUnderline()||F.isOverline())&&(ae=" "),he=se*d-_.get(ae,F.isBold(),F.isItalic()),!C)C=this._document.createElement("span");else if(j&&(me&&te||!me&&!te&&F.bg===B)&&(me&&te&&S.selectionForeground||F.fg===M)&&F.extended.ext===V&&A===ee&&he===q&&!Ce&&!L&&!Q&&T){F.isInvisible()?N+=fn:N+=ae,j++;continue}else j&&(C.textContent=N),C=this._document.createElement("span"),j=0,N="";if(B=F.bg,M=F.fg,V=F.extended.ext,ee=A,q=he,te=me,L&&l>=K&&l<=U&&(l=K),!this._coreService.isCursorHidden&&Ce&&this._coreService.isCursorInitialized){if(ge.push("xterm-cursor"),this._coreBrowserService.isFocused)h&&ge.push("xterm-cursor-blink"),ge.push(n==="bar"?"xterm-cursor-bar":n==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(a)switch(a){case"outline":ge.push("xterm-cursor-outline");break;case"block":ge.push("xterm-cursor-block");break;case"bar":ge.push("xterm-cursor-bar");break;case"underline":ge.push("xterm-cursor-underline");break}}if(F.isBold()&&ge.push("xterm-bold"),F.isItalic()&&ge.push("xterm-italic"),F.isDim()&&ge.push("xterm-dim"),F.isInvisible()?N=fn:N=F.getChars()||fn,F.isUnderline()&&(ge.push(`xterm-underline-${F.extended.underlineStyle}`),N===" "&&(N=" "),!F.isUnderlineColorDefault()))if(F.isUnderlineColorRGB())C.style.textDecorationColor=`rgb(${oc.toColorRGB(F.getUnderlineColor()).join(",")})`;else{let Je=F.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&F.isBold()&&Je<8&&(Je+=8),C.style.textDecorationColor=S.ansi[Je].css}F.isOverline()&&(ge.push("xterm-overline"),N===" "&&(N=" ")),F.isStrikethrough()&&ge.push("xterm-strikethrough"),A&&(C.style.textDecoration="underline");let $=F.getFgColor(),le=F.getFgColorMode(),ye=F.getBgColor(),Be=F.getBgColorMode(),kt=!!F.isInverse();if(kt){let Je=$;$=ye,ye=Je;let di=le;le=Be,Be=di}let Qe,As,xi=!1;this._decorationService.forEachDecorationAtCell(K,t,void 0,Je=>{Je.options.layer!=="top"&&xi||(Je.backgroundColorRGB&&(Be=50331648,ye=Je.backgroundColorRGB.rgba>>8&16777215,Qe=Je.backgroundColorRGB),Je.foregroundColorRGB&&(le=50331648,$=Je.foregroundColorRGB.rgba>>8&16777215,As=Je.foregroundColorRGB),xi=Je.options.layer==="top")}),!xi&&me&&(Qe=this._coreBrowserService.isFocused?S.selectionBackgroundOpaque:S.selectionInactiveBackgroundOpaque,ye=Qe.rgba>>8&16777215,Be=50331648,xi=!0,S.selectionForeground&&(le=50331648,$=S.selectionForeground.rgba>>8&16777215,As=S.selectionForeground)),xi&&ge.push("xterm-decoration-top");let Gs;switch(Be){case 16777216:case 33554432:Gs=S.ansi[ye],ge.push(`xterm-bg-${ye}`);break;case 50331648:Gs=qt.toColor(ye>>16,ye>>8&255,ye&255),this._addStyle(C,`background-color:#${iS((ye>>>0).toString(16),"0",6)}`);break;case 0:default:kt?(Gs=S.foreground,ge.push("xterm-bg-257")):Gs=S.background}switch(Qe||F.isDim()&&(Qe=_t.multiplyOpacity(Gs,.5)),le){case 16777216:case 33554432:F.isBold()&&$<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&($+=8),this._applyMinimumContrast(C,Gs,S.ansi[$],F,Qe,void 0)||ge.push(`xterm-fg-${$}`);break;case 50331648:let Je=qt.toColor($>>16&255,$>>8&255,$&255);this._applyMinimumContrast(C,Gs,Je,F,Qe,As)||this._addStyle(C,`color:#${iS($.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(C,Gs,S.foreground,F,Qe,As)||kt&&ge.push("xterm-fg-257")}ge.length&&(C.className=ge.join(" "),ge.length=0),!Ce&&!L&&!Q&&T?j++:C.textContent=N,he!==this.defaultSpacing&&(C.style.letterSpacing=`${he}px`),g.push(C),K=U}return C&&j&&(C.textContent=N),g}_applyMinimumContrast(e,t,i,n,a,l){if(this._optionsService.rawOptions.minimumContrastRatio===1||FA(n.getCode()))return!1;let h=this._getContrastCache(n),d;if(!a&&!l&&(d=h.getColor(t.rgba,i.rgba)),d===void 0){let _=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);d=_t.ensureContrastRatio(a||t,l||i,_),h.setColor((a||t).rgba,(l||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]}};j_=jt([ue(1,Ow),ue(2,ys),ue(3,gr),ue(4,da),ue(5,lc),ue(6,ko)],j_);function iS(e,t,i){for(;e.length<i;)e=t+e;return e}var $A=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 l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold",l.style.fontStyle="italic",this._measureElements=[i,n,a,l],this._container.appendChild(i),this._container.appendChild(n),this._container.appendChild(a),this._container.appendChild(l),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 l=this._holey.get(a);if(l===void 0){let h=0;t&&(h|=1),i&&(h|=2),l=this._measure(e,h),l>0&&this._holey.set(a,l)}return l}_measure(e,t){let i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}},WA=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,l=t[1]-a,h=i[1]-a,d=Math.max(l,0),_=Math.min(h,e.rows-1);if(d>=e.rows||_<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=l,this.viewportEndRow=h,this.viewportCappedStartRow=d,this.viewportCappedEndRow=_,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 VA(){return new WA}var cm="xterm-dom-renderer-owner-",ai="xterm-rows",Hu="xterm-fg-",rS="xterm-bg-",Cl="xterm-focus",Iu="xterm-selection",YA=1,k_=class extends He{constructor(e,t,i,n,a,l,h,d,_,m,v,g,b,S){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=n,this._viewportElement=a,this._helperContainer=l,this._linkifier2=h,this._charSizeService=_,this._optionsService=m,this._bufferService=v,this._coreService=g,this._coreBrowserService=b,this._themeService=S,this._terminalClass=YA++,this._rowElements=[],this._selectionRenderModel=VA(),this.onRequestRedraw=this._register(new oe).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ai),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(Iu),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=KA(),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(j_,document),this._element.classList.add(cm+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(vt(()=>{this._element.classList.remove(cm+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new $A(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} .${ai} 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} .${ai} { 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} .${ai} .xterm-dim { color: ${_t.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} .${ai}.${Cl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${ai}.${Cl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${ai}.${Cl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${ai} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ai} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ai} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ai} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ai} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Iu} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Iu} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Iu} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[l,h]of e.ansi.entries())t+=`${this._terminalSelector} .${Hu}${l} { color: ${h.css}; }${this._terminalSelector} .${Hu}${l}.xterm-dim { color: ${_t.multiplyOpacity(h,.5).css}; }${this._terminalSelector} .${rS}${l} { background-color: ${h.css}; }`;t+=`${this._terminalSelector} .${Hu}257 { color: ${_t.opaque(e.background).css}; }${this._terminalSelector} .${Hu}257.xterm-dim { color: ${_t.multiplyOpacity(_t.opaque(e.background),.5).css}; }${this._terminalSelector} .${rS}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(Cl),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Cl),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,l=this._selectionRenderModel.viewportCappedStartRow,h=this._selectionRenderModel.viewportCappedEndRow,d=this._document.createDocumentFragment();if(i){let _=e[0]>t[0];d.appendChild(this._createSelectionElement(l,_?t[0]:e[0],_?e[0]:t[0],h-l+1))}else{let _=n===l?e[0]:0,m=l===a?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(l,_,m));let v=h-l-1;if(d.appendChild(this._createSelectionElement(l+1,0,this._bufferService.cols,v)),l!==h){let g=a===h?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(h,0,g))}}this._selectionContainer.appendChild(d)}_createSelectionElement(e,t,i,n=1){let a=this._document.createElement("div"),l=t*this.dimensions.css.cell.width,h=this.dimensions.css.cell.width*(i-t);return l+h>this.dimensions.css.canvas.width&&(h=this.dimensions.css.canvas.width-l),a.style.height=`${n*this.dimensions.css.cell.height}px`,a.style.top=`${e*this.dimensions.css.cell.height}px`,a.style.left=`${l}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),l=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,h=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,d=this._optionsService.rawOptions.cursorInactiveStyle;for(let _=e;_<=t;_++){let m=_+i.ydisp,v=this._rowElements[_],g=i.lines.get(m);if(!v||!g)break;v.replaceChildren(...this._rowFactory.createRow(g,m,m===n,h,d,a,l,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${cm}${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,l){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,_=d.ybase+d.y,m=Math.min(d.x,a-1),v=this._optionsService.rawOptions.cursorBlink,g=this._optionsService.rawOptions.cursorStyle,b=this._optionsService.rawOptions.cursorInactiveStyle;for(let S=i;S<=n;++S){let x=S+d.ydisp,C=this._rowElements[S],j=d.lines.get(x);if(!C||!j)break;C.replaceChildren(...this._rowFactory.createRow(j,x,x===_,g,b,m,v,this.dimensions.css.cell.width,this._widthCache,l?S===i?e:0:-1,l?(S===n?t:a)-1:-1))}}};k_=jt([ue(7,mp),ue(8,Ch),ue(9,ys),ue(10,gs),ue(11,da),ue(12,gr),ue(13,ko)],k_);var E_=class extends He{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new oe),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new QA(this._optionsService))}catch{this._measureStrategy=this._register(new GA(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())}};E_=jt([ue(2,ys)],E_);var Gw=class extends He{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)}},GA=class extends Gw{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}},QA=class extends Gw{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}},ZA=class extends He{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 XA(this._window)),this._onDprChange=this._register(new oe),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new oe),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(n=>this._screenDprMonitor.setWindow(n))),this._register(ls.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ee(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ee(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}},XA=class extends He{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new So),this._onDprChange=this._register(new oe),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(vt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ee(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)}},JA=class extends He{constructor(){super(),this.linkProviders=[],this._register(vt(()=>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 xp(e,t,i){let n=i.getBoundingClientRect(),a=e.getComputedStyle(i),l=parseInt(a.getPropertyValue("padding-left")),h=parseInt(a.getPropertyValue("padding-top"));return[t.clientX-n.left-l,t.clientY-n.top-h]}function eR(e,t,i,n,a,l,h,d,_){if(!l)return;let m=xp(e,t,i);if(m)return m[0]=Math.ceil((m[0]+(_?h/2:0))/h),m[1]=Math.ceil(m[1]/d),m[0]=Math.min(Math.max(m[0],1),n+(_?1:0)),m[1]=Math.min(Math.max(m[1],1),a),m}var N_=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,n,a){return eR(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=xp(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])}}};N_=jt([ue(0,yr),ue(1,Ch)],N_);var tR=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=[]}},Qw={};hO(Qw,{getSafariVersion:()=>iR,isChromeOS:()=>e1,isFirefox:()=>Zw,isIpad:()=>rR,isIphone:()=>nR,isLegacyEdge:()=>sR,isLinux:()=>wp,isMac:()=>mh,isNode:()=>jh,isSafari:()=>Xw,isWindows:()=>Jw});var jh=typeof process<"u"&&"title"in process,cc=jh?"node":navigator.userAgent,uc=jh?"node":navigator.platform,Zw=cc.includes("Firefox"),sR=cc.includes("Edge"),Xw=/^((?!chrome|android).)*safari/i.test(cc);function iR(){if(!Xw)return 0;let e=cc.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var mh=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(uc),rR=uc==="iPad",nR=uc==="iPhone",Jw=["Windows","Win16","Win32","WinCE"].includes(uc),wp=uc.indexOf("Linux")>=0,e1=/\bCrOS\b/.test(cc),t1=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()}},aR=class extends t1{_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())}}},oR=class extends t1{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},_h=!jh&&"requestIdleCallback"in window?oR:aR,lR=class{constructor(){this._queue=new _h}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},T_=class extends He{constructor(e,t,i,n,a,l,h,d,_){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=n,this._coreService=a,this._coreBrowserService=d,this._renderer=this._register(new So),this._pausedResizeTask=new lR,this._observerDisposable=this._register(new So),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 oe),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new oe),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new oe),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new oe),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new tR((m,v)=>this._renderRows(m,v),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new cR(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(vt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(h.onResize(()=>this._fullRefresh())),this._register(h.buffers.onBufferActivate(()=>{var m;return(m=this._renderer.value)==null?void 0:m.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(l.onDecorationRegistered(()=>this._fullRefresh())),this._register(l.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(_.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(m=>this._registerIntersectionObserver(m,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver(n=>this._handleIntersectionChange(n[n.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=vt(()=>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()}};T_=jt([ue(2,ys),ue(3,Ch),ue(4,da),ue(5,lc),ue(6,gs),ue(7,gr),ue(8,ko)],T_);var cR=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 uR(e,t,i,n){let a=i.buffer.x,l=i.buffer.y;if(!i.buffer.hasScrollback)return fR(a,l,e,t,i,n)+kh(l,t,i,n)+mR(a,l,e,t,i,n);let h;if(l===t)return h=a>e?"D":"C",Vl(Math.abs(a-e),Wl(h,n));h=l>t?"D":"C";let d=Math.abs(l-t),_=dR(l>t?e:a,i)+(d-1)*i.cols+1+hR(l>t?a:e);return Vl(_,Wl(h,n))}function hR(e,t){return e-1}function dR(e,t){return t.cols-e}function fR(e,t,i,n,a,l){return kh(t,n,a,l).length===0?"":Vl(i1(e,t,e,t-oa(t,a),!1,a).length,Wl("D",l))}function kh(e,t,i,n){let a=e-oa(e,i),l=t-oa(t,i),h=Math.abs(a-l)-_R(e,t,i);return Vl(h,Wl(s1(e,t),n))}function mR(e,t,i,n,a,l){let h;kh(t,n,a,l).length>0?h=n-oa(n,a):h=t;let d=n,_=pR(e,t,i,n,a,l);return Vl(i1(e,h,i,d,_==="C",a).length,Wl(_,l))}function _R(e,t,i){var h;let n=0,a=e-oa(e,i),l=t-oa(t,i);for(let d=0;d<Math.abs(a-l);d++){let _=s1(e,t)==="A"?-1:1;(h=i.buffer.lines.get(a+_*d))!=null&&h.isWrapped&&n++}return n}function oa(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 pR(e,t,i,n,a,l){let h;return kh(i,n,a,l).length>0?h=n-oa(n,a):h=t,e<i&&h<=n||e>=i&&h<n?"C":"D"}function s1(e,t){return e>t?"A":"B"}function i1(e,t,i,n,a,l){let h=e,d=t,_="";for(;(h!==i||d!==n)&&d>=0&&d<l.buffer.lines.length;)h+=a?1:-1,a&&h>l.cols-1?(_+=l.buffer.translateBufferLineToString(d,!1,e,h),h=0,e=0,d++):!a&&h<0&&(_+=l.buffer.translateBufferLineToString(d,!1,0,e+1),h=l.cols-1,e=h,d--);return _+l.buffer.translateBufferLineToString(d,!1,e,h)}function Wl(e,t){let i=t?"O":"[";return J.ESC+i+e}function Vl(e,t){e=Math.floor(e);let i="";for(let n=0;n<e;n++)i+=t;return i}var vR=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 nS(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 um=50,gR=15,yR=50,bR=500,SR=" ",xR=new RegExp(SR,"g"),O_=class extends He{constructor(e,t,i,n,a,l,h,d,_){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=n,this._coreService=a,this._mouseService=l,this._optionsService=h,this._renderService=d,this._coreBrowserService=_,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new ui,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new oe),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new oe),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new oe),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new oe),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=m=>this._handleMouseMove(m),this._mouseUpListener=m=>this._handleMouseUp(m),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(m=>this._handleTrim(m)),this._register(this._bufferService.buffers.onBufferActivate(m=>this._handleBufferActivate(m))),this.enable(),this._model=new vR(this._bufferService),this._activeSelectionMode=0,this._register(vt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(m=>{m.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let i=this._bufferService.buffer,n=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let a=e[0]<t[0]?e[0]:t[0],l=e[0]<t[0]?t[0]:e[0];for(let h=e[1];h<=t[1];h++){let d=i.translateBufferLineToString(h,!0,a,l);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 l=e[1]+1;l<=t[1]-1;l++){let h=i.lines.get(l),d=i.translateBufferLineToString(l,!0);h!=null&&h.isWrapped?n[n.length-1]+=d:n.push(d)}if(e[1]!==t[1]){let l=i.lines.get(t[1]),h=i.translateBufferLineToString(t[1],!0,0,t[0]);l&&l.isWrapped?n[n.length-1]+=h:n.push(h)}}return n.map(a=>a.replace(xR," ")).join(Jw?`\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())),wp&&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,l;let i=(l=(a=this._linkifier.currentLink)==null?void 0:a.link)==null?void 0:l.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=nS(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=xp(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,-um),um),t/=um,t/Math.abs(t)+Math.round(t*(gR-1)))}shouldForceSelection(e){return mh?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(),yR)}_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&&!(mh&&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<bR&&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=uR(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,l=a.lines.get(e[1]);if(!l)return;let h=a.translateBufferLineToString(e[1],!1),d=this._convertViewportColToCharacterIndex(l,e[0]),_=d,m=e[0]-d,v=0,g=0,b=0,S=0;if(h.charAt(d)===" "){for(;d>0&&h.charAt(d-1)===" ";)d--;for(;_<h.length&&h.charAt(_+1)===" ";)_++}else{let j=e[0],N=e[0];l.getWidth(j)===0&&(v++,j--),l.getWidth(N)===2&&(g++,N++);let z=l.getString(N).length;for(z>1&&(S+=z-1,_+=z-1);j>0&&d>0&&!this._isCharWordSeparator(l.loadCell(j-1,this._workCell));){l.loadCell(j-1,this._workCell);let B=this._workCell.getChars().length;this._workCell.getWidth()===0?(v++,j--):B>1&&(b+=B-1,d-=B-1),d--,j--}for(;N<l.length&&_+1<h.length&&!this._isCharWordSeparator(l.loadCell(N+1,this._workCell));){l.loadCell(N+1,this._workCell);let B=this._workCell.getChars().length;this._workCell.getWidth()===2?(g++,N++):B>1&&(S+=B-1,_+=B-1),_++,N++}}_++;let x=d+m-v+b,C=Math.min(this._bufferService.cols,_-d+v+g-b-S);if(!(!t&&h.slice(d,_).trim()==="")){if(i&&x===0&&l.getCodePoint(0)!==32){let j=a.lines.get(e[1]-1);if(j&&l.isWrapped&&j.getCodePoint(this._bufferService.cols-1)!==32){let N=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(N){let z=this._bufferService.cols-N.start;x-=z,C+=z}}}if(n&&x+C===this._bufferService.cols&&l.getCodePoint(this._bufferService.cols-1)!==32){let j=a.lines.get(e[1]+1);if(j!=null&&j.isWrapped&&j.getCodePoint(0)!==32){let N=this._getWordAt([0,e[1]+1],!1,!1,!0);N&&(C+=N.length)}}return{start:x,length:C}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=nS(i,this._bufferService.cols)}};O_=jt([ue(3,gs),ue(4,da),ue(5,_p),ue(6,ys),ue(7,yr),ue(8,gr)],O_);var aS=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={}}},oS=class{constructor(){this._color=new aS,this._css=new aS}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],l=t[i%6];e.push({css:qt.toCss(n,a,l),rgba:qt.toRgba(n,a,l)})}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"),Ml=yt.toColor("#000000"),lS=yt.toColor("#ffffff"),cS=Ml,jl={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},wR=Pn,A_=class extends He{constructor(e){super(),this._optionsService=e,this._contrastCache=new oS,this._halfContrastCache=new oS,this._onChangeColors=this._register(new oe),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Pn,background:Ml,cursor:lS,cursorAccent:cS,selectionForeground:void 0,selectionBackgroundTransparent:jl,selectionBackgroundOpaque:_t.blend(Ml,jl),selectionInactiveBackgroundTransparent:jl,selectionInactiveBackgroundOpaque:_t.blend(Ml,jl),scrollbarSliderBackground:_t.opacity(Pn,.2),scrollbarSliderHoverBackground:_t.opacity(Pn,.4),scrollbarSliderActiveBackground:_t.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,Ml),t.cursor=_t.blend(t.background,ut(e.cursor,lS)),t.cursorAccent=_t.blend(t.background,ut(e.cursorAccent,cS)),t.selectionBackgroundTransparent=ut(e.selectionBackground,jl),t.selectionBackgroundOpaque=_t.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ut(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=_t.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ut(e.selectionForeground,sS):void 0,t.selectionForeground===sS&&(t.selectionForeground=void 0),_t.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=_t.opacity(t.selectionBackgroundTransparent,.3)),_t.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=_t.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ut(e.scrollbarSliderBackground,_t.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ut(e.scrollbarSliderHoverBackground,_t.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ut(e.scrollbarSliderActiveBackground,_t.opacity(t.foreground,.5)),t.overviewRulerBorder=ut(e.overviewRulerBorder,wR),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()}}};A_=jt([ue(0,ys)],A_);function ut(e,t){if(e!==void 0)try{return yt.toColor(e)}catch{}return t}var CR=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)}},jR=class{constructor(){this._services=new CR,this._services.set(mp,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=gO(e).sort((l,h)=>l.index-h.index),n=[];for(let l of i){let h=this._services.get(l.id);if(!h)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${l.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)}},kR={trace:0,debug:1,info:2,warn:3,error:4,off:5},ER="xterm.js: ",R_=class extends He{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=kR[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?"":ER)+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)}};R_=jt([ue(0,ys)],R_);var uS=class extends He{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new oe),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new oe),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new oe),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),Uu=0,hm=2,Dl=class r1{constructor(t,i,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*ze);let a=i||ui.fromCharData([0,ww,1,0]);for(let l=0;l<t;++l)this.setCell(l,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 Uu=t*ze,i.content=this._data[Uu+0],i.fg=this._data[Uu+1],i.bg=this._data[Uu+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 ui;for(let l=this.length-t-i-1;l>=0;--l)this.setCell(t+i+l,this.loadCell(t+l,a));for(let l=0;l<i;++l)this.setCell(t+l,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 ui;for(let l=0;l<this.length-t-i;++l)this.setCell(t+l,this.loadCell(t+i+l,a));for(let l=this.length-i;l<this.length;++l)this.setCell(l,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*hm<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 l=Object.keys(this._extendedAttrs);for(let h=0;h<l.length;h++){let d=parseInt(l[h],10);d>=t&&delete this._extendedAttrs[d]}}return this.length=t,n*4*hm<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*hm<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 r1(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,l){let h=t._data;if(l)for(let _=a-1;_>=0;_--){for(let m=0;m<ze;m++)this._data[(n+_)*ze+m]=h[(i+_)*ze+m];h[(i+_)*ze+2]&268435456&&(this._extendedAttrs[n+_]=t._extendedAttrs[i+_])}else for(let _=0;_<a;_++){for(let m=0;m<ze;m++)this._data[(n+_)*ze+m]=h[(i+_)*ze+m];h[(i+_)*ze+2]&268435456&&(this._extendedAttrs[n+_]=t._extendedAttrs[i+_])}let d=Object.keys(t._combined);for(let _=0;_<d.length;_++){let m=parseInt(d[_],10);m>=i&&(this._combined[m-i+n]=t._combined[m])}}translateToString(t,i,n,a){i=i??0,n=n??this.length,t&&(n=Math.min(n,this.getTrimmedLength())),a&&(a.length=0);let l="";for(;i<n;){let h=this._data[i*ze+0],d=h&2097151,_=h&2097152?this._combined[i]:d?Zr(d):fn;if(l+=_,a)for(let m=0;m<_.length;++m)a.push(i);i+=h>>22||1}return a&&a.push(i),l}};function NR(e,t,i,n,a,l){let h=[];for(let d=0;d<e.length-1;d++){let _=d,m=e.get(++_);if(!m.isWrapped)continue;let v=[e.get(d)];for(;_<e.length&&m.isWrapped;)v.push(m),m=e.get(++_);if(!l&&n>=d&&n<_){d+=v.length-1;continue}let g=0,b=Yl(v,g,t),S=1,x=0;for(;S<v.length;){let j=Yl(v,S,t),N=j-x,z=i-b,B=Math.min(N,z);v[g].copyCellsFrom(v[S],x,b,B,!1),b+=B,b===i&&(g++,b=0),x+=B,x===j&&(S++,x=0),b===0&&g!==0&&v[g-1].getWidth(i-1)===2&&(v[g].copyCellsFrom(v[g-1],i-1,b++,1,!1),v[g-1].setCell(i-1,a))}v[g].replaceCells(b,i,a);let C=0;for(let j=v.length-1;j>0&&(j>g||v[j].getTrimmedLength()===0);j--)C++;C>0&&(h.push(d+v.length-C),h.push(C)),d+=v.length-1}return h}function TR(e,t){let i=[],n=0,a=t[n],l=0;for(let h=0;h<e.length;h++)if(a===h){let d=t[++n];e.onDeleteEmitter.fire({index:h-l,amount:d}),h+=d-1,l+=d,a=t[++n]}else i.push(h);return{layout:i,countRemoved:l}}function OR(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 AR(e,t,i){let n=[],a=e.map((_,m)=>Yl(e,m,t)).reduce((_,m)=>_+m),l=0,h=0,d=0;for(;d<a;){if(a-d<i){n.push(a-d);break}l+=i;let _=Yl(e,h,t);l>_&&(l-=_,h++);let m=e[h].getWidth(l-1)===2;m&&l--;let v=m?i-1:i;n.push(v),d+=v}return n}function Yl(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 n1=class a1{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=a1._nextId++,this._onDispose=this.register(new oe),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),aa(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};n1._nextId=1;var RR=n1,Kt={},Hn=Kt.B;Kt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Kt.A={"#":"£"};Kt.B=void 0;Kt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Kt.C=Kt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Kt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Kt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Kt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Kt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Kt.E=Kt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Kt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Kt.H=Kt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Kt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var hS=4294967295,dS=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=ui.fromCharData([0,ww,1,0]),this._whitespaceCell=ui.fromCharData([0,fn,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new _h,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new uS(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 hh),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 hh),this._whitespaceCell}getBlankLine(e,t){return new Dl(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>hS?hS: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 uS(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 l=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 Dl(e,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+l+1?(this.ybase--,l++,this.ydisp>0&&this.ydisp--):this.lines.push(new Dl(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),l&&(this.y+=l),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 l=0;l<this.lines.length;l++)n+=+this.lines.get(l).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=NR(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Lt),i);if(n.length>0){let a=TR(this.lines,n);OR(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 Dl(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=[],l=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 _=[d];for(;d.isWrapped&&h>0;)d=this.lines.get(--h),_.unshift(d);if(!i){let B=this.ybase+this.y;if(B>=h&&B<h+_.length)continue}let m=_[_.length-1].getTrimmedLength(),v=AR(_,this._cols,e),g=v.length-_.length,b;this.ybase===0&&this.y!==this.lines.length-1?b=Math.max(0,this.y-this.lines.maxLength+g):b=Math.max(0,this.lines.length-this.lines.maxLength+g);let S=[];for(let B=0;B<g;B++){let M=this.getBlankLine(Lt,!0);S.push(M)}S.length>0&&(a.push({start:h+_.length+l,newLines:S}),l+=S.length),_.push(...S);let x=v.length-1,C=v[x];C===0&&(x--,C=v[x]);let j=_.length-g-1,N=m;for(;j>=0;){let B=Math.min(N,C);if(_[x]===void 0)break;if(_[x].copyCellsFrom(_[j],N-B,C-B,B,!0),C-=B,C===0&&(x--,C=v[x]),N-=B,N===0){j--;let M=Math.max(j,0);N=Yl(_,M,this._cols)}}for(let B=0;B<_.length;B++)v[B]<e&&_[B].setCell(v[B],n);let z=g-b;for(;z-- >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+l)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+g,this.ybase+t-1)}if(a.length>0){let h=[],d=[];for(let C=0;C<this.lines.length;C++)d.push(this.lines.get(C));let _=this.lines.length,m=_-1,v=0,g=a[v];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+l);let b=0;for(let C=Math.min(this.lines.maxLength-1,_+l-1);C>=0;C--)if(g&&g.start>m+b){for(let j=g.newLines.length-1;j>=0;j--)this.lines.set(C--,g.newLines[j]);C++,h.push({index:m+1,amount:g.newLines.length}),b+=g.newLines.length,g=a[++v]}else this.lines.set(C,d[m--]);let S=0;for(let C=h.length-1;C>=0;C--)h[C].index+=S,this.lines.onInsertEmitter.fire(h[C]),S+=h[C].amount;let x=Math.max(0,_+l-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 RR(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)}},MR=class extends He{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new oe),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 dS(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new dS(!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)}},o1=2,l1=1,M_=class extends He{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new oe),this.onResize=this._onResize.event,this._onScroll=this._register(new oe),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,o1),this.rows=Math.max(e.rawOptions.rows||0,l1),this.buffers=this._register(new MR(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,l=i.ybase+i.scrollBottom;if(i.scrollTop===0){let h=i.lines.isFull;l===i.lines.length-1?h?i.lines.recycle().copyFrom(n):i.lines.push(n.clone()):i.lines.splice(l+1,0,n.clone()),h?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let h=l-a+1;i.lines.shiftElements(a+1,h-1,-1),i.lines.set(l,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))}};M_=jt([ue(0,ys)],M_);var Ja={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:mh,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},DR=["normal","bold","100","200","300","400","500","600","700","800","900"],BR=class extends He{constructor(e){super(),this._onOptionChange=this._register(new oe),this.onOptionChange=this._onOptionChange.event;let t={...Ja};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(vt(()=>{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 Ja))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,n)=>{if(!(i in Ja))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=Ja[e]),!LR(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Ja[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=DR.includes(t)?t:Ja[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 LR(e){return e==="block"||e==="underline"||e==="bar"}function Bl(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]&&Bl(e[n],t-1);return i}var fS=Object.freeze({insertMode:!1}),mS=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),D_=class extends He{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 oe),this.onData=this._onData.event,this._onUserInput=this._register(new oe),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new oe),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new oe),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Bl(fS),this.decPrivateModes=Bl(mS)}reset(){this.modes=Bl(fS),this.decPrivateModes=Bl(mS)}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))}};D_=jt([ue(0,gs),ue(1,Nw),ue(2,ys)],D_);var _S={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 dm(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 fm=String.fromCharCode,pS={DEFAULT:e=>{let t=[dm(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${fm(t[0])}${fm(t[1])}${fm(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${dm(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${dm(e,!0)};${e.x};${e.y}${t}`}},B_=class extends He{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 oe),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(_S))this.addProtocol(n,_S[n]);for(let n of Object.keys(pS))this.addEncoding(n,pS[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)}};B_=jt([ue(0,gs),ue(1,da),ue(2,ys)],B_);var mm=[[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]],zR=[[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 qR(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 PR=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<mm.length;++e)It.fill(0,mm[e][0],mm[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?It[e]:qR(e,zR)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),n=i===0&&t!==0;if(n){let a=Un.extractWidth(t);a===0?n=!1:a>i&&(i=a)}return Un.createPropertyValue(0,i,n)}},Un=class eh{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new oe,this.onChange=this._onChange.event;let t=new PR;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 l=0;l<a;++l){let h=t.charCodeAt(l);if(55296<=h&&h<=56319){if(++l>=a)return i+this.wcwidth(h);let m=t.charCodeAt(l);56320<=m&&m<=57343?h=(h-55296)*1024+m-56320+65536:i+=this.wcwidth(m)}let d=this.charProperties(h,n),_=eh.extractWidth(d);eh.extractShouldJoin(d)&&(_-=eh.extractWidth(n)),i+=_,n=d}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},HR=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 vS(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 kl=2147483647,IR=256,c1=class L_{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>IR)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 L_;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 l=0;l<a.length;++l)i.addSubParam(a[l]);else i.addParam(a)}return i}clone(){let t=new L_(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>kl?kl: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>kl?kl: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,kl):t}},El=[],UR=class{constructor(){this._state=0,this._active=El,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=El}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=El,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||El,!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",wh(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=El,this._id=-1,this._state=0}}},Fs=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+=wh(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}},Nl=[],FR=class{constructor(){this._handlers=Object.create(null),this._active=Nl,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Nl}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=Nl,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Nl,!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",wh(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=Nl,this._ident=0}},Ll=new c1;Ll.addParam(0);var gS=class{constructor(e){this._handler=e,this._data="",this._params=Ll,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Ll,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=wh(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=Ll,this._data="",this._hitLimit=!1,i));return this._params=Ll,this._data="",this._hitLimit=!1,t}},KR=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}},ci=160,$R=(function(){let e=new KR(4095),t=Array.apply(null,Array(256)).map((d,_)=>_),i=(d,_)=>t.slice(d,_),n=i(32,127),a=i(0,24);a.push(25),a.push.apply(a,i(28,32));let l=i(0,14),h;e.setDefault(1,0),e.addMany(n,0,2,0);for(h in l)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(ci,0,2,0),e.add(ci,8,5,8),e.add(ci,6,0,6),e.add(ci,11,0,11),e.add(ci,13,13,13),e})(),WR=class extends He{constructor(e=$R){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 c1,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(vt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new UR),this._dcsParser=this._register(new FR),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 l=e.intermediates.charCodeAt(a);if(32>l||l>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=l}}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,l=0,h;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,l=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,_=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&_>-1){for(;_>=0&&(h=d[_](this._params),h!==!0);_--)if(h instanceof Promise)return this._parseStack.handlerPos=_,h}this._parseStack.handlers=[];break;case 4:if(i===!1&&_>-1){for(;_>=0&&(h=d[_](),h!==!0);_--)if(h instanceof Promise)return this._parseStack.handlerPos=_,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,l=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let d=l;d<t;++d){switch(n=e[d],a=this._transitions.table[this.currentState<<8|(n<160?n:ci)],a>>4){case 2:for(let b=d+1;;++b){if(b>=t||(n=e[b])<32||n>126&&n<ci){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(n=e[b])<32||n>126&&n<ci){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(n=e[b])<32||n>126&&n<ci){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(n=e[b])<32||n>126&&n<ci){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 _=this._csiHandlers[this._collect<<8|n],m=_?_.length-1:-1;for(;m>=0&&(h=_[m](this._params),h!==!0);m--)if(h instanceof Promise)return this._preserveStack(3,_,m,a,d),h;m<0&&this._csiHandlerFb(this._collect<<8|n,this._params),this.precedingJoinState=0;break;case 8:do switch(n){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(n-48)}while(++d<t&&(n=e[d])>47&&n<60);d--;break;case 9:this._collect<<=8,this._collect|=n;break;case 10:let v=this._escHandlers[this._collect<<8|n],g=v?v.length-1:-1;for(;g>=0&&(h=v[g](),h!==!0);g--)if(h instanceof Promise)return this._preserveStack(4,v,g,a,d),h;g<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<ci){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<ci){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}}},VR=/^([\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})$/,YR=/^[\da-f]+$/;function yS(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let i=VR.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),YR.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 l=parseInt(t.slice(i*a,i*a+i),16);n[a]=i===1?l<<4:i===2?l:i===3?l>>4:l>>8}return n}}function _m(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 GR(e,t=16){let[i,n,a]=e;return`rgb:${_m(i,t)}/${_m(n,t)}/${_m(a,t)}`}var QR={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Vr=131072,bS=10;function SS(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 xS=5e3,wS=0,ZR=class extends He{constructor(e,t,i,n,a,l,h,d,_=new WR){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=n,this._optionsService=a,this._oscLinkService=l,this._coreMouseService=h,this._unicodeService=d,this._parser=_,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new pO,this._utf8Decoder=new vO,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Lt.clone(),this._eraseAttrDataInternal=Lt.clone(),this._onRequestBell=this._register(new oe),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new oe),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new oe),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new oe),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new oe),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new oe),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new oe),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new oe),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new oe),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new oe),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new oe),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new oe),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new oe),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 z_(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(m=>this._activeBuffer=m.activeBuffer)),this._parser.setCsiHandlerFallback((m,v)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(m),params:v.toArray()})}),this._parser.setEscHandlerFallback(m=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(m)})}),this._parser.setExecuteHandlerFallback(m=>{this._logService.debug("Unknown EXECUTE code: ",{code:m})}),this._parser.setOscHandlerFallback((m,v,g)=>{this._logService.debug("Unknown OSC code: ",{identifier:m,action:v,data:g})}),this._parser.setDcsHandlerFallback((m,v,g)=>{v==="HOOK"&&(g=g.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(m),action:v,payload:g})}),this._parser.setPrintHandler((m,v,g)=>this.print(m,v,g)),this._parser.registerCsiHandler({final:"@"},m=>this.insertChars(m)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},m=>this.scrollLeft(m)),this._parser.registerCsiHandler({final:"A"},m=>this.cursorUp(m)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},m=>this.scrollRight(m)),this._parser.registerCsiHandler({final:"B"},m=>this.cursorDown(m)),this._parser.registerCsiHandler({final:"C"},m=>this.cursorForward(m)),this._parser.registerCsiHandler({final:"D"},m=>this.cursorBackward(m)),this._parser.registerCsiHandler({final:"E"},m=>this.cursorNextLine(m)),this._parser.registerCsiHandler({final:"F"},m=>this.cursorPrecedingLine(m)),this._parser.registerCsiHandler({final:"G"},m=>this.cursorCharAbsolute(m)),this._parser.registerCsiHandler({final:"H"},m=>this.cursorPosition(m)),this._parser.registerCsiHandler({final:"I"},m=>this.cursorForwardTab(m)),this._parser.registerCsiHandler({final:"J"},m=>this.eraseInDisplay(m,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},m=>this.eraseInDisplay(m,!0)),this._parser.registerCsiHandler({final:"K"},m=>this.eraseInLine(m,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},m=>this.eraseInLine(m,!0)),this._parser.registerCsiHandler({final:"L"},m=>this.insertLines(m)),this._parser.registerCsiHandler({final:"M"},m=>this.deleteLines(m)),this._parser.registerCsiHandler({final:"P"},m=>this.deleteChars(m)),this._parser.registerCsiHandler({final:"S"},m=>this.scrollUp(m)),this._parser.registerCsiHandler({final:"T"},m=>this.scrollDown(m)),this._parser.registerCsiHandler({final:"X"},m=>this.eraseChars(m)),this._parser.registerCsiHandler({final:"Z"},m=>this.cursorBackwardTab(m)),this._parser.registerCsiHandler({final:"`"},m=>this.charPosAbsolute(m)),this._parser.registerCsiHandler({final:"a"},m=>this.hPositionRelative(m)),this._parser.registerCsiHandler({final:"b"},m=>this.repeatPrecedingCharacter(m)),this._parser.registerCsiHandler({final:"c"},m=>this.sendDeviceAttributesPrimary(m)),this._parser.registerCsiHandler({prefix:">",final:"c"},m=>this.sendDeviceAttributesSecondary(m)),this._parser.registerCsiHandler({final:"d"},m=>this.linePosAbsolute(m)),this._parser.registerCsiHandler({final:"e"},m=>this.vPositionRelative(m)),this._parser.registerCsiHandler({final:"f"},m=>this.hVPosition(m)),this._parser.registerCsiHandler({final:"g"},m=>this.tabClear(m)),this._parser.registerCsiHandler({final:"h"},m=>this.setMode(m)),this._parser.registerCsiHandler({prefix:"?",final:"h"},m=>this.setModePrivate(m)),this._parser.registerCsiHandler({final:"l"},m=>this.resetMode(m)),this._parser.registerCsiHandler({prefix:"?",final:"l"},m=>this.resetModePrivate(m)),this._parser.registerCsiHandler({final:"m"},m=>this.charAttributes(m)),this._parser.registerCsiHandler({final:"n"},m=>this.deviceStatus(m)),this._parser.registerCsiHandler({prefix:"?",final:"n"},m=>this.deviceStatusPrivate(m)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},m=>this.softReset(m)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},m=>this.setCursorStyle(m)),this._parser.registerCsiHandler({final:"r"},m=>this.setScrollRegion(m)),this._parser.registerCsiHandler({final:"s"},m=>this.saveCursor(m)),this._parser.registerCsiHandler({final:"t"},m=>this.windowOptions(m)),this._parser.registerCsiHandler({final:"u"},m=>this.restoreCursor(m)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},m=>this.insertColumns(m)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},m=>this.deleteColumns(m)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},m=>this.selectProtected(m)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},m=>this.requestMode(m,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},m=>this.requestMode(m,!1)),this._parser.setExecuteHandler(J.BEL,()=>this.bell()),this._parser.setExecuteHandler(J.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(J.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(J.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(J.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(J.BS,()=>this.backspace()),this._parser.setExecuteHandler(J.HT,()=>this.tab()),this._parser.setExecuteHandler(J.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(J.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Xu.IND,()=>this.index()),this._parser.setExecuteHandler(Xu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Xu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Fs(m=>(this.setTitle(m),this.setIconName(m),!0))),this._parser.registerOscHandler(1,new Fs(m=>this.setIconName(m))),this._parser.registerOscHandler(2,new Fs(m=>this.setTitle(m))),this._parser.registerOscHandler(4,new Fs(m=>this.setOrReportIndexedColor(m))),this._parser.registerOscHandler(8,new Fs(m=>this.setHyperlink(m))),this._parser.registerOscHandler(10,new Fs(m=>this.setOrReportFgColor(m))),this._parser.registerOscHandler(11,new Fs(m=>this.setOrReportBgColor(m))),this._parser.registerOscHandler(12,new Fs(m=>this.setOrReportCursorColor(m))),this._parser.registerOscHandler(104,new Fs(m=>this.restoreIndexedColor(m))),this._parser.registerOscHandler(110,new Fs(m=>this.restoreFgColor(m))),this._parser.registerOscHandler(111,new Fs(m=>this.restoreBgColor(m))),this._parser.registerOscHandler(112,new Fs(m=>this.restoreCursorColor(m))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let m in Kt)this._parser.registerEscHandler({intermediates:"(",final:m},()=>this.selectCharset("("+m)),this._parser.registerEscHandler({intermediates:")",final:m},()=>this.selectCharset(")"+m)),this._parser.registerEscHandler({intermediates:"*",final:m},()=>this.selectCharset("*"+m)),this._parser.registerEscHandler({intermediates:"+",final:m},()=>this.selectCharset("+"+m)),this._parser.registerEscHandler({intermediates:"-",final:m},()=>this.selectCharset("-"+m)),this._parser.registerEscHandler({intermediates:".",final:m},()=>this.selectCharset("."+m)),this._parser.registerEscHandler({intermediates:"/",final:m},()=>this.selectCharset("/"+m));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(m=>(this._logService.error("Parsing error: ",m),m)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new gS((m,v)=>this.requestStatusString(m,v)))}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"),xS))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${xS} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,n=this._activeBuffer.x,a=this._activeBuffer.y,l=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&&(l=this._parseStack.position+Vr)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,m=>String.fromCharCode(m)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(m=>m.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Vr&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Vr))),h||this._dirtyRowTracker.clearRange(),e.length>Vr)for(let m=l;m<e.length;m+=Vr){let v=m+Vr<e.length?m+Vr:e.length,g=typeof e=="string"?this._stringDecoder.decode(e.substring(m,v),this._parseBuffer):this._utf8Decoder.decode(e.subarray(m,v),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,g))return this._preserveStack(n,a,g,m),this._logSlowResolvingAsync(i),i}else if(!h){let m=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,m))return this._preserveStack(n,a,m,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==n||this._activeBuffer.y!==a)&&this._onCursorMove.fire();let d=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),_=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);_<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(_,this._bufferService.rows-1),end:Math.min(d,this._bufferService.rows-1)})}print(e,t,i){let n,a,l=this._charsetService.charset,h=this._optionsService.rawOptions.screenReaderMode,d=this._bufferService.cols,_=this._coreService.decPrivateModes.wraparound,m=this._coreService.modes.insertMode,v=this._curAttrData,g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&g.getWidth(this._activeBuffer.x-1)===2&&g.setCellFromCodepoint(this._activeBuffer.x-1,0,1,v);let b=this._parser.precedingJoinState;for(let S=t;S<i;++S){if(n=e[S],n<127&&l){let N=l[String.fromCharCode(n)];N&&(n=N.charCodeAt(0))}let x=this._unicodeService.charProperties(n,b);a=Un.extractWidth(x);let C=Un.extractShouldJoin(x),j=C?Un.extractWidth(b):0;if(b=x,h&&this._onA11yChar.fire(Zr(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+a-j>d){if(_){let N=g,z=this._activeBuffer.x-j;for(this._activeBuffer.x=j,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),g=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),j>0&&g instanceof Dl&&g.copyCellsFrom(N,z,0,j,!1);z<d;)N.setCellFromCodepoint(z++,0,1,v)}else if(this._activeBuffer.x=d-1,a===2)continue}if(C&&this._activeBuffer.x){let N=g.getWidth(this._activeBuffer.x-1)?1:2;g.addCodepointToCell(this._activeBuffer.x-N,n,a);for(let z=a-j;--z>=0;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,v);continue}if(m&&(g.insertCells(this._activeBuffer.x,a-j,this._activeBuffer.getNullCell(v)),g.getWidth(d-1)===2&&g.setCellFromCodepoint(d-1,0,1,v)),g.setCellFromCodepoint(this._activeBuffer.x++,n,a,v),a>0)for(;--a;)g.setCellFromCodepoint(this._activeBuffer.x++,0,0,v)}this._parser.precedingJoinState=b,this._activeBuffer.x<d&&i-t>0&&g.getWidth(this._activeBuffer.x)===0&&!g.hasContent(this._activeBuffer.x)&&g.setCellFromCodepoint(this._activeBuffer.x,0,1,v),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,i=>SS(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new gS(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Fs(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 l=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);l.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),a),n&&(l.isWrapped=!1)}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){var n;this._restrictCursor(this._bufferService.cols);let i;switch(e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);i<this._bufferService.rows;i++)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!((n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))!=null&&n.getTrimmedLength()););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let a=this._activeBuffer.lines.length-this._bufferService.rows;a>0&&(this._activeBuffer.lines.trimStart(a),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-a,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-a,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,a=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;t--;)this._activeBuffer.lines.splice(a-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,n;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;t--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Lt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let i=e.params[0]||1,n=Un.extractWidth(t),a=this._activeBuffer.x-n,l=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(a),h=new Uint32Array(l.length*i),d=0;for(let m=0;m<l.length;){let v=l.codePointAt(m)||0;h[d++]=v,m+=v>65535?2:1}let _=d;for(let m=1;m<i;++m)h.copyWithin(_,0,d),_+=d;return this.print(h,0,_),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(J.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(J.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(J.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(J.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(J.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Hn),this._charsetService.setgCharset(1,Hn),this._charsetService.setgCharset(2,Hn),this._charsetService.setgCharset(3,Hn);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(C=>(C[C.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",C[C.SET=1]="SET",C[C.RESET=2]="RESET",C[C.PERMANENTLY_SET=3]="PERMANENTLY_SET",C[C.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(i={}));let n=this._coreService.decPrivateModes,{activeProtocol:a,activeEncoding:l}=this._coreMouseService,h=this._coreService,{buffers:d,cols:_}=this._bufferService,{active:m,alt:v}=d,g=this._optionsService.rawOptions,b=(C,j)=>(h.triggerDataEvent(`${J.ESC}[${t?"":"?"}${C};${j}$y`),!0),S=C=>C?1:2,x=e.params[0];return t?x===2?b(x,4):x===4?b(x,S(h.modes.insertMode)):x===12?b(x,3):x===20?b(x,S(g.convertEol)):b(x,0):x===1?b(x,S(n.applicationCursorKeys)):x===3?b(x,g.windowOptions.setWinLines?_===80?2:_===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(g.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(l==="SGR")):x===1015?b(x,4):x===1016?b(x,S(l==="SGR_PIXELS")):x===1048?b(x,1):x===47||x===1047||x===1049?b(x,S(m===v)):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,l=0;do{if(n[l+a]=e.params[t+l],e.hasSubParams(t+l)){let h=e.getSubParams(t+l),d=0;do n[1]===5&&(a=1),n[l+d+1+a]=h[d];while(++d<h.length&&d+l+1+a<n.length);break}if(n[1]===5&&l+a>=2||n[1]===2&&l+a>=5)break;n[1]&&(a=1)}while(++l+t<e.length&&l+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 l}_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(`${J.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${J.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(`${J.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(!SS(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(`${J.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>bS&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>bS&&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 l=parseInt(n);if(CS(l))if(a==="?")t.push({type:0,index:l});else{let h=yS(a);h&&t.push({type:1,index:l,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(l=>l.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=yS(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]);CS(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(QR[e[0]],Kt[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 ui;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(`${J.ESC}${h}${J.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)}},z_=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&&(wS=e,e=t,t=wS),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};z_=jt([ue(0,gs)],z_);function CS(e){return 0<=e&&e<256}var XR=5e7,jS=12,JR=50,eM=class extends He{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 oe),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>XR)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>=jS?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(i,d);a.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(h);return}let l=this._callbacks[this._bufferOffset];if(l&&l(),this._bufferOffset++,this._pendingData-=n.length,performance.now()-i>=jS)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>JR&&(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()}},q_=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),_={data:e,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(_,d)),this._dataByLinkId.set(_.id,_),_.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 l=t.addMarker(t.ybase+t.y),h={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(h,l)),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)))}};q_=jt([ue(0,gs)],q_);var kS=!1,tM=class extends He{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new So),this._onBinary=this._register(new oe),this.onBinary=this._onBinary.event,this._onData=this._register(new oe),this.onData=this._onData.event,this._onLineFeed=this._register(new oe),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new oe),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new oe),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new oe),this._instantiationService=new jR,this.optionsService=this._register(new BR(e)),this._instantiationService.setService(ys,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(M_)),this._instantiationService.setService(gs,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(R_)),this._instantiationService.setService(Nw,this._logService),this.coreService=this._register(this._instantiationService.createInstance(D_)),this._instantiationService.setService(da,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(B_)),this._instantiationService.setService(Ew,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Un)),this._instantiationService.setService(SO,this.unicodeService),this._charsetService=this._instantiationService.createInstance(HR),this._instantiationService.setService(bO,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(q_),this._instantiationService.setService(Tw,this._oscLinkService),this._inputHandler=this._register(new ZR(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ls.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ls.forward(this._bufferService.onResize,this._onResize)),this._register(ls.forward(this.coreService.onData,this._onData)),this._register(ls.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 eM((t,i)=>this._inputHandler.parse(t,i))),this._register(ls.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new oe),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&&!kS&&(this._logService.warn("writeSync is unreliable and will be removed soon."),kS=!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,o1),t=Math.max(t,l1),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(vS.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(vS(this._bufferService),!1))),this._windowsWrappingHeuristics.value=vt(()=>{for(let t of e)t.dispose()})}}},sM={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 iM(e,t,i,n){var h;let a={type:0,cancel:!1,key:void 0},l=(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=J.ESC+"OA":a.key=J.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?a.key=J.ESC+"OD":a.key=J.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?a.key=J.ESC+"OC":a.key=J.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?a.key=J.ESC+"OB":a.key=J.ESC+"[B");break;case 8:a.key=e.ctrlKey?"\b":J.DEL,e.altKey&&(a.key=J.ESC+a.key);break;case 9:if(e.shiftKey){a.key=J.ESC+"[Z";break}a.key=J.HT,a.cancel=!0;break;case 13:a.key=e.altKey?J.ESC+J.CR:J.CR,a.cancel=!0;break;case 27:a.key=J.ESC,e.altKey&&(a.key=J.ESC+J.ESC),a.cancel=!0;break;case 37:if(e.metaKey)break;l?a.key=J.ESC+"[1;"+(l+1)+"D":t?a.key=J.ESC+"OD":a.key=J.ESC+"[D";break;case 39:if(e.metaKey)break;l?a.key=J.ESC+"[1;"+(l+1)+"C":t?a.key=J.ESC+"OC":a.key=J.ESC+"[C";break;case 38:if(e.metaKey)break;l?a.key=J.ESC+"[1;"+(l+1)+"A":t?a.key=J.ESC+"OA":a.key=J.ESC+"[A";break;case 40:if(e.metaKey)break;l?a.key=J.ESC+"[1;"+(l+1)+"B":t?a.key=J.ESC+"OB":a.key=J.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(a.key=J.ESC+"[2~");break;case 46:l?a.key=J.ESC+"[3;"+(l+1)+"~":a.key=J.ESC+"[3~";break;case 36:l?a.key=J.ESC+"[1;"+(l+1)+"H":t?a.key=J.ESC+"OH":a.key=J.ESC+"[H";break;case 35:l?a.key=J.ESC+"[1;"+(l+1)+"F":t?a.key=J.ESC+"OF":a.key=J.ESC+"[F";break;case 33:e.shiftKey?a.type=2:e.ctrlKey?a.key=J.ESC+"[5;"+(l+1)+"~":a.key=J.ESC+"[5~";break;case 34:e.shiftKey?a.type=3:e.ctrlKey?a.key=J.ESC+"[6;"+(l+1)+"~":a.key=J.ESC+"[6~";break;case 112:l?a.key=J.ESC+"[1;"+(l+1)+"P":a.key=J.ESC+"OP";break;case 113:l?a.key=J.ESC+"[1;"+(l+1)+"Q":a.key=J.ESC+"OQ";break;case 114:l?a.key=J.ESC+"[1;"+(l+1)+"R":a.key=J.ESC+"OR";break;case 115:l?a.key=J.ESC+"[1;"+(l+1)+"S":a.key=J.ESC+"OS";break;case 116:l?a.key=J.ESC+"[15;"+(l+1)+"~":a.key=J.ESC+"[15~";break;case 117:l?a.key=J.ESC+"[17;"+(l+1)+"~":a.key=J.ESC+"[17~";break;case 118:l?a.key=J.ESC+"[18;"+(l+1)+"~":a.key=J.ESC+"[18~";break;case 119:l?a.key=J.ESC+"[19;"+(l+1)+"~":a.key=J.ESC+"[19~";break;case 120:l?a.key=J.ESC+"[20;"+(l+1)+"~":a.key=J.ESC+"[20~";break;case 121:l?a.key=J.ESC+"[21;"+(l+1)+"~":a.key=J.ESC+"[21~";break;case 122:l?a.key=J.ESC+"[23;"+(l+1)+"~":a.key=J.ESC+"[23~";break;case 123:l?a.key=J.ESC+"[24;"+(l+1)+"~":a.key=J.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=J.NUL:e.keyCode>=51&&e.keyCode<=55?a.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?a.key=J.DEL:e.keyCode===219?a.key=J.ESC:e.keyCode===220?a.key=J.FS:e.keyCode===221&&(a.key=J.GS);else if((!i||n)&&e.altKey&&!e.metaKey){let d=(h=sM[e.keyCode])==null?void 0:h[e.shiftKey?1:0];if(d)a.key=J.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let _=e.ctrlKey?e.keyCode-64:e.keyCode+32,m=String.fromCharCode(_);e.shiftKey&&(m=m.toUpperCase()),a.key=J.ESC+m}else if(e.keyCode===32)a.key=J.ESC+(e.ctrlKey?J.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let _=e.code.slice(3,4);e.shiftKey||(_=_.toLowerCase()),a.key=J.ESC+_,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=J.US),e.key==="@"&&(a.key=J.NUL));break}return a}var Tt=0,rM=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new _h,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new _h,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,l)=>this._getKey(a)-this._getKey(l)),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,l)=>a-l),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}},pm=0,ES=0,nM=class extends He{constructor(){super(),this._decorations=new rM(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new oe),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new oe),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(vt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new aM(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 l of this._decorations.getKeyIterator(t))n=l.options.x??0,a=n+(l.options.width??1),e>=n&&e<a&&(!i||(l.options.layer??"bottom")===i)&&(yield l)}forEachDecorationAtCell(e,t,i,n){this._decorations.forEachByKey(t,a=>{pm=a.options.x??0,ES=pm+(a.options.width??1),e>=pm&&e<ES&&(!i||(a.options.layer??"bottom")===i)&&n(a)})}},aM=class extends _n{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new oe),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new oe),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()}},oM=1e3,lM=class{constructor(e,t=oM){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,l=this._debounceThresholdMS-a;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},l)}}_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)}},NS=20,ph=class extends He{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 l=0;l<this._terminal.rows;l++)this._rowElements[l]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[l]);if(this._topBoundaryFocusListener=l=>this._handleBoundaryFocus(l,0),this._bottomBoundaryFocusListener=l=>this._handleBoundaryFocus(l,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 lM(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(l=>this._handleResize(l.rows))),this._register(this._terminal.onRender(l=>this._refreshRows(l.start,l.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(l=>this._handleChar(l))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
85
|
+
`))),this._register(this._terminal.onA11yTab(l=>this._handleTab(l))),this._register(this._terminal.onKey(l=>this._handleKey(l.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Ee(a,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(vt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<NS+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
86
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===NS+1&&(this._liveRegion.textContent+=r_.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 l=i.lines.get(i.ydisp+a),h=[],d=(l==null?void 0:l.translateToString(!0,void 0,void 0,h))||"",_=(i.ydisp+a+1).toString(),m=this._rowElements[a];m&&(d.length===0?(m.textContent=" ",this._rowColumns.set(m,[0,1])):(m.textContent=d,this._rowColumns.set(m,h)),m.setAttribute("aria-posinset",_),m.setAttribute("aria-setsize",n),this._alignRowWidth(m))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i=e.target,n=this._rowElements[t===0?1:this._rowElements.length-2],a=i.getAttribute("aria-posinset"),l=t===0?"1":`${this._terminal.buffer.lines.length}`;if(a===l||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 _=this._createAccessibilityTreeNode();this._rowElements.unshift(_),this._rowContainer.insertAdjacentElement("afterbegin",_)}else{let _=this._createAccessibilityTreeNode();this._rowElements.push(_),this._rowContainer.appendChild(_)}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:_,offset:m})=>{let v=_ instanceof Text?_.parentNode:_,g=parseInt(v==null?void 0:v.getAttribute("aria-posinset"),10)-1;if(isNaN(g))return console.warn("row is invalid. Race condition?"),null;let b=this._rowColumns.get(v);if(!b)return console.warn("columns is null. Race condition?"),null;let S=m<b.length?b[m]:b.slice(-1)[0]+1;return S>=this._terminal.cols&&(++g,S=0),{row:g,column:S}},l=a(t),h=a(i);if(!(!l||!h)){if(l.row>h.row||l.row===h.row&&l.column>=h.column)throw new Error("invalid range");this._terminal.select(l.column,l.row,(h.row-l.row)*this._terminal.cols-l.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,l;e.style.transform="";let t=e.getBoundingClientRect().width,i=(l=(a=this._rowColumns.get(e))==null?void 0:a.slice(-1))==null?void 0:l[0];if(!i)return;let n=i*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${n/t})`}};ph=jt([ue(1,mp),ue(2,gr),ue(3,yr)],ph);var P_=class extends He{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 oe),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new oe),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(vt(()=>{var l;aa(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(l=this._activeProviderReplies)==null||l.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Ee(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ee(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ee(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ee(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(l=>{l==null||l.forEach(h=>{h.link.dispose&&h.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[l,h]of this._linkProviderService.linkProviders.entries())t?(a=this._activeProviderReplies)!=null&&a.get(l)&&(i=this._checkLinkProviderResult(l,e,i)):h.provideLinks(e.y,d=>{var m,v;if(this._isMouseOut)return;let _=d==null?void 0:d.map(g=>({link:g}));(m=this._activeProviderReplies)==null||m.set(l,_),i=this._checkLinkProviderResult(l,e,i),((v=this._activeProviderReplies)==null?void 0:v.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 l=0;l<a.length;l++){let h=a[l],d=h.link.range.start.y<e?0:h.link.range.start.x,_=h.link.range.end.y>e?this._bufferService.cols:h.link.range.end.x;for(let m=d;m<=_;m++){if(i.has(m)){a.splice(l--,1);break}i.add(m)}}}}_checkLinkProviderResult(e,t,i){var l;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=(l=this._activeProviderReplies.get(h))==null?void 0:l.find(_=>this._linkAtPosition(_.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&&cM(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,aa(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,l;(n=this._currentLink)!=null&&n.state&&((l=(a=this._currentLink)==null?void 0:a.state)==null?void 0:l.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 l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._askForLink(l,!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([ue(1,_p),ue(2,yr),ue(3,gs),ue(4,Aw)],P_);function cM(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 uM=class extends tM{constructor(e={}){super(e),this._linkifier=this._register(new So),this.browser=Qw,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new So),this._onCursorMove=this._register(new oe),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new oe),this.onKey=this._onKey.event,this._onRender=this._register(new oe),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new oe),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new oe),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new oe),this.onBell=this._onBell.event,this._onFocus=this._register(new oe),this._onBlur=this._register(new oe),this._onA11yCharEmitter=this._register(new oe),this._onA11yTabEmitter=this._register(new oe),this._onWillOpen=this._register(new oe),this._setup(),this._decorationService=this._instantiationService.createInstance(nM),this._instantiationService.setService(lc,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(JA),this._instantiationService.setService(Aw,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(a_)),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(ls.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ls.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ls.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ls.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(vt(()=>{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=_t.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${J.ESC}]${n};${GR(a)}${Yw.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(l=>l.ansi[t.index]=qt.toColor(...t.color));else{let l=i;this._themeService.modifyColors(h=>h[l]=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(ph,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(J.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(J.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),l=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=l+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ee(this.element,"copy",t=>{this.hasSelection()&&mO(t,this._selectionService)}));let e=t=>_O(t,this.textarea,this.coreService,this.optionsService);this._register(Ee(this.textarea,"paste",e)),this._register(Ee(this.element,"paste",e)),Zw?this._register(Ee(this.element,"mousedown",t=>{t.button===2&&q0(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ee(this.element,"contextmenu",t=>{q0(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),wp&&this._register(Ee(this.element,"auxclick",t=>{t.button===1&&xw(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ee(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ee(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ee(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ee(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ee(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ee(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ee(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(Ee(this.screenElement,"mousemove",l=>this.updateCursorStyle(l))),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",i_.get()),e1||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(ZA,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(gr,this._coreBrowserService),this._register(Ee(this.textarea,"focus",l=>this._handleTextAreaFocus(l))),this._register(Ee(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(E_,this._document,this._helperContainer),this._instantiationService.setService(Ch,this._charSizeService),this._themeService=this._instantiationService.createInstance(A_),this._instantiationService.setService(ko,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(fh),this._instantiationService.setService(Ow,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(T_,this.rows,this.screenElement)),this._instantiationService.setService(yr,this._renderService),this._register(this._renderService.onRenderedViewportChange(l=>this._onRender.fire(l))),this.onResize(l=>this._renderService.resize(l.cols,l.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(C_,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(N_),this._instantiationService.setService(_p,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(x_,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(l=>{super.scrollLines(l,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(O_,this.element,this.screenElement,n)),this._instantiationService.setService(wO,this._selectionService),this._register(this._selectionService.onRequestScrollLines(l=>this.scrollLines(l.amount,l.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(l=>this._renderService.handleSelectionChanged(l.start,l.end,l.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(l=>{this.textarea.value=l,this.textarea.focus(),this.textarea.select()})),this._register(ls.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var l;this._selectionService.refresh(),(l=this._viewport)==null||l.queueSync()})),this._register(this._instantiationService.createInstance(w_,this.screenElement)),this._register(Ee(this.element,"mousedown",l=>this._selectionService.handleMouseDown(l))),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(ph,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",l=>this._handleScreenReaderModeOptionChange(l))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(dh,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",l=>{!this._overviewRulerRenderer&&l&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(dh,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(k_,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(l){var m,v,g,b,S;let h=e._mouseService.getMouseReportCoords(l,e.screenElement);if(!h)return!1;let d,_;switch(l.overrideType||l.type){case"mousemove":_=32,l.buttons===void 0?(d=3,l.button!==void 0&&(d=l.button<3?l.button:3)):d=l.buttons&1?0:l.buttons&4?1:l.buttons&2?2:3;break;case"mouseup":_=0,d=l.button<3?l.button:3;break;case"mousedown":_=1,d=l.button<3?l.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(l)===!1)return!1;let x=l.deltaY;if(x===0||e.coreMouseService.consumeWheelEvent(l,(b=(g=(v=(m=e._renderService)==null?void 0:m.dimensions)==null?void 0:v.device)==null?void 0:g.cell)==null?void 0:b.height,(S=e._coreBrowserService)==null?void 0:S.dpr)===0)return!1;_=x<0?0:1,d=4;break;default:return!1}return _===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:_,ctrl:l.ctrlKey,alt:l.altKey,shift:l.shiftKey})}let n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:l=>(i(l),l.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(l)),wheel:l=>(i(l),this.cancel(l,!0)),mousedrag:l=>{l.buttons&&i(l)},mousemove:l=>{l.buttons||i(l)}};this._register(this.coreMouseService.onProtocolChange(l=>{l?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(l)),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()),l&8?n.mousemove||(t.addEventListener("mousemove",a.mousemove),n.mousemove=a.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),l&16?n.wheel||(t.addEventListener("wheel",a.wheel,{passive:!1}),n.wheel=a.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),l&2?n.mouseup||(n.mouseup=a.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),n.mouseup=null),l&4?n.mousedrag||(n.mousedrag=a.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Ee(t,"mousedown",l=>{if(l.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(l)))return i(l),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(l)})),this._register(Ee(t,"wheel",l=>{var h,d,_,m,v;if(!n.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(l)===!1)return!1;if(!this.buffer.hasScrollback){if(l.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(l,(m=(_=(d=(h=e._renderService)==null?void 0:h.dimensions)==null?void 0:d.device)==null?void 0:_.cell)==null?void 0:m.height,(v=e._coreBrowserService)==null?void 0:v.dpr)===0)return this.cancel(l,!0);let g=J.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(l.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(g,!0),this.cancel(l,!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){Sw(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=iM(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===J.ETX||i.key===J.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)&&(hM(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(J.ESC+"[I"):this.coreService.triggerDataEvent(J.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(`${J.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(`${J.ESC}[6;${a};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function hM(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var dM=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)}},fM=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 ui)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},TS=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 fM(t)}getNullCell(){return new ui}},mM=class extends He{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new oe),this.onBufferChange=this._onBufferChange.event,this._normal=new TS(this._core.buffers.normal,"normal"),this._alternate=new TS(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)}},_M=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)}},pM=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}},vM=["cols","rows"],Ni=0,gM=class extends He{constructor(e){super(),this._core=this._register(new uM(e)),this._addonManager=this._register(new dM),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(vM.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 _M(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new pM(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 mM(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 i_.get()},set promptLabel(e){i_.set(e)},get tooMuchOutput(){return r_.get()},set tooMuchOutput(e){r_.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]},V3={2:2,8:8,10:10,12:12},Y3={"gutter/line":44},yM={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]},bM=['"JetBrainsMono Nerd Font"','"MesloLGS NF"','"FiraCode Nerd Font"','"Hack Nerd Font"','"JetBrains Mono"',"ui-monospace","SFMono-Regular","Menlo","monospace"].join(", "),SM=13,xM=20/13;function Eh({sessionId:e,connect:t=nw,readOnly:i=!1,onReady:n,onMessage:a}){const l=k.useRef(null),h=k.useRef(null),d=k.useRef(i);d.current=i;const _=k.useRef(n),m=k.useRef(a);return _.current=n,m.current=a,k.useEffect(()=>{var z;const v=l.current;if(!v)return;const g=new gM({convertEol:!1,cursorBlink:!d.current,disableStdin:d.current,scrollback:1e4,theme:yM,fontFamily:bM,fontSize:SM,lineHeight:xM}),b=new cO;g.loadAddon(b),g.open(v),h.current=g,vm(b),d.current||g.focus();const S=t(e,{onMessage(B){var M;B.type==="attached"?(vm(b),g.reset(),g.write(B.snapshot)):B.type==="output"&&g.write(B.data),(M=m.current)==null||M.call(m,B)}}),x=g.onData(B=>{d.current||S.send({type:"input",data:B})}),C=g.onResize(({cols:B,rows:M})=>S.send({type:"resize",cols:B,rows:M})),j=()=>vm(b);window.addEventListener("resize",j);const N=typeof ResizeObserver>"u"?null:new ResizeObserver(j);return N==null||N.observe(v),(z=_.current)==null||z.call(_,g),()=>{N==null||N.disconnect(),window.removeEventListener("resize",j),x.dispose(),C.dispose(),S.close(),g.dispose(),h.current=null}},[e,t]),k.useEffect(()=>{var g;const v=h.current;v!==null&&(v.options.disableStdin=i,v.options.cursorBlink=!i,i&&((g=l.current)!=null&&g.contains(document.activeElement))&&v.blur())},[i]),c.jsx("div",{className:"terminal","data-testid":"terminal","data-readonly":i?"true":void 0,ref:l})}function vm(e){try{e.fit()}catch{}}function wM({scope:e,dock:t,onAskAgent:i}){var d,_,m;const[n,a]=k.useState("run"),l=gw(e),h=nO(e);return t.open?c.jsxs("div",{className:"dock",style:{height:`${String(t.height)}px`},"data-testid":"run-dock",children:[c.jsx("span",{className:"dock__grip",role:"separator","aria-orientation":"horizontal","aria-label":"altura do rodapé",onPointerDown:t.beginResize}),c.jsxs("div",{className:"dock__bar",role:"tablist","aria-label":"execução do checkout",children:[c.jsx("button",{type:"button",className:"dock__fold",title:"recolher o rodapé","aria-label":"recolher o rodapé",onClick:t.toggle,children:"⌄"}),c.jsx(Fu,{label:"Setup",active:n==="setup",dot:gm((d=l.data)==null?void 0:d.setup),onClick:()=>a("setup")}),c.jsx(Fu,{label:"Run",active:n==="run",dot:gm((_=l.data)==null?void 0:_.run),onClick:()=>a("run")}),c.jsx(Fu,{label:"Testes",active:n==="test",dot:gm((m=l.data)==null?void 0:m.test),onClick:()=>a("test")}),c.jsx(Fu,{label:"Terminal",active:n==="terminal",onClick:()=>a("terminal")}),c.jsx("span",{className:"dock__spacer"}),c.jsxs("div",{className:"dock__acts",children:[n==="run"&&c.jsx(CM,{status:l.data,actions:h}),(n==="setup"||n==="test")&&c.jsx(jM,{phase:n,status:l.data,actions:h})]})]}),n==="terminal"?c.jsx(OM,{scope:e}):l.isError?c.jsx("div",{className:"dock__idle",role:"alert",children:c.jsx("span",{children:l.error.message})}):c.jsx(kM,{scope:e,phase:n,status:l.data,actions:h,onAskAgent:i})]}):c.jsx(AM,{scope:e,status:l.data,onOpen:t.toggle})}function gm(e){return e!=null&&e.last?e.last.running?"run":e.last.exitCode===0?"ok":"fail":null}function Fu({label:e,active:t,dot:i=null,onClick:n}){return c.jsxs("button",{type:"button",role:"tab","aria-selected":t,className:`dtab${t?" dtab--active":""}`,onClick:n,children:[i!==null&&c.jsx("span",{className:`dtab__dot dtab__dot--${i}`,"data-testid":`dot-${e.toLowerCase()}`}),e]})}function CM({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?c.jsxs(c.Fragment,{children:[n!==null&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"openbtn__from dock__note",children:n.source==="env"?"porta de LUMEM_RUN_PORT":"porta lida da saída"}),c.jsxs("a",{className:"openbtn",href:`http://127.0.0.1:${String(n.port)}`,target:"_blank",rel:"noreferrer",children:[c.jsx("span",{children:"Abrir"}),c.jsxs("span",{className:"openbtn__port",children:[":",n.port]})]})]}),c.jsx(pe,{size:"sm",glyph:c.jsx("span",{className:"stopglyph",children:"⏹"}),disabled:t.stop.isPending,onClick:()=>t.stop.mutate("run"),children:"parar"})]}):c.jsx(pe,{size:"sm",variant:"primary",disabled:(e==null?void 0:e.run.command)===null||t.start.isPending,onClick:()=>t.start.mutate("run"),children:"▶ rodar"})}function jM({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 c.jsx(pe,{size:"sm",glyph:c.jsx("span",{className:"stopglyph",children:"⏹"}),onClick:()=>i.stop.mutate(e),children:"parar"});const a=n!==null&&n.exitCode!==0;return c.jsxs(pe,{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 kM({scope:e,phase:t,status:i,actions:n,onAskAgent:a}){if(!i)return c.jsx("div",{className:"dock__idle",children:"lendo o checkout…"});const l=i[t].command;if(l===null)return c.jsx(NM,{scope:e,status:i,onAskAgent:a});if(!i.trusted)return c.jsx(TM,{status:i,phase:t,actions:n});const h=i[t].last,d=h!==null&&!h.running&&h.exitCode!==0;return c.jsxs(c.Fragment,{children:[t==="setup"&&d&&c.jsxs("div",{className:"dock__banner",role:"status",children:[c.jsx(at,{tone:"warn",children:"⚠"}),c.jsxs("span",{children:[c.jsx("strong",{children:"A worktree foi criada; o setup dela falhou."})," Ela funciona — só não está preparada."]})]}),c.jsxs("div",{className:"dock__state",children:[h===null?c.jsx(Ft,{children:"nunca rodou"}):h.running?c.jsxs(Ft,{tone:"clean",dot:!0,children:["rodando · ",s_(h.startedAt)]}):c.jsxs(Ft,{dot:!0,children:["saiu ",h.exitCode??"?"," · ",s_(h.finishedAt??h.startedAt)]}),c.jsx("span",{className:"dock__cmd",children:l}),c.jsx("span",{className:"dock__spacer"}),c.jsx("span",{className:"dock__note",children:i.reservedPort===null?"":`porta reservada :${String(i.reservedPort)}`})]}),h!==null&&!h.outputAvailable?c.jsx("div",{className:"dock__idle",children:c.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?c.jsx("div",{className:"dock__idle",children:c.jsxs("span",{children:["Este checkout ainda não rodou ",t==="test"?"os testes":`o ${t}`,". O botão está ali em cima."]})}):c.jsx("div",{className:"dock__out",children:c.jsx(Eh,{sessionId:h.sessionId,readOnly:!h.running},h.sessionId)})]})}function EM(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 NM({scope:e,status:t,onAskAgent:i}){const n=Ye(),l=(Ae({queryKey:["agentConfig","list"],queryFn:()=>ie.agentConfig.list.query()}).data??[]).find(_=>_.transport==="acp")??null,h=Ve({mutationFn:async()=>{if(l===null)throw new Error("nenhum agente conectado");const _=await ie.session.createAgent.mutate({scopeType:e.scopeType,scopeId:e.scopeId,agentConfigId:l.id});return await n.invalidateQueries({queryKey:Hi(e.scopeType,e.scopeId)}),_.id},onSuccess:_=>i==null?void 0:i(_,EM(t.file))}),d=k.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 c.jsxs("div",{className:"noscripts",children:[c.jsx("span",{className:"noscripts__t",children:"Este projeto não diz como rodar."}),c.jsxs("p",{className:"noscripts__d",children:["O Lumem lê os comandos de um arquivo ",c.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 ",c.jsx("code",{children:"Setup"})," e ",c.jsx("code",{children:"Run"})," ficam vazias — o ",c.jsx("code",{children:"Terminal"})," continua funcionando."]}),c.jsx("span",{className:"noscripts__where",children:t.file}),c.jsx("pre",{className:"toml",children:d}),c.jsxs("div",{className:"noscripts__acts",children:[c.jsx(pe,{size:"sm",variant:"primary",disabled:l===null||i===void 0||h.isPending,onClick:()=>h.mutate(),children:h.isPending?"abrindo a conversa…":"pedir para o agente criar"}),c.jsx(pe,{size:"sm",onClick:()=>{var _;return void((_=navigator.clipboard)==null?void 0:_.writeText(d))},children:"copiar o exemplo"}),l===null&&c.jsx("span",{className:"trust__note",children:"conecte um agente na barra da esquerda para pedir — ou escreva o arquivo à mão"}),h.isError&&c.jsx("span",{className:"trust__note",role:"alert",children:h.error.message})]})]})}function TM({status:e,phase:t,actions:i}){return c.jsxs("div",{className:"trust",children:[c.jsxs("div",{className:"trust__head",children:[c.jsx("span",{className:"trust__glyph",children:"⚠"}),"Este comando vem do repositório, não de você."]}),c.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."}),c.jsx("div",{className:"trust__cmd",children:e[t].command}),c.jsxs("div",{className:"trust__acts",children:[c.jsx(pe,{size:"sm",variant:"primary",disabled:i.trust.isPending,onClick:()=>i.trust.mutate(),children:"confiar neste projeto"}),c.jsx("span",{className:"trust__note",children:"Vale para este projeto nesta máquina — e volta a perguntar se o comando mudar."})]})]})}function OM({scope:e}){const t=Ye(),i=dp(e),[n,a]=k.useState(null),l=(i.data??[]).filter(_=>_.kind==="shell"&&_.state==="running"),h=l.find(_=>_.id===n)??l[0]??null;async function d(){const _=await ie.session.createShell.mutate(e);a(_.id),await t.invalidateQueries({queryKey:Hi(e.scopeType,e.scopeId)})}return h==null?c.jsxs("div",{className:"dock__idle",children:[c.jsx("span",{children:"Nenhum terminal aberto neste checkout."}),c.jsx(pe,{size:"sm",onClick:()=>void d(),children:"+ abrir terminal"})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"dock__state",children:[c.jsxs(Ft,{tone:"clean",dot:!0,children:[l.length," viva",l.length>1?"s":""]}),c.jsxs("span",{className:"dock__cmd dock__cmd--dim",children:["cwd ",h.cwd]}),c.jsx("span",{className:"dock__spacer"}),c.jsx("button",{type:"button",className:"dock__new",onClick:()=>void d(),children:"+ outro terminal"})]}),c.jsx("div",{className:"dock__out",children:c.jsx(Eh,{sessionId:h.id},h.id)})]})}function AM({scope:e,status:t,onOpen:i}){var l;const n=((l=t==null?void 0:t.run.last)==null?void 0:l.running)===!0,a=(t==null?void 0:t.port)??null;return c.jsx("div",{className:"dock dock--collapsed","data-testid":"run-dock-folded",children:c.jsxs("div",{className:"dock__folded",children:[c.jsx("button",{type:"button",className:"dock__fold","aria-label":"abrir o rodapé",onClick:i,children:"⌃"}),n?c.jsxs("span",{className:"runmark",children:[c.jsx("span",{className:"runmark__glyph",children:"▶"}),a===null?"run":`run · :${String(a.port)}`]}):c.jsx("span",{children:"setup, run e terminal"}),c.jsx("span",{className:"dock__spacer"}),c.jsx("span",{className:"dock__note",children:e.scopeType==="worktree"?"worktree":"projeto"})]})})}function RM({scope:e,onClose:t,onResize:i,dock:n,onAskAgent:a}){var N,z,B,M;const l=Ye(),[h,d]=k.useState("files"),[_,m]=k.useState("worktree"),v=cp(),g=IT(e),b=dw(e,"worktree"),S=op("pending"),x=UT(e),C=new Map((((N=b.data)==null?void 0:N.files)??[]).map(V=>[V.path,V.status])),j=v.activeTab===null?null:v.fileFor(v.activeTab);return c.jsxs(iO,{tab:h,onSelectTab:d,changeCount:((z=b.data)==null?void 0:z.files.length)??null,proposalCount:((B=S.data)==null?void 0:B.length)??null,actions:h==="files"?c.jsx(VT,{edits:g}):void 0,onReload:()=>{l.invalidateQueries({queryKey:["files"]}),l.invalidateQueries({queryKey:["changes"]})},onClose:t,onResize:i,dock:c.jsx(wM,{scope:e,dock:n,onAskAgent:a}),footLeft:b.isError?"não deu para ler o checkout":void 0,footRight:h==="changes"?_==="worktree"?"árvore de trabalho vs HEAD":`vs ${((M=b.data)==null?void 0:M.baseBranch)??"base"}`:void 0,children:[h==="files"&&c.jsx(WT,{scope:e,openPath:(j==null?void 0:j.view)==="file"?j.path:null,onOpen:V=>v.open({path:V,view:"file"}),statusOf:V=>C.get(V),edits:g}),h==="changes"&&c.jsx(FT,{scope:e,openPath:(j==null?void 0:j.view)==="patch"?j.path:null,onOpenPatch:(V,ee)=>v.open({path:V,view:"patch",ref:ee}),onRefChange:m}),h==="memory"&&c.jsx(ow,{workspaceId:x.workspaceId,projectId:x.projectId})]})}function MM({workspaceId:e,onRetry:t}){const i=Ye(),n=M2(e),[a,l]=k.useState(null),h=Ve({mutationFn:m=>ie.project.cloneCancel.mutate({jobId:m}),onSuccess:()=>i.invalidateQueries({queryKey:yh(e)})});if(n===null||n.id===a||n.state==="cancelled")return null;if(bh(n.state))return c.jsx(DM,{job:n,onDismiss:async()=>{l(n.id),await i.invalidateQueries({queryKey:ca(e)})},...t===void 0?{}:{onRetry:t}});const d=n.percent,_=n.phase===null?null:O2[n.phase]??n.phase;return c.jsxs("div",{className:"clone-row","data-state":n.state,"aria-label":`clonando ${n.name}`,children:[c.jsxs("div",{className:"clone-row__top",children:[c.jsx(at,{tone:"project",children:"■"}),c.jsx("span",{className:"clone-row__name",children:n.name}),d!==null&&c.jsxs("span",{className:"clone-row__pct",children:[d,"%"]}),n.state==="cloning"&&c.jsx("button",{type:"button",className:"clone-row__cancel","aria-label":`cancelar o clone de ${n.name}`,onClick:()=>h.mutate(n.id),children:"✕"})]}),c.jsx("div",{className:d===null?"bar bar--unknown":"bar",children:c.jsx("div",{className:"bar__fill",style:d===null?void 0:{width:`${d}%`}})}),c.jsx("p",{className:"clone-row__phase",children:n.state==="registering"?"registrando":_??"conectando"})]})}function DM({job:e,onDismiss:t,onRetry:i}){if(e.state==="done")return e.message===null||!e.message.includes("registrado como")?null:c.jsxs("div",{className:"clone-outcome clone-outcome--done",role:"status",children:[c.jsx("p",{className:"clone-outcome__body",children:e.message}),c.jsx(pe,{variant:"ghost",size:"sm",onClick:t,children:"entendi"})]});const n=e.failure==="auth"?LM(e.url):null;return c.jsxs("div",{className:"clone-outcome clone-outcome--failed",role:"alert",children:[c.jsx("p",{className:"clone-outcome__title",children:e.failure==="auth"?`não consegui autenticar em ${BM(e.url)}`:`não deu para clonar ${e.name}`}),e.failure==="auth"&&c.jsxs(c.Fragment,{children:[c.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:"}),c.jsxs("ul",{className:"clone-outcome__ways",children:[c.jsx("li",{children:"usar a URL ssh do mesmo repositório, com a chave no ssh-agent;"}),c.jsx("li",{children:"configurar um credential.helper para https."})]})]}),e.message!==null&&c.jsx("code",{className:"clone-outcome__git",children:e.message}),c.jsxs("div",{className:"clone-outcome__actions",children:[n!==null&&i!==void 0&&c.jsx(pe,{variant:"primary",size:"sm",onClick:()=>i(n),children:"tentar por ssh"}),c.jsx(pe,{variant:"ghost",size:"sm",onClick:t,children:"dispensar"})]}),n!==null&&c.jsx("p",{className:"clone-outcome__path",children:n})]})}function BM(e){try{return new URL(e).host}catch{return e}}function LM(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}`}function zM({projectId:e,onCreated:t,hasCommits:i=null}){const n=Ye(),[a,l]=k.useState(!1),[h,d]=k.useState(""),_=Ve({mutationFn:()=>ie.worktree.create.mutate({projectId:e,name:h.trim()}),onSuccess:async b=>{await n.invalidateQueries({queryKey:xo(e)}),t(b.id),l(!1),d("")}}),m=b=>{b.preventDefault(),h.trim()!==""&&_.mutate()},v=i===!1;if(!a)return c.jsx(pe,{variant:"primary",glyph:c.jsx(at,{children:"◇"}),onClick:()=>l(!0),disabled:v,title:v?"este repositório ainda não tem nenhum commit":void 0,children:"nova worktree"});const g=`worktree-name-${e}`;return c.jsx("form",{className:"create-worktree",onSubmit:m,children:c.jsxs(Sh,{children:[c.jsx(as,{id:g,label:"Nome da worktree",error:_.isError?_.error.message:void 0,children:c.jsx(ps,{id:g,value:h,onChange:b=>d(b.target.value),placeholder:"teste-prd",invalid:_.isError,autoFocus:!0})}),v?c.jsx("div",{className:"create-worktree__status",children:c.jsx(Re,{tone:"warning",children:"este repositório ainda não tem nenhum commit — faça o primeiro para poder cortar worktrees"})}):c.jsx("p",{className:"create-worktree__hint",children:"A branch tem o mesmo nome. Barra vira diretório aninhado."}),c.jsxs("div",{className:"create-worktree__actions",children:[c.jsx(pe,{type:"submit",variant:"primary",disabled:_.isPending||h.trim()===""||v,children:_.isPending?"criando…":"criar"}),c.jsx(pe,{variant:"ghost",onClick:()=>l(!1),children:"cancelar"})]}),_.isPending&&c.jsx("div",{className:"create-worktree__status",children:c.jsx(Re,{tone:"info",children:"criando a worktree…"})})]})})}const u1=k.createContext(null);function qM({children:e}){const[t,i]=k.useState(new Set),n=k.useCallback((l,h)=>{i(d=>{if(d.has(l)===h)return d;const _=new Set(d);return h?_.add(l):_.delete(l),_})},[]),a=k.useMemo(()=>({isWaiting:l=>t.has(l),countIn:l=>l.filter(h=>t.has(h)).length,setWaiting:n}),[t,n]);return c.jsx(u1.Provider,{value:a,children:e})}function Cp(){return k.useContext(u1)??{isWaiting:()=>!1,countIn:()=>0,setWaiting:()=>{}}}function PM(e){const t=dp(e),i=Ye(),[n,a]=k.useState(null),[l,h]=k.useState(new Set),[d,_]=k.useState(new Set),m=k.useMemo(()=>t.data??[],[t.data]),v=k.useMemo(()=>{const j=m.filter(z=>!d.has(z.id)&&(z.state==="running"||l.has(z.id))),N=new Map;return j.map(z=>{const B=z.agentName??"shell",M=(N.get(B)??0)+1;return N.set(B,M),{sessionId:z.id,label:B,kind:z.kind,state:z.state,exitCode:z.exitCode,command:z.command,transport:z.transport==="acp"?"acp":"pty",agentConfigId:z.agentConfigId,...M>1?{ordinal:M}:{}}})},[m,l,d]);k.useEffect(()=>{n!==null&&!v.some(j=>j.sessionId===n)&&a(null)},[v,n]);const g=k.useCallback(j=>a(j),[]),b=k.useCallback(j=>{const N=m.find(z=>z.id===j);N===void 0||N.state==="running"||(_(z=>new Set(z).add(j)),h(z=>{const B=new Set(z);return B.delete(j),B}))},[m]),S=k.useCallback(j=>{_(N=>{const z=new Set(N);return z.delete(j),z}),h(N=>new Set(N).add(j)),a(j)},[]),x=Ve({mutationFn:j=>ie.session.resume.mutate({id:j}),onSuccess:async j=>{await i.invalidateQueries({queryKey:Hi(e.scopeType,e.scopeId)}),a(j.id)}}),C=k.useCallback(j=>x.mutate(j),[x]);return{tabs:v,activeId:n,select:g,close:b,reopen:S,resume:C,resuming:x.isPending?x.variables??null:null,sessions:t}}const HM=800;function OS(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 l=0;for(;l<i.length-a&&l<n.length-a&&i[i.length-1-l]===n[n.length-1-l];)l++;return{added:n.length-a-l,removed:i.length-a-l}}function Ku(e,t){return e.scopeType===t.scopeType&&e.scopeId===t.scopeId&&e.path===t.path}function IM(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function UM(e){return e instanceof Error?e.message:String(e)}function AS(e){return e===void 0||e.kind!=="text"?null:e}function FM({scope:e,path:t,active:i}){const n=Ye(),a=k.useRef(null),l=k.useRef(null),h=k.useRef({scopeType:e.scopeType,scopeId:e.scopeId,path:t}),d=k.useRef(null),_=k.useRef(0),m=k.useRef(0),v=k.useRef(null),g=k.useRef(!1),b=k.useRef(!1),S=k.useRef(null),x=k.useRef(null),C=k.useRef(!1),j=k.useRef([]),[N,z]=k.useState({kind:"clean"}),[B,M]=k.useState(!0),V=k.useRef(!0),ee=Ou(e.scopeType,e.scopeId,t),q=Ae({queryKey:ee,queryFn:()=>{const $=n.getQueryData(ee);return!V.current&&$!==void 0?(C.current=!0,$):ie.files.read.query({scopeType:e.scopeType,scopeId:e.scopeId,path:t})},refetchOnWindowFocus:B}),te=AS(q.data),he=k.useRef(!1);he.current=te===null||te.readOnly!==null;const de=k.useCallback($=>{V.current=$,M($)},[]),ge=k.useCallback(()=>{x.current!==null&&(window.clearTimeout(x.current),x.current=null)},[]),G=k.useCallback($=>{S.current=$,z({kind:"stale",...$})},[]),K=k.useCallback(()=>!g.current&&(v.current===null||b.current),[]),se=k.useCallback(()=>{if(!K())return;const $=j.current;if($.length!==0){j.current=[];for(const le of $)le()}},[K]),L=k.useCallback($=>{n.invalidateQueries({queryKey:["changes"]}),n.invalidateQueries({queryKey:J_($.scopeType,$.scopeId,IM($.path))})},[n]),T=k.useCallback(()=>{if(g.current||b.current)return;const $=v.current;$!==null&&(v.current=null,g.current=!0,z({kind:"saving"}),n.cancelQueries({queryKey:Ou($.target.scopeType,$.target.scopeId,$.target.path)}),ie.files.write.mutate({scopeType:$.target.scopeType,scopeId:$.target.scopeId,path:$.target.path,text:$.text,baseRevision:$.baseRevision}).then(le=>{var ye,Be;if(!le.ok){if(!Ku($.target,h.current))return;b.current=!0,ge(),G({revision:le.revision,changedAt:le.changedAt,base:((ye=l.current)==null?void 0:ye.text)??$.text,mine:((Be=a.current)==null?void 0:Be.getDoc())??$.text,disk:null}),ie.files.read.query($.target).then(kt=>{const Qe=AS(kt),As=S.current;Qe===null||As===null||G({...As,disk:Qe})}).catch(()=>{});return}Ku($.target,h.current)&&(l.current={text:$.text,revision:le.revision},_.current===$.version&&(m.current=$.version,de(!0)),z({kind:"saved",at:Date.now()})),v.current!==null&&Ku(v.current.target,$.target)&&(v.current={...v.current,baseRevision:le.revision}),L($.target)}).catch(le=>{Ku($.target,h.current)&&z({kind:"failed",why:UM(le)})}).finally(()=>{g.current=!1,T(),se()}))},[ge,L,n,se,de,G]),U=k.useCallback(()=>{ge();const $=a.current,le=l.current,ye=d.current;$===null||le===null||ye===null||_.current!==m.current&&(v.current={target:ye,text:$.getDoc(),baseRevision:le.revision,version:_.current},T())},[ge,T]),F=k.useCallback(()=>{if(b.current||(U(),K()))return Promise.resolve();const $=new Promise(le=>{j.current.push(le)});return qT($),$},[K,U]),me=k.useCallback(()=>{if(_.current+=1,d.current=h.current,de(!1),b.current){const $=S.current,le=a.current;$!==null&&le!==null&&G({...$,mine:le.getDoc()});return}ge(),x.current=window.setTimeout(()=>{x.current=null,U()},HM)},[ge,U,de,G]),Ce=k.useCallback($=>{var le;if($===null){F(),(le=a.current)==null||le.onChange(null),a.current=null;return}a.current=$,!he.current&&$.onChange(me)},[me,F]),A=k.useCallback(()=>{U()},[U]),Q=k.useCallback(()=>{const $=S.current,le=d.current;if($===null||le===null)return;S.current=null,b.current=!1,m.current=_.current,de(!0),z({kind:"clean"});const ye=Ou(le.scopeType,le.scopeId,le.path);if($.disk===null){n.invalidateQueries({queryKey:ye});return}n.setQueryData(ye,$.disk)},[n,de]),ae=k.useCallback(()=>{const $=S.current,le=a.current,ye=d.current;$===null||le===null||ye===null||(S.current=null,b.current=!1,v.current={target:ye,text:le.getDoc(),baseRevision:$.revision,version:_.current},T())},[T]);return k.useEffect(()=>{h.current={scopeType:e.scopeType,scopeId:e.scopeId,path:t},d.current=null,m.current=_.current,b.current=!1,S.current=null,l.current=null,de(!0),z({kind:"clean"})},[e.scopeType,e.scopeId,t,de]),k.useEffect(()=>{var $;te!==null&&V.current&&(l.current={text:te.text,revision:te.revision},($=a.current)==null||$.setDoc(te.text))},[te]),k.useEffect(()=>{!B||!C.current||(C.current=!1,n.invalidateQueries({queryKey:Ou(e.scopeType,e.scopeId,t)}))},[B,n,e.scopeType,e.scopeId,t]),k.useEffect(()=>{i||F()},[i,F]),k.useEffect(()=>{const $=()=>void F();return window.addEventListener("blur",$),()=>window.removeEventListener("blur",$)},[F]),k.useEffect(()=>ge,[ge]),{content:q,state:N,attach:Ce,retry:A,reload:Q,overwrite:ae}}const h1="lumem",KM={name:h1,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"]}}]},$M={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"},WM={typescript:()=>Ut(()=>import("./typescript-BPQ3VLAy.js"),[]),tsx:()=>Ut(()=>import("./tsx-COt5Ahok.js"),[]),javascript:()=>Ut(()=>import("./javascript-wDzz0qaB.js"),[]),jsx:()=>Ut(()=>import("./jsx-g9-lgVsj.js"),[]),json:()=>Ut(()=>import("./json-Cp-IABpG.js"),[]),markdown:()=>Ut(()=>import("./markdown-Cvjx9yec.js"),[]),css:()=>Ut(()=>import("./css-CLj8gQPS.js"),[]),html:()=>Ut(()=>import("./html-pp8916En.js"),__vite__mapDeps([0,1,2])),yaml:()=>Ut(()=>import("./yaml-Buea-lGh.js"),[]),shellscript:()=>Ut(()=>import("./shellscript-Yzrsuije.js"),[]),python:()=>Ut(()=>import("./python-B6aJPvgy.js"),[]),sql:()=>Ut(()=>import("./sql-CRqJ_cUM.js"),[]),toml:()=>Ut(()=>import("./toml-vGWfd6FD.js"),[]),diff:()=>Ut(()=>import("./diff-D97Zzqfu.js"),[]),docker:()=>Ut(()=>import("./docker-BcOcwvcX.js"),[]),make:()=>Ut(()=>import("./make-CHLpvVh8.js"),[])},RS={dockerfile:"docker",makefile:"make"};function VM(e){const t=e.slice(e.lastIndexOf("/")+1).toLowerCase();if(t in RS)return RS[t];const i=t.lastIndexOf(".");return i<=0?null:$M[t.slice(i+1)]??null}let $u=null,ym=null;const MS=new Set;async function YM(){if($u!==null)return $u;ym??(ym=GM());try{return $u=await ym,$u}catch(e){throw ym=null,e}}async function GM(){const[{createHighlighterCore:e},{createJavaScriptRegexEngine:t}]=await Promise.all([Ut(()=>import("./core-rofTMs1b.js"),[]),Ut(()=>import("./engine-javascript-DBd1bXLz.js"),[])]);return e({themes:[KM],langs:[],engine:t()})}async function QM(e){try{const t=await YM();if(!MS.has(e)){const i=WM[e];if(i===void 0)return null;const n=await i();await t.loadLanguage(n.default),MS.add(e)}return t}catch{return null}}function d1({path:e,headExtra:t,wrap:i,onToggleWrap:n,onClose:a,footLeft:l,footRight:h,children:d}){const _=e.lastIndexOf("/"),m=_===-1?"":e.slice(0,_+1),v=e.slice(_+1);return c.jsxs("div",{className:"viewer",children:[c.jsxs("div",{className:"viewer__head",children:[c.jsxs("span",{className:"fpath",title:e,children:[c.jsx("span",{className:"fpath__dir",children:m}),c.jsx("span",{className:"fpath__name",children:v})]}),t,c.jsx("span",{className:"viewer__spacer"}),c.jsxs("button",{type:"button",className:`rp__icon${i?" rp__icon--on":""}`,"aria-pressed":i,onClick:n,title:"quebrar linhas longas",children:["⇄",c.jsx("span",{className:"sr-only",children:"quebrar linhas longas"})]}),c.jsxs("button",{type:"button",className:"rp__icon",onClick:a,title:"fechar",children:["✕",c.jsx("span",{className:"sr-only",children:"fechar"})]})]}),d,c.jsxs("div",{className:"viewer__foot",children:[l,h===void 0?null:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"viewer__spacer"}),h]})]})]})}const DS={"inside-git":{chip:"dentro de .git",why:c.jsxs(c.Fragment,{children:["está dentro de ",c.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:c.jsx(c.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:c.jsx(c.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 ZM({scope:e,path:t,active:i,onClose:n}){const[a,l]=k.useState(!0),h=FM({scope:e,path:t,active:i}),d=h.content,_=VM(t),m=d.data,v=m===void 0?null:m.kind==="binary"?"binário":m.kind==="too-large"?"acima do teto":m.readOnly===null?null:DS[m.readOnly].chip,g=v===null&&(h.state.kind==="failed"||h.state.kind==="stale");return c.jsx(d1,{path:t,onClose:n,wrap:a,onToggleWrap:()=>l(S=>!S),footLeft:v===null?c.jsx(eD,{state:h.state,onRetry:h.retry}):c.jsxs("span",{className:"save save--readonly",children:[c.jsx("span",{className:"save__mark","aria-hidden":"true",children:"⊘"}),"somente leitura · ",v]}),footRight:g||m===void 0?void 0:m.kind==="text"?`${Al(m.bytes)} · ${m.lines} linhas · ${_??"texto"}`:Al(m.bytes),children:b()});function b(){if(d.isPending)return c.jsx("div",{className:"code",children:"carregando…"});if(d.isError)return c.jsxs("div",{className:"refuse",role:"alert",children:[c.jsx("span",{className:"refuse__glyph","aria-hidden":"true",children:"⚠"}),c.jsx("span",{className:"refuse__title",children:"não deu para abrir"}),c.jsx("span",{className:"refuse__why",children:d.error.message})]});if(d.data.kind==="binary")return c.jsxs("div",{className:"refuse",children:[c.jsx("span",{className:"refuse__glyph","aria-hidden":"true",children:"▦"}),c.jsx("span",{className:"refuse__title",children:"arquivo binário"}),c.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."}),c.jsx("span",{className:"refuse__why",children:c.jsx("code",{children:t})})]});if(d.data.kind==="too-large")return c.jsxs("div",{className:"refuse",children:[c.jsx("span",{className:"refuse__glyph","aria-hidden":"true",children:"▤"}),c.jsxs("span",{className:"refuse__title",children:[Al(d.data.bytes)," passa do teto de ",Al(d.data.limit)]}),c.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."}),c.jsx("span",{className:"refuse__why",children:c.jsx("code",{children:t})})]});const S=d.data.readOnly;return c.jsxs(c.Fragment,{children:[S!==null&&c.jsxs("div",{className:"robar",children:[c.jsx("span",{className:"robar__glyph","aria-hidden":"true",children:"⊘"}),c.jsx("span",{children:DS[S].why})]}),h.state.kind==="stale"&&c.jsx(XM,{conflict:h.state,onReload:h.reload,onOverwrite:h.overwrite}),c.jsx(tD,{path:t,text:d.data.text,language:_,readOnly:S!==null,wrap:a,onReady:h.attach})]})}}function XM({conflict:e,onReload:t,onOverwrite:i}){const n=OS(e.base,e.mine),a=e.disk===null?null:OS(e.base,e.disk.text);return c.jsxs("div",{className:"conflict",role:"alert",children:[c.jsxs("div",{className:"conflict__head",children:[c.jsx("span",{className:"conflict__glyph","aria-hidden":"true",children:"⚠"}),"o agente escreveu este arquivo há ",c.jsx(f1,{at:e.changedAt})]}),c.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á."}),c.jsxs("div",{className:"conflict__exits",children:[c.jsxs("button",{type:"button",className:"exit",onClick:t,children:[c.jsx("span",{className:"exit__what",children:"recarregar do disco"}),c.jsxs("span",{className:"exit__cost",children:["perde ",JM(n)]})]}),c.jsxs("button",{type:"button",className:"exit",onClick:i,children:[c.jsx("span",{className:"exit__what",children:"sobrescrever"}),c.jsxs("span",{className:"exit__cost",children:["perde a edição do agente",a===null?"":` (+${a.added} −${a.removed})`]})]})]})]})}function JM(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 eD({state:e,onRetry:t}){return e.kind==="clean"?null:e.kind==="saving"?c.jsx(Wu,{tone:"saving",children:"salvando…"}):e.kind==="saved"?c.jsxs(Wu,{tone:"saved",children:["salvo há ",c.jsx(f1,{at:e.at})]}):e.kind==="failed"?c.jsxs(c.Fragment,{children:[c.jsx(Wu,{tone:"failed",children:"não deu para salvar"}),c.jsx("span",{className:"save__why",title:e.why,children:e.why}),c.jsx("button",{type:"button",className:"save__act",onClick:t,children:"tentar de novo"})]}):c.jsxs(c.Fragment,{children:[c.jsx(Wu,{tone:"stale",children:"mudou no disco"}),c.jsx("span",{className:"save__why",children:"o autosave parou até você escolher"})]})}function Wu({tone:e,children:t}){return c.jsxs("span",{className:`save save--${e}`,children:[c.jsx("span",{className:"save__dot","aria-hidden":"true"}),t]})}function f1({at:e}){const[t,i]=k.useState(e);k.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 c.jsx(c.Fragment,{children:n<60?`${n} s`:`${Math.floor(n/60)} min`})}function tD({path:e,text:t,language:i,readOnly:n,wrap:a,onReady:l}){const h=k.useRef(null),d=k.useRef(null),_=k.useRef(null),m=k.useRef({text:t,wrap:a});return k.useEffect(()=>{m.current.text=t},[t]),k.useEffect(()=>{var v;m.current.wrap=a,(v=d.current)==null||v.setWrap(a)},[a]),k.useEffect(()=>{const v=h.current;if(v===null)return;let g=!0;return Ut(async()=>{const{mountEditor:b}=await import("./codemirror-setup-Csmyc9rQ.js");return{mountEditor:b}},[]).then(({mountEditor:b})=>{g&&(d.current=b(v,{doc:m.current.text,wrap:m.current.wrap,readOnly:n}),d.current.setHighlight(_.current),l(d.current))}),()=>{var b;g=!1,l(null),(b=d.current)==null||b.destroy(),d.current=null}},[e,n,l]),k.useEffect(()=>{var g;if(_.current=null,(g=d.current)==null||g.setHighlight(null),i===null)return;let v=!0;return QM(i).then(b=>{var S;!v||b===null||(_.current={highlighter:b,language:i,theme:h1},(S=d.current)==null||S.setHighlight(_.current))}),()=>{v=!1}},[i]),c.jsx("div",{className:"cmhost",ref:h,"data-testid":"editor"})}function sD({scopeType:e,scopeId:t,onCreated:i}){const n=Ye(),a=up(),l=Ae({queryKey:["agentConfig","list"],queryFn:()=>ie.agentConfig.list.query()}),h=()=>n.invalidateQueries({queryKey:Hi(e,t)}),d=Ve({mutationFn:()=>ie.session.createShell.mutate({scopeType:e,scopeId:t}),onSuccess:async g=>{await h(),i(g.id)}}),_=Ve({mutationFn:g=>ie.session.createAgent.mutate({scopeType:e,scopeId:t,agentConfigId:g}),onSuccess:async g=>{a.close(),await h(),i(g.id)}}),m=d.error??_.error,v=l.data??[];return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"new-session",children:[c.jsxs("button",{type:"button",ref:a.triggerRef,className:"tabs-new","aria-haspopup":"menu","aria-expanded":a.open,disabled:_.isPending||d.isPending,onClick:a.toggle,children:[c.jsx("span",{"aria-hidden":"true",children:"+"})," nova sessão"]}),a.open&&c.jsx("div",{className:"new-session__panel",ref:a.panelRef,children:c.jsxs(ip,{label:"nova sessão",children:[c.jsx(hn,{glyph:c.jsx(at,{tone:"shell",children:"●"}),hint:"shell de login",onSelect:()=>{a.close(),d.mutate()},children:"shell"}),v.map(g=>c.jsx(hn,{glyph:c.jsx(at,{tone:"agent",children:"◆"}),disabled:!g.available||_.isPending,hint:g.available?g.command:"fora do PATH",onSelect:()=>_.mutate(g.id),children:g.name},g.id))]})})]}),m&&c.jsx("div",{className:"new-session__error",children:c.jsx(Re,{tone:"danger",children:m.message})})]})}function m1({lines:e,wrap:t=!0}){return c.jsx("div",{className:`patch${t?"":" patch--nowrap"}`,children:e.map((i,n)=>i.kind==="hunk"?c.jsx("div",{className:"hunk",children:i.text},n):c.jsxs("div",{className:`dl${i.kind==="add"?" dl--add":i.kind==="del"?" dl--del":""}`,children:[c.jsx("span",{className:"dl__sig","aria-hidden":"true",children:i.kind==="add"?"+":i.kind==="del"?"−":" "}),c.jsx("span",{className:"dl__t",children:i.text})]},n))})}function iD(e,t){const i=BS(e??""),n=BS(t);let a=0;for(;a<i.length&&a<n.length&&i[a]===n[a];)a+=1;let l=0;for(;l<i.length-a&&l<n.length-a&&i[i.length-1-l]===n[n.length-1-l];)l+=1;const h=i.slice(a,i.length-l),d=n.slice(a,n.length-l),_=[];a>0&&_.push({kind:"context",text:`… ${a} linha(s) acima, sem mudança`});for(const m of h)_.push({kind:"del",text:m});for(const m of d)_.push({kind:"add",text:m});return l>0&&_.push({kind:"context",text:`… ${l} linha(s) abaixo, sem mudança`}),_}function BS(e){if(e==="")return[];const t=e.split(`
|
|
92
|
+
`);return t.at(-1)===""&&t.pop(),t}function rD({scope:e,path:t,changeRef:i,onClose:n}){const[a,l]=k.useState(!0),h=Ae({queryKey:Zk(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?[]:nD(h.data.patch),_=d.filter(v=>v.kind==="hunk").length;return c.jsx(d1,{path:t,onClose:n,wrap:a,onToggleWrap:()=>l(v=>!v),footLeft:i==="worktree"?"não commitado · vs HEAD":"vs base",footRight:_===0?void 0:`${_} ${_===1?"hunk":"hunks"}`,children:m()});function m(){return h.isPending?c.jsx("div",{className:"patch",children:"carregando…"}):h.isError?c.jsxs("div",{className:"refuse",role:"alert",children:[c.jsx("span",{className:"refuse__glyph","aria-hidden":"true",children:"⚠"}),c.jsx("span",{className:"refuse__title",children:"não deu para ler o diff"}),c.jsx("span",{className:"refuse__why",children:h.error.message})]}):h.data.binary?c.jsxs("div",{className:"refuse",children:[c.jsx("span",{className:"refuse__glyph","aria-hidden":"true",children:"▦"}),c.jsx("span",{className:"refuse__title",children:"arquivo binário"}),c.jsx("span",{className:"refuse__why",children:"o git conta linhas, e aqui não há linhas para contar."})]}):d.length===0?c.jsxs("div",{className:"empty",children:[c.jsx("span",{className:"empty__glyph","aria-hidden":"true",children:"✓"}),c.jsx("span",{className:"empty__title",children:"sem diferenças neste arquivo"})]}):c.jsx(m1,{lines:d,wrap:a})}}function nD(e){var n,a;const t=[];let i=!1;for(const l of e.split(`
|
|
93
|
+
`)){if(l.startsWith("@@")){i=!0,t.push({kind:"hunk",text:l});continue}i&&(l.startsWith("\\")||(l.startsWith("+")?t.push({kind:"add",text:l.slice(1)}):l.startsWith("-")?t.push({kind:"del",text:l.slice(1)}):(l!==""||t.length>0)&&t.push({kind:"context",text:l.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 _1(){return{turns:[],pendingPermission:null,streaming:!1,lastStopReason:null,orphanUpdates:0,plan:null,usage:null,mode:"",configOptions:[],commands:[],terminals:[]}}function aD(e){return e.reduce(p1,_1())}function p1(e,{at:t,event:i}){var n,a,l,h,d;switch(i.type){case"message":return LS(e,i.role,{kind:"message",messageId:i.messageId,text:i.text});case"thought":return LS(e,"agent",{kind:"thought",messageId:i.messageId,text:i.text});case"tool_call":return bm(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,startedAt:t}});case"tool_call_update":return zS(e,i.toolCallId,_=>({..._,...i.status?{status:i.status}:{},...i.title?{title:i.title}:{},...i.locations?{locations:i.locations}:{},...i.content?lD(_,i.content):{},elapsedMs:t-_.startedAt}));case"permission_request":{const _={requestId:i.requestId,toolCallId:i.toolCallId,title:i.title,command:i.command??null,cwd:i.cwd,options:i.options},m=qS(e.turns,v=>v.kind==="permission"?null:v);return bm({...e,turns:m,pendingPermission:_},"agent",{kind:"permission",request:_})}case"permission_resolved":{const _=oD(e.turns,i.requestId);if(!_)return{...e,orphanUpdates:e.orphanUpdates+1};const m=i.outcome==="cancelled"?null:i.outcome.optionId,v=m===null?null:_.options.find(S=>S.optionId===m)??null,g=qS(e.turns,S=>S.kind==="permission"&&S.request.requestId===i.requestId?null:S),b={...e,turns:g,pendingPermission:((n=e.pendingPermission)==null?void 0:n.requestId)===i.requestId?null:e.pendingPermission};return v?zS(b,_.toolCallId,S=>({...S,verdict:v})):b}case"plan":return{...e,plan:i.entries};case"plan_removed":return{...e,plan:null};case"usage":{const _=((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:(((l=e.usage)==null?void 0:l.totalCost)??0)+_,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};case"commands":return{...e,commands:i.commands};case"terminal":{const _=e.terminals.filter(m=>m.terminalId!==i.terminalId);return{...e,terminals:[..._,{terminalId:i.terminalId,ptySessionId:i.ptySessionId,command:i.command}]}}case"turn_end":return{...e,streaming:!1,lastStopReason:i.stopReason};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 bm(e,"agent",{kind:"note",text:`evento não reconhecido: ${i.sessionUpdate}`})}}function LS(e,t,i){const n=t==="user"?!0:e.streaming,a=[...e.turns],l=a.at(-1);if((l==null?void 0:l.role)===t){const h=[...l.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]={...l,blocks:h},{...e,turns:a,streaming:n}}return a.push({role:t,blocks:[i]}),{...e,turns:a,streaming:n}}function bm(e,t,i){const n=[...e.turns],a=n.at(-1);return(a==null?void 0:a.role)===t?n[n.length-1]={...a,blocks:[...a.blocks,i]}:n.push({role:t,blocks:[i]}),{...e,turns:n}}function zS(e,t,i){let n=!1;const a=e.turns.map(l=>({...l,blocks:l.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 qS(e,t){return e.map(i=>({...i,blocks:i.blocks.flatMap(n=>{const a=t(n);return a?[a]:[]})}))}function oD(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 lD(e,t){let i=0,n=0,a=!1;for(const l of t){if(l.type!=="diff")continue;a=!0;const h=PS(l.oldText??""),d=PS(l.newText),_=cD(h,d);i+=d.length-_,n+=h.length-_}return{content:t,added:a?i:e.added,removed:a?n:e.removed}}function PS(e){if(e==="")return[];const t=e.split(`
|
|
94
|
+
`);return t.at(-1)===""&&t.pop(),t}function cD(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 l=i.get(a)??0;l>0&&(i.set(a,l-1),n+=1)}return n}const uD=1;function hD(e,t){return`${t.protocol==="https:"?"wss:":"ws:"}//${t.host}${vN}?${gN}=${encodeURIComponent(e)}`}function dD(e,t,i={}){const{createWebSocket:n=h=>new WebSocket(h),origin:a=window.location}=i,l=n(hD(e,a));return l.onmessage=h=>{var _;const d=LN(String(h.data));d.ok?t.onMessage(d.message):(_=t.onDecodeError)==null||_.call(t,d.error)},l.onclose=h=>{var d;(d=t.onClose)==null||d.call(t,{code:h.code,clean:h.wasClean,refused:h.code===yN})},l.onerror=()=>{},{send(h){var _,m;const d=MN.safeParse(h);if(!d.success){(_=t.onSendRejected)==null||_.call(t,d.error.issues.map(v=>`${v.path.join(".")||"<root>"}: ${v.message}`).join("; "));return}if(l.readyState!==uD){(m=t.onSendRejected)==null||m.call(t,"o socket não está aberto");return}l.send(zN(d.data))},close(){l.onmessage=null,l.onclose=null,l.onopen=null,l.close()}}}const fD={auto:"auto",plan:"plan",bypassPermissions:"bypass"};function mD({mode:e,options:t,disabled:i=!1,onSwitch:n}){const[a,l]=k.useState(null);return c.jsx(c.Fragment,{children:t.map(h=>{const d=h.id==="mode"?e:h.currentValue,_=_D(h,d);return c.jsxs("span",{className:"config",children:[c.jsxs("button",{type:"button",className:`pill${pD(h,d)} focus-ring`,"aria-haspopup":"menu","aria-expanded":a===h.id,"aria-label":`${h.name}: ${_}`,disabled:i,title:i?"não dá para trocar no meio de um turno":`${h.name}: ${_}`,onClick:()=>l(a===h.id?null:h.id),children:[_,c.jsx("span",{className:"pill__caret","aria-hidden":"true",children:"▾"})]}),a===h.id&&c.jsx("div",{className:"slash",role:"menu","aria-label":h.name,children:h.choices.map(m=>c.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":m.value===d,className:`slash__row focus-ring${m.value===d?" slash__row--on":""}${m.value==="bypassPermissions"?" slash__row--danger":""}`,onClick:()=>{l(null),n(h.id,m.value)},children:[c.jsx("span",{className:"slash__cmd",children:m.value}),c.jsx("span",{className:"slash__desc",children:m.description??""})]},m.value))})]},h.id)})})}function _D(e,t){var i;return((i=e.choices.find(n=>n.value===t))==null?void 0:i.name)||t||e.name}function pD(e,t){if(e.id==="mode"){const i=fD[t];return i?` pill--${i}`:""}return e.id==="model"?" pill--model":""}const H_=/^\s{0,3}(?:```|~~~)\s*([\w+-]*)\s*$/,v1=/^\s{0,3}(#{1,6})\s+(.*)$/,g1=/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/,I_=/^\s{0,3}>\s?(.*)$/,jp=/^(\s*)[-*+]\s+(.*)$/,vh=/^(\s*)\d{1,9}[.)]\s+(.*)$/,gh=/^\s{0,3}\|(.+)\|\s*$/,vD=/^\s{0,3}\|[\s:|-]+\|\s*$/;function gD(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 l=H_.exec(a);if(l){const _=l[1]===""?null:l[1],m=[];for(n+=1;n<t.length&&!H_.test(t[n]);)m.push(t[n]),n+=1;n<t.length&&(n+=1),i.push({kind:"code",language:_,text:m.join(`
|
|
97
|
+
`)});continue}const h=v1.exec(a);if(h){i.push({kind:"heading",level:h[1].length,content:Li(h[2].trim())}),n+=1;continue}if(g1.test(a)){i.push({kind:"rule"}),n+=1;continue}if(I_.test(a)){const _=[];for(;n<t.length;){const m=I_.exec(t[n]);if(!m)break;_.push(m[1]),n+=1}i.push({kind:"quote",content:Li(_.join(`
|
|
98
|
+
`))});continue}if(gh.test(a)&&n+1<t.length&&vD.test(t[n+1])){const _=HS(a);n+=2;const m=[];for(;n<t.length&&gh.test(t[n]);)m.push(HS(t[n])),n+=1;i.push({kind:"table",header:_,rows:m});continue}if(jp.test(a)||vh.test(a)){const _=vh.test(a),{items:m,next:v}=bD(t,n,_);i.push({kind:"list",ordered:_,items:m}),n=v;continue}const d=[t[n].trim()];for(n+=1;n<t.length;){const _=t[n];if(_.trim()===""||yD(_))break;d.push(_.trim()),n+=1}i.push({kind:"paragraph",content:Li(d.join(`
|
|
99
|
+
`))})}return i}function yD(e){return H_.test(e)||v1.test(e)||g1.test(e)||I_.test(e)||jp.test(e)||vh.test(e)||gh.test(e)}function HS(e){return gh.exec(e)[1].split("|").map(i=>Li(i.trim()))}function bD(e,t,i){const n=[];let a=t,l=null;for(;a<e.length;){const h=e[a];if(h.trim()===""){if(a+1<e.length&&IS(e[a+1])!==null){a+=1;continue}break}const d=IS(h);if(d===null||d.ordered!==i&&d.indent===(l??d.indent))break;if(l??(l=d.indent),d.indent>l){const _=n[n.length-1];if(_===void 0)break;_.children.push({content:Li(d.text),children:[]})}else n.push({content:Li(d.text),children:[]});a+=1}return{items:n,next:a}}function IS(e){const t=jp.exec(e);if(t)return{indent:t[1].length,text:t[2],ordered:!1};const i=vh.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[l,h]of i.split(`
|
|
100
|
+
`).entries())l>0&&t.push({kind:"break"}),h!==""&&t.push({kind:"text",text:h});i=""}};let a=0;for(;a<e.length;){const l=e.slice(a),h=/^(`+)([\s\S]*?)\1(?!`)/.exec(l);if(h){n(),t.push({kind:"code",text:h[2].trim()}),a+=h[0].length;continue}const d=/^\[([^\]]*)\]\(([^\s)]+)\)/.exec(l);if(d){n(),t.push({kind:"link",href:d[2],children:Li(d[1])}),a+=d[0].length;continue}const _=/^(\*\*|__)(?=\S)([\s\S]*?\S)\1/.exec(l);if(_){n(),t.push({kind:"strong",children:Li(_[2])}),a+=_[0].length;continue}const m=/^~~(?=\S)([\s\S]*?\S)~~/.exec(l);if(m){n(),t.push({kind:"strike",children:Li(m[1])}),a+=m[0].length;continue}const v=/^(\*)(?=\S)([\s\S]*?\S)\1|^(_)(?=\S)([\s\S]*?\S)\3(?![\w])/.exec(l);if(v&&(v[1]==="*"||a===0||/[^\w]/.test(e[a-1]))){n(),t.push({kind:"em",children:Li(v[2]??v[4])}),a+=v[0].length;continue}i+=e[a],a+=1}return n(),t}function y1({text:e,streaming:t=!1}){const i=gD(e),n=i.length-1,a=c.jsx("span",{className:"mcaret","aria-hidden":"true"});return i.length===0?t?c.jsx("p",{children:a}):null:c.jsx(c.Fragment,{children:i.map((l,h)=>c.jsx(k.Fragment,{children:SD(l,t&&h===n?a:null)},h))})}function SD(e,t){switch(e.kind){case"paragraph":return c.jsxs("p",{children:[c.jsx(Di,{nodes:e.content}),t]});case"heading":{const i=`h${String(Math.min(e.level,6))}`;return c.jsxs(i,{children:[c.jsx(Di,{nodes:e.content}),t]})}case"code":return c.jsxs(c.Fragment,{children:[c.jsx("pre",{children:c.jsx("code",{...e.language===null?{}:{"data-language":e.language},children:e.text})}),t]});case"quote":return c.jsxs("blockquote",{children:[c.jsx(Di,{nodes:e.content}),t]});case"list":{const i=e.ordered?"ol":"ul";return c.jsxs(c.Fragment,{children:[c.jsx(i,{children:e.items.map((n,a)=>c.jsx(b1,{item:n,ordered:e.ordered},a))}),t]})}case"table":return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"table-scroll",children:c.jsxs("table",{children:[c.jsx("thead",{children:c.jsx("tr",{children:e.header.map((i,n)=>c.jsx("th",{children:c.jsx(Di,{nodes:i})},n))})}),c.jsx("tbody",{children:e.rows.map((i,n)=>c.jsx("tr",{children:i.map((a,l)=>c.jsx("td",{children:c.jsx(Di,{nodes:a})},l))},n))})]})}),t]});case"rule":return c.jsxs(c.Fragment,{children:[c.jsx("hr",{}),t]})}}function b1({item:e,ordered:t}){const i=t?"ol":"ul";return c.jsxs("li",{children:[c.jsx(Di,{nodes:e.content}),e.children.length>0&&c.jsx(i,{children:e.children.map((n,a)=>c.jsx(b1,{item:n,ordered:t},a))})]})}function Di({nodes:e}){return c.jsx(c.Fragment,{children:e.map((t,i)=>c.jsx(k.Fragment,{children:xD(t)},i))})}function xD(e){switch(e.kind){case"text":return e.text;case"code":return c.jsx("code",{children:e.text});case"strong":return c.jsx("strong",{children:c.jsx(Di,{nodes:e.children})});case"em":return c.jsx("em",{children:c.jsx(Di,{nodes:e.children})});case"strike":return c.jsx("del",{children:c.jsx(Di,{nodes:e.children})});case"link":return c.jsx("a",{href:e.href,target:"_blank",rel:"noreferrer",children:c.jsx(Di,{nodes:e.children})});case"break":return c.jsx("br",{})}}function wD({role:e,children:t}){return c.jsxs("div",{className:`turn turn--${e}`,children:[c.jsx("span",{className:"turn__g",children:c.jsx(at,{tone:e==="agent"?"agent":"none",children:e==="agent"?"◆":"❯"})}),c.jsx("div",{className:"turn__b",children:t})]})}function CD({text:e,streaming:t=!1}){return c.jsx("div",{className:"msg",children:c.jsx(y1,{text:e,streaming:t})})}function jD({text:e,open:t,onToggle:i,streaming:n=!1}){const a=n?"pensando…":"pensou";return c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",className:"thought focus-ring","aria-expanded":t,onClick:i,children:[c.jsx("span",{className:"thought__twist","aria-hidden":"true",children:t?"▾":"▸"}),a,!t&&e!==""&&c.jsxs("span",{className:"thought__peek",children:["· ",e]})]}),t&&c.jsx("div",{className:"thought__text",children:c.jsx(y1,{text:e,streaming:n})})]})}function kD({request:e,onRespond:t}){const[i,n]=k.useState(!1),a=k.useRef(null),l=Sm(e.options,"allow_once")??e.options[0],h=Sm(e.options,"reject_once"),d=Sm(e.options,"reject_always"),_=e.options.filter(v=>v!==l&&v!==h&&v!==d),m=v=>{i||(n(!0),t(v))};return k.useEffect(()=>{var v;(v=a.current)==null||v.focus()},[e.requestId]),k.useEffect(()=>{const v=g=>{if(g.key==="Enter"&&!g.shiftKey){g.preventDefault(),m(l.optionId);return}g.key==="Escape"&&h&&(g.preventDefault(),m(h.optionId))};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)}),c.jsxs("div",{className:"perm",role:"group","aria-label":"pedido de permissão",children:[c.jsxs("div",{className:"perm__head",children:[c.jsx("span",{className:"perm__glyph","aria-hidden":"true",children:"⚠"}),"Permissão",c.jsx("span",{className:"spacer"}),c.jsx("span",{className:"kbd",children:i?"enviado":"o turno está parado aqui"})]}),c.jsxs("div",{className:"perm__body",children:[c.jsxs("div",{className:"perm__what",children:[c.jsx("div",{className:"perm__cmd",children:e.command??e.title}),c.jsxs("div",{className:"perm__where",children:["cwd ",e.cwd]})]}),c.jsxs("div",{className:"perm__opts",children:[c.jsxs(pe,{ref:a,variant:"primary",size:"sm",disabled:i,onClick:()=>m(l.optionId),children:[l.name," ",c.jsx("span",{className:"kbd",children:"⏎"})]}),_.map(v=>c.jsx(pe,{variant:"ghost",size:"sm",disabled:i,onClick:()=>m(v.optionId),children:v.name},v.optionId)),h&&c.jsxs(pe,{variant:"ghost",size:"sm",disabled:i,onClick:()=>m(h.optionId),children:[h.name," ",c.jsx("span",{className:"kbd",children:"esc"})]}),d&&c.jsx(pe,{variant:"danger",size:"sm",disabled:i,onClick:()=>m(d.optionId),children:d.name})]})]})]})}function Sm(e,t){return e.find(i=>i.kind===t)}const S1="lumem.coach.permission";function ED(){try{return window.localStorage.getItem(S1)==="seen"}catch{return!1}}function ND(){try{window.localStorage.setItem(S1,"seen")}catch{}}function TD(e){const[t,i]=k.useState(ED),[n,a]=k.useState(!1),l=k.useCallback(()=>a(!0),[]),h=k.useCallback(()=>{ND(),i(!0)},[]);return{show:e&&!t&&!n,dismiss:l,never:h}}const OD={pending:"○",in_progress:"◐",completed:"✓"},AD={pending:"pending",in_progress:"active",completed:"done"};function RD({entries:e,defaultOpen:t=!1}){const i=e.filter(d=>d.status==="completed").length,n=e.length>0&&i===e.length,[a,l]=k.useState(t),h=!n||a;return c.jsxs("div",{className:"plan",children:[c.jsxs("div",{className:"plan__head",children:[c.jsx("span",{className:`plan__glyph${n?" plan__glyph--done":""}`,"aria-hidden":"true",children:n?"✓":"☰"}),"Plano",c.jsx("span",{className:"spacer"}),c.jsxs("span",{className:"plan__count",children:[i," de ",e.length]}),n&&c.jsx("button",{type:"button",className:"tc__twist focus-ring","aria-expanded":a,"aria-label":a?"esconder os passos":"mostrar os passos",onClick:()=>l(!a),children:a?"▾":"▸"})]}),h&&e.map((d,_)=>c.jsxs("div",{className:`plan__row plan__row--${AD[d.status]}`,children:[c.jsx("span",{className:"plan__mark","aria-hidden":"true",children:OD[d.status]}),c.jsx("span",{className:"plan__what",children:d.content}),d.status==="in_progress"&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"spacer"}),c.jsx("span",{className:"plan__now",children:"agora"})]})]},_))]})}function MD(e){const t=/^\/([^\s]*)$/.exec(e);return t?t[1]:null}function x1(e,t){if(t==="")return e;const i=t.toLowerCase();return e.filter(n=>n.name.toLowerCase().startsWith(i))}function DD({commands:e,query:t,onChoose:i,onDismiss:n}){const a=x1(e,t),[l,h]=k.useState(0);k.useEffect(()=>h(0),[t,e]),k.useEffect(()=>{const _=m=>{if(a.length!==0){if(m.key==="ArrowDown"){m.preventDefault(),h(v=>(v+1)%a.length);return}if(m.key==="ArrowUp"){m.preventDefault(),h(v=>(v-1+a.length)%a.length);return}if(m.key==="Enter"&&!m.metaKey&&!m.ctrlKey){m.preventDefault(),m.stopPropagation(),d(a[l]);return}m.key==="Escape"&&(m.preventDefault(),n())}};return window.addEventListener("keydown",_,!0),()=>window.removeEventListener("keydown",_,!0)});function d(_){i(`/${_.name}${_.takesInput?" ":""}`)}return a.length===0?null:c.jsx("div",{className:"slash",role:"listbox","aria-label":"comandos do agente",children:a.map((_,m)=>c.jsxs("button",{type:"button",role:"option","aria-selected":m===l,className:`slash__row focus-ring${m===l?" slash__row--on":""}`,onMouseDown:v=>{v.preventDefault(),d(_)},children:[c.jsxs("span",{className:"slash__cmd",children:["/",_.name]}),c.jsx("span",{className:"slash__desc",children:_.description})]},_.name))})}const BD={read:"▤",search:"▤",edit:"▣",delete:"▣",move:"▣",execute:"❯",fetch:"↓",think:"◈",switch_mode:"◈",other:"◈"},LD={pending:"na fila",running:"rodando",ok:"ok",failed:"falhou",cancelled:"interrompido"},zD=12;function qD({call:e,terminals:t=[],defaultOpen:i=!1}){const[n,a]=k.useState(i),l=PD(e),h=ID(e),d=HD(e,t);return c.jsxs("div",{className:`tc tc--${e.status}`,children:[c.jsxs("div",{className:"tc__head",children:[c.jsx("span",{className:"tc__glyph","aria-hidden":"true",children:BD[e.kind]}),c.jsx("span",{className:"tc__verb",children:e.name??FD(e.title)}),h?c.jsxs("span",{className:"tc__target",title:h.full,children:[c.jsx("span",{className:"tc__dir",children:h.dir}),c.jsx("span",{className:"tc__name",children:h.name})]}):c.jsx("span",{className:"tc__arg",title:e.title,children:UD(e)}),e.verdict&&c.jsxs("span",{className:`verdict verdict--${e.verdict.kind.startsWith("allow")?"allowed":"denied"}`,children:[e.verdict.kind.startsWith("allow")?"✓":"✕"," ",e.verdict.name]}),(e.added!==null||e.removed!==null)&&c.jsxs("span",{className:"tc__delta",children:[e.added?c.jsxs("span",{className:"plus",children:["+",e.added]}):null,e.added&&e.removed?" ":null,e.removed?c.jsxs("span",{className:"minus",children:["−",e.removed]}):null]}),e.elapsedMs!==null&&c.jsx("span",{className:"tc__time",children:KD(e.elapsedMs)}),c.jsxs("span",{className:"tc__st",children:[c.jsx("span",{className:"tc__dot","aria-hidden":"true"}),LD[e.status]]}),(l||d)&&c.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?"▾":"▸"})]}),n&&d&&c.jsx("div",{className:"tc__body",children:c.jsx("div",{className:"tc__term",children:c.jsx(Eh,{sessionId:d.ptySessionId})})}),n&&!d&&l&&c.jsxs("div",{className:"tc__body",children:[l.kind==="diff"?c.jsx(m1,{lines:l.lines,wrap:!1}):c.jsx("div",{className:"out",children:l.lines.map((_,m)=>c.jsx("span",{className:"l",children:_},m))}),l.hidden>0&&c.jsxs("div",{className:"tc__more",children:["▾ mostrar as ",l.hidden.toLocaleString("pt-BR")," linhas"]})]})]})}function PD(e){const t=e.content.find(l=>l.type==="diff");if((t==null?void 0:t.type)==="diff")return{kind:"diff",lines:iD(t.oldText,t.newText),hidden:0};const i=e.content.filter(l=>l.type==="content").map(l=>l.text).join("");if(i==="")return null;const n=i.split(`
|
|
101
|
+
`),a=n.slice(Math.max(0,n.length-zD));return{kind:"text",lines:a,hidden:n.length-a.length}}function HD(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 ID(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 UD(e){const t=e.name;return t&&e.title.startsWith(`${t} `)?e.title.slice(t.length+1):e.title}function FD(e){const t=e.indexOf(" ");return t===-1?e:e.slice(0,t)}function KD(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 w1={conversation:_1(),session:null,failure:null};function $D(e,t){if(t.kind==="reset")return w1;const i=t.message;switch(i.type){case"attached":return{conversation:{...aD(i.transcript),mode:i.mode,configOptions:i.configOptions},session:{acpSessionId:i.acpSessionId,model:i.model,mode:i.mode,state:i.state},failure:null};case"event":return{...e,conversation:p1(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 WD=e=>ie.session.transcript.query({id:e});function VD({sessionId:e,live:t=!0,connect:i=dD,load:n=WD,onResume:a,resuming:l=!1,active:h=!0,initialPrompt:d}){const[_,m]=k.useReducer($D,w1),[v,g]=k.useState(""),[b,S]=k.useState(new Set),x=k.useRef(null),C=Cp(),{conversation:j,session:N,failure:z}=_,B=j.pendingPermission,M=TD(B!==null),V=!t||(N==null?void 0:N.state)==="exited";k.useEffect(()=>{if(m({kind:"reset"}),!t){let T=!0;return n(e).then(U=>{T&&m({kind:"message",message:U})}).catch(U=>{T&&m({kind:"message",message:{type:"error",code:"INTERNAL",message:U instanceof Error?U.message:"não deu para ler a conversa"}})}),()=>{T=!1}}const L=i(e,{onMessage:T=>m({kind:"message",message:T})});return x.current=L,()=>{x.current=null,L.close()}},[e,t,i,n]),k.useEffect(()=>{C.setWaiting(e,B!==null)},[C,e,B]);const ee=k.useRef(C.setWaiting);ee.current=C.setWaiting,k.useEffect(()=>()=>{ee.current(e,!1)},[e]);const q=N!==null,te=k.useCallback(()=>{var T;const L=v.trim();L===""||B!==null||V||!q||((T=x.current)==null||T.send({type:"prompt",text:L}),g(""))},[q,v,B,V]),he=k.useRef(!1);k.useEffect(()=>{var L;d===void 0||he.current||!q||V||(he.current=!0,(L=x.current)==null||L.send({type:"prompt",text:d}))},[q,d,V]);const de=MD(v),ge=k.useCallback(()=>{var L;(L=x.current)==null||L.send({type:"cancel"})},[]),G=j.streaming,K=de!==null&&x1(j.commands,de).length>0;k.useEffect(()=>{if(!h||V||!G||B!==null||K)return;const L=T=>{T.key==="Escape"&&(T.preventDefault(),ge())};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[h,V,G,B,K,ge]);const se=XD([j.turns.length,j.streaming]);return c.jsxs("div",{className:"conv",children:[c.jsxs("div",{className:"conv__head",children:[c.jsxs("span",{className:"conv__who",children:[c.jsx(at,{tone:"agent",children:"◆"}),"claude"]}),N&&c.jsxs("span",{className:"conv__adapter",children:["sessão ",N.acpSessionId.slice(0,8)," · ",N.model," · ",N.mode]}),c.jsx("span",{className:"spacer"}),V&&a&&c.jsx(pe,{variant:"primary",size:"sm",disabled:l,onClick:a,children:l?"retomando…":"↻ retomar"}),j.streaming&&!V&&c.jsxs(pe,{variant:"ghost",size:"sm",onClick:ge,children:["■ interromper ",c.jsx("span",{className:"kbd",children:"esc"})]})]}),c.jsxs("div",{className:"conv__scroll",ref:se,children:[(z==null?void 0:z.fatal)&&c.jsxs("div",{className:"fail",children:[c.jsxs("div",{className:"fail__title",children:[c.jsx("span",{"aria-hidden":"true",children:"⚠"}),z.remedy?"o adaptador ACP não subiu":"a sessão não está disponível"]}),c.jsx("div",{className:"fail__body",children:z.message}),z.remedy&&c.jsx("div",{className:"fail__cmd",children:z.remedy})]}),z&&!z.fatal&&c.jsx(Re,{tone:"danger",children:z.message}),j.turns.length===0&&!z&&c.jsx(ZD,{ready:N!==null}),j.plan&&c.jsx(RD,{entries:j.plan}),j.turns.map((L,T)=>L.role==="resumed"?c.jsx(YD,{at:L.at??null},T):c.jsx(wD,{role:L.role,children:L.blocks.map((U,F)=>c.jsx(QD,{block:U,terminals:j.terminals,streaming:j.streaming&&T===j.turns.length-1&&F===L.blocks.length-1,openThoughts:b,onToggleThought:me=>S(Ce=>{const A=new Set(Ce);return A.has(me)?A.delete(me):A.add(me),A}),onRespond:me=>{var A;const Ce=j.pendingPermission;Ce&&((A=x.current)==null||A.send({type:"permission_response",requestId:Ce.requestId,optionId:me}))},coach:M},F))},T)),V&&N&&c.jsx("div",{className:"daysep",children:"conversa encerrada"})]}),j.usage&&c.jsx(MT,{usage:j.usage}),c.jsx("div",{className:"composer",children:c.jsxs("div",{className:"composer__box",children:[de!==null&&c.jsx(DD,{commands:j.commands,query:de,onChoose:g,onDismiss:()=>g("")}),c.jsx("textarea",{className:`composer__in${v===""?" composer__in--empty":""}`,value:v,disabled:B!==null||V,placeholder:V?"esta conversa terminou — retome para continuar":B!==null?"responda o pedido de permissão para continuar":"escreva, ou / para comandos","aria-label":"mensagem para o agente",onChange:L=>g(L.target.value),onKeyDown:L=>{L.key==="Enter"&&(L.shiftKey||L.nativeEvent.isComposing||(L.preventDefault(),te()))}}),c.jsxs("div",{className:"composer__bar",children:[c.jsx(mD,{mode:j.mode,options:j.configOptions,disabled:j.streaming||V,onSwitch:(L,T)=>{var U;return(U=x.current)==null?void 0:U.send({type:"set_config",optionId:L,value:T})}}),c.jsx("span",{className:"spacer"}),c.jsxs(pe,{variant:"primary",size:"sm",disabled:v.trim()===""||B!==null||V||!q,onClick:te,children:["enviar ",c.jsx("span",{className:"kbd",children:"⏎"})]})]})]})})]})}function YD({at:e}){return c.jsxs("div",{className:"daysep",children:["retomada",e===null?"":` · ${GD(e)}`]})}function GD(e){return new Date(e).toLocaleString("pt-BR",{day:"2-digit",month:"short",hour:"2-digit",minute:"2-digit"})}function QD({block:e,terminals:t,streaming:i,openThoughts:n,onToggleThought:a,onRespond:l,coach:h}){switch(e.kind){case"message":return c.jsx(CD,{text:e.text,streaming:i});case"thought":return c.jsx(jD,{text:e.text,open:n.has(e.messageId),onToggle:()=>a(e.messageId),streaming:i});case"tool":return c.jsx(qD,{call:e.call,terminals:t});case"permission":return c.jsxs(c.Fragment,{children:[c.jsx(kD,{request:e.request,onRespond:l}),h.show&&c.jsxs(z2,{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 ",c.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"," ",c.jsx("b",{children:"Plano"})," na barra acima."]})]});case"note":return c.jsx("div",{className:"unknown",children:e.text});case"meta":return c.jsx("div",{className:"meta",children:e.text})}}function ZD({ready:e}){return c.jsxs("div",{className:"empty",children:[c.jsx("span",{className:"empty__glyph","aria-hidden":"true",children:"◆"}),c.jsx("span",{className:"empty__title",children:e?"sessão aberta, nada pedido ainda":"conectando…"}),e&&c.jsxs("span",{className:"empty__sub",children:["O adaptador subiu e o handshake passou sem consumir nada. O primeiro turno já entra com"," ",c.jsx("b",{children:"39,2k"})," de contexto — system prompt e ferramentas do próprio Claude Code, não do Lumem."]})]})}function XD(e){const t=k.useRef(null),i=k.useRef(!0),n=k.useCallback(a=>{if(t.current=a,!a)return;const l=()=>{i.current=a.scrollHeight-a.scrollTop-a.clientHeight<24};a.addEventListener("scroll",l)},[]);return k.useEffect(()=>{const a=t.current;a&&i.current&&(a.scrollTop=a.scrollHeight)},e),n}const JD=.2,e3=.8;function C1({children:e,viewer:t}){const[i,n]=k.useState(.5),a=k.useRef(null),[l,h]=k.useState(!1),d=k.useCallback(_=>{var g;const m=(g=a.current)==null?void 0:g.getBoundingClientRect();if(m===void 0||m.width===0||!Number.isFinite(_))return;const v=(_-m.left)/m.width;n(Math.min(e3,Math.max(JD,v)))},[]);return k.useEffect(()=>{if(!l)return;const _=v=>{v.preventDefault(),d(v.clientX)},m=()=>h(!1);return window.addEventListener("pointermove",_),window.addEventListener("pointerup",m),()=>{window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",m)}},[l,d]),t===null?c.jsx(c.Fragment,{children:e}):c.jsxs("div",{className:"split",ref:a,children:[c.jsx("div",{className:"split__side split__side--term",style:{flexGrow:i},children:e}),c.jsx("span",{className:"split__grip",role:"separator","aria-orientation":"vertical","aria-label":"largura do arquivo aberto",onPointerDown:_=>{_.preventDefault(),h(!0)}}),c.jsx("div",{className:"split__side split__side--viewer",style:{flexGrow:1-i},children:t})]})}function t3({tab:e,scope:t,cwd:i,active:n,viewer:a=null,onResume:l,resuming:h=!1,onStarted:d,initialPrompt:_}){const m=e.kind==="agent",v=e.transport==="acp",g=!v&&e.state!=="running";return c.jsx("div",{className:`pane ${v?"pane--conv":"pane--term"}`,role:"tabpanel",hidden:!n,"aria-label":g?`registro de ${e.label}`:`sessão ${e.label}`,children:c.jsxs(C1,{viewer:a,children:[!v&&c.jsxs("div",{className:"term-head",children:[c.jsx(at,{tone:m?"agent":"shell",children:m?"◆":"●"}),c.jsxs("span",{className:"term-head__cmd",title:`${e.command} · cwd ${i}`,children:[e.command," ",c.jsxs("span",{className:"dim",children:["· cwd ",i]})]}),g?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{tone:"neutral",children:"registro"}),c.jsxs(Ft,{tone:e.exitCode===0?"exited":"failed",dot:!0,children:["exited (",e.exitCode??"?",")"]})]}):c.jsx(Ft,{tone:"running",dot:!0,children:"running"})]}),g&&c.jsx(s3,{tab:e,scope:t,onStarted:d}),v?c.jsx(VD,{sessionId:e.sessionId,live:e.state==="running",active:n,...l?{onResume:l}:{},resuming:h,initialPrompt:_},e.sessionId):c.jsx(Eh,{sessionId:e.sessionId,readOnly:g},e.sessionId)]})})}function s3({tab:e,scope:t,onStarted:i}){const n=Ye(),a=Ve({mutationFn:()=>e.agentConfigId===null?ie.session.createShell.mutate(t):ie.session.createAgent.mutate({...t,agentConfigId:e.agentConfigId}),onSuccess:async l=>{await n.invalidateQueries({queryKey:Hi(t.scopeType,t.scopeId)}),i(l.id)}});return c.jsxs("div",{className:"term-note",children:[c.jsx(Re,{tone:"info",actions:c.jsx(pe,{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&&c.jsx(Re,{tone:"danger",children:a.error.message})]})}function j1({scope:e,header:t,context:i,cwd:n,openSessionId:a,initialPrompt:l}){const h=Ye(),{tabs:d,activeId:_,select:m,close:v,reopen:g,resume:b,resuming:S,sessions:x}=PM(e),C=Cp(),j=cp(),N=k.useRef(!1);k.useEffect(()=>{a===void 0||N.current||d.some(q=>q.sessionId===a)&&(N.current=!0,m(a))},[a,d,m]);const z=R0(e.scopeType,e.scopeId,_);k.useEffect(()=>{j.setActiveTab(z)},[z,j.setActiveTab]);function B(q){const te=R0(e.scopeType,e.scopeId,q),he=j.fileFor(te);return he===null?null:he.view==="patch"?c.jsx(rD,{scope:e,path:he.path,changeRef:he.ref??"worktree",onClose:()=>j.close(te)}):c.jsx(ZM,{scope:e,path:he.path,active:q===_,onClose:()=>j.close(te)})}const M=Ve({mutationFn:q=>ie.session.close.mutate({id:q}),onSuccess:()=>h.invalidateQueries({queryKey:Hi(e.scopeType,e.scopeId)})}),V=x.data??[],ee=new Set(d.map(q=>q.sessionId));return c.jsxs("section",{className:"scope",children:[c.jsx("div",{className:"scope__head",children:t}),c.jsx(P2,{label:`sessões de ${n}`,lead:c.jsx(l0,{label:"contexto",active:_===null,onSelect:()=>m(null)}),action:c.jsx(sD,{scopeType:e.scopeType,scopeId:e.scopeId,onCreated:q=>m(q)}),children:d.map(q=>c.jsx(l0,{label:q.label,ordinal:q.ordinal,glyph:c.jsx(at,{tone:q.kind==="agent"?"agent":"shell",children:q.kind==="agent"?"◆":"●"}),state:C.isWaiting(q.sessionId)?"asking":q.state==="running"?"running":q.exitCode===0?"exited":"failed",note:q.state==="running"?void 0:"registro",active:_===q.sessionId,onSelect:()=>m(q.sessionId),onClose:()=>{q.state==="running"?M.mutate(q.sessionId):v(q.sessionId)}},q.sessionId))}),c.jsx("div",{className:"pane",role:"tabpanel",hidden:_!==null,"aria-label":"contexto",children:c.jsxs(C1,{viewer:B(null),children:[M.isError&&c.jsx("div",{className:"detail__banner",children:c.jsx(Re,{tone:"danger",children:M.error.message})}),i,c.jsxs("section",{className:"section",children:[c.jsx(xh,{title:"Sessões",count:V.length===0?0:`${V.length} · ${V.filter(q=>q.state==="running").length} rodando`}),V.length===0?c.jsx("p",{className:"detail__hint",children:"nenhuma sessão aberta aqui"}):V.map(q=>{const te=q.state==="running",he=ee.has(q.id);return c.jsx(Zx,{name:q.agentName??q.scriptName??"shell",glyph:c.jsx(at,{tone:q.kind==="agent"?"agent":"shell",children:q.kind==="agent"?"◆":q.kind==="script"?"▶":"●"}),detail:q.command,state:te?{label:"running",tone:"running"}:{label:`exited (${q.exitCode??"?"})`,tone:q.exitCode===0?"exited":"failed"},age:s_(q.createdAt),onSelect:he?()=>m(q.id):void 0,action:he?void 0:c.jsx(pe,{size:"sm",variant:"ghost",onClick:()=>g(q.id),children:q.transport==="acp"?"reabrir":"ver registro"})},q.id)})]})]})}),d.map(q=>c.jsx(t3,{tab:q,scope:e,cwd:n,onStarted:m,active:_===q.sessionId,viewer:B(q.sessionId),...q.transport==="acp"?{onResume:()=>b(q.sessionId)}:{},resuming:S===q.sessionId,initialPrompt:(l==null?void 0:l.sessionId)===q.sessionId?l.text:void 0},q.sessionId))]})}function i3({projectId:e}){var h,d;const[t,i]=k.useState("7d"),n=JN(e,t),a=[...(((h=n.data)==null?void 0:h.worktrees)??[]).map(_=>({id:_.worktreeId,name:_.name,tokens:_.tokens,cost:_.cost,currency:_.currency,turns:_.turns,kind:"worktree"}))],l=(d=n.data)==null?void 0:d.outside;return l!==void 0&&(l.turns>0||a.length>0)&&a.push({id:"__outside__",name:"direto no projeto",tokens:l.tokens,cost:l.cost,currency:l.currency,turns:l.turns,kind:"project",outside:!0}),c.jsxs("section",{className:"section",children:[c.jsx(xh,{title:"Consumo por worktree",aside:c.jsx("div",{className:"seg",role:"group","aria-label":"Janela de tempo do consumo do projeto",children:aw.map(_=>c.jsx("button",{type:"button",className:"seg__btn","aria-pressed":t===_.id,onClick:()=>i(_.id),children:_.label},_.id))})}),n.isError?c.jsx(Re,{tone:"danger",children:n.error.message}):n.isPending?c.jsx("p",{className:"detail__hint",children:"somando o consumo…"}):a.length===0?c.jsx("p",{className:"detail__hint",children:"nada gasto ainda neste projeto"}):c.jsx(hw,{rows:a})]})}function r3({projectId:e,workspaceId:t,workspaceName:i,onRemoved:n,onOpenWorkspace:a,onSelectWorktree:l,openSessionId:h,initialPrompt:d}){var M;const _=Ye(),m={scopeType:"project",scopeId:e},v=Ae({queryKey:["project","get",e],queryFn:()=>ie.project.get.query({id:e})}),g=Ae({queryKey:xo(e),queryFn:()=>ie.worktree.listByProject.query({projectId:e}),enabled:((M=v.data)==null?void 0:M.available)===!0}),[b,S]=k.useState(!1),x=Ve({mutationFn:()=>ie.project.remove.mutate({id:e}),onSuccess:async()=>{await _.invalidateQueries({queryKey:ca(t)}),n()}});if(b&&v.data)return c.jsx(n3,{project:v.data,pending:x.isPending,error:x.isError?x.error.message:null,onCancel:()=>{S(!1),x.reset()},onConfirm:()=>x.mutate()});if(v.isPending)return c.jsx("div",{className:"pane",children:c.jsx(gi,{label:"carregando o projeto"})});if(!v.data)return c.jsx("div",{className:"pane",children:c.jsx("p",{role:"alert",children:"projeto não encontrado"})});const{name:C,path:j,defaultBranch:N,available:z}=v.data,B=g.data??[];return c.jsx(j1,{scope:m,cwd:j,openSessionId:h,initialPrompt:d,header:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{className:"crumb",children:[c.jsx("button",{type:"button",className:"crumb__up focus-ring",onClick:a,children:i}),c.jsx("span",{className:"crumb__sep","aria-hidden":"true",children:"/"}),C,c.jsx("span",{className:"crumb__sep","aria-hidden":"true",children:"/"}),c.jsx("span",{className:"crumb__here",children:"local"})]}),c.jsxs("div",{className:"detail__title",children:[c.jsxs("h2",{children:[c.jsx(at,{tone:z?"project":"off",children:"▭"})," local"]}),c.jsx("span",{className:"actions__spacer"}),c.jsx(pe,{variant:"ghost",size:"sm",onClick:()=>S(!0),disabled:x.isPending,children:x.isPending?"removendo…":"remover projeto"})]}),c.jsxs("div",{className:"chips",children:[c.jsx(Ft,{tone:"branch",dot:!0,children:N}),z&&c.jsxs(Ft,{children:[B.length," ",B.length===1?"worktree":"worktrees"]})]})]}),context:c.jsxs(c.Fragment,{children:[z?c.jsx("div",{className:"detail__banner",children:c.jsxs(Re,{tone:"info",children:[c.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."]})}):c.jsx("div",{className:"detail__banner",children:c.jsxs(Re,{tone:"danger",children:[c.jsxs("strong",{children:["O repositório não está mais em ",j,"."]})," As ações sobre ele ficam bloqueadas até que ele volte; o registro continua aqui."]})}),x.isError&&c.jsx("div",{className:"detail__banner",children:c.jsx(Re,{tone:"danger",children:x.error.message})}),c.jsx(ha,{entries:[{label:"caminho",value:j,title:j},{label:"branch base",value:c.jsxs(c.Fragment,{children:[N," ",c.jsx("span",{className:"dim",children:"· resolvida na adição"})]})}]}),z&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"actions",children:c.jsx(zM,{projectId:e,onCreated:l,hasCommits:v.data.hasCommits})}),c.jsx(i3,{projectId:e}),c.jsxs("section",{className:"section",children:[c.jsx(xh,{title:"Worktrees deste projeto",count:B.length}),B.length===0?c.jsx("p",{className:"detail__hint",children:"nenhuma worktree ainda"}):B.map(V=>c.jsx(Zx,{name:V.name,glyph:c.jsx(at,{tone:V.state==="missing"?"warn":"worktree",children:V.state==="missing"?"⚠":"◇"}),detail:V.path,state:V.state==="missing"?{label:"ausente",tone:"missing"}:void 0,onSelect:()=>l(V.id)},V.id))]})]})]})})}function n3({project:e,pending:t,error:i,onCancel:n,onConfirm:a}){return c.jsx("div",{className:"pane",children:c.jsxs("div",{className:"remove-confirm",role:"alertdialog","aria-label":"confirmar remoção",children:[e.managed?c.jsxs(c.Fragment,{children:[c.jsxs("h2",{className:"remove-confirm__title",children:["apagar ",e.name," do disco?"]}),c.jsxs("p",{className:"remove-confirm__body",children:["Este projeto foi clonado pelo Lumem. Remover tira do registro ",c.jsx("strong",{children:"e apaga o diretório"}),". Não dá para desfazer."]}),c.jsx("p",{className:"remove-confirm__path",children:e.path})]}):c.jsxs(c.Fragment,{children:[c.jsxs("h2",{className:"remove-confirm__title",children:["remover ",e.name," da lista?"]}),c.jsxs("p",{className:"remove-confirm__body",children:["Este projeto aponta para um repositório ",c.jsx("strong",{children:"seu"}),". Sai da lista; o diretório fica exatamente onde está."]})]}),i!==null&&c.jsx(Re,{tone:"danger",children:i}),c.jsxs("div",{className:"remove-confirm__actions",children:[c.jsx(pe,{variant:e.managed?"danger":"primary",onClick:a,disabled:t,children:t?"removendo…":e.managed?"apagar":"remover"}),c.jsx(pe,{variant:"ghost",onClick:n,children:"cancelar"})]})]})})}function a3(e){const t=Ae({queryKey:ca(e.workspaceId),queryFn:()=>ie.project.listByWorkspace.query({workspaceId:e.workspaceId})});if(t.isError)return c.jsx("p",{className:"tree__message",role:"alert",children:t.error.message});if(t.isPending)return c.jsx("div",{className:"tree",children:c.jsx(gi,{label:"carregando os projetos",widths:["80%","60%","70%"]})});const i=t.data??[];return i.length===0?c.jsx("div",{className:"tree",children:c.jsx(vs,{title:"Nenhum projeto aqui",children:"Aponte para a raiz de um repositório git que já está no disco. O Lumem não clona nada."})}):c.jsxs("div",{className:"tree","aria-label":"árvore de projetos",children:[c.jsx("p",{className:"tree__label",children:"Projetos"}),i.map(n=>c.jsx(o3,{project:n,...e},n.id))]})}function o3({project:e,expansion:t,selection:i,onSelect:n}){const a=t.isExpanded(e.id),l={scopeType:"project",scopeId:e.id},h=Ae({queryKey:xo(e.id),queryFn:()=>ie.worktree.listByProject.query({projectId:e.id}),enabled:e.available}),d=h.data??[],_=[l,...d.map(v=>({scopeType:"worktree",scopeId:v.id}))],m=fp(_);return c.jsxs(c.Fragment,{children:[c.jsx("div",{"data-kind":"project","data-state":e.available?"available":"missing",children:c.jsx(rp,{depth:0,emphasis:!0,label:e.name,glyph:c.jsx(at,{tone:e.available?"project":"off",children:"■"}),muted:!e.available,meta:e.available?void 0:"sem disco",count:!a&&m>0?m:void 0,expanded:a,onToggle:()=>t.toggle(e.id),selected:!1,onSelect:()=>n(e.id,l)})}),a&&e.available&&c.jsxs(c.Fragment,{children:[c.jsx(l3,{projectId:e.id,selected:i.scopeType==="project"&&i.scopeId===e.id,onSelect:()=>n(e.id,l)}),h.isError&&c.jsx("p",{className:"tree__message",role:"alert",children:h.error.message}),d.map(v=>c.jsx(u3,{projectId:e.id,worktree:v,selected:i.scopeType==="worktree"&&i.scopeId===v.id,onSelect:n},v.id))]})]})}function l3({projectId:e,selected:t,onSelect:i}){const n={scopeType:"project",scopeId:e},a=fp([n]);return c.jsx("div",{"data-kind":"local","data-state":"active",children:c.jsx(rp,{depth:1,label:"local",glyph:c.jsx(at,{tone:"project",children:"▭"}),meta:c.jsx(k1,{scope:n}),count:a>0?a:void 0,selected:t,onSelect:i})})}function k1({scope:e}){var a,l,h;const t=gw(e),i=(a=t.data)==null?void 0:a.run.last,n=(l=t.data)==null?void 0:l.setup.last;if((i==null?void 0:i.running)===!0){const d=((h=t.data)==null?void 0:h.port)??null;return c.jsxs("span",{className:"runmark",children:[c.jsx("span",{className:"runmark__glyph",children:"▶"}),d===null?"run":`:${String(d.port)}`]})}return n&&!n.running&&n.exitCode!==0?c.jsx(c.Fragment,{children:"setup falhou"}):null}function c3(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 u3({projectId:e,worktree:t,selected:i,onSelect:n}){const a=t.state==="missing",l={scopeType:"worktree",scopeId:t.id},h=fp([l]),d=Cp(),_=dp(l),m=d.countIn((_.data??[]).map(v=>v.id));return c.jsx("div",{"data-kind":"worktree","data-state":t.state,children:c.jsx(rp,{depth:1,label:t.name,glyph:c.jsx(at,{tone:a?"warn":"worktree",children:a?"⚠":"◇"}),muted:a,meta:c3(t)??(a?void 0:c.jsx(k1,{scope:l}))??void 0,count:m>0?m:h>0?h:void 0,countTone:m>0?"asking":"running",selected:i,onSelect:()=>n(e,l)})})}function h3({workspaces:e,activeId:t,onSelect:i}){const n=Ye(),[a,l]=k.useState(!1),[h,d]=k.useState(""),_=Ve({mutationFn:v=>ie.workspace.create.mutate({name:v}),onSuccess:async v=>{await n.invalidateQueries({queryKey:mr}),i(v.id),l(!1),d("")}}),m=v=>{v.preventDefault(),h.trim()!==""&&_.mutate(h)};return c.jsxs("div",{className:"ws",children:[c.jsxs("div",{className:"ws__bar",children:[c.jsx("label",{className:"sr-only",htmlFor:"workspace-select",children:"Workspace"}),c.jsx("span",{className:"ws__glyph","aria-hidden":"true",children:"◈"}),c.jsx("select",{id:"workspace-select",className:"ws__select",value:t??"",onChange:v=>i(v.target.value),children:e.map(v=>c.jsx("option",{value:v.id,children:v.name},v.id))}),c.jsx("span",{className:"ws__caret","aria-hidden":"true",children:"▾"}),c.jsx(pe,{size:"sm",variant:"ghost","aria-label":"novo workspace",title:"novo workspace",onClick:()=>l(!0),children:"+"})]}),a&&c.jsxs("form",{className:"ws__form",onSubmit:m,children:[c.jsx(as,{id:"new-workspace-name",label:"Nome do novo workspace",children:c.jsx(ps,{id:"new-workspace-name",value:h,onChange:v=>d(v.target.value),placeholder:"trabalho",autoFocus:!0})}),c.jsxs("div",{className:"ws__actions",children:[c.jsx(pe,{type:"submit",variant:"primary",size:"sm",disabled:_.isPending||h.trim()==="",children:"criar"}),c.jsx(pe,{size:"sm",variant:"ghost",onClick:()=>l(!1),children:"cancelar"})]})]}),_.isError&&c.jsx("p",{className:"ws__error",role:"alert",children:_.error.message})]})}function d3({worktreeId:e,projectId:t,workspaceName:i,onRemoved:n,onOpenWorkspace:a,onOpenProject:l,openSessionId:h,initialPrompt:d}){var te,he;const _=Ye(),[m,v]=k.useState(!1),g=Ae({queryKey:X_(e),queryFn:()=>ie.worktree.getDetail.query({id:e})}),b=Ae({queryKey:["project","get",t],queryFn:()=>ie.project.get.query({id:t})}),S=Ve({mutationFn:de=>ie.worktree.remove.mutate({id:e,force:de}),onSuccess:async()=>{await _.invalidateQueries({queryKey:xo(t)}),n()}});if(g.isPending)return c.jsx("div",{className:"pane",children:c.jsx(gi,{label:"carregando a worktree"})});if(g.isError)return c.jsx("div",{className:"pane",children:c.jsx(Re,{tone:"danger",children:g.error.message})});const{name:x,branch:C,path:j,state:N,present:z,status:B,aheadBehind:M,baseBranch:V}=g.data,ee=!z||N==="missing",q={scopeType:"worktree",scopeId:e};return c.jsx(j1,{scope:q,cwd:j,openSessionId:h,initialPrompt:d,header:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{className:"crumb",children:[c.jsx("button",{type:"button",className:"crumb__up focus-ring",onClick:a,children:i}),c.jsx("span",{className:"crumb__sep","aria-hidden":"true",children:"/"}),c.jsx("button",{type:"button",className:"crumb__up focus-ring",onClick:l,children:((te=b.data)==null?void 0:te.name)??"…"}),c.jsx("span",{className:"crumb__sep","aria-hidden":"true",children:"/"}),c.jsx("span",{className:"crumb__here",children:x})]}),c.jsxs("div",{className:"detail__title",children:[c.jsxs("h2",{children:[c.jsx(at,{tone:ee?"warn":"worktree",children:ee?"⚠":"◇"})," ",x]}),c.jsx("span",{className:"actions__spacer"}),c.jsx(pe,{variant:"ghost",size:"sm",onClick:()=>S.mutate(!1,{onError:()=>v(!0)}),disabled:S.isPending,children:S.isPending?"removendo…":"remover worktree"})]}),c.jsxs("div",{className:"chips",children:[c.jsx(Ft,{tone:"branch",dot:!0,children:C}),ee?c.jsx(Ft,{tone:"missing",dot:!0,children:"ausente do disco"}):c.jsxs(c.Fragment,{children:[B===null?c.jsx(Ft,{children:"estado desconhecido"}):B.clean?c.jsx(Ft,{tone:"clean",dot:!0,children:"limpa"}):c.jsxs(Ft,{tone:"dirty",dot:!0,children:["suja · ",B.changedFiles," ",B.changedFiles===1?"arquivo":"arquivos"]}),M!==null&&(M.ahead>0||M.behind>0)&&c.jsxs(Ft,{children:[M.ahead>0&&c.jsxs("span",{className:"ahead",children:["↑",M.ahead]}),M.ahead>0&&M.behind>0&&" ",M.behind>0&&c.jsxs("span",{className:"behind",children:["↓",M.behind]}),c.jsxs("span",{className:"dim",children:[" de ",V]})]})]})]}),m&&c.jsx("div",{className:"detail__banner",children:c.jsx(Re,{tone:"danger",actions:c.jsxs(c.Fragment,{children:[c.jsx(pe,{size:"sm",variant:"danger",onClick:()=>S.mutate(!0),disabled:S.isPending,children:"remover mesmo assim"}),c.jsx(pe,{size:"sm",variant:"ghost",onClick:()=>v(!1),children:"cancelar"})]}),children:((he=S.error)==null?void 0:he.message)??"isso descarta as alterações não salvas."})})]}),context:c.jsxs(c.Fragment,{children:[ee&&c.jsx("div",{className:"detail__banner",children:c.jsxs(Re,{tone:"warning",children:["O diretório não está em ",c.jsx("code",{children:j}),". Remover aqui só apaga o registro; a branch ",c.jsx("code",{children:C})," continua existindo."]})}),c.jsx(ha,{entries:[{label:"caminho",value:j,title:j},{label:"branch",value:c.jsxs(c.Fragment,{children:[C," ",c.jsxs("span",{className:"dim",children:["nasceu de ",V]})]})},{label:`em relação a ${V}`,value:M===null?"desconhecido":`${M.ahead} à frente, ${M.behind} atrás`}]}),c.jsx("p",{className:"detail__hint",children:"a branch não é apagada"})]})})}const U_="lumem.activeWorkspaceId";function f3(){try{return window.localStorage.getItem(U_)}catch{return null}}function US(e){try{e===null?window.localStorage.removeItem(U_):window.localStorage.setItem(U_,e)}catch{}}function m3(e){var l,h;const[t,i]=k.useState(f3),n=((l=e.find(d=>d.id===t))==null?void 0:l.id)??((h=e[0])==null?void 0:h.id)??null;k.useEffect(()=>{n!==t&&US(n)},[n,t]);const a=k.useCallback(d=>{US(d),i(d)},[]);return{activeId:n,select:a}}function _3(e,t){switch(t.type){case"workspace.changed":e.invalidateQueries({queryKey:mr});return;case"project.changed":e.invalidateQueries({queryKey:ca(t.workspaceId)}),e.invalidateQueries({queryKey:["project","get"]});return;case"worktree.changed":e.invalidateQueries({queryKey:xo(t.projectId)}),e.invalidateQueries({queryKey:["worktree"]}),e.invalidateQueries({queryKey:["files"]}),e.invalidateQueries({queryKey:["changes"]});return;case"session.changed":e.invalidateQueries({queryKey:Hi(t.scopeType,t.scopeId)}),e.invalidateQueries({queryKey:["session"]});return}}function p3(){const e=Ye();k.useEffect(()=>{const t=ie.events.onChange.subscribe(void 0,{onData:i=>_3(e,i),onConnectionStateChange:i=>{i.state==="idle"&&e.invalidateQueries()}});return()=>t.unsubscribe()},[e])}const E1="lumem.runDock",N1=96;function v3(e=window.innerHeight){return kp(Math.round(e/2),e)}function g3(e=window.innerHeight){return Math.max(N1,e-160)}const FS=640;function kp(e,t=window.innerHeight){return Math.min(g3(t),Math.max(N1,Math.round(e)))}function y3(){const e={open:!1,height:v3()};try{const t=window.localStorage.getItem(E1);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"?kp(a):e.height}}catch{return e}}function KS(e){try{window.localStorage.setItem(E1,JSON.stringify(e))}catch{}}function b3(){const[e,t]=k.useState(y3),[i,n]=k.useState(!1),a=k.useCallback(d=>{t(_=>{const m={..._,height:kp(d)};return KS(m),m})},[]),l=k.useCallback(()=>{t(d=>{const _={...d,open:!d.open};return KS(_),_})},[]);k.useEffect(()=>{if(!i)return;const d=m=>{m.preventDefault(),a(window.innerHeight-m.clientY)},_=()=>n(!1);return window.addEventListener("pointermove",d),window.addEventListener("pointerup",_),()=>{window.removeEventListener("pointermove",d),window.removeEventListener("pointerup",_)}},[i,a]);const h=k.useCallback(d=>{d.preventDefault(),n(!0)},[]);return{open:e.open,height:e.height,toggle:l,setHeight:a,beginResize:h}}const T1="lumem.collapsedNodes";function S3(){try{const e=window.localStorage.getItem(T1);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 x3(e){try{window.localStorage.setItem(T1,JSON.stringify([...e]))}catch{}}function w3(){const[e,t]=k.useState(S3),i=k.useCallback(a=>!e.has(a),[e]),n=k.useCallback(a=>{t(l=>{const h=new Set(l);return h.delete(a)||h.add(a),x3(h),h})},[]);return{isExpanded:i,toggle:n}}function C3({sidebar:e,children:t,fill:i=!1,right:n,rightWidth:a}){const l=n!==void 0&&a!==void 0?{"--right-width":`${a}px`}:void 0;return c.jsxs("div",{className:`app-shell${n!==void 0?" app-shell--right":""}`,style:l,children:[c.jsx("aside",{className:"app-shell__sidebar","aria-label":"navegação",children:e}),c.jsx("main",{className:`app-shell__main${i?" app-shell__main--fill":""}`,children:t}),n]})}function j3({version:e,unreachable:t,filesPanel:i}){return c.jsxs("header",{className:"topbar",children:[c.jsxs("h1",{className:"wordmark",children:[c.jsx("span",{className:"wordmark__dot","aria-hidden":"true"}),"Lumem-OS"]}),c.jsx("span",{className:"topbar__spacer"}),i!==void 0&&c.jsxs("button",{type:"button",className:`rp-toggle${i.open?" rp-toggle--on":""}`,"aria-pressed":i.open,onClick:i.toggle,children:[c.jsx("span",{"aria-hidden":"true",children:"▤"})," arquivos"]}),t?c.jsxs("span",{className:"daemon daemon--off",role:"alert",children:[c.jsx("span",{className:"daemon__dot","aria-hidden":"true"}),"daemon inacessível"]}):e!==null&&c.jsxs("span",{className:"daemon",children:[c.jsx("span",{className:"daemon__dot","aria-hidden":"true"}),"daemon v",e]})]})}const O1=["máquina","agente","workspace","projeto","tarefa"],k3={welcome:null,machine:0,agent:1,handshake:1,workspace:2,project:3,task:4,done:null};function A1(e){return k3[e]}function No(e){const t=A1(e);return t===null?null:`passo ${t+1} de ${O1.length}`}function gn({eyebrow:e,title:t,lede:i,narrow:n,children:a,primary:l,onSubmit:h,onBack:d,onSkip:_,extra:m,hint:v}){const g=b=>{b.preventDefault(),!((l==null?void 0:l.disabled)===!0||(l==null?void 0:l.isPending)===!0)&&(h==null||h())};return c.jsx("form",{className:"wizard__form",onSubmit:g,children:c.jsx(H2,{...e===void 0?{}:{eyebrow:e},title:t,...i===void 0?{}:{lede:i},...n===void 0?{}:{narrow:n},footer:c.jsxs(c.Fragment,{children:[l!==void 0&&c.jsxs(pe,{type:"submit",variant:"primary",disabled:l.disabled===!0||l.isPending===!0,children:[l.isPending===!0&&l.pending!==void 0?l.pending:l.label,l.isPending!==!0&&c.jsxs(c.Fragment,{children:[" ",c.jsx("span",{className:"kbd",children:"⏎"})]})]}),m,c.jsx("span",{className:"spacer"}),_!==void 0&&c.jsx(pe,{variant:"ghost",onClick:_,children:"pular este passo"}),d!==void 0&&c.jsx(pe,{variant:"ghost",onClick:d,children:"Voltar"}),v!==void 0&&c.jsx("span",{className:"hint",children:v})]}),children:a})})}const $S=["setup","agents"];function E3({onNext:e,onBack:t,onSkip:i}){var m,v;const n=Ye(),a=Ae({queryKey:$S,queryFn:()=>ie.setup.agents.query(),refetchOnWindowFocus:!1}),l=Ve({mutationFn:()=>ie.setup.installAdapter.mutate(),onSuccess:async()=>{await n.invalidateQueries({queryKey:$S})}}),h=(m=a.data)==null?void 0:m.adapter,d=(v=a.data)==null?void 0:v.claude,_=(h==null?void 0:h.path)!=null;return c.jsxs(gn,{eyebrow:No("agent"),title:"Conecte o Claude Code",lede:c.jsxs(c.Fragment,{children:["O Lumem conversa com agentes por ",c.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:!_},onSubmit:e,onBack:t,onSkip:i,hint:_?void 0:c.jsx(c.Fragment,{children:"o botão libera quando o adaptador estiver no PATH"}),children:[a.isPending&&c.jsx(gi,{label:"procurando os binários"}),a.isError&&c.jsxs(Re,{tone:"danger",children:[c.jsx("strong",{children:"Não deu para procurar os binários."})," ",a.error.message]}),a.data!==void 0&&d!==void 0&&h!==void 0&&c.jsxs(c.Fragment,{children:[c.jsxs(ta,{title:"o que foi encontrado na sua máquina",children:[c.jsxs(Fl,{label:"binários",children:[c.jsx(Vs,{state:d.path===null?"warn":"ok",what:d.command,value:d.path===null?"não está no PATH — o adaptador precisa dele para trabalhar":`${d.version??d.versionNote??"versão não lida"} · ${d.path}`,status:d.path===null?"falta":"ok"}),c.jsx(Vs,{state:h.path===null?"fail":"ok",what:h.command,value:h.path===null?"adaptador ACP não está no PATH":`${h.version??h.versionNote??"versão não lida"} · ${h.path}`,status:h.path===null?"falta":"ok"})]}),h.path===null&&c.jsxs(c.Fragment,{children:[c.jsxs("span",{className:"field__help",children:["Nada para rodar no terminal: o Lumem instala o adaptador ",c.jsx("b",{children:"dentro da pasta dele"}),", numa versão fixa — nunca ",c.jsx("code",{children:"@latest"}),", para uma atualização de madrugada não mudar o comportamento do agente."]}),c.jsxs("div",{className:"wizard__acts",children:[c.jsx(pe,{variant:"primary",size:"sm",disabled:l.isPending,onClick:()=>l.mutate(),children:l.isPending?"instalando…":"Instalar o adaptador"}),c.jsx(pe,{variant:"ghost",size:"sm",disabled:a.isFetching,onClick:()=>void a.refetch(),children:a.isFetching?"verificando…":"Já instalei — verificar"})]}),l.isError&&c.jsxs(c.Fragment,{children:[c.jsx(Re,{tone:"danger",children:l.error.message}),h.install!==null&&c.jsx(Qx,{command:h.install})]})]}),h.managed&&c.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 ",c.jsx("code",{children:"PATH"}),"."]})]}),c.jsxs(ta,{title:"como o Claude vai se autenticar — o que foi encontrado",children:[c.jsx(Fl,{label:"credencial",children:c.jsx(Vs,{state:a.data.apiKeyInEnv?"ok":"warn",what:"ANTHROPIC_API_KEY",value:a.data.apiKeyInEnv?"presente no ambiente do daemon — cobrança por token":"ausente — o adaptador vai usar a credencial local do Claude",status:a.data.apiKeyInEnv?"chave":"assinatura"})}),c.jsxs("span",{className:"field__help",children:["Não é escolha sua nem do Lumem: o adaptador usa a credencial que ",c.jsx("b",{children:"encontrar"}),". É o passo seguinte que confirma se ela vale — e ele confirma sem gastar token."]})]}),c.jsxs("div",{className:"adv",children:[c.jsx("span",{className:"adv__k",children:"avançado"}),c.jsxs("span",{className:"adv__v",children:["comando: ",h.command," · args: nenhum · env herdado do daemon"]})]}),c.jsxs(Re,{tone:"info",children:["Qualquer agente que fale ACP entra depois em ",c.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 N3=["agentConfig","list"];function T3({result:e,skipped:t,onOpen:i,onReview:n}){var S,x,C;const[a,l,h,d,_]=Ex({queries:[{queryKey:mr,queryFn:()=>ie.workspace.list.query()},{queryKey:N3,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:X_(e.worktreeId??""),queryFn:()=>ie.worktree.getDetail.query({id:e.worktreeId??""}),enabled:e.worktreeId!==void 0},{queryKey:Hi("worktree",e.worktreeId??""),queryFn:()=>ie.session.listByScope.query({scopeType:"worktree",scopeId:e.worktreeId??""}),enabled:e.worktreeId!==void 0}]}),m=(S=a.data)==null?void 0:S.find(j=>j.id===e.workspaceId),v=(x=l.data)==null?void 0:x.find(j=>j.id===e.agentConfigId),g=(C=_.data)==null?void 0:C.find(j=>j.kind==="agent"),b=[{label:"workspace",value:(m==null?void 0:m.name)??c.jsx(O3,{})},{label:"agente",value:v===void 0?c.jsx(xm,{step:"agent",skipped:t,onReview:n}):c.jsxs(c.Fragment,{children:[v.command,v.adapterVersion!==null&&` @${v.adapterVersion}`," ",c.jsxs("span",{className:"dim",children:["— ",v.transport==="acp"?"conversa":"terminal",v.available?"":" · fora do PATH"]})]})},{label:"projeto",value:h.data==null?c.jsx(xm,{step:"project",skipped:t,onReview:n}):c.jsxs(c.Fragment,{children:[h.data.path,!h.data.available&&c.jsx("span",{className:"dim",children:" — não está no disco"})]})},{label:"worktree",value:d.data==null?c.jsx(xm,{step:"task",skipped:t,onReview:n}):c.jsxs(c.Fragment,{children:[d.data.path,!d.data.present&&c.jsx("span",{className:"dim",children:" — não está no disco"})]})},{label:"sessão",value:g===void 0?c.jsx("span",{className:"dim",children:"nenhuma — abra uma quando quiser"}):c.jsxs(c.Fragment,{children:[g.agentName??"agente"," ",c.jsxs("span",{className:"dim",children:["— ",g.state]})]})}];return c.jsxs(gn,{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:c.jsx(pe,{variant:"ghost",onClick:n,children:"Revisar a configuração"}),children:[c.jsx(ha,{variant:"recap",entries:b}),c.jsxs("div",{className:"keys",children:[c.jsxs("div",{className:"key",children:[c.jsx("span",{className:"key__k",children:"⏎"}),c.jsxs("span",{className:"key__d",children:["enviar o turno — ",c.jsx("span",{className:"dim",children:"⇧⏎ faz linha nova"})]})]}),c.jsxs("div",{className:"key",children:[c.jsx("span",{className:"key__k",children:"esquerda"}),c.jsx("span",{className:"key__d",children:"projetos e worktrees; o rodapé adiciona projeto e configura agente"})]}),c.jsxs("div",{className:"key",children:[c.jsx("span",{className:"key__k",children:"abas"}),c.jsxs("span",{className:"key__d",children:["uma por sessão viva, mais ",c.jsx("b",{children:"contexto"})," — a worktree em si"]})]}),c.jsxs("div",{className:"key",children:[c.jsx("span",{className:"key__k",children:"direita"}),c.jsx("span",{className:"key__d",children:"arquivos do checkout e o que mudou neles, ao lado da conversa"})]})]})]})}function O3(){return c.jsx("span",{className:"dim",children:"lendo do daemon…"})}function xm({step:e,skipped:t,onReview:i}){const n={agent:"no rodapé da sidebar, em agentes",project:"no rodapé da sidebar, em adicionar projeto",task:"no painel do projeto, em nova worktree"};return t.includes(e)?c.jsxs("span",{className:"dim",children:["pulado — dá para fazer ",n[e],","," ",c.jsx("button",{type:"button",className:"key__link",onClick:i,children:"ou voltar ao fluxo"})]}):c.jsx("span",{className:"dim",children:"nada foi criado"})}const A3=["setup","probe"],WS=["agentConfig","list"],VS="claude";function R3({onNext:e,onBack:t,onSkip:i}){const n=Ye(),a=Ae({queryKey:A3,queryFn:()=>ie.setup.probe.query(),refetchOnWindowFocus:!1,retry:!1}),l=Ae({queryKey:WS,queryFn:()=>ie.agentConfig.list.query()}),h=a.data,d=Ve({mutationFn:async()=>{var v,g;if(h===void 0)throw new Error("sem handshake não há o que salvar");const m=(v=l.data)==null?void 0:v.find(b=>b.transport==="acp"&&b.command===h.command);return m!==void 0?m:ie.agentConfig.create.mutate({name:VS,command:h.command,args:[...h.args],transport:"acp",adapterVersion:((g=h.agentInfo)==null?void 0:g.version)??null})},onSuccess:async m=>{await n.invalidateQueries({queryKey:WS}),e({agentConfigId:m.id,agentName:m.name,...m.adapterVersion===null?{}:{adapterVersion:m.adapterVersion}})}}),_=h===void 0?"":h.authMethods.length===0?"o adaptador não pediu autenticação: usou a credencial local":`o adaptador pede autenticação: ${h.authMethods.map(m=>m.name??m.id).join(", ")}`;return c.jsxs(gn,{eyebrow:`${No("handshake")??""} · conexão`,title:a.isError?"O adaptador não conectou":"Claude Code conectado",lede:a.isError?c.jsx(c.Fragment,{children:"Isto é o que o daemon tentou, e o que voltou."}):c.jsxs(c.Fragment,{children:["O daemon subiu o adaptador, trocou o ",c.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:c.jsx(pe,{variant:"ghost",disabled:a.isFetching,onClick:()=>void a.refetch(),children:a.isFetching?"testando…":"Testar de novo"}),hint:c.jsxs(c.Fragment,{children:["salvo como ",c.jsx("b",{children:VS})]}),children:[a.isPending&&c.jsx(gi,{label:"subindo o adaptador"}),a.isError&&c.jsxs(Re,{tone:"danger",children:[c.jsx("strong",{children:"O handshake falhou."})," ",a.error.message]}),h!==void 0&&c.jsxs(c.Fragment,{children:[c.jsxs(Fl,{label:"o que o adaptador respondeu",children:[c.jsx(Vs,{state:"ok",what:"processo",value:`${h.command} · subiu em ${h.timings.spawnMs} ms`,status:"ok"}),c.jsx(Vs,{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"}),c.jsx(Vs,{state:h.authMethods.length===0?"ok":"warn",what:"autenticação",value:_,status:h.authMethods.length===0?"ok":"pede"}),c.jsx(Vs,{state:"ok",what:"capacidades",value:h.capabilities.length===0?"nenhuma declarada":h.capabilities.join(" · "),status:"ok"}),c.jsx(Vs,{state:"ok",what:"sessão",value:`session/new devolveu ${h.acpSessionId} em ${h.timings.sessionMs} ms`,status:"ok"})]}),c.jsx(ta,{title:"o que o daemon mandou e o que voltou",children:c.jsxs("div",{className:"wire",children:[c.jsxs("span",{className:"wire__l",children:[c.jsx("span",{className:"wire__d wire__d--out","aria-hidden":"true",children:"→"}),c.jsxs("span",{className:"wire__c",children:["initialize ","{"," protocolVersion: ",h.protocolVersion,", clientCapabilities:"," ","{"," fs: ","{"," readTextFile, writeTextFile ","}",", terminal ","}"," ","}"]})]}),c.jsxs("span",{className:"wire__l",children:[c.jsx("span",{className:"wire__d wire__d--in","aria-hidden":"true",children:"←"}),c.jsxs("span",{className:"wire__c",children:["{"," protocolVersion: ",h.protocolVersion,", agentInfo:"," ",h.agentInfo===null?"ausente":`${h.agentInfo.name}@${h.agentInfo.version}`,", authMethods: [",h.authMethods.map(m=>m.id).join(", "),"] ","}"]})]}),c.jsxs("span",{className:"wire__l",children:[c.jsx("span",{className:"wire__d wire__d--out","aria-hidden":"true",children:"→"}),c.jsxs("span",{className:"wire__c",children:["session/new ","{"," cwd: ~/.lumem/probe, mcpServers: [] ","}"]})]}),c.jsxs("span",{className:"wire__l",children:[c.jsx("span",{className:"wire__d wire__d--in","aria-hidden":"true",children:"←"}),c.jsxs("span",{className:"wire__c",children:["{"," sessionId: ",h.acpSessionId,", modes: [",h.modes.join(", "),"] ","}"]})]}),c.jsxs("span",{className:"wire__l",children:[c.jsx("span",{className:"wire__d","aria-hidden":"true",children:"·"}),c.jsx("span",{className:"wire__c",children:"sessão de teste encerrada. Nenhum token consumido — não houve session/prompt."})]})]})}),c.jsxs(ta,{title:"como as próximas sessões nascem",children:[c.jsx(ha,{variant:"recap",entries:[{label:"modelo",value:c.jsxs(c.Fragment,{children:["o que o agente oferecer ",c.jsx("span",{className:"dim",children:"— trocável em cada conversa"})]})},{label:"modo",value:h.currentMode===null?c.jsx("span",{className:"dim",children:"o padrão do agente"}):c.jsxs(c.Fragment,{children:[h.currentMode," ",c.jsx("span",{className:"dim",children:"— trocável em cada conversa"})]})},{label:"versão",value:h.agentInfo===null?c.jsx("span",{className:"dim",children:"o adaptador não declarou — vai pedir para digitar"}):h.agentInfo.version}]}),c.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&&c.jsx(Re,{tone:"danger",children:d.error.message})]})]})}const R1=["setup","preflight"];function M3({onNext:e,onBack:t,onSkip:i}){var h;const n=Ae({queryKey:R1,queryFn:()=>ie.setup.preflight.query(),refetchOnWindowFocus:!1}),a=((h=n.data)==null?void 0:h.checks)??[],l=a.some(d=>d.id==="git"&&d.state==="fail");return c.jsxs(gn,{eyebrow:No("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:c.jsx(pe,{variant:"ghost",disabled:n.isFetching,onClick:()=>void n.refetch(),children:n.isFetching?"verificando…":"Verificar de novo"}),hint:c.jsxs(c.Fragment,{children:[c.jsx("b",{children:"esc"})," volta"]}),children:[n.isPending&&c.jsx(gi,{label:"lendo a máquina"}),n.isError&&c.jsxs(Re,{tone:"danger",children:[c.jsx("strong",{children:"O daemon não respondeu ao pré-voo."})," ",n.error.message]}),a.length>0&&c.jsx(Fl,{label:"o que o Lumem encontrou nesta máquina",children:a.map(d=>c.jsx(Vs,{state:n.isFetching?"running":d.state,what:d.label,value:d.value,status:n.isFetching?"lendo":D3(d.state),...d.fix===null?{}:{action:c.jsx(Qx,{command:d.fix})}},d.id))}),l&&c.jsxs(Re,{tone:"warning",children:["Git abaixo de ",c.jsx("strong",{children:"2.30"})," não serve: o Lumem usa ",c.jsx("code",{children:"git worktree"})," com"," ",c.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 D3(e){return e==="ok"?"ok":e==="warn"?"atenção":"falha"}function M1(e,t=400){const[i,n]=k.useState(e);return k.useEffect(()=>{const a=setTimeout(()=>n(e),t);return()=>clearTimeout(a)},[e,t]),i}function B3({workspaceId:e,onNext:t,onBack:i,onSkip:n}){const a=Ye(),[l,h]=k.useState(""),d=M1(l.trim()),_=Ae({queryKey:["project","inspect",d],queryFn:()=>ie.project.inspect.query({path:d}),enabled:d.startsWith("/")||d.startsWith("~"),retry:!1}),m=Ve({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:ca(e)}),t({projectId:b.id,projectPath:b.path})}}),v=_.data,g=(v==null?void 0:v.alreadyRegistered)??null;return c.jsxs(gn,{eyebrow:No("project"),title:"Adicione o primeiro projeto",lede:c.jsxs(c.Fragment,{children:["Projeto é um repositório git que ",c.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:g===null?"Adicionar projeto":"Usar o que já está aqui",disabled:v===void 0,isPending:m.isPending,pending:"validando…"},onSubmit:()=>{if(g!==null){t({projectId:g.id,projectPath:d});return}m.mutate()},onBack:i,onSkip:n,children:[c.jsxs("div",{className:"wizard__body",children:[c.jsx(as,{id:"setup-project-path",label:"Pasta do projeto — caminho absoluto",error:m.isError?m.error.message:_.isError&&d!==""?_.error.message:void 0,children:c.jsx(ps,{id:"setup-project-path",value:l,onChange:b=>h(b.target.value),placeholder:"/Users/voce/Documents/GitHub/lorebase",invalid:m.isError||_.isError,autoFocus:!0})}),c.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"," ",c.jsx("b",{children:"qual"})," verificação falhou."]})]}),_.isFetching&&c.jsx(gi,{label:"lendo o repositório"}),v!==void 0&&c.jsxs(c.Fragment,{children:[c.jsxs(ta,{title:"o que o Lumem leu daí",children:[c.jsxs(Fl,{label:"o que o repositório é",children:[c.jsx(Vs,{state:"ok",what:"repositório",value:`git · ${v.commits} commit(s) · HEAD em ${v.head.branch??"HEAD destacado"}${v.head.shortSha===null?"":` · ${v.head.shortSha}`}`,status:"ok"}),c.jsx(Vs,{state:v.origin===null?"warn":"ok",what:"remoto",value:v.origin??"sem origin — worktree funciona igual, push é que não",status:v.origin===null?"sem":"ok"}),c.jsx(Vs,{state:v.clean?"ok":"warn",what:"árvore",value:v.clean?"limpa · nada por commitar":`${v.changedFiles} arquivo(s) por commitar — o Lumem não toca neles`,status:v.clean?"limpa":"suja"}),c.jsx(Vs,{state:v.worktrees.length===0?"ok":"warn",what:"worktrees",value:v.worktrees.length===0?"nenhuma além do checkout principal":`${v.worktrees.length} já registrada(s) neste repositório, criada(s) fora do Lumem`,status:v.worktrees.length===0?"ok":"atenção"})]}),v.worktrees.length>0&&c.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."})]}),g!==null&&c.jsxs(Re,{tone:"info",children:["Este caminho já é o projeto ",c.jsx("strong",{children:g.name})," aqui. Nada será criado de novo — o fluxo segue com ele."]}),c.jsxs(Re,{tone:"info",children:["Seu checkout em ",c.jsx("code",{children:v.root})," continua sendo seu. O agente trabalha nas worktrees irmãs, fora dele."]})]})]})}function L3({projectId:e,agentConfigId:t,onNext:i,onBack:n,onSkip:a}){const l=Ye(),[h,d]=k.useState("primeira-tarefa"),[_,m]=k.useState(!0),v=M1(h.trim()),g=Ae({queryKey:["worktree","plan",e??"",v],queryFn:()=>ie.worktree.plan.query({projectId:e??"",name:v}),enabled:e!==void 0&&v!=="",retry:!1}),b=Ve({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:v});let C;return _&&t!==void 0&&(C=(await ie.session.createAgent.mutate({scopeType:"worktree",scopeId:x.id,agentConfigId:t})).id),{worktree:x,sessionId:C}},onSuccess:async({worktree:x,sessionId:C})=>{e!==void 0&&await l.invalidateQueries({queryKey:xo(e)}),await l.invalidateQueries({queryKey:Hi("worktree",x.id)}),i({worktreeId:x.id,worktreeName:x.name,sessionOpened:C!==void 0,...C===void 0?{}:{sessionId:C}})}}),S=g.data;return c.jsxs(gn,{eyebrow:No("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:_&&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:[c.jsxs("div",{className:"wizard__body",children:[c.jsx(as,{id:"setup-task-name",label:"Nome da tarefa",error:b.isError?b.error.message:g.isError?g.error.message:(S==null?void 0:S.refusal)??void 0,children:c.jsx(ps,{id:"setup-task-name",value:h,onChange:x=>d(x.target.value),placeholder:"primeira-tarefa",invalid:b.isError||g.isError||(S==null?void 0:S.refusal)!=null,autoFocus:!0})}),c.jsx("span",{className:"field__help",children:"Vira o nome da branch e o nome da pasta."}),S!==void 0&&c.jsx(ha,{variant:"recap",entries:[{label:"branch",value:c.jsxs(c.Fragment,{children:[S.branch," ",c.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}]})]}),c.jsx(ta,{title:"o que abre junto",children:c.jsxs(L2,{label:"o que abre junto",children:[c.jsx(o0,{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:c.jsx(at,{tone:"agent",children:"◆"}),selected:_&&t!==void 0,onSelect:()=>m(!0),disabled:t===void 0}),c.jsx(o0,{title:"Só a worktree",description:"Cria a pasta e a branch. Você abre sessão quando quiser.",glyph:c.jsx(at,{tone:"shell",children:"●"}),selected:!_||t===void 0,onSelect:()=>m(!1)})]})}),e===void 0&&c.jsxs(Re,{tone:"warning",children:["O passo do projeto foi pulado, então não há de onde cortar uma worktree. Pule este também — o painel do projeto tem ",c.jsx("b",{children:"nova worktree"})," quando você adicionar um."]})]})}function z3({daemonVersion:e,daemonUnreachable:t,onStart:i}){return c.jsx(gn,{title:t?"O daemon não está respondendo.":"O daemon já está rodando. Falta dizer com o que ele trabalha.",lede:t?c.jsxs(c.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 ",c.jsx("code",{children:"pnpm dev"})," e volte."]}):c.jsxs(c.Fragment,{children:["O Lumem roda inteiro na sua máquina: um daemon local",e!==null&&c.jsxs(c.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:c.jsx(c.Fragment,{children:"leva ~2 min"}),children:c.jsxs("div",{className:"tri",children:[c.jsxs("div",{className:"tri__i",children:[c.jsx("span",{className:"tri__g glyph glyph--worktree","aria-hidden":"true",children:"◇"}),c.jsx("span",{className:"tri__t",children:"Uma tarefa, uma worktree"}),c.jsx("span",{className:"tri__d",children:"Cada tarefa ganha branch e pasta próprias. O agente trabalha lá; seu checkout não é tocado."})]}),c.jsxs("div",{className:"tri__i",children:[c.jsx("span",{className:"tri__g glyph glyph--agent","aria-hidden":"true",children:"◆"}),c.jsx("span",{className:"tri__t",children:"Agente por ACP"}),c.jsx("span",{className:"tri__d",children:"Claude Code entra por protocolo, não por terminal simulado. Ferramenta, plano e permissão viram blocos."})]}),c.jsxs("div",{className:"tri__i",children:[c.jsx("span",{className:"tri__g glyph glyph--project","aria-hidden":"true",children:"■"}),c.jsx("span",{className:"tri__t",children:"Vários ao mesmo tempo"}),c.jsx("span",{className:"tri__d",children:"Sessões paralelas em worktrees diferentes, sem uma pisar na outra."})]})]})})}function q3({onNext:e,onBack:t}){var _;const i=Ye(),[n,a]=k.useState("pessoal"),l=Ae({queryKey:R1,queryFn:()=>ie.setup.preflight.query(),refetchOnWindowFocus:!1}),h=Ve({mutationFn:()=>ie.workspace.create.mutate({name:n.trim()}),onSuccess:async m=>{await i.invalidateQueries({queryKey:mr}),e({workspaceId:m.id,workspaceName:m.name})}}),d=(_=l.data)==null?void 0:_.paths;return c.jsxs(gn,{eyebrow:No("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:[c.jsxs("div",{className:"wizard__body",children:[c.jsx(as,{id:"setup-workspace-name",label:"Nome",error:h.isError?h.error.message:void 0,children:c.jsx(ps,{id:"setup-workspace-name",value:n,onChange:m=>a(m.target.value),placeholder:"pessoal",invalid:h.isError,autoFocus:!0})}),c.jsx("span",{className:"field__help",children:"Aparece no topo da coluna da esquerda. Dá para renomear depois."}),d!==void 0&&c.jsx(as,{id:"setup-workspaces-dir",label:"Onde o Lumem escreve — leitura",children:c.jsx(ps,{id:"setup-workspaces-dir",value:d.workspacesDir,readOnly:!0})}),c.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"," ",c.jsx("code",{children:"git status"})," e acaba commitada por acidente. Quem muda o lugar é a variável"," ",c.jsx("code",{children:"LUMEM_STATE_DIR"})," do daemon."]})]}),d!==void 0&&c.jsx(ta,{title:"o que este passo escreve no disco",children:c.jsx(ha,{variant:"recap",entries:[{label:"registro",value:d.databasePath},{label:"workspaces",value:d.workspacesDir},{label:"conversas",value:c.jsxs(c.Fragment,{children:[d.transcriptsDir," ",c.jsx("span",{className:"dim",children:"— só local"})]})}]})})]})}const wm=["welcome","machine","agent","handshake","workspace","project","task","done"];function P3({daemonVersion:e,daemonUnreachable:t,onFinish:i}){const[n,a]=k.useState("welcome"),[l,h]=k.useState({}),[d,_]=k.useState([]),m=wm.indexOf(n),v=k.useCallback(N=>{a(N),window.scrollTo(0,0)},[]),g=k.useCallback(N=>{N!==void 0&&h(B=>({...B,...N}));const z=wm[m+1];z!==void 0&&v(z)},[v,m]),b=k.useCallback(()=>{const N=wm[m-1];N!==void 0&&v(N)},[v,m]),S=k.useCallback(()=>{if(_(N=>N.includes(n)?N:[...N,n]),n==="agent"){_(N=>N.includes("handshake")?N:[...N,"handshake"]),v("workspace");return}g()},[g,v,n]);k.useEffect(()=>{const N=z=>{z.key==="Escape"&&b()};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[b]);const x=A1(n),C=k.useMemo(()=>x===null?null:c.jsx(q2,{steps:O1,current:x}),[x]);return c.jsx("div",{className:"flow",children:c.jsxs("div",{className:"wizard",children:[C,j()]})});function j(){switch(n){case"welcome":return c.jsx(z3,{daemonVersion:e,daemonUnreachable:t,onStart:()=>g()});case"machine":return c.jsx(M3,{onNext:()=>g(),onBack:b,onSkip:S});case"agent":return c.jsx(E3,{onNext:()=>g(),onBack:b,onSkip:S});case"handshake":return c.jsx(R3,{onNext:N=>g(N),onBack:b,onSkip:S});case"workspace":return c.jsx(q3,{onNext:N=>g(N),onBack:b});case"project":return c.jsx(B3,{workspaceId:l.workspaceId,onNext:N=>g(N),onBack:b,onSkip:S});case"task":return c.jsx(L3,{projectId:l.projectId,agentConfigId:l.agentConfigId,onNext:N=>g(N),onBack:b,onSkip:S});case"done":return c.jsx(T3,{result:l,skipped:d,onOpen:()=>i(l),onReview:()=>v("welcome")})}}}function H3(){var V;const e=Ye(),[t,i]=k.useState(null),[n,a]=k.useState(null),[l,h]=k.useState(void 0),[d,_]=k.useState(null),[m,v]=k.useState(null),g=w3(),b=sO(),S=b3(),x=Ae({queryKey:["health"],queryFn:()=>ie.health.query(),refetchInterval:5e3,retry:!1}),C=Ae({queryKey:mr,queryFn:()=>ie.workspace.list.query()}),{activeId:j,select:N}=m3(C.data??[]);return k.useEffect(()=>{n!==null||!C.isSuccess||a(C.data.length===0)},[n,C.isSuccess,C.data]),p3(),c.jsx(qM,{children:c.jsx(HT,{children:c.jsxs("div",{className:"app",children:[c.jsx(j3,{version:((V=x.data)==null?void 0:V.version)??null,unreachable:x.isError,filesPanel:t===null?void 0:b}),x.isError&&c.jsx("div",{className:"app__banner",children:c.jsxs(Re,{tone:"danger",children:[c.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."]})}),z()]})})});function z(){var te,he;if(C.isPending)return c.jsx("div",{className:"pane",children:c.jsx(gi,{label:"conectando ao daemon"})});if(C.isError)return c.jsx("div",{className:"pane",children:c.jsx("p",{role:"alert",children:C.error.message})});if(n===null)return c.jsx("div",{className:"pane",children:c.jsx(gi,{label:"conectando ao daemon"})});if(n||C.data.length===0||j===null)return c.jsx(P3,{daemonVersion:((te=x.data)==null?void 0:te.version)??null,daemonUnreachable:x.isError,onFinish:async de=>{await e.invalidateQueries({queryKey:mr}),de.workspaceId!==void 0&&N(de.workspaceId),h(de.sessionId),de.projectId!==void 0&&i({projectId:de.projectId,scope:de.worktreeId===void 0?{scopeType:"project",scopeId:de.projectId}:{scopeType:"worktree",scopeId:de.worktreeId}}),a(!1)}});const ee=C.data,q=((he=ee.find(de=>de.id===j))==null?void 0:he.name)??"";return c.jsx(C3,{fill:!0,right:B(),rightWidth:b.width,sidebar:c.jsxs(c.Fragment,{children:[c.jsx(h3,{workspaces:ee,activeId:j,onSelect:de=>{N(de),i(null)}}),c.jsx(a3,{workspaceId:j,expansion:g,selection:{scopeType:(t==null?void 0:t.scope.scopeType)??null,scopeId:(t==null?void 0:t.scope.scopeId)??null},onSelect:(de,ge)=>i({projectId:de,scope:ge})}),c.jsxs("div",{className:"sidebar__foot",children:[c.jsx(ZN,{}),c.jsx(MM,{workspaceId:j,onRetry:v}),c.jsx(U2,{workspaceId:j,prefill:m,onPrefillConsumed:()=>v(null),onAdded:de=>i({projectId:de,scope:{scopeType:"project",scopeId:de}})})]})]}),children:M(j,q)})}function B(){if(!(t===null||!b.open))return c.jsx(RM,{scope:t.scope,onClose:b.toggle,onResize:b.setWidth,onAskAgent:(ee,q)=>{_({sessionId:ee,text:q}),h(ee)},dock:{...S,toggle:()=>{!S.open&&b.width<FS&&b.setWidth(FS),S.toggle()}}},`${t.scope.scopeType}:${t.scope.scopeId}`)}function M(ee,q){if(t===null)return c.jsx(BT,{workspaceId:ee,workspaceName:q,onRemoved:async()=>{await e.invalidateQueries({queryKey:mr})}},ee);const{projectId:te,scope:he}=t;return he.scopeType==="worktree"?c.jsx(d3,{worktreeId:he.scopeId,projectId:te,openSessionId:l,initialPrompt:d??void 0,workspaceName:q,onRemoved:()=>i({projectId:te,scope:{scopeType:"project",scopeId:te}}),onOpenWorkspace:()=>i(null),onOpenProject:()=>i({projectId:te,scope:{scopeType:"project",scopeId:te}})},he.scopeId):c.jsx(r3,{projectId:te,workspaceId:ee,workspaceName:q,openSessionId:l,initialPrompt:d??void 0,onRemoved:()=>i(null),onOpenWorkspace:()=>i(null),onSelectWorktree:de=>i({projectId:te,scope:{scopeType:"worktree",scopeId:de}})},te)}}function I3(){return new Dk({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}})}const D1=document.getElementById("root");if(!D1)throw new Error("#root not found in index.html");const U3=Vk.createRoot(D1);U3.render(c.jsx(k.StrictMode,{children:c.jsx(Lk,{client:I3(),children:c.jsx(H3,{})})}));export{Y3 as a,Bt as c,V3 as s};
|