@agent-dock/cli 0.3.11 → 0.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ImageLightbox-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ImageLightbox-BQrxoDkw.js","assets/index-BSGhT06r.js","assets/syntax-highlighter-d-DuIo_w.js","assets/index-DXtkYvCt.css","assets/ImageLightbox-cV5bVqLR.css","assets/PromptEditor-CEWu7YQO.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var VM=e=>{throw TypeError(e)};var S1=(e,t,n)=>t.has(e)||VM("Cannot "+n);var V=(e,t,n)=>(S1(e,t,"read from private field"),n?n.call(e):t.get(e)),Ve=(e,t,n)=>t.has(e)?VM("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),we=(e,t,n,r)=>(S1(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),sn=(e,t,n)=>(S1(e,t,"access private method"),n);var L0=(e,t,n,r)=>({set _(i){we(e,t,i,n)},get _(){return V(e,t,r)}});import{j as d,r as iY,c as sY}from"./index-BSGhT06r.js";import{r as m,c as F0,g as ns,R as ze,a as Ca,H as oY,t as WM,P as aY}from"./syntax-highlighter-d-DuIo_w.js";function lY(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const S4=m.createContext(void 0),Fn=e=>{const t=m.useContext(S4);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},cY=({client:e,children:t})=>(m.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),d.jsx(S4.Provider,{value:e,children:t})),uY={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)};var Ql,sN,r4,dY=(r4=class{constructor(){Ve(this,Ql,uY);Ve(this,sN,!1)}setTimeoutProvider(e){we(this,Ql,e)}setTimeout(e,t){return V(this,Ql).setTimeout(e,t)}clearTimeout(e){V(this,Ql).clearTimeout(e)}setInterval(e,t){return V(this,Ql).setInterval(e,t)}clearInterval(e){V(this,Ql).clearInterval(e)}},Ql=new WeakMap,sN=new WeakMap,r4);const wu=new dY;function hY(e){setTimeout(e,0)}const fY=typeof window>"u"||"Deno"in globalThis;function Zi(){}function pY(e,t){return typeof e=="function"?e(t):e}function _4(e){return typeof e=="number"&&e>=0&&e!==1/0}function C4(e,t){return Math.max(e+(t||0)-Date.now(),0)}function nr(e,t){return typeof e=="function"?e(t):e}function qM(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==oN(o,t.options))return!1}else if(!hf(t.queryKey,o))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||i&&i!==t.state.fetchStatus||s&&!s(t))}function UM(e,t){const{exact:n,status:r,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(cd(t.options.mutationKey)!==cd(s))return!1}else if(!hf(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function oN(e,t){return((t==null?void 0:t.queryKeyHashFn)||cd)(e)}function cd(e){return JSON.stringify(e,(t,n)=>f_(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function hf(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)){if(t.length>e.length)return!1;for(let r=0;r<t.length;r++)if(!hf(e[r],t[r]))return!1;return!0}const n=Object.keys(t);for(const r of n)if(!hf(e[r],t[r]))return!1;return!0}return!1}const k4=Object.prototype.hasOwnProperty;function N4(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=KM(e)&&KM(t);if(!r&&!(f_(e)&&f_(t)))return t;const i=(r?e:Object.keys(e)).length,s=r?t:Object.keys(t),o=s.length,a=r?new Array(o):{};let l=0;for(let c=0;c<o;c++){const u=r?c:s[c],h=e[u],f=t[u];if(h===f){a[u]=h,(r?c<i:k4.call(e,u))&&l++;continue}if(h===null||f===null||typeof h!="object"||typeof f!="object"){a[u]=f;continue}const p=N4(h,f,n+1);a[u]=p,p===h&&l++}return i===o&&l===i?e:a}function Bv(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n of Object.keys(e))if(!k4.call(t,n)||e[n]!==t[n])return!1;return!0}function KM(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function f_(e){if(!GM(e))return!1;const t=Object.getPrototypeOf(e),n=t==null?void 0:t.constructor;if(n===void 0)return!0;if(typeof n!="function")return!1;const r=n.prototype;return!(!GM(r)||!r.hasOwnProperty("isPrototypeOf")||t!==Object.prototype)}function GM(e){return Object.prototype.toString.call(e)==="[object Object]"}function mY(e){return new Promise(t=>{wu.setTimeout(t,e)})}function p_(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?N4(e,t):t}function gY(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(-n):r}function vY(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,n):r}const aN=Symbol();function E4(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===aN?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function lN(e,t){return typeof e=="function"?e(...t):!!e}const cN=Symbol();function xY(e,t,n,r){let i=!1,s;return Object.defineProperties(e,{[cN]:{value:r},signal:{enumerable:!0,get:()=>(s??(s=t()),i||(i=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}}),e}let bY=()=>fY;const uN=()=>bY();var $f=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(){}},ju,Jl,$h,i4,yY=(i4=class extends $f{constructor(){super();Ve(this,ju);Ve(this,Jl);Ve(this,$h);we(this,$h,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){V(this,Jl)||this.setEventListener(V(this,$h))}onUnsubscribe(){var t;this.hasListeners()||((t=V(this,Jl))==null||t.call(this),we(this,Jl,void 0))}setEventListener(t){var n;we(this,$h,t),(n=V(this,Jl))==null||n.call(this),we(this,Jl,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){V(this,ju)!==t&&(we(this,ju,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof V(this,ju)=="boolean"?V(this,ju):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ju=new WeakMap,Jl=new WeakMap,$h=new WeakMap,i4);const dN=new yY,wY=hY;function SY(){let e=[],t=0,n=a=>{a()},r=a=>{a()},i=wY;const s=a=>{t?e.push(a):i(()=>{n(a)})},o=()=>{const a=e;e=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}const Lr=SY();var Rh,ec,Oh,s4,_Y=(s4=class extends $f{constructor(){super();Ve(this,Rh,!0);Ve(this,ec);Ve(this,Oh);we(this,Oh,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){V(this,ec)||this.setEventListener(V(this,Oh))}onUnsubscribe(){var t;this.hasListeners()||((t=V(this,ec))==null||t.call(this),we(this,ec,void 0))}setEventListener(t){var n;we(this,Oh,t),(n=V(this,ec))==null||n.call(this),we(this,ec,t(this.setOnline.bind(this)))}setOnline(t){V(this,Rh)!==t&&(we(this,Rh,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return V(this,Rh)}},Rh=new WeakMap,ec=new WeakMap,Oh=new WeakMap,s4);const Ix=new _Y;function CY(e){return Math.min(1e3*2**e,3e4)}function j4(e){return(e??"online")==="online"?Ix.isOnline():!0}var m_=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function z4(e){let t=!1,n=0,r,i="pending",s,o;const a=new Promise((y,w)=>{s=y,o=w});a.catch(Zi);const l=()=>i!=="pending",c=y=>{var w;if(!l()){const S=new m_(y);v(S),(w=e.onCancel)==null||w.call(e,S)}},u=()=>{t=!0},h=()=>{t=!1},f=()=>dN.isFocused()&&(e.networkMode==="always"||Ix.isOnline())&&e.canRun(),p=()=>j4(e.networkMode)&&e.canRun(),g=y=>{l()||(r==null||r(),i="resolved",s(y))},v=y=>{l()||(r==null||r(),i="rejected",o(y))},x=y=>new Promise(w=>{var S;r=C=>{(l()||y())&&w(C)},(S=e.onPause)==null||S.call(e)}).then(()=>{var w;r=void 0,l()||(w=e.onContinue)==null||w.call(e)}),b=()=>{if(l())return;let y;const w=n===0?e.initialPromise:void 0;try{y=w??e.fn()}catch(S){y=Promise.reject(S)}Promise.resolve(y).then(g).catch(S=>{var j;if(l())return;const C=e.retry??(uN()?0:3),_=e.retryDelay??CY,k=typeof _=="function"?_(n,S):_,z=C===!0||typeof C=="number"&&n<C||typeof C=="function"&&C(n,S);if(t||!z){v(S);return}n++,(j=e.onFail)==null||j.call(e,n,S),mY(k).then(()=>l()||f()?void 0:x(f)).then(()=>{t?v(S):b()})})};return{promise:a,status:()=>i,cancel:c,continue:()=>(r==null||r(),a),cancelRetry:u,continueRetry:h,canStart:p,start:()=>(p()?b():x(p).then(b),a)}}var zu,o4,M4=(o4=class{constructor(){Ve(this,zu)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),_4(this.gcTime)&&we(this,zu,wu.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(uN()?1/0:3e5))}clearGcTimeout(){V(this,zu)!==void 0&&(wu.clearTimeout(V(this,zu)),we(this,zu,void 0))}},zu=new WeakMap,o4);function kY(e){return{onFetch:(t,n)=>{var u,h,f,p,g;const r=t.options,i=(f=(h=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:h.fetchMore)==null?void 0:f.direction,s=((p=t.state.data)==null?void 0:p.pages)||[],o=((g=t.state.data)==null?void 0:g.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let v=!1;const x=t,b=S=>{xY(S,()=>t.signal,()=>v=!0,x[cN])},y=E4(t.options,t.fetchOptions),w=async(S,C,_)=>{if(v)return Promise.reject(t.signal.reason);if(C==null&&S.pages.length)return Promise.resolve(S);const z=(()=>{const R={client:t.client,queryKey:t.queryKey,pageParam:C,direction:_?"backward":"forward",meta:t.options.meta};return b(R),R})(),j=await y(z),{maxPages:N}=t.options,$=_?vY:gY;return{pages:$(S.pages,j,N),pageParams:$(S.pageParams,C,N)}};if(i&&s.length){const S=i==="backward",C=S?I4:g_,_={pages:s,pageParams:o};a=await w(_,C(r,_),S)}else{const S=e??s.length;do{const C=l===0?o[0]===void 0?r.initialPageParam:o[0]:g_(r,a);if(l>0&&C==null)break;a=await w(a,C),l++}while(l<S)}return a};t.options.persister?t.fetchFn=()=>{var v,x;return(x=(v=t.options).persister)==null?void 0:x.call(v,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function g_(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function I4(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}function NY(e,t){return t?g_(e,t)!=null:!1}function EY(e,t){return!t||!e.getPreviousPageParam?!1:I4(e,t)!=null}var Ph,Mu,Th,Zs,Iu,Xr,La,Ng,$u,No,Pa,a4,jY=(a4=class extends M4{constructor(t){super();Ve(this,No);Ve(this,Ph);Ve(this,Mu);Ve(this,Th);Ve(this,Zs);Ve(this,Iu);Ve(this,Xr);Ve(this,La);Ve(this,Ng);Ve(this,$u);we(this,$u,!1),we(this,Ng,t.defaultOptions),this.setOptions(t.options),this.observers=[],we(this,Iu,t.client),we(this,Zs,V(this,Iu).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,we(this,Mu,ZM(this.options)),this.state=t.state??V(this,Mu),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return V(this,Ph)}get promise(){var t;return(t=V(this,Xr))==null?void 0:t.promise}setOptions(t){if(this.options={...V(this,Ng),...t},t!=null&&t._type&&we(this,Ph,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=ZM(this.options);n.data!==void 0&&(this.setState(YM(n.data,n.dataUpdatedAt)),we(this,Mu,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&V(this,Zs).remove(this)}setData(t,n){const r=p_(this.state.data,t,this.options);return sn(this,No,Pa).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t){sn(this,No,Pa).call(this,{type:"setState",state:t})}cancel(t){var r,i;const n=(r=V(this,Xr))==null?void 0:r.promise;return(i=V(this,Xr))==null||i.cancel(t),n?n.then(Zi).catch(Zi):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return V(this,Mu)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>nr(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===aN||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.state.data===void 0?!1:this.getObserversCount()>0?this.observers.some(t=>nr(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:!C4(this.state.dataUpdatedAt,t)}onFocus(){var t,n;(t=this.observers.find(r=>r.shouldFetchOnWindowFocus()))==null||t.refetch({cancelRefetch:!1}),(n=V(this,Xr))==null||n.continue()}onOnline(){var t,n;(t=this.observers.find(r=>r.shouldFetchOnReconnect()))==null||t.refetch({cancelRefetch:!1}),(n=V(this,Xr))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),V(this,Zs).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){const n=this.observers.indexOf(t);n!==-1&&(this.observers.splice(n,1),this.observers.length||(V(this,Xr)&&(V(this,$u)||this.state.fetchStatus==="paused"&&this.state.status==="pending"?V(this,Xr).cancel({revert:!0}):V(this,Xr).cancelRetry()),this.scheduleGc()),V(this,Zs).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||sn(this,No,Pa).call(this,{type:"invalidate"})}async fetch(t,n){var u,h,f,p;if(this.state.fetchStatus!=="idle"&&((u=V(this,Xr))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(V(this,Xr)&&V(this,La))return V(this,Xr).continueRetry(),V(this,La)}if(t&&this.setOptions(t),!this.options.queryFn){const g=this.observers.find(v=>v.options.queryFn);g&&this.setOptions(g.options)}const r=new AbortController,i=g=>{Object.defineProperties(g,{[cN]:{value:r.signal,enumerable:!0},signal:{enumerable:!0,get:()=>(we(this,$u,!0),r.signal)}})},s=()=>{const g=E4(this.options,n),x=(()=>{const b={client:V(this,Iu),queryKey:this.queryKey,meta:this.meta};return i(b),b})();return we(this,$u,!1),this.options.persister?this.options.persister(g,x,this):g(x)},a=(()=>{const g={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:V(this,Iu),state:this.state,fetchFn:s};return i(g),g})();(h=V(this,Ph)==="infinite"?kY(this.options.pages):this.options.behavior)==null||h.onFetch(a,this),we(this,Th,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&sn(this,No,Pa).call(this,{type:"fetch",meta:(p=a.fetchOptions)==null?void 0:p.meta});const l=we(this,Xr,z4({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:g=>{g instanceof m_&&g.revert&&this.setState({...V(this,Th),fetchStatus:"idle"}),r.abort()},onFail:(g,v)=>{sn(this,No,Pa).call(this,{type:"failed",failureCount:g,error:v})},onPause:()=>{sn(this,No,Pa).call(this,{type:"pause"})},onContinue:()=>{sn(this,No,Pa).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0})),c=(async()=>{var g,v,x,b,y,w,S,C;try{const _=await l.promise;if(_===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(_),(v=(g=V(this,Zs).config).onSuccess)==null||v.call(g,_,this),(b=(x=V(this,Zs).config).onSettled)==null||b.call(x,_,this.state.error,this),_}catch(_){if(_ instanceof m_){if(_.silent){if(V(this,Xr)!==l&&V(this,La))return V(this,La);throw _}else if(_.revert){if(this.state.data===void 0)throw _;return this.state.data}}throw sn(this,No,Pa).call(this,{type:"error",error:_}),(w=(y=V(this,Zs).config).onError)==null||w.call(y,_,this),(C=(S=V(this,Zs).config).onSettled)==null||C.call(S,this.state.data,_,this),_}finally{V(this,Xr)===l&&(we(this,Xr,void 0),we(this,La,void 0)),this.scheduleGc()}})();return we(this,La,c),l.start(),c}},Ph=new WeakMap,Mu=new WeakMap,Th=new WeakMap,Zs=new WeakMap,Iu=new WeakMap,Xr=new WeakMap,La=new WeakMap,Ng=new WeakMap,$u=new WeakMap,No=new WeakSet,Pa=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...$4(r.data,this.options),fetchMeta:t.meta??null};case"success":const i={...r,...YM(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return we(this,Th,t.manual?i:void 0),i;case"error":const s=t.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Lr.batch(()=>{this.observers.slice().forEach(r=>{r.onQueryUpdate()}),V(this,Zs).notify({query:this,type:"updated",action:t})})},a4);function $4(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:j4(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function YM(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ZM(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ki,wn,Eg,Gi,Ru,Ah,Fa,jg,Dh,Lh,Ou,Pu,tc,Fh,In,Vp,v_,x_,b_,y_,w_,S_,__,C_,l4,R4=(l4=class extends $f{constructor(t,n){super();Ve(this,In);Ve(this,Ki);Ve(this,wn);Ve(this,Eg);Ve(this,Gi);Ve(this,Ru);Ve(this,Ah);Ve(this,Fa);Ve(this,jg);Ve(this,Dh);Ve(this,Lh);Ve(this,Ou);Ve(this,Pu);Ve(this,tc);Ve(this,Fh,new Set);this.options=n,we(this,Ki,t),we(this,Fa,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(V(this,wn).addObserver(this),XM(V(this,wn),this.options)?sn(this,In,Vp).call(this):this.updateResult(),sn(this,In,w_).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return k_(V(this,wn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return k_(V(this,wn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,sn(this,In,S_).call(this),sn(this,In,__).call(this),V(this,wn).removeObserver(this)}setOptions(t){const n=this.options,r=V(this,wn);if(this.options=V(this,Ki).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof nr(this.options.enabled,V(this,wn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");sn(this,In,C_).call(this),V(this,wn).setOptions(this.options),n._defaulted&&!Bv(this.options,n)&&V(this,Ki).getQueryCache().notify({type:"observerOptionsUpdated",query:V(this,wn),observer:this});const i=this.hasListeners();i&&QM(V(this,wn),r,this.options,n)&&sn(this,In,Vp).call(this),this.updateResult(),i&&(V(this,wn)!==r||nr(this.options.enabled,V(this,wn))!==nr(n.enabled,V(this,wn))||nr(this.options.staleTime,V(this,wn))!==nr(n.staleTime,V(this,wn)))&&sn(this,In,x_).call(this);const s=sn(this,In,b_).call(this);i&&(V(this,wn)!==r||nr(this.options.enabled,V(this,wn))!==nr(n.enabled,V(this,wn))||s!==V(this,tc))&&sn(this,In,y_).call(this,s)}getOptimisticResult(t){const n=V(this,Ki).getQueryCache().build(V(this,Ki),t),r=this.createResult(n,t);return Bv(this.getCurrentResult(),r)||(we(this,Gi,r),we(this,Ah,this.options),we(this,Ru,V(this,wn).state)),r}getCurrentResult(){return V(this,Gi)}trackResult(t,n){return new Proxy(t,{get:(r,i)=>(this.trackProp(i),n==null||n(i),Reflect.get(r,i))})}trackProp(t){V(this,Fh).add(t)}getCurrentQuery(){return V(this,wn)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=V(this,Ki).defaultQueryOptions(t),r=V(this,Ki).getQueryCache().build(V(this,Ki),n);let i=()=>{},s;const o=new Promise(a=>{s=a,i=V(this,Ki).getQueryCache().subscribe(l=>{l.type==="updated"&&l.query.queryHash===r.queryHash&&r.state.data!==void 0&&(i(),a(this.createResult(r,n)))})});return Promise.race([r.fetch(n).then(()=>{const a=this.createResult(r,n);return s==null||s(a),a}).finally(()=>{i()}),o])}fetch(t){return sn(this,In,Vp).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),V(this,Gi)))}createResult(t,n){var _;const r=V(this,wn),i=this.options,s=V(this,Gi),o=V(this,Ru),a=V(this,Ah),l=t!==r?t.state:V(this,Eg),{state:c}=t;let u={...c},h=!1,f;if(n._optimisticResults){const k=this.hasListeners(),z=!k&&XM(t,n),j=k&&QM(t,r,n,i);(z||j)&&(u={...u,...$4(c.data,t.options)}),n._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:p,errorUpdatedAt:g,status:v}=u;f=u.data;let x=!1;if(n.placeholderData!==void 0&&f===void 0&&v==="pending"){let k;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(k=s.data,x=!0):k=typeof n.placeholderData=="function"?n.placeholderData((_=V(this,Lh))==null?void 0:_.state.data,V(this,Lh)):n.placeholderData,k!==void 0&&(v="success",f=p_(s==null?void 0:s.data,k,n),h=!0)}if(n.select&&f!==void 0&&!x)if(s&&f===(o==null?void 0:o.data)&&n.select===V(this,jg))f=V(this,Dh);else try{we(this,jg,n.select),f=n.select(f),f=p_(s==null?void 0:s.data,f,n),we(this,Dh,f),we(this,Fa,null)}catch(k){we(this,Fa,k)}else f===void 0&&we(this,Fa,null);V(this,Fa)&&(p=V(this,Fa),f=V(this,Dh),g=(s==null?void 0:s.error)===p?s.errorUpdatedAt:Date.now(),v="error",h=!1);const b=u.fetchStatus==="fetching",y=v==="pending",w=v==="error",S=y&&b,C=f!==void 0;return{status:v,fetchStatus:u.fetchStatus,isPending:y,isSuccess:v==="success",isError:w,isInitialLoading:S,isLoading:S,data:f,dataUpdatedAt:u.dataUpdatedAt,error:p,errorUpdatedAt:g,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:u.dataUpdateCount>l.dataUpdateCount||u.errorUpdateCount>l.errorUpdateCount,isFetching:b,isRefetching:b&&!y,isLoadingError:w&&!C,isPaused:u.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:w&&C,isStale:hN(t,n),refetch:this.refetch,isEnabled:nr(n.enabled,t)!==!1}}updateResult(){const t=V(this,Gi),n=this.createResult(V(this,wn),this.options);if(we(this,Ru,V(this,wn).state),we(this,Ah,this.options),V(this,Ru).data!==void 0&&we(this,Lh,V(this,wn)),Bv(n,t))return;we(this,Gi,n);const i=(()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,o=typeof s=="function"?s():s;if(o==="all"||!o&&!V(this,Fh).size||this.options.throwOnError&&V(this,Gi).error!==t.error)return!0;for(const a of o??V(this,Fh))if(V(this,Gi)[a]!==t[a])return!0;return!1})();Lr.batch(()=>{i&&this.listeners.forEach(s=>{s(V(this,Gi))}),V(this,Ki).getQueryCache().notify({query:V(this,wn),type:"observerResultsUpdated"})})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&sn(this,In,w_).call(this)}},Ki=new WeakMap,wn=new WeakMap,Eg=new WeakMap,Gi=new WeakMap,Ru=new WeakMap,Ah=new WeakMap,Fa=new WeakMap,jg=new WeakMap,Dh=new WeakMap,Lh=new WeakMap,Ou=new WeakMap,Pu=new WeakMap,tc=new WeakMap,Fh=new WeakMap,In=new WeakSet,Vp=function(t){sn(this,In,C_).call(this);let n=V(this,wn).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Zi)),n},v_=function(t){return!uN()&&nr(this.options.enabled,V(this,wn))!==!1&&_4(t)},x_=function(){sn(this,In,S_).call(this);const t=nr(this.options.staleTime,V(this,wn));if(V(this,Gi).isStale||!sn(this,In,v_).call(this,t))return;const n=C4(V(this,Gi).dataUpdatedAt,t)+1;we(this,Ou,wu.setTimeout(()=>{V(this,Gi).isStale||this.updateResult()},n))},b_=function(){return nr(this.options.refetchInterval,V(this,wn))??!1},y_=function(t){sn(this,In,__).call(this),we(this,tc,t),!(V(this,tc)===0||!sn(this,In,v_).call(this,V(this,tc)))&&we(this,Pu,wu.setInterval(()=>{(this.options.refetchIntervalInBackground||dN.isFocused())&&sn(this,In,Vp).call(this)},V(this,tc)))},w_=function(){sn(this,In,x_).call(this),sn(this,In,y_).call(this,sn(this,In,b_).call(this))},S_=function(){V(this,Ou)!==void 0&&(wu.clearTimeout(V(this,Ou)),we(this,Ou,void 0))},__=function(){V(this,Pu)!==void 0&&(wu.clearInterval(V(this,Pu)),we(this,Pu,void 0))},C_=function(){const t=V(this,Ki).getQueryCache().build(V(this,Ki),this.options);if(t===V(this,wn))return;const n=V(this,wn);we(this,wn,t),we(this,Eg,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},l4);function zY(e,t){return nr(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&nr(t.retryOnMount,e)===!1)}function XM(e,t){return zY(e,t)||e.state.data!==void 0&&k_(e,t,t.refetchOnMount)}function k_(e,t,n){if(nr(t.enabled,e)!==!1&&nr(t.staleTime,e)!=="static"){const r=nr(n,e);return r==="always"||r!==!1&&hN(e,t)}return!1}function QM(e,t,n,r){return(e!==t||nr(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&hN(e,n)}function hN(e,t){return nr(t.enabled,e)!==!1&&e.isStaleByTime(nr(t.staleTime,e))}var MY=class extends R4{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var p,g;const{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:s,isError:o,isRefetchError:a}=r,l=(g=(p=n.fetchMeta)==null?void 0:p.fetchMore)==null?void 0:g.direction,c=o&&l==="forward",u=i&&l==="forward",h=o&&l==="backward",f=i&&l==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:NY(t,n.data),hasPreviousPage:EY(t,n.data),isFetchNextPageError:c,isFetchingNextPage:u,isFetchPreviousPageError:h,isFetchingPreviousPage:f,isRefetchError:a&&!c&&!h,isRefetching:s&&!u&&!f}}},zg,Jo,zi,Tu,ea,Ll,c4,IY=(c4=class extends M4{constructor(t){super();Ve(this,ea);Ve(this,zg);Ve(this,Jo);Ve(this,zi);Ve(this,Tu);we(this,zg,t.client),this.mutationId=t.mutationId,we(this,zi,t.mutationCache),we(this,Jo,[]),this.state=t.state||O4(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){V(this,Jo).includes(t)||(V(this,Jo).push(t),this.clearGcTimeout(),V(this,zi).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){we(this,Jo,V(this,Jo).filter(n=>n!==t)),this.scheduleGc(),V(this,zi).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){V(this,Jo).length||(this.state.status==="pending"?this.scheduleGc():V(this,zi).remove(this))}continue(){var t;return((t=V(this,Tu))==null?void 0:t.continue())??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(t){var a,l,c,u,h,f,p,g,v,x,b,y,w,S,C,_,k,z;const n=()=>{sn(this,ea,Ll).call(this,{type:"continue"})},r={client:V(this,zg),meta:this.options.meta,mutationKey:this.options.mutationKey},i=we(this,Tu,z4({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(j,N)=>{sn(this,ea,Ll).call(this,{type:"failed",failureCount:j,error:N})},onPause:()=>{sn(this,ea,Ll).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>V(this,zi).canRun(this)})),s=this.state.status==="pending",o=!i.canStart();try{if(s)n();else{sn(this,ea,Ll).call(this,{type:"pending",variables:t,isPaused:o}),V(this,zi).config.onMutate&&await V(this,zi).config.onMutate(t,this,r);const N=await((l=(a=this.options).onMutate)==null?void 0:l.call(a,t,r));N!==this.state.context&&sn(this,ea,Ll).call(this,{type:"pending",context:N,variables:t,isPaused:o})}this.state.isPaused&&i.canStart()&&n();const j=await i.start();return await((u=(c=V(this,zi).config).onSuccess)==null?void 0:u.call(c,j,t,this.state.context,this,r)),await((f=(h=this.options).onSuccess)==null?void 0:f.call(h,j,t,this.state.context,r)),await((g=(p=V(this,zi).config).onSettled)==null?void 0:g.call(p,j,null,this.state.variables,this.state.context,this,r)),await((x=(v=this.options).onSettled)==null?void 0:x.call(v,j,null,t,this.state.context,r)),sn(this,ea,Ll).call(this,{type:"success",data:j}),j}catch(j){try{await((y=(b=V(this,zi).config).onError)==null?void 0:y.call(b,j,t,this.state.context,this,r))}catch(N){Promise.reject(N)}try{await((S=(w=this.options).onError)==null?void 0:S.call(w,j,t,this.state.context,r))}catch(N){Promise.reject(N)}try{await((_=(C=V(this,zi).config).onSettled)==null?void 0:_.call(C,void 0,j,this.state.variables,this.state.context,this,r))}catch(N){Promise.reject(N)}try{await((z=(k=this.options).onSettled)==null?void 0:z.call(k,void 0,j,t,this.state.context,r))}catch(N){Promise.reject(N)}throw sn(this,ea,Ll).call(this,{type:"error",error:j}),j}finally{V(this,Tu)===i&&we(this,Tu,void 0),V(this,zi).runNext(this)}}},zg=new WeakMap,Jo=new WeakMap,zi=new WeakMap,Tu=new WeakMap,ea=new WeakSet,Ll=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,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{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Lr.batch(()=>{V(this,Jo).forEach(r=>{r.onMutationUpdate(t)}),V(this,zi).notify({mutation:this,type:"updated",action:t})})},c4);function O4(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var nc,Eo,Mg,u4,$Y=(u4=class extends $f{constructor(t={}){super();Ve(this,nc);Ve(this,Eo);Ve(this,Mg);this.config=t,we(this,nc,new Set),we(this,Eo,new Map),we(this,Mg,0)}build(t,n,r){const i=new IY({client:t,mutationCache:this,mutationId:++L0(this,Mg)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){V(this,nc).add(t);const n=B0(t);if(typeof n=="string"){const r=V(this,Eo).get(n);r?r.push(t):V(this,Eo).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(V(this,nc).delete(t)){const n=B0(t);if(typeof n=="string"){const r=V(this,Eo).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&V(this,Eo).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){var r;const n=B0(t);if(typeof n=="string"){const i=(r=V(this,Eo).get(n))==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r,i;const n=B0(t);return typeof n=="string"?((i=(r=V(this,Eo).get(n))==null?void 0:r.find(s=>s!==t&&s.state.isPaused))==null?void 0:i.continue())??Promise.resolve():Promise.resolve()}clear(){Lr.batch(()=>{const t=this.getAll();V(this,nc).clear(),V(this,Eo).clear(),t.forEach(n=>{this.notify({type:"removed",mutation:n})})})}getAll(){return Array.from(V(this,nc))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>UM(n,r))}findAll(t={}){return this.getAll().filter(n=>UM(t,n))}notify(t){Lr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Lr.batch(()=>Promise.all(t.map(n=>n.continue().catch(Zi))))}},nc=new WeakMap,Eo=new WeakMap,Mg=new WeakMap,u4);function B0(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Ba,rc,Mi,Ig,ua,Wp,N_,d4,RY=(d4=class extends $f{constructor(n,r){super();Ve(this,ua);Ve(this,Ba);Ve(this,rc);Ve(this,Mi);Ve(this,Ig);we(this,Ba,n),this.setOptions(r),this.bindMethods(),sn(this,ua,Wp).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var i;const r=this.options;this.options=V(this,Ba).defaultMutationOptions(n),Bv(this.options,r)||V(this,Ba).getMutationCache().notify({type:"observerOptionsUpdated",mutation:V(this,Mi),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&cd(r.mutationKey)!==cd(this.options.mutationKey)?this.reset():((i=V(this,Mi))==null?void 0:i.state.status)==="pending"&&V(this,Mi).setOptions(this.options)}onSubscribe(){this.listeners.size===1&&V(this,Mi)&&(V(this,Mi).addObserver(this),sn(this,ua,Wp).call(this))}onUnsubscribe(){var n;this.hasListeners()||(n=V(this,Mi))==null||n.removeObserver(this)}onMutationUpdate(n){sn(this,ua,Wp).call(this),sn(this,ua,N_).call(this,n)}getCurrentResult(){return V(this,rc)}reset(){var n;(n=V(this,Mi))==null||n.removeObserver(this),we(this,Mi,void 0),sn(this,ua,Wp).call(this),sn(this,ua,N_).call(this)}mutate(n,r){var i;return we(this,Ig,r),(i=V(this,Mi))==null||i.removeObserver(this),we(this,Mi,V(this,Ba).getMutationCache().build(V(this,Ba),this.options)),V(this,Mi).addObserver(this),V(this,Mi).execute(n)}},Ba=new WeakMap,rc=new WeakMap,Mi=new WeakMap,Ig=new WeakMap,ua=new WeakSet,Wp=function(){var r;const n=((r=V(this,Mi))==null?void 0:r.state)??O4();we(this,rc,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},N_=function(n){Lr.batch(()=>{var i,s,o,a;const r=V(this,Ig);if(r&&this.hasListeners()){const l=V(this,rc).variables,c=V(this,rc).context,u={client:V(this,Ba),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(i=r.onSuccess)==null||i.call(r,n.data,l,c,u)}catch(h){Promise.reject(h)}try{(s=r.onSettled)==null||s.call(r,n.data,null,l,c,u)}catch(h){Promise.reject(h)}}else if((n==null?void 0:n.type)==="error"){try{(o=r.onError)==null||o.call(r,n.error,l,c,u)}catch(h){Promise.reject(h)}try{(a=r.onSettled)==null||a.call(r,void 0,n.error,l,c,u)}catch(h){Promise.reject(h)}}}this.listeners.forEach(l=>{l(V(this,rc))})})},d4),ta,h4,OY=(h4=class extends $f{constructor(t={}){super();Ve(this,ta);this.config=t,we(this,ta,new Map)}build(t,n,r){const i=n.queryKey,s=n.queryHash??oN(i,n);let o=this.get(s);return o||(o=new jY({client:t,queryKey:i,queryHash:s,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(o)),o}add(t){V(this,ta).has(t.queryHash)||(V(this,ta).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){V(this,ta).get(t.queryHash)===t&&(t.destroy(),V(this,ta).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Lr.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return V(this,ta).get(t)}getAll(){return[...V(this,ta).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>qM(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>qM(t,r)):n}notify(t){Lr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Lr.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Lr.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ta=new WeakMap,h4),cr,ic,sc,Bh,Hh,oc,Vh,Wh,f4,PY=(f4=class{constructor(e={}){Ve(this,cr);Ve(this,ic);Ve(this,sc);Ve(this,Bh);Ve(this,Hh);Ve(this,oc);Ve(this,Vh);Ve(this,Wh);we(this,cr,e.queryCache||new OY),we(this,ic,e.mutationCache||new $Y),we(this,sc,e.defaultOptions||{}),we(this,Bh,new Map),we(this,Hh,new Map),we(this,oc,0)}mount(){L0(this,oc)._++,V(this,oc)===1&&(we(this,Vh,dN.subscribe(async e=>{e&&(await this.resumePausedMutations(),V(this,cr).onFocus())})),we(this,Wh,Ix.subscribe(async e=>{e&&(await this.resumePausedMutations(),V(this,cr).onOnline())})))}unmount(){var e,t;L0(this,oc)._--,V(this,oc)===0&&((e=V(this,Vh))==null||e.call(this),we(this,Vh,void 0),(t=V(this,Wh))==null||t.call(this),we(this,Wh,void 0))}isFetching(e){return V(this,cr).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return V(this,ic).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=V(this,cr).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=V(this,cr).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(nr(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return V(this,cr).findAll(e).map(({queryKey:t,state:n})=>[t,n.data])}setQueryData(e,t,n){var o;const r=this.defaultQueryOptions({queryKey:e}),i=(o=V(this,cr).get(r.queryHash))==null?void 0:o.state.data,s=pY(t,i);if(s!==void 0)return V(this,cr).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return Lr.batch(()=>V(this,cr).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=V(this,cr).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=V(this,cr);Lr.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=V(this,cr);return Lr.batch(()=>{const r=n.findAll(e),i=new Set(r);return r.forEach(s=>{s.reset()}),this.refetchQueries({type:"active",predicate:s=>i.has(s)},t)})}cancelQueries(e,t={}){const n={revert:!0,...t},r=Lr.batch(()=>V(this,cr).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(Zi).catch(Zi)}invalidateQueries(e,t={}){return Lr.batch(()=>(V(this,cr).findAll(e).forEach(n=>{n.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 n={...t,cancelRefetch:t.cancelRefetch??!0},r=Lr.batch(()=>V(this,cr).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);const o=i.state.fetchStatus==="paused";return(!n.throwOnError||o)&&(s=s.catch(Zi)),o?Promise.resolve():s}));return Promise.all(r).then(Zi)}async query(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=V(this,cr).build(this,t),r=n.isStaleByTime(nr(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=V(this,cr).build(this,t);return n.isStaleByTime(nr(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Zi).catch(Zi)}infiniteQuery(e){return e._type="infinite",this.query(e)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Zi).catch(Zi)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Ix.isOnline()?V(this,ic).resumePausedMutations():Promise.resolve()}getQueryCache(){return V(this,cr)}getMutationCache(){return V(this,ic)}getDefaultOptions(){return V(this,sc)}setDefaultOptions(e){we(this,sc,e)}setQueryDefaults(e,t){V(this,Bh).set(cd(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...V(this,Bh).values()],n={};return t.forEach(r=>{hf(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){V(this,Hh).set(cd(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...V(this,Hh).values()],n={};return t.forEach(r=>{hf(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...V(this,sc).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=oN(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===aN&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...V(this,sc).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){V(this,cr).clear(),V(this,ic).clear()}},cr=new WeakMap,ic=new WeakMap,sc=new WeakMap,Bh=new WeakMap,Hh=new WeakMap,oc=new WeakMap,Vh=new WeakMap,Wh=new WeakMap,f4);const P4=m.createContext(!1),TY=()=>m.useContext(P4);P4.Provider;function AY(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}const DY=m.createContext(AY()),LY=()=>m.useContext(DY),FY=(e,t,n)=>{const r=(n==null?void 0:n.state.status)==="error"&&typeof e.throwOnError=="function"?lN(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},BY=e=>{m.useEffect(()=>{e.clearReset()},[e])},HY=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||lN(n,[e.error,r])),VY=e=>{if(e.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},WY=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,qY=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function T4(e,t,n){const r=TY(),i=LY(),s=Fn(),o=s.defaultQueryOptions(e),a=s.getQueryCache().get(o.queryHash),l=e.subscribed!==!1;o._optimisticResults=r?"isRestoring":l?"optimistic":void 0,VY(o),FY(o,i,a),BY(i);const[c]=m.useState(()=>new t(s,o)),u=c.getOptimisticResult(o);m.useEffect(()=>{c.setOptions(o)},[o,c]);const h=!r&&l;if(m.useSyncExternalStore(m.useCallback(f=>{const p=h?c.subscribe(Lr.batchCalls(f)):Zi;return c.updateResult(),p},[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),WY(o,u))throw qY(o,c,i);if(HY({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:c.trackResult(u)}function It(e,t){return T4(e,R4)}function bt(e,t){const n=Fn(),[r]=m.useState(()=>new RY(n,e));m.useEffect(()=>{r.setOptions(e)},[r,e]);const i=m.useSyncExternalStore(m.useCallback(o=>r.subscribe(Lr.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=m.useCallback((...o)=>{r.mutate(o[0],o[1]).catch(Zi)},[r]);if(i.error&&lN(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}function UY(e,t){return T4(e,MY)}const KY="modulepreload",GY=function(e){return"/"+e},JM={},A4=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=o(n.map(c=>{if(c=GY(c),c in JM)return;JM[c]=!0;const u=c.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${h}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":KY,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((p,g)=>{f.addEventListener("load",p),f.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return t().catch(s)})};function fN({open:e,children:t,ms:n=180}){const r=m.useRef(t),[i,s]=m.useState(e);return e&&(r.current=t),m.useEffect(()=>{if(e){s(!0);return}const o=window.setTimeout(()=>s(!1),n);return()=>window.clearTimeout(o)},[e,n]),!e&&!i?null:d.jsx("div",{style:{display:"contents"},...e?{}:{"data-closing":""},children:e?t:r.current})}let Gl=null;const $x=new Set,YY=e=>($x.add(e),()=>{$x.delete(e)}),eI=()=>Gl;function _r(e,t){if(!((Gl==null?void 0:Gl.kind)===e&&Gl.sessionId===(t==null?void 0:t.sessionId))){Gl={kind:e,...t!=null&&t.sessionId?{sessionId:t.sessionId}:{}};for(const n of $x)n()}}function Ei(){if(Gl!==null){Gl=null;for(const e of $x)e()}}function ZY(){return m.useSyncExternalStore(YY,eI,eI)}function XY({dialogs:e}){const t=ZY();return d.jsx(d.Fragment,{children:Object.keys(e).map(n=>{const r=(t==null?void 0:t.kind)===n,i=e[n],s=r?typeof i=="function"?i(t.sessionId):i:null;return d.jsx(fN,{open:r,children:s},n)})})}const QY=e=>(t,n)=>{const r=m.useRef(!1);e(()=>()=>{r.current=!1},[]),e(()=>{if(!r.current)r.current=!0;else return t()},n)},mu=e=>typeof e=="function",pN=e=>typeof e=="number"&&!Number.isNaN(e),JY=e=>typeof e>"u",eZ=e=>e!=null,tZ=e=>eZ(e)&&mu(e.then),Cn=e=>{const t=m.useRef(e);t.current=m.useMemo(()=>e,[e]);const n=m.useRef(void 0);return n.current||(n.current=function(...r){return t.current.apply(this,r)}),n.current},Wu=QY(m.useEffect);function tI(e,t){if(e===t)return!0;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function Xg(e){const t=m.useRef(e);return t.current=e,t}const Qg=e=>{const t=Xg(e);m.useEffect(()=>()=>{t.current()},[])};var _1,nI;function mN(){if(nI)return _1;nI=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return _1=e,_1}var C1,rI;function nZ(){if(rI)return C1;rI=1;var e=typeof F0=="object"&&F0&&F0.Object===Object&&F0;return C1=e,C1}var k1,iI;function D4(){if(iI)return k1;iI=1;var e=nZ(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return k1=n,k1}var N1,sI;function rZ(){if(sI)return N1;sI=1;var e=D4(),t=function(){return e.Date.now()};return N1=t,N1}var E1,oI;function iZ(){if(oI)return E1;oI=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return E1=t,E1}var j1,aI;function sZ(){if(aI)return j1;aI=1;var e=iZ(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return j1=n,j1}var z1,lI;function L4(){if(lI)return z1;lI=1;var e=D4(),t=e.Symbol;return z1=t,z1}var M1,cI;function oZ(){if(cI)return M1;cI=1;var e=L4(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function s(o){var a=n.call(o,i),l=o[i];try{o[i]=void 0;var c=!0}catch{}var u=r.call(o);return c&&(a?o[i]=l:delete o[i]),u}return M1=s,M1}var I1,uI;function aZ(){if(uI)return I1;uI=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return I1=n,I1}var $1,dI;function lZ(){if(dI)return $1;dI=1;var e=L4(),t=oZ(),n=aZ(),r="[object Null]",i="[object Undefined]",s=e?e.toStringTag:void 0;function o(a){return a==null?a===void 0?i:r:s&&s in Object(a)?t(a):n(a)}return $1=o,$1}var R1,hI;function cZ(){if(hI)return R1;hI=1;function e(t){return t!=null&&typeof t=="object"}return R1=e,R1}var O1,fI;function uZ(){if(fI)return O1;fI=1;var e=lZ(),t=cZ(),n="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&e(i)==n}return O1=r,O1}var P1,pI;function dZ(){if(pI)return P1;pI=1;var e=sZ(),t=mN(),n=uZ(),r=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt;function l(c){if(typeof c=="number")return c;if(n(c))return r;if(t(c)){var u=typeof c.valueOf=="function"?c.valueOf():c;c=t(u)?u+"":u}if(typeof c!="string")return c===0?c:+c;c=e(c);var h=s.test(c);return h||o.test(c)?a(c.slice(2),h?2:8):i.test(c)?r:+c}return P1=l,P1}var T1,mI;function F4(){if(mI)return T1;mI=1;var e=mN(),t=rZ(),n=dZ(),r="Expected a function",i=Math.max,s=Math.min;function o(a,l,c){var u,h,f,p,g,v,x=0,b=!1,y=!1,w=!0;if(typeof a!="function")throw new TypeError(r);l=n(l)||0,e(c)&&(b=!!c.leading,y="maxWait"in c,f=y?i(n(c.maxWait)||0,l):f,w="trailing"in c?!!c.trailing:w);function S(P){var E=u,M=h;return u=h=void 0,x=P,p=a.apply(M,E),p}function C(P){return x=P,g=setTimeout(z,l),b?S(P):p}function _(P){var E=P-v,M=P-x,T=l-E;return y?s(T,f-M):T}function k(P){var E=P-v,M=P-x;return v===void 0||E>=l||E<0||y&&M>=f}function z(){var P=t();if(k(P))return j(P);g=setTimeout(z,_(P))}function j(P){return g=void 0,w&&u?S(P):(u=h=void 0,p)}function N(){g!==void 0&&clearTimeout(g),x=0,u=v=h=g=void 0}function $(){return g===void 0?p:j(t())}function R(){var P=t(),E=k(P);if(u=arguments,h=this,v=P,E){if(g===void 0)return C(v);if(y)return clearTimeout(g),g=setTimeout(z,l),S(v)}return g===void 0&&(g=setTimeout(z,l)),p}return R.cancel=N,R.flush=$,R}return T1=o,T1}var hZ=F4();const fZ=ns(hZ),B4=!!(typeof window<"u"&&window.document&&window.document.createElement);var A1,gI;function pZ(){if(gI)return A1;gI=1;var e=F4(),t=mN(),n="Expected a function";function r(i,s,o){var a=!0,l=!0;if(typeof i!="function")throw new TypeError(n);return t(o)&&(a="leading"in o?!!o.leading:a,l="trailing"in o?!!o.trailing:l),e(i,s,{leading:a,maxWait:s,trailing:l})}return A1=r,A1}var mZ=pZ();const gZ=ns(mZ),Xb=e=>{m.useEffect(()=>{const t=e==null?void 0:e();if(!tZ(t))return t},[])};function H4(e,t){if(!B4)return;if(!e)return t;let n;return mu(e)?n=e():"current"in e?n=e.current:n=e,n}const vZ=e=>(n,r,i)=>{const s=m.useRef(!1),o=m.useRef([]),a=m.useRef([]),l=m.useRef(void 0);e(()=>{var c;const h=(Array.isArray(i)?i:[i]).map(f=>H4(f));if(!s.current){s.current=!0,o.current=h,a.current=r,l.current=n();return}(h.length!==o.current.length||!tI(o.current,h)||!tI(a.current,r))&&((c=l.current)===null||c===void 0||c.call(l),o.current=h,a.current=r,l.current=n())}),Qg(()=>{var c;(c=l.current)===null||c===void 0||c.call(l),s.current=!1})},xZ=vZ(m.useEffect);var Hv={exports:{}},bZ=Hv.exports,vI;function V4(){return vI||(vI=1,(function(e,t){(function(n,r){e.exports=r()})(bZ,(function(){var n=1e3,r=6e4,i=36e5,s="millisecond",o="second",a="minute",l="hour",c="day",u="week",h="month",f="quarter",p="year",g="date",v="Invalid Date",x=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(E){var M=["th","st","nd","rd"],T=E%100;return"["+E+(M[(T-20)%10]||M[T]||M[0])+"]"}},w=function(E,M,T){var D=String(E);return!D||D.length>=M?E:""+Array(M+1-D.length).join(T)+E},S={s:w,z:function(E){var M=-E.utcOffset(),T=Math.abs(M),D=Math.floor(T/60),A=T%60;return(M<=0?"+":"-")+w(D,2,"0")+":"+w(A,2,"0")},m:function E(M,T){if(M.date()<T.date())return-E(T,M);var D=12*(T.year()-M.year())+(T.month()-M.month()),A=M.clone().add(D,h),H=T-A<0,I=M.clone().add(D+(H?-1:1),h);return+(-(D+(T-A)/(H?A-I:I-A))||0)},a:function(E){return E<0?Math.ceil(E)||0:Math.floor(E)},p:function(E){return{M:h,y:p,w:u,d:c,D:g,h:l,m:a,s:o,ms:s,Q:f}[E]||String(E||"").toLowerCase().replace(/s$/,"")},u:function(E){return E===void 0}},C="en",_={};_[C]=y;var k="$isDayjsObject",z=function(E){return E instanceof R||!(!E||!E[k])},j=function E(M,T,D){var A;if(!M)return C;if(typeof M=="string"){var H=M.toLowerCase();_[H]&&(A=H),T&&(_[H]=T,A=H);var I=M.split("-");if(!A&&I.length>1)return E(I[0])}else{var B=M.name;_[B]=M,A=B}return!D&&A&&(C=A),A||!D&&C},N=function(E,M){if(z(E))return E.clone();var T=typeof M=="object"?M:{};return T.date=E,T.args=arguments,new R(T)},$=S;$.l=j,$.i=z,$.w=function(E,M){return N(E,{locale:M.$L,utc:M.$u,x:M.$x,$offset:M.$offset})};var R=(function(){function E(T){this.$L=j(T.locale,null,!0),this.parse(T),this.$x=this.$x||T.x||{},this[k]=!0}var M=E.prototype;return M.parse=function(T){this.$d=(function(D){var A=D.date,H=D.utc;if(A===null)return new Date(NaN);if($.u(A))return new Date;if(A instanceof Date)return new Date(A);if(typeof A=="string"&&!/Z$/i.test(A)){var I=A.match(x);if(I){var B=I[2]-1||0,L=(I[7]||"0").substring(0,3);return H?new Date(Date.UTC(I[1],B,I[3]||1,I[4]||0,I[5]||0,I[6]||0,L)):new Date(I[1],B,I[3]||1,I[4]||0,I[5]||0,I[6]||0,L)}}return new Date(A)})(T),this.init()},M.init=function(){var T=this.$d;this.$y=T.getFullYear(),this.$M=T.getMonth(),this.$D=T.getDate(),this.$W=T.getDay(),this.$H=T.getHours(),this.$m=T.getMinutes(),this.$s=T.getSeconds(),this.$ms=T.getMilliseconds()},M.$utils=function(){return $},M.isValid=function(){return this.$d.toString()!==v},M.isSame=function(T,D){var A=N(T);return this.startOf(D)<=A&&A<=this.endOf(D)},M.isAfter=function(T,D){return N(T)<this.startOf(D)},M.isBefore=function(T,D){return this.endOf(D)<N(T)},M.$g=function(T,D,A){return $.u(T)?this[D]:this.set(A,T)},M.unix=function(){return Math.floor(this.valueOf()/1e3)},M.valueOf=function(){return this.$d.getTime()},M.startOf=function(T,D){var A=this,H=!!$.u(D)||D,I=$.p(T),B=function(ae,ne){var ie=$.w(A.$u?Date.UTC(A.$y,ne,ae):new Date(A.$y,ne,ae),A);return H?ie:ie.endOf(c)},L=function(ae,ne){return $.w(A.toDate()[ae].apply(A.toDate("s"),(H?[0,0,0,0]:[23,59,59,999]).slice(ne)),A)},O=this.$W,W=this.$M,F=this.$D,U="set"+(this.$u?"UTC":"");switch(I){case p:return H?B(1,0):B(31,11);case h:return H?B(1,W):B(0,W+1);case u:var X=this.$locale().weekStart||0,Q=(O<X?O+7:O)-X;return B(H?F-Q:F+(6-Q),W);case c:case g:return L(U+"Hours",0);case l:return L(U+"Minutes",1);case a:return L(U+"Seconds",2);case o:return L(U+"Milliseconds",3);default:return this.clone()}},M.endOf=function(T){return this.startOf(T,!1)},M.$set=function(T,D){var A,H=$.p(T),I="set"+(this.$u?"UTC":""),B=(A={},A[c]=I+"Date",A[g]=I+"Date",A[h]=I+"Month",A[p]=I+"FullYear",A[l]=I+"Hours",A[a]=I+"Minutes",A[o]=I+"Seconds",A[s]=I+"Milliseconds",A)[H],L=H===c?this.$D+(D-this.$W):D;if(H===h||H===p){var O=this.clone().set(g,1);O.$d[B](L),O.init(),this.$d=O.set(g,Math.min(this.$D,O.daysInMonth())).$d}else B&&this.$d[B](L);return this.init(),this},M.set=function(T,D){return this.clone().$set(T,D)},M.get=function(T){return this[$.p(T)]()},M.add=function(T,D){var A,H=this;T=Number(T);var I=$.p(D),B=function(W){var F=N(H);return $.w(F.date(F.date()+Math.round(W*T)),H)};if(I===h)return this.set(h,this.$M+T);if(I===p)return this.set(p,this.$y+T);if(I===c)return B(1);if(I===u)return B(7);var L=(A={},A[a]=r,A[l]=i,A[o]=n,A)[I]||1,O=this.$d.getTime()+T*L;return $.w(O,this)},M.subtract=function(T,D){return this.add(-1*T,D)},M.format=function(T){var D=this,A=this.$locale();if(!this.isValid())return A.invalidDate||v;var H=T||"YYYY-MM-DDTHH:mm:ssZ",I=$.z(this),B=this.$H,L=this.$m,O=this.$M,W=A.weekdays,F=A.months,U=A.meridiem,X=function(ne,ie,oe,G){return ne&&(ne[ie]||ne(D,H))||oe[ie].slice(0,G)},Q=function(ne){return $.s(B%12||12,ne,"0")},ae=U||function(ne,ie,oe){var G=ne<12?"AM":"PM";return oe?G.toLowerCase():G};return H.replace(b,(function(ne,ie){return ie||(function(oe){switch(oe){case"YY":return String(D.$y).slice(-2);case"YYYY":return $.s(D.$y,4,"0");case"M":return O+1;case"MM":return $.s(O+1,2,"0");case"MMM":return X(A.monthsShort,O,F,3);case"MMMM":return X(F,O);case"D":return D.$D;case"DD":return $.s(D.$D,2,"0");case"d":return String(D.$W);case"dd":return X(A.weekdaysMin,D.$W,W,2);case"ddd":return X(A.weekdaysShort,D.$W,W,3);case"dddd":return W[D.$W];case"H":return String(B);case"HH":return $.s(B,2,"0");case"h":return Q(1);case"hh":return Q(2);case"a":return ae(B,L,!0);case"A":return ae(B,L,!1);case"m":return String(L);case"mm":return $.s(L,2,"0");case"s":return String(D.$s);case"ss":return $.s(D.$s,2,"0");case"SSS":return $.s(D.$ms,3,"0");case"Z":return I}return null})(ne)||I.replace(":","")}))},M.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},M.diff=function(T,D,A){var H,I=this,B=$.p(D),L=N(T),O=(L.utcOffset()-this.utcOffset())*r,W=this-L,F=function(){return $.m(I,L)};switch(B){case p:H=F()/12;break;case h:H=F();break;case f:H=F()/3;break;case u:H=(W-O)/6048e5;break;case c:H=(W-O)/864e5;break;case l:H=W/i;break;case a:H=W/r;break;case o:H=W/n;break;default:H=W}return A?H:$.a(H)},M.daysInMonth=function(){return this.endOf(h).$D},M.$locale=function(){return _[this.$L]},M.locale=function(T,D){if(!T)return this.$L;var A=this.clone(),H=j(T,D,!0);return H&&(A.$L=H),A},M.clone=function(){return $.w(this.$d,this)},M.toDate=function(){return new Date(this.valueOf())},M.toJSON=function(){return this.isValid()?this.toISOString():null},M.toISOString=function(){return this.$d.toISOString()},M.toString=function(){return this.$d.toUTCString()},E})(),P=R.prototype;return N.prototype=P,[["$ms",s],["$s",o],["$m",a],["$H",l],["$W",c],["$M",h],["$y",p],["$D",g]].forEach((function(E){P[E[1]]=function(M){return this.$g(M,E[0],E[1])}})),N.extend=function(E,M){return E.$i||(E(M,R,N),E.$i=!0),N},N.locale=j,N.isDayjs=z,N.unix=function(E){return N(1e3*E)},N.en=_[C],N.Ls=_,N.p={},N}))})(Hv)),Hv.exports}var yZ=V4();const Dr=ns(yZ),D1=e=>{if(!e)return 0;const t=Dr(e).valueOf()-Date.now();return t<0?0:t},wZ=e=>({days:Math.floor(e/864e5),hours:Math.floor(e/36e5)%24,minutes:Math.floor(e/6e4)%60,seconds:Math.floor(e/1e3)%60,milliseconds:Math.floor(e)%1e3}),SZ=(e={})=>{const{leftTime:t,targetDate:n,interval:r=1e3,onEnd:i}=e||{},s=m.useMemo(()=>pN(t)&&t>0?Date.now()+t:void 0,[t]),o="leftTime"in e?s:n,[a,l]=m.useState(()=>D1(o)),c=Xg(i);m.useEffect(()=>{if(!o){l(0);return}l(D1(o));const h=setInterval(()=>{var f;const p=D1(o);l(p),p===0&&(clearInterval(h),(f=c.current)===null||f===void 0||f.call(c))},r);return()=>clearInterval(h)},[o,r]);const u=m.useMemo(()=>wZ(a),[a]);return[a,u]};function _Z(){const e=(typeof global>"u"?"undefined":typeof global)=="object"&&global&&global.Object===Object&&global,t=typeof self=="object"&&self&&self.Object===Object&&self;return e||t}_Z()||(global.Date=Date);function CZ(e,t){var n;const r=Xg(e),i=(n=t==null?void 0:t.wait)!==null&&n!==void 0?n:1e3,s=m.useMemo(()=>fZ((...o)=>r.current(...o),i,t),[]);return Qg(()=>{s.cancel()}),{run:s,cancel:s.cancel,flush:s.flush}}function kZ(e,t){const[n,r]=m.useState(e),{run:i}=CZ(()=>{r(e)},t);return m.useEffect(()=>{i()},[e]),n}function kr(e,t,n={}){const{enable:r=!0}=n,i=Xg(t);xZ(()=>{if(!r)return;const s=H4(n.target,window);if(!(s!=null&&s.addEventListener))return;const o=l=>i.current(l),a=Array.isArray(e)?e:[e];return a.forEach(l=>{s.addEventListener(l,o,{capture:n.capture,once:n.once,passive:n.passive})}),()=>{a.forEach(l=>{s.removeEventListener(l,o,{capture:n.capture})})}},[e,n.capture,n.once,n.passive,r],n.target)}var W4=(function(){if(typeof Map<"u")return Map;function e(t,n){var r=-1;return t.some(function(i,s){return i[0]===n?(r=s,!0):!1}),r}return(function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(n){var r=e(this.__entries__,n),i=this.__entries__[r];return i&&i[1]},t.prototype.set=function(n,r){var i=e(this.__entries__,n);~i?this.__entries__[i][1]=r:this.__entries__.push([n,r])},t.prototype.delete=function(n){var r=this.__entries__,i=e(r,n);~i&&r.splice(i,1)},t.prototype.has=function(n){return!!~e(this.__entries__,n)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var i=0,s=this.__entries__;i<s.length;i++){var o=s[i];n.call(r,o[1],o[0])}},t})()})(),E_=typeof window<"u"&&typeof document<"u"&&window.document===document,Rx=(function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()})(),NZ=(function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Rx):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}})(),EZ=2;function jZ(e,t){var n=!1,r=!1,i=0;function s(){n&&(n=!1,e()),r&&a()}function o(){NZ(s)}function a(){var l=Date.now();if(n){if(l-i<EZ)return;r=!0}else n=!0,r=!1,setTimeout(o,t);i=l}return a}var zZ=20,MZ=["top","right","bottom","left","width","height","size","weight"],IZ=typeof MutationObserver<"u",$Z=(function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=jZ(this.refresh.bind(this),zZ)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var n=this.observers_,r=n.indexOf(t);~r&&n.splice(r,1),!n.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return t.forEach(function(n){return n.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!E_||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),IZ?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!E_||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var n=t.propertyName,r=n===void 0?"":n,i=MZ.some(function(s){return!!~r.indexOf(s)});i&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e})(),q4=(function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];Object.defineProperty(e,i,{value:t[i],enumerable:!1,writable:!1,configurable:!0})}return e}),ff=(function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||Rx}),U4=Qb(0,0,0,0);function Ox(e){return parseFloat(e)||0}function xI(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(r,i){var s=e["border-"+i+"-width"];return r+Ox(s)},0)}function RZ(e){for(var t=["top","right","bottom","left"],n={},r=0,i=t;r<i.length;r++){var s=i[r],o=e["padding-"+s];n[s]=Ox(o)}return n}function OZ(e){var t=e.getBBox();return Qb(0,0,t.width,t.height)}function PZ(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return U4;var r=ff(e).getComputedStyle(e),i=RZ(r),s=i.left+i.right,o=i.top+i.bottom,a=Ox(r.width),l=Ox(r.height);if(r.boxSizing==="border-box"&&(Math.round(a+s)!==t&&(a-=xI(r,"left","right")+s),Math.round(l+o)!==n&&(l-=xI(r,"top","bottom")+o)),!AZ(e)){var c=Math.round(a+s)-t,u=Math.round(l+o)-n;Math.abs(c)!==1&&(a-=c),Math.abs(u)!==1&&(l-=u)}return Qb(i.left,i.top,a,l)}var TZ=(function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof ff(e).SVGGraphicsElement}:function(e){return e instanceof ff(e).SVGElement&&typeof e.getBBox=="function"}})();function AZ(e){return e===ff(e).document.documentElement}function DZ(e){return E_?TZ(e)?OZ(e):PZ(e):U4}function LZ(e){var t=e.x,n=e.y,r=e.width,i=e.height,s=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,o=Object.create(s.prototype);return q4(o,{x:t,y:n,width:r,height:i,top:n,right:t+r,bottom:i+n,left:t}),o}function Qb(e,t,n,r){return{x:e,y:t,width:n,height:r}}var FZ=(function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Qb(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=DZ(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},e})(),BZ=(function(){function e(t,n){var r=LZ(n);q4(this,{target:t,contentRect:r})}return e})(),HZ=(function(){function e(t,n,r){if(this.activeObservations_=[],this.observations_=new W4,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=n,this.callbackCtx_=r}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof ff(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new FZ(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof ff(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)&&(n.delete(t),n.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&t.activeObservations_.push(n)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new BZ(r.target,r.broadcastRect())});this.callback_.call(t,n,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e})(),K4=typeof WeakMap<"u"?new WeakMap:new W4,G4=(function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=$Z.getInstance(),r=new HZ(t,n,this);K4.set(this,r)}return e})();["observe","unobserve","disconnect"].forEach(function(e){G4.prototype[e]=function(){var t;return(t=K4.get(this))[e].apply(t,arguments)}});var VZ=(function(){return typeof Rx.ResizeObserver<"u"?Rx.ResizeObserver:G4})();const gN=(e,t,n={})=>{const r=Cn(e),i=m.useRef(null),s=m.useCallback(()=>{i.current&&clearInterval(i.current)},[]);return m.useEffect(()=>{if(!(!pN(t)||t<0))return n.immediate&&r(),i.current=setInterval(r,t),s},[t,n.immediate]),s},bI="AHOOKS_SYNC_STORAGE_EVENT_NAME",WZ=e=>(n,r={})=>{let i;const{listenStorageChange:s=!1,getInitialValueInEffect:o=!1}=r,a=mu(r.serializer)?r.serializer:JSON.stringify,l=mu(r.deserializer)?r.deserializer:JSON.parse,c=mu(r.onError)?r.onError:console.error;try{i=e()}catch(y){c(y)}const u=()=>{try{const y=i==null?void 0:i.getItem(n);if(y)return l(y)}catch(y){c(y)}return h()};function h(){return mu(r.defaultValue)?r.defaultValue():r.defaultValue}const[f,p]=m.useState(()=>o?h():u());Xb(()=>{o&&p(u())});const g=m.useRef(f);g.current=f,Wu(()=>{const y=u();Object.is(y,g.current)||(g.current=y,p(y))},[n]);const v=y=>{const w=g.current,S=mu(y)?y(w):y;if(!Object.is(S,w)){s||(g.current=S,p(S));try{let C;const _=i==null?void 0:i.getItem(n);JY(S)?(C=null,i==null||i.removeItem(n)):(C=a(S),i==null||i.setItem(n,C)),dispatchEvent(new CustomEvent(bI,{detail:{key:n,newValue:C,oldValue:_,storageArea:i}}))}catch(C){c(C)}}},x=y=>{if(y.key!==n||y.storageArea!==i)return;const w=u();Object.is(w,g.current)||(g.current=w,p(w))},b=y=>{x(y.detail)};return kr("storage",x,{enable:s}),kr(bI,b,{enable:s}),[f,Cn(v)]},hh=WZ(()=>B4?localStorage:void 0);function qZ(e,t){var n;const r=Xg(e),i=(n=t==null?void 0:t.wait)!==null&&n!==void 0?n:1e3,s=m.useMemo(()=>gZ((...o)=>r.current(...o),i,t),[]);return Qg(()=>{s.cancel()}),{run:s,cancel:s.cancel,flush:s.flush}}function UZ(e,t){const[n,r]=m.useState(e),{run:i}=qZ(()=>{r(e)},t);return m.useEffect(()=>{i()},[e]),n}const KZ=(e,t)=>{const n=Cn(e),r=m.useRef(null),i=m.useCallback(()=>{r.current&&clearTimeout(r.current)},[]);return m.useEffect(()=>{if(!(!pN(t)||t<0))return r.current=setTimeout(n,t),i},[t]),i};/**
|
|
3
3
|
* @license lucide-react v1.72.0 - ISC
|
|
4
4
|
*
|
|
@@ -858,7 +858,7 @@ html body {
|
|
|
858
858
|
`,Dde=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break","white-space"],xw={},Ss;function Lde(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=e.getAttribute("id")||e.getAttribute("data-reactid")||e.getAttribute("name");if(t&&xw[n])return xw[n];var r=window.getComputedStyle(e),i=r.getPropertyValue("box-sizing")||r.getPropertyValue("-moz-box-sizing")||r.getPropertyValue("-webkit-box-sizing"),s=parseFloat(r.getPropertyValue("padding-bottom"))+parseFloat(r.getPropertyValue("padding-top")),o=parseFloat(r.getPropertyValue("border-bottom-width"))+parseFloat(r.getPropertyValue("border-top-width")),a=Dde.map(function(c){return"".concat(c,":").concat(r.getPropertyValue(c))}).join(";"),l={sizingStyle:a,paddingSize:s,borderSize:o,boxSizing:i};return t&&n&&(xw[n]=l),l}function Fde(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;Ss||(Ss=document.createElement("textarea"),Ss.setAttribute("tab-index","-1"),Ss.setAttribute("aria-hidden","true"),Ss.setAttribute("name","hiddenTextarea"),document.body.appendChild(Ss)),e.getAttribute("wrap")?Ss.setAttribute("wrap",e.getAttribute("wrap")):Ss.removeAttribute("wrap");var i=Lde(e,t),s=i.paddingSize,o=i.borderSize,a=i.boxSizing,l=i.sizingStyle;Ss.setAttribute("style","".concat(l,";").concat(Ade)),Ss.value=e.value||e.placeholder||"";var c=void 0,u=void 0,h,f=Ss.scrollHeight;if(a==="border-box"?f+=o:a==="content-box"&&(f-=s),n!==null||r!==null){Ss.value=" ";var p=Ss.scrollHeight-s;n!==null&&(c=p*n,a==="border-box"&&(c=c+s+o),f=Math.max(c,f)),r!==null&&(u=p*r,a==="border-box"&&(u=u+s+o),h=f>u?"":"hidden",f=Math.min(u,f))}var g={height:f,overflowY:h,resize:"none"};return c&&(g.minHeight=c),u&&(g.maxHeight=u),g}var Bde=["prefixCls","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],bw=0,yw=1,ww=2,Hde=m.forwardRef(function(e,t){var n=e,r=n.prefixCls,i=n.defaultValue,s=n.value,o=n.autoSize,a=n.onResize,l=n.className,c=n.style,u=n.disabled,h=n.onChange;n.onInternalAutoSize;var f=nn(n,Bde),p=Er(i,{value:s,postState:function(O){return O??""}}),g=J(p,2),v=g[0],x=g[1],b=function(O){x(O.target.value),h==null||h(O)},y=m.useRef();m.useImperativeHandle(t,function(){return{textArea:y.current}});var w=m.useMemo(function(){return o&&jt(o)==="object"?[o.minRows,o.maxRows]:[]},[o]),S=J(w,2),C=S[0],_=S[1],k=!!o,z=m.useState(ww),j=J(z,2),N=j[0],$=j[1],R=m.useState(),P=J(R,2),E=P[0],M=P[1],T=function(){$(bw)};Sn(function(){k&&T()},[s,C,_,k]),Sn(function(){if(N===bw)$(yw);else if(N===yw){var L=Fde(y.current,!1,C,_);$(ww),M(L)}},[N]);var D=m.useRef(),A=function(){xn.cancel(D.current)},H=function(O){N===ww&&(a==null||a(O),o&&(A(),D.current=xn(function(){T()})))};m.useEffect(function(){return A},[]);var I=k?E:null,B=Z(Z({},c),I);return(N===bw||N===yw)&&(B.overflowY="hidden",B.overflowX="hidden"),m.createElement(ka,{onResize:H,disabled:!(o||a)},m.createElement("textarea",rt({},f,{ref:y,style:B,className:Me(r,l,K({},"".concat(r,"-disabled"),u)),disabled:u,value:v,onChange:b})))}),Vde=["defaultValue","value","onFocus","onBlur","onChange","allowClear","maxLength","onCompositionStart","onCompositionEnd","suffix","prefixCls","showCount","count","className","style","disabled","hidden","classNames","styles","onResize","onClear","onPressEnter","readOnly","autoSize","onKeyDown"],Wde=ze.forwardRef(function(e,t){var n,r=e.defaultValue,i=e.value,s=e.onFocus,o=e.onBlur,a=e.onChange,l=e.allowClear,c=e.maxLength,u=e.onCompositionStart,h=e.onCompositionEnd,f=e.suffix,p=e.prefixCls,g=p===void 0?"rc-textarea":p,v=e.showCount,x=e.count,b=e.className,y=e.style,w=e.disabled,S=e.hidden,C=e.classNames,_=e.styles,k=e.onResize,z=e.onClear,j=e.onPressEnter,N=e.readOnly,$=e.autoSize,R=e.onKeyDown,P=nn(e,Vde),E=Er(r,{value:i,defaultValue:r}),M=J(E,2),T=M[0],D=M[1],A=T==null?"":String(T),H=ze.useState(!1),I=J(H,2),B=I[0],L=I[1],O=ze.useRef(!1),W=ze.useState(null),F=J(W,2),U=F[0],X=F[1],Q=m.useRef(null),ae=m.useRef(null),ne=function(){var he;return(he=ae.current)===null||he===void 0?void 0:he.textArea},ie=function(){ne().focus()};m.useImperativeHandle(t,function(){var Oe;return{resizableTextArea:ae.current,focus:ie,blur:function(){ne().blur()},nativeElement:((Oe=Q.current)===null||Oe===void 0?void 0:Oe.nativeElement)||ne()}}),m.useEffect(function(){L(function(Oe){return!w&&Oe})},[w]);var oe=ze.useState(null),G=J(oe,2),le=G[0],me=G[1];ze.useEffect(function(){if(le){var Oe;(Oe=ne()).setSelectionRange.apply(Oe,it(le))}},[le]);var Y=y8(x,v),ge=(n=Y.max)!==null&&n!==void 0?n:c,ye=Number(ge)>0,re=Y.strategy(A),Ee=!!ge&&re>ge,Ie=function(he,_e){var je=_e;!O.current&&Y.exceedFormatter&&Y.max&&Y.strategy(_e)>Y.max&&(je=Y.exceedFormatter(_e,{max:Y.max}),_e!==je&&me([ne().selectionStart||0,ne().selectionEnd||0])),D(je),Qx(he.currentTarget,he,a,je)},Pe=function(he){O.current=!0,u==null||u(he)},$e=function(he){O.current=!1,Ie(he,he.currentTarget.value),h==null||h(he)},pe=function(he){Ie(he,he.target.value)},De=function(he){he.key==="Enter"&&j&&j(he),R==null||R(he)},ee=function(he){L(!0),s==null||s(he)},fe=function(he){L(!1),o==null||o(he)},Se=function(he){D(""),ie(),Qx(ne(),he,a)},Te=f,ve;Y.show&&(Y.showFormatter?ve=Y.showFormatter({value:A,count:re,maxLength:ge}):ve="".concat(re).concat(ye?" / ".concat(ge):""),Te=ze.createElement(ze.Fragment,null,Te,ze.createElement("span",{className:Me("".concat(g,"-data-count"),C==null?void 0:C.count),style:_==null?void 0:_.count},ve)));var Ue=function(he){var _e;k==null||k(he),(_e=ne())!==null&&_e!==void 0&&_e.style.height&&X(!0)},ce=!$&&!v&&!l;return ze.createElement(yE,{ref:Q,value:A,allowClear:l,handleReset:Se,suffix:Te,prefixCls:g,classNames:Z(Z({},C),{},{affixWrapper:Me(C==null?void 0:C.affixWrapper,K(K({},"".concat(g,"-show-count"),v),"".concat(g,"-textarea-allow-clear"),l))}),disabled:w,focused:B,className:Me(b,Ee&&"".concat(g,"-out-of-range")),style:Z(Z({},y),U&&!ce?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":typeof ve=="string"?ve:void 0}},hidden:S,readOnly:N,onClear:z},ze.createElement(Hde,rt({},P,{autoSize:$,maxLength:c,onKeyDown:De,onChange:pe,onFocus:ee,onBlur:fe,onCompositionStart:Pe,onCompositionEnd:$e,className:Me(C==null?void 0:C.textarea),style:Z(Z({},_==null?void 0:_.textarea),{},{resize:y==null?void 0:y.resize}),disabled:w,prefixCls:g,onResize:Ue,ref:ae,readOnly:N})))});const qde=e=>{const{componentCls:t,paddingLG:n}=e,r=`${t}-textarea`;return{[`textarea${t}`]:{maxWidth:"100%",height:"auto",minHeight:e.controlHeight,lineHeight:e.lineHeight,verticalAlign:"bottom",transition:`all ${e.motionDurationSlow}`,resize:"vertical",[`&${t}-mouse-active`]:{transition:`all ${e.motionDurationSlow}, height 0s, width 0s`}},[`${t}-textarea-affix-wrapper-resize-dirty`]:{width:"auto"},[r]:{position:"relative","&-show-count":{[`${t}-data-count`]:{position:"absolute",bottom:e.calc(e.fontSize).mul(e.lineHeight).mul(-1).equal(),insetInlineEnd:0,color:e.colorTextDescription,whiteSpace:"nowrap",pointerEvents:"none"}},[`
|
|
859
859
|
&-allow-clear > ${t},
|
|
860
860
|
&-affix-wrapper${r}-has-feedback ${t}
|
|
861
|
-
`]:{paddingInlineEnd:n},[`&-affix-wrapper${t}-affix-wrapper`]:{padding:0,[`> textarea${t}`]:{fontSize:"inherit",border:"none",outline:"none",background:"transparent",minHeight:e.calc(e.controlHeight).sub(e.calc(e.lineWidth).mul(2)).equal(),"&:focus":{boxShadow:"none !important"}},[`${t}-suffix`]:{margin:0,"> *:not(:last-child)":{marginInline:0},[`${t}-clear-icon`]:{position:"absolute",insetInlineEnd:e.paddingInline,insetBlockStart:e.paddingXS},[`${r}-suffix`]:{position:"absolute",top:0,insetInlineEnd:e.paddingInline,bottom:0,zIndex:1,display:"inline-flex",alignItems:"center",margin:"auto",pointerEvents:"none"}}},[`&-affix-wrapper${t}-affix-wrapper-rtl`]:{[`${t}-suffix`]:{[`${t}-data-count`]:{direction:"ltr",insetInlineStart:0}}},[`&-affix-wrapper${t}-affix-wrapper-sm`]:{[`${t}-suffix`]:{[`${t}-clear-icon`]:{insetInlineEnd:e.paddingInlineSM}}}}}},Ude=li(["Input","TextArea"],e=>{const t=Dn(e,Vf(e));return qde(t)},Wf,{resetFont:!1});var Kde=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const Gde=m.forwardRef((e,t)=>{var n;const{prefixCls:r,bordered:i=!0,size:s,disabled:o,status:a,allowClear:l,classNames:c,rootClassName:u,className:h,style:f,styles:p,variant:g,showCount:v,onMouseDown:x,onResize:b}=e,y=Kde(e,["prefixCls","bordered","size","disabled","status","allowClear","classNames","rootClassName","className","style","styles","variant","showCount","onMouseDown","onResize"]),{getPrefixCls:w,direction:S,allowClear:C,autoComplete:_,className:k,style:z,classNames:j,styles:N}=Sl("textArea"),$=m.useContext(Ts),R=o??$,{status:P,hasFeedback:E,feedbackIcon:M}=m.useContext(As),T=Md(P,a),D=m.useRef(null);m.useImperativeHandle(t,()=>{var Y;return{resizableTextArea:(Y=D.current)===null||Y===void 0?void 0:Y.resizableTextArea,focus:ge=>{var ye,re;bE((re=(ye=D.current)===null||ye===void 0?void 0:ye.resizableTextArea)===null||re===void 0?void 0:re.textArea,ge)},blur:()=>{var ge;return(ge=D.current)===null||ge===void 0?void 0:ge.blur()}}});const A=w("input",r),H=Na(A),[I,B,L]=d8(A,u),[O]=Ude(A,H),{compactSize:W,compactItemClassnames:F}=Cl(A,S),U=mo(Y=>{var ge;return(ge=s??W)!==null&&ge!==void 0?ge:Y}),[X,Q]=Id("textArea",g,i),ae=S8(l??C),[ne,ie]=m.useState(!1),[oe,G]=m.useState(!1),le=Y=>{ie(!0),x==null||x(Y);const ge=()=>{ie(!1),document.removeEventListener("mouseup",ge)};document.addEventListener("mouseup",ge)},me=Y=>{var ge,ye;if(b==null||b(Y),ne&&typeof getComputedStyle=="function"){const re=(ye=(ge=D.current)===null||ge===void 0?void 0:ge.nativeElement)===null||ye===void 0?void 0:ye.querySelector("textarea");re&&getComputedStyle(re).resize==="both"&&G(!0)}};return I(O(m.createElement(Wde,Object.assign({autoComplete:_},y,{style:Object.assign(Object.assign({},z),f),styles:Object.assign(Object.assign({},N),p),disabled:R,allowClear:ae,className:Me(L,H,h,u,F,k,oe&&`${A}-textarea-affix-wrapper-resize-dirty`),classNames:Object.assign(Object.assign(Object.assign({},c),j),{textarea:Me({[`${A}-sm`]:U==="small",[`${A}-lg`]:U==="large"},B,c==null?void 0:c.textarea,j.textarea,ne&&`${A}-mouse-active`),variant:Me({[`${A}-${X}`]:Q},Mc(A,T)),affixWrapper:Me(`${A}-textarea-affix-wrapper`,{[`${A}-affix-wrapper-rtl`]:S==="rtl",[`${A}-affix-wrapper-sm`]:U==="small",[`${A}-affix-wrapper-lg`]:U==="large",[`${A}-textarea-show-count`]:v||((n=e.count)===null||n===void 0?void 0:n.show)},B)}),prefixCls:A,suffix:E&&m.createElement("span",{className:`${A}-textarea-suffix`},M),showCount:v,ref:D,onResize:me,onMouseDown:le}))))}),ir=Iy;ir.Group=yde;ir.Search=Tde;ir.TextArea=Gde;ir.Password=Ode;ir.OTP=Ede;let Js=null,_u=e=>e(),Qm=[],Jm={};function LR(){const{getContainer:e,duration:t,rtl:n,maxCount:r,top:i}=Jm,s=(e==null?void 0:e())||document.body;return{getContainer:()=>s,duration:t,rtl:n,maxCount:r,top:i}}const Yde=ze.forwardRef((e,t)=>{const{messageConfig:n,sync:r}=e,{getPrefixCls:i}=m.useContext(_n),s=Jm.prefixCls||i("message"),o=m.useContext(fse),[a,l]=z6(Object.assign(Object.assign(Object.assign({},n),{prefixCls:s}),o.message));return ze.useImperativeHandle(t,()=>{const c=Object.assign({},a);return Object.keys(c).forEach(u=>{c[u]=(...h)=>(r(),a[u].apply(a,h))}),{instance:c,sync:r}}),l}),Zde=ze.forwardRef((e,t)=>{const[n,r]=ze.useState(LR),i=()=>{r(LR)};ze.useEffect(i,[]);const s=hte(),o=s.getRootPrefixCls(),a=s.getIconPrefixCls(),l=s.getTheme(),c=ze.createElement(Yde,{ref:t,sync:i,messageConfig:n});return ze.createElement(_l,{prefixCls:o,iconPrefixCls:a,theme:l},s.holderRender?s.holderRender(c):c)}),$y=()=>{if(!Js){const e=document.createDocumentFragment(),t={fragment:e};Js=t,_u(()=>{$6()(ze.createElement(Zde,{ref:r=>{const{instance:i,sync:s}=r||{};Promise.resolve().then(()=>{!t.instance&&i&&(t.instance=i,t.sync=s,$y())})}}),e)});return}Js.instance&&(Qm.forEach(e=>{const{type:t,skipped:n}=e;if(!n)switch(t){case"open":{_u(()=>{const r=Js.instance.open(Object.assign(Object.assign({},Jm),e.config));r==null||r.then(e.resolve),e.setCloseFn(r)});break}case"destroy":_u(()=>{Js==null||Js.instance.destroy(e.key)});break;default:_u(()=>{var r;const i=(r=Js.instance)[t].apply(r,it(e.args));i==null||i.then(e.resolve),e.setCloseFn(i)})}}),Qm=[])};function Xde(e){Jm=Object.assign(Object.assign({},Jm),e),_u(()=>{var t;(t=Js==null?void 0:Js.sync)===null||t===void 0||t.call(Js)})}function Qde(e){const t=BN(n=>{let r;const i={type:"open",config:e,resolve:n,setCloseFn:s=>{r=s}};return Qm.push(i),()=>{r?_u(()=>{r()}):i.skipped=!0}});return $y(),t}function Jde(e,t){const n=BN(r=>{let i;const s={type:e,args:t,resolve:r,setCloseFn:o=>{i=o}};return Qm.push(s),()=>{i?_u(()=>{i()}):s.skipped=!0}});return $y(),n}const ehe=e=>{Qm.push({type:"destroy",key:e}),$y()},the=["success","info","warning","error","loading"],nhe={open:Qde,destroy:ehe,config:Xde,useMessage:yne,_InternalPanelDoNotUseOrYouWillBeFired:hne},M8=nhe;the.forEach(e=>{M8[e]=(...t)=>Jde(e,t)});var rhe=["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"],I8=m.forwardRef(function(e,t){var n,r=e.prefixCls,i=r===void 0?"rc-switch":r,s=e.className,o=e.checked,a=e.defaultChecked,l=e.disabled,c=e.loadingIcon,u=e.checkedChildren,h=e.unCheckedChildren,f=e.onClick,p=e.onChange,g=e.onKeyDown,v=nn(e,rhe),x=Er(!1,{value:o,defaultValue:a}),b=J(x,2),y=b[0],w=b[1];function S(z,j){var N=y;return l||(N=z,w(N),p==null||p(N,j)),N}function C(z){z.which===Gt.LEFT?S(!1,z):z.which===Gt.RIGHT&&S(!0,z),g==null||g(z)}function _(z){var j=S(!y,z);f==null||f(j,z)}var k=Me(i,s,(n={},K(n,"".concat(i,"-checked"),y),K(n,"".concat(i,"-disabled"),l),n));return m.createElement("button",rt({},v,{type:"button",role:"switch","aria-checked":y,disabled:l,className:k,ref:t,onKeyDown:C,onClick:_}),c,m.createElement("span",{className:"".concat(i,"-inner")},m.createElement("span",{className:"".concat(i,"-inner-checked")},u),m.createElement("span",{className:"".concat(i,"-inner-unchecked")},h)))});I8.displayName="Switch";const ihe=e=>{const{componentCls:t,trackHeightSM:n,trackPadding:r,trackMinWidthSM:i,innerMinMarginSM:s,innerMaxMarginSM:o,handleSizeSM:a,calc:l}=e,c=`${t}-inner`,u=Be(l(a).add(l(r).mul(2)).equal()),h=Be(l(o).mul(2).equal());return{[t]:{[`&${t}-small`]:{minWidth:i,height:n,lineHeight:Be(n),[`${t}-inner`]:{paddingInlineStart:o,paddingInlineEnd:s,[`${c}-checked, ${c}-unchecked`]:{minHeight:n},[`${c}-checked`]:{marginInlineStart:`calc(-100% + ${u} - ${h})`,marginInlineEnd:`calc(100% - ${u} + ${h})`},[`${c}-unchecked`]:{marginTop:l(n).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`${t}-handle`]:{width:a,height:a},[`${t}-loading-icon`]:{top:l(l(a).sub(e.switchLoadingIconSize)).div(2).equal(),fontSize:e.switchLoadingIconSize},[`&${t}-checked`]:{[`${t}-inner`]:{paddingInlineStart:s,paddingInlineEnd:o,[`${c}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${c}-unchecked`]:{marginInlineStart:`calc(100% - ${u} + ${h})`,marginInlineEnd:`calc(-100% + ${u} - ${h})`}},[`${t}-handle`]:{insetInlineStart:`calc(100% - ${Be(l(a).add(r).equal())})`}},[`&:not(${t}-disabled):active`]:{[`&:not(${t}-checked) ${c}`]:{[`${c}-unchecked`]:{marginInlineStart:l(e.marginXXS).div(2).equal(),marginInlineEnd:l(e.marginXXS).mul(-1).div(2).equal()}},[`&${t}-checked ${c}`]:{[`${c}-checked`]:{marginInlineStart:l(e.marginXXS).mul(-1).div(2).equal(),marginInlineEnd:l(e.marginXXS).div(2).equal()}}}}}}},she=e=>{const{componentCls:t,handleSize:n,calc:r}=e;return{[t]:{[`${t}-loading-icon${e.iconCls}`]:{position:"relative",top:r(r(n).sub(e.fontSize)).div(2).equal(),color:e.switchLoadingIconColor,verticalAlign:"top"},[`&${t}-checked ${t}-loading-icon`]:{color:e.switchColor}}}},ohe=e=>{const{componentCls:t,trackPadding:n,handleBg:r,handleShadow:i,handleSize:s,calc:o}=e,a=`${t}-handle`;return{[t]:{[a]:{position:"absolute",top:n,insetInlineStart:n,width:s,height:s,transition:`all ${e.switchDuration} ease-in-out`,"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:r,borderRadius:o(s).div(2).equal(),boxShadow:i,transition:`all ${e.switchDuration} ease-in-out`,content:'""'}},[`&${t}-checked ${a}`]:{insetInlineStart:`calc(100% - ${Be(o(s).add(n).equal())})`},[`&:not(${t}-disabled):active`]:{[`${a}::before`]:{insetInlineEnd:e.switchHandleActiveInset,insetInlineStart:0},[`&${t}-checked ${a}::before`]:{insetInlineEnd:0,insetInlineStart:e.switchHandleActiveInset}}}}},ahe=e=>{const{componentCls:t,trackHeight:n,trackPadding:r,innerMinMargin:i,innerMaxMargin:s,handleSize:o,calc:a}=e,l=`${t}-inner`,c=Be(a(o).add(a(r).mul(2)).equal()),u=Be(a(s).mul(2).equal());return{[t]:{[l]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:s,paddingInlineEnd:i,transition:`padding-inline-start ${e.switchDuration} ease-in-out, padding-inline-end ${e.switchDuration} ease-in-out`,[`${l}-checked, ${l}-unchecked`]:{display:"block",color:e.colorTextLightSolid,fontSize:e.fontSizeSM,transition:`margin-inline-start ${e.switchDuration} ease-in-out, margin-inline-end ${e.switchDuration} ease-in-out`,pointerEvents:"none",minHeight:n},[`${l}-checked`]:{marginInlineStart:`calc(-100% + ${c} - ${u})`,marginInlineEnd:`calc(100% - ${c} + ${u})`},[`${l}-unchecked`]:{marginTop:a(n).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`&${t}-checked ${l}`]:{paddingInlineStart:i,paddingInlineEnd:s,[`${l}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${l}-unchecked`]:{marginInlineStart:`calc(100% - ${c} + ${u})`,marginInlineEnd:`calc(-100% + ${c} - ${u})`}},[`&:not(${t}-disabled):active`]:{[`&:not(${t}-checked) ${l}`]:{[`${l}-unchecked`]:{marginInlineStart:a(r).mul(2).equal(),marginInlineEnd:a(r).mul(-1).mul(2).equal()}},[`&${t}-checked ${l}`]:{[`${l}-checked`]:{marginInlineStart:a(r).mul(-1).mul(2).equal(),marginInlineEnd:a(r).mul(2).equal()}}}}}},lhe=e=>{const{componentCls:t,trackHeight:n,trackMinWidth:r}=e;return{[t]:Object.assign(Object.assign(Object.assign(Object.assign({},si(e)),{position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:r,height:n,lineHeight:Be(n),verticalAlign:"middle",background:e.colorTextQuaternary,border:"0",borderRadius:100,cursor:"pointer",transition:`all ${e.motionDurationMid}`,userSelect:"none",[`&:hover:not(${t}-disabled)`]:{background:e.colorTextTertiary}}),TN(e)),{[`&${t}-checked`]:{background:e.switchColor,[`&:hover:not(${t}-disabled)`]:{background:e.colorPrimaryHover}},[`&${t}-loading, &${t}-disabled`]:{cursor:"not-allowed",opacity:e.switchDisabledOpacity,"*":{boxShadow:"none",cursor:"not-allowed"}},[`&${t}-rtl`]:{direction:"rtl"}})}},che=e=>{const{fontSize:t,lineHeight:n,controlHeight:r,colorWhite:i}=e,s=t*n,o=r/2,a=2,l=s-a*2,c=o-a*2;return{trackHeight:s,trackHeightSM:o,trackMinWidth:l*2+a*4,trackMinWidthSM:c*2+a*2,trackPadding:a,handleBg:i,handleSize:l,handleSizeSM:c,handleShadow:`0 2px 4px 0 ${new bn("#00230b").setA(.2).toRgbString()}`,innerMinMargin:l/2,innerMaxMargin:l+a+a*2,innerMinMarginSM:c/2,innerMaxMarginSM:c+a+a*2}},uhe=li("Switch",e=>{const t=Dn(e,{switchDuration:e.motionDurationMid,switchColor:e.colorPrimary,switchDisabledOpacity:e.opacityLoading,switchLoadingIconSize:e.calc(e.fontSizeIcon).mul(.75).equal(),switchLoadingIconColor:`rgba(0, 0, 0, ${e.opacityLoading})`,switchHandleActiveInset:"-30%"});return[lhe(t),ahe(t),ohe(t),she(t),ihe(t)]},che);var dhe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const hhe=m.forwardRef((e,t)=>{const{prefixCls:n,size:r,disabled:i,loading:s,className:o,rootClassName:a,style:l,checked:c,value:u,defaultChecked:h,defaultValue:f,onChange:p}=e,g=dhe(e,["prefixCls","size","disabled","loading","className","rootClassName","style","checked","value","defaultChecked","defaultValue","onChange"]),[v,x]=Er(!1,{value:c??u,defaultValue:h??f}),{getPrefixCls:b,direction:y,switch:w}=m.useContext(_n),S=m.useContext(Ts),C=(i??S)||s,_=b("switch",n),k=m.createElement("div",{className:`${_}-handle`},s&&m.createElement(dy,{className:`${_}-loading-icon`})),[z,j,N]=uhe(_),$=mo(r),R=Me(w==null?void 0:w.className,{[`${_}-small`]:$==="small",[`${_}-loading`]:s,[`${_}-rtl`]:y==="rtl"},o,a,j,N),P=Object.assign(Object.assign({},w==null?void 0:w.style),l),E=(...M)=>{x(M[0]),p==null||p.apply(void 0,M)};return z(m.createElement(fy,{component:"Switch",disabled:C},m.createElement(I8,Object.assign({},g,{checked:v,onChange:E,prefixCls:_,className:R,style:P,disabled:C,ref:t,loadingIcon:k}))))}),Xi=hhe;Xi.__ANT_SWITCH=!0;const fhe=e=>{const{paddingXXS:t,lineWidth:n,tagPaddingHorizontal:r,componentCls:i,calc:s}=e,o=s(r).sub(n).equal(),a=s(t).sub(n).equal();return{[i]:Object.assign(Object.assign({},si(e)),{display:"inline-block",height:"auto",marginInlineEnd:e.marginXS,paddingInline:o,fontSize:e.tagFontSize,lineHeight:e.tagLineHeight,whiteSpace:"nowrap",background:e.defaultBg,border:`${Be(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusSM,opacity:1,transition:`all ${e.motionDurationMid}`,textAlign:"start",position:"relative",[`&${i}-rtl`]:{direction:"rtl"},"&, a, a:hover":{color:e.defaultColor},[`${i}-close-icon`]:{marginInlineStart:a,fontSize:e.tagIconSize,color:e.colorIcon,cursor:"pointer",transition:`all ${e.motionDurationMid}`,"&:hover":{color:e.colorTextHeading}},[`&${i}-has-color`]:{borderColor:"transparent",[`&, a, a:hover, ${e.iconCls}-close, ${e.iconCls}-close:hover`]:{color:e.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",[`&:not(${i}-checkable-checked):hover`]:{color:e.colorPrimary,backgroundColor:e.colorFillSecondary},"&:active, &-checked":{color:e.colorTextLightSolid},"&-checked":{backgroundColor:e.colorPrimary,"&:hover":{backgroundColor:e.colorPrimaryHover}},"&:active":{backgroundColor:e.colorPrimaryActive}},"&-hidden":{display:"none"},[`> ${e.iconCls} + span, > span + ${e.iconCls}`]:{marginInlineStart:o}}),[`${i}-borderless`]:{borderColor:"transparent",background:e.tagBorderlessBg}}},SE=e=>{const{lineWidth:t,fontSizeIcon:n,calc:r}=e,i=e.fontSizeSM;return Dn(e,{tagFontSize:i,tagLineHeight:Be(r(e.lineHeightSM).mul(i).equal()),tagIconSize:r(n).sub(r(t).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:e.defaultBg})},_E=e=>({defaultBg:new bn(e.colorFillQuaternary).onBackground(e.colorBgContainer).toHexString(),defaultColor:e.colorText}),$8=li("Tag",e=>{const t=SE(e);return fhe(t)},_E);var phe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const mhe=m.forwardRef((e,t)=>{const{prefixCls:n,style:r,className:i,checked:s,children:o,icon:a,onChange:l,onClick:c}=e,u=phe(e,["prefixCls","style","className","checked","children","icon","onChange","onClick"]),{getPrefixCls:h,tag:f}=m.useContext(_n),p=w=>{l==null||l(!s),c==null||c(w)},g=h("tag",n),[v,x,b]=$8(g),y=Me(g,`${g}-checkable`,{[`${g}-checkable-checked`]:s},f==null?void 0:f.className,i,x,b);return v(m.createElement("span",Object.assign({},u,{ref:t,style:Object.assign(Object.assign({},r),f==null?void 0:f.style),className:y,onClick:p}),a,m.createElement("span",null,o)))}),ghe=e=>n6(e,(t,{textColor:n,lightBorderColor:r,lightColor:i,darkColor:s})=>({[`${e.componentCls}${e.componentCls}-${t}`]:{color:n,background:i,borderColor:r,"&-inverse":{color:e.colorTextLightSolid,background:s,borderColor:s},[`&${e.componentCls}-borderless`]:{borderColor:"transparent"}}})),vhe=AN(["Tag","preset"],e=>{const t=SE(e);return ghe(t)},_E);function xhe(e){return typeof e!="string"?e:e.charAt(0).toUpperCase()+e.slice(1)}const sv=(e,t,n)=>{const r=xhe(n);return{[`${e.componentCls}${e.componentCls}-${t}`]:{color:e[`color${n}`],background:e[`color${r}Bg`],borderColor:e[`color${r}Border`],[`&${e.componentCls}-borderless`]:{borderColor:"transparent"}}}},bhe=AN(["Tag","status"],e=>{const t=SE(e);return[sv(t,"success","Success"),sv(t,"processing","Info"),sv(t,"error","Error"),sv(t,"warning","Warning")]},_E);var yhe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const whe=m.forwardRef((e,t)=>{const{prefixCls:n,className:r,rootClassName:i,style:s,children:o,icon:a,color:l,onClose:c,bordered:u=!0,visible:h}=e,f=yhe(e,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:p,direction:g,tag:v}=m.useContext(_n),[x,b]=m.useState(!0),y=po(f,["closeIcon","closable"]);m.useEffect(()=>{h!==void 0&&b(h)},[h]);const w=kB(l),S=qae(l),C=w||S,_=Object.assign(Object.assign({backgroundColor:l&&!C?l:void 0},v==null?void 0:v.style),s),k=p("tag",n),[z,j,N]=$8(k),$=Me(k,v==null?void 0:v.className,{[`${k}-${l}`]:C,[`${k}-has-color`]:l&&!C,[`${k}-hidden`]:!x,[`${k}-rtl`]:g==="rtl",[`${k}-borderless`]:!u},r,i,j,N),R=A=>{A.stopPropagation(),c==null||c(A),!A.defaultPrevented&&b(!1)},[,P]=ene(p$(e),p$(v),{closable:!1,closeIconRender:A=>{const H=m.createElement("span",{className:`${k}-close-icon`,onClick:R},A);return w6(A,H,I=>({onClick:B=>{var L;(L=I==null?void 0:I.onClick)===null||L===void 0||L.call(I,B),R(B)},className:Me(I==null?void 0:I.className,`${k}-close-icon`)}))}}),E=typeof f.onClick=="function"||o&&o.type==="a",M=a||null,T=M?m.createElement(m.Fragment,null,M,o&&m.createElement("span",null,o)):o,D=m.createElement("span",Object.assign({},y,{ref:t,className:$,style:_}),T,P,w&&m.createElement(vhe,{key:"preset",prefixCls:k}),S&&m.createElement(bhe,{key:"status",prefixCls:k}));return z(E?m.createElement(fy,{component:"Tag"},D):D)}),R8=whe;R8.CheckableTag=mhe;const Us=(e,t)=>new bn(e).setA(t).toRgbString(),Qd=(e,t)=>new bn(e).lighten(t).toHexString(),She=e=>{const t=fd(e,{theme:"dark"});return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[6],6:t[5],7:t[4],8:t[6],9:t[5],10:t[4]}},_he=(e,t)=>{const n=e||"#000",r=t||"#fff";return{colorBgBase:n,colorTextBase:r,colorText:Us(r,.85),colorTextSecondary:Us(r,.65),colorTextTertiary:Us(r,.45),colorTextQuaternary:Us(r,.25),colorFill:Us(r,.18),colorFillSecondary:Us(r,.12),colorFillTertiary:Us(r,.08),colorFillQuaternary:Us(r,.04),colorBgSolid:Us(r,.95),colorBgSolidHover:Us(r,1),colorBgSolidActive:Us(r,.9),colorBgElevated:Qd(n,12),colorBgContainer:Qd(n,8),colorBgLayout:Qd(n,0),colorBgSpotlight:Qd(n,26),colorBgBlur:Us(r,.04),colorBorder:Qd(n,26),colorBorderSecondary:Qd(n,19)}},Che=(e,t)=>{const n=Object.keys(RN).map(s=>{const o=fd(e[s],{theme:"dark"});return Array.from({length:10},()=>1).reduce((a,l,c)=>(a[`${s}-${c+1}`]=o[c],a[`${s}${c+1}`]=o[c],a),{})}).reduce((s,o)=>(s=Object.assign(Object.assign({},s),o),s),{}),r=t??ON(e),i=UF(e,{generateColorPalettes:She,generateNeutralColorPalettes:_he});return Object.assign(Object.assign(Object.assign(Object.assign({},r),n),i),{colorPrimaryBg:i.colorPrimaryBorder,colorPrimaryBgHover:i.colorPrimaryBorderHover})},FR={defaultSeed:Fx.token,defaultAlgorithm:ON,darkAlgorithm:Che};var khe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const{TimePicker:Nhe,RangePicker:Ehe}=Od,jhe=m.forwardRef((e,t)=>m.createElement(Ehe,Object.assign({},e,{picker:"time",mode:void 0,ref:t}))),d0=m.forwardRef((e,t)=>{var{addon:n,renderExtraFooter:r,variant:i,bordered:s}=e,o=khe(e,["addon","renderExtraFooter","variant","bordered"]);const[a]=Id("timePicker",i,s),l=m.useMemo(()=>{if(r)return r;if(n)return n},[n,r]);return m.createElement(Nhe,Object.assign({},o,{mode:void 0,ref:t,renderExtraFooter:l,variant:a}))}),O8=l0(d0,"popupAlign",void 0,"picker");d0._InternalPanelDoNotUseOrYouWillBeFired=O8;d0.RangePicker=jhe;d0._InternalPanelDoNotUseOrYouWillBeFired=O8;var zhe=Object.defineProperty,qf=(e,t)=>zhe(e,"name",{value:t,configurable:!0}),P8=!!(typeof window<"u"&&window.document&&window.document.createElement);function na(e,t,{checkForDefaultPrevented:n=!0}={}){return qf(function(i){if(e==null||e(i),n===!1||!i||!i.defaultPrevented)return t==null?void 0:t(i)},"handleEvent")}qf(na,"composeEventHandlers");function Mhe(e){var t;if(!P8)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}qf(Mhe,"getOwnerWindow");function TC(e){if(!P8)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}qf(TC,"getOwnerDocument");function T8(e,t=!1){const{activeElement:n}=TC(e);if(!(n!=null&&n.nodeName))return null;if(A8(n)&&n.contentDocument)return T8(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const i=TC(n).getElementById(r);if(i)return i}}return n}qf(T8,"getActiveElement");function A8(e){return e.tagName==="IFRAME"}qf(A8,"isFrame");var Ihe=Object.defineProperty,CE=(e,t)=>Ihe(e,"name",{value:t,configurable:!0});function AC(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}CE(AC,"setRef");function D8(...e){return t=>{let n=!1;const r=e.map(i=>{const s=AC(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():AC(e[i],null)}}}}CE(D8,"composeRefs");function qc(...e){return m.useCallback(D8(...e),e)}CE(qc,"useComposedRefs");var $he=Object.defineProperty,ro=(e,t)=>$he(e,"name",{value:t,configurable:!0});function Rhe(e,t){const n=m.createContext(t);n.displayName=e+"Context";const r=ro(s=>{const{children:o,...a}=s,l=m.useMemo(()=>a,Object.values(a));return d.jsx(n.Provider,{value:l,children:o})},"Provider");r.displayName=e+"Provider";function i(s,o={}){const{optional:a=!1}=o,l=m.useContext(n);if(l)return l;if(t!==void 0)return t;if(!a)throw new Error(`\`${s}\` must be used within \`${e}\``)}return ro(i,"useContext"),[r,i]}ro(Rhe,"createContext");function kE(e,t=[]){let n=[];function r(s,o){const a=m.createContext(o);a.displayName=s+"Context";const l=n.length;n=[...n,o];const c=ro(h=>{var b;const{scope:f,children:p,...g}=h,v=((b=f==null?void 0:f[e])==null?void 0:b[l])||a,x=m.useMemo(()=>g,Object.values(g));return d.jsx(v.Provider,{value:x,children:p})},"Provider");c.displayName=s+"Provider";function u(h,f,p={}){var b;const{optional:g=!1}=p,v=((b=f==null?void 0:f[e])==null?void 0:b[l])||a,x=m.useContext(v);if(x)return x;if(o!==void 0)return o;if(!g)throw new Error(`\`${h}\` must be used within \`${s}\``)}return ro(u,"useContext"),[c,u]}ro(r,"createContext");const i=ro(()=>{const s=n.map(o=>m.createContext(o));return ro(function(a){const l=(a==null?void 0:a[e])||s;return m.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])},"useScope")},"createScope");return i.scopeName=e,[r,L8(i,...t)]}ro(kE,"createContextScope");function L8(...e){const t=e[0];if(e.length===1)return t;const n=ro(()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return ro(function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const h=l(s)[`__scope${c}`];return{...a,...h}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}ro(L8,"composeContextScopes");var Ohe=Object.defineProperty,Ds=(e,t)=>Ohe(e,"name",{value:t,configurable:!0});function F8(e){const t=m.forwardRef((n,r)=>{let{children:i,...s}=n,o=null,a=!1;const l=[];i=K8(i),m.Children.forEach(i,f=>{var p;if(q8(f)){a=!0;const g=f;let v="child"in g.props?g.props.child:g.props.children;for(;NE(v)&&typeof tb=="function";)v=tb(v._payload);o=Phe(g,v),l.push((p=o==null?void 0:o.props)==null?void 0:p.children)}else l.push(f)}),o?o=m.cloneElement(o,void 0,l):!a&&m.Children.count(i)===1&&m.isValidElement(i)&&(o=i);const c=o?W8(o):void 0,u=qc(r,c);if(!o){if(i||i===0)throw new Error(a?Dhe(e):Ahe(e));return i}const h=V8(s,o.props??{});return o.type!==m.Fragment&&(h.ref=r?u:c),m.cloneElement(o,h)});return t.displayName=`${e}.Slot`,t}Ds(F8,"createSlot");var B8=Symbol.for("radix.slottable");function H8(e){const t=Ds(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=B8,t}Ds(H8,"createSlottable");var Phe=Ds((e,t)=>"child"in e.props?m.isValidElement(t)?m.cloneElement(t,void 0,e.props.children(t.props.children)):null:m.isValidElement(t)?t:null,"getSlottableElementFromSlottable");function V8(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"?n[r]=[i,s].filter(Boolean).join(" "):r==="aria-describedby"&&(n[r]=G8(s,i))}return{...e,...n}}Ds(V8,"mergeProps");function W8(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Ds(W8,"getElementRef");function q8(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===B8}Ds(q8,"isSlottable");var The=Symbol.for("react.lazy");function NE(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===The&&"_payload"in e&&U8(e._payload)}Ds(NE,"isLazyComponent");function U8(e){return typeof e=="object"&&e!==null&&"then"in e}Ds(U8,"isPromiseLike");function K8(e){let t=e;for(;NE(t)&&typeof tb=="function";)t=tb(t._payload);return t}Ds(K8,"useUnwrappedLazy");function G8(...e){const t=new Set;for(const n of e)if(typeof n=="string")for(const r of String(n).trim().split(/\s+/))r&&t.add(r);return t.size>0?Array.from(t).join(" "):void 0}Ds(G8,"concatAriaDescribedby");var Ahe=Ds(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),Dhe=Ds(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),tb=Ca[" use ".trim().toString()],Lhe=Object.defineProperty,Fhe=(e,t)=>Lhe(e,"name",{value:t,configurable:!0}),Bhe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Uf=Bhe.reduce((e,t)=>{const n=F8(`Primitive.${t}`),r=m.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Y8(e,t){e&&ki.flushSync(()=>e.dispatchEvent(t))}Fhe(Y8,"dispatchDiscreteCustomEvent");var io=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},Hhe=Object.defineProperty,Vhe=(e,t)=>Hhe(e,"name",{value:t,configurable:!0}),BR=Ca[" useInsertionEffect ".trim().toString()];function h0(e){const t=m.useRef(e);return typeof BR=="function"?BR(()=>{t.current=e}):io(()=>{t.current=e}),m.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}Vhe(h0,"useCallbackRef");var Whe=Object.defineProperty,ri=(e,t)=>Whe(e,"name",{value:t,configurable:!0}),DC="dismissableLayer.update",qhe="dismissableLayer.pointerDownOutside",Uhe="dismissableLayer.focusOutside",HR,Z8=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Khe=m.forwardRef(ri(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:c,...u}=t,h=m.useContext(Z8),[f,p]=m.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,v]=m.useState({}),x=qc(n,p),b=Array.from(h.layers),[y]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),w=y?b.indexOf(y):-1,S=f?b.indexOf(f):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,_=S>=w,k=m.useRef(!1),z=X8(R=>{o==null||o(R),l==null||l(R),R.defaultPrevented||c==null||c()},{ownerDocument:g,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:h.dismissableSurfaces,shouldHandlePointerDownOutside:m.useCallback(R=>{if(!(R instanceof Node))return!1;const P=[...h.branches].some(E=>E.contains(R));return _&&!P},[h.branches,_])}),j=Q8(R=>{if(i&&k.current)return;const P=R.target;[...h.branches].some(M=>M.contains(P))||(a==null||a(R),l==null||l(R),R.defaultPrevented||c==null||c())},g),N=f?S===b.length-1:!1,$=h0(R=>{R.key==="Escape"&&(s==null||s(R),!R.defaultPrevented&&c&&(R.preventDefault(),c()))});return m.useEffect(()=>{if(N)return g.addEventListener("keydown",$,{capture:!0}),()=>g.removeEventListener("keydown",$,{capture:!0})},[g,N,$]),m.useEffect(()=>{if(f)return r&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(HR=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),LC(),()=>{r&&(h.layersWithOutsidePointerEventsDisabled.delete(f),h.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=HR))}},[f,g,r,h]),m.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),LC())},[f,h]),m.useEffect(()=>{const R=ri(()=>v({}),"handleUpdate");return document.addEventListener(DC,R),()=>document.removeEventListener(DC,R)},[]),d.jsx(Uf.div,{...u,ref:x,style:{pointerEvents:C?_?"auto":"none":void 0,...t.style},onFocusCapture:na(t.onFocusCapture,j.onFocusCapture),onBlurCapture:na(t.onBlurCapture,j.onBlurCapture),onPointerDownCapture:na(t.onPointerDownCapture,z.onPointerDownCapture)})},"DismissableLayer"));function Ghe(){const e=m.useContext(Z8),[t,n]=m.useState(null);return m.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}ri(Ghe,"useDismissableLayerSurface");var Yhe=ri(()=>!0,"IS_TRUE");function X8(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s,shouldHandlePointerDownOutside:o=Yhe}=t,a=h0(e),l=m.useRef(!1),c=m.useRef(!1),u=m.useRef(new Map),h=m.useRef(()=>{});return m.useEffect(()=>{function f(){c.current=!1,i.current=!1,u.current.clear()}ri(f,"resetOutsideInteraction");function p(){return Array.from(u.current.values()).some(Boolean)}ri(p,"isOutsideInteractionIntercepted");function g(w){if(!c.current)return;const S=w.target;S instanceof Node&&[...s].some(_=>_.contains(S))||u.current.set(w.type,!0),w.type==="click"&&window.setTimeout(()=>{c.current&&h.current()},0)}ri(g,"handleInteractionCapture");function v(w){c.current&&u.current.set(w.type,!1)}ri(v,"handleInteractionBubble");const x=ri(w=>{if(w.target&&!l.current){let S=function(){n.removeEventListener("click",h.current);const _=p();f(),_||EE(qhe,a,C,{discrete:!0})};if(ri(S,"handleAndDispatchPointerDownOutsideEvent"),!o(w.target)){n.removeEventListener("click",h.current),f(),l.current=!1;return}const C={originalEvent:w};c.current=!0,i.current=r&&w.button===0,u.current.clear(),!r||w.button!==0?S():(n.removeEventListener("click",h.current),h.current=S,n.addEventListener("click",h.current,{once:!0}))}else n.removeEventListener("click",h.current),f();l.current=!1},"handlePointerDown"),b=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const w of b)n.addEventListener(w,g,!0),n.addEventListener(w,v);const y=window.setTimeout(()=>{n.addEventListener("pointerdown",x)},0);return()=>{window.clearTimeout(y),n.removeEventListener("pointerdown",x),n.removeEventListener("click",h.current);for(const w of b)n.removeEventListener(w,g,!0),n.removeEventListener(w,v)}},[n,a,r,i,s,o]),{onPointerDownCapture:ri(()=>l.current=!0,"onPointerDownCapture")}}ri(X8,"usePointerDownOutside");function Q8(e,t=globalThis==null?void 0:globalThis.document){const n=h0(e),r=m.useRef(!1);return m.useEffect(()=>{const i=ri(s=>{s.target&&!r.current&&EE(Uhe,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:ri(()=>r.current=!0,"onFocusCapture"),onBlurCapture:ri(()=>r.current=!1,"onBlurCapture")}}ri(Q8,"useFocusOutside");function LC(){const e=new CustomEvent(DC);document.dispatchEvent(e)}ri(LC,"dispatchUpdate");function EE(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Y8(i,s):i.dispatchEvent(s)}ri(EE,"handleAndDispatchCustomEvent");var Zhe=Object.defineProperty,Li=(e,t)=>Zhe(e,"name",{value:t,configurable:!0}),J8=m.createContext(null);function Xhe({registry:e,children:t}){return e?d.jsx(J8.Provider,{value:e,children:t}):t}Li(Xhe,"FocusScopeBranchProvider");function Qhe(){const[e,t]=m.useState([]),n=m.useMemo(()=>({add:Li(r=>t(i=>i.includes(r)?i:[...i,r]),"add"),remove:Li(r=>t(i=>i.filter(s=>s!==r)),"remove")}),[]);return{nodes:e,registry:n}}Li(Qhe,"useFocusScopeBranchRegistry");function eH(e){const t=m.useContext(J8);m.useEffect(()=>{if(!(!e||!t))return t.add(e),()=>t.remove(e)},[e,t])}Li(eH,"useFocusScopeBranch");function Jhe(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(iH(r,{select:t}),document.activeElement!==n)return}Li(Jhe,"focusFirst");function efe(e){const t=tH(e),n=FC(t,e),r=FC(t.reverse(),e);return[n,r]}Li(efe,"getTabbableEdges");function tH(e){const t=[],r=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Li(i=>{const s=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||s?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;r.nextNode();)t.push(r.currentNode);return t}Li(tH,"getTabbableCandidates");function FC(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):nH(r,{upTo:t})))return r}Li(FC,"findVisible");function nH(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}Li(nH,"isHidden");function rH(e){return e.tagName==="INPUT"&&typeof e.select=="function"}Li(rH,"isSelectableInput");function iH(e,{select:t=!1}={}){if(e&&e.focus){const r=(e.ownerDocument??document).activeElement;e.focus({preventScroll:!0}),e!==r&&rH(e)&&t&&e.select()}}Li(iH,"focus");function tfe(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=BC(e,t),e.unshift(t)},remove(t){var n;e=BC(e,t),(n=e[0])==null||n.resume()}}}Li(tfe,"createFocusScopesStack");function BC(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Li(BC,"arrayRemove");function nfe(e){return e.filter(t=>t.tagName!=="A")}Li(nfe,"removeLinks");var rfe=Object.defineProperty,ife=(e,t)=>rfe(e,"name",{value:t,configurable:!0}),sfe=Ca[" useId ".trim().toString()]||(()=>{}),ofe=0;function sH(e){const[t,n]=m.useState(sfe());return io(()=>{e||n(r=>r??String(ofe++))},[e]),e||(t?`radix-${t}`:"")}ife(sH,"useId");const afe=["top","right","bottom","left"],Ic=Math.min,sl=Math.max,nb=Math.round,ov=Math.floor,ol=e=>({x:e,y:e}),lfe={left:"right",right:"left",bottom:"top",top:"bottom"};function oH(e,t,n){return sl(e,Ic(t,n))}function pl(e,t){return typeof e=="function"?e(t):e}function $c(e){return e.split("-")[0]}function Kf(e){return e.split("-")[1]}function jE(e){return e==="x"?"y":"x"}function zE(e){return e==="y"?"height":"width"}function la(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ME(e){return jE(la(e))}function cfe(e,t,n){n===void 0&&(n=!1);const r=Kf(e),i=ME(e),s=zE(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=rb(o)),[o,rb(o)]}function ufe(e){const t=rb(e);return[HC(e),t,HC(t)]}function HC(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const VR=["left","right"],WR=["right","left"],dfe=["top","bottom"],hfe=["bottom","top"];function ffe(e,t,n){switch(e){case"top":case"bottom":return n?t?WR:VR:t?VR:WR;case"left":case"right":return t?dfe:hfe;default:return[]}}function pfe(e,t,n,r){const i=Kf(e);let s=ffe($c(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(HC)))),s}function rb(e){const t=$c(e);return lfe[t]+e.slice(t.length)}function mfe(e){var t,n,r,i;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(i=e.left)!=null?i:0}}function aH(e){return typeof e!="number"?mfe(e):{top:e,right:e,bottom:e,left:e}}function ib(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function qR(e,t,n){let{reference:r,floating:i}=e;const s=la(t),o=ME(t),a=zE(o),l=$c(t),c=s==="y",u=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,f=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:u,y:r.y-i.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:h};break;case"left":p={x:r.x-i.width,y:h};break;default:p={x:r.x,y:r.y}}const g=Kf(t);return g&&(p[o]+=f*(g==="end"?1:-1)*(n&&c?-1:1)),p}async function gfe(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:f=!1,padding:p=0}=pl(t,e),g=aH(p),x=a[f?h==="floating"?"reference":"floating":h],b=ib(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),y=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),S=await(s.isElement==null?void 0:s.isElement(w))&&await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1},C=ib(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:w,strategy:l}):y);return{top:(b.top-C.top+g.top)/S.y,bottom:(C.bottom-b.bottom+g.bottom)/S.y,left:(b.left-C.left+g.left)/S.x,right:(C.right-b.right+g.right)/S.x}}const vfe=50,xfe=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:gfe},l=await(o.isRTL==null?void 0:o.isRTL(t));let c=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:h}=qR(c,r,l),f=r,p=0;const g={};for(let v=0;v<s.length;v++){const x=s[v];if(!x)continue;const{name:b,fn:y}=x,{x:w,y:S,data:C,reset:_}=await y({x:u,y:h,initialPlacement:r,placement:f,strategy:i,middlewareData:g,rects:c,platform:a,elements:{reference:e,floating:t}});u=w??u,h=S??h,g[b]={...g[b],...C},_&&p<vfe&&(p++,typeof _=="object"&&(_.placement&&(f=_.placement),_.rects&&(c=_.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):_.rects),{x:u,y:h}=qR(c,f,l)),v=-1)}return{x:u,y:h,placement:f,strategy:i,middlewareData:g}},bfe=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=pl(e,t)||{};if(c==null)return{};const h=aH(u),f={x:n,y:r},p=ME(i),g=zE(p),v=await o.getDimensions(c),x=p==="y",b=x?"top":"left",y=x?"bottom":"right",w=x?"clientHeight":"clientWidth",S=s.reference[g]+s.reference[p]-f[p]-s.floating[g],C=f[p]-s.reference[p],_=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let k=_?_[w]:0;(!k||!await(o.isElement==null?void 0:o.isElement(_)))&&(k=a.floating[w]||s.floating[g]);const z=S/2-C/2,j=k/2-v[g]/2-1,N=Ic(h[b],j),$=Ic(h[y],j),R=k-v[g]-$,P=k/2-v[g]/2+z,E=oH(N,P,R),M=!l.arrow&&Kf(i)!=null&&P!==E&&s.reference[g]/2-(P<N?N:$)-v[g]/2<0,T=M?P<N?P-N:P-R:0;return{[p]:f[p]+T,data:{[p]:E,centerOffset:P-E-T,...M&&{alignmentOffset:T}},reset:M}}}),yfe=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...x}=pl(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=$c(i),y=la(a),w=$c(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),C=f||(w||!v?[rb(a)]:ufe(a)),_=g!=="none";!f&&_&&C.push(...pfe(a,v,g,S));const k=[a,...C],z=await l.detectOverflow(t,x),j=[];let N=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&j.push(z[b]),h){const E=cfe(i,o,S);j.push(z[E[0]],z[E[1]])}if(N=[...N,{placement:i,overflows:j}],!j.every(E=>E<=0)){var $,R;const E=((($=s.flip)==null?void 0:$.index)||0)+1,M=k[E];if(M&&(!(h==="alignment"?y!==la(M):!1)||N.every(A=>la(A.placement)===y?A.overflows[0]>0:!0)))return{data:{index:E,overflows:N},reset:{placement:M}};let T=(R=N.filter(D=>D.overflows[0]<=0).sort((D,A)=>D.overflows[1]-A.overflows[1])[0])==null?void 0:R.placement;if(!T)switch(p){case"bestFit":{var P;const D=(P=N.filter(A=>{if(_){const H=la(A.placement);return H===y||H==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(H=>H>0).reduce((H,I)=>H+I,0)]).sort((A,H)=>A[1]-H[1])[0])==null?void 0:P[0];D&&(T=D);break}case"initialPlacement":T=a;break}if(i!==T)return{reset:{placement:T}}}return{}}}};function UR(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function KR(e){return afe.some(t=>e[t]>=0)}const wfe=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=pl(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=UR(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:KR(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),a=UR(o,n.floating);return{data:{escapedOffsets:a,escaped:KR(a)}}}default:return{}}}}},lH=new Set(["left","top"]);async function Sfe(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=$c(n),a=Kf(n),l=la(n)==="y",c=lH.has(o)?-1:1,u=s&&l?-1:1,h=pl(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:g}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),l?{x:p*u,y:f*c}:{x:f*c,y:p*u}}const _fe=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=t,l=await Sfe(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},Cfe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x:w,y:S}=y;return{x:w,y:S}}},...c}=pl(e,t),u={x:n,y:r},h=await s.detectOverflow(t,c),f=la(i),p=jE(f);let g=u[p],v=u[f];const x=(y,w)=>oH(w+h[y==="y"?"top":"left"],w,w-h[y==="y"?"bottom":"right"]);o&&(g=x(p,g)),a&&(v=x(f,v));const b=l.fn({...t,[p]:g,[f]:v});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[p]:o,[f]:a}}}}}},kfe=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:i,y:s,placement:o,rects:a,middlewareData:l}=t,{offset:c=0,mainAxis:u=!0,crossAxis:h=!0}=pl(e,t),f={x:i,y:s},p=la(o),g=jE(p);let v=f[g],x=f[p];const b=pl(c,t),y=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:(n=b.mainAxis)!=null?n:0,crossAxis:(r=b.crossAxis)!=null?r:0};if(u){const C=g==="y"?"height":"width",_=a.reference[g]-a.floating[C]+y.mainAxis,k=a.reference[g]+a.reference[C]-y.mainAxis;v<_?v=_:v>k&&(v=k)}if(h){var w,S;const C=g==="y"?"width":"height",_=lH.has($c(o)),k=a.reference[p]-a.floating[C]+(_&&((w=l.offset)==null?void 0:w[p])||0)+(_?0:y.crossAxis),z=a.reference[p]+a.reference[C]+(_?0:((S=l.offset)==null?void 0:S[p])||0)-(_?y.crossAxis:0);x<k?x=k:x>z&&(x=z)}return{[g]:v,[p]:x}}}},Nfe=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:i,elements:s}=t,{apply:o=()=>{},...a}=pl(e,t),l=await i.detectOverflow(t,a),c=$c(n),u=Kf(n),h=la(n)==="y",{width:f,height:p}=r.floating;let g,v;c==="top"||c==="bottom"?(g=c,v=u===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(v=c,g=u==="end"?"top":"bottom");const x=p-l.top-l.bottom,b=f-l.left-l.right,y=Ic(p-l[g],x),w=Ic(f-l[v],b),S=t.middlewareData.shift,C=!S;let _=y,k=w;S!=null&&S.enabled.x&&(k=b),S!=null&&S.enabled.y&&(_=x),C&&!u&&(h?k=f-2*sl(l.left,l.right):_=p-2*sl(l.top,l.bottom)),await o({...t,availableWidth:k,availableHeight:_});const z=await i.getDimensions(s.floating);return f!==z.width||p!==z.height?{reset:{rects:!0}}:{}}}};function Ry(){return typeof window<"u"}function Gf(e){return cH(e)?(e.nodeName||"").toLowerCase():"#document"}function us(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function kl(e){var t;return(t=(cH(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function cH(e){return Ry()?e instanceof Node||e instanceof us(e).Node:!1}function va(e){return Ry()?e instanceof Element||e instanceof us(e).Element:!1}function Uc(e){return Ry()?e instanceof HTMLElement||e instanceof us(e).HTMLElement:!1}function GR(e){return!Ry()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof us(e).ShadowRoot}function Oy(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=xa(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function Efe(e){return/^(table|td|th)$/.test(Gf(e))}function Py(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const jfe=/transform|translate|scale|rotate|perspective|filter/,zfe=/paint|layout|strict|content/,su=e=>!!e&&e!=="none";let Sw;function IE(e){const t=va(e)?xa(e):e;return su(t.transform)||su(t.translate)||su(t.scale)||su(t.rotate)||su(t.perspective)||!$E()&&(su(t.backdropFilter)||su(t.filter))||jfe.test(t.willChange||"")||zfe.test(t.contain||"")}function Mfe(e){let t=gd(e);for(;Uc(t)&&!eg(t);){if(IE(t))return t;if(Py(t))return null;t=gd(t)}return null}function $E(){return Sw==null&&(Sw=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Sw}function eg(e){return/^(html|body|#document)$/.test(Gf(e))}function xa(e){return us(e).getComputedStyle(e)}function Ty(e){return va(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function gd(e){if(Gf(e)==="html")return e;const t=e.assignedSlot||e.parentNode||GR(e)&&e.host||kl(e);return GR(t)?t.host:t}function uH(e){const t=gd(e);return eg(t)?(e.ownerDocument||e).body:Uc(t)&&Oy(t)?t:uH(t)}function tg(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=uH(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=us(i);if(s){const a=VC(o);return t.concat(o,o.visualViewport||[],Oy(i)?i:[],a&&n?tg(a):[])}else return t.concat(i,tg(i,[],n))}function VC(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dH(e){const t=xa(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Uc(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,a=nb(n)!==s||nb(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function RE(e){return va(e)?e:e.contextElement}function Nh(e){const t=RE(e);if(!Uc(t))return ol(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=dH(t);let o=(s?nb(n.width):n.width)/r,a=(s?nb(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Ife=ol(0);function hH(e){const t=us(e);return!$E()||!t.visualViewport?Ife:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function $fe(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===us(e)}function vd(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=RE(e);let o=ol(1);t&&(r?va(r)&&(o=Nh(r)):o=Nh(e));const a=$fe(s,n,r)?hH(s):ol(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,h=i.height/o.y;if(s&&r){const f=us(s),p=va(r)?us(r):r;let g=f,v=VC(g);for(;v&&p!==g;){const x=Nh(v),b=v.getBoundingClientRect(),y=xa(v),w=b.left+(v.clientLeft+parseFloat(y.paddingLeft))*x.x,S=b.top+(v.clientTop+parseFloat(y.paddingTop))*x.y;l*=x.x,c*=x.y,u*=x.x,h*=x.y,l+=w,c+=S,g=us(v),v=VC(g)}}return ib({width:u,height:h,x:l,y:c})}function Ay(e,t){const n=Ty(e).scrollLeft;return t?t.left+n:vd(kl(e)).left+n}function fH(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ay(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function Rfe(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=kl(r),a=t?Py(t.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=ol(1);const u=ol(0),h=Uc(r);if((h||!s)&&((Gf(r)!=="body"||Oy(o))&&(l=Ty(r)),h)){const p=vd(r);c=Nh(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const f=o&&!h&&!s?fH(o,l):ol(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}}function Ofe(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Pfe(e){const t=Ty(e),n=e.ownerDocument.body,r=sl(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=sl(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+Ay(e);const o=-t.scrollTop;return xa(n).direction==="rtl"&&(s+=sl(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:s,y:o}}const Tfe=25;function Afe(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",i=us(e),s=kl(e),o=i.visualViewport;let a=s.clientWidth,l=s.clientHeight,c=0,u=0;if(o){const f=!$E()||t==="fixed";r?f||(c=-o.offsetLeft,u=-o.offsetTop):(a=o.width,l=o.height,f&&(c=o.offsetLeft,u=o.offsetTop))}if(Ay(s)<=0){const f=s.ownerDocument,p=f.body,g=getComputedStyle(p),v=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,x=Math.abs(s.clientWidth-p.clientWidth-v),b=getComputedStyle(s).scrollbarGutter==="stable both-edges"?x/2:x;b<=Tfe&&(a-=b)}return{width:a,height:l,x:c,y:u}}function Dfe(e,t){const n=vd(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=Nh(e),o=e.clientWidth*s.x,a=e.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function YR(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=Afe(e,n,t);else if(t==="document")r=Pfe(kl(e));else if(va(t))r=Dfe(t,n);else{const i=hH(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return ib(r)}function Lfe(e,t){const n=t.get(e);if(n)return n;let r=tg(e,[],!1).filter(a=>va(a)&&Gf(a)!=="body"),i=null;const s=xa(e).position==="fixed";let o=s?gd(e):e;for(;va(o)&&!eg(o);){const a=xa(o),l=IE(o),c=i?i.position:s?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?r=r.filter(h=>h!==o):i=a,o=gd(o)}return t.set(e,r),r}function Ffe(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?Py(t)?[]:Lfe(t,this._c):[].concat(n),r],a=YR(t,o[0],i);let l=a.top,c=a.right,u=a.bottom,h=a.left;for(let f=1;f<o.length;f++){const p=YR(t,o[f],i);l=sl(p.top,l),c=Ic(p.right,c),u=Ic(p.bottom,u),h=sl(p.left,h)}return{width:c-h,height:u-l,x:h,y:l}}function Bfe(e){const{width:t,height:n}=dH(e);return{width:t,height:n}}function Hfe(e,t,n){const r=Uc(t),i=kl(t),s=n==="fixed",o=vd(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=ol(0);if((r||!s)&&((Gf(t)!=="body"||Oy(i))&&(a=Ty(t)),r)){const f=vd(t,!0,s,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}!r&&i&&(l.x=Ay(i));const c=i&&!r&&!s?fH(i,a):ol(0),u=o.left+a.scrollLeft-l.x-c.x,h=o.top+a.scrollTop-l.y-c.y;return{x:u,y:h,width:o.width,height:o.height}}function _w(e){return xa(e).position==="static"}function ZR(e,t){if(!Uc(e)||xa(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return kl(e)===n&&(n=n.ownerDocument.body),n}function pH(e,t){const n=us(e);if(Py(e))return n;if(!Uc(e)){let i=gd(e);for(;i&&!eg(i);){if(va(i)&&!_w(i))return i;i=gd(i)}return n}let r=ZR(e,t);for(;r&&Efe(r)&&_w(r);)r=ZR(r,t);return r&&eg(r)&&_w(r)&&!IE(r)?n:r||Mfe(e)||n}const Vfe=async function(e){const t=this.getOffsetParent||pH,n=this.getDimensions,r=await n(e.floating);return{reference:Hfe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Wfe(e){return xa(e).direction==="rtl"}const qfe={convertOffsetParentRelativeRectToViewportRelativeRect:Rfe,getDocumentElement:kl,getClippingRect:Ffe,getOffsetParent:pH,getElementRects:Vfe,getClientRects:Ofe,getDimensions:Bfe,getScale:Nh,isElement:va,isRTL:Wfe};function mH(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ufe(e,t,n){let r=null,i;const s=kl(e);function o(){var u;clearTimeout(i),(u=r)==null||u.disconnect(),r=null}function a(u,h){u===void 0&&(u=!1),h===void 0&&(h=1),o();const f=e.getBoundingClientRect(),{left:p,top:g,width:v,height:x}=f;if(u||t(),!v||!x)return;const b=ov(g),y=ov(s.clientWidth-(p+v)),w=ov(s.clientHeight-(g+x)),S=ov(p),_={rootMargin:-b+"px "+-y+"px "+-w+"px "+-S+"px",threshold:sl(0,Ic(1,h))||1};let k=!0;function z(j){const N=j[0].intersectionRatio;if(!mH(f,e.getBoundingClientRect()))return a();if(N!==h){if(!k)return a();N?a(!1,N):i=setTimeout(()=>{a(!1,1e-7)},1e3)}k=!1}try{r=new IntersectionObserver(z,{..._,root:s.ownerDocument})}catch{r=new IntersectionObserver(z,_)}r.observe(e)}const l=us(e),c=()=>a(n);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),o()}}function Kfe(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=RE(e),u=i||s?[...c?tg(c):[],...t?tg(t):[]]:[];u.forEach(b=>{i&&b.addEventListener("scroll",n),s&&b.addEventListener("resize",n)});const h=c&&a?Ufe(c,n,s):null;let f=-1,p=null;o&&(p=new ResizeObserver(b=>{let[y]=b;y&&y.target===c&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),c&&!l&&p.observe(c),t&&p.observe(t));let g,v=l?vd(e):null;l&&x();function x(){const b=vd(e);v&&!mH(v,b)&&n(),v=b,g=requestAnimationFrame(x)}return n(),()=>{var b;u.forEach(y=>{i&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),h==null||h(),(b=p)==null||b.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const Gfe=_fe,Yfe=Cfe,Zfe=yfe,Xfe=Nfe,Qfe=wfe,XR=bfe,Jfe=kfe,epe=(e,t,n)=>{const r=new Map,i=n??{},s={...qfe,...i.platform,_c:r};return xfe(e,t,{...i,platform:s})};var tpe=typeof document<"u",npe=function(){},ix=tpe?m.useLayoutEffect:npe;function sb(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!sb(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!sb(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function gH(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function QR(e,t){const n=gH(e);return Math.round(t*n)/n}function Cw(e){const t=m.useRef(e);return ix(()=>{t.current=e}),t}function rpe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,h]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=m.useState(r);sb(f,r)||p(r);const[g,v]=m.useState(null),[x,b]=m.useState(null),y=m.useCallback(A=>{A!==_.current&&(_.current=A,v(A))},[]),w=m.useCallback(A=>{A!==k.current&&(k.current=A,b(A))},[]),S=s||g,C=o||x,_=m.useRef(null),k=m.useRef(null),z=m.useRef(u),j=l!=null,N=Cw(l),$=Cw(i),R=Cw(c),P=m.useCallback(()=>{if(!_.current||!k.current)return;const A={placement:t,strategy:n,middleware:f};$.current&&(A.platform=$.current),epe(_.current,k.current,A).then(H=>{const I={...H,isPositioned:R.current!==!1};E.current&&!sb(z.current,I)&&(z.current=I,ki.flushSync(()=>{h(I)}))})},[f,t,n,$,R]);ix(()=>{c===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,h(A=>({...A,isPositioned:!1})))},[c]);const E=m.useRef(!1);ix(()=>(E.current=!0,()=>{E.current=!1}),[]),ix(()=>{if(S&&(_.current=S),C&&(k.current=C),S&&C){if(N.current)return N.current(S,C,P);P()}},[S,C,P,N,j]);const M=m.useMemo(()=>({reference:_,floating:k,setReference:y,setFloating:w}),[y,w]),T=m.useMemo(()=>({reference:S,floating:C}),[S,C]),D=m.useMemo(()=>{const A={position:n,left:0,top:0};if(!T.floating)return A;const H=QR(T.floating,u.x),I=QR(T.floating,u.y);return a?{...A,transform:"translate("+H+"px, "+I+"px)",...gH(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:I}},[n,a,T.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:P,refs:M,elements:T,floatingStyles:D}),[u,P,M,T,D])}const ipe=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?XR({element:r.current,padding:i}).fn(n):{}:r?XR({element:r,padding:i}).fn(n):{}}}},spe=(e,t)=>{const n=Gfe(e);return{name:n.name,fn:n.fn,options:[e,t]}},ope=(e,t)=>{const n=Yfe(e);return{name:n.name,fn:n.fn,options:[e,t]}},ape=(e,t)=>({fn:Jfe(e).fn,options:[e,t]}),lpe=(e,t)=>{const n=Zfe(e);return{name:n.name,fn:n.fn,options:[e,t]}},cpe=(e,t)=>{const n=Xfe(e);return{name:n.name,fn:n.fn,options:[e,t]}},upe=(e,t)=>{const n=Qfe(e);return{name:n.name,fn:n.fn,options:[e,t]}},dpe=(e,t)=>{const n=ipe(e);return{name:n.name,fn:n.fn,options:[e,t]}};var hpe=Object.defineProperty,fpe=(e,t)=>hpe(e,"name",{value:t,configurable:!0});function vH(e){const[t,n]=m.useState(void 0);return io(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let r=0;const i=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];window.cancelAnimationFrame(r),r=window.requestAnimationFrame(()=>{let a,l;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})})});return i.observe(e,{box:"border-box"}),()=>{window.cancelAnimationFrame(r),i.unobserve(e)}}else n(void 0)},[e]),t}fpe(vH,"useSize");var ppe=Object.defineProperty,wc=(e,t)=>ppe(e,"name",{value:t,configurable:!0}),JR={Partial:"partial"},eO={Optimized:"optimized",Always:"always"},xH="Popper",[bH,yH]=kE(xH),[mpe,wH]=bH(xH),gpe=wc(e=>{const{__scopePopper:t,children:n}=e,[r,i]=m.useState(null),[s,o]=m.useState(void 0);return d.jsx(mpe,{scope:t,anchor:r,onAnchorChange:i,placementState:s,setPlacementState:o,children:n})},"Popper"),vpe="PopperAnchor",xpe=m.forwardRef(wc(function(t,n){const{__scopePopper:r,virtualRef:i,...s}=t,o=wH(vpe,r),a=m.useRef(null),l=o.onAnchorChange,c=m.useCallback(v=>{a.current=v,v&&l(v)},[l]),u=qc(n,c),h=m.useRef(null);m.useEffect(()=>{if(!i)return;const v=h.current;h.current=i.current,v!==h.current&&l(h.current)});const f=o.placementState&&Dy(o.placementState),p=f==null?void 0:f[0],g=f==null?void 0:f[1];return i?null:d.jsx(Uf.div,{"data-radix-popper-side":p,"data-radix-popper-align":g,...s,ref:u})},"PopperAnchor")),SH="PopperContent",[bpe,BFe]=bH(SH),ype=m.forwardRef(wc(function(t,n){var ae,ne,ie,oe,G,le,me;const{__scopePopper:r,side:i="bottom",sideOffset:s=0,align:o="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:h=0,sticky:f=JR.Partial,hideWhenDetached:p=!1,updatePositionStrategy:g=eO.Optimized,onPlaced:v,...x}=t,b=wH(SH,r),[y,w]=m.useState(null),S=qc(n,w),[C,_]=m.useState(null),k=vH(C),z=(k==null?void 0:k.width)??0,j=(k==null?void 0:k.height)??0,N=i+(o!=="center"?"-"+o:""),$=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},R=Array.isArray(u)?u:[u],P=R.length>0,E={padding:$,boundary:R.filter(_H),altBoundary:P},{refs:M,floatingStyles:T,placement:D,isPositioned:A,middlewareData:H}=rpe({strategy:"fixed",placement:N,whileElementsMounted:wc((...Y)=>Kfe(...Y,{animationFrame:g===eO.Always}),"whileElementsMounted"),elements:{reference:b.anchor},middleware:[spe({mainAxis:s+j,alignmentAxis:a}),c&&ope({mainAxis:!0,crossAxis:!1,...f===JR.Partial?{limiter:ape()}:{},...E}),c&&lpe({...E}),cpe({...E,apply:wc(({elements:Y,rects:ge,availableWidth:ye,availableHeight:re})=>{const{width:Ee,height:Ie}=ge.reference,Pe=Y.floating.style;Pe.setProperty("--radix-popper-available-width",`${ye}px`),Pe.setProperty("--radix-popper-available-height",`${re}px`),Pe.setProperty("--radix-popper-anchor-width",`${Ee}px`),Pe.setProperty("--radix-popper-anchor-height",`${Ie}px`)},"apply")}),C&&dpe({element:C,padding:l}),wpe({arrowWidth:z,arrowHeight:j}),p&&upe(P?{strategy:"referenceHidden",...E}:{strategy:"referenceHidden",padding:E.padding,altBoundary:E.altBoundary})]}),I=b.setPlacementState;io(()=>(I(D),()=>{I(void 0)}),[D,I]);const[B,L]=Dy(D),O=h0(v);io(()=>{A&&(O==null||O())},[A,O]);const W=(ae=H.arrow)==null?void 0:ae.x,F=(ne=H.arrow)==null?void 0:ne.y,U=((ie=H.arrow)==null?void 0:ie.centerOffset)!==0,[X,Q]=m.useState();return io(()=>{y&&Q(window.getComputedStyle(y).zIndex)},[y]),d.jsx("div",{ref:M.setFloating,"data-radix-popper-content-wrapper":"",style:{...T,transform:A?T.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:X,"--radix-popper-transform-origin":[(oe=H.transformOrigin)==null?void 0:oe.x,(G=H.transformOrigin)==null?void 0:G.y].join(" "),...((le=H.hide)==null?void 0:le.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:d.jsx(bpe,{scope:r,placedSide:B,placedAlign:L,onArrowChange:_,arrowX:W,arrowY:F,shouldHideArrow:U,children:d.jsx(Uf.div,{"data-side":B,"data-align":L,...x,ref:S,style:{...x.style,animation:A?(me=x.style)==null?void 0:me.animation:"none"}})})})},"PopperContent"));function _H(e){return e!==null}wc(_H,"isNotNull");var wpe=wc(e=>({name:"transformOrigin",options:e,fn(t){var x,b,y;const{placement:n,rects:r,middlewareData:i}=t,o=((x=i.arrow)==null?void 0:x.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[c,u]=Dy(n),h={start:"0%",center:"50%",end:"100%"}[u],f=(((b=i.arrow)==null?void 0:b.x)??0)+a/2,p=(((y=i.arrow)==null?void 0:y.y)??0)+l/2;let g="",v="";return c==="bottom"?(g=o?h:`${f}px`,v=`${-l}px`):c==="top"?(g=o?h:`${f}px`,v=`${r.floating.height+l}px`):c==="right"?(g=`${-l}px`,v=o?h:`${p}px`):c==="left"&&(g=`${r.floating.width+l}px`,v=o?h:`${p}px`),{data:{x:g,y:v}}}}),"transformOrigin");function Dy(e){const[t,n="center"]=e.split("-");return[t,n]}wc(Dy,"getSideAndAlignFromPlacement");var Spe=Object.defineProperty,_pe=(e,t)=>Spe(e,"name",{value:t,configurable:!0}),Cpe=m.forwardRef(_pe(function(t,n){var l;const{container:r,...i}=t,[s,o]=m.useState(!1);io(()=>o(!0),[]);const a=r||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return a?ki.createPortal(d.jsx(Uf.div,{...i,ref:n}),a):null},"Portal")),kpe=Object.defineProperty,ml=(e,t)=>kpe(e,"name",{value:t,configurable:!0});function CH(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}ml(CH,"useStateMachine");var kH=ml(e=>{const{present:t,children:n}=e,r=NH(t),i=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),s=EH(r.ref,jH(i));return typeof n=="function"||r.isPresent?m.cloneElement(i,{ref:s}):null},"Presence");function NH(e){const[t,n]=m.useState(),r=m.useRef(null),i=m.useRef(e),s=m.useRef("none"),o=m.useRef(void 0),a=e?"mounted":"unmounted",[l,c]=CH(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{l==="mounted"?(s.current=o.current??oh(r.current),o.current=void 0):s.current="none"},[l]),io(()=>{const u=r.current,h=i.current;if(h!==e){const p=s.current,g=oh(u);e?(o.current=g,c("MOUNT")):g==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(h&&p!==g?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),io(()=>{if(t){let u;const h=t.ownerDocument.defaultView??window,f=ml(g=>{const x=oh(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&x&&(c("ANIMATION_END"),!i.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",u=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},"handleAnimationEnd"),p=ml(g=>{g.target===t&&(s.current=oh(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{h.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:m.useCallback(u=>{if(u){const h=getComputedStyle(u);r.current=h,o.current=oh(h)}else r.current=null;n(u)},[])}}ml(NH,"usePresence");function WC(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}ml(WC,"setRef");function EH(...e){const t=m.useRef(e);return t.current=e,m.useCallback(n=>{const r=t.current;let i=!1;const s=r.map(o=>{const a=WC(o,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let o=0;o<s.length;o++){const a=s[o];typeof a=="function"?a():WC(r[o],null)}}},[])}ml(EH,"useStableComposedRefs");function oh(e){return(e==null?void 0:e.animationName)||"none"}ml(oh,"getAnimationName");function jH(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}ml(jH,"getElementRef");var Npe=Object.defineProperty,Epe=(e,t)=>Npe(e,"name",{value:t,configurable:!0}),tO=Ca[" useEffectEvent ".trim().toString()],nO=Ca[" useInsertionEffect ".trim().toString()];function zH(e){if(typeof tO=="function")return tO(e);const t=m.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof nO=="function"?nO(()=>{t.current=e}):io(()=>{t.current=e}),m.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}Epe(zH,"useEffectEvent");var jpe=Object.defineProperty,f0=(e,t)=>jpe(e,"name",{value:t,configurable:!0}),zpe=Ca[" useInsertionEffect ".trim().toString()]||io;function MH({prop:e,defaultProp:t,onChange:n=f0(()=>{},"onChange"),caller:r}){const[i,s,o]=IH({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:i,c=m.useCallback(u=>{var h;if(a){const f=$H(u)?u(e):u;f!==e&&((h=o.current)==null||h.call(o,f))}else s(u)},[a,e,s,o]);return[l,c]}f0(MH,"useControllableState");function IH({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),i=m.useRef(n),s=m.useRef(t);return zpe(()=>{s.current=t},[t]),m.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}f0(IH,"useUncontrolledState");function $H(e){return typeof e=="function"}f0($H,"isFunction");var rO=Symbol("RADIX:SYNC_STATE");function Mpe(e,t,n,r){const{prop:i,defaultProp:s,onChange:o,caller:a}=t,l=i!==void 0,c=zH(o),u=[{...n,state:s}];r&&u.push(r);const[h,f]=m.useReducer((x,b)=>{if(b.type===rO)return{...x,state:b.state};const y=e(x,b);return l&&!Object.is(y.state,x.state)&&c(y.state),y},...u),p=h.state,g=m.useRef(p);m.useEffect(()=>{g.current!==p&&(g.current=p,l||c(p))},[p,g,l]);const v=m.useMemo(()=>i!==void 0?{...h,state:i}:h,[h,i]);return m.useEffect(()=>{l&&!Object.is(i,h.state)&&f({type:rO,state:i})},[i,h.state,l]),[v,f]}f0(Mpe,"useControllableStateReducer");var Ipe=Object.defineProperty,$pe=(e,t)=>Ipe(e,"name",{value:t,configurable:!0}),Rpe=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Ope=m.forwardRef($pe(function(t,n){return d.jsx(Uf.span,{...t,ref:n,style:{...Rpe,...t.style}})},"VisuallyHidden")),Ppe=Object.defineProperty,Br=(e,t)=>Ppe(e,"name",{value:t,configurable:!0}),[OE,HFe]=kE("Tooltip",[yH]),PE=yH(),Tpe="TooltipProvider",Ape=700,qC="tooltip.open",[Dpe,TE]=OE(Tpe),Lpe=Br(e=>{const{__scopeTooltip:t,delayDuration:n=Ape,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,o=m.useRef(!0),a=m.useRef(!1),l=m.useRef(0);return m.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),d.jsx(Dpe,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:m.useCallback(()=>{r<=0||(window.clearTimeout(l.current),o.current=!1)},[r]),onClose:m.useCallback(()=>{r<=0||(window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:a,onPointerInTransitChange:m.useCallback(c=>{a.current=c},[]),disableHoverableContent:i,children:s})},"TooltipProvider"),UC="Tooltip",[Fpe,p0]=OE(UC),RH=Br(e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=e,l=TE(UC,e.__scopeTooltip),c=PE(t),[u,h]=m.useState(null),[f,p]=m.useState(void 0),g=sH(),v=m.useRef(0),x=o??l.disableHoverableContent,b=a??l.delayDuration,y=m.useRef(!1),[w,S]=MH({prop:r,defaultProp:i??!1,onChange:Br(N=>{N?(l.onOpen(),document.dispatchEvent(new CustomEvent(qC))):l.onClose(),s==null||s(N)},"onChange"),caller:UC}),C=m.useMemo(()=>w?y.current?"delayed-open":"instant-open":"closed",[w]),_=m.useCallback(()=>{window.clearTimeout(v.current),v.current=0,y.current=!1,S(!0)},[S]),k=m.useCallback(()=>{window.clearTimeout(v.current),v.current=0,S(!1)},[S]),z=m.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{y.current=!0,S(!0),v.current=0},b)},[b,S]);m.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]);const j=f??g;return d.jsx(gpe,{...c,children:d.jsx(Fpe,{scope:t,contentId:j,setContentId:p,open:w,stateAttribute:C,trigger:u,onTriggerChange:h,onTriggerEnter:m.useCallback(()=>{l.isOpenDelayedRef.current?z():_()},[l.isOpenDelayedRef,z,_]),onTriggerLeave:m.useCallback(()=>{x?k():(window.clearTimeout(v.current),v.current=0)},[k,x]),onOpen:_,onClose:k,disableHoverableContent:x,children:n})})},"Tooltip"),iO="TooltipTrigger",OH=m.forwardRef(Br(function(t,n){const{__scopeTooltip:r,"aria-describedby":i,...s}=t,o=p0(iO,r),a=TE(iO,r),l=PE(r),c=m.useRef(null),u=qc(n,c,o.onTriggerChange),h=m.useRef(!1),f=m.useRef(!1),p=m.useCallback(()=>h.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),d.jsx(xpe,{asChild:!0,...l,children:d.jsx(Uf.button,{"aria-describedby":o.open?WH(i,o.contentId):i,"data-state":o.stateAttribute,...s,ref:u,onPointerMove:na(t.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!a.isPointerInTransitRef.current&&(o.onTriggerEnter(),f.current=!0)}),onPointerLeave:na(t.onPointerLeave,()=>{o.onTriggerLeave(),f.current=!1}),onPointerDown:na(t.onPointerDown,()=>{o.open&&o.onClose(),h.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:na(t.onFocus,()=>{h.current||o.onOpen()}),onBlur:na(t.onBlur,o.onClose),onClick:na(t.onClick,o.onClose)})})},"TooltipTrigger")),PH="TooltipPortal",[Bpe,Hpe]=OE(PH,{forceMount:void 0}),TH=Br(e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=p0(PH,t);return d.jsx(Bpe,{scope:t,forceMount:n,children:d.jsx(kH,{present:n||s.open,children:d.jsx(Cpe,{asChild:!0,container:i,children:r})})})},"TooltipPortal"),ng="TooltipContent",Vpe=m.forwardRef(Br(function(t,n){const r=Hpe(ng,t.__scopeTooltip),{forceMount:i=r.forceMount,side:s="top",...o}=t,a=p0(ng,t.__scopeTooltip);return d.jsx(kH,{present:i||a.open,children:a.disableHoverableContent?d.jsx(AH,{side:s,...o,ref:n}):d.jsx(Wpe,{side:s,...o,ref:n})})},"TooltipContent")),Wpe=m.forwardRef(Br(function(t,n){const r=p0(ng,t.__scopeTooltip),i=TE(ng,t.__scopeTooltip),s=m.useRef(null),o=qc(n,s),[a,l]=m.useState(null),{trigger:c,onClose:u}=r,h=s.current,{onPointerInTransitChange:f}=i,p=m.useCallback(()=>{l(null),f(!1)},[f]),g=m.useCallback((v,x)=>{const b=v.currentTarget,y={x:v.clientX,y:v.clientY},w=DH(y,b.getBoundingClientRect()),S=LH(y,w),C=FH(x.getBoundingClientRect()),_=HH([...S,...C]);l(_),f(!0)},[f]);return m.useEffect(()=>()=>p(),[p]),m.useEffect(()=>{if(c&&h){const v=Br(b=>g(b,h),"handleTriggerLeave"),x=Br(b=>g(b,c),"handleContentLeave");return c.addEventListener("pointerleave",v),h.addEventListener("pointerleave",x),()=>{c.removeEventListener("pointerleave",v),h.removeEventListener("pointerleave",x)}}},[c,h,g,p]),m.useEffect(()=>{if(a){const v=Br(x=>{const b=x.target,y={x:x.clientX,y:x.clientY},w=(c==null?void 0:c.contains(b))||(h==null?void 0:h.contains(b)),S=!BH(y,a);w?p():S&&(p(),u())},"handleTrackPointerGrace");return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[c,h,a,u,p]),d.jsx(AH,{...t,ref:o})},"TooltipContentHoverable")),qpe=H8("TooltipContent"),AH=m.forwardRef(Br(function(t,n){const{__scopeTooltip:r,children:i,"aria-label":s,id:o,onEscapeKeyDown:a,onPointerDownOutside:l,...c}=t,u=p0(ng,r),h=PE(r),{onClose:f}=u,[p,g]=m.useState(null),v=qc(n,g);eH(p),m.useEffect(()=>(document.addEventListener(qC,f),()=>document.removeEventListener(qC,f)),[f]),m.useEffect(()=>{if(u.trigger){const b=Br(y=>{y.target instanceof Node&&y.target.contains(u.trigger)&&f()},"handleScroll");return window.addEventListener("scroll",b,{capture:!0}),()=>window.removeEventListener("scroll",b,{capture:!0})}},[u.trigger,f]);const{setContentId:x}=u;return io(()=>(x(o),()=>{x(void 0)}),[o,x]),d.jsx(Khe,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:b=>b.preventDefault(),onDismiss:f,children:d.jsxs(ype,{"data-state":u.stateAttribute,role:s?void 0:"tooltip",id:s?void 0:u.contentId,...h,...c,ref:v,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[d.jsx(qpe,{children:i}),s?d.jsx(Ope,{id:u.contentId,role:"tooltip",children:s}):null]})})},"TooltipContentImpl"));function DH(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}Br(DH,"getExitSideFromRect");function LH(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}Br(LH,"getPaddedExitPoints");function FH(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}Br(FH,"getPointsFromRect");function BH(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s],l=t[o],c=a.x,u=a.y,h=l.x,f=l.y;u>r!=f>r&&n<(h-c)*(r-u)/(f-u)+c&&(i=!i)}return i}Br(BH,"isPointInPolygon");function HH(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),VH(t)}Br(HH,"getHull");function VH(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}Br(VH,"getHullPresorted");function WH(...e){const t=new Set;for(const n of e)if(typeof n=="string")for(const r of String(n).trim().split(/\s+/))r&&t.add(r);return t.size>0?Array.from(t).join(" "):void 0}Br(WH,"concatAriaDescribedby");function on({content:e,children:t,side:n,align:r,hoverOnly:i=!1}){return e?d.jsxs(RH,{children:[d.jsx(OH,{asChild:!0,...i?{onFocus:s=>s.preventDefault()}:{},children:t}),d.jsx(TH,{children:d.jsx(UH,{content:e,side:n,align:r})})]}):d.jsx(d.Fragment,{children:t})}function qH({content:e,children:t,className:n=""}){return e?d.jsxs(RH,{children:[d.jsx(OH,{asChild:!0,children:d.jsx("span",{className:n,children:t})}),d.jsx(TH,{children:d.jsx(UH,{content:e})})]}):d.jsx("span",{className:n,children:t})}function UH({content:e,side:t,align:n}){return d.jsx(Vpe,{side:t,align:n,sideOffset:8,collisionPadding:8,className:"ui-tooltip pointer-events-none z-[60] max-h-[46vh] max-w-[460px] overflow-hidden whitespace-pre-wrap break-words rounded-lg border border-zinc-200 bg-white px-2.5 py-2 text-[12px] leading-5 text-zinc-700 shadow-[0_10px_30px_rgba(24,24,27,.14)]",children:e})}function Upe({children:e}){return d.jsx(Lpe,{delayDuration:120,skipDelayDuration:300,disableHoverableContent:!0,children:e})}function Ea(e=6e3){const[t,n]=M8.useMessage({maxCount:1}),r="agentdock-toast";return{toast:n,show:(i,s="error")=>{if(!i){t.destroy(r);return}t.open({key:r,type:s==="error"?"error":"info",content:i,duration:e/1e3})},clear:()=>t.destroy(r)}}function Kpe({enabled:e}){const t=Ea(8e3),n=Fn(),r=It({queryKey:["autostart"],queryFn:Ne.autostartStatus,enabled:e,retry:!1,refetchOnWindowFocus:!1}),i=bt({mutationFn:Ne.setAutostart,onSuccess:a=>n.setQueryData(["autostart"],a),onError:a=>{t.show(a.message),r.refetch()}}),s=r.data;if(!(s!=null&&s.supported))return null;const o=i.isPending?!!i.variables:s.enabled;return d.jsxs("div",{className:"flex h-[34px] items-center gap-1 text-[12px]",children:[d.jsx(on,{content:s.enabled?`登录时自动运行 agent-dock start(${s.plistPath})`:"登录 macOS 后自动在后台启动 AgentDock",children:d.jsx("span",{className:"min-w-0 flex-1 truncate",children:"开机自启"})}),d.jsx(Xi,{size:"small",className:"!ml-auto shrink-0","aria-label":"开机自启",checked:o,loading:i.isPending,onChange:a=>i.mutate(a)})]})}function Gpe({enabled:e}){var h,f,p,g;const t=Ea(8e3),n=Fn(),r=It({queryKey:["keep-awake"],queryFn:Ne.keepAwakeStatus,enabled:e,retry:!1,refetchOnWindowFocus:!1}),i=bt({mutationFn:Ne.setKeepAwake,scope:{id:"keep-awake"},onSuccess:v=>n.setQueryData(["keep-awake"],v),onError:v=>{t.show(v.message),r.refetch()}}),s=r.data;if(!(s!=null&&s.supported))return null;const o=i.isPending,a=o&&((h=i.variables)==null?void 0:h.enabled)!==void 0?i.variables.enabled:s.enabled,l=o&&((f=i.variables)==null?void 0:f.keepDisplay)!==void 0?i.variables.keepDisplay:s.keepDisplay,c=o&&((p=i.variables)==null?void 0:p.enabled)!==void 0,u=o&&((g=i.variables)==null?void 0:g.keepDisplay)!==void 0;return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex h-[34px] items-center gap-1 text-[12px]",children:[d.jsx(on,{content:"AgentDock 运行期间用 caffeinate -imsu 阻止 Mac 空闲休眠;daemon 退出后自动释放,下次启动按上次选择恢复",children:d.jsx("span",{className:"min-w-0 flex-1 truncate",children:"永不休眠"})}),d.jsx(Xi,{size:"small",className:"!ml-auto shrink-0","aria-label":"永不休眠",checked:a,loading:c,disabled:u,onChange:v=>i.mutate({enabled:v})})]}),d.jsxs("div",{className:`flex h-[34px] items-center gap-1 pl-4 text-[12px] transition-opacity ${a?"":"opacity-50"}`,children:[d.jsx(on,{content:"额外加 -d,阻止显示器休眠以保持屏幕常亮;关闭主开关时保留这个偏好",children:d.jsx("span",{className:"min-w-0 flex-1 truncate",children:"屏幕常亮"})}),d.jsx(Xi,{size:"small",className:"!ml-auto shrink-0","aria-label":"保持屏幕常亮",disabled:!a||c,checked:l,loading:u,onChange:v=>i.mutate({keepDisplay:v})})]}),t.toast]})}function KH(){var e;return typeof window>"u"||(e=window.agentdockDesktop)==null?void 0:e.update}function GH(){const e=KH(),[t,n]=m.useState();m.useEffect(()=>{if(!e)return;let i=!0;const s=e.subscribe(o=>{i&&n(o)});return e.getState().then(o=>{i&&n(o)}).catch(()=>{}),()=>{i=!1,e.unsubscribe(s)}},[e]);const r=m.useCallback(async i=>{if(!e)return;const s=await e[i]();return n(s),s},[e]);return{api:e,state:t,check:()=>r("check"),download:()=>r("download"),install:()=>r("install")}}function Ype(e){return!!(e&&["available","downloading","downloaded","installing"].includes(e.phase))}function KC(e){if(!e||e<=0)return"0 B";const t=["B","KB","MB","GB"];let n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=100||r===0?Math.round(n):n.toFixed(1)} ${t[r]}`}function Zpe(e){return e&&e>0?`${KC(e)}/s`:""}function Xpe(e){return e.total?`${KC(e.transferred)} / ${KC(e.total)}`:""}function Qpe(e){const t=Number(e.percent);return Number.isFinite(t)?Math.max(0,Math.min(100,t)):0}function er({size:e=14,className:t="",label:n="加载中"}){return d.jsx("span",{role:"status","aria-label":n,className:`inline-block shrink-0 animate-spin rounded-full border-[1.5px] border-current border-r-transparent opacity-70 ${t}`,style:{width:e,height:e}})}const GC="agentdock:theme",YC=new Set,Eh=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):void 0;function Ly(){try{const e=localStorage.getItem(GC);return e==="light"||e==="dark"?e:"system"}catch{return"system"}}const YH=e=>e==="system"?Eh!=null&&Eh.matches?"dark":"light":e;function ZH(){var t;const e=YH(Ly());document.documentElement.dataset.theme=e,(t=document.querySelector('meta[name="theme-color"]'))==null||t.setAttribute("content",e==="dark"?"#212121":"#ffffff"),YC.forEach(n=>n())}function Jpe(e){try{e==="system"?localStorage.removeItem(GC):localStorage.setItem(GC,e)}catch{}ZH()}Eh==null||Eh.addEventListener("change",()=>{Ly()==="system"&&ZH()});const XH=e=>(YC.add(e),()=>{YC.delete(e)}),eme=()=>m.useSyncExternalStore(XH,Ly,()=>"system"),QH=()=>m.useSyncExternalStore(XH,()=>YH(Ly()),()=>"light");var pp={},kw={exports:{}},sO;function Fy(){return sO||(sO=1,(function(e){function t(n){return n&&n.__esModule?n:{default:n}}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})(kw)),kw.exports}var mp={},oO;function tme(){if(oO)return mp;oO=1,Object.defineProperty(mp,"__esModule",{value:!0}),mp.default=void 0;var e={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页",page_size:"页码"};return mp.default=e,mp}var gp={},vp={},xp={},Nw={exports:{}},Ew={exports:{}},jw={exports:{}},zw={exports:{}},aO;function JH(){return aO||(aO=1,(function(e){function t(n){"@babel/helpers - typeof";return e.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})(zw)),zw.exports}var Mw={exports:{}},lO;function nme(){return lO||(lO=1,(function(e){var t=JH().default;function n(r,i){if(t(r)!="object"||!r)return r;var s=r[Symbol.toPrimitive];if(s!==void 0){var o=s.call(r,i||"default");if(t(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports})(Mw)),Mw.exports}var cO;function rme(){return cO||(cO=1,(function(e){var t=JH().default,n=nme();function r(i){var s=n(i,"string");return t(s)=="symbol"?s:s+""}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports})(jw)),jw.exports}var uO;function ime(){return uO||(uO=1,(function(e){var t=rme();function n(r,i,s){return(i=t(i))in r?Object.defineProperty(r,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):r[i]=s,r}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports})(Ew)),Ew.exports}var dO;function sme(){return dO||(dO=1,(function(e){var t=ime();function n(i,s){var o=Object.keys(i);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(i);s&&(a=a.filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable})),o.push.apply(o,a)}return o}function r(i){for(var s=1;s<arguments.length;s++){var o=arguments[s]!=null?arguments[s]:{};s%2?n(Object(o),!0).forEach(function(a){t(i,a,o[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach(function(a){Object.defineProperty(i,a,Object.getOwnPropertyDescriptor(o,a))})}return i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports})(Nw)),Nw.exports}var bp={},hO;function ome(){return hO||(hO=1,Object.defineProperty(bp,"__esModule",{value:!0}),bp.commonLocale=void 0,bp.commonLocale={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0}),bp}var fO;function ame(){if(fO)return xp;fO=1;var e=Fy().default;Object.defineProperty(xp,"__esModule",{value:!0}),xp.default=void 0;var t=e(sme()),n=ome(),r=(0,t.default)((0,t.default)({},n.commonLocale),{},{locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",week:"周",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪",yearFormat:"YYYY年",cellDateFormat:"D",monthBeforeYear:!1});return xp.default=r,xp}var yp={},pO;function e9(){if(pO)return yp;pO=1,Object.defineProperty(yp,"__esModule",{value:!0}),yp.default=void 0;const e={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]};return yp.default=e,yp}var mO;function t9(){if(mO)return vp;mO=1;var e=Fy().default;Object.defineProperty(vp,"__esModule",{value:!0}),vp.default=void 0;var t=e(ame()),n=e(e9());const r={lang:Object.assign({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},t.default),timePickerLocale:Object.assign({},n.default)};return r.lang.ok="确定",vp.default=r,vp}var gO;function lme(){if(gO)return gp;gO=1;var e=Fy().default;Object.defineProperty(gp,"__esModule",{value:!0}),gp.default=void 0;var t=e(t9());return gp.default=t.default,gp}var vO;function cme(){if(vO)return pp;vO=1;var e=Fy().default;Object.defineProperty(pp,"__esModule",{value:!0}),pp.default=void 0;var t=e(tme()),n=e(lme()),r=e(t9()),i=e(e9());const s="${label}不是一个有效的${type}",o={locale:"zh-cn",Pagination:t.default,DatePicker:r.default,TimePicker:i.default,Calendar:n.default,global:{placeholder:"请选择",close:"关闭"},Table:{filterTitle:"筛选",filterConfirm:"确定",filterReset:"重置",filterEmptyText:"无筛选项",filterCheckAll:"全选",filterSearchPlaceholder:"在筛选项中搜索",emptyText:"暂无数据",selectAll:"全选当页",selectInvert:"反选当页",selectNone:"清空所有",selectionAll:"全选所有",sortTitle:"排序",expand:"展开行",collapse:"关闭行",triggerDesc:"点击降序",triggerAsc:"点击升序",cancelSort:"取消排序"},Modal:{okText:"确定",cancelText:"取消",justOkText:"知道了"},Tour:{Next:"下一步",Previous:"上一步",Finish:"结束导览"},Popconfirm:{cancelText:"取消",okText:"确定"},Transfer:{titles:["",""],searchPlaceholder:"请输入搜索内容",itemUnit:"项",itemsUnit:"项",remove:"删除",selectCurrent:"全选当页",removeCurrent:"删除当页",selectAll:"全选所有",deselectAll:"取消全选",removeAll:"删除全部",selectInvert:"反选当页"},Upload:{uploading:"文件上传中",removeFile:"删除文件",uploadError:"上传错误",previewFile:"预览文件",downloadFile:"下载文件"},Empty:{description:"暂无数据"},Icon:{icon:"图标"},Text:{edit:"编辑",copy:"复制",copied:"复制成功",expand:"展开",collapse:"收起"},Form:{optional:"(可选)",defaultValidateMessages:{default:"字段验证错误${label}",required:"请输入${label}",enum:"${label}必须是其中一个[${enum}]",whitespace:"${label}不能为空字符",date:{format:"${label}日期格式无效",parse:"${label}不能转换为日期",invalid:"${label}是一个无效日期"},types:{string:s,method:s,array:s,object:s,number:s,date:s,boolean:s,integer:s,float:s,regexp:s,email:s,url:s,hex:s},string:{len:"${label}须为${len}个字符",min:"${label}最少${min}个字符",max:"${label}最多${max}个字符",range:"${label}须在${min}-${max}字符之间"},number:{len:"${label}必须等于${len}",min:"${label}最小值为${min}",max:"${label}最大值为${max}",range:"${label}须在${min}-${max}之间"},array:{len:"须为${len}个${label}",min:"最少${min}个${label}",max:"最多${max}个${label}",range:"${label}数量须在${min}-${max}之间"},pattern:{mismatch:"${label}与模式不匹配${pattern}"}}},Image:{preview:"预览"},QRCode:{expired:"二维码过期",refresh:"点击刷新",scanned:"已扫描"},ColorPicker:{presetEmpty:"暂无",transparent:"无色",singleColor:"单色",gradientColor:"渐变色"}};return pp.default=o,pp}var Iw,xO;function ume(){return xO||(xO=1,Iw=cme()),Iw}var dme=ume();const hme=ns(dme);var sx={exports:{}},fme=sx.exports,bO;function pme(){return bO||(bO=1,(function(e,t){(function(n,r){e.exports=r(V4())})(fme,(function(n){function r(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var i=r(n),s={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(o,a){return a==="W"?o+"周":o+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(o,a){var l=100*o+a;return l<600?"凌晨":l<900?"早上":l<1100?"上午":l<1300?"中午":l<1800?"下午":"晚上"}};return i.default.locale(s,null,!0),s}))})(sx)),sx.exports}pme();Dr.locale("zh-cn");function mme({children:e}){const t=QH()==="dark",n=t?{ink:"#f0f1f4",hover:"#d4d6dc",border:"#343740",placeholder:"#777c87",fill:"#272a31",fillHover:"#343740",mid:"#969ba6",outline:"rgba(150, 155, 166, .25)",link:"#7daaff",surface:"#181a1f"}:{ink:"#18181b",hover:"#3f3f46",border:"#e4e4e7",placeholder:"#a1a1aa",fill:"#f4f4f5",fillHover:"#e4e4e7",mid:"#71717a",outline:"rgba(161, 161, 170, .2)",link:"#2563eb",surface:"#ffffff"};return d.jsx(LQ,{hashPriority:"high",children:d.jsx(_l,{locale:hme,button:{autoInsertSpace:!1},theme:{algorithm:t?FR.darkAlgorithm:FR.defaultAlgorithm,token:{colorPrimary:n.ink,colorTextLightSolid:t?"#0e0f12":"#ffffff",colorLink:n.link,colorBorder:n.border,colorBgContainer:n.surface,colorBgElevated:n.surface,colorTextPlaceholder:n.placeholder,borderRadius:8,fontSize:12,controlHeight:32,controlHeightLG:36,fontSizeLG:13,borderRadiusLG:8,fontFamily:"inherit",zIndexPopupBase:1100,colorPrimaryHover:n.hover,controlOutline:n.outline,controlItemBgActive:n.fill,controlItemBgActiveHover:n.fillHover},components:{Segmented:{itemSelectedColor:n.ink,trackBg:n.fill},DatePicker:{cellActiveWithRangeBg:n.fill,activeBorderColor:n.mid,hoverBorderColor:n.placeholder},Input:{activeBorderColor:n.mid,hoverBorderColor:n.placeholder},Select:{optionSelectedBg:n.fill,optionSelectedFontWeight:500,activeBorderColor:n.mid,hoverBorderColor:n.placeholder}}},children:e})})}function gme(){return!!document.querySelector(".ant-picker-dropdown:not(.ant-picker-dropdown-hidden), .ant-select-dropdown:not(.ant-select-dropdown-hidden), .ant-dropdown:not(.ant-dropdown-hidden)")}const vme='button:not([disabled]), [href], input:not([disabled]), [tabindex]:not([tabindex="-1"])';function Vo(e){const{panel:t,initial:n,dismissible:r,onDismiss:i}=e,s=m.useRef(void 0),o=Cn(i);Xb(()=>{s.current=document.activeElement instanceof HTMLElement?document.activeElement:void 0,requestAnimationFrame(()=>{var a;return(a=n.current)==null?void 0:a.focus()})}),Qg(()=>{var a;return(a=s.current)==null?void 0:a.focus()}),kr("keydown",a=>{var h;if(a.key==="Escape"&&r&&!gme()){a.preventDefault(),o();return}if(a.key!=="Tab")return;const l=[...((h=t.current)==null?void 0:h.querySelectorAll(vme))??[]];if(!l.length)return;const c=l[0],u=l.at(-1);a.shiftKey&&document.activeElement===c?(a.preventDefault(),u.focus()):!a.shiftKey&&document.activeElement===u&&(a.preventDefault(),c.focus())},{target:()=>document})}function Ro({label:e,disabled:t,active:n,onClick:r,children:i}){const s=d.jsx("button",{type:"button","aria-label":e,"aria-pressed":n,disabled:t,onClick:r,className:`grid h-8 w-8 place-items-center rounded-lg transition-[color,background-color,transform] duration-200 hover:bg-zinc-100 hover:text-zinc-900 active:scale-[.96] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400/50 disabled:pointer-events-none disabled:opacity-30 ${n?"bg-zinc-100 text-zinc-900":"text-zinc-500"}`,children:i});return d.jsx(on,{content:e,children:s})}function Wi({title:e,description:t,children:n,className:r=""}){return d.jsxs("div",{className:`flex flex-col gap-2.5 border-t border-zinc-100 px-4 py-3.5 first:border-t-0 min-[520px]:flex-row min-[520px]:items-center min-[520px]:gap-4 ${r}`,children:[d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsx("div",{className:"text-[14px] text-zinc-900",children:e}),t&&d.jsx("div",{className:"mt-0.5 text-[12px] leading-5 text-zinc-500",children:t})]}),d.jsx("div",{className:"flex shrink-0 items-center min-[520px]:justify-end",children:n})]})}function Rs({open:e,...t}){return d.jsx(fN,{open:e,children:d.jsx(xme,{...t})})}function xme({title:e,description:t,confirmLabel:n,tone:r="warning",busy:i=!1,error:s,onConfirm:o,onCancel:a}){const l=m.useRef(null),c=m.useRef(null);Vo({panel:l,initial:c,dismissible:!i,onDismiss:a});const u=r==="danger";return d.jsx("div",{className:"ui-overlay fixed inset-0 z-50 grid place-items-center bg-zinc-950/35 p-4",onMouseDown:h=>{!i&&h.currentTarget===h.target&&a()},children:d.jsxs("div",{ref:l,role:"alertdialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title","aria-describedby":"confirm-dialog-description",className:"ui-dialog w-full max-w-[420px] overflow-hidden rounded-[14px] border border-zinc-200 bg-white shadow-[0_28px_90px_rgba(24,24,27,.24)]",children:[d.jsxs("div",{className:"flex gap-3.5 px-5 pb-4 pt-5",children:[d.jsx("div",{className:`grid h-10 w-10 shrink-0 place-items-center rounded-xl ${u?"bg-red-50 text-red-600 ring-1 ring-red-100":"bg-amber-50 text-amber-700 ring-1 ring-amber-100"}`,children:d.jsx(fl,{size:19,strokeWidth:1.8})}),d.jsxs("div",{className:"min-w-0 pt-0.5",children:[d.jsx("h2",{id:"confirm-dialog-title",className:"text-[16px] font-semibold tracking-[-.01em] text-zinc-900",children:e}),d.jsx("p",{id:"confirm-dialog-description",className:"mt-1.5 text-[12px] leading-5 text-zinc-500",children:t})]})]}),s&&d.jsx("div",{className:"mx-5 mb-4 rounded-lg border border-red-100 bg-red-50 px-3 py-2 text-[12px] leading-4 text-red-700",children:s}),d.jsxs("div",{className:"flex justify-end gap-2 border-t border-zinc-100 bg-zinc-50/70 px-5 py-3.5",children:[d.jsx(Pn,{ref:c,size:"large",disabled:i,onClick:a,children:"取消"}),d.jsx(Pn,{type:"primary",danger:u,size:"large",loading:i,onClick:o,className:"min-w-24",children:i?"处理中":n})]})]})})}const bme=5*6e4;function yme(e,t,n){return t&&t.currentVersion!==e?{phase:"done",version:t.currentVersion}:t&&!t.updating&&t.lastError?{phase:"failed",message:t.lastError}:n>bme?{phase:"failed",message:"升级超时,请在终端执行 agent-dock status 查看服务状态"}:{phase:"pending"}}function $o(e){const t=/^(\d+\.\d+\.\d+)(?:-([a-zA-Z][\w-]*))?/.exec(e.trim());return t?`${t[1]}${t[2]?`-${t[2]}`:""}`:e}const $w="h-7 shrink-0 rounded-md px-2 text-[12px] font-medium text-zinc-900 transition-colors hover:bg-zinc-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400/50 disabled:cursor-not-allowed disabled:text-zinc-400";function wme(){const e=Ea(8e3),t=GH(),[n,r]=m.useState(!1),[i,s]=m.useState(!1),o=t.state;if(!o)return null;const a=o.phase==="checking",l=o.phase==="downloading",c=o.phase==="installing"||i,u=a||l||c,h=o.latestVersion,f=Qpe(o),p=Xpe(o),g=Zpe(o.bytesPerSecond),v=o.phase!=="unsupported"&&!u&&o.phase!=="downloaded",x=["available","downloading","downloaded","installing","error"].includes(o.phase),b=async()=>{const S=await t.check();S&&(S.phase==="idle"?e.show(`已是最新版本(${$o(S.currentVersion)})`,"info"):S.phase==="error"?e.show(S.error??"检查更新失败"):S.phase==="available"&&S.latestVersion&&e.show(`发现新版本 ${$o(S.latestVersion)}`,"info"))},y=async()=>{const S=await t.download();(S==null?void 0:S.phase)==="error"&&e.show(S.error??"下载更新失败")},w=async()=>{s(!0);try{await t.install()}catch(S){s(!1),e.show(S instanceof Error?S.message:String(S))}};return d.jsxs(d.Fragment,{children:[x&&d.jsxs("div",{className:"relative mb-2 flex min-h-9 items-center gap-2 overflow-hidden rounded-lg border border-zinc-200 bg-white/80 pl-2.5 pr-1 text-[12px] text-zinc-600 shadow-[0_1px_2px_rgba(24,24,27,.04)]",children:[o.phase==="error"?d.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-red-500"}):u||o.phase==="downloading"?d.jsx(er,{size:13,className:"shrink-0 text-zinc-400"}):d.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500"}),o.phase==="available"&&d.jsxs(d.Fragment,{children:[d.jsx(on,{content:h?`新版本 ${h}`:"新版本",children:d.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["新版本 ",d.jsx("span",{className:"font-mono text-zinc-800",children:$o(h??"")})," 可用"]})}),d.jsx(on,{content:"下载安装包并在应用内安装,完成后应用会自动重启",children:d.jsx("button",{type:"button",onClick:()=>void y(),className:$w,children:"下载并升级"})})]}),l&&d.jsxs(d.Fragment,{children:[d.jsx(on,{content:[p,g].filter(Boolean).join(" · ")||"正在下载安装包",children:d.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["正在下载",h?d.jsxs(d.Fragment,{children:[" ",d.jsx("span",{className:"font-mono text-zinc-800",children:$o(h)})]}):""," · ",Math.round(f),"%"]})}),d.jsx("span",{className:"h-7 shrink-0 px-2 text-[11px] leading-7 tabular-nums text-zinc-400",children:g})]}),o.phase==="downloaded"&&d.jsxs(d.Fragment,{children:[d.jsx(on,{content:h?`新版本 ${h} 已下载完成`:"更新包已下载完成",children:d.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["新版本 ",d.jsx("span",{className:"font-mono text-zinc-800",children:$o(h??"")})," 已下载"]})}),d.jsx(on,{content:"退出应用、安装新版本并重新启动",children:d.jsx("button",{type:"button",onClick:()=>r(!0),className:$w,children:"重启并安装"})})]}),c&&d.jsx(d.Fragment,{children:d.jsx("span",{className:"min-w-0 flex-1 truncate",children:"正在重启并安装更新…"})}),o.phase==="error"&&d.jsxs(d.Fragment,{children:[d.jsx(on,{content:o.error??"更新失败",children:d.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["更新失败,",o.error?o.error:"请重试"]})}),d.jsx(on,{content:"重新检查更新",children:d.jsx("button",{type:"button",onClick:()=>void b(),className:$w,children:"重试"})})]}),l&&d.jsx("span",{className:"absolute inset-x-0 bottom-0 h-0.5 bg-zinc-100",children:d.jsx("span",{className:"block h-full bg-emerald-500 transition-[width] duration-300",style:{width:`${f}%`}})})]}),d.jsxs("div",{className:"flex h-8 items-center gap-1 text-[12px]",children:[d.jsx(on,{content:`当前版本 ${o.currentVersion}`,children:d.jsxs("span",{className:"min-w-0 truncate",children:["AgentDock ",d.jsx("span",{className:"font-mono",children:$o(o.currentVersion)})]})}),o.phase!=="unsupported"&&d.jsx(on,{content:a?"正在检查更新":o.phase==="downloaded"?"更新已下载,重启后安装":"检查更新",children:d.jsx("button",{type:"button","aria-label":"检查更新",disabled:!v,onClick:()=>void b(),className:"grid h-7 w-7 shrink-0 place-items-center rounded-md text-zinc-400 transition-colors duration-150 hover:bg-white hover:text-zinc-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400/50 disabled:pointer-events-none",children:d.jsx(Wn,{size:13,strokeWidth:2,className:a?"animate-spin text-zinc-500":""})})})]}),ki.createPortal(d.jsxs(d.Fragment,{children:[d.jsx(Rs,{open:n,title:`重启并安装 ${h?$o(h):"新版本"}?`,description:"会退出 AgentDock、安装新版本并自动重新打开,正在执行的任务会被中断。",confirmLabel:"重启并安装",busy:c,onConfirm:()=>void w(),onCancel:()=>r(!1)}),e.toast]}),document.body)]})}function Sme({enabled:e}){return KH()?d.jsx(wme,{}):d.jsx(_me,{enabled:e})}function _me({enabled:e}){const t=Ea(8e3),[n,r]=m.useState(!1),[i,s]=m.useState(!1),[o,a]=m.useState(),l=Fn(),c=It({queryKey:["self-update"],queryFn:()=>Ne.selfUpdateStatus(),enabled:e,retry:!1,refetchInterval:5*6e4,refetchOnWindowFocus:!1}),u=bt({mutationFn:()=>Ne.selfUpdateStatus(!0),onSuccess:b=>{l.setQueryData(["self-update"],b),b.checkError?t.show(b.checkError):b.updateAvailable||t.show(`已是最新版本(${$o(b.currentVersion)})`,"info")},onError:b=>t.show(b.message)}),h=bt({mutationFn:Ne.startSelfUpdate,onSuccess:b=>{r(!1),a({fromVersion:b.currentVersion,...b.latestVersion?{targetVersion:b.latestVersion}:{},startedAt:Date.now()})}});gN(async()=>{if(!o)return;const b=await Ne.selfUpdateStatus().catch(()=>{}),y=yme(o.fromVersion,b,Date.now()-o.startedAt);if(y.phase!=="pending"){if(a(void 0),y.phase==="failed"){t.show(y.message),c.refetch();return}t.show(`已升级到 ${y.version},即将刷新页面`,"info"),window.setTimeout(()=>window.location.reload(),1500)}},o?2e3:void 0);const f=c.data;if(!f)return null;const p=!!o||f.updating,g=(o==null?void 0:o.targetVersion)??f.latestVersion,v=p||f.updateAvailable&&f.latestVersion,x=f.runtime==="foreground"?`当前是前台运行的 AgentDock 进程,界面无法重启它。请先在终端按 Ctrl-C 停止,再执行 npm install -g @agent-dock/cli@${f.distTag},然后重新启动;需要后台常驻可改用 agent-dock start。`:`桌面版请在 AgentDock 应用内升级;浏览器访问时请在运行服务的那台机器上执行 npm install -g @agent-dock/cli@${f.distTag} && agent-dock restart。`;return d.jsxs(d.Fragment,{children:[v&&d.jsxs("div",{className:"mb-2 flex h-9 items-center gap-2 rounded-lg border border-zinc-200 bg-white/80 pl-2.5 pr-1 text-[12px] text-zinc-600 shadow-[0_1px_2px_rgba(24,24,27,.04)]",children:[p?d.jsx(er,{size:13,className:"shrink-0 text-zinc-400"}):d.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500"}),d.jsx(on,{content:g?`${f.distTag} 通道 ${g}`:"新版本",children:d.jsx("span",{className:"min-w-0 flex-1 truncate",children:p?"正在升级,完成后自动刷新":d.jsxs(d.Fragment,{children:["新版本 ",d.jsx("span",{className:"font-mono text-zinc-800",children:$o(g)})," 可用"]})})}),!p&&d.jsx(on,{content:f.canUpdate?"安装新版本并重启服务":"查看手动升级方式",children:d.jsx("button",{type:"button",onClick:()=>{if(!f.canUpdate){s(!0);return}h.reset(),r(!0)},className:"h-7 shrink-0 rounded-md px-2 text-[12px] font-medium text-zinc-900 transition-colors hover:bg-zinc-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400/50",children:"升级"})})]}),d.jsxs("div",{className:"flex h-8 items-center gap-1 text-[12px]",children:[d.jsx(on,{content:f.currentVersion,children:d.jsxs("span",{className:"min-w-0 truncate",children:["AgentDock ",d.jsx("span",{className:"font-mono",children:$o(f.currentVersion)})]})}),!v&&d.jsx(on,{content:u.isPending?"正在检查更新":"检查更新",children:d.jsx("button",{type:"button","aria-label":"检查更新",disabled:u.isPending,onClick:()=>u.mutate(),className:"grid h-7 w-7 shrink-0 place-items-center rounded-md text-zinc-400 transition-colors duration-150 hover:bg-white hover:text-zinc-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400/50 disabled:pointer-events-none",children:d.jsx(Wn,{size:13,strokeWidth:2,className:u.isPending?"animate-spin text-zinc-500":""})})})]}),ki.createPortal(d.jsxs(d.Fragment,{children:[d.jsx(Rs,{open:n,title:`升级到 ${f.latestVersion?$o(f.latestVersion):"新版本"}?`,description:"会安装新版本并重启 AgentDock 服务,正在执行的任务会被中断,页面会在升级完成后自动刷新。",confirmLabel:"升级并重启",busy:h.isPending,...h.error?{error:h.error.message}:{},onConfirm:()=>h.mutate(),onCancel:()=>r(!1)}),d.jsx(Rs,{open:i,title:"需要手动升级",description:x,confirmLabel:"知道了",onConfirm:()=>s(!1),onCancel:()=>s(!1)}),t.toast]}),document.body)]})}const yO=[{mode:"light",label:"浅色",icon:GX},{mode:"system",label:"跟随系统",icon:PX},{mode:"dark",label:"深色",icon:TX}];function Cme(){const e=eme(),t=yO.findIndex(n=>n.mode===e);return d.jsxs("div",{role:"radiogroup","aria-label":"主题",className:"relative grid grid-cols-3 rounded-lg bg-zinc-100 p-0.5",children:[d.jsx("span",{"aria-hidden":"true",className:"absolute inset-y-0.5 left-0.5 w-[calc((100%-4px)/3)] rounded-md bg-white shadow-sm ring-1 ring-zinc-200 transition-transform duration-200 ease-[cubic-bezier(.2,0,0,1)]",style:{transform:`translateX(${t*100}%)`}}),yO.map(({mode:n,label:r,icon:i})=>d.jsxs("button",{type:"button",role:"radio","aria-checked":e===n,"aria-label":r,title:r,onClick:()=>Jpe(n),className:`relative z-10 flex h-7 items-center justify-center gap-1 rounded-md text-[12px] transition-colors ${e===n?"text-zinc-900":"text-zinc-400 hover:text-zinc-600"}`,children:[d.jsx(i,{size:13}),r]},n))]})}function m0(e,t,n){kr("pointerdown",r=>{var i;(i=e.current)!=null&&i.contains(r.target)||n()},{target:()=>document,enable:t})}const ou="flex h-[34px] w-full items-center gap-2.5 rounded-lg px-2.5 text-[14px] font-medium text-zinc-600 transition-colors duration-150 hover:bg-zinc-100 hover:text-zinc-900";function kme({webDenied:e,archivedCount:t,onSchedule:n,onArchived:r,onImport:i,onAgentConfig:s,onAssistant:o,onLark:a,onLarkAvatar:l,onShare:c}){var b,y;const[u,h]=m.useState(!1),f=m.useRef(null);m0(f,u,()=>h(!1)),kr("keydown",w=>{w.key==="Escape"&&h(!1)},{target:()=>document,enable:u});const p=GH(),g=It({queryKey:["self-update"],queryFn:()=>Ne.selfUpdateStatus(),enabled:!e&&!p.api,retry:!1,refetchInterval:5*6e4,refetchOnWindowFocus:!1}),v=p.api?Ype(p.state):!!((b=g.data)!=null&&b.updateAvailable||(y=g.data)!=null&&y.updating),x=w=>()=>{h(!1),w()};return d.jsxs("div",{ref:f,className:"relative flex min-w-[268px] items-center gap-1 border-t border-zinc-200 p-2",children:[d.jsxs("div",{role:"menu","aria-label":"设置",style:{transformOrigin:"bottom center"},"aria-hidden":!u,inert:!u,className:`absolute inset-x-2 bottom-full z-30 mb-1 max-h-[75dvh] overflow-y-auto rounded-xl border border-zinc-200 bg-white p-1.5 shadow-[0_-12px_36px_rgba(12,13,16,.14)] transition-[opacity,transform,visibility] duration-200 ease-[cubic-bezier(.2,0,0,1)] ${u?"visible translate-y-0 opacity-100":"invisible translate-y-1.5 opacity-0"}`,children:[d.jsxs("button",{type:"button",role:"menuitem",onClick:x(n),className:ou,children:[d.jsx(dl,{size:16}),d.jsx("span",{children:"定时任务"})]}),d.jsxs("button",{type:"button",role:"menuitem",onClick:x(r),className:ou,children:[d.jsx(jd,{size:16}),d.jsx("span",{children:"归档会话"}),d.jsx("span",{className:"ml-auto text-[12px] tabular-nums text-zinc-400",children:t})]}),d.jsxs("button",{type:"button",role:"menuitem",onClick:x(i),className:ou,children:[d.jsx(fa,{size:16}),d.jsx("span",{children:"导入外部会话"})]}),d.jsx("div",{className:"my-1 border-t border-zinc-200/70"}),d.jsxs("button",{type:"button",role:"menuitem",onClick:x(s),className:ou,children:[d.jsx(ii,{size:16}),d.jsx("span",{children:"Agent 设置"})]}),d.jsxs("button",{type:"button",role:"menuitem",onClick:x(o),className:ou,children:[d.jsx(ps,{size:16}),d.jsx("span",{children:"小猫与督办"})]}),d.jsxs("button",{type:"button",role:"menuitem",onClick:x(a),className:ou,children:[d.jsx(ty,{size:16}),d.jsx("span",{children:"飞书设置"})]}),d.jsxs("button",{type:"button",role:"menuitem",onClick:x(l),className:ou,children:[d.jsx(ii,{size:16}),d.jsx("span",{children:"AI 飞书替身"})]}),d.jsx("div",{className:"my-1 border-t border-zinc-200/70"}),d.jsxs("div",{className:"px-2.5 py-1",children:[d.jsx("div",{className:"mb-1.5 text-[12px] text-zinc-500",children:"外观"}),d.jsx(Cme,{})]}),d.jsxs("div",{className:"px-2.5 py-1 text-[12px] text-zinc-600",children:[d.jsx(Kpe,{enabled:!e}),d.jsx(Gpe,{enabled:!e})]}),d.jsx("div",{className:"mt-1 border-t border-zinc-200/70 px-2.5 pb-1 pt-2 text-[12px] text-zinc-400",children:d.jsx(Sme,{enabled:!e})})]}),d.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":u,onClick:()=>h(w=>!w),className:`flex h-9 min-w-0 flex-1 items-center gap-2.5 rounded-lg px-2.5 text-[14px] font-medium transition-colors duration-150 ${u?"bg-zinc-100 text-zinc-900":"text-zinc-600 hover:bg-zinc-100 hover:text-zinc-900"}`,children:[d.jsx(qX,{size:16,className:`transition-transform duration-300 ease-[cubic-bezier(.2,0,0,1)] ${u?"rotate-90":""}`}),d.jsx("span",{children:"设置"}),v&&d.jsxs("span",{className:"ml-auto flex items-center gap-1 text-[12px] font-normal text-emerald-600",children:[d.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 ui-status-pulse"}),"有新版本"]})]}),d.jsx(on,{content:"在手机上打开(扫码)",children:d.jsx("button",{type:"button",onClick:()=>{h(!1),c()},"aria-label":"在手机上打开",className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg text-zinc-600 transition-colors duration-150 hover:bg-zinc-100 hover:text-zinc-900",children:d.jsx(KL,{size:16})})})]})}var Nme=Object.defineProperty,ob=Object.getOwnPropertySymbols,n9=Object.prototype.hasOwnProperty,r9=Object.prototype.propertyIsEnumerable,wO=(e,t,n)=>t in e?Nme(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ZC=(e,t)=>{for(var n in t||(t={}))n9.call(t,n)&&wO(e,n,t[n]);if(ob)for(var n of ob(t))r9.call(t,n)&&wO(e,n,t[n]);return e},XC=(e,t)=>{var n={};for(var r in e)n9.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ob)for(var r of ob(e))t.indexOf(r)<0&&r9.call(e,r)&&(n[r]=e[r]);return n};/**
|
|
861
|
+
`]:{paddingInlineEnd:n},[`&-affix-wrapper${t}-affix-wrapper`]:{padding:0,[`> textarea${t}`]:{fontSize:"inherit",border:"none",outline:"none",background:"transparent",minHeight:e.calc(e.controlHeight).sub(e.calc(e.lineWidth).mul(2)).equal(),"&:focus":{boxShadow:"none !important"}},[`${t}-suffix`]:{margin:0,"> *:not(:last-child)":{marginInline:0},[`${t}-clear-icon`]:{position:"absolute",insetInlineEnd:e.paddingInline,insetBlockStart:e.paddingXS},[`${r}-suffix`]:{position:"absolute",top:0,insetInlineEnd:e.paddingInline,bottom:0,zIndex:1,display:"inline-flex",alignItems:"center",margin:"auto",pointerEvents:"none"}}},[`&-affix-wrapper${t}-affix-wrapper-rtl`]:{[`${t}-suffix`]:{[`${t}-data-count`]:{direction:"ltr",insetInlineStart:0}}},[`&-affix-wrapper${t}-affix-wrapper-sm`]:{[`${t}-suffix`]:{[`${t}-clear-icon`]:{insetInlineEnd:e.paddingInlineSM}}}}}},Ude=li(["Input","TextArea"],e=>{const t=Dn(e,Vf(e));return qde(t)},Wf,{resetFont:!1});var Kde=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const Gde=m.forwardRef((e,t)=>{var n;const{prefixCls:r,bordered:i=!0,size:s,disabled:o,status:a,allowClear:l,classNames:c,rootClassName:u,className:h,style:f,styles:p,variant:g,showCount:v,onMouseDown:x,onResize:b}=e,y=Kde(e,["prefixCls","bordered","size","disabled","status","allowClear","classNames","rootClassName","className","style","styles","variant","showCount","onMouseDown","onResize"]),{getPrefixCls:w,direction:S,allowClear:C,autoComplete:_,className:k,style:z,classNames:j,styles:N}=Sl("textArea"),$=m.useContext(Ts),R=o??$,{status:P,hasFeedback:E,feedbackIcon:M}=m.useContext(As),T=Md(P,a),D=m.useRef(null);m.useImperativeHandle(t,()=>{var Y;return{resizableTextArea:(Y=D.current)===null||Y===void 0?void 0:Y.resizableTextArea,focus:ge=>{var ye,re;bE((re=(ye=D.current)===null||ye===void 0?void 0:ye.resizableTextArea)===null||re===void 0?void 0:re.textArea,ge)},blur:()=>{var ge;return(ge=D.current)===null||ge===void 0?void 0:ge.blur()}}});const A=w("input",r),H=Na(A),[I,B,L]=d8(A,u),[O]=Ude(A,H),{compactSize:W,compactItemClassnames:F}=Cl(A,S),U=mo(Y=>{var ge;return(ge=s??W)!==null&&ge!==void 0?ge:Y}),[X,Q]=Id("textArea",g,i),ae=S8(l??C),[ne,ie]=m.useState(!1),[oe,G]=m.useState(!1),le=Y=>{ie(!0),x==null||x(Y);const ge=()=>{ie(!1),document.removeEventListener("mouseup",ge)};document.addEventListener("mouseup",ge)},me=Y=>{var ge,ye;if(b==null||b(Y),ne&&typeof getComputedStyle=="function"){const re=(ye=(ge=D.current)===null||ge===void 0?void 0:ge.nativeElement)===null||ye===void 0?void 0:ye.querySelector("textarea");re&&getComputedStyle(re).resize==="both"&&G(!0)}};return I(O(m.createElement(Wde,Object.assign({autoComplete:_},y,{style:Object.assign(Object.assign({},z),f),styles:Object.assign(Object.assign({},N),p),disabled:R,allowClear:ae,className:Me(L,H,h,u,F,k,oe&&`${A}-textarea-affix-wrapper-resize-dirty`),classNames:Object.assign(Object.assign(Object.assign({},c),j),{textarea:Me({[`${A}-sm`]:U==="small",[`${A}-lg`]:U==="large"},B,c==null?void 0:c.textarea,j.textarea,ne&&`${A}-mouse-active`),variant:Me({[`${A}-${X}`]:Q},Mc(A,T)),affixWrapper:Me(`${A}-textarea-affix-wrapper`,{[`${A}-affix-wrapper-rtl`]:S==="rtl",[`${A}-affix-wrapper-sm`]:U==="small",[`${A}-affix-wrapper-lg`]:U==="large",[`${A}-textarea-show-count`]:v||((n=e.count)===null||n===void 0?void 0:n.show)},B)}),prefixCls:A,suffix:E&&m.createElement("span",{className:`${A}-textarea-suffix`},M),showCount:v,ref:D,onResize:me,onMouseDown:le}))))}),ir=Iy;ir.Group=yde;ir.Search=Tde;ir.TextArea=Gde;ir.Password=Ode;ir.OTP=Ede;let Js=null,_u=e=>e(),Qm=[],Jm={};function LR(){const{getContainer:e,duration:t,rtl:n,maxCount:r,top:i}=Jm,s=(e==null?void 0:e())||document.body;return{getContainer:()=>s,duration:t,rtl:n,maxCount:r,top:i}}const Yde=ze.forwardRef((e,t)=>{const{messageConfig:n,sync:r}=e,{getPrefixCls:i}=m.useContext(_n),s=Jm.prefixCls||i("message"),o=m.useContext(fse),[a,l]=z6(Object.assign(Object.assign(Object.assign({},n),{prefixCls:s}),o.message));return ze.useImperativeHandle(t,()=>{const c=Object.assign({},a);return Object.keys(c).forEach(u=>{c[u]=(...h)=>(r(),a[u].apply(a,h))}),{instance:c,sync:r}}),l}),Zde=ze.forwardRef((e,t)=>{const[n,r]=ze.useState(LR),i=()=>{r(LR)};ze.useEffect(i,[]);const s=hte(),o=s.getRootPrefixCls(),a=s.getIconPrefixCls(),l=s.getTheme(),c=ze.createElement(Yde,{ref:t,sync:i,messageConfig:n});return ze.createElement(_l,{prefixCls:o,iconPrefixCls:a,theme:l},s.holderRender?s.holderRender(c):c)}),$y=()=>{if(!Js){const e=document.createDocumentFragment(),t={fragment:e};Js=t,_u(()=>{$6()(ze.createElement(Zde,{ref:r=>{const{instance:i,sync:s}=r||{};Promise.resolve().then(()=>{!t.instance&&i&&(t.instance=i,t.sync=s,$y())})}}),e)});return}Js.instance&&(Qm.forEach(e=>{const{type:t,skipped:n}=e;if(!n)switch(t){case"open":{_u(()=>{const r=Js.instance.open(Object.assign(Object.assign({},Jm),e.config));r==null||r.then(e.resolve),e.setCloseFn(r)});break}case"destroy":_u(()=>{Js==null||Js.instance.destroy(e.key)});break;default:_u(()=>{var r;const i=(r=Js.instance)[t].apply(r,it(e.args));i==null||i.then(e.resolve),e.setCloseFn(i)})}}),Qm=[])};function Xde(e){Jm=Object.assign(Object.assign({},Jm),e),_u(()=>{var t;(t=Js==null?void 0:Js.sync)===null||t===void 0||t.call(Js)})}function Qde(e){const t=BN(n=>{let r;const i={type:"open",config:e,resolve:n,setCloseFn:s=>{r=s}};return Qm.push(i),()=>{r?_u(()=>{r()}):i.skipped=!0}});return $y(),t}function Jde(e,t){const n=BN(r=>{let i;const s={type:e,args:t,resolve:r,setCloseFn:o=>{i=o}};return Qm.push(s),()=>{i?_u(()=>{i()}):s.skipped=!0}});return $y(),n}const ehe=e=>{Qm.push({type:"destroy",key:e}),$y()},the=["success","info","warning","error","loading"],nhe={open:Qde,destroy:ehe,config:Xde,useMessage:yne,_InternalPanelDoNotUseOrYouWillBeFired:hne},M8=nhe;the.forEach(e=>{M8[e]=(...t)=>Jde(e,t)});var rhe=["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"],I8=m.forwardRef(function(e,t){var n,r=e.prefixCls,i=r===void 0?"rc-switch":r,s=e.className,o=e.checked,a=e.defaultChecked,l=e.disabled,c=e.loadingIcon,u=e.checkedChildren,h=e.unCheckedChildren,f=e.onClick,p=e.onChange,g=e.onKeyDown,v=nn(e,rhe),x=Er(!1,{value:o,defaultValue:a}),b=J(x,2),y=b[0],w=b[1];function S(z,j){var N=y;return l||(N=z,w(N),p==null||p(N,j)),N}function C(z){z.which===Gt.LEFT?S(!1,z):z.which===Gt.RIGHT&&S(!0,z),g==null||g(z)}function _(z){var j=S(!y,z);f==null||f(j,z)}var k=Me(i,s,(n={},K(n,"".concat(i,"-checked"),y),K(n,"".concat(i,"-disabled"),l),n));return m.createElement("button",rt({},v,{type:"button",role:"switch","aria-checked":y,disabled:l,className:k,ref:t,onKeyDown:C,onClick:_}),c,m.createElement("span",{className:"".concat(i,"-inner")},m.createElement("span",{className:"".concat(i,"-inner-checked")},u),m.createElement("span",{className:"".concat(i,"-inner-unchecked")},h)))});I8.displayName="Switch";const ihe=e=>{const{componentCls:t,trackHeightSM:n,trackPadding:r,trackMinWidthSM:i,innerMinMarginSM:s,innerMaxMarginSM:o,handleSizeSM:a,calc:l}=e,c=`${t}-inner`,u=Be(l(a).add(l(r).mul(2)).equal()),h=Be(l(o).mul(2).equal());return{[t]:{[`&${t}-small`]:{minWidth:i,height:n,lineHeight:Be(n),[`${t}-inner`]:{paddingInlineStart:o,paddingInlineEnd:s,[`${c}-checked, ${c}-unchecked`]:{minHeight:n},[`${c}-checked`]:{marginInlineStart:`calc(-100% + ${u} - ${h})`,marginInlineEnd:`calc(100% - ${u} + ${h})`},[`${c}-unchecked`]:{marginTop:l(n).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`${t}-handle`]:{width:a,height:a},[`${t}-loading-icon`]:{top:l(l(a).sub(e.switchLoadingIconSize)).div(2).equal(),fontSize:e.switchLoadingIconSize},[`&${t}-checked`]:{[`${t}-inner`]:{paddingInlineStart:s,paddingInlineEnd:o,[`${c}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${c}-unchecked`]:{marginInlineStart:`calc(100% - ${u} + ${h})`,marginInlineEnd:`calc(-100% + ${u} - ${h})`}},[`${t}-handle`]:{insetInlineStart:`calc(100% - ${Be(l(a).add(r).equal())})`}},[`&:not(${t}-disabled):active`]:{[`&:not(${t}-checked) ${c}`]:{[`${c}-unchecked`]:{marginInlineStart:l(e.marginXXS).div(2).equal(),marginInlineEnd:l(e.marginXXS).mul(-1).div(2).equal()}},[`&${t}-checked ${c}`]:{[`${c}-checked`]:{marginInlineStart:l(e.marginXXS).mul(-1).div(2).equal(),marginInlineEnd:l(e.marginXXS).div(2).equal()}}}}}}},she=e=>{const{componentCls:t,handleSize:n,calc:r}=e;return{[t]:{[`${t}-loading-icon${e.iconCls}`]:{position:"relative",top:r(r(n).sub(e.fontSize)).div(2).equal(),color:e.switchLoadingIconColor,verticalAlign:"top"},[`&${t}-checked ${t}-loading-icon`]:{color:e.switchColor}}}},ohe=e=>{const{componentCls:t,trackPadding:n,handleBg:r,handleShadow:i,handleSize:s,calc:o}=e,a=`${t}-handle`;return{[t]:{[a]:{position:"absolute",top:n,insetInlineStart:n,width:s,height:s,transition:`all ${e.switchDuration} ease-in-out`,"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:r,borderRadius:o(s).div(2).equal(),boxShadow:i,transition:`all ${e.switchDuration} ease-in-out`,content:'""'}},[`&${t}-checked ${a}`]:{insetInlineStart:`calc(100% - ${Be(o(s).add(n).equal())})`},[`&:not(${t}-disabled):active`]:{[`${a}::before`]:{insetInlineEnd:e.switchHandleActiveInset,insetInlineStart:0},[`&${t}-checked ${a}::before`]:{insetInlineEnd:0,insetInlineStart:e.switchHandleActiveInset}}}}},ahe=e=>{const{componentCls:t,trackHeight:n,trackPadding:r,innerMinMargin:i,innerMaxMargin:s,handleSize:o,calc:a}=e,l=`${t}-inner`,c=Be(a(o).add(a(r).mul(2)).equal()),u=Be(a(s).mul(2).equal());return{[t]:{[l]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:s,paddingInlineEnd:i,transition:`padding-inline-start ${e.switchDuration} ease-in-out, padding-inline-end ${e.switchDuration} ease-in-out`,[`${l}-checked, ${l}-unchecked`]:{display:"block",color:e.colorTextLightSolid,fontSize:e.fontSizeSM,transition:`margin-inline-start ${e.switchDuration} ease-in-out, margin-inline-end ${e.switchDuration} ease-in-out`,pointerEvents:"none",minHeight:n},[`${l}-checked`]:{marginInlineStart:`calc(-100% + ${c} - ${u})`,marginInlineEnd:`calc(100% - ${c} + ${u})`},[`${l}-unchecked`]:{marginTop:a(n).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`&${t}-checked ${l}`]:{paddingInlineStart:i,paddingInlineEnd:s,[`${l}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${l}-unchecked`]:{marginInlineStart:`calc(100% - ${c} + ${u})`,marginInlineEnd:`calc(-100% + ${c} - ${u})`}},[`&:not(${t}-disabled):active`]:{[`&:not(${t}-checked) ${l}`]:{[`${l}-unchecked`]:{marginInlineStart:a(r).mul(2).equal(),marginInlineEnd:a(r).mul(-1).mul(2).equal()}},[`&${t}-checked ${l}`]:{[`${l}-checked`]:{marginInlineStart:a(r).mul(-1).mul(2).equal(),marginInlineEnd:a(r).mul(2).equal()}}}}}},lhe=e=>{const{componentCls:t,trackHeight:n,trackMinWidth:r}=e;return{[t]:Object.assign(Object.assign(Object.assign(Object.assign({},si(e)),{position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:r,height:n,lineHeight:Be(n),verticalAlign:"middle",background:e.colorTextQuaternary,border:"0",borderRadius:100,cursor:"pointer",transition:`all ${e.motionDurationMid}`,userSelect:"none",[`&:hover:not(${t}-disabled)`]:{background:e.colorTextTertiary}}),TN(e)),{[`&${t}-checked`]:{background:e.switchColor,[`&:hover:not(${t}-disabled)`]:{background:e.colorPrimaryHover}},[`&${t}-loading, &${t}-disabled`]:{cursor:"not-allowed",opacity:e.switchDisabledOpacity,"*":{boxShadow:"none",cursor:"not-allowed"}},[`&${t}-rtl`]:{direction:"rtl"}})}},che=e=>{const{fontSize:t,lineHeight:n,controlHeight:r,colorWhite:i}=e,s=t*n,o=r/2,a=2,l=s-a*2,c=o-a*2;return{trackHeight:s,trackHeightSM:o,trackMinWidth:l*2+a*4,trackMinWidthSM:c*2+a*2,trackPadding:a,handleBg:i,handleSize:l,handleSizeSM:c,handleShadow:`0 2px 4px 0 ${new bn("#00230b").setA(.2).toRgbString()}`,innerMinMargin:l/2,innerMaxMargin:l+a+a*2,innerMinMarginSM:c/2,innerMaxMarginSM:c+a+a*2}},uhe=li("Switch",e=>{const t=Dn(e,{switchDuration:e.motionDurationMid,switchColor:e.colorPrimary,switchDisabledOpacity:e.opacityLoading,switchLoadingIconSize:e.calc(e.fontSizeIcon).mul(.75).equal(),switchLoadingIconColor:`rgba(0, 0, 0, ${e.opacityLoading})`,switchHandleActiveInset:"-30%"});return[lhe(t),ahe(t),ohe(t),she(t),ihe(t)]},che);var dhe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const hhe=m.forwardRef((e,t)=>{const{prefixCls:n,size:r,disabled:i,loading:s,className:o,rootClassName:a,style:l,checked:c,value:u,defaultChecked:h,defaultValue:f,onChange:p}=e,g=dhe(e,["prefixCls","size","disabled","loading","className","rootClassName","style","checked","value","defaultChecked","defaultValue","onChange"]),[v,x]=Er(!1,{value:c??u,defaultValue:h??f}),{getPrefixCls:b,direction:y,switch:w}=m.useContext(_n),S=m.useContext(Ts),C=(i??S)||s,_=b("switch",n),k=m.createElement("div",{className:`${_}-handle`},s&&m.createElement(dy,{className:`${_}-loading-icon`})),[z,j,N]=uhe(_),$=mo(r),R=Me(w==null?void 0:w.className,{[`${_}-small`]:$==="small",[`${_}-loading`]:s,[`${_}-rtl`]:y==="rtl"},o,a,j,N),P=Object.assign(Object.assign({},w==null?void 0:w.style),l),E=(...M)=>{x(M[0]),p==null||p.apply(void 0,M)};return z(m.createElement(fy,{component:"Switch",disabled:C},m.createElement(I8,Object.assign({},g,{checked:v,onChange:E,prefixCls:_,className:R,style:P,disabled:C,ref:t,loadingIcon:k}))))}),Xi=hhe;Xi.__ANT_SWITCH=!0;const fhe=e=>{const{paddingXXS:t,lineWidth:n,tagPaddingHorizontal:r,componentCls:i,calc:s}=e,o=s(r).sub(n).equal(),a=s(t).sub(n).equal();return{[i]:Object.assign(Object.assign({},si(e)),{display:"inline-block",height:"auto",marginInlineEnd:e.marginXS,paddingInline:o,fontSize:e.tagFontSize,lineHeight:e.tagLineHeight,whiteSpace:"nowrap",background:e.defaultBg,border:`${Be(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusSM,opacity:1,transition:`all ${e.motionDurationMid}`,textAlign:"start",position:"relative",[`&${i}-rtl`]:{direction:"rtl"},"&, a, a:hover":{color:e.defaultColor},[`${i}-close-icon`]:{marginInlineStart:a,fontSize:e.tagIconSize,color:e.colorIcon,cursor:"pointer",transition:`all ${e.motionDurationMid}`,"&:hover":{color:e.colorTextHeading}},[`&${i}-has-color`]:{borderColor:"transparent",[`&, a, a:hover, ${e.iconCls}-close, ${e.iconCls}-close:hover`]:{color:e.colorTextLightSolid}},"&-checkable":{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",[`&:not(${i}-checkable-checked):hover`]:{color:e.colorPrimary,backgroundColor:e.colorFillSecondary},"&:active, &-checked":{color:e.colorTextLightSolid},"&-checked":{backgroundColor:e.colorPrimary,"&:hover":{backgroundColor:e.colorPrimaryHover}},"&:active":{backgroundColor:e.colorPrimaryActive}},"&-hidden":{display:"none"},[`> ${e.iconCls} + span, > span + ${e.iconCls}`]:{marginInlineStart:o}}),[`${i}-borderless`]:{borderColor:"transparent",background:e.tagBorderlessBg}}},SE=e=>{const{lineWidth:t,fontSizeIcon:n,calc:r}=e,i=e.fontSizeSM;return Dn(e,{tagFontSize:i,tagLineHeight:Be(r(e.lineHeightSM).mul(i).equal()),tagIconSize:r(n).sub(r(t).mul(2)).equal(),tagPaddingHorizontal:8,tagBorderlessBg:e.defaultBg})},_E=e=>({defaultBg:new bn(e.colorFillQuaternary).onBackground(e.colorBgContainer).toHexString(),defaultColor:e.colorText}),$8=li("Tag",e=>{const t=SE(e);return fhe(t)},_E);var phe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const mhe=m.forwardRef((e,t)=>{const{prefixCls:n,style:r,className:i,checked:s,children:o,icon:a,onChange:l,onClick:c}=e,u=phe(e,["prefixCls","style","className","checked","children","icon","onChange","onClick"]),{getPrefixCls:h,tag:f}=m.useContext(_n),p=w=>{l==null||l(!s),c==null||c(w)},g=h("tag",n),[v,x,b]=$8(g),y=Me(g,`${g}-checkable`,{[`${g}-checkable-checked`]:s},f==null?void 0:f.className,i,x,b);return v(m.createElement("span",Object.assign({},u,{ref:t,style:Object.assign(Object.assign({},r),f==null?void 0:f.style),className:y,onClick:p}),a,m.createElement("span",null,o)))}),ghe=e=>n6(e,(t,{textColor:n,lightBorderColor:r,lightColor:i,darkColor:s})=>({[`${e.componentCls}${e.componentCls}-${t}`]:{color:n,background:i,borderColor:r,"&-inverse":{color:e.colorTextLightSolid,background:s,borderColor:s},[`&${e.componentCls}-borderless`]:{borderColor:"transparent"}}})),vhe=AN(["Tag","preset"],e=>{const t=SE(e);return ghe(t)},_E);function xhe(e){return typeof e!="string"?e:e.charAt(0).toUpperCase()+e.slice(1)}const sv=(e,t,n)=>{const r=xhe(n);return{[`${e.componentCls}${e.componentCls}-${t}`]:{color:e[`color${n}`],background:e[`color${r}Bg`],borderColor:e[`color${r}Border`],[`&${e.componentCls}-borderless`]:{borderColor:"transparent"}}}},bhe=AN(["Tag","status"],e=>{const t=SE(e);return[sv(t,"success","Success"),sv(t,"processing","Info"),sv(t,"error","Error"),sv(t,"warning","Warning")]},_E);var yhe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const whe=m.forwardRef((e,t)=>{const{prefixCls:n,className:r,rootClassName:i,style:s,children:o,icon:a,color:l,onClose:c,bordered:u=!0,visible:h}=e,f=yhe(e,["prefixCls","className","rootClassName","style","children","icon","color","onClose","bordered","visible"]),{getPrefixCls:p,direction:g,tag:v}=m.useContext(_n),[x,b]=m.useState(!0),y=po(f,["closeIcon","closable"]);m.useEffect(()=>{h!==void 0&&b(h)},[h]);const w=kB(l),S=qae(l),C=w||S,_=Object.assign(Object.assign({backgroundColor:l&&!C?l:void 0},v==null?void 0:v.style),s),k=p("tag",n),[z,j,N]=$8(k),$=Me(k,v==null?void 0:v.className,{[`${k}-${l}`]:C,[`${k}-has-color`]:l&&!C,[`${k}-hidden`]:!x,[`${k}-rtl`]:g==="rtl",[`${k}-borderless`]:!u},r,i,j,N),R=A=>{A.stopPropagation(),c==null||c(A),!A.defaultPrevented&&b(!1)},[,P]=ene(p$(e),p$(v),{closable:!1,closeIconRender:A=>{const H=m.createElement("span",{className:`${k}-close-icon`,onClick:R},A);return w6(A,H,I=>({onClick:B=>{var L;(L=I==null?void 0:I.onClick)===null||L===void 0||L.call(I,B),R(B)},className:Me(I==null?void 0:I.className,`${k}-close-icon`)}))}}),E=typeof f.onClick=="function"||o&&o.type==="a",M=a||null,T=M?m.createElement(m.Fragment,null,M,o&&m.createElement("span",null,o)):o,D=m.createElement("span",Object.assign({},y,{ref:t,className:$,style:_}),T,P,w&&m.createElement(vhe,{key:"preset",prefixCls:k}),S&&m.createElement(bhe,{key:"status",prefixCls:k}));return z(E?m.createElement(fy,{component:"Tag"},D):D)}),R8=whe;R8.CheckableTag=mhe;const Us=(e,t)=>new bn(e).setA(t).toRgbString(),Qd=(e,t)=>new bn(e).lighten(t).toHexString(),She=e=>{const t=fd(e,{theme:"dark"});return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[6],6:t[5],7:t[4],8:t[6],9:t[5],10:t[4]}},_he=(e,t)=>{const n=e||"#000",r=t||"#fff";return{colorBgBase:n,colorTextBase:r,colorText:Us(r,.85),colorTextSecondary:Us(r,.65),colorTextTertiary:Us(r,.45),colorTextQuaternary:Us(r,.25),colorFill:Us(r,.18),colorFillSecondary:Us(r,.12),colorFillTertiary:Us(r,.08),colorFillQuaternary:Us(r,.04),colorBgSolid:Us(r,.95),colorBgSolidHover:Us(r,1),colorBgSolidActive:Us(r,.9),colorBgElevated:Qd(n,12),colorBgContainer:Qd(n,8),colorBgLayout:Qd(n,0),colorBgSpotlight:Qd(n,26),colorBgBlur:Us(r,.04),colorBorder:Qd(n,26),colorBorderSecondary:Qd(n,19)}},Che=(e,t)=>{const n=Object.keys(RN).map(s=>{const o=fd(e[s],{theme:"dark"});return Array.from({length:10},()=>1).reduce((a,l,c)=>(a[`${s}-${c+1}`]=o[c],a[`${s}${c+1}`]=o[c],a),{})}).reduce((s,o)=>(s=Object.assign(Object.assign({},s),o),s),{}),r=t??ON(e),i=UF(e,{generateColorPalettes:She,generateNeutralColorPalettes:_he});return Object.assign(Object.assign(Object.assign(Object.assign({},r),n),i),{colorPrimaryBg:i.colorPrimaryBorder,colorPrimaryBgHover:i.colorPrimaryBorderHover})},FR={defaultSeed:Fx.token,defaultAlgorithm:ON,darkAlgorithm:Che};var khe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const{TimePicker:Nhe,RangePicker:Ehe}=Od,jhe=m.forwardRef((e,t)=>m.createElement(Ehe,Object.assign({},e,{picker:"time",mode:void 0,ref:t}))),d0=m.forwardRef((e,t)=>{var{addon:n,renderExtraFooter:r,variant:i,bordered:s}=e,o=khe(e,["addon","renderExtraFooter","variant","bordered"]);const[a]=Id("timePicker",i,s),l=m.useMemo(()=>{if(r)return r;if(n)return n},[n,r]);return m.createElement(Nhe,Object.assign({},o,{mode:void 0,ref:t,renderExtraFooter:l,variant:a}))}),O8=l0(d0,"popupAlign",void 0,"picker");d0._InternalPanelDoNotUseOrYouWillBeFired=O8;d0.RangePicker=jhe;d0._InternalPanelDoNotUseOrYouWillBeFired=O8;var zhe=Object.defineProperty,qf=(e,t)=>zhe(e,"name",{value:t,configurable:!0}),P8=!!(typeof window<"u"&&window.document&&window.document.createElement);function na(e,t,{checkForDefaultPrevented:n=!0}={}){return qf(function(i){if(e==null||e(i),n===!1||!i||!i.defaultPrevented)return t==null?void 0:t(i)},"handleEvent")}qf(na,"composeEventHandlers");function Mhe(e){var t;if(!P8)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}qf(Mhe,"getOwnerWindow");function TC(e){if(!P8)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}qf(TC,"getOwnerDocument");function T8(e,t=!1){const{activeElement:n}=TC(e);if(!(n!=null&&n.nodeName))return null;if(A8(n)&&n.contentDocument)return T8(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const i=TC(n).getElementById(r);if(i)return i}}return n}qf(T8,"getActiveElement");function A8(e){return e.tagName==="IFRAME"}qf(A8,"isFrame");var Ihe=Object.defineProperty,CE=(e,t)=>Ihe(e,"name",{value:t,configurable:!0});function AC(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}CE(AC,"setRef");function D8(...e){return t=>{let n=!1;const r=e.map(i=>{const s=AC(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():AC(e[i],null)}}}}CE(D8,"composeRefs");function qc(...e){return m.useCallback(D8(...e),e)}CE(qc,"useComposedRefs");var $he=Object.defineProperty,ro=(e,t)=>$he(e,"name",{value:t,configurable:!0});function Rhe(e,t){const n=m.createContext(t);n.displayName=e+"Context";const r=ro(s=>{const{children:o,...a}=s,l=m.useMemo(()=>a,Object.values(a));return d.jsx(n.Provider,{value:l,children:o})},"Provider");r.displayName=e+"Provider";function i(s,o={}){const{optional:a=!1}=o,l=m.useContext(n);if(l)return l;if(t!==void 0)return t;if(!a)throw new Error(`\`${s}\` must be used within \`${e}\``)}return ro(i,"useContext"),[r,i]}ro(Rhe,"createContext");function kE(e,t=[]){let n=[];function r(s,o){const a=m.createContext(o);a.displayName=s+"Context";const l=n.length;n=[...n,o];const c=ro(h=>{var b;const{scope:f,children:p,...g}=h,v=((b=f==null?void 0:f[e])==null?void 0:b[l])||a,x=m.useMemo(()=>g,Object.values(g));return d.jsx(v.Provider,{value:x,children:p})},"Provider");c.displayName=s+"Provider";function u(h,f,p={}){var b;const{optional:g=!1}=p,v=((b=f==null?void 0:f[e])==null?void 0:b[l])||a,x=m.useContext(v);if(x)return x;if(o!==void 0)return o;if(!g)throw new Error(`\`${h}\` must be used within \`${s}\``)}return ro(u,"useContext"),[c,u]}ro(r,"createContext");const i=ro(()=>{const s=n.map(o=>m.createContext(o));return ro(function(a){const l=(a==null?void 0:a[e])||s;return m.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])},"useScope")},"createScope");return i.scopeName=e,[r,L8(i,...t)]}ro(kE,"createContextScope");function L8(...e){const t=e[0];if(e.length===1)return t;const n=ro(()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return ro(function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const h=l(s)[`__scope${c}`];return{...a,...h}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}ro(L8,"composeContextScopes");var Ohe=Object.defineProperty,Ds=(e,t)=>Ohe(e,"name",{value:t,configurable:!0});function F8(e){const t=m.forwardRef((n,r)=>{let{children:i,...s}=n,o=null,a=!1;const l=[];i=K8(i),m.Children.forEach(i,f=>{var p;if(q8(f)){a=!0;const g=f;let v="child"in g.props?g.props.child:g.props.children;for(;NE(v)&&typeof tb=="function";)v=tb(v._payload);o=Phe(g,v),l.push((p=o==null?void 0:o.props)==null?void 0:p.children)}else l.push(f)}),o?o=m.cloneElement(o,void 0,l):!a&&m.Children.count(i)===1&&m.isValidElement(i)&&(o=i);const c=o?W8(o):void 0,u=qc(r,c);if(!o){if(i||i===0)throw new Error(a?Dhe(e):Ahe(e));return i}const h=V8(s,o.props??{});return o.type!==m.Fragment&&(h.ref=r?u:c),m.cloneElement(o,h)});return t.displayName=`${e}.Slot`,t}Ds(F8,"createSlot");var B8=Symbol.for("radix.slottable");function H8(e){const t=Ds(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=B8,t}Ds(H8,"createSlottable");var Phe=Ds((e,t)=>"child"in e.props?m.isValidElement(t)?m.cloneElement(t,void 0,e.props.children(t.props.children)):null:m.isValidElement(t)?t:null,"getSlottableElementFromSlottable");function V8(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"?n[r]=[i,s].filter(Boolean).join(" "):r==="aria-describedby"&&(n[r]=G8(s,i))}return{...e,...n}}Ds(V8,"mergeProps");function W8(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Ds(W8,"getElementRef");function q8(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===B8}Ds(q8,"isSlottable");var The=Symbol.for("react.lazy");function NE(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===The&&"_payload"in e&&U8(e._payload)}Ds(NE,"isLazyComponent");function U8(e){return typeof e=="object"&&e!==null&&"then"in e}Ds(U8,"isPromiseLike");function K8(e){let t=e;for(;NE(t)&&typeof tb=="function";)t=tb(t._payload);return t}Ds(K8,"useUnwrappedLazy");function G8(...e){const t=new Set;for(const n of e)if(typeof n=="string")for(const r of String(n).trim().split(/\s+/))r&&t.add(r);return t.size>0?Array.from(t).join(" "):void 0}Ds(G8,"concatAriaDescribedby");var Ahe=Ds(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),Dhe=Ds(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),tb=Ca[" use ".trim().toString()],Lhe=Object.defineProperty,Fhe=(e,t)=>Lhe(e,"name",{value:t,configurable:!0}),Bhe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Uf=Bhe.reduce((e,t)=>{const n=F8(`Primitive.${t}`),r=m.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Y8(e,t){e&&ki.flushSync(()=>e.dispatchEvent(t))}Fhe(Y8,"dispatchDiscreteCustomEvent");var io=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},Hhe=Object.defineProperty,Vhe=(e,t)=>Hhe(e,"name",{value:t,configurable:!0}),BR=Ca[" useInsertionEffect ".trim().toString()];function h0(e){const t=m.useRef(e);return typeof BR=="function"?BR(()=>{t.current=e}):io(()=>{t.current=e}),m.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}Vhe(h0,"useCallbackRef");var Whe=Object.defineProperty,ri=(e,t)=>Whe(e,"name",{value:t,configurable:!0}),DC="dismissableLayer.update",qhe="dismissableLayer.pointerDownOutside",Uhe="dismissableLayer.focusOutside",HR,Z8=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Khe=m.forwardRef(ri(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:c,...u}=t,h=m.useContext(Z8),[f,p]=m.useState(null),g=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,v]=m.useState({}),x=qc(n,p),b=Array.from(h.layers),[y]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),w=y?b.indexOf(y):-1,S=f?b.indexOf(f):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,_=S>=w,k=m.useRef(!1),z=X8(R=>{o==null||o(R),l==null||l(R),R.defaultPrevented||c==null||c()},{ownerDocument:g,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:h.dismissableSurfaces,shouldHandlePointerDownOutside:m.useCallback(R=>{if(!(R instanceof Node))return!1;const P=[...h.branches].some(E=>E.contains(R));return _&&!P},[h.branches,_])}),j=Q8(R=>{if(i&&k.current)return;const P=R.target;[...h.branches].some(M=>M.contains(P))||(a==null||a(R),l==null||l(R),R.defaultPrevented||c==null||c())},g),N=f?S===b.length-1:!1,$=h0(R=>{R.key==="Escape"&&(s==null||s(R),!R.defaultPrevented&&c&&(R.preventDefault(),c()))});return m.useEffect(()=>{if(N)return g.addEventListener("keydown",$,{capture:!0}),()=>g.removeEventListener("keydown",$,{capture:!0})},[g,N,$]),m.useEffect(()=>{if(f)return r&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(HR=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),LC(),()=>{r&&(h.layersWithOutsidePointerEventsDisabled.delete(f),h.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=HR))}},[f,g,r,h]),m.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),LC())},[f,h]),m.useEffect(()=>{const R=ri(()=>v({}),"handleUpdate");return document.addEventListener(DC,R),()=>document.removeEventListener(DC,R)},[]),d.jsx(Uf.div,{...u,ref:x,style:{pointerEvents:C?_?"auto":"none":void 0,...t.style},onFocusCapture:na(t.onFocusCapture,j.onFocusCapture),onBlurCapture:na(t.onBlurCapture,j.onBlurCapture),onPointerDownCapture:na(t.onPointerDownCapture,z.onPointerDownCapture)})},"DismissableLayer"));function Ghe(){const e=m.useContext(Z8),[t,n]=m.useState(null);return m.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}ri(Ghe,"useDismissableLayerSurface");var Yhe=ri(()=>!0,"IS_TRUE");function X8(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s,shouldHandlePointerDownOutside:o=Yhe}=t,a=h0(e),l=m.useRef(!1),c=m.useRef(!1),u=m.useRef(new Map),h=m.useRef(()=>{});return m.useEffect(()=>{function f(){c.current=!1,i.current=!1,u.current.clear()}ri(f,"resetOutsideInteraction");function p(){return Array.from(u.current.values()).some(Boolean)}ri(p,"isOutsideInteractionIntercepted");function g(w){if(!c.current)return;const S=w.target;S instanceof Node&&[...s].some(_=>_.contains(S))||u.current.set(w.type,!0),w.type==="click"&&window.setTimeout(()=>{c.current&&h.current()},0)}ri(g,"handleInteractionCapture");function v(w){c.current&&u.current.set(w.type,!1)}ri(v,"handleInteractionBubble");const x=ri(w=>{if(w.target&&!l.current){let S=function(){n.removeEventListener("click",h.current);const _=p();f(),_||EE(qhe,a,C,{discrete:!0})};if(ri(S,"handleAndDispatchPointerDownOutsideEvent"),!o(w.target)){n.removeEventListener("click",h.current),f(),l.current=!1;return}const C={originalEvent:w};c.current=!0,i.current=r&&w.button===0,u.current.clear(),!r||w.button!==0?S():(n.removeEventListener("click",h.current),h.current=S,n.addEventListener("click",h.current,{once:!0}))}else n.removeEventListener("click",h.current),f();l.current=!1},"handlePointerDown"),b=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const w of b)n.addEventListener(w,g,!0),n.addEventListener(w,v);const y=window.setTimeout(()=>{n.addEventListener("pointerdown",x)},0);return()=>{window.clearTimeout(y),n.removeEventListener("pointerdown",x),n.removeEventListener("click",h.current);for(const w of b)n.removeEventListener(w,g,!0),n.removeEventListener(w,v)}},[n,a,r,i,s,o]),{onPointerDownCapture:ri(()=>l.current=!0,"onPointerDownCapture")}}ri(X8,"usePointerDownOutside");function Q8(e,t=globalThis==null?void 0:globalThis.document){const n=h0(e),r=m.useRef(!1);return m.useEffect(()=>{const i=ri(s=>{s.target&&!r.current&&EE(Uhe,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:ri(()=>r.current=!0,"onFocusCapture"),onBlurCapture:ri(()=>r.current=!1,"onBlurCapture")}}ri(Q8,"useFocusOutside");function LC(){const e=new CustomEvent(DC);document.dispatchEvent(e)}ri(LC,"dispatchUpdate");function EE(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Y8(i,s):i.dispatchEvent(s)}ri(EE,"handleAndDispatchCustomEvent");var Zhe=Object.defineProperty,Li=(e,t)=>Zhe(e,"name",{value:t,configurable:!0}),J8=m.createContext(null);function Xhe({registry:e,children:t}){return e?d.jsx(J8.Provider,{value:e,children:t}):t}Li(Xhe,"FocusScopeBranchProvider");function Qhe(){const[e,t]=m.useState([]),n=m.useMemo(()=>({add:Li(r=>t(i=>i.includes(r)?i:[...i,r]),"add"),remove:Li(r=>t(i=>i.filter(s=>s!==r)),"remove")}),[]);return{nodes:e,registry:n}}Li(Qhe,"useFocusScopeBranchRegistry");function eH(e){const t=m.useContext(J8);m.useEffect(()=>{if(!(!e||!t))return t.add(e),()=>t.remove(e)},[e,t])}Li(eH,"useFocusScopeBranch");function Jhe(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(iH(r,{select:t}),document.activeElement!==n)return}Li(Jhe,"focusFirst");function efe(e){const t=tH(e),n=FC(t,e),r=FC(t.reverse(),e);return[n,r]}Li(efe,"getTabbableEdges");function tH(e){const t=[],r=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Li(i=>{const s=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||s?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;r.nextNode();)t.push(r.currentNode);return t}Li(tH,"getTabbableCandidates");function FC(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):nH(r,{upTo:t})))return r}Li(FC,"findVisible");function nH(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}Li(nH,"isHidden");function rH(e){return e.tagName==="INPUT"&&typeof e.select=="function"}Li(rH,"isSelectableInput");function iH(e,{select:t=!1}={}){if(e&&e.focus){const r=(e.ownerDocument??document).activeElement;e.focus({preventScroll:!0}),e!==r&&rH(e)&&t&&e.select()}}Li(iH,"focus");function tfe(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=BC(e,t),e.unshift(t)},remove(t){var n;e=BC(e,t),(n=e[0])==null||n.resume()}}}Li(tfe,"createFocusScopesStack");function BC(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Li(BC,"arrayRemove");function nfe(e){return e.filter(t=>t.tagName!=="A")}Li(nfe,"removeLinks");var rfe=Object.defineProperty,ife=(e,t)=>rfe(e,"name",{value:t,configurable:!0}),sfe=Ca[" useId ".trim().toString()]||(()=>{}),ofe=0;function sH(e){const[t,n]=m.useState(sfe());return io(()=>{e||n(r=>r??String(ofe++))},[e]),e||(t?`radix-${t}`:"")}ife(sH,"useId");const afe=["top","right","bottom","left"],Ic=Math.min,sl=Math.max,nb=Math.round,ov=Math.floor,ol=e=>({x:e,y:e}),lfe={left:"right",right:"left",bottom:"top",top:"bottom"};function oH(e,t,n){return sl(e,Ic(t,n))}function pl(e,t){return typeof e=="function"?e(t):e}function $c(e){return e.split("-")[0]}function Kf(e){return e.split("-")[1]}function jE(e){return e==="x"?"y":"x"}function zE(e){return e==="y"?"height":"width"}function la(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ME(e){return jE(la(e))}function cfe(e,t,n){n===void 0&&(n=!1);const r=Kf(e),i=ME(e),s=zE(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=rb(o)),[o,rb(o)]}function ufe(e){const t=rb(e);return[HC(e),t,HC(t)]}function HC(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const VR=["left","right"],WR=["right","left"],dfe=["top","bottom"],hfe=["bottom","top"];function ffe(e,t,n){switch(e){case"top":case"bottom":return n?t?WR:VR:t?VR:WR;case"left":case"right":return t?dfe:hfe;default:return[]}}function pfe(e,t,n,r){const i=Kf(e);let s=ffe($c(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(HC)))),s}function rb(e){const t=$c(e);return lfe[t]+e.slice(t.length)}function mfe(e){var t,n,r,i;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(i=e.left)!=null?i:0}}function aH(e){return typeof e!="number"?mfe(e):{top:e,right:e,bottom:e,left:e}}function ib(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function qR(e,t,n){let{reference:r,floating:i}=e;const s=la(t),o=ME(t),a=zE(o),l=$c(t),c=s==="y",u=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,f=r[a]/2-i[a]/2;let p;switch(l){case"top":p={x:u,y:r.y-i.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:h};break;case"left":p={x:r.x-i.width,y:h};break;default:p={x:r.x,y:r.y}}const g=Kf(t);return g&&(p[o]+=f*(g==="end"?1:-1)*(n&&c?-1:1)),p}async function gfe(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:f=!1,padding:p=0}=pl(t,e),g=aH(p),x=a[f?h==="floating"?"reference":"floating":h],b=ib(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),y=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),S=await(s.isElement==null?void 0:s.isElement(w))&&await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1},C=ib(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:w,strategy:l}):y);return{top:(b.top-C.top+g.top)/S.y,bottom:(C.bottom-b.bottom+g.bottom)/S.y,left:(b.left-C.left+g.left)/S.x,right:(C.right-b.right+g.right)/S.x}}const vfe=50,xfe=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:gfe},l=await(o.isRTL==null?void 0:o.isRTL(t));let c=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:h}=qR(c,r,l),f=r,p=0;const g={};for(let v=0;v<s.length;v++){const x=s[v];if(!x)continue;const{name:b,fn:y}=x,{x:w,y:S,data:C,reset:_}=await y({x:u,y:h,initialPlacement:r,placement:f,strategy:i,middlewareData:g,rects:c,platform:a,elements:{reference:e,floating:t}});u=w??u,h=S??h,g[b]={...g[b],...C},_&&p<vfe&&(p++,typeof _=="object"&&(_.placement&&(f=_.placement),_.rects&&(c=_.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):_.rects),{x:u,y:h}=qR(c,f,l)),v=-1)}return{x:u,y:h,placement:f,strategy:i,middlewareData:g}},bfe=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=pl(e,t)||{};if(c==null)return{};const h=aH(u),f={x:n,y:r},p=ME(i),g=zE(p),v=await o.getDimensions(c),x=p==="y",b=x?"top":"left",y=x?"bottom":"right",w=x?"clientHeight":"clientWidth",S=s.reference[g]+s.reference[p]-f[p]-s.floating[g],C=f[p]-s.reference[p],_=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let k=_?_[w]:0;(!k||!await(o.isElement==null?void 0:o.isElement(_)))&&(k=a.floating[w]||s.floating[g]);const z=S/2-C/2,j=k/2-v[g]/2-1,N=Ic(h[b],j),$=Ic(h[y],j),R=k-v[g]-$,P=k/2-v[g]/2+z,E=oH(N,P,R),M=!l.arrow&&Kf(i)!=null&&P!==E&&s.reference[g]/2-(P<N?N:$)-v[g]/2<0,T=M?P<N?P-N:P-R:0;return{[p]:f[p]+T,data:{[p]:E,centerOffset:P-E-T,...M&&{alignmentOffset:T}},reset:M}}}),yfe=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...x}=pl(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=$c(i),y=la(a),w=$c(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),C=f||(w||!v?[rb(a)]:ufe(a)),_=g!=="none";!f&&_&&C.push(...pfe(a,v,g,S));const k=[a,...C],z=await l.detectOverflow(t,x),j=[];let N=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&j.push(z[b]),h){const E=cfe(i,o,S);j.push(z[E[0]],z[E[1]])}if(N=[...N,{placement:i,overflows:j}],!j.every(E=>E<=0)){var $,R;const E=((($=s.flip)==null?void 0:$.index)||0)+1,M=k[E];if(M&&(!(h==="alignment"?y!==la(M):!1)||N.every(A=>la(A.placement)===y?A.overflows[0]>0:!0)))return{data:{index:E,overflows:N},reset:{placement:M}};let T=(R=N.filter(D=>D.overflows[0]<=0).sort((D,A)=>D.overflows[1]-A.overflows[1])[0])==null?void 0:R.placement;if(!T)switch(p){case"bestFit":{var P;const D=(P=N.filter(A=>{if(_){const H=la(A.placement);return H===y||H==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(H=>H>0).reduce((H,I)=>H+I,0)]).sort((A,H)=>A[1]-H[1])[0])==null?void 0:P[0];D&&(T=D);break}case"initialPlacement":T=a;break}if(i!==T)return{reset:{placement:T}}}return{}}}};function UR(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function KR(e){return afe.some(t=>e[t]>=0)}const wfe=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=pl(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=UR(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:KR(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),a=UR(o,n.floating);return{data:{escapedOffsets:a,escaped:KR(a)}}}default:return{}}}}},lH=new Set(["left","top"]);async function Sfe(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=$c(n),a=Kf(n),l=la(n)==="y",c=lH.has(o)?-1:1,u=s&&l?-1:1,h=pl(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:g}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),l?{x:p*u,y:f*c}:{x:f*c,y:p*u}}const _fe=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=t,l=await Sfe(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},Cfe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x:w,y:S}=y;return{x:w,y:S}}},...c}=pl(e,t),u={x:n,y:r},h=await s.detectOverflow(t,c),f=la(i),p=jE(f);let g=u[p],v=u[f];const x=(y,w)=>oH(w+h[y==="y"?"top":"left"],w,w-h[y==="y"?"bottom":"right"]);o&&(g=x(p,g)),a&&(v=x(f,v));const b=l.fn({...t,[p]:g,[f]:v});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[p]:o,[f]:a}}}}}},kfe=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:i,y:s,placement:o,rects:a,middlewareData:l}=t,{offset:c=0,mainAxis:u=!0,crossAxis:h=!0}=pl(e,t),f={x:i,y:s},p=la(o),g=jE(p);let v=f[g],x=f[p];const b=pl(c,t),y=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:(n=b.mainAxis)!=null?n:0,crossAxis:(r=b.crossAxis)!=null?r:0};if(u){const C=g==="y"?"height":"width",_=a.reference[g]-a.floating[C]+y.mainAxis,k=a.reference[g]+a.reference[C]-y.mainAxis;v<_?v=_:v>k&&(v=k)}if(h){var w,S;const C=g==="y"?"width":"height",_=lH.has($c(o)),k=a.reference[p]-a.floating[C]+(_&&((w=l.offset)==null?void 0:w[p])||0)+(_?0:y.crossAxis),z=a.reference[p]+a.reference[C]+(_?0:((S=l.offset)==null?void 0:S[p])||0)-(_?y.crossAxis:0);x<k?x=k:x>z&&(x=z)}return{[g]:v,[p]:x}}}},Nfe=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:i,elements:s}=t,{apply:o=()=>{},...a}=pl(e,t),l=await i.detectOverflow(t,a),c=$c(n),u=Kf(n),h=la(n)==="y",{width:f,height:p}=r.floating;let g,v;c==="top"||c==="bottom"?(g=c,v=u===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(v=c,g=u==="end"?"top":"bottom");const x=p-l.top-l.bottom,b=f-l.left-l.right,y=Ic(p-l[g],x),w=Ic(f-l[v],b),S=t.middlewareData.shift,C=!S;let _=y,k=w;S!=null&&S.enabled.x&&(k=b),S!=null&&S.enabled.y&&(_=x),C&&!u&&(h?k=f-2*sl(l.left,l.right):_=p-2*sl(l.top,l.bottom)),await o({...t,availableWidth:k,availableHeight:_});const z=await i.getDimensions(s.floating);return f!==z.width||p!==z.height?{reset:{rects:!0}}:{}}}};function Ry(){return typeof window<"u"}function Gf(e){return cH(e)?(e.nodeName||"").toLowerCase():"#document"}function us(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function kl(e){var t;return(t=(cH(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function cH(e){return Ry()?e instanceof Node||e instanceof us(e).Node:!1}function va(e){return Ry()?e instanceof Element||e instanceof us(e).Element:!1}function Uc(e){return Ry()?e instanceof HTMLElement||e instanceof us(e).HTMLElement:!1}function GR(e){return!Ry()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof us(e).ShadowRoot}function Oy(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=xa(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function Efe(e){return/^(table|td|th)$/.test(Gf(e))}function Py(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const jfe=/transform|translate|scale|rotate|perspective|filter/,zfe=/paint|layout|strict|content/,su=e=>!!e&&e!=="none";let Sw;function IE(e){const t=va(e)?xa(e):e;return su(t.transform)||su(t.translate)||su(t.scale)||su(t.rotate)||su(t.perspective)||!$E()&&(su(t.backdropFilter)||su(t.filter))||jfe.test(t.willChange||"")||zfe.test(t.contain||"")}function Mfe(e){let t=gd(e);for(;Uc(t)&&!eg(t);){if(IE(t))return t;if(Py(t))return null;t=gd(t)}return null}function $E(){return Sw==null&&(Sw=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Sw}function eg(e){return/^(html|body|#document)$/.test(Gf(e))}function xa(e){return us(e).getComputedStyle(e)}function Ty(e){return va(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function gd(e){if(Gf(e)==="html")return e;const t=e.assignedSlot||e.parentNode||GR(e)&&e.host||kl(e);return GR(t)?t.host:t}function uH(e){const t=gd(e);return eg(t)?(e.ownerDocument||e).body:Uc(t)&&Oy(t)?t:uH(t)}function tg(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=uH(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=us(i);if(s){const a=VC(o);return t.concat(o,o.visualViewport||[],Oy(i)?i:[],a&&n?tg(a):[])}else return t.concat(i,tg(i,[],n))}function VC(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dH(e){const t=xa(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Uc(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,a=nb(n)!==s||nb(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function RE(e){return va(e)?e:e.contextElement}function Nh(e){const t=RE(e);if(!Uc(t))return ol(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=dH(t);let o=(s?nb(n.width):n.width)/r,a=(s?nb(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Ife=ol(0);function hH(e){const t=us(e);return!$E()||!t.visualViewport?Ife:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function $fe(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===us(e)}function vd(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=RE(e);let o=ol(1);t&&(r?va(r)&&(o=Nh(r)):o=Nh(e));const a=$fe(s,n,r)?hH(s):ol(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,h=i.height/o.y;if(s&&r){const f=us(s),p=va(r)?us(r):r;let g=f,v=VC(g);for(;v&&p!==g;){const x=Nh(v),b=v.getBoundingClientRect(),y=xa(v),w=b.left+(v.clientLeft+parseFloat(y.paddingLeft))*x.x,S=b.top+(v.clientTop+parseFloat(y.paddingTop))*x.y;l*=x.x,c*=x.y,u*=x.x,h*=x.y,l+=w,c+=S,g=us(v),v=VC(g)}}return ib({width:u,height:h,x:l,y:c})}function Ay(e,t){const n=Ty(e).scrollLeft;return t?t.left+n:vd(kl(e)).left+n}function fH(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ay(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function Rfe(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=kl(r),a=t?Py(t.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=ol(1);const u=ol(0),h=Uc(r);if((h||!s)&&((Gf(r)!=="body"||Oy(o))&&(l=Ty(r)),h)){const p=vd(r);c=Nh(r),u.x=p.x+r.clientLeft,u.y=p.y+r.clientTop}const f=o&&!h&&!s?fH(o,l):ol(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}}function Ofe(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Pfe(e){const t=Ty(e),n=e.ownerDocument.body,r=sl(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=sl(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+Ay(e);const o=-t.scrollTop;return xa(n).direction==="rtl"&&(s+=sl(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:s,y:o}}const Tfe=25;function Afe(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",i=us(e),s=kl(e),o=i.visualViewport;let a=s.clientWidth,l=s.clientHeight,c=0,u=0;if(o){const f=!$E()||t==="fixed";r?f||(c=-o.offsetLeft,u=-o.offsetTop):(a=o.width,l=o.height,f&&(c=o.offsetLeft,u=o.offsetTop))}if(Ay(s)<=0){const f=s.ownerDocument,p=f.body,g=getComputedStyle(p),v=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,x=Math.abs(s.clientWidth-p.clientWidth-v),b=getComputedStyle(s).scrollbarGutter==="stable both-edges"?x/2:x;b<=Tfe&&(a-=b)}return{width:a,height:l,x:c,y:u}}function Dfe(e,t){const n=vd(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=Nh(e),o=e.clientWidth*s.x,a=e.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function YR(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=Afe(e,n,t);else if(t==="document")r=Pfe(kl(e));else if(va(t))r=Dfe(t,n);else{const i=hH(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return ib(r)}function Lfe(e,t){const n=t.get(e);if(n)return n;let r=tg(e,[],!1).filter(a=>va(a)&&Gf(a)!=="body"),i=null;const s=xa(e).position==="fixed";let o=s?gd(e):e;for(;va(o)&&!eg(o);){const a=xa(o),l=IE(o),c=i?i.position:s?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?r=r.filter(h=>h!==o):i=a,o=gd(o)}return t.set(e,r),r}function Ffe(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?Py(t)?[]:Lfe(t,this._c):[].concat(n),r],a=YR(t,o[0],i);let l=a.top,c=a.right,u=a.bottom,h=a.left;for(let f=1;f<o.length;f++){const p=YR(t,o[f],i);l=sl(p.top,l),c=Ic(p.right,c),u=Ic(p.bottom,u),h=sl(p.left,h)}return{width:c-h,height:u-l,x:h,y:l}}function Bfe(e){const{width:t,height:n}=dH(e);return{width:t,height:n}}function Hfe(e,t,n){const r=Uc(t),i=kl(t),s=n==="fixed",o=vd(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=ol(0);if((r||!s)&&((Gf(t)!=="body"||Oy(i))&&(a=Ty(t)),r)){const f=vd(t,!0,s,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}!r&&i&&(l.x=Ay(i));const c=i&&!r&&!s?fH(i,a):ol(0),u=o.left+a.scrollLeft-l.x-c.x,h=o.top+a.scrollTop-l.y-c.y;return{x:u,y:h,width:o.width,height:o.height}}function _w(e){return xa(e).position==="static"}function ZR(e,t){if(!Uc(e)||xa(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return kl(e)===n&&(n=n.ownerDocument.body),n}function pH(e,t){const n=us(e);if(Py(e))return n;if(!Uc(e)){let i=gd(e);for(;i&&!eg(i);){if(va(i)&&!_w(i))return i;i=gd(i)}return n}let r=ZR(e,t);for(;r&&Efe(r)&&_w(r);)r=ZR(r,t);return r&&eg(r)&&_w(r)&&!IE(r)?n:r||Mfe(e)||n}const Vfe=async function(e){const t=this.getOffsetParent||pH,n=this.getDimensions,r=await n(e.floating);return{reference:Hfe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Wfe(e){return xa(e).direction==="rtl"}const qfe={convertOffsetParentRelativeRectToViewportRelativeRect:Rfe,getDocumentElement:kl,getClippingRect:Ffe,getOffsetParent:pH,getElementRects:Vfe,getClientRects:Ofe,getDimensions:Bfe,getScale:Nh,isElement:va,isRTL:Wfe};function mH(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ufe(e,t,n){let r=null,i;const s=kl(e);function o(){var u;clearTimeout(i),(u=r)==null||u.disconnect(),r=null}function a(u,h){u===void 0&&(u=!1),h===void 0&&(h=1),o();const f=e.getBoundingClientRect(),{left:p,top:g,width:v,height:x}=f;if(u||t(),!v||!x)return;const b=ov(g),y=ov(s.clientWidth-(p+v)),w=ov(s.clientHeight-(g+x)),S=ov(p),_={rootMargin:-b+"px "+-y+"px "+-w+"px "+-S+"px",threshold:sl(0,Ic(1,h))||1};let k=!0;function z(j){const N=j[0].intersectionRatio;if(!mH(f,e.getBoundingClientRect()))return a();if(N!==h){if(!k)return a();N?a(!1,N):i=setTimeout(()=>{a(!1,1e-7)},1e3)}k=!1}try{r=new IntersectionObserver(z,{..._,root:s.ownerDocument})}catch{r=new IntersectionObserver(z,_)}r.observe(e)}const l=us(e),c=()=>a(n);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),o()}}function Kfe(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=RE(e),u=i||s?[...c?tg(c):[],...t?tg(t):[]]:[];u.forEach(b=>{i&&b.addEventListener("scroll",n),s&&b.addEventListener("resize",n)});const h=c&&a?Ufe(c,n,s):null;let f=-1,p=null;o&&(p=new ResizeObserver(b=>{let[y]=b;y&&y.target===c&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),c&&!l&&p.observe(c),t&&p.observe(t));let g,v=l?vd(e):null;l&&x();function x(){const b=vd(e);v&&!mH(v,b)&&n(),v=b,g=requestAnimationFrame(x)}return n(),()=>{var b;u.forEach(y=>{i&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),h==null||h(),(b=p)==null||b.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const Gfe=_fe,Yfe=Cfe,Zfe=yfe,Xfe=Nfe,Qfe=wfe,XR=bfe,Jfe=kfe,epe=(e,t,n)=>{const r=new Map,i=n??{},s={...qfe,...i.platform,_c:r};return xfe(e,t,{...i,platform:s})};var tpe=typeof document<"u",npe=function(){},ix=tpe?m.useLayoutEffect:npe;function sb(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!sb(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!sb(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function gH(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function QR(e,t){const n=gH(e);return Math.round(t*n)/n}function Cw(e){const t=m.useRef(e);return ix(()=>{t.current=e}),t}function rpe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,h]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=m.useState(r);sb(f,r)||p(r);const[g,v]=m.useState(null),[x,b]=m.useState(null),y=m.useCallback(A=>{A!==_.current&&(_.current=A,v(A))},[]),w=m.useCallback(A=>{A!==k.current&&(k.current=A,b(A))},[]),S=s||g,C=o||x,_=m.useRef(null),k=m.useRef(null),z=m.useRef(u),j=l!=null,N=Cw(l),$=Cw(i),R=Cw(c),P=m.useCallback(()=>{if(!_.current||!k.current)return;const A={placement:t,strategy:n,middleware:f};$.current&&(A.platform=$.current),epe(_.current,k.current,A).then(H=>{const I={...H,isPositioned:R.current!==!1};E.current&&!sb(z.current,I)&&(z.current=I,ki.flushSync(()=>{h(I)}))})},[f,t,n,$,R]);ix(()=>{c===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,h(A=>({...A,isPositioned:!1})))},[c]);const E=m.useRef(!1);ix(()=>(E.current=!0,()=>{E.current=!1}),[]),ix(()=>{if(S&&(_.current=S),C&&(k.current=C),S&&C){if(N.current)return N.current(S,C,P);P()}},[S,C,P,N,j]);const M=m.useMemo(()=>({reference:_,floating:k,setReference:y,setFloating:w}),[y,w]),T=m.useMemo(()=>({reference:S,floating:C}),[S,C]),D=m.useMemo(()=>{const A={position:n,left:0,top:0};if(!T.floating)return A;const H=QR(T.floating,u.x),I=QR(T.floating,u.y);return a?{...A,transform:"translate("+H+"px, "+I+"px)",...gH(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:I}},[n,a,T.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:P,refs:M,elements:T,floatingStyles:D}),[u,P,M,T,D])}const ipe=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?XR({element:r.current,padding:i}).fn(n):{}:r?XR({element:r,padding:i}).fn(n):{}}}},spe=(e,t)=>{const n=Gfe(e);return{name:n.name,fn:n.fn,options:[e,t]}},ope=(e,t)=>{const n=Yfe(e);return{name:n.name,fn:n.fn,options:[e,t]}},ape=(e,t)=>({fn:Jfe(e).fn,options:[e,t]}),lpe=(e,t)=>{const n=Zfe(e);return{name:n.name,fn:n.fn,options:[e,t]}},cpe=(e,t)=>{const n=Xfe(e);return{name:n.name,fn:n.fn,options:[e,t]}},upe=(e,t)=>{const n=Qfe(e);return{name:n.name,fn:n.fn,options:[e,t]}},dpe=(e,t)=>{const n=ipe(e);return{name:n.name,fn:n.fn,options:[e,t]}};var hpe=Object.defineProperty,fpe=(e,t)=>hpe(e,"name",{value:t,configurable:!0});function vH(e){const[t,n]=m.useState(void 0);return io(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let r=0;const i=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];window.cancelAnimationFrame(r),r=window.requestAnimationFrame(()=>{let a,l;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})})});return i.observe(e,{box:"border-box"}),()=>{window.cancelAnimationFrame(r),i.unobserve(e)}}else n(void 0)},[e]),t}fpe(vH,"useSize");var ppe=Object.defineProperty,wc=(e,t)=>ppe(e,"name",{value:t,configurable:!0}),JR={Partial:"partial"},eO={Optimized:"optimized",Always:"always"},xH="Popper",[bH,yH]=kE(xH),[mpe,wH]=bH(xH),gpe=wc(e=>{const{__scopePopper:t,children:n}=e,[r,i]=m.useState(null),[s,o]=m.useState(void 0);return d.jsx(mpe,{scope:t,anchor:r,onAnchorChange:i,placementState:s,setPlacementState:o,children:n})},"Popper"),vpe="PopperAnchor",xpe=m.forwardRef(wc(function(t,n){const{__scopePopper:r,virtualRef:i,...s}=t,o=wH(vpe,r),a=m.useRef(null),l=o.onAnchorChange,c=m.useCallback(v=>{a.current=v,v&&l(v)},[l]),u=qc(n,c),h=m.useRef(null);m.useEffect(()=>{if(!i)return;const v=h.current;h.current=i.current,v!==h.current&&l(h.current)});const f=o.placementState&&Dy(o.placementState),p=f==null?void 0:f[0],g=f==null?void 0:f[1];return i?null:d.jsx(Uf.div,{"data-radix-popper-side":p,"data-radix-popper-align":g,...s,ref:u})},"PopperAnchor")),SH="PopperContent",[bpe,BFe]=bH(SH),ype=m.forwardRef(wc(function(t,n){var ae,ne,ie,oe,G,le,me;const{__scopePopper:r,side:i="bottom",sideOffset:s=0,align:o="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:h=0,sticky:f=JR.Partial,hideWhenDetached:p=!1,updatePositionStrategy:g=eO.Optimized,onPlaced:v,...x}=t,b=wH(SH,r),[y,w]=m.useState(null),S=qc(n,w),[C,_]=m.useState(null),k=vH(C),z=(k==null?void 0:k.width)??0,j=(k==null?void 0:k.height)??0,N=i+(o!=="center"?"-"+o:""),$=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},R=Array.isArray(u)?u:[u],P=R.length>0,E={padding:$,boundary:R.filter(_H),altBoundary:P},{refs:M,floatingStyles:T,placement:D,isPositioned:A,middlewareData:H}=rpe({strategy:"fixed",placement:N,whileElementsMounted:wc((...Y)=>Kfe(...Y,{animationFrame:g===eO.Always}),"whileElementsMounted"),elements:{reference:b.anchor},middleware:[spe({mainAxis:s+j,alignmentAxis:a}),c&&ope({mainAxis:!0,crossAxis:!1,...f===JR.Partial?{limiter:ape()}:{},...E}),c&&lpe({...E}),cpe({...E,apply:wc(({elements:Y,rects:ge,availableWidth:ye,availableHeight:re})=>{const{width:Ee,height:Ie}=ge.reference,Pe=Y.floating.style;Pe.setProperty("--radix-popper-available-width",`${ye}px`),Pe.setProperty("--radix-popper-available-height",`${re}px`),Pe.setProperty("--radix-popper-anchor-width",`${Ee}px`),Pe.setProperty("--radix-popper-anchor-height",`${Ie}px`)},"apply")}),C&&dpe({element:C,padding:l}),wpe({arrowWidth:z,arrowHeight:j}),p&&upe(P?{strategy:"referenceHidden",...E}:{strategy:"referenceHidden",padding:E.padding,altBoundary:E.altBoundary})]}),I=b.setPlacementState;io(()=>(I(D),()=>{I(void 0)}),[D,I]);const[B,L]=Dy(D),O=h0(v);io(()=>{A&&(O==null||O())},[A,O]);const W=(ae=H.arrow)==null?void 0:ae.x,F=(ne=H.arrow)==null?void 0:ne.y,U=((ie=H.arrow)==null?void 0:ie.centerOffset)!==0,[X,Q]=m.useState();return io(()=>{y&&Q(window.getComputedStyle(y).zIndex)},[y]),d.jsx("div",{ref:M.setFloating,"data-radix-popper-content-wrapper":"",style:{...T,transform:A?T.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:X,"--radix-popper-transform-origin":[(oe=H.transformOrigin)==null?void 0:oe.x,(G=H.transformOrigin)==null?void 0:G.y].join(" "),...((le=H.hide)==null?void 0:le.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:d.jsx(bpe,{scope:r,placedSide:B,placedAlign:L,onArrowChange:_,arrowX:W,arrowY:F,shouldHideArrow:U,children:d.jsx(Uf.div,{"data-side":B,"data-align":L,...x,ref:S,style:{...x.style,animation:A?(me=x.style)==null?void 0:me.animation:"none"}})})})},"PopperContent"));function _H(e){return e!==null}wc(_H,"isNotNull");var wpe=wc(e=>({name:"transformOrigin",options:e,fn(t){var x,b,y;const{placement:n,rects:r,middlewareData:i}=t,o=((x=i.arrow)==null?void 0:x.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[c,u]=Dy(n),h={start:"0%",center:"50%",end:"100%"}[u],f=(((b=i.arrow)==null?void 0:b.x)??0)+a/2,p=(((y=i.arrow)==null?void 0:y.y)??0)+l/2;let g="",v="";return c==="bottom"?(g=o?h:`${f}px`,v=`${-l}px`):c==="top"?(g=o?h:`${f}px`,v=`${r.floating.height+l}px`):c==="right"?(g=`${-l}px`,v=o?h:`${p}px`):c==="left"&&(g=`${r.floating.width+l}px`,v=o?h:`${p}px`),{data:{x:g,y:v}}}}),"transformOrigin");function Dy(e){const[t,n="center"]=e.split("-");return[t,n]}wc(Dy,"getSideAndAlignFromPlacement");var Spe=Object.defineProperty,_pe=(e,t)=>Spe(e,"name",{value:t,configurable:!0}),Cpe=m.forwardRef(_pe(function(t,n){var l;const{container:r,...i}=t,[s,o]=m.useState(!1);io(()=>o(!0),[]);const a=r||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return a?ki.createPortal(d.jsx(Uf.div,{...i,ref:n}),a):null},"Portal")),kpe=Object.defineProperty,ml=(e,t)=>kpe(e,"name",{value:t,configurable:!0});function CH(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}ml(CH,"useStateMachine");var kH=ml(e=>{const{present:t,children:n}=e,r=NH(t),i=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),s=EH(r.ref,jH(i));return typeof n=="function"||r.isPresent?m.cloneElement(i,{ref:s}):null},"Presence");function NH(e){const[t,n]=m.useState(),r=m.useRef(null),i=m.useRef(e),s=m.useRef("none"),o=m.useRef(void 0),a=e?"mounted":"unmounted",[l,c]=CH(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{l==="mounted"?(s.current=o.current??oh(r.current),o.current=void 0):s.current="none"},[l]),io(()=>{const u=r.current,h=i.current;if(h!==e){const p=s.current,g=oh(u);e?(o.current=g,c("MOUNT")):g==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(h&&p!==g?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),io(()=>{if(t){let u;const h=t.ownerDocument.defaultView??window,f=ml(g=>{const x=oh(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&x&&(c("ANIMATION_END"),!i.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",u=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},"handleAnimationEnd"),p=ml(g=>{g.target===t&&(s.current=oh(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{h.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:m.useCallback(u=>{if(u){const h=getComputedStyle(u);r.current=h,o.current=oh(h)}else r.current=null;n(u)},[])}}ml(NH,"usePresence");function WC(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}ml(WC,"setRef");function EH(...e){const t=m.useRef(e);return t.current=e,m.useCallback(n=>{const r=t.current;let i=!1;const s=r.map(o=>{const a=WC(o,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let o=0;o<s.length;o++){const a=s[o];typeof a=="function"?a():WC(r[o],null)}}},[])}ml(EH,"useStableComposedRefs");function oh(e){return(e==null?void 0:e.animationName)||"none"}ml(oh,"getAnimationName");function jH(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}ml(jH,"getElementRef");var Npe=Object.defineProperty,Epe=(e,t)=>Npe(e,"name",{value:t,configurable:!0}),tO=Ca[" useEffectEvent ".trim().toString()],nO=Ca[" useInsertionEffect ".trim().toString()];function zH(e){if(typeof tO=="function")return tO(e);const t=m.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof nO=="function"?nO(()=>{t.current=e}):io(()=>{t.current=e}),m.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}Epe(zH,"useEffectEvent");var jpe=Object.defineProperty,f0=(e,t)=>jpe(e,"name",{value:t,configurable:!0}),zpe=Ca[" useInsertionEffect ".trim().toString()]||io;function MH({prop:e,defaultProp:t,onChange:n=f0(()=>{},"onChange"),caller:r}){const[i,s,o]=IH({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:i,c=m.useCallback(u=>{var h;if(a){const f=$H(u)?u(e):u;f!==e&&((h=o.current)==null||h.call(o,f))}else s(u)},[a,e,s,o]);return[l,c]}f0(MH,"useControllableState");function IH({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),i=m.useRef(n),s=m.useRef(t);return zpe(()=>{s.current=t},[t]),m.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}f0(IH,"useUncontrolledState");function $H(e){return typeof e=="function"}f0($H,"isFunction");var rO=Symbol("RADIX:SYNC_STATE");function Mpe(e,t,n,r){const{prop:i,defaultProp:s,onChange:o,caller:a}=t,l=i!==void 0,c=zH(o),u=[{...n,state:s}];r&&u.push(r);const[h,f]=m.useReducer((x,b)=>{if(b.type===rO)return{...x,state:b.state};const y=e(x,b);return l&&!Object.is(y.state,x.state)&&c(y.state),y},...u),p=h.state,g=m.useRef(p);m.useEffect(()=>{g.current!==p&&(g.current=p,l||c(p))},[p,g,l]);const v=m.useMemo(()=>i!==void 0?{...h,state:i}:h,[h,i]);return m.useEffect(()=>{l&&!Object.is(i,h.state)&&f({type:rO,state:i})},[i,h.state,l]),[v,f]}f0(Mpe,"useControllableStateReducer");var Ipe=Object.defineProperty,$pe=(e,t)=>Ipe(e,"name",{value:t,configurable:!0}),Rpe=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Ope=m.forwardRef($pe(function(t,n){return d.jsx(Uf.span,{...t,ref:n,style:{...Rpe,...t.style}})},"VisuallyHidden")),Ppe=Object.defineProperty,Br=(e,t)=>Ppe(e,"name",{value:t,configurable:!0}),[OE,HFe]=kE("Tooltip",[yH]),PE=yH(),Tpe="TooltipProvider",Ape=700,qC="tooltip.open",[Dpe,TE]=OE(Tpe),Lpe=Br(e=>{const{__scopeTooltip:t,delayDuration:n=Ape,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,o=m.useRef(!0),a=m.useRef(!1),l=m.useRef(0);return m.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),d.jsx(Dpe,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:m.useCallback(()=>{r<=0||(window.clearTimeout(l.current),o.current=!1)},[r]),onClose:m.useCallback(()=>{r<=0||(window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:a,onPointerInTransitChange:m.useCallback(c=>{a.current=c},[]),disableHoverableContent:i,children:s})},"TooltipProvider"),UC="Tooltip",[Fpe,p0]=OE(UC),RH=Br(e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=e,l=TE(UC,e.__scopeTooltip),c=PE(t),[u,h]=m.useState(null),[f,p]=m.useState(void 0),g=sH(),v=m.useRef(0),x=o??l.disableHoverableContent,b=a??l.delayDuration,y=m.useRef(!1),[w,S]=MH({prop:r,defaultProp:i??!1,onChange:Br(N=>{N?(l.onOpen(),document.dispatchEvent(new CustomEvent(qC))):l.onClose(),s==null||s(N)},"onChange"),caller:UC}),C=m.useMemo(()=>w?y.current?"delayed-open":"instant-open":"closed",[w]),_=m.useCallback(()=>{window.clearTimeout(v.current),v.current=0,y.current=!1,S(!0)},[S]),k=m.useCallback(()=>{window.clearTimeout(v.current),v.current=0,S(!1)},[S]),z=m.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{y.current=!0,S(!0),v.current=0},b)},[b,S]);m.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]);const j=f??g;return d.jsx(gpe,{...c,children:d.jsx(Fpe,{scope:t,contentId:j,setContentId:p,open:w,stateAttribute:C,trigger:u,onTriggerChange:h,onTriggerEnter:m.useCallback(()=>{l.isOpenDelayedRef.current?z():_()},[l.isOpenDelayedRef,z,_]),onTriggerLeave:m.useCallback(()=>{x?k():(window.clearTimeout(v.current),v.current=0)},[k,x]),onOpen:_,onClose:k,disableHoverableContent:x,children:n})})},"Tooltip"),iO="TooltipTrigger",OH=m.forwardRef(Br(function(t,n){const{__scopeTooltip:r,"aria-describedby":i,...s}=t,o=p0(iO,r),a=TE(iO,r),l=PE(r),c=m.useRef(null),u=qc(n,c,o.onTriggerChange),h=m.useRef(!1),f=m.useRef(!1),p=m.useCallback(()=>h.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),d.jsx(xpe,{asChild:!0,...l,children:d.jsx(Uf.button,{"aria-describedby":o.open?WH(i,o.contentId):i,"data-state":o.stateAttribute,...s,ref:u,onPointerMove:na(t.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!a.isPointerInTransitRef.current&&(o.onTriggerEnter(),f.current=!0)}),onPointerLeave:na(t.onPointerLeave,()=>{o.onTriggerLeave(),f.current=!1}),onPointerDown:na(t.onPointerDown,()=>{o.open&&o.onClose(),h.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:na(t.onFocus,()=>{h.current||o.onOpen()}),onBlur:na(t.onBlur,o.onClose),onClick:na(t.onClick,o.onClose)})})},"TooltipTrigger")),PH="TooltipPortal",[Bpe,Hpe]=OE(PH,{forceMount:void 0}),TH=Br(e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=p0(PH,t);return d.jsx(Bpe,{scope:t,forceMount:n,children:d.jsx(kH,{present:n||s.open,children:d.jsx(Cpe,{asChild:!0,container:i,children:r})})})},"TooltipPortal"),ng="TooltipContent",Vpe=m.forwardRef(Br(function(t,n){const r=Hpe(ng,t.__scopeTooltip),{forceMount:i=r.forceMount,side:s="top",...o}=t,a=p0(ng,t.__scopeTooltip);return d.jsx(kH,{present:i||a.open,children:a.disableHoverableContent?d.jsx(AH,{side:s,...o,ref:n}):d.jsx(Wpe,{side:s,...o,ref:n})})},"TooltipContent")),Wpe=m.forwardRef(Br(function(t,n){const r=p0(ng,t.__scopeTooltip),i=TE(ng,t.__scopeTooltip),s=m.useRef(null),o=qc(n,s),[a,l]=m.useState(null),{trigger:c,onClose:u}=r,h=s.current,{onPointerInTransitChange:f}=i,p=m.useCallback(()=>{l(null),f(!1)},[f]),g=m.useCallback((v,x)=>{const b=v.currentTarget,y={x:v.clientX,y:v.clientY},w=DH(y,b.getBoundingClientRect()),S=LH(y,w),C=FH(x.getBoundingClientRect()),_=HH([...S,...C]);l(_),f(!0)},[f]);return m.useEffect(()=>()=>p(),[p]),m.useEffect(()=>{if(c&&h){const v=Br(b=>g(b,h),"handleTriggerLeave"),x=Br(b=>g(b,c),"handleContentLeave");return c.addEventListener("pointerleave",v),h.addEventListener("pointerleave",x),()=>{c.removeEventListener("pointerleave",v),h.removeEventListener("pointerleave",x)}}},[c,h,g,p]),m.useEffect(()=>{if(a){const v=Br(x=>{const b=x.target,y={x:x.clientX,y:x.clientY},w=(c==null?void 0:c.contains(b))||(h==null?void 0:h.contains(b)),S=!BH(y,a);w?p():S&&(p(),u())},"handleTrackPointerGrace");return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[c,h,a,u,p]),d.jsx(AH,{...t,ref:o})},"TooltipContentHoverable")),qpe=H8("TooltipContent"),AH=m.forwardRef(Br(function(t,n){const{__scopeTooltip:r,children:i,"aria-label":s,id:o,onEscapeKeyDown:a,onPointerDownOutside:l,...c}=t,u=p0(ng,r),h=PE(r),{onClose:f}=u,[p,g]=m.useState(null),v=qc(n,g);eH(p),m.useEffect(()=>(document.addEventListener(qC,f),()=>document.removeEventListener(qC,f)),[f]),m.useEffect(()=>{if(u.trigger){const b=Br(y=>{y.target instanceof Node&&y.target.contains(u.trigger)&&f()},"handleScroll");return window.addEventListener("scroll",b,{capture:!0}),()=>window.removeEventListener("scroll",b,{capture:!0})}},[u.trigger,f]);const{setContentId:x}=u;return io(()=>(x(o),()=>{x(void 0)}),[o,x]),d.jsx(Khe,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:b=>b.preventDefault(),onDismiss:f,children:d.jsxs(ype,{"data-state":u.stateAttribute,role:s?void 0:"tooltip",id:s?void 0:u.contentId,...h,...c,ref:v,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[d.jsx(qpe,{children:i}),s?d.jsx(Ope,{id:u.contentId,role:"tooltip",children:s}):null]})})},"TooltipContentImpl"));function DH(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}Br(DH,"getExitSideFromRect");function LH(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}Br(LH,"getPaddedExitPoints");function FH(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}Br(FH,"getPointsFromRect");function BH(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s],l=t[o],c=a.x,u=a.y,h=l.x,f=l.y;u>r!=f>r&&n<(h-c)*(r-u)/(f-u)+c&&(i=!i)}return i}Br(BH,"isPointInPolygon");function HH(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),VH(t)}Br(HH,"getHull");function VH(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}Br(VH,"getHullPresorted");function WH(...e){const t=new Set;for(const n of e)if(typeof n=="string")for(const r of String(n).trim().split(/\s+/))r&&t.add(r);return t.size>0?Array.from(t).join(" "):void 0}Br(WH,"concatAriaDescribedby");function on({content:e,children:t,side:n,align:r,hoverOnly:i=!1}){return e?d.jsxs(RH,{children:[d.jsx(OH,{asChild:!0,...i?{onFocus:s=>s.preventDefault()}:{},children:t}),d.jsx(TH,{children:d.jsx(UH,{content:e,side:n,align:r})})]}):d.jsx(d.Fragment,{children:t})}function qH({content:e,children:t,className:n=""}){return e?d.jsxs(RH,{children:[d.jsx(OH,{asChild:!0,children:d.jsx("span",{className:n,children:t})}),d.jsx(TH,{children:d.jsx(UH,{content:e})})]}):d.jsx("span",{className:n,children:t})}function UH({content:e,side:t,align:n}){return d.jsx(Vpe,{side:t,align:n,sideOffset:8,collisionPadding:8,className:"ui-tooltip pointer-events-none z-[60] max-h-[46vh] max-w-[460px] overflow-hidden whitespace-pre-wrap break-words rounded-lg border border-zinc-200 bg-white px-2.5 py-2 text-[12px] leading-5 text-zinc-700 shadow-[0_10px_30px_rgba(24,24,27,.14)]",children:e})}function Upe({children:e}){return d.jsx(Lpe,{delayDuration:120,skipDelayDuration:300,disableHoverableContent:!0,children:e})}function Ea(e=6e3){const[t,n]=M8.useMessage({maxCount:1}),r="agentdock-toast";return{toast:n,show:(i,s="error")=>{if(!i){t.destroy(r);return}t.open({key:r,type:s==="error"?"error":"info",content:i,duration:e/1e3})},clear:()=>t.destroy(r)}}function Kpe({enabled:e}){const t=Ea(8e3),n=Fn(),r=It({queryKey:["autostart"],queryFn:Ne.autostartStatus,enabled:e,retry:!1,refetchOnWindowFocus:!1}),i=bt({mutationFn:Ne.setAutostart,onSuccess:a=>n.setQueryData(["autostart"],a),onError:a=>{t.show(a.message),r.refetch()}}),s=r.data;if(!(s!=null&&s.supported))return null;const o=i.isPending?!!i.variables:s.enabled;return d.jsxs("div",{className:"flex h-[34px] items-center gap-1 text-[12px]",children:[d.jsx(on,{content:s.enabled?`登录时自动运行 agent-dock start(${s.plistPath})`:"登录 macOS 后自动在后台启动 AgentDock",children:d.jsx("span",{className:"min-w-0 flex-1 truncate",children:"开机自启"})}),d.jsx(Xi,{size:"small",className:"!ml-auto shrink-0","aria-label":"开机自启",checked:o,loading:i.isPending,onChange:a=>i.mutate(a)})]})}function Gpe({enabled:e}){var h,f,p,g;const t=Ea(8e3),n=Fn(),r=It({queryKey:["keep-awake"],queryFn:Ne.keepAwakeStatus,enabled:e,retry:!1,refetchOnWindowFocus:!1}),i=bt({mutationFn:Ne.setKeepAwake,scope:{id:"keep-awake"},onSuccess:v=>n.setQueryData(["keep-awake"],v),onError:v=>{t.show(v.message),r.refetch()}}),s=r.data;if(!(s!=null&&s.supported))return null;const o=i.isPending,a=o&&((h=i.variables)==null?void 0:h.enabled)!==void 0?i.variables.enabled:s.enabled,l=o&&((f=i.variables)==null?void 0:f.keepDisplay)!==void 0?i.variables.keepDisplay:s.keepDisplay,c=o&&((p=i.variables)==null?void 0:p.enabled)!==void 0,u=o&&((g=i.variables)==null?void 0:g.keepDisplay)!==void 0;return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex h-[34px] items-center gap-1 text-[12px]",children:[d.jsx(on,{content:"AgentDock 运行期间用 caffeinate -imsu 阻止 Mac 空闲休眠;daemon 退出后自动释放,下次启动按上次选择恢复",children:d.jsx("span",{className:"min-w-0 flex-1 truncate",children:"永不休眠"})}),d.jsx(Xi,{size:"small",className:"!ml-auto shrink-0","aria-label":"永不休眠",checked:a,loading:c,disabled:u,onChange:v=>i.mutate({enabled:v})})]}),d.jsxs("div",{className:`flex h-[34px] items-center gap-1 pl-4 text-[12px] transition-opacity ${a?"":"opacity-50"}`,children:[d.jsx(on,{content:"额外加 -d,阻止显示器休眠以保持屏幕常亮;关闭主开关时保留这个偏好",children:d.jsx("span",{className:"min-w-0 flex-1 truncate",children:"屏幕常亮"})}),d.jsx(Xi,{size:"small",className:"!ml-auto shrink-0","aria-label":"保持屏幕常亮",disabled:!a||c,checked:l,loading:u,onChange:v=>i.mutate({keepDisplay:v})})]}),t.toast]})}function KH(){var e;return typeof window>"u"||(e=window.agentdockDesktop)==null?void 0:e.update}function GH(){const e=KH(),[t,n]=m.useState();m.useEffect(()=>{if(!e)return;let i=!0;const s=e.subscribe(o=>{i&&n(o)});return e.getState().then(o=>{i&&n(o)}).catch(()=>{}),()=>{i=!1,e.unsubscribe(s)}},[e]);const r=m.useCallback(async i=>{if(!e)return;const s=await e[i]();return n(s),s},[e]);return{api:e,state:t,check:()=>r("check"),download:()=>r("download"),install:()=>r("install")}}function Ype(e){return!!(e&&["available","downloading","downloaded","installing"].includes(e.phase))}function KC(e){if(!e||e<=0)return"0 B";const t=["B","KB","MB","GB"];let n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=100||r===0?Math.round(n):n.toFixed(1)} ${t[r]}`}function Zpe(e){return e&&e>0?`${KC(e)}/s`:""}function Xpe(e){return e.total?`${KC(e.transferred)} / ${KC(e.total)}`:""}function Qpe(e){const t=Number(e.percent);return Number.isFinite(t)?Math.max(0,Math.min(100,t)):0}function er({size:e=14,className:t="",label:n="加载中"}){return d.jsx("span",{role:"status","aria-label":n,className:`inline-block shrink-0 animate-spin rounded-full border-[1.5px] border-current border-r-transparent opacity-70 ${t}`,style:{width:e,height:e}})}const GC="agentdock:theme",YC=new Set,Eh=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):void 0;function Ly(){try{const e=localStorage.getItem(GC);return e==="light"||e==="dark"?e:"system"}catch{return"system"}}const YH=e=>e==="system"?Eh!=null&&Eh.matches?"dark":"light":e;function ZH(){var t;const e=YH(Ly());document.documentElement.dataset.theme=e,(t=document.querySelector('meta[name="theme-color"]'))==null||t.setAttribute("content",e==="dark"?"#212121":"#ffffff"),YC.forEach(n=>n())}function Jpe(e){try{e==="system"?localStorage.removeItem(GC):localStorage.setItem(GC,e)}catch{}ZH()}Eh==null||Eh.addEventListener("change",()=>{Ly()==="system"&&ZH()});const XH=e=>(YC.add(e),()=>{YC.delete(e)}),eme=()=>m.useSyncExternalStore(XH,Ly,()=>"system"),QH=()=>m.useSyncExternalStore(XH,()=>YH(Ly()),()=>"light");var pp={},kw={exports:{}},sO;function Fy(){return sO||(sO=1,(function(e){function t(n){return n&&n.__esModule?n:{default:n}}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})(kw)),kw.exports}var mp={},oO;function tme(){if(oO)return mp;oO=1,Object.defineProperty(mp,"__esModule",{value:!0}),mp.default=void 0;var e={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页",page_size:"页码"};return mp.default=e,mp}var gp={},vp={},xp={},Nw={exports:{}},Ew={exports:{}},jw={exports:{}},zw={exports:{}},aO;function JH(){return aO||(aO=1,(function(e){function t(n){"@babel/helpers - typeof";return e.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})(zw)),zw.exports}var Mw={exports:{}},lO;function nme(){return lO||(lO=1,(function(e){var t=JH().default;function n(r,i){if(t(r)!="object"||!r)return r;var s=r[Symbol.toPrimitive];if(s!==void 0){var o=s.call(r,i||"default");if(t(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports})(Mw)),Mw.exports}var cO;function rme(){return cO||(cO=1,(function(e){var t=JH().default,n=nme();function r(i){var s=n(i,"string");return t(s)=="symbol"?s:s+""}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports})(jw)),jw.exports}var uO;function ime(){return uO||(uO=1,(function(e){var t=rme();function n(r,i,s){return(i=t(i))in r?Object.defineProperty(r,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):r[i]=s,r}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports})(Ew)),Ew.exports}var dO;function sme(){return dO||(dO=1,(function(e){var t=ime();function n(i,s){var o=Object.keys(i);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(i);s&&(a=a.filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable})),o.push.apply(o,a)}return o}function r(i){for(var s=1;s<arguments.length;s++){var o=arguments[s]!=null?arguments[s]:{};s%2?n(Object(o),!0).forEach(function(a){t(i,a,o[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach(function(a){Object.defineProperty(i,a,Object.getOwnPropertyDescriptor(o,a))})}return i}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports})(Nw)),Nw.exports}var bp={},hO;function ome(){return hO||(hO=1,Object.defineProperty(bp,"__esModule",{value:!0}),bp.commonLocale=void 0,bp.commonLocale={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0}),bp}var fO;function ame(){if(fO)return xp;fO=1;var e=Fy().default;Object.defineProperty(xp,"__esModule",{value:!0}),xp.default=void 0;var t=e(sme()),n=ome(),r=(0,t.default)((0,t.default)({},n.commonLocale),{},{locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",week:"周",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪",yearFormat:"YYYY年",cellDateFormat:"D",monthBeforeYear:!1});return xp.default=r,xp}var yp={},pO;function e9(){if(pO)return yp;pO=1,Object.defineProperty(yp,"__esModule",{value:!0}),yp.default=void 0;const e={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]};return yp.default=e,yp}var mO;function t9(){if(mO)return vp;mO=1;var e=Fy().default;Object.defineProperty(vp,"__esModule",{value:!0}),vp.default=void 0;var t=e(ame()),n=e(e9());const r={lang:Object.assign({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},t.default),timePickerLocale:Object.assign({},n.default)};return r.lang.ok="确定",vp.default=r,vp}var gO;function lme(){if(gO)return gp;gO=1;var e=Fy().default;Object.defineProperty(gp,"__esModule",{value:!0}),gp.default=void 0;var t=e(t9());return gp.default=t.default,gp}var vO;function cme(){if(vO)return pp;vO=1;var e=Fy().default;Object.defineProperty(pp,"__esModule",{value:!0}),pp.default=void 0;var t=e(tme()),n=e(lme()),r=e(t9()),i=e(e9());const s="${label}不是一个有效的${type}",o={locale:"zh-cn",Pagination:t.default,DatePicker:r.default,TimePicker:i.default,Calendar:n.default,global:{placeholder:"请选择",close:"关闭"},Table:{filterTitle:"筛选",filterConfirm:"确定",filterReset:"重置",filterEmptyText:"无筛选项",filterCheckAll:"全选",filterSearchPlaceholder:"在筛选项中搜索",emptyText:"暂无数据",selectAll:"全选当页",selectInvert:"反选当页",selectNone:"清空所有",selectionAll:"全选所有",sortTitle:"排序",expand:"展开行",collapse:"关闭行",triggerDesc:"点击降序",triggerAsc:"点击升序",cancelSort:"取消排序"},Modal:{okText:"确定",cancelText:"取消",justOkText:"知道了"},Tour:{Next:"下一步",Previous:"上一步",Finish:"结束导览"},Popconfirm:{cancelText:"取消",okText:"确定"},Transfer:{titles:["",""],searchPlaceholder:"请输入搜索内容",itemUnit:"项",itemsUnit:"项",remove:"删除",selectCurrent:"全选当页",removeCurrent:"删除当页",selectAll:"全选所有",deselectAll:"取消全选",removeAll:"删除全部",selectInvert:"反选当页"},Upload:{uploading:"文件上传中",removeFile:"删除文件",uploadError:"上传错误",previewFile:"预览文件",downloadFile:"下载文件"},Empty:{description:"暂无数据"},Icon:{icon:"图标"},Text:{edit:"编辑",copy:"复制",copied:"复制成功",expand:"展开",collapse:"收起"},Form:{optional:"(可选)",defaultValidateMessages:{default:"字段验证错误${label}",required:"请输入${label}",enum:"${label}必须是其中一个[${enum}]",whitespace:"${label}不能为空字符",date:{format:"${label}日期格式无效",parse:"${label}不能转换为日期",invalid:"${label}是一个无效日期"},types:{string:s,method:s,array:s,object:s,number:s,date:s,boolean:s,integer:s,float:s,regexp:s,email:s,url:s,hex:s},string:{len:"${label}须为${len}个字符",min:"${label}最少${min}个字符",max:"${label}最多${max}个字符",range:"${label}须在${min}-${max}字符之间"},number:{len:"${label}必须等于${len}",min:"${label}最小值为${min}",max:"${label}最大值为${max}",range:"${label}须在${min}-${max}之间"},array:{len:"须为${len}个${label}",min:"最少${min}个${label}",max:"最多${max}个${label}",range:"${label}数量须在${min}-${max}之间"},pattern:{mismatch:"${label}与模式不匹配${pattern}"}}},Image:{preview:"预览"},QRCode:{expired:"二维码过期",refresh:"点击刷新",scanned:"已扫描"},ColorPicker:{presetEmpty:"暂无",transparent:"无色",singleColor:"单色",gradientColor:"渐变色"}};return pp.default=o,pp}var Iw,xO;function ume(){return xO||(xO=1,Iw=cme()),Iw}var dme=ume();const hme=ns(dme);var sx={exports:{}},fme=sx.exports,bO;function pme(){return bO||(bO=1,(function(e,t){(function(n,r){e.exports=r(V4())})(fme,(function(n){function r(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var i=r(n),s={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(o,a){return a==="W"?o+"周":o+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(o,a){var l=100*o+a;return l<600?"凌晨":l<900?"早上":l<1100?"上午":l<1300?"中午":l<1800?"下午":"晚上"}};return i.default.locale(s,null,!0),s}))})(sx)),sx.exports}pme();Dr.locale("zh-cn");function mme({children:e}){const t=QH()==="dark",n=t?{ink:"#f0f1f4",hover:"#d4d6dc",border:"#343740",placeholder:"#777c87",fill:"#272a31",fillHover:"#343740",mid:"#969ba6",outline:"rgba(150, 155, 166, .25)",link:"#7daaff",surface:"#181a1f"}:{ink:"#18181b",hover:"#3f3f46",border:"#e4e4e7",placeholder:"#a1a1aa",fill:"#f4f4f5",fillHover:"#e4e4e7",mid:"#71717a",outline:"rgba(161, 161, 170, .2)",link:"#2563eb",surface:"#ffffff"};return d.jsx(LQ,{hashPriority:"high",children:d.jsx(_l,{locale:hme,button:{autoInsertSpace:!1},theme:{algorithm:t?FR.darkAlgorithm:FR.defaultAlgorithm,token:{colorPrimary:n.ink,colorTextLightSolid:t?"#0e0f12":"#ffffff",colorLink:n.link,colorBorder:n.border,colorBgContainer:n.surface,colorBgElevated:n.surface,colorTextPlaceholder:n.placeholder,borderRadius:8,fontSize:12,controlHeight:32,controlHeightLG:36,fontSizeLG:13,borderRadiusLG:8,fontFamily:"inherit",zIndexPopupBase:1100,colorPrimaryHover:n.hover,controlOutline:n.outline,controlItemBgActive:n.fill,controlItemBgActiveHover:n.fillHover},components:{Segmented:{itemSelectedColor:n.ink,trackBg:n.fill},DatePicker:{cellActiveWithRangeBg:n.fill,activeBorderColor:n.mid,hoverBorderColor:n.placeholder},Input:{activeBorderColor:n.mid,hoverBorderColor:n.placeholder},Select:{optionSelectedBg:n.fill,optionSelectedFontWeight:500,activeBorderColor:n.mid,hoverBorderColor:n.placeholder}}},children:e})})}function gme(){return!!document.querySelector(".ant-picker-dropdown:not(.ant-picker-dropdown-hidden), .ant-select-dropdown:not(.ant-select-dropdown-hidden), .ant-dropdown:not(.ant-dropdown-hidden)")}const vme='button:not([disabled]), [href], input:not([disabled]), [tabindex]:not([tabindex="-1"])';function Vo(e){const{panel:t,initial:n,dismissible:r,onDismiss:i}=e,s=m.useRef(void 0),o=Cn(i);Xb(()=>{s.current=document.activeElement instanceof HTMLElement?document.activeElement:void 0,requestAnimationFrame(()=>{var a;return(a=n.current)==null?void 0:a.focus()})}),Qg(()=>{var a;return(a=s.current)==null?void 0:a.focus()}),kr("keydown",a=>{var h;if(a.key==="Escape"&&r&&!gme()){a.preventDefault(),o();return}if(a.key!=="Tab")return;const l=[...((h=t.current)==null?void 0:h.querySelectorAll(vme))??[]];if(!l.length)return;const c=l[0],u=l.at(-1);a.shiftKey&&document.activeElement===c?(a.preventDefault(),u.focus()):!a.shiftKey&&document.activeElement===u&&(a.preventDefault(),c.focus())},{target:()=>document})}function Ro({label:e,disabled:t,active:n,onClick:r,children:i}){const s=d.jsx("button",{type:"button","aria-label":e,"aria-pressed":n,disabled:t,onClick:r,className:`grid h-8 w-8 place-items-center rounded-lg transition-[color,background-color,transform] duration-200 hover:bg-zinc-100 hover:text-zinc-900 active:scale-[.96] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400/50 disabled:pointer-events-none disabled:opacity-30 ${n?"bg-zinc-100 text-zinc-900":"text-zinc-500"}`,children:i});return d.jsx(on,{content:e,children:s})}function Wi({title:e,description:t,children:n,className:r=""}){return d.jsxs("div",{className:`flex flex-col gap-2.5 border-t border-zinc-100 px-4 py-3.5 first:border-t-0 min-[520px]:flex-row min-[520px]:items-center min-[520px]:gap-4 ${r}`,children:[d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsx("div",{className:"text-[14px] text-zinc-900",children:e}),t&&d.jsx("div",{className:"mt-0.5 text-[12px] leading-5 text-zinc-500",children:t})]}),d.jsx("div",{className:"flex shrink-0 items-center min-[520px]:justify-end",children:n})]})}function Rs({open:e,...t}){return d.jsx(fN,{open:e,children:d.jsx(xme,{...t})})}function xme({title:e,description:t,confirmLabel:n,tone:r="warning",busy:i=!1,error:s,onConfirm:o,onCancel:a}){const l=m.useRef(null),c=m.useRef(null);Vo({panel:l,initial:c,dismissible:!i,onDismiss:a});const u=r==="danger";return d.jsx("div",{className:"ui-overlay fixed inset-0 z-50 grid place-items-center bg-zinc-950/35 p-4",onMouseDown:h=>{!i&&h.currentTarget===h.target&&a()},children:d.jsxs("div",{ref:l,role:"alertdialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title","aria-describedby":"confirm-dialog-description",className:"ui-dialog w-full max-w-[420px] overflow-hidden rounded-[14px] border border-zinc-200 bg-white shadow-[0_28px_90px_rgba(24,24,27,.24)]",children:[d.jsxs("div",{className:"flex gap-3.5 px-5 pb-4 pt-5",children:[d.jsx("div",{className:`grid h-10 w-10 shrink-0 place-items-center rounded-xl ${u?"bg-red-50 text-red-600 ring-1 ring-red-100":"bg-amber-50 text-amber-700 ring-1 ring-amber-100"}`,children:d.jsx(fl,{size:19,strokeWidth:1.8})}),d.jsxs("div",{className:"min-w-0 pt-0.5",children:[d.jsx("h2",{id:"confirm-dialog-title",className:"text-[16px] font-semibold tracking-[-.01em] text-zinc-900",children:e}),d.jsx("p",{id:"confirm-dialog-description",className:"mt-1.5 text-[12px] leading-5 text-zinc-500",children:t})]})]}),s&&d.jsx("div",{className:"mx-5 mb-4 rounded-lg border border-red-100 bg-red-50 px-3 py-2 text-[12px] leading-4 text-red-700",children:s}),d.jsxs("div",{className:"flex justify-end gap-2 border-t border-zinc-100 bg-zinc-50/70 px-5 py-3.5",children:[d.jsx(Pn,{ref:c,size:"large",disabled:i,onClick:a,children:"取消"}),d.jsx(Pn,{type:"primary",danger:u,size:"large",loading:i,onClick:o,className:"min-w-24",children:i?"处理中":n})]})]})})}const bme=5*6e4;function yme(e,t,n){return t&&t.currentVersion!==e?{phase:"done",version:t.currentVersion}:t&&!t.updating&&t.lastError?{phase:"failed",message:t.lastError}:n>bme?{phase:"failed",message:"升级超时,请在终端执行 agent-dock status 查看服务状态"}:{phase:"pending"}}function $o(e){const t=/^(\d+\.\d+\.\d+)(?:-([a-zA-Z][\w-]*))?/.exec(e.trim());return t?`${t[1]}${t[2]?`-${t[2]}`:""}`:e}const $w="h-7 shrink-0 rounded-md px-2 text-[12px] font-medium text-zinc-900 transition-colors hover:bg-zinc-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400/50 disabled:cursor-not-allowed disabled:text-zinc-400";function wme(){const e=Ea(8e3),t=GH(),[n,r]=m.useState(!1),[i,s]=m.useState(!1),o=t.state;if(!o)return null;const a=o.phase==="checking",l=o.phase==="downloading",c=o.phase==="installing"||i,u=a||l||c,h=o.latestVersion,f=Qpe(o),p=Xpe(o),g=Zpe(o.bytesPerSecond),v=o.phase!=="unsupported"&&!u&&o.phase!=="downloaded",x=["available","downloading","downloaded","installing","error"].includes(o.phase),b=async()=>{const S=await t.check();S&&(S.phase==="idle"?e.show(`已是最新版本(${$o(S.currentVersion)})`,"info"):S.phase==="error"?e.show(S.error??"检查更新失败"):S.phase==="available"&&S.latestVersion&&e.show(`发现新版本 ${$o(S.latestVersion)}`,"info"))},y=async()=>{const S=await t.download();(S==null?void 0:S.phase)==="error"&&e.show(S.error??"下载更新失败")},w=async()=>{s(!0);try{await t.install()}catch(S){s(!1),e.show(S instanceof Error?S.message:String(S))}};return d.jsxs(d.Fragment,{children:[x&&d.jsxs("div",{className:"relative mb-2 flex min-h-9 items-center gap-2 overflow-hidden rounded-lg border border-zinc-200 bg-white/80 pl-2.5 pr-1 text-[12px] text-zinc-600 shadow-[0_1px_2px_rgba(24,24,27,.04)]",children:[o.phase==="error"?d.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-red-500"}):u||o.phase==="downloading"?d.jsx(er,{size:13,className:"shrink-0 text-zinc-400"}):d.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500"}),o.phase==="available"&&d.jsxs(d.Fragment,{children:[d.jsx(on,{content:h?`新版本 ${h}`:"新版本",children:d.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["新版本 ",d.jsx("span",{className:"font-mono text-zinc-800",children:$o(h??"")})," 可用"]})}),d.jsx(on,{content:"下载安装包并在应用内安装,完成后应用会自动重启",children:d.jsx("button",{type:"button",onClick:()=>void y(),className:$w,children:"下载并升级"})})]}),l&&d.jsxs(d.Fragment,{children:[d.jsx(on,{content:[p,g].filter(Boolean).join(" · ")||"正在下载安装包",children:d.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["正在下载",h?d.jsxs(d.Fragment,{children:[" ",d.jsx("span",{className:"font-mono text-zinc-800",children:$o(h)})]}):""," · ",Math.round(f),"%"]})}),d.jsx("span",{className:"h-7 shrink-0 px-2 text-[11px] leading-7 tabular-nums text-zinc-400",children:g})]}),o.phase==="downloaded"&&d.jsxs(d.Fragment,{children:[d.jsx(on,{content:h?`新版本 ${h} 已下载完成`:"更新包已下载完成",children:d.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["新版本 ",d.jsx("span",{className:"font-mono text-zinc-800",children:$o(h??"")})," 已下载"]})}),d.jsx(on,{content:"退出应用、安装新版本并重新启动",children:d.jsx("button",{type:"button",onClick:()=>r(!0),className:$w,children:"重启并安装"})})]}),c&&d.jsx(d.Fragment,{children:d.jsx("span",{className:"min-w-0 flex-1 truncate",children:"正在重启并安装更新…"})}),o.phase==="error"&&d.jsxs(d.Fragment,{children:[d.jsx(on,{content:o.error??"更新失败",children:d.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["更新失败,",o.error?o.error:"请重试"]})}),d.jsx(on,{content:"重新检查更新",children:d.jsx("button",{type:"button",onClick:()=>void b(),className:$w,children:"重试"})})]}),l&&d.jsx("span",{className:"absolute inset-x-0 bottom-0 h-0.5 bg-zinc-100",children:d.jsx("span",{className:"block h-full bg-emerald-500 transition-[width] duration-300",style:{width:`${f}%`}})})]}),d.jsxs("div",{className:"flex h-8 items-center gap-1 text-[12px]",children:[d.jsx(on,{content:`当前版本 ${o.currentVersion}`,children:d.jsxs("span",{className:"min-w-0 truncate",children:["AgentDock ",d.jsx("span",{className:"font-mono",children:$o(o.currentVersion)})]})}),o.phase!=="unsupported"&&d.jsx(on,{content:a?"正在检查更新":o.phase==="downloaded"?"更新已下载,重启后安装":"检查更新",children:d.jsx("button",{type:"button","aria-label":"检查更新",disabled:!v,onClick:()=>void b(),className:"grid h-7 w-7 shrink-0 place-items-center rounded-md text-zinc-400 transition-colors duration-150 hover:bg-white hover:text-zinc-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400/50 disabled:pointer-events-none",children:d.jsx(Wn,{size:13,strokeWidth:2,className:a?"animate-spin text-zinc-500":""})})})]}),ki.createPortal(d.jsxs(d.Fragment,{children:[d.jsx(Rs,{open:n,title:`重启并安装 ${h?$o(h):"新版本"}?`,description:"会退出 AgentDock、安装新版本并自动重新打开,正在执行的任务会被中断。",confirmLabel:"重启并安装",busy:c,onConfirm:()=>void w(),onCancel:()=>r(!1)}),e.toast]}),document.body)]})}function Sme({enabled:e}){return KH()?d.jsx(wme,{}):d.jsx(_me,{enabled:e})}function _me({enabled:e}){const t=Ea(8e3),[n,r]=m.useState(!1),[i,s]=m.useState(!1),[o,a]=m.useState(),l=Fn(),c=It({queryKey:["self-update"],queryFn:()=>Ne.selfUpdateStatus(),enabled:e,retry:!1,refetchInterval:5*6e4,refetchOnWindowFocus:!1}),u=bt({mutationFn:()=>Ne.selfUpdateStatus(!0),onSuccess:b=>{l.setQueryData(["self-update"],b),b.checkError?t.show(b.checkError):b.updateAvailable||t.show(`已是最新版本(${$o(b.currentVersion)})`,"info")},onError:b=>t.show(b.message)}),h=bt({mutationFn:Ne.startSelfUpdate,onSuccess:b=>{r(!1),a({fromVersion:b.currentVersion,...b.latestVersion?{targetVersion:b.latestVersion}:{},startedAt:Date.now()})}});gN(async()=>{if(!o)return;const b=await Ne.selfUpdateStatus().catch(()=>{}),y=yme(o.fromVersion,b,Date.now()-o.startedAt);if(y.phase!=="pending"){if(a(void 0),y.phase==="failed"){t.show(y.message),c.refetch();return}t.show(`已升级到 ${y.version},即将刷新页面`,"info"),window.setTimeout(()=>window.location.reload(),1500)}},o?2e3:void 0);const f=c.data;if(!f)return null;const p=!!o||f.updating,g=(o==null?void 0:o.targetVersion)??f.latestVersion,v=p||f.updateAvailable&&f.latestVersion,x=f.runtime==="foreground"?`当前是前台运行的 AgentDock 进程,界面无法重启它。请先在终端按 Ctrl-C 停止,再执行 npm install -g @agent-dock/cli@${f.distTag},然后重新启动;需要后台常驻可改用 agent-dock start。`:`桌面版请在 AgentDock 应用内升级;浏览器访问时请在运行服务的那台机器上执行 npm install -g @agent-dock/cli@${f.distTag} && agent-dock restart。`;return d.jsxs(d.Fragment,{children:[v&&d.jsxs("div",{className:"mb-2 flex h-9 items-center gap-2 rounded-lg border border-zinc-200 bg-white/80 pl-2.5 pr-1 text-[12px] text-zinc-600 shadow-[0_1px_2px_rgba(24,24,27,.04)]",children:[p?d.jsx(er,{size:13,className:"shrink-0 text-zinc-400"}):d.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500"}),d.jsx(on,{content:g?`${f.distTag} 通道 ${g}`:"新版本",children:d.jsx("span",{className:"min-w-0 flex-1 truncate",children:p?"正在升级,完成后自动刷新":d.jsxs(d.Fragment,{children:["新版本 ",d.jsx("span",{className:"font-mono text-zinc-800",children:$o(g)})," 可用"]})})}),!p&&d.jsx(on,{content:f.canUpdate?"安装新版本并重启服务":"查看手动升级方式",children:d.jsx("button",{type:"button",onClick:()=>{if(!f.canUpdate){s(!0);return}h.reset(),r(!0)},className:"h-7 shrink-0 rounded-md px-2 text-[12px] font-medium text-zinc-900 transition-colors hover:bg-zinc-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400/50",children:"升级"})})]}),d.jsxs("div",{className:"flex h-8 items-center gap-1 text-[12px]",children:[d.jsx(on,{content:f.currentVersion,children:d.jsxs("span",{className:"min-w-0 truncate",children:["AgentDock ",d.jsx("span",{className:"font-mono",children:$o(f.currentVersion)})]})}),d.jsx(on,{content:p?"升级进行中":u.isPending?"正在检查更新":"检查更新",children:d.jsx("button",{type:"button","aria-label":"检查更新",disabled:u.isPending||p,onClick:()=>u.mutate(),className:"grid h-7 w-7 shrink-0 place-items-center rounded-md text-zinc-400 transition-colors duration-150 hover:bg-white hover:text-zinc-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400/50 disabled:pointer-events-none",children:d.jsx(Wn,{size:13,strokeWidth:2,className:u.isPending?"animate-spin text-zinc-500":""})})})]}),ki.createPortal(d.jsxs(d.Fragment,{children:[d.jsx(Rs,{open:n,title:`升级到 ${f.latestVersion?$o(f.latestVersion):"新版本"}?`,description:"会安装新版本并重启 AgentDock 服务,正在执行的任务会被中断,页面会在升级完成后自动刷新。",confirmLabel:"升级并重启",busy:h.isPending,...h.error?{error:h.error.message}:{},onConfirm:()=>h.mutate(),onCancel:()=>r(!1)}),d.jsx(Rs,{open:i,title:"需要手动升级",description:x,confirmLabel:"知道了",onConfirm:()=>s(!1),onCancel:()=>s(!1)}),t.toast]}),document.body)]})}const yO=[{mode:"light",label:"浅色",icon:GX},{mode:"system",label:"跟随系统",icon:PX},{mode:"dark",label:"深色",icon:TX}];function Cme(){const e=eme(),t=yO.findIndex(n=>n.mode===e);return d.jsxs("div",{role:"radiogroup","aria-label":"主题",className:"relative grid grid-cols-3 rounded-lg bg-zinc-100 p-0.5",children:[d.jsx("span",{"aria-hidden":"true",className:"absolute inset-y-0.5 left-0.5 w-[calc((100%-4px)/3)] rounded-md bg-white shadow-sm ring-1 ring-zinc-200 transition-transform duration-200 ease-[cubic-bezier(.2,0,0,1)]",style:{transform:`translateX(${t*100}%)`}}),yO.map(({mode:n,label:r,icon:i})=>d.jsxs("button",{type:"button",role:"radio","aria-checked":e===n,"aria-label":r,title:r,onClick:()=>Jpe(n),className:`relative z-10 flex h-7 items-center justify-center gap-1 rounded-md text-[12px] transition-colors ${e===n?"text-zinc-900":"text-zinc-400 hover:text-zinc-600"}`,children:[d.jsx(i,{size:13}),r]},n))]})}function m0(e,t,n){kr("pointerdown",r=>{var i;(i=e.current)!=null&&i.contains(r.target)||n()},{target:()=>document,enable:t})}const ou="flex h-[34px] w-full items-center gap-2.5 rounded-lg px-2.5 text-[14px] font-medium text-zinc-600 transition-colors duration-150 hover:bg-zinc-100 hover:text-zinc-900";function kme({webDenied:e,archivedCount:t,onSchedule:n,onArchived:r,onImport:i,onAgentConfig:s,onAssistant:o,onLark:a,onLarkAvatar:l,onShare:c}){var b,y;const[u,h]=m.useState(!1),f=m.useRef(null);m0(f,u,()=>h(!1)),kr("keydown",w=>{w.key==="Escape"&&h(!1)},{target:()=>document,enable:u});const p=GH(),g=It({queryKey:["self-update"],queryFn:()=>Ne.selfUpdateStatus(),enabled:!e&&!p.api,retry:!1,refetchInterval:5*6e4,refetchOnWindowFocus:!1}),v=p.api?Ype(p.state):!!((b=g.data)!=null&&b.updateAvailable||(y=g.data)!=null&&y.updating),x=w=>()=>{h(!1),w()};return d.jsxs("div",{ref:f,className:"relative flex min-w-[268px] items-center gap-1 border-t border-zinc-200 p-2",children:[d.jsxs("div",{role:"menu","aria-label":"设置",style:{transformOrigin:"bottom center"},"aria-hidden":!u,inert:!u,className:`absolute inset-x-2 bottom-full z-30 mb-1 max-h-[75dvh] overflow-y-auto rounded-xl border border-zinc-200 bg-white p-1.5 shadow-[0_-12px_36px_rgba(12,13,16,.14)] transition-[opacity,transform,visibility] duration-200 ease-[cubic-bezier(.2,0,0,1)] ${u?"visible translate-y-0 opacity-100":"invisible translate-y-1.5 opacity-0"}`,children:[d.jsxs("button",{type:"button",role:"menuitem",onClick:x(n),className:ou,children:[d.jsx(dl,{size:16}),d.jsx("span",{children:"定时任务"})]}),d.jsxs("button",{type:"button",role:"menuitem",onClick:x(r),className:ou,children:[d.jsx(jd,{size:16}),d.jsx("span",{children:"归档会话"}),d.jsx("span",{className:"ml-auto text-[12px] tabular-nums text-zinc-400",children:t})]}),d.jsxs("button",{type:"button",role:"menuitem",onClick:x(i),className:ou,children:[d.jsx(fa,{size:16}),d.jsx("span",{children:"导入外部会话"})]}),d.jsx("div",{className:"my-1 border-t border-zinc-200/70"}),d.jsxs("button",{type:"button",role:"menuitem",onClick:x(s),className:ou,children:[d.jsx(ii,{size:16}),d.jsx("span",{children:"Agent 设置"})]}),d.jsxs("button",{type:"button",role:"menuitem",onClick:x(o),className:ou,children:[d.jsx(ps,{size:16}),d.jsx("span",{children:"小猫与督办"})]}),d.jsxs("button",{type:"button",role:"menuitem",onClick:x(a),className:ou,children:[d.jsx(ty,{size:16}),d.jsx("span",{children:"飞书设置"})]}),d.jsxs("button",{type:"button",role:"menuitem",onClick:x(l),className:ou,children:[d.jsx(ii,{size:16}),d.jsx("span",{children:"AI 飞书替身"})]}),d.jsx("div",{className:"my-1 border-t border-zinc-200/70"}),d.jsxs("div",{className:"px-2.5 py-1",children:[d.jsx("div",{className:"mb-1.5 text-[12px] text-zinc-500",children:"外观"}),d.jsx(Cme,{})]}),d.jsxs("div",{className:"px-2.5 py-1 text-[12px] text-zinc-600",children:[d.jsx(Kpe,{enabled:!e}),d.jsx(Gpe,{enabled:!e})]}),d.jsx("div",{className:"mt-1 border-t border-zinc-200/70 px-2.5 pb-1 pt-2 text-[12px] text-zinc-400",children:d.jsx(Sme,{enabled:!e})})]}),d.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":u,onClick:()=>h(w=>!w),className:`flex h-9 min-w-0 flex-1 items-center gap-2.5 rounded-lg px-2.5 text-[14px] font-medium transition-colors duration-150 ${u?"bg-zinc-100 text-zinc-900":"text-zinc-600 hover:bg-zinc-100 hover:text-zinc-900"}`,children:[d.jsx(qX,{size:16,className:`transition-transform duration-300 ease-[cubic-bezier(.2,0,0,1)] ${u?"rotate-90":""}`}),d.jsx("span",{children:"设置"}),v&&d.jsxs("span",{className:"ml-auto flex items-center gap-1 text-[12px] font-normal text-emerald-600",children:[d.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 ui-status-pulse"}),"有新版本"]})]}),d.jsx(on,{content:"在手机上打开(扫码)",children:d.jsx("button",{type:"button",onClick:()=>{h(!1),c()},"aria-label":"在手机上打开",className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg text-zinc-600 transition-colors duration-150 hover:bg-zinc-100 hover:text-zinc-900",children:d.jsx(KL,{size:16})})})]})}var Nme=Object.defineProperty,ob=Object.getOwnPropertySymbols,n9=Object.prototype.hasOwnProperty,r9=Object.prototype.propertyIsEnumerable,wO=(e,t,n)=>t in e?Nme(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ZC=(e,t)=>{for(var n in t||(t={}))n9.call(t,n)&&wO(e,n,t[n]);if(ob)for(var n of ob(t))r9.call(t,n)&&wO(e,n,t[n]);return e},XC=(e,t)=>{var n={};for(var r in e)n9.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ob)for(var r of ob(e))t.indexOf(r)<0&&r9.call(e,r)&&(n[r]=e[r]);return n};/**
|
|
862
862
|
* @license QR Code generator library (TypeScript)
|
|
863
863
|
* Copyright (c) Project Nayuki.
|
|
864
864
|
* SPDX-License-Identifier: MIT
|
|
@@ -976,7 +976,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
976
976
|
`),i;function s(o){return r.stack.push(o),a;function a(){r.stack.pop()}}}function ZEe(e){throw new Error("Cannot handle value `"+e+"`, expected node")}function XEe(e){const t=e;throw new Error("Cannot handle unknown node `"+t.type+"`")}function QEe(e,t){if(e.type==="definition"&&e.type===t.type)return 0}function JEe(e,t){return BEe(e,this,t)}function eje(e,t){return HEe(e,this,t)}function tje(e,t){return UEe(this,e,t)}function nje(){return{enter:{table:rje,tableData:dA,tableHeader:dA,tableRow:sje},exit:{codeText:oje,table:ije,tableData:pS,tableHeader:pS,tableRow:pS}}}function rje(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function ije(e){this.exit(e),this.data.inTable=void 0}function sje(e){this.enter({type:"tableRow",children:[]},e)}function pS(e){this.exit(e)}function dA(e){this.enter({type:"tableCell",children:[]},e)}function oje(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,aje));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function aje(e,t){return t==="|"?t:e}function lje(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
977
977
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:l,tableRow:a}};function o(p,g,v,x){return c(u(p,v,x),p.align)}function a(p,g,v,x){const b=h(p,v,x),y=c([b]);return y.slice(0,y.indexOf(`
|
|
978
978
|
`))}function l(p,g,v,x){const b=v.enter("tableCell"),y=v.enter("phrasing"),w=v.containerPhrasing(p,{...x,before:s,after:s});return y(),b(),w}function c(p,g){return nEe(p,{align:g,alignDelimiters:r,padding:n,stringLength:i})}function u(p,g,v){const x=p.children;let b=-1;const y=[],w=g.enter("table");for(;++b<x.length;)y[b]=h(x[b],g,v);return w(),y}function h(p,g,v){const x=p.children;let b=-1;const y=[],w=g.enter("tableRow");for(;++b<x.length;)y[b]=l(x[b],p,g,v);return w(),y}function f(p,g,v){let x=Rj.inlineCode(p,g,v);return v.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function cje(){return{exit:{taskListCheckValueChecked:hA,taskListCheckValueUnchecked:hA,paragraph:dje}}}function uje(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:hje}}}function hA(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function dje(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let s=-1,o;for(;++s<i.length;){const a=i[s];if(a.type==="paragraph"){o=a;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function hje(e,t,n,r){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(o);let l=Rj.listItem(e,t,n,{...r,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+o}}function fje(){return[kNe(),UNe(),ZNe(),nje(),cje()]}function pje(e){return{extensions:[NNe(),KNe(e),XNe(),lje(e),uje()]}}const mje={tokenize:wje,partial:!0},lW={tokenize:Sje,partial:!0},cW={tokenize:_je,partial:!0},uW={tokenize:Cje,partial:!0},gje={tokenize:kje,partial:!0},dW={name:"wwwAutolink",tokenize:bje,previous:fW},hW={name:"protocolAutolink",tokenize:yje,previous:pW},Nl={name:"emailAutolink",tokenize:xje,previous:mW},za={};function vje(){return{text:za}}let cu=48;for(;cu<123;)za[cu]=Nl,cu++,cu===58?cu=65:cu===91&&(cu=97);za[43]=Nl;za[45]=Nl;za[46]=Nl;za[95]=Nl;za[72]=[Nl,hW];za[104]=[Nl,hW];za[87]=[Nl,dW];za[119]=[Nl,dW];function xje(e,t,n){const r=this;let i,s;return o;function o(h){return!jk(h)||!mW.call(r,r.previous)||Oj(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(h))}function a(h){return jk(h)?(e.consume(h),a):h===64?(e.consume(h),l):n(h)}function l(h){return h===46?e.check(gje,u,c)(h):h===45||h===95||Pi(h)?(s=!0,e.consume(h),l):u(h)}function c(h){return e.consume(h),i=!0,l}function u(h){return s&&i&&Ji(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function bje(e,t,n){const r=this;return i;function i(o){return o!==87&&o!==119||!fW.call(r,r.previous)||Oj(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(mje,e.attempt(lW,e.attempt(cW,s),n),n)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function yje(e,t,n){const r=this;let i="",s=!1;return o;function o(h){return(h===72||h===104)&&pW.call(r,r.previous)&&!Oj(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),e.consume(h),a):n(h)}function a(h){if(Ji(h)&&i.length<5)return i+=String.fromCodePoint(h),e.consume(h),a;if(h===58){const f=i.toLowerCase();if(f==="http"||f==="https")return e.consume(h),l}return n(h)}function l(h){return h===47?(e.consume(h),s?c:(s=!0,l)):n(h)}function c(h){return h===null||wb(h)||Gn(h)||yd(h)||Xy(h)?n(h):e.attempt(lW,e.attempt(cW,u),n)(h)}function u(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function wje(e,t,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),i):o===46&&r===3?(e.consume(o),s):n(o)}function s(o){return o===null?n(o):t(o)}}function Sje(e,t,n){let r,i,s;return o;function o(c){return c===46||c===95?e.check(uW,l,a)(c):c===null||Gn(c)||yd(c)||c!==45&&Xy(c)?l(c):(s=!0,e.consume(c),o)}function a(c){return c===95?r=!0:(i=r,r=void 0),e.consume(c),o}function l(c){return i||r||!s?n(c):t(c)}}function _je(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(uW,t,s)(o):o===null||Gn(o)||yd(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&r++,e.consume(o),i}}function Cje(e,t,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),r):a===38?(e.consume(a),s):a===93?(e.consume(a),i):a===60||a===null||Gn(a)||yd(a)?t(a):n(a)}function i(a){return a===null||a===40||a===91||Gn(a)||yd(a)?t(a):r(a)}function s(a){return Ji(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),r):Ji(a)?(e.consume(a),o):n(a)}}function kje(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return Pi(s)?n(s):t(s)}}function fW(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Gn(e)}function pW(e){return!Ji(e)}function mW(e){return!(e===47||jk(e))}function jk(e){return e===43||e===45||e===46||e===95||Pi(e)}function Oj(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Nje={tokenize:Oje,partial:!0};function Eje(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Ije,continuation:{tokenize:$je},exit:Rje}},text:{91:{name:"gfmFootnoteCall",tokenize:Mje},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:jje,resolveTo:zje}}}}function jje(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const c=Do(r.sliceSerialize({start:o.end,end:r.now()}));return c.codePointAt(0)!==94||!s.includes(c.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function zje(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function Mje(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,o;return a;function a(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),l}function l(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(h){if(s>999||h===93&&!o||h===null||h===91||Gn(h))return n(h);if(h===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return i.includes(Do(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return Gn(h)||(o=!0),s++,e.consume(h),h===92?u:c}function u(h){return h===91||h===92||h===93?(e.consume(h),s++,c):c(h)}}function Ije(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,a;return l;function l(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):n(g)}function u(g){if(o>999||g===93&&!a||g===null||g===91||Gn(g))return n(g);if(g===93){e.exit("chunkString");const v=e.exit("gfmFootnoteDefinitionLabelString");return s=Do(r.sliceSerialize(v)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return Gn(g)||(a=!0),o++,e.consume(g),g===92?h:u}function h(g){return g===91||g===92||g===93?(e.consume(g),o++,u):u(g)}function f(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),i.includes(s)||i.push(s),kn(e,p,"gfmFootnoteDefinitionWhitespace")):n(g)}function p(g){return t(g)}}function $je(e,t,n){return e.check(v0,t,e.attempt(Nje,t,n))}function Rje(e){e.exit("gfmFootnoteDefinition")}function Oje(e,t,n){const r=this;return kn(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):n(s)}}function Pje(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let c=l;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[l][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[l][1].end)},h={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[l][1].start)},f=[["enter",u,a],["enter",o[c][1],a],["exit",o[c][1],a],["enter",h,a]],p=a.parser.constructs.insideSpan.null;p&&Os(f,f.length,0,Qy(p,o.slice(c+1,l),a)),Os(f,f.length,0,[["exit",h,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),Os(o,c-1,l-c+3,f),l=c+f.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function s(o,a,l){const c=this.previous,u=this.events;let h=0;return f;function f(g){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(g):(o.enter("strikethroughSequenceTemporary"),p(g))}function p(g){const v=_f(c);if(g===126)return h>1?l(g):(o.consume(g),h++,p);if(h<2&&!n)return l(g);const x=o.exit("strikethroughSequenceTemporary"),b=_f(g);return x._open=!b||b===2&&!!v,x._close=!v||v===2&&!!b,a(g)}}}class Tje{constructor(){this.map=[],this.index=new Map}add(t,n,r){Aje(this,t,n,r)}consume(t){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0,this.index.clear()}}function Aje(e,t,n,r){if(n===0&&r.length===0)return;const i=e.index.get(t);if(i){i[1]+=n,i[2].push(...r);return}const s=[t,n,r];e.map.push(s),e.index.set(t,s)}function Dje(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function Lje(){return{flow:{null:{name:"table",tokenize:Fje,resolveAll:Bje}}}}function Fje(e,t,n){const r=this;let i=0,s=0,o;return a;function a(N){let $=r.events.length-1;for(;$>-1;){const{type:E}=r.events[$][1];if(E==="lineEnding"||E==="linePrefix")$--;else break}const R=$>-1?r.events[$][1].type:null,P=R==="tableHead"||R==="tableRow"?_:l;return P===_&&r.parser.lazy[r.now().line]?n(N):P(N)}function l(N){return e.enter("tableHead"),e.enter("tableRow"),c(N)}function c(N){return N===124||(o=!0,s+=1),u(N)}function u(N){return N===null?n(N):At(N)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),p):n(N):pn(N)?kn(e,u,"whitespace")(N):(s+=1,o&&(o=!1,i+=1),N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),o=!0,u):(e.enter("data"),h(N)))}function h(N){return N===null||N===124||Gn(N)?(e.exit("data"),u(N)):(e.consume(N),N===92?f:h)}function f(N){return N===92||N===124?(e.consume(N),h):h(N)}function p(N){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(N):(e.enter("tableDelimiterRow"),o=!1,pn(N)?kn(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):g(N))}function g(N){return N===45||N===58?x(N):N===124?(o=!0,e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),v):C(N)}function v(N){return pn(N)?kn(e,x,"whitespace")(N):x(N)}function x(N){return N===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),b):N===45?(s+=1,b(N)):N===null||At(N)?S(N):C(N)}function b(N){return N===45?(e.enter("tableDelimiterFiller"),y(N)):C(N)}function y(N){return N===45?(e.consume(N),y):N===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),w):(e.exit("tableDelimiterFiller"),w(N))}function w(N){return pn(N)?kn(e,S,"whitespace")(N):S(N)}function S(N){return N===124?g(N):N===null||At(N)?!o||i!==s?C(N):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(N)):C(N)}function C(N){return n(N)}function _(N){return e.enter("tableRow"),k(N)}function k(N){return N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),k):N===null||At(N)?(e.exit("tableRow"),t(N)):pn(N)?kn(e,k,"whitespace")(N):(e.enter("data"),z(N))}function z(N){return N===null||N===124||Gn(N)?(e.exit("data"),k(N)):(e.consume(N),N===92?j:z)}function j(N){return N===92||N===124?(e.consume(N),z):z(N)}}function Bje(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,c,u,h;const f=new Tje;for(;++n<e.length;){const p=e[n],g=p[1];p[0]==="enter"?g.type==="tableHead"?(a=!1,l!==0&&(fA(f,t,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},f.add(n,0,[["enter",c,t]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,h=void 0,s=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,u={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},f.add(n,0,[["enter",u,t]])),i=g.type==="tableDelimiterRow"?2:u?3:1):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],h=kv(f,t,s,i,void 0,h),s=[0,0,0,0]),o[2]=n)):g.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(o[0]=o[1],h=kv(f,t,s,i,void 0,h)),s=o,o=[s[1],n,0,0])):g.type==="tableHead"?(a=!0,l=n):g.type==="tableRow"||g.type==="tableDelimiterRow"?(l=n,s[1]!==0?(o[0]=o[1],h=kv(f,t,s,i,n,h)):o[1]!==0&&(h=kv(f,t,o,i,n,h)),i=0):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&fA(f,t,l,c,u),f.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=Dje(t.events,n))}return e}function kv(e,t,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(s.end=Object.assign({},ah(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const l=ah(t.events,n[1]);if(s={type:o,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const c=ah(t.events,n[2]),u=ah(t.events,n[3]),h={type:a,start:Object.assign({},c),end:Object.assign({},u)};if(e.add(n[2],0,[["enter",h,t]]),r!==2){const f=t.events[n[2]],p=t.events[n[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const g=n[2]+1,v=n[3]-n[2]-1;e.add(g,v,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return i!==void 0&&(s.end=Object.assign({},ah(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function fA(e,t,n,r,i){const s=[],o=ah(t.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function ah(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const Hje={name:"tasklistCheck",tokenize:Wje};function Vje(){return{text:{91:Hje}}}function Wje(e,t,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),s)}function s(l){return Gn(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(l)}function a(l){return At(l)?t(l):pn(l)?e.check({tokenize:qje},t,n)(l):n(l)}}function qje(e,t,n){return kn(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function Uje(e){return wV([vje(),Eje(),Pje(e),Lje(),Vje()])}const Kje={};function gW(e){const t=this,n=e||Kje,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Uje(n)),s.push(fje()),o.push(pje(n))}function Gje(e){WV(e,[/\r?\n|\r/g,Yje])}function Yje(){return{type:"break"}}function Zje(){return function(e){Gje(e)}}const Xje=new Set(["code","pre","a"]),Qje=/[\u3000-\u303f\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\uff00-\uffef]/;function Jje(e){const t=[];let n="";const r=()=>{n&&(t.push(n),n="")};for(const i of e){if(i===`
|
|
979
|
-
`){r(),t.push(i);continue}if(Qje.test(i)){r(),t.push(i);continue}n+=i}return r(),t}function eze(e){return{type:"element",tagName:"span",properties:{className:["ui-tw-unit"]},children:[{type:"text",value:e}]}}function vW(e,t){if(!Array.isArray(e.children))return;const n=t||e.type==="element"&&Xje.has(e.tagName??""),r=[];for(const i of e.children){if(i.type==="text"&&typeof i.value=="string"&&!n&&i.value.trim()){for(const s of Jje(i.value))r.push(eze(s));continue}vW(i,n),r.push(i)}e.children=r}function tze(){return e=>{vW(e,!1)}}function Pj(e){if(!e||e.startsWith("#")||e.startsWith("//")||/^(?!file:)[a-z][a-z\d+.-]*:/i.test(e))return;let t=e;if(/^file:/i.test(t))try{const r=new URL(t);if(r.protocol!=="file:"||r.hostname&&r.hostname!=="localhost")return;t=decodeURIComponent(r.pathname)}catch{return}else try{t=decodeURIComponent(t.split(/[?#]/,1)[0])}catch{return}const n=t.slice(t.lastIndexOf("/")+1);if(/\.[^/.]+:\d+(?::\d+)?$/.test(n)&&(t=t.replace(/:\d+(?::\d+)?$/,"")),!(!t||t.includes("\0")||t.startsWith("/api/")||t.startsWith("/sessions/")))return t}function xW(e,t){var s;const n=(s=Pj(e))==null?void 0:s.replace(/\\/g,"/");if(!n)return;const r=t.replace(/\\/g,"/").replace(/\/$/,"");if(n.startsWith("/"))return!r||!n.startsWith(`${r}/`)?void 0:n.slice(r.length+1);const i=[];for(const o of n.split("/"))if(!(!o||o==="."))if(o===".."){if(!i.length)return;i.pop()}else i.push(o);return i.join("/")||void 0}function nze(e,t){const n=Pj(e);return xW(e,t)??(n!=null&&n.startsWith("/")?n:void 0)}const rze=m.lazy(()=>A4(()=>import("./ImageLightbox-
|
|
979
|
+
`){r(),t.push(i);continue}if(Qje.test(i)){r(),t.push(i);continue}n+=i}return r(),t}function eze(e){return{type:"element",tagName:"span",properties:{className:["ui-tw-unit"]},children:[{type:"text",value:e}]}}function vW(e,t){if(!Array.isArray(e.children))return;const n=t||e.type==="element"&&Xje.has(e.tagName??""),r=[];for(const i of e.children){if(i.type==="text"&&typeof i.value=="string"&&!n&&i.value.trim()){for(const s of Jje(i.value))r.push(eze(s));continue}vW(i,n),r.push(i)}e.children=r}function tze(){return e=>{vW(e,!1)}}function Pj(e){if(!e||e.startsWith("#")||e.startsWith("//")||/^(?!file:)[a-z][a-z\d+.-]*:/i.test(e))return;let t=e;if(/^file:/i.test(t))try{const r=new URL(t);if(r.protocol!=="file:"||r.hostname&&r.hostname!=="localhost")return;t=decodeURIComponent(r.pathname)}catch{return}else try{t=decodeURIComponent(t.split(/[?#]/,1)[0])}catch{return}const n=t.slice(t.lastIndexOf("/")+1);if(/\.[^/.]+:\d+(?::\d+)?$/.test(n)&&(t=t.replace(/:\d+(?::\d+)?$/,"")),!(!t||t.includes("\0")||t.startsWith("/api/")||t.startsWith("/sessions/")))return t}function xW(e,t){var s;const n=(s=Pj(e))==null?void 0:s.replace(/\\/g,"/");if(!n)return;const r=t.replace(/\\/g,"/").replace(/\/$/,"");if(n.startsWith("/"))return!r||!n.startsWith(`${r}/`)?void 0:n.slice(r.length+1);const i=[];for(const o of n.split("/"))if(!(!o||o==="."))if(o===".."){if(!i.length)return;i.pop()}else i.push(o);return i.join("/")||void 0}function nze(e,t){const n=Pj(e);return xW(e,t)??(n!=null&&n.startsWith("/")?n:void 0)}const rze=m.lazy(()=>A4(()=>import("./ImageLightbox-BQrxoDkw.js"),__vite__mapDeps([0,1,2,3,4]))),ize=new Set([".png",".jpg",".jpeg",".gif",".webp",".bmp",".svg"]);function sze(e,t){var r;if(!e||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:")||e.startsWith("/api/"))return e;const n=(r=e.split(".").pop())==null?void 0:r.toLowerCase();if(n&&ize.has(`.${n}`)&&t&&e.includes(".agentdock/uploads")){const i=e.split(/[/\\]/).pop();if(i)return`/api/sessions/${t}/uploads/${i}`}return e}const oze={csharp:"csharp",cs:"csharp",html:"markup",js:"javascript",jsx:"jsx",md:"markdown",py:"python",rb:"ruby",rs:"rust",sh:"bash",shell:"bash",ts:"typescript",tsx:"tsx",xml:"markup",yml:"yaml",zsh:"bash"};function aze(e){var r,i;const t=((i=(r=/(?:^|\s)language-([\w-]+)/.exec(e??""))==null?void 0:r[1])==null?void 0:i.toLowerCase())??"",n=oze[t]??t;return{language:n&&aY.languages[n]?n:"plain",label:t||"text"}}function bW(e,t){return!!(e!=null&&e.includes("language-")||String(t).includes(`
|
|
980
980
|
`))}const yW=m.memo(function({code:t,className:n}){const{language:r,label:i}=aze(n),s=QH()==="dark",[o,a]=m.useState(!1);KZ(()=>a(!1),o?1500:void 0);const l=async()=>{var c;try{if((c=navigator.clipboard)!=null&&c.writeText)await navigator.clipboard.writeText(t);else{const u=document.createElement("textarea");u.value=t,u.style.position="fixed",u.style.opacity="0",document.body.appendChild(u),u.select(),document.execCommand("copy"),document.body.removeChild(u)}a(!0)}catch{a(!1)}};return d.jsxs("div",{className:"code-renderer group/code my-4 overflow-hidden rounded-[10px] border border-zinc-200 bg-[rgb(var(--code-bg))] [contain:layout_paint]",children:[d.jsxs("div",{className:"flex h-8 items-center px-3",children:[d.jsx("span",{className:"font-mono text-[12px] text-zinc-500",children:i}),d.jsxs("button",{type:"button",onClick:()=>void l(),className:"ml-auto flex h-6 items-center gap-1.5 rounded-md px-2 text-[12px] font-medium text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400/50","aria-label":o?"代码已复制":"复制代码",children:[o?d.jsx(ni,{size:12}):d.jsx(_3,{size:12}),d.jsx("span",{children:o?"已复制":"复制"})]})]}),d.jsx(oY,{theme:s?WM.vsDark:WM.vsLight,code:t,language:r,children:({className:c,style:u,tokens:h,getLineProps:f,getTokenProps:p})=>d.jsx("pre",{className:`${c} code-renderer-scroll m-0 overflow-x-auto px-4 pb-3.5 pt-1 text-[13px] leading-6`,style:{...u,backgroundColor:"transparent"},children:d.jsx("code",{children:h.map((g,v)=>d.jsx("span",{...f({line:g}),className:"block min-h-6",children:g.map((x,b)=>d.jsx("span",{...p({token:x})},b))},v))})})})]})});function lze({src:e,alt:t}){const[n,r]=m.useState(!1),[i,s]=m.useState(!1);return d.jsxs(d.Fragment,{children:[d.jsx("img",{src:e,alt:t??"",loading:"lazy",onClick:()=>{r(!0),s(!0)},className:"my-2 max-h-40 w-auto max-w-full cursor-zoom-in object-contain transition-shadow hover:shadow-md"}),n&&d.jsx(m.Suspense,{fallback:null,children:d.jsx(rze,{src:e,alt:t,open:i,onClose:()=>s(!1)})})]})}const wW={a({href:e,children:t}){return d.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-link underline decoration-[#2563eb]/40 underline-offset-2 hover:decoration-[#2563eb]",children:t})},code({className:e,children:t}){return bW(e,t)?d.jsx(yW,{className:e,code:String(t).replace(/\n$/,"")}):d.jsx("code",{className:"rounded bg-zinc-100 px-[.32rem] py-[.12rem] font-mono text-[.9em] text-zinc-800",children:t})},pre({children:e}){return d.jsx(d.Fragment,{children:e})},table({children:e}){return d.jsx("div",{className:"markdown-table-scroll",children:d.jsx("table",{children:e})})}},cze={...wW,code({className:e,children:t}){return bW(e,t)?d.jsx(yW,{className:e,code:String(t).replace(/\n$/,"")}):/^\/[^\s]+$/.test(String(t))?d.jsx("code",{className:"ui-slash-command",children:t}):d.jsx("code",{className:"rounded bg-zinc-100 px-[.32rem] py-[.12rem] font-mono text-[.9em] text-zinc-800",children:t})}},zh=m.memo(function({children:t,sessionId:n,throttleMs:r,animateUnits:i=!1,highlightSlashCommands:s=!1}){const o=UZ(t,{wait:r??0}),a=r?o:t,l={...s?cze:wW,a({href:c,children:u}){const h=c?Pj(c):void 0;return h&&n?d.jsx("button",{type:"button",title:h,onClick:()=>{const f=Xa.getState();f.openTab({id:`preview:${f.primarySessionId}:${n}:${h}`,kind:"files",anchorSessionId:n,filePath:h,title:h.split("/").at(-1)||"文件"})},className:"font-medium text-link underline decoration-[#2563eb]/40 underline-offset-2 hover:decoration-[#2563eb]",children:u}):d.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-link underline decoration-[#2563eb]/40 underline-offset-2 hover:decoration-[#2563eb]",children:u})},img({src:c,alt:u}){const h=sze(c??"",n);return h?d.jsx(lze,{src:h,alt:u??""}):null}};return d.jsx(vNe,{remarkPlugins:[gW,Zje],rehypePlugins:i?[tze]:[],urlTransform:c=>/^file:/i.test(c)?c:VV(c),components:l,children:a})}),SW={baseCharsPerSecond:14,catchUpSeconds:3,drainSeconds:.9},uze=.1,dze=40;function hze(e,t,n,r,i=SW){if(e>=t)return t;const s=t-e,a=(r?i.baseCharsPerSecond+s/Math.max(.1,i.catchUpSeconds):s/Math.max(.05,i.drainSeconds))*Math.max(0,Math.min(uze,n));return Math.min(t,e+(r?a:Math.max(1,a)))}function fze(e){var n;if(!e)return e;const t=mze(e);if(t.openStart>=0){const r=((n=/^\s*(`{3,}|~{3,})/.exec(e.slice(t.openStart)))==null?void 0:n[1])??"```";return`${e}
|
|
981
981
|
${r}`}return bze(gze(vze(e,t.ranges)),t.ranges)}function pze(e,t){return fze(e.slice(0,Math.max(0,Math.min(t,e.length))))}function mze(e){const t=[];let n=0,r=-1;for(;n<e.length;){const i=e.indexOf(`
|
|
982
982
|
`,n),s=i===-1?e.length:i,o=e.slice(n,s);if(/^\s*(`{3,}|~{3,})/.test(o)&&(r<0?r=n:/^\s*(`{3,}|~{3,})\s*$/.test(o)&&(t.push({start:r,end:s+1}),r=-1)),i===-1)break;n=i+1}return{ranges:t,openStart:r}}function _W(e,t){if(t.length===0)return e;const n=e.split("");for(const r of t)for(let i=r.start;i<Math.min(r.end,n.length);i+=1)n[i]=" ";return n.join("")}function gze(e){const t=e.split(`
|
|
@@ -1134,7 +1134,7 @@ ${e.raw??JSON.stringify(e.data,null,2)??""}`}function oLe({sessionId:e,active:t=
|
|
|
1134
1134
|
2. …
|
|
1135
1135
|
3. …`,multiline:!0},{key:"期望结果",label:"期望结果",placeholder:"正确时应该发生什么",multiline:!0},{key:"错误日志",label:"错误日志 / 堆栈(可选)",placeholder:"粘贴完整堆栈,不要截断",multiline:!0,optional:!0}]},{id:"builtin-review",title:"代码审查",description:"按清单审查 diff,给出带文件行号的发现",icon:"review",body:aFe,builtin:!0,fields:[{key:"审查范围",label:"审查范围",placeholder:"例如:git diff main...HEAD",defaultValue:"git diff main...HEAD"},{key:"重点关注",label:"重点关注(可选)",placeholder:"例如:并发、鉴权、错误处理",defaultValue:"正确性、边界条件、回归风险",optional:!0}]},{id:"builtin-test",title:"补测试",description:"为目标模块补齐关键路径和边界用例",icon:"test",body:lFe,builtin:!0,fields:[{key:"目标模块",label:"目标模块 / 文件",placeholder:"例如:packages/storage/src/index.ts",multiline:!0},{key:"测试命令",label:"测试命令",defaultValue:"pnpm test"},{key:"重点场景",label:"重点场景(可选)",placeholder:"例如:空输入、并发写入、失败重试",defaultValue:"正常路径、边界条件、错误路径",optional:!0}]},{id:"builtin-onboarding",title:"项目上手",description:"先画出代码地图,再做一次最小验证",icon:"compass",body:cFe,builtin:!0,fields:[{key:"想了解的问题",label:"想了解什么",placeholder:"例如:一次请求从入口到存储经过了哪些模块?",multiline:!0},{key:"关注目录",label:"关注目录(可选)",placeholder:"例如:apps/server/src",defaultValue:"整个仓库",optional:!0}]}];function AM(e){const t=new Set,n=[];for(const r of e.matchAll(/\{\{\s*([^{}]+?)\s*\}\}/g)){const i=r[1].trim();!i||t.has(i)||(t.add(i),n.push({key:i,label:i,multiline:!0}))}return n}function JG(e,t){return e.body.replace(/\{\{\s*([^{}]+?)\s*\}\}/g,(n,r)=>{var s;const i=r.trim();return((s=t[i])==null?void 0:s.trim())||`{{${i}}}`})}function dFe(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];const n=[],r=new Set;for(const i of t){if(!i||typeof i!="object")continue;const s=i;if(typeof s.id!="string"||!s.id.trim()||r.has(s.id)||typeof s.title!="string"||!s.title.trim()||typeof s.body!="string"||!s.body.trim())continue;const o=s.title.trim().slice(0,OM),a=typeof s.description=="string"&&s.description.trim()?s.description.trim().slice(0,PM):"自定义提示词模板",l=s.body.slice(0,TM);if(r.add(s.id),n.push({id:s.id,title:o,description:a,body:l,icon:"custom",builtin:!1,fields:AM(l)}),n.length>=rFe)break}return n}function hFe(e){return JSON.stringify(e.map(t=>({id:t.id,title:t.title.slice(0,OM),description:t.description.slice(0,PM),body:t.body.slice(0,TM)})))}function fFe(e,t){const n=e.title.trim().slice(0,OM),r=e.body.trim().slice(0,TM);if(!n)throw new Error("模板名称不能为空");if(!r)throw new Error("模板内容不能为空");return{id:t??`custom_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`,title:n,description:e.description.trim().slice(0,PM)||"自定义提示词模板",icon:"custom",body:r,builtin:!1,fields:AM(r)}}function J5(){try{return dFe(window.localStorage.getItem(RM))}catch{return[]}}function pFe(e){try{window.localStorage.setItem(RM,hFe(e))}catch{}}const mFe={repeat:PL,sparkles:hl,bug:cX,review:WX,test:W3,compass:fX,custom:yX};function gFe({onUse:e}){const[t,n]=m.useState(()=>J5()),[r,i]=m.useState();m.useEffect(()=>{const a=l=>{l.key===RM&&n(J5())};return window.addEventListener("storage",a),()=>window.removeEventListener("storage",a)},[]);const s=a=>{n(a),pFe(a)},o=a=>{const l=Object.fromEntries(a.fields.map(c=>[c.key,c.defaultValue??""]));e(JG(a,l))};return d.jsxs("section",{"aria-label":"提示词模板",className:"mt-4",children:[d.jsxs("div",{className:"mb-2 flex items-center gap-1.5 px-0.5 text-[12px] font-medium text-zinc-500",children:[d.jsx(O_,{size:12}),d.jsx("span",{children:"提示词模板"}),d.jsx("span",{className:"ml-auto font-normal text-zinc-400",children:"点卡片直接填入,右上角可填写变量"})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:[[...uFe,...t].map(a=>{const l=mFe[a.icon],c=a.fields.length>0;return d.jsxs("div",{className:"group relative h-full",children:[d.jsxs("button",{type:"button",onClick:()=>o(a),title:"点击直接填入输入框",className:`flex h-full min-h-[78px] w-full flex-col rounded-xl border border-zinc-200 bg-white px-3 py-2.5 text-left transition-[border-color,box-shadow,transform] duration-150 ease-[cubic-bezier(.2,0,0,1)] hover:-translate-y-px hover:border-zinc-300 hover:shadow-[0_4px_14px_rgba(24,24,27,.06)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400/50 ${a.builtin?c?"pr-8":"":"pr-14"}`,children:[d.jsxs("span",{className:"flex w-full items-center gap-1.5 pr-5 text-[12px] font-medium text-zinc-800",children:[d.jsx(l,{size:13,className:"shrink-0 text-zinc-400"}),d.jsx("span",{className:"truncate",children:a.title})]}),d.jsx("span",{className:"mt-1 line-clamp-2 block text-[12px] leading-[1.5] text-zinc-500",children:a.description})]}),c&&d.jsx("button",{type:"button",onClick:()=>i({kind:"fill",template:a}),"aria-label":`填写模板变量:${a.title}`,title:"填写变量并预览最终文案",className:`absolute top-1.5 grid h-6 w-6 place-items-center rounded-md text-zinc-400 opacity-100 transition-opacity hover:bg-zinc-100 hover:text-zinc-700 focus-visible:opacity-100 sm:opacity-0 sm:group-hover:opacity-100 ${a.builtin?"right-1.5":"right-8"}`,children:d.jsx(KX,{size:11})}),!a.builtin&&d.jsx("button",{type:"button",onClick:()=>i({kind:"edit",template:a}),"aria-label":`编辑模板:${a.title}`,title:"编辑模板",className:"absolute right-1.5 top-1.5 grid h-6 w-6 place-items-center rounded-md text-zinc-400 opacity-100 transition-opacity hover:bg-zinc-100 hover:text-zinc-700 focus-visible:opacity-100 sm:opacity-0 sm:group-hover:opacity-100",children:d.jsx(xN,{size:11})})]},a.id)}),d.jsxs("button",{type:"button",onClick:()=>i({kind:"edit"}),className:"flex min-h-[78px] w-full flex-col items-center justify-center gap-1 rounded-xl border border-dashed border-zinc-300 px-3 py-2.5 text-[12px] text-zinc-500 transition-colors hover:border-zinc-400 hover:bg-zinc-50 hover:text-zinc-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400/50",children:[d.jsx(oa,{size:14}),d.jsx("span",{children:"新建模板"})]})]}),r&&d.jsx(vFe,{state:r,onClose:()=>i(void 0),onApply:a=>{i(void 0),e(a)},onSave:a=>{s(t.some(l=>l.id===a.id)?t.map(l=>l.id===a.id?a:l):[...t,a]),i(void 0)},onDelete:a=>{s(t.filter(l=>l.id!==a)),i(void 0)}})]})}function vFe({state:e,onClose:t,onApply:n,onSave:r,onDelete:i}){const s=m.useRef(null);Vo({panel:s,initial:s,dismissible:!0,onDismiss:t});const o=e.kind==="edit",a=o?e.template?"编辑模板":"新建模板":e.template.title;return d.jsx("div",{className:"ui-overlay fixed inset-0 z-[60] grid place-items-center bg-zinc-950/30 p-2 sm:p-4",children:d.jsxs("div",{ref:s,role:"dialog","aria-modal":"true","aria-label":a,className:"ui-dialog flex max-h-[88dvh] w-full max-w-xl flex-col overflow-hidden rounded-[14px] border border-zinc-200 bg-white shadow-[0_24px_80px_rgba(24,24,27,.2)]",children:[d.jsxs("div",{className:"flex h-12 shrink-0 items-center gap-3 border-b border-zinc-100 px-4",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("div",{className:"truncate text-[15px] font-semibold text-zinc-900",children:a}),!o&&d.jsx("div",{className:"truncate text-[12px] text-zinc-400",children:e.template.description})]}),d.jsx("button",{type:"button",onClick:t,"aria-label":"关闭",className:"ml-auto grid h-8 w-8 shrink-0 place-items-center rounded-lg text-zinc-400 hover:bg-zinc-100 hover:text-zinc-800",children:d.jsx(Yn,{size:16})})]}),o?d.jsx(bFe,{template:e.template,onClose:t,onSave:r,onDelete:i}):d.jsx(xFe,{template:e.template,onClose:t,onApply:n})]})})}function xFe({template:e,onClose:t,onApply:n}){const[r,i]=m.useState(()=>Object.fromEntries(e.fields.map(a=>[a.key,a.defaultValue??""]))),s=m.useMemo(()=>JG(e,r),[e,r]),o=a=>{a.preventDefault(),n(s)};return d.jsxs("form",{onSubmit:o,className:"flex min-h-0 flex-1 flex-col",children:[d.jsxs("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto px-4 py-3",children:[e.fields.map((a,l)=>d.jsxs("label",{className:"block",children:[d.jsx("span",{className:"mb-1.5 flex items-center gap-1 text-[12px] font-medium text-zinc-600",children:a.label}),a.multiline?d.jsx("textarea",{autoFocus:l===0,value:r[a.key]??"",onChange:c=>i(u=>({...u,[a.key]:c.target.value})),rows:3,placeholder:a.placeholder,className:"ui-field w-full resize-y rounded-lg border border-zinc-200 bg-white px-3 py-2 text-[13px] leading-5 text-zinc-800 outline-none transition-colors placeholder:text-zinc-400 focus:border-zinc-400"}):d.jsx("input",{autoFocus:l===0,value:r[a.key]??"",onChange:c=>i(u=>({...u,[a.key]:c.target.value})),placeholder:a.placeholder,spellCheck:!1,className:"ui-field h-9 w-full rounded-lg border border-zinc-200 bg-white px-3 text-[13px] text-zinc-800 outline-none transition-colors placeholder:text-zinc-400 focus:border-zinc-400"})]},a.key)),e.fields.length===0&&d.jsx("p",{className:"text-[12px] text-zinc-400",children:"这个模板没有变量,会直接填入输入框。"}),d.jsxs("div",{children:[d.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 text-[12px] font-medium text-zinc-600",children:[d.jsx(Jg,{size:12,className:"text-zinc-400"}),"最终文案预览"]}),d.jsx("pre",{"aria-label":"最终文案预览",className:"max-h-44 overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-zinc-200 bg-zinc-50 px-3 py-2 font-sans text-[12px] leading-5 text-zinc-600",children:s}),d.jsxs("p",{className:"mt-1 text-[12px] text-zinc-400",children:["变量留空会保留 ","{{变量}}"," 占位,填入后仍可在输入框里修改。"]})]})]}),d.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-2 border-t border-zinc-100 px-4 py-3",children:[d.jsx("button",{type:"button",onClick:t,className:"rounded-lg px-3 py-1.5 text-[12px] text-zinc-600 hover:bg-zinc-100",children:"取消"}),d.jsx("button",{type:"submit",className:"rounded-lg bg-zinc-900 px-3.5 py-1.5 text-[12px] font-medium text-white transition-colors hover:bg-zinc-800",children:"填入输入框"})]})]})}function bFe({template:e,onClose:t,onSave:n,onDelete:r}){const[i,s]=m.useState((e==null?void 0:e.title)??""),[o,a]=m.useState((e==null?void 0:e.description)??""),[l,c]=m.useState((e==null?void 0:e.body)??""),[u,h]=m.useState(),[f,p]=m.useState(!1),g=m.useMemo(()=>AM(l).map(x=>x.key),[l]),v=x=>{x.preventDefault();try{n(fFe({title:i,description:o,body:l},e==null?void 0:e.id))}catch(b){h(b instanceof Error?b.message:String(b))}};return d.jsxs("form",{onSubmit:v,className:"flex min-h-0 flex-1 flex-col",children:[d.jsxs("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto px-4 py-3",children:[d.jsxs("label",{className:"block",children:[d.jsxs("span",{className:"mb-1.5 flex items-center gap-1 text-[12px] font-medium text-zinc-600",children:["模板名称",d.jsx("span",{className:"text-red-500",children:"*"})]}),d.jsx("input",{autoFocus:!0,value:i,onChange:x=>s(x.target.value),maxLength:40,placeholder:"例如:发布前检查",className:"ui-field h-9 w-full rounded-lg border border-zinc-200 bg-white px-3 text-[13px] text-zinc-800 outline-none transition-colors placeholder:text-zinc-400 focus:border-zinc-400"})]}),d.jsxs("label",{className:"block",children:[d.jsx("span",{className:"mb-1.5 block text-[12px] font-medium text-zinc-600",children:"一句话说明"}),d.jsx("input",{value:o,onChange:x=>a(x.target.value),maxLength:120,placeholder:"显示在卡片上,可留空",className:"ui-field h-9 w-full rounded-lg border border-zinc-200 bg-white px-3 text-[13px] text-zinc-800 outline-none transition-colors placeholder:text-zinc-400 focus:border-zinc-400"})]}),d.jsxs("label",{className:"block",children:[d.jsxs("span",{className:"mb-1.5 flex items-center gap-1 text-[12px] font-medium text-zinc-600",children:["模板内容",d.jsx("span",{className:"text-red-500",children:"*"})]}),d.jsx("textarea",{value:l,onChange:x=>c(x.target.value),rows:8,placeholder:`直接写完整提示词。用 {{变量名}} 标记需要每次填写的内容。
|
|
1136
1136
|
|
|
1137
|
-
例如:请检查 {{项目}} 的发布前状态,并运行 {{验证命令}}。`,className:"ui-field w-full resize-y rounded-lg border border-zinc-200 bg-white px-3 py-2 font-mono text-[12px] leading-5 text-zinc-800 outline-none transition-colors placeholder:text-zinc-400 focus:border-zinc-400"})]}),d.jsx("div",{className:"text-[12px] leading-5 text-zinc-500",children:g.length?d.jsxs(d.Fragment,{children:["识别到变量:",d.jsx("span",{className:"font-mono text-zinc-700",children:g.join("、")})]}):"没有 {{变量}},点击卡片会直接填入整段提示词。"}),u&&d.jsx("p",{role:"alert",className:"text-[12px] text-red-600",children:u})]}),d.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-t border-zinc-100 px-4 py-3",children:[e&&d.jsxs("button",{type:"button",onClick:()=>{if(!f){p(!0);return}r(e.id)},className:"flex items-center gap-1 rounded-lg px-2.5 py-1.5 text-[12px] text-red-600 hover:bg-red-50",children:[d.jsx(Of,{size:12}),f?"确认删除":"删除"]}),d.jsx("button",{type:"button",onClick:t,className:"ml-auto rounded-lg px-3 py-1.5 text-[12px] text-zinc-600 hover:bg-zinc-100",children:"取消"}),d.jsx("button",{type:"submit",disabled:!i.trim()||!l.trim(),className:"rounded-lg bg-zinc-900 px-3.5 py-1.5 text-[12px] font-medium text-white transition-colors hover:bg-zinc-800 disabled:cursor-not-allowed disabled:opacity-40",children:"保存模板"})]})]})}function yFe({agents:e,sessions:t,onCreated:n,editorRef:r,hero:i,collapsed:s=!1,companion:o}){var ne,ie,oe,G,le,me,Y,ge,ye;const a=Fn(),[l,c]=m.useState(""),[u,h]=m.useState([]),[f,p]=m.useState(""),[g,v]=m.useState(""),[x,b]=m.useState(""),[y,w]=m.useState(""),[S,C]=m.useState(),[_,k]=m.useState(!1),z=m.useRef(new Map),j=m.useRef(new Set),N=m.useRef(0),$=m.useRef(l);$.current=l;const R=()=>{var re;return((re=r==null?void 0:r.current)==null?void 0:re.getValue())??$.current},P=nG(o==null?void 0:o.sessionId,l,{skipEmptyValue:_}),E=e.some(re=>re.id===f)?f:((ne=t.find(re=>!re.archivedAt&&e.some(Ee=>Ee.id===re.agentId)))==null?void 0:ne.agentId)||((ie=e[0])==null?void 0:ie.id)||"",M=e.find(re=>re.id===E),T=It({queryKey:["system-capabilities"],queryFn:Ne.systemCapabilities}),D=(M==null?void 0:M.cwd)||((oe=T.data)==null?void 0:oe.workingDirectory),A=m.useMemo(()=>{const re=new Set,Ee=[];for(const Ie of[D,...t.map(Pe=>Pe.cwd)])!Ie||re.has(Ie)||(re.add(Ie),Ee.push(Ie));return Ee.slice(0,30)},[D,t]),H=(G=T.data)==null?void 0:G.homeDirectory,I=It({queryKey:vl(E,x),queryFn:()=>xl(E,x||void 0),enabled:!!E,initialData:()=>Pd(E,x||void 0),initialDataUpdatedAt:0,refetchOnMount:"always",staleTime:6e4}),B=It({queryKey:["skills",g],queryFn:()=>Ne.skills(g||void 0),staleTime:6e4}),L=bt({mutationFn:()=>xl(E,x||void 0,!0),onSuccess:re=>a.setQueryData(vl(E,x||void 0),re),onError:re=>C(re instanceof Error?re.message:String(re))}),O=bt({mutationFn:Ne.selectDirectory,onSuccess:re=>v(re.path),onError:re=>C(re instanceof Error?re.message:String(re))}),W=UK({loaded:I.data!==void 0,loading:I.data===void 0&&(I.isPending||I.isFetching||L.isPending),switching:!1,failed:I.data===void 0&&I.isError}),F=async re=>{const Ee=`draft-${++N.current}`,Ie="name"in re?re.name:"(未命名文件)",Pe=re.type.startsWith("image/");re instanceof File&&z.current.set(Ee,re);const $e=Pe?URL.createObjectURL(re):void 0;return $e&&j.current.add($e),{id:Ee,kind:Pe?"image":"file",label:Ie,value:Ee,...$e?{url:$e}:{}}},U=()=>{for(const re of j.current)URL.revokeObjectURL(re);j.current.clear(),z.current.clear()},X=re=>{c(re),requestAnimationFrame(()=>{var Ee;return(Ee=r==null?void 0:r.current)==null?void 0:Ee.focus()})},Q=(re,Ee)=>{const Ie=u,Pe=v2();k(!0),(async()=>{var $e;try{const pe=await Promise.all(Ie.map(async Te=>{const ve=z.current.get(Te.id);if(!ve)return Te;const Ue=await p2(re.sessionId,ve);return m2(Ue,ve.type.startsWith("image/"))})),De=f2(Ee,pe);De&&await Ne.send(re.sessionId,De,"queue",void 0,Pe),a.invalidateQueries({queryKey:["sessions"]}),a.invalidateQueries({queryKey:["tasks",re.sessionId]}),P.cancel();const ee=xc(),fe=R();!!fe.trim()&&fe!==Ee?(bh(ee,re.sessionId,fe),c(fe)):(y2(ee,re.sessionId),($e=r==null?void 0:r.current)==null||$e.setValue(""),c("")),h([]),U(),re.onSent()}catch(pe){C(pe instanceof Error?pe.message:String(pe))}finally{k(!1)}})()},ae=re=>{if(_)return;if(C(void 0),o){Q(o,re);return}if(!E)return;const Ee=re,Ie=u,Pe=v2();k(!0),(async()=>{var pe;let $e;try{$e=await Ne.create({agentId:E,...g.trim()?{cwd:g.trim()}:{},...x?{model:x}:{},...y?{reasoningEffort:y}:{}}),Ee&&bh(xc(),$e.id,Ee);const De=await Promise.all(Ie.map(async ve=>{const Ue=z.current.get(ve.id);if(!Ue)return ve;const ce=await p2($e.id,Ue);return m2(ce,Ue.type.startsWith("image/"))})),ee=f2(Ee,De);ee&&await Ne.send($e.id,ee,"queue",void 0,Pe),a.invalidateQueries({queryKey:["sessions"]}),a.invalidateQueries({queryKey:["tasks",$e.id]}),P.cancel();const fe=xc(),Se=R();!!Se.trim()&&Se!==Ee?(bh(fe,$e.id,Se),c(Se)):(y2(fe,$e.id),(pe=r==null?void 0:r.current)==null||pe.setValue(""),c("")),h([]),U(),n($e)}catch(De){C(De instanceof Error?De.message:String(De)),$e&&(bh(xc(),$e.id,R()),a.invalidateQueries({queryKey:["sessions"]}),n($e))}finally{k(!1)}})()};return d.jsxs("div",{className:"relative my-auto w-full min-w-0 max-w-[720px]",children:[i??d.jsxs("div",{className:"flex flex-col items-center text-center",children:[d.jsx(nFe,{size:88}),d.jsx("h1",{className:"ui-empty-state ui-hero-title mt-4 text-[22px] font-semibold tracking-[-.02em]",children:"有什么要做的?"})]}),d.jsx("div",{className:"ui-collapse","data-collapsed":s||void 0,"aria-hidden":s||void 0,inert:s,children:d.jsxs("div",{children:[d.jsx("div",{className:"mt-6",children:d.jsx(YK,{draft:!0,...o?{placeholder:d.jsxs(d.Fragment,{children:[d.jsxs("span",{className:"hidden sm:inline",children:["跟",o.name,"说说要做什么,Enter 发送;它会派侧边会话去办"]}),d.jsxs("span",{className:"sm:hidden",children:["跟",o.name,"说说要做什么"]})]}),sendLabel:`交给${o.name}`,lockedTarget:d.jsxs("span",{title:`消息会发进主会话,由${o.name}安排`,className:"flex h-8 shrink-0 items-center gap-1.5 rounded-lg bg-zinc-100 px-2.5 text-[12px] font-medium text-zinc-700",children:[d.jsx(ps,{size:12}),o.name," · 主会话"]})}:{},editorRef:r,sessionId:"",state:"idle",value:l,references:u,sending:_,mode:"queue",queuedTasks:[],skills:B.data??[],models:((le=I.data)==null?void 0:le.models)??[],reasoningEfforts:((me=I.data)==null?void 0:me.reasoningEfforts)??[],currentModel:x||((Y=I.data)==null?void 0:Y.defaultModel),currentReasoningEffort:y||((ge=I.data)==null?void 0:ge.defaultReasoningEffort),context:{},advertisedCommands:[],modelReadiness:W,switchingModel:!1,switchingReasoningEffort:!1,refreshingModels:I.isFetching||L.isPending,agents:e,currentAgentId:(o==null?void 0:o.agentId)??E,onAgentChange:re=>{p(re),b(""),w("")},workspace:g,onWorkspaceChange:v,workspaceSuggestion:D,homeDirectory:H,workspaceOptions:A,directoryPickerAvailable:(ye=T.data)==null?void 0:ye.directoryPicker,pickingDirectory:O.isPending,onPickDirectory:()=>O.mutate(),onAttachFile:F,onChange:c,onReferencesChange:h,onModeChange:()=>{},onSubmit:ae,onInterrupt:()=>{},onCancelQueued:()=>{},onSteerQueued:()=>{},onEditQueued:()=>{},onModelChange:b,onReasoningEffortChange:w,onRefreshModels:()=>L.mutate()})}),!o&&d.jsx(gFe,{onUse:X}),l.length>wg&&d.jsxs("p",{role:"status",className:"mt-2 text-center text-[12px] text-amber-600",children:["草稿超过 ",wg.toLocaleString()," 字符,超出部分不会保存,刷新后会丢失。"]}),S&&d.jsx("p",{role:"alert",className:"mt-2 text-center text-[12px] text-red-600",children:S}),u.length>0&&d.jsxs("p",{className:"mt-2 text-center text-[12px] text-zinc-400",children:[u.length," 个附件会在",o?"发送":"会话创建","后上传"]})]})})]})}const eY="agentdock:adopt-agent";function wFe(){try{return typeof window>"u"?"":window.localStorage.getItem(eY)||""}catch{return""}}function SFe(e,t){const n=e instanceof Error?e.message:String(e);return/authentication required|not authenticated|unauthorized|\b401\b/i.test(n)?`${t} 还没在这台机器上登录,暂时开不了工。换一个已登录的 Agent,或先在终端完成 ${t} 的登录再回来认领。`:n}function e4(){const e=d.jsxs("svg",{viewBox:"0 0 24 24",width:"11",height:"11",fill:"currentColor","aria-hidden":"true",children:[d.jsx("ellipse",{cx:"12",cy:"16",rx:"5",ry:"4.2"}),d.jsx("circle",{cx:"6",cy:"9.5",r:"2.2"}),d.jsx("circle",{cx:"10",cy:"6",r:"2.2"}),d.jsx("circle",{cx:"14",cy:"6",r:"2.2"}),d.jsx("circle",{cx:"18",cy:"9.5",r:"2.2"})]});return d.jsxs("span",{className:"ui-paw-walk",children:[e,e,e,e]})}function t4(e){const t=B7();return e.counts.needsUser?`${t}~有 ${e.counts.needsUser} 件事等你拍板,右边的便签里看看吧`:e.counts.planned?`${t}~有 ${e.counts.planned} 张计划等你点头,右边的便签里看看`:e.busy?`${t}~我正在忙,有新想法也可以先丢给我`:e.counts.running?`${t}~我在盯着 ${e.counts.running} 张便签,有进展会叫你`:e.counts.review?`${t}~${e.counts.review} 张便签做完了,我在验收`:`${t}~我是${e.name},有事交给我,我派人去办`}function _Fe({value:e,name:t,onChange:n}){return d.jsxs("div",{className:"ui-target mt-4","data-value":e,role:"group","aria-label":"这条消息发给谁",children:[d.jsx("span",{className:"ui-target-pill","aria-hidden":"true"}),d.jsxs("button",{type:"button","aria-pressed":e==="new",onClick:()=>n("new"),className:"ui-target-option",children:[d.jsx(OX,{size:13}),"新对话"]}),d.jsxs("button",{type:"button","aria-pressed":e==="companion",onClick:()=>n("companion"),className:"ui-target-option ui-cat-hover-host",children:[d.jsx(ps,{size:13}),d.jsxs("span",{className:"max-w-[9rem] truncate",children:["交给",t]})]})]})}function CFe({agents:e,sessions:t,editorRef:n,onCreated:r}){var Ee,Ie,Pe,$e,pe,De,ee,fe,Se,Te,ve,Ue;const i=Fn(),s=ui(),o=ja(),a=Mt(ce=>ce.adoptPending),l=Mt(ce=>ce.inviteDismissed),c=Mt(ce=>ce.homeTarget),u=Mt(ce=>ce.celebrateNonce),[h,f]=m.useState("idle"),[p,g]=m.useState(tm),[v,x]=m.useState(wFe),[b,y]=m.useState(""),[w,S]=m.useState(""),[C,_]=m.useState(""),[k,z]=m.useState(),[j,N]=m.useState(),[$,R]=m.useState(""),P=jh("kitten-hero"),E=m.useRef(null),M=m.useRef(null),T=It({queryKey:["system-capabilities"],queryFn:Ne.systemCapabilities});m.useEffect(()=>{!a||!s.loaded||(Mt.getState().consumeAdoption(),s.adopted||f("form"))},[a,s.loaded,s.adopted]),m.useEffect(()=>{if(h!=="form")return;const ce=window.setTimeout(()=>{var Oe,he;(Oe=E.current)==null||Oe.focus(),(he=E.current)==null||he.select()},260);return()=>window.clearTimeout(ce)},[h]),m.useEffect(()=>{if(!j)return;const ce=window.setTimeout(()=>N(void 0),1800);return()=>window.clearTimeout(ce)},[j]);const D=m.useMemo(()=>e.filter(ce=>!ce.disabled),[e]),A=D.some(ce=>ce.id===v)?v:((Ee=t.find(ce=>!ce.archivedAt&&D.some(Oe=>Oe.id===ce.agentId)))==null?void 0:Ee.agentId)||((Ie=D[0])==null?void 0:Ie.id)||"",H=D.find(ce=>ce.id===A),I=(H==null?void 0:H.cwd)||((Pe=T.data)==null?void 0:Pe.workingDirectory),B=($e=T.data)==null?void 0:$e.homeDirectory,L=m.useMemo(()=>{const ce=new Set,Oe=[];for(const he of[I,...t.map(_e=>_e.cwd)])!he||ce.has(he)||(ce.add(he),Oe.push(he));return Oe.slice(0,20)},[I,t]),O=It({queryKey:vl(A,w),queryFn:()=>xl(A,w||void 0),enabled:!!A&&(h==="form"||h==="adopting"),initialData:()=>Pd(A,w||void 0),initialDataUpdatedAt:0,refetchOnMount:"always",staleTime:6e4});m.useEffect(()=>{S(""),_("")},[A]);const W=((De=(pe=O.data)==null?void 0:pe.models.find(ce=>{var Oe;return ce.id===((Oe=O.data)==null?void 0:Oe.defaultModel)}))==null?void 0:De.name)??((ee=O.data)==null?void 0:ee.defaultModel),F=((Se=(fe=O.data)==null?void 0:fe.reasoningEfforts.find(ce=>{var Oe;return ce.id===((Oe=O.data)==null?void 0:Oe.defaultReasoningEffort)}))==null?void 0:Se.name)??((Te=O.data)==null?void 0:Te.defaultReasoningEffort),U=m.useMemo(()=>{var ce;return(ce=O.data)!=null&&ce.models.length?[{value:"",label:W?`Agent 默认 · ${W}`:"Agent 默认"},...O.data.models.map(Oe=>({value:Oe.id,label:Oe.name,meta:Oe.name===Oe.id?void 0:Oe.id}))]:[]},[W,O.data]),X=m.useMemo(()=>{var ce;return(ce=O.data)!=null&&ce.reasoningEfforts.length?[{value:"",label:F?`Agent 默认 · ${F}`:"Agent 默认"},...O.data.reasoningEfforts.map(Oe=>({value:Oe.id,label:Oe.name}))]:[]},[F,O.data]),Q=O.isPending||O.isFetching,ae=bt({mutationFn:Ne.selectDirectory,onSuccess:ce=>{y(ce.path),z(void 0)},onError:ce=>z(ce instanceof Error?ce.message:String(ce))}),ne=bt({mutationFn:()=>Ne.assistantSetMain({agentId:A,name:p.trim()||tm,...b.trim()?{cwd:b.trim()}:{},...w?{model:w}:{},...C?{reasoningEffort:C}:{}}),onMutate:()=>{z(void 0),f("adopting")},onSuccess:ce=>{var _e;try{window.localStorage.setItem(eY,A)}catch{}const Oe=((_e=ce.companion)==null?void 0:_e.name)??(p.trim()||tm);R(Oe),i.setQueryData(["assistant-state"],je=>je&&{...je,mainSessionId:ce.session.id,mainSession:ce.session,companion:ce.companion??{name:Oe,adoptedAt:new Date().toISOString()}}),i.setQueryData(["sessions"],je=>je&&[ce.session,...je.filter(ke=>ke.id!==ce.session.id)]),i.invalidateQueries({queryKey:["assistant-state"]}),i.invalidateQueries({queryKey:["sessions"]});const he=Mt.getState();he.dismissInvite(!1),he.celebrate(),f("celebrate"),window.setTimeout(()=>{M.current&&Tc(M.current.getBoundingClientRect(),"confetti",18)},120),window.setTimeout(()=>o.openMain(ce.session.id),uo()?900:2300)},onError:ce=>{f("form"),z(SFe(ce,(H==null?void 0:H.name)??A))}}),ie=()=>{const ce=b.trim();if(ce&&!ce.startsWith("/")){z("工作目录请填绝对路径,例如 /Users/you/project");return}ne.mutate()},oe=()=>{Mt.getState().dismissInvite(),N("sad"),f("idle")},G=s.adopted&&h!=="celebrate",le=G&&c==="companion"&&!!s.mainId,me=!s.adopted&&s.loaded&&(h==="invite"||h==="idle"&&!l),Y=h==="form"||h==="adopting"||h==="celebrate",ge=j??(h==="celebrate"?"happy":h==="adopting"?"busy":G?s.mood==="curious"?"idle":s.mood:"curious"),ye=d.jsx("div",{ref:P,className:"ui-stage-kitten",children:d.jsx(Fi,{size:h==="form"||h==="adopting"?76:88,mood:ge,stage:G?s.stage:void 0,collar:G||h==="celebrate",drawCollar:h==="celebrate",track:!0,typingAware:!0,celebrateKey:u,viewTransitionName:D7,label:G?`进入主会话(${s.name})`:"小猫",onClick:()=>{G?o.openMain():h==="idle"&&f("invite")}})});let re;if(G){const ce=s.counts;re=d.jsxs("div",{className:"ui-stage",children:[d.jsx("div",{className:"ui-speech text-center",children:t4(s)},t4(s)),ye,d.jsx("span",{className:"ui-name-tag",children:s.name}),d.jsxs("div",{className:"mt-3 flex flex-wrap justify-center gap-1.5",children:[ce.needsUser>0&&d.jsxs("button",{type:"button",className:"ui-status-chip",onClick:()=>Mt.getState().openDrawer({filter:"needs_user"}),children:[d.jsx("span",{className:"ui-note-swatch ui-note-paper-needs"}),ce.needsUser," 件需要你"]}),ce.planned>0&&d.jsxs("button",{type:"button",className:"ui-status-chip",onClick:()=>Mt.getState().openDrawer({filter:"needs_user"}),children:[d.jsx("span",{className:"ui-note-swatch ui-note-paper-plan"}),ce.planned," 张计划等你点头"]}),ce.review>0&&d.jsxs("button",{type:"button",className:"ui-status-chip",onClick:()=>Mt.getState().openDrawer({filter:"review"}),children:[d.jsx("span",{className:"ui-note-swatch ui-note-paper-review"}),ce.review," 张待验收"]}),ce.running>0&&d.jsxs("button",{type:"button",className:"ui-status-chip",onClick:()=>Mt.getState().openDrawer({filter:"running"}),children:[d.jsx("span",{className:"ui-note-swatch ui-note-paper-running"}),ce.running," 张进行中"]}),!ce.open&&d.jsxs("button",{type:"button",className:"ui-status-chip",onClick:()=>Mt.getState().toggleDrawer(),children:[d.jsx("span",{className:"ui-note-swatch ui-note-paper-done"}),ce.closed?`${ce.closed} 张已完成`:"便签墙"]})]}),d.jsx("h1",{className:"ui-empty-state ui-hero-title mt-5 text-[22px] font-semibold tracking-[-.02em]",children:le?`交给${s.name}吧`:"有什么要做的?"}),d.jsx(_Fe,{value:c,name:s.name,onChange:Oe=>{Mt.getState().setHomeTarget(Oe),requestAnimationFrame(()=>{var he;return(he=n==null?void 0:n.current)==null?void 0:he.focus()})}})]})}else re=d.jsxs("div",{className:"ui-stage",children:[me&&d.jsxs("div",{className:"ui-speech text-center",children:[d.jsx("p",{className:"text-[14px] font-medium text-zinc-900",children:"喵~带我回家吧?"}),d.jsx("p",{className:"mt-0.5 text-[12.5px] leading-5 text-zinc-500",children:"认领后我就是你的主会话:你说要做什么,我派侧边会话去干、盯进度、做完帮你验收,每件事都贴成便签。"}),d.jsxs("div",{className:"mt-2.5 flex justify-center gap-2",children:[d.jsxs("button",{type:"button",onClick:()=>f("form"),className:"inline-flex h-8 items-center gap-1.5 rounded-full bg-zinc-900 px-3.5 text-[12.5px] font-medium text-white transition-[background-color,transform] hover:bg-zinc-700 active:scale-95",children:[d.jsx(ps,{size:13}),"认领它"]}),d.jsx("button",{type:"button",onClick:oe,className:"inline-flex h-8 items-center rounded-full px-3 text-[12.5px] text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-800",children:"先不了"})]})]}),h==="celebrate"&&d.jsxs("div",{className:"ui-speech text-center",children:[d.jsxs("p",{className:"text-[14px] font-medium text-zinc-900",children:["喵!我是",$,",以后请多指教~"]}),d.jsxs("p",{className:"mt-1 inline-flex items-center gap-1.5 text-[12px] text-zinc-500",children:[d.jsx(e4,{}),"正在去主会话…"]})]}),ye,h==="celebrate"&&d.jsx("span",{className:"ui-name-tag",children:$}),(h==="form"||h==="adopting")&&d.jsx("div",{ref:M,className:"ui-adopt-card mt-4",children:d.jsxs("form",{className:"min-w-0",onSubmit:ce=>{ce.preventDefault(),!ne.isPending&&A&&ie()},children:[d.jsxs("div",{className:"min-w-0 px-5 pt-5",children:[d.jsxs("label",{className:"block min-w-0",children:[d.jsx("span",{className:"text-[14px] font-semibold text-zinc-900",children:"给它起个名字"}),d.jsxs("span",{className:"mt-2 flex min-w-0 items-center gap-2",children:[d.jsx("input",{ref:E,value:p,maxLength:16,disabled:h==="adopting",onChange:ce=>g(ce.target.value),placeholder:tm,"aria-label":"小猫的名字",className:"ui-field h-10 min-w-0 flex-1 rounded-xl border border-zinc-300 bg-white px-3 text-[15px] font-semibold text-zinc-900 outline-none placeholder:font-normal placeholder:text-zinc-400 disabled:opacity-60"}),d.jsx("button",{type:"button",disabled:h==="adopting",onClick:()=>g(ce=>Yy(ce.trim())),"aria-label":"随机换一个名字",title:"随机换一个名字",className:"ui-dice grid h-10 w-10 shrink-0 place-items-center rounded-xl border border-zinc-200 text-zinc-500 hover:border-zinc-300 hover:text-zinc-900 disabled:opacity-50",children:d.jsx(Jb,{size:17})})]})]}),d.jsx("div",{className:"mt-4 text-[12.5px] font-medium text-zinc-600",children:"它用哪个 Agent 思考"}),d.jsxs("div",{className:"mt-2 flex min-w-0 max-w-full flex-wrap gap-1.5",children:[D.map(ce=>d.jsxs("button",{type:"button",disabled:h==="adopting","aria-pressed":ce.id===A,onClick:()=>{x(ce.id),S(""),_(""),z(void 0)},className:"ui-pill-choice",children:[d.jsx(Wr,{agentId:ce.id,agentName:ce.name,size:13}),d.jsx("span",{className:"min-w-0 truncate",children:ce.name})]},ce.id)),!D.length&&d.jsx("span",{className:"text-[12.5px] text-zinc-400",children:"还没有可用的 Agent,先到设置里配一个。"})]}),d.jsxs("div",{className:"mt-4 grid min-w-0 grid-cols-[minmax(0,1fr)] gap-3",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"text-[12.5px] font-medium text-zinc-600",children:["模型 ",d.jsx("span",{className:"font-normal text-zinc-400",children:"可选"})]}),d.jsx(da,{size:"sm",options:U,value:w,placeholder:"Agent 默认",disabledText:Q?"正在读取模型…":O.isError?"模型列表读取失败,可先不选":"这个 Agent 没有提供模型选项",disabled:h==="adopting",onChange:ce=>{S(ce),_("")}})]}),d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"text-[12.5px] font-medium text-zinc-600",children:["思考深度 ",d.jsx("span",{className:"font-normal text-zinc-400",children:"可选"})]}),d.jsx(da,{size:"sm",options:X,value:C,placeholder:"Agent 默认",disabledText:Q?"正在读取…":O.isError?"读取失败,可先不选":"这个模型没有思考深度选项",disabled:h==="adopting",onChange:_})]})]}),((ve=O.data)==null?void 0:ve.warning)&&d.jsxs("p",{className:"mt-1.5 break-words text-[11px] leading-4 text-amber-600 [overflow-wrap:anywhere]",children:["这个 Agent 的配置没读出来:",O.data.warning," 如果一直这样,先检查它是否已登录。"]}),d.jsxs("div",{className:"mt-4 text-[12.5px] font-medium text-zinc-600",children:["常驻目录 ",d.jsx("span",{className:"font-normal text-zinc-400",children:"可选,派活时仍可指定别的目录"})]}),d.jsxs("div",{className:"mt-2 flex min-w-0 max-w-full items-center gap-1.5",children:[d.jsx("input",{list:"adopt-workspaces",value:b,disabled:h==="adopting",onChange:ce=>y(ce.target.value),placeholder:I??"绝对路径,例如 /Users/you/project","aria-label":"常驻目录",title:b.trim()||I||void 0,spellCheck:!1,className:"ui-field h-9 w-0 min-w-0 max-w-full flex-1 truncate rounded-xl border border-zinc-300 bg-white px-3 font-mono text-[12.5px] text-zinc-800 outline-none placeholder:font-sans placeholder:text-zinc-400 disabled:opacity-60"}),((Ue=T.data)==null?void 0:Ue.directoryPicker)&&d.jsx("button",{type:"button",disabled:h==="adopting"||ae.isPending,onClick:()=>ae.mutate(),title:ae.isPending?"选择中…":"选择目录","aria-label":"选择目录",className:"grid h-9 w-9 shrink-0 place-items-center rounded-xl border border-zinc-200 text-zinc-500 transition-colors hover:border-zinc-300 hover:text-zinc-900 disabled:opacity-50",children:ae.isPending?d.jsx(Wn,{size:14,className:"animate-spin"}):d.jsx(fa,{size:14})})]}),b.trim()&&d.jsx("p",{className:"mt-1.5 break-all font-mono text-[11.5px] leading-4 text-zinc-400",title:b.trim(),children:b.trim()}),d.jsx("datalist",{id:"adopt-workspaces",children:L.map(ce=>d.jsx("option",{value:ce,children:g2(ce,B)},ce))}),d.jsx("p",{className:"mt-1.5 text-[11.5px] leading-4 text-zinc-400",children:"可以直接粘贴任意绝对路径,或从最近用过的目录里挑;留空就用 Agent 自己的默认目录。"}),d.jsxs("p",{className:"mt-4 rounded-xl bg-zinc-50 px-3 py-2.5 text-[12px] leading-5 text-zinc-500",children:["它会成为你的",d.jsx("b",{className:"font-medium text-zinc-700",children:"主会话"}),":听你说要做什么,派侧边会话去干、盯进度、验收结果。派出去的每件事都是一张便签,贴在屏幕右边,随时划出来看。"]}),k&&d.jsx("p",{role:"alert",className:"mt-3 break-words text-[12px] text-red-600 [overflow-wrap:anywhere]",children:k})]}),d.jsxs("div",{className:"mt-4 flex min-w-0 flex-wrap items-center justify-end gap-2 border-t border-zinc-100 px-4 py-3",children:[d.jsx("button",{type:"button",disabled:h==="adopting",onClick:()=>f(l?"idle":"invite"),className:"h-9 rounded-full px-3.5 text-[13px] text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-800 disabled:opacity-50",children:"先不了"}),d.jsx("button",{type:"submit",disabled:h==="adopting"||!A,className:"inline-flex h-9 min-w-[8.5rem] items-center justify-center gap-1.5 rounded-full bg-zinc-900 px-4 text-[13px] font-medium text-white transition-[background-color,transform] hover:bg-zinc-700 active:scale-95 disabled:opacity-60",children:h==="adopting"?d.jsxs(d.Fragment,{children:[d.jsx(e4,{}),"正在带它回家…"]}):d.jsxs(d.Fragment,{children:[d.jsx(ps,{size:14}),"带它回家"]})})]})]})}),!Y&&d.jsx("h1",{className:"ui-empty-state ui-hero-title mt-4 text-[22px] font-semibold tracking-[-.02em]",children:"有什么要做的?"})]});return d.jsx(yFe,{editorRef:n,agents:e,sessions:t,onCreated:r,hero:re,collapsed:Y&&!G,companion:le&&s.mainSession?{sessionId:s.mainSession.id,agentId:s.mainSession.agentId,name:s.name,onSent:()=>{const ce=wm(["kitten-hero"]);ce&&Tc(ce,"sparkles",6),window.setTimeout(()=>o.openMain(),uo()?0:260)}}:void 0})}const kFe=m.lazy(()=>A4(()=>import("./PromptEditor-BgmgUJOC.js"),__vite__mapDeps([5,1,2,3]))),NFe=e=>[...new Set(e.split(/[\n,,]/).map(t=>t.trim()).filter(Boolean))];function EFe({className:e=""}){return d.jsx("img",{src:"/agent-dock.svg",alt:"","aria-hidden":"true",className:`${e} ui-logo-tile`})}function jFe({cwd:e,top:t,left:n,agents:r,creatingPair:i,onSelect:s,onClose:o}){const a=m.useRef(null);return m0(a,!0,o),d.jsxs("div",{ref:a,className:"ui-popover fixed z-50 max-h-64 w-52 overflow-y-auto rounded-lg border border-zinc-200 bg-white p-1 shadow-[0_16px_40px_rgba(24,24,27,.16)]",style:{top:t,left:n},children:[d.jsx("div",{className:"px-2 py-1 text-[12px] text-zinc-400",children:"在此工作区新建会话"}),r.length===0&&d.jsx("div",{className:"px-2 py-2 text-[12px] text-zinc-400",children:"暂无可用 Agent"}),r.map(l=>{const c=(i==null?void 0:i.agentId)===l.id&&i.cwd===e;return d.jsxs("button",{type:"button",disabled:!!i,onClick:()=>s(l.id),className:"flex h-8 w-full items-center gap-2 rounded-md px-2 text-left text-[12px] text-zinc-700 hover:bg-zinc-100 disabled:opacity-50",children:[c?d.jsx(Wn,{size:13,className:"shrink-0 animate-spin text-zinc-500"}):d.jsx(Wr,{agentId:l.id,agentName:l.name,size:14}),d.jsx("span",{className:"min-w-0 flex-1 truncate",children:l.name})]},l.id)})]})}function zFe({options:e,value:t,onChange:n}){return d.jsx(xi,{className:"w-40 shrink-0",size:"small",popupMatchSelectWidth:!1,value:t,onChange:n,options:e.map(r=>({value:r.value,label:r.label}))})}function n4({options:e,value:t,onChange:n}){return d.jsx("div",{className:"flex shrink-0 rounded-md bg-zinc-100 p-0.5",children:e.map(r=>d.jsx("button",{type:"button",onClick:()=>n(r.value),className:`h-7 rounded px-2.5 text-[12px] font-medium transition-colors ${t===r.value?"bg-white text-zinc-900 shadow-sm":"text-zinc-500 hover:text-zinc-700"}`,children:r.label},r.value))})}function MFe({agents:e,value:t,disabled:n,size:r="default",popupWidth:i,onChange:s}){return d.jsx(da,{size:r,popupWidth:i,options:e.map(o=>({value:o.id,label:o.name,meta:o.version,agentId:o.id})),value:t,placeholder:"选择 Agent",disabledText:"未扫描到可用 Agent",disabled:n,onChange:s})}function h_({value:e,placeholder:t,onChange:n}){const[r,i]=m.useState(""),s=m.useRef(null),o=(c=r)=>{const u=NFe(c);u.length&&n([...new Set([...e,...u])]),i("")},a=c=>n(e.filter(u=>u!==c)),l=c=>{c.nativeEvent.isComposing||(c.key==="Enter"||c.key===","||c.key===","?(c.preventDefault(),o()):c.key==="Backspace"&&!r&&e.length&&a(e[e.length-1]))};return d.jsxs("div",{role:"group","aria-label":"成员真实姓名",onClick:()=>{var c;return(c=s.current)==null?void 0:c.focus()},className:"mt-2 flex min-h-11 cursor-text flex-wrap items-center gap-x-2 gap-y-2 rounded-lg border border-zinc-300 bg-zinc-50/70 p-2 ui-field-within focus-within:bg-white",children:[e.map(c=>d.jsxs("span",{title:c,className:"flex h-7 max-w-full items-center rounded-md border border-zinc-200 bg-white pl-2.5 pr-1 text-[12px] font-medium text-zinc-700 shadow-[0_1px_1px_rgba(24,24,27,.04)]",children:[d.jsx("span",{className:"min-w-0 truncate",children:c}),d.jsx("button",{type:"button","aria-label":`移除 ${c}`,onPointerDown:u=>u.preventDefault(),onClick:()=>a(c),className:"ml-1.5 grid h-5 w-5 shrink-0 place-items-center rounded text-zinc-400 transition-colors hover:bg-zinc-100 hover:text-zinc-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-300",children:d.jsx(Yn,{size:11})})]},c)),d.jsx("input",{ref:s,"aria-label":"输入成员真实姓名",value:r,onChange:c=>i(c.target.value),onKeyDown:l,onBlur:()=>o(),onPaste:c=>{const u=c.clipboardData.getData("text");/[\n,,]/.test(u)&&(c.preventDefault(),o(`${r}
|
|
1137
|
+
例如:请检查 {{项目}} 的发布前状态,并运行 {{验证命令}}。`,className:"ui-field w-full resize-y rounded-lg border border-zinc-200 bg-white px-3 py-2 font-mono text-[12px] leading-5 text-zinc-800 outline-none transition-colors placeholder:text-zinc-400 focus:border-zinc-400"})]}),d.jsx("div",{className:"text-[12px] leading-5 text-zinc-500",children:g.length?d.jsxs(d.Fragment,{children:["识别到变量:",d.jsx("span",{className:"font-mono text-zinc-700",children:g.join("、")})]}):"没有 {{变量}},点击卡片会直接填入整段提示词。"}),u&&d.jsx("p",{role:"alert",className:"text-[12px] text-red-600",children:u})]}),d.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-t border-zinc-100 px-4 py-3",children:[e&&d.jsxs("button",{type:"button",onClick:()=>{if(!f){p(!0);return}r(e.id)},className:"flex items-center gap-1 rounded-lg px-2.5 py-1.5 text-[12px] text-red-600 hover:bg-red-50",children:[d.jsx(Of,{size:12}),f?"确认删除":"删除"]}),d.jsx("button",{type:"button",onClick:t,className:"ml-auto rounded-lg px-3 py-1.5 text-[12px] text-zinc-600 hover:bg-zinc-100",children:"取消"}),d.jsx("button",{type:"submit",disabled:!i.trim()||!l.trim(),className:"rounded-lg bg-zinc-900 px-3.5 py-1.5 text-[12px] font-medium text-white transition-colors hover:bg-zinc-800 disabled:cursor-not-allowed disabled:opacity-40",children:"保存模板"})]})]})}function yFe({agents:e,sessions:t,onCreated:n,editorRef:r,hero:i,collapsed:s=!1,companion:o}){var ne,ie,oe,G,le,me,Y,ge,ye;const a=Fn(),[l,c]=m.useState(""),[u,h]=m.useState([]),[f,p]=m.useState(""),[g,v]=m.useState(""),[x,b]=m.useState(""),[y,w]=m.useState(""),[S,C]=m.useState(),[_,k]=m.useState(!1),z=m.useRef(new Map),j=m.useRef(new Set),N=m.useRef(0),$=m.useRef(l);$.current=l;const R=()=>{var re;return((re=r==null?void 0:r.current)==null?void 0:re.getValue())??$.current},P=nG(o==null?void 0:o.sessionId,l,{skipEmptyValue:_}),E=e.some(re=>re.id===f)?f:((ne=t.find(re=>!re.archivedAt&&e.some(Ee=>Ee.id===re.agentId)))==null?void 0:ne.agentId)||((ie=e[0])==null?void 0:ie.id)||"",M=e.find(re=>re.id===E),T=It({queryKey:["system-capabilities"],queryFn:Ne.systemCapabilities}),D=(M==null?void 0:M.cwd)||((oe=T.data)==null?void 0:oe.workingDirectory),A=m.useMemo(()=>{const re=new Set,Ee=[];for(const Ie of[D,...t.map(Pe=>Pe.cwd)])!Ie||re.has(Ie)||(re.add(Ie),Ee.push(Ie));return Ee.slice(0,30)},[D,t]),H=(G=T.data)==null?void 0:G.homeDirectory,I=It({queryKey:vl(E,x),queryFn:()=>xl(E,x||void 0),enabled:!!E,initialData:()=>Pd(E,x||void 0),initialDataUpdatedAt:0,refetchOnMount:"always",staleTime:6e4}),B=It({queryKey:["skills",g],queryFn:()=>Ne.skills(g||void 0),staleTime:6e4}),L=bt({mutationFn:()=>xl(E,x||void 0,!0),onSuccess:re=>a.setQueryData(vl(E,x||void 0),re),onError:re=>C(re instanceof Error?re.message:String(re))}),O=bt({mutationFn:Ne.selectDirectory,onSuccess:re=>v(re.path),onError:re=>C(re instanceof Error?re.message:String(re))}),W=UK({loaded:I.data!==void 0,loading:I.data===void 0&&(I.isPending||I.isFetching||L.isPending),switching:!1,failed:I.data===void 0&&I.isError}),F=async re=>{const Ee=`draft-${++N.current}`,Ie="name"in re?re.name:"(未命名文件)",Pe=re.type.startsWith("image/");re instanceof File&&z.current.set(Ee,re);const $e=Pe?URL.createObjectURL(re):void 0;return $e&&j.current.add($e),{id:Ee,kind:Pe?"image":"file",label:Ie,value:Ee,...$e?{url:$e}:{}}},U=()=>{for(const re of j.current)URL.revokeObjectURL(re);j.current.clear(),z.current.clear()},X=re=>{c(re),requestAnimationFrame(()=>{var Ee;return(Ee=r==null?void 0:r.current)==null?void 0:Ee.focus()})},Q=(re,Ee)=>{const Ie=u,Pe=v2();k(!0),(async()=>{var $e;try{const pe=await Promise.all(Ie.map(async Te=>{const ve=z.current.get(Te.id);if(!ve)return Te;const Ue=await p2(re.sessionId,ve);return m2(Ue,ve.type.startsWith("image/"))})),De=f2(Ee,pe);De&&await Ne.send(re.sessionId,De,"queue",void 0,Pe),a.invalidateQueries({queryKey:["sessions"]}),a.invalidateQueries({queryKey:["tasks",re.sessionId]}),P.cancel();const ee=xc(),fe=R();!!fe.trim()&&fe!==Ee?(bh(ee,re.sessionId,fe),c(fe)):(y2(ee,re.sessionId),($e=r==null?void 0:r.current)==null||$e.setValue(""),c("")),h([]),U(),re.onSent()}catch(pe){C(pe instanceof Error?pe.message:String(pe))}finally{k(!1)}})()},ae=re=>{if(_)return;if(C(void 0),o){Q(o,re);return}if(!E)return;const Ee=re,Ie=u,Pe=v2();k(!0),(async()=>{var pe;let $e;try{$e=await Ne.create({agentId:E,...g.trim()?{cwd:g.trim()}:{},...x?{model:x}:{},...y?{reasoningEffort:y}:{}}),Ee&&bh(xc(),$e.id,Ee);const De=await Promise.all(Ie.map(async ve=>{const Ue=z.current.get(ve.id);if(!Ue)return ve;const ce=await p2($e.id,Ue);return m2(ce,Ue.type.startsWith("image/"))})),ee=f2(Ee,De);ee&&await Ne.send($e.id,ee,"queue",void 0,Pe),a.invalidateQueries({queryKey:["sessions"]}),a.invalidateQueries({queryKey:["tasks",$e.id]}),P.cancel();const fe=xc(),Se=R();!!Se.trim()&&Se!==Ee?(bh(fe,$e.id,Se),c(Se)):(y2(fe,$e.id),(pe=r==null?void 0:r.current)==null||pe.setValue(""),c("")),h([]),U(),n($e)}catch(De){C(De instanceof Error?De.message:String(De)),$e&&(bh(xc(),$e.id,R()),a.invalidateQueries({queryKey:["sessions"]}),n($e))}finally{k(!1)}})()};return d.jsxs("div",{className:"relative my-auto w-full min-w-0 max-w-[720px]",children:[i??d.jsxs("div",{className:"flex flex-col items-center text-center",children:[d.jsx(nFe,{size:88}),d.jsx("h1",{className:"ui-empty-state ui-hero-title mt-4 text-[22px] font-semibold tracking-[-.02em]",children:"有什么要做的?"})]}),d.jsx("div",{className:"ui-collapse","data-collapsed":s||void 0,"aria-hidden":s||void 0,inert:s,children:d.jsxs("div",{children:[d.jsx("div",{className:"mt-6",children:d.jsx(YK,{draft:!0,...o?{placeholder:d.jsxs(d.Fragment,{children:[d.jsxs("span",{className:"hidden sm:inline",children:["跟",o.name,"说说要做什么,Enter 发送;它会派侧边会话去办"]}),d.jsxs("span",{className:"sm:hidden",children:["跟",o.name,"说说要做什么"]})]}),sendLabel:`交给${o.name}`,lockedTarget:d.jsxs("span",{title:`消息会发进主会话,由${o.name}安排`,className:"flex h-8 shrink-0 items-center gap-1.5 rounded-lg bg-zinc-100 px-2.5 text-[12px] font-medium text-zinc-700",children:[d.jsx(ps,{size:12}),o.name," · 主会话"]})}:{},editorRef:r,sessionId:"",state:"idle",value:l,references:u,sending:_,mode:"queue",queuedTasks:[],skills:B.data??[],models:((le=I.data)==null?void 0:le.models)??[],reasoningEfforts:((me=I.data)==null?void 0:me.reasoningEfforts)??[],currentModel:x||((Y=I.data)==null?void 0:Y.defaultModel),currentReasoningEffort:y||((ge=I.data)==null?void 0:ge.defaultReasoningEffort),context:{},advertisedCommands:[],modelReadiness:W,switchingModel:!1,switchingReasoningEffort:!1,refreshingModels:I.isFetching||L.isPending,agents:e,currentAgentId:(o==null?void 0:o.agentId)??E,onAgentChange:re=>{p(re),b(""),w("")},workspace:g,onWorkspaceChange:v,workspaceSuggestion:D,homeDirectory:H,workspaceOptions:A,directoryPickerAvailable:(ye=T.data)==null?void 0:ye.directoryPicker,pickingDirectory:O.isPending,onPickDirectory:()=>O.mutate(),onAttachFile:F,onChange:c,onReferencesChange:h,onModeChange:()=>{},onSubmit:ae,onInterrupt:()=>{},onCancelQueued:()=>{},onSteerQueued:()=>{},onEditQueued:()=>{},onModelChange:b,onReasoningEffortChange:w,onRefreshModels:()=>L.mutate()})}),!o&&d.jsx(gFe,{onUse:X}),l.length>wg&&d.jsxs("p",{role:"status",className:"mt-2 text-center text-[12px] text-amber-600",children:["草稿超过 ",wg.toLocaleString()," 字符,超出部分不会保存,刷新后会丢失。"]}),S&&d.jsx("p",{role:"alert",className:"mt-2 text-center text-[12px] text-red-600",children:S}),u.length>0&&d.jsxs("p",{className:"mt-2 text-center text-[12px] text-zinc-400",children:[u.length," 个附件会在",o?"发送":"会话创建","后上传"]})]})})]})}const eY="agentdock:adopt-agent";function wFe(){try{return typeof window>"u"?"":window.localStorage.getItem(eY)||""}catch{return""}}function SFe(e,t){const n=e instanceof Error?e.message:String(e);return/authentication required|not authenticated|unauthorized|\b401\b/i.test(n)?`${t} 还没在这台机器上登录,暂时开不了工。换一个已登录的 Agent,或先在终端完成 ${t} 的登录再回来认领。`:n}function e4(){const e=d.jsxs("svg",{viewBox:"0 0 24 24",width:"11",height:"11",fill:"currentColor","aria-hidden":"true",children:[d.jsx("ellipse",{cx:"12",cy:"16",rx:"5",ry:"4.2"}),d.jsx("circle",{cx:"6",cy:"9.5",r:"2.2"}),d.jsx("circle",{cx:"10",cy:"6",r:"2.2"}),d.jsx("circle",{cx:"14",cy:"6",r:"2.2"}),d.jsx("circle",{cx:"18",cy:"9.5",r:"2.2"})]});return d.jsxs("span",{className:"ui-paw-walk",children:[e,e,e,e]})}function t4(e){const t=B7();return e.counts.needsUser?`${t}~有 ${e.counts.needsUser} 件事等你拍板,右边的便签里看看吧`:e.counts.planned?`${t}~有 ${e.counts.planned} 张计划等你点头,右边的便签里看看`:e.busy?`${t}~我正在忙,有新想法也可以先丢给我`:e.counts.running?`${t}~我在盯着 ${e.counts.running} 张便签,有进展会叫你`:e.counts.review?`${t}~${e.counts.review} 张便签做完了,我在验收`:`${t}~我是${e.name},有事交给我,我派人去办`}function _Fe({value:e,name:t,onChange:n}){return d.jsxs("div",{className:"ui-target mt-4","data-value":e,role:"group","aria-label":"这条消息发给谁",children:[d.jsx("span",{className:"ui-target-pill","aria-hidden":"true"}),d.jsxs("button",{type:"button","aria-pressed":e==="new",onClick:()=>n("new"),className:"ui-target-option",children:[d.jsx(OX,{size:13}),"新对话"]}),d.jsxs("button",{type:"button","aria-pressed":e==="companion",onClick:()=>n("companion"),className:"ui-target-option ui-cat-hover-host",children:[d.jsx(ps,{size:13}),d.jsxs("span",{className:"max-w-[9rem] truncate",children:["交给",t]})]})]})}function CFe({agents:e,sessions:t,editorRef:n,onCreated:r}){var Ee,Ie,Pe,$e,pe,De,ee,fe,Se,Te,ve,Ue;const i=Fn(),s=ui(),o=ja(),a=Mt(ce=>ce.adoptPending),l=Mt(ce=>ce.inviteDismissed),c=Mt(ce=>ce.homeTarget),u=Mt(ce=>ce.celebrateNonce),[h,f]=m.useState("idle"),[p,g]=m.useState(tm),[v,x]=m.useState(wFe),[b,y]=m.useState(""),[w,S]=m.useState(""),[C,_]=m.useState(""),[k,z]=m.useState(),[j,N]=m.useState(),[$,R]=m.useState(""),P=jh("kitten-hero"),E=m.useRef(null),M=m.useRef(null),T=It({queryKey:["system-capabilities"],queryFn:Ne.systemCapabilities});m.useEffect(()=>{!a||!s.loaded||(Mt.getState().consumeAdoption(),s.adopted||f("form"))},[a,s.loaded,s.adopted]),m.useEffect(()=>{if(h!=="form")return;const ce=window.setTimeout(()=>{var Oe,he;(Oe=E.current)==null||Oe.focus(),(he=E.current)==null||he.select()},260);return()=>window.clearTimeout(ce)},[h]),m.useEffect(()=>{if(!j)return;const ce=window.setTimeout(()=>N(void 0),1800);return()=>window.clearTimeout(ce)},[j]);const D=m.useMemo(()=>e.filter(ce=>!ce.disabled),[e]),A=D.some(ce=>ce.id===v)?v:((Ee=t.find(ce=>!ce.archivedAt&&D.some(Oe=>Oe.id===ce.agentId)))==null?void 0:Ee.agentId)||((Ie=D[0])==null?void 0:Ie.id)||"",H=D.find(ce=>ce.id===A),I=(H==null?void 0:H.cwd)||((Pe=T.data)==null?void 0:Pe.workingDirectory),B=($e=T.data)==null?void 0:$e.homeDirectory,L=m.useMemo(()=>{const ce=new Set,Oe=[];for(const he of[I,...t.map(_e=>_e.cwd)])!he||ce.has(he)||(ce.add(he),Oe.push(he));return Oe.slice(0,20)},[I,t]),O=It({queryKey:vl(A,w),queryFn:()=>xl(A,w||void 0),enabled:!!A&&(h==="form"||h==="adopting"),initialData:()=>Pd(A,w||void 0),initialDataUpdatedAt:0,refetchOnMount:"always",staleTime:6e4});m.useEffect(()=>{S(""),_("")},[A]);const W=((De=(pe=O.data)==null?void 0:pe.models.find(ce=>{var Oe;return ce.id===((Oe=O.data)==null?void 0:Oe.defaultModel)}))==null?void 0:De.name)??((ee=O.data)==null?void 0:ee.defaultModel),F=((Se=(fe=O.data)==null?void 0:fe.reasoningEfforts.find(ce=>{var Oe;return ce.id===((Oe=O.data)==null?void 0:Oe.defaultReasoningEffort)}))==null?void 0:Se.name)??((Te=O.data)==null?void 0:Te.defaultReasoningEffort),U=m.useMemo(()=>{var ce;return(ce=O.data)!=null&&ce.models.length?[{value:"",label:W?`Agent 默认 · ${W}`:"Agent 默认"},...O.data.models.map(Oe=>({value:Oe.id,label:Oe.name,meta:Oe.name===Oe.id?void 0:Oe.id}))]:[]},[W,O.data]),X=m.useMemo(()=>{var ce;return(ce=O.data)!=null&&ce.reasoningEfforts.length?[{value:"",label:F?`Agent 默认 · ${F}`:"Agent 默认"},...O.data.reasoningEfforts.map(Oe=>({value:Oe.id,label:Oe.name}))]:[]},[F,O.data]),Q=O.isPending||O.isFetching,ae=bt({mutationFn:Ne.selectDirectory,onSuccess:ce=>{y(ce.path),z(void 0)},onError:ce=>z(ce instanceof Error?ce.message:String(ce))}),ne=bt({mutationFn:()=>Ne.assistantSetMain({agentId:A,name:p.trim()||tm,...b.trim()?{cwd:b.trim()}:{},...w?{model:w}:{},...C?{reasoningEffort:C}:{}}),onMutate:()=>{z(void 0),f("adopting")},onSuccess:ce=>{var _e;try{window.localStorage.setItem(eY,A)}catch{}const Oe=((_e=ce.companion)==null?void 0:_e.name)??(p.trim()||tm);R(Oe),i.setQueryData(["assistant-state"],je=>je&&{...je,mainSessionId:ce.session.id,mainSession:ce.session,companion:ce.companion??{name:Oe,adoptedAt:new Date().toISOString()}}),i.setQueryData(["sessions"],je=>je&&[ce.session,...je.filter(ke=>ke.id!==ce.session.id)]),i.invalidateQueries({queryKey:["assistant-state"]}),i.invalidateQueries({queryKey:["sessions"]});const he=Mt.getState();he.dismissInvite(!1),he.celebrate(),f("celebrate"),window.setTimeout(()=>{M.current&&Tc(M.current.getBoundingClientRect(),"confetti",18)},120),window.setTimeout(()=>o.openMain(ce.session.id),uo()?900:2300)},onError:ce=>{f("form"),z(SFe(ce,(H==null?void 0:H.name)??A))}}),ie=()=>{const ce=b.trim();if(ce&&!ce.startsWith("/")){z("工作目录请填绝对路径,例如 /Users/you/project");return}ne.mutate()},oe=()=>{Mt.getState().dismissInvite(),N("sad"),f("idle")},G=s.adopted&&h!=="celebrate",le=G&&c==="companion"&&!!s.mainId,me=!s.adopted&&s.loaded&&(h==="invite"||h==="idle"&&!l),Y=h==="form"||h==="adopting"||h==="celebrate",ge=j??(h==="celebrate"?"happy":h==="adopting"?"busy":G?s.mood==="curious"?"idle":s.mood:"curious"),ye=d.jsx("div",{ref:P,className:"ui-stage-kitten",children:d.jsx(Fi,{size:h==="form"||h==="adopting"?76:88,mood:ge,stage:G?s.stage:void 0,collar:G||h==="celebrate",drawCollar:h==="celebrate",track:!0,typingAware:!0,celebrateKey:u,viewTransitionName:D7,label:G?`进入主会话(${s.name})`:"小猫",onClick:()=>{G?o.openMain():h==="idle"&&f("invite")}})});let re;if(G){const ce=s.counts;re=d.jsxs("div",{className:"ui-stage",children:[d.jsx("div",{className:"ui-speech text-center",children:t4(s)},t4(s)),ye,d.jsx("span",{className:"ui-name-tag",children:s.name}),d.jsxs("div",{className:"mt-3 flex flex-wrap justify-center gap-1.5",children:[ce.needsUser>0&&d.jsxs("button",{type:"button",className:"ui-status-chip",onClick:()=>Mt.getState().openDrawer({filter:"needs_user"}),children:[d.jsx("span",{className:"ui-note-swatch ui-note-paper-needs"}),ce.needsUser," 件需要你"]}),ce.planned>0&&d.jsxs("button",{type:"button",className:"ui-status-chip",onClick:()=>Mt.getState().openDrawer({filter:"needs_user"}),children:[d.jsx("span",{className:"ui-note-swatch ui-note-paper-plan"}),ce.planned," 张计划等你点头"]}),ce.review>0&&d.jsxs("button",{type:"button",className:"ui-status-chip",onClick:()=>Mt.getState().openDrawer({filter:"review"}),children:[d.jsx("span",{className:"ui-note-swatch ui-note-paper-review"}),ce.review," 张待验收"]}),ce.running>0&&d.jsxs("button",{type:"button",className:"ui-status-chip",onClick:()=>Mt.getState().openDrawer({filter:"running"}),children:[d.jsx("span",{className:"ui-note-swatch ui-note-paper-running"}),ce.running," 张进行中"]}),!ce.open&&d.jsxs("button",{type:"button",className:"ui-status-chip",onClick:()=>Mt.getState().toggleDrawer(),children:[d.jsx("span",{className:"ui-note-swatch ui-note-paper-done"}),ce.closed?`${ce.closed} 张已完成`:"便签墙"]})]}),d.jsx("h1",{className:"ui-empty-state ui-hero-title mt-5 text-[22px] font-semibold tracking-[-.02em]",children:le?`交给${s.name}吧`:"有什么要做的?"}),d.jsx(_Fe,{value:c,name:s.name,onChange:Oe=>{Mt.getState().setHomeTarget(Oe),requestAnimationFrame(()=>{var he;return(he=n==null?void 0:n.current)==null?void 0:he.focus()})}})]})}else re=d.jsxs("div",{className:"ui-stage",children:[me&&d.jsxs("div",{className:"ui-speech text-center",children:[d.jsx("p",{className:"text-[14px] font-medium text-zinc-900",children:"喵~带我回家吧?"}),d.jsx("p",{className:"mt-0.5 text-[12.5px] leading-5 text-zinc-500",children:"认领后我就是你的主会话:你说要做什么,我派侧边会话去干、盯进度、做完帮你验收,每件事都贴成便签。"}),d.jsxs("div",{className:"mt-2.5 flex justify-center gap-2",children:[d.jsxs("button",{type:"button",onClick:()=>f("form"),className:"inline-flex h-8 items-center gap-1.5 rounded-full bg-zinc-900 px-3.5 text-[12.5px] font-medium text-white transition-[background-color,transform] hover:bg-zinc-700 active:scale-95",children:[d.jsx(ps,{size:13}),"认领它"]}),d.jsx("button",{type:"button",onClick:oe,className:"inline-flex h-8 items-center rounded-full px-3 text-[12.5px] text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-800",children:"先不了"})]})]}),h==="celebrate"&&d.jsxs("div",{className:"ui-speech text-center",children:[d.jsxs("p",{className:"text-[14px] font-medium text-zinc-900",children:["喵!我是",$,",以后请多指教~"]}),d.jsxs("p",{className:"mt-1 inline-flex items-center gap-1.5 text-[12px] text-zinc-500",children:[d.jsx(e4,{}),"正在去主会话…"]})]}),ye,h==="celebrate"&&d.jsx("span",{className:"ui-name-tag",children:$}),(h==="form"||h==="adopting")&&d.jsx("div",{ref:M,className:"ui-adopt-card mt-4",children:d.jsxs("form",{className:"min-w-0",onSubmit:ce=>{ce.preventDefault(),!ne.isPending&&A&&ie()},children:[d.jsxs("div",{className:"min-w-0 px-5 pt-5",children:[d.jsxs("label",{className:"block min-w-0",children:[d.jsx("span",{className:"text-[14px] font-semibold text-zinc-900",children:"给它起个名字"}),d.jsxs("span",{className:"mt-2 flex min-w-0 items-center gap-2",children:[d.jsx("input",{ref:E,value:p,maxLength:16,disabled:h==="adopting",onChange:ce=>g(ce.target.value),placeholder:tm,"aria-label":"小猫的名字",className:"ui-field h-10 min-w-0 flex-1 rounded-xl border border-zinc-300 bg-white px-3 text-[15px] font-semibold text-zinc-900 outline-none placeholder:font-normal placeholder:text-zinc-400 disabled:opacity-60"}),d.jsx("button",{type:"button",disabled:h==="adopting",onClick:()=>g(ce=>Yy(ce.trim())),"aria-label":"随机换一个名字",title:"随机换一个名字",className:"ui-dice grid h-10 w-10 shrink-0 place-items-center rounded-xl border border-zinc-200 text-zinc-500 hover:border-zinc-300 hover:text-zinc-900 disabled:opacity-50",children:d.jsx(Jb,{size:17})})]})]}),d.jsx("div",{className:"mt-4 text-[12.5px] font-medium text-zinc-600",children:"它用哪个 Agent 思考"}),d.jsxs("div",{className:"mt-2 flex min-w-0 max-w-full flex-wrap gap-1.5",children:[D.map(ce=>d.jsxs("button",{type:"button",disabled:h==="adopting","aria-pressed":ce.id===A,onClick:()=>{x(ce.id),S(""),_(""),z(void 0)},className:"ui-pill-choice",children:[d.jsx(Wr,{agentId:ce.id,agentName:ce.name,size:13}),d.jsx("span",{className:"min-w-0 truncate",children:ce.name})]},ce.id)),!D.length&&d.jsx("span",{className:"text-[12.5px] text-zinc-400",children:"还没有可用的 Agent,先到设置里配一个。"})]}),d.jsxs("div",{className:"mt-4 grid min-w-0 grid-cols-[minmax(0,1fr)] gap-3",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"text-[12.5px] font-medium text-zinc-600",children:["模型 ",d.jsx("span",{className:"font-normal text-zinc-400",children:"可选"})]}),d.jsx(da,{size:"sm",options:U,value:w,placeholder:"Agent 默认",disabledText:Q?"正在读取模型…":O.isError?"模型列表读取失败,可先不选":"这个 Agent 没有提供模型选项",disabled:h==="adopting",onChange:ce=>{S(ce),_("")}})]}),d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"text-[12.5px] font-medium text-zinc-600",children:["思考深度 ",d.jsx("span",{className:"font-normal text-zinc-400",children:"可选"})]}),d.jsx(da,{size:"sm",options:X,value:C,placeholder:"Agent 默认",disabledText:Q?"正在读取…":O.isError?"读取失败,可先不选":"这个模型没有思考深度选项",disabled:h==="adopting",onChange:_})]})]}),((ve=O.data)==null?void 0:ve.warning)&&d.jsxs("p",{className:"mt-1.5 break-words text-[11px] leading-4 text-amber-600 [overflow-wrap:anywhere]",children:["这个 Agent 的配置没读出来:",O.data.warning," 如果一直这样,先检查它是否已登录。"]}),d.jsxs("div",{className:"mt-4 text-[12.5px] font-medium text-zinc-600",children:["常驻目录 ",d.jsx("span",{className:"font-normal text-zinc-400",children:"可选,派活时仍可指定别的目录"})]}),d.jsxs("div",{className:"mt-2 flex min-w-0 max-w-full items-center gap-1.5",children:[d.jsx("input",{list:"adopt-workspaces",value:b,disabled:h==="adopting",onChange:ce=>y(ce.target.value),placeholder:I??"绝对路径,例如 /Users/you/project","aria-label":"常驻目录",title:b.trim()||I||void 0,spellCheck:!1,className:"ui-field h-9 w-0 min-w-0 max-w-full flex-1 truncate rounded-xl border border-zinc-300 bg-white px-3 font-mono text-[12.5px] text-zinc-800 outline-none placeholder:font-sans placeholder:text-zinc-400 disabled:opacity-60"}),((Ue=T.data)==null?void 0:Ue.directoryPicker)&&d.jsx("button",{type:"button",disabled:h==="adopting"||ae.isPending,onClick:()=>ae.mutate(),title:ae.isPending?"选择中…":"选择目录","aria-label":"选择目录",className:"grid h-9 w-9 shrink-0 place-items-center rounded-xl border border-zinc-200 text-zinc-500 transition-colors hover:border-zinc-300 hover:text-zinc-900 disabled:opacity-50",children:ae.isPending?d.jsx(Wn,{size:14,className:"animate-spin"}):d.jsx(fa,{size:14})})]}),b.trim()&&d.jsx("p",{className:"mt-1.5 break-all font-mono text-[11.5px] leading-4 text-zinc-400",title:b.trim(),children:b.trim()}),d.jsx("datalist",{id:"adopt-workspaces",children:L.map(ce=>d.jsx("option",{value:ce,children:g2(ce,B)},ce))}),d.jsx("p",{className:"mt-1.5 text-[11.5px] leading-4 text-zinc-400",children:"可以直接粘贴任意绝对路径,或从最近用过的目录里挑;留空就用 Agent 自己的默认目录。"}),d.jsxs("p",{className:"mt-4 rounded-xl bg-zinc-50 px-3 py-2.5 text-[12px] leading-5 text-zinc-500",children:["它会成为你的",d.jsx("b",{className:"font-medium text-zinc-700",children:"主会话"}),":听你说要做什么,派侧边会话去干、盯进度、验收结果。派出去的每件事都是一张便签,贴在屏幕右边,随时划出来看。"]}),k&&d.jsx("p",{role:"alert",className:"mt-3 break-words text-[12px] text-red-600 [overflow-wrap:anywhere]",children:k})]}),d.jsxs("div",{className:"mt-4 flex min-w-0 flex-wrap items-center justify-end gap-2 border-t border-zinc-100 px-4 py-3",children:[d.jsx("button",{type:"button",disabled:h==="adopting",onClick:()=>f(l?"idle":"invite"),className:"h-9 rounded-full px-3.5 text-[13px] text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-800 disabled:opacity-50",children:"先不了"}),d.jsx("button",{type:"submit",disabled:h==="adopting"||!A,className:"inline-flex h-9 min-w-[8.5rem] items-center justify-center gap-1.5 rounded-full bg-zinc-900 px-4 text-[13px] font-medium text-white transition-[background-color,transform] hover:bg-zinc-700 active:scale-95 disabled:opacity-60",children:h==="adopting"?d.jsxs(d.Fragment,{children:[d.jsx(e4,{}),"正在带它回家…"]}):d.jsxs(d.Fragment,{children:[d.jsx(ps,{size:14}),"带它回家"]})})]})]})}),!Y&&d.jsx("h1",{className:"ui-empty-state ui-hero-title mt-4 text-[22px] font-semibold tracking-[-.02em]",children:"有什么要做的?"})]});return d.jsx(yFe,{editorRef:n,agents:e,sessions:t,onCreated:r,hero:re,collapsed:Y&&!G,companion:le&&s.mainSession?{sessionId:s.mainSession.id,agentId:s.mainSession.agentId,name:s.name,onSent:()=>{const ce=wm(["kitten-hero"]);ce&&Tc(ce,"sparkles",6),window.setTimeout(()=>o.openMain(),uo()?0:260)}}:void 0})}const kFe=m.lazy(()=>A4(()=>import("./PromptEditor-CEWu7YQO.js"),__vite__mapDeps([5,1,2,3]))),NFe=e=>[...new Set(e.split(/[\n,,]/).map(t=>t.trim()).filter(Boolean))];function EFe({className:e=""}){return d.jsx("img",{src:"/agent-dock.svg",alt:"","aria-hidden":"true",className:`${e} ui-logo-tile`})}function jFe({cwd:e,top:t,left:n,agents:r,creatingPair:i,onSelect:s,onClose:o}){const a=m.useRef(null);return m0(a,!0,o),d.jsxs("div",{ref:a,className:"ui-popover fixed z-50 max-h-64 w-52 overflow-y-auto rounded-lg border border-zinc-200 bg-white p-1 shadow-[0_16px_40px_rgba(24,24,27,.16)]",style:{top:t,left:n},children:[d.jsx("div",{className:"px-2 py-1 text-[12px] text-zinc-400",children:"在此工作区新建会话"}),r.length===0&&d.jsx("div",{className:"px-2 py-2 text-[12px] text-zinc-400",children:"暂无可用 Agent"}),r.map(l=>{const c=(i==null?void 0:i.agentId)===l.id&&i.cwd===e;return d.jsxs("button",{type:"button",disabled:!!i,onClick:()=>s(l.id),className:"flex h-8 w-full items-center gap-2 rounded-md px-2 text-left text-[12px] text-zinc-700 hover:bg-zinc-100 disabled:opacity-50",children:[c?d.jsx(Wn,{size:13,className:"shrink-0 animate-spin text-zinc-500"}):d.jsx(Wr,{agentId:l.id,agentName:l.name,size:14}),d.jsx("span",{className:"min-w-0 flex-1 truncate",children:l.name})]},l.id)})]})}function zFe({options:e,value:t,onChange:n}){return d.jsx(xi,{className:"w-40 shrink-0",size:"small",popupMatchSelectWidth:!1,value:t,onChange:n,options:e.map(r=>({value:r.value,label:r.label}))})}function n4({options:e,value:t,onChange:n}){return d.jsx("div",{className:"flex shrink-0 rounded-md bg-zinc-100 p-0.5",children:e.map(r=>d.jsx("button",{type:"button",onClick:()=>n(r.value),className:`h-7 rounded px-2.5 text-[12px] font-medium transition-colors ${t===r.value?"bg-white text-zinc-900 shadow-sm":"text-zinc-500 hover:text-zinc-700"}`,children:r.label},r.value))})}function MFe({agents:e,value:t,disabled:n,size:r="default",popupWidth:i,onChange:s}){return d.jsx(da,{size:r,popupWidth:i,options:e.map(o=>({value:o.id,label:o.name,meta:o.version,agentId:o.id})),value:t,placeholder:"选择 Agent",disabledText:"未扫描到可用 Agent",disabled:n,onChange:s})}function h_({value:e,placeholder:t,onChange:n}){const[r,i]=m.useState(""),s=m.useRef(null),o=(c=r)=>{const u=NFe(c);u.length&&n([...new Set([...e,...u])]),i("")},a=c=>n(e.filter(u=>u!==c)),l=c=>{c.nativeEvent.isComposing||(c.key==="Enter"||c.key===","||c.key===","?(c.preventDefault(),o()):c.key==="Backspace"&&!r&&e.length&&a(e[e.length-1]))};return d.jsxs("div",{role:"group","aria-label":"成员真实姓名",onClick:()=>{var c;return(c=s.current)==null?void 0:c.focus()},className:"mt-2 flex min-h-11 cursor-text flex-wrap items-center gap-x-2 gap-y-2 rounded-lg border border-zinc-300 bg-zinc-50/70 p-2 ui-field-within focus-within:bg-white",children:[e.map(c=>d.jsxs("span",{title:c,className:"flex h-7 max-w-full items-center rounded-md border border-zinc-200 bg-white pl-2.5 pr-1 text-[12px] font-medium text-zinc-700 shadow-[0_1px_1px_rgba(24,24,27,.04)]",children:[d.jsx("span",{className:"min-w-0 truncate",children:c}),d.jsx("button",{type:"button","aria-label":`移除 ${c}`,onPointerDown:u=>u.preventDefault(),onClick:()=>a(c),className:"ml-1.5 grid h-5 w-5 shrink-0 place-items-center rounded text-zinc-400 transition-colors hover:bg-zinc-100 hover:text-zinc-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-300",children:d.jsx(Yn,{size:11})})]},c)),d.jsx("input",{ref:s,"aria-label":"输入成员真实姓名",value:r,onChange:c=>i(c.target.value),onKeyDown:l,onBlur:()=>o(),onPaste:c=>{const u=c.clipboardData.getData("text");/[\n,,]/.test(u)&&(c.preventDefault(),o(`${r}
|
|
1138
1138
|
${u}`))},placeholder:e.length?"继续添加成员…":t,className:"h-7 min-w-36 flex-[1_0_9rem] border-0 bg-transparent px-1 text-[12px] text-zinc-800 outline-none placeholder:text-zinc-400"})]})}function IFe({agents:e,onClose:t}){var ut,wt,Wt,an,Bn,qt,jn,et,ft,q,Ce,He,Ct,pt,tn,Ut,Xt,zn,ln,mn,hr,fr,hn,Zn,jr,zr,Yr,fi,Ft,Rt;const[n,r]=m.useState(!1),i=Fn(),s=It({queryKey:["lark-config"],queryFn:Ne.larkConfig}),o=It({queryKey:["system-capabilities"],queryFn:Ne.systemCapabilities}),[a,l]=m.useState(),c=m.useRef(null),[u,h]=m.useState(null),[f,p]=m.useState(1),[g,v]=m.useState(""),[x,b]=m.useState(""),[y,w]=m.useState(""),[S,C]=m.useState(""),[_,k]=m.useState(""),[z,j]=m.useState(!1),[N,$]=m.useState([]),[R,P]=m.useState([]),[E,M]=m.useState(!0),[T,D]=m.useState(""),[A,H]=m.useState(""),[I,B]=m.useState(""),[L,O]=m.useState(""),[W,F]=m.useState(!1),[U,X]=m.useState(!1),[Q,ae]=m.useState("user"),[ne,ie]=m.useState([]),[oe,G]=m.useState(""),[le,me]=m.useState(!1),[Y,ge]=m.useState(!1),[ye,re]=m.useState(!1),[Ee,Ie]=m.useState(!1),[Pe,$e]=m.useState(!1),[pe,De]=m.useState(1e3),[ee,fe]=m.useState(String(Vw)),[Se,Te]=m.useState(!1),ve=(ut=s.data)==null?void 0:ut.bots.find(se=>se.appId===u),Ue=((wt=e.find(se=>se.id===T))==null?void 0:wt.cwd)||((Wt=o.data)==null?void 0:Wt.workingDirectory),ce=!!(ve!=null&&ve.setupComplete&&ve.defaultAgentId===T),Oe=!!(Y||ve!=null&&ve.hardGateEnabled),he=m.useMemo(()=>Dye(oe),[oe]),_e=It({queryKey:["lark-hook-status",ve==null?void 0:ve.appId,T],queryFn:()=>Ne.larkHookStatus(ve.appId),enabled:!!(ce&&le&&f===2)}),je=It({queryKey:vl(T,A),queryFn:()=>xl(T,A||void 0),enabled:!!T,initialData:()=>Pd(T,A||void 0),initialDataUpdatedAt:0,refetchOnMount:"always",staleTime:5*6e4}),ke=bt({mutationFn:se=>xl(se.agentId,se.model,!0),onSuccess:(se,mt)=>i.setQueryData(vl(mt.agentId,mt.model),se)}),Le={enabled:Y,persisted:!!(ve!=null&&ve.hardGateEnabled),agentSelectionSaved:ce,hookInstalled:!!((an=_e.data)!=null&&an.installed)},at=t1e(Le),vt=n1e(Le),$t=!!(Y&&(ve!=null&&ve.hardGateEnabled)&&_e.isSuccess&&!_e.data.installed),st=!!(le&&(ve!=null&&ve.highRiskAllowedEmails.length)&&!ne.length),Xe=r1e(I,(Bn=je.data)!=null&&Bn.warning?void 0:je.data,je.isFetching),ht=[`机器人名称:${g.trim()||S.trim()||"未命名"}`,`Agent:${((qt=e.find(se=>se.id===T))==null?void 0:qt.name)??(T||"未选择")}`,`工作区:${x.trim()||"使用 Agent 默认工作目录"}`,`群协作工具:${W?U?"已开启(可读写)":"已开启(只读)":"未开启"}`,`回复模式:${Se?"静默回复(最终答案由服务端自动发送)":"Trace 卡片"}`].join(`
|
|
1139
1139
|
`);AP(s.data,()=>{if(u!==null)return;const se=s.data.bots[0];h((se==null?void 0:se.appId)??""),p(se&&!se.setupComplete?2:1)}),AP(s.data&&u!==null?u:null,()=>{var mt,xt,rn,$n,Xn;if(u===null||c.current===u)return;c.current=u;const se=s.data.bots.find(qn=>qn.appId===u);v((se==null?void 0:se.name)??""),b((se==null?void 0:se.workspace)??""),w((se==null?void 0:se.webBaseUrl)??""),C((se==null?void 0:se.appId)??""),k(""),j(!!(se!=null&&se.allowedUsers.length||se!=null&&se.allowedEmails.length||(mt=se==null?void 0:se.allowedUserNames)!=null&&mt.length)),$((xt=se==null?void 0:se.allowedUserNames)!=null&&xt.length?se.allowedUserNames:((se==null?void 0:se.allowedUsers)??[]).map(qn=>qn.name)),P((rn=se==null?void 0:se.allowedBotNames)!=null&&rn.length?se.allowedBotNames:((se==null?void 0:se.allowedBots)??[]).map(qn=>qn.name)),M((se==null?void 0:se.peerBotsAllowed)!==!1),D(e.some(qn=>qn.id===(se==null?void 0:se.defaultAgentId))?(se==null?void 0:se.defaultAgentId)??"":(($n=e[0])==null?void 0:$n.id)??""),H((se==null?void 0:se.defaultModel)??""),B((se==null?void 0:se.defaultReasoningEffort)??""),$e((se==null?void 0:se.listening)??!1),De((se==null?void 0:se.pushIntervalMs)??1e3),fe(((se==null?void 0:se.traceLimit)??Vw).toString()),Te((se==null?void 0:se.quietReply)??!1),O((se==null?void 0:se.preInjectPrompt)??""),F((se==null?void 0:se.groupToolsEnabled)??!1),X((se==null?void 0:se.groupToolsAllowSend)??!1),ae((se==null?void 0:se.groupSessionScope)??"user"),ie((Xn=se==null?void 0:se.highRiskAllowedUserNames)!=null&&Xn.length?se.highRiskAllowedUserNames:((se==null?void 0:se.highRiskAllowedUsers)??[]).map(qn=>qn.name)),G((se==null?void 0:se.highRiskPattern)??""),me((se==null?void 0:se.gateEnabled)??!1),ge((se==null?void 0:se.hardGateEnabled)??!1),re((se==null?void 0:se.hookTrustConfirmed)??!1)});const Ye=bt({mutationFn:()=>Ne.inspectLarkBot({appId:S.trim(),appSecret:_.trim()}),onSuccess:se=>v(se.appName)}),lt=bt({mutationFn:async()=>{const se=await Ne.saveLarkConfig({stage:"lark",...ve?{originalAppId:ve.appId}:{},appId:S.trim(),..._.trim()?{appSecret:_.trim()}:{},workspace:x.trim(),webBaseUrl:y.trim(),allowedUserNames:z?N:[],allowedEmails:[],allowedBotNames:E?[]:R,peerBotsAllowed:E,listening:Pe,pushIntervalMs:pe,traceLimit:Number(ee),quietReply:Se});return i.setQueryData(["lark-config"],se),Ne.saveLarkConfig({stage:"agent",originalAppId:S.trim(),defaultAgentId:T,defaultModel:A,defaultReasoningEffort:Xe,preInjectPrompt:L,groupToolsEnabled:W,groupToolsAllowSend:U,groupSessionScope:Q,highRiskAllowedUserNames:ne,highRiskAllowedEmails:[],highRiskPattern:oe,gateEnabled:le,softGateEnabled:le,hardGateEnabled:Y,hookTrustConfirmed:ye})},onSuccess:se=>{i.setQueryData(["lark-config"],se);const mt=S.trim();h(mt),k(""),i.invalidateQueries({queryKey:["lark-hook-status",mt]}),t()}}),kt=bt({mutationFn:async()=>{const se=await Ne.saveLarkConfig({stage:"agent",originalAppId:ve.appId,defaultAgentId:T,defaultModel:A,defaultReasoningEffort:Xe,preInjectPrompt:L,listening:Pe,groupToolsEnabled:W,groupToolsAllowSend:U,groupSessionScope:Q,highRiskAllowedUserNames:ne,highRiskAllowedEmails:[],highRiskPattern:oe,gateEnabled:!0,softGateEnabled:!0,hardGateEnabled:!1,hookTrustConfirmed:!1});return i.setQueryData(["lark-config"],se),Ne.installLarkHook(ve.appId,oe)},onSuccess:se=>{i.setQueryData(["lark-hook-status",ve.appId,T],se),me(!0),ge(!1),re(!0),i.invalidateQueries({queryKey:["lark-config"]})}}),_t=bt({mutationFn:()=>Ne.deleteLarkConfig(ve.appId),onSuccess:se=>{i.setQueryData(["lark-config"],se);const mt=se.bots[0];h((mt==null?void 0:mt.appId)??""),p(mt&&!mt.setupComplete?2:1),l(void 0)}}),ct=bt({mutationFn:Ne.selectDirectory,onSuccess:se=>b(se.path)}),yt=f===2&&!!T&&!je.data&&(je.isLoading||je.isFetching),de=f!==2||!!je.data,be=!!(S.trim()&&(ve||_.trim())&&(!z||N.length)&&(E||R.length)&&(Se||Number.isInteger(pe)&&pe>=500&&pe<=2e4)),ue=!!(T&&de&&(!le||he.valid)&&!st&&at),Re=f===1&&!(ve!=null&&ve.setupComplete),Ae=Re?be:be&&ue,Je=!!(ve||S.trim()&&_.trim()),ot=ke.error??lt.error??_t.error??ct.error??Ye.error??kt.error??(je.data?void 0:je.error)??s.error,Tt=/^cli_[\w-]+$/.test(S.trim())?`https://open.larkoffice.com/app/${encodeURIComponent(S.trim())}/auth`:void 0,Lt=!!(ot&&/权限|permission|通讯录|邮箱|open[_ ]?id|资源点|visible range/i.test(ot.message)),xe=()=>{const se=!!(ve&&!ve.setupComplete),mt=!ve&&u===""&&!!(S.trim()||_.trim()||x.trim());if(se||mt){l(se?"incomplete":"discard");return}t()};return d.jsxs(d.Fragment,{children:[n&&d.jsx(Ame,{onClose:()=>{r(!1),i.invalidateQueries({queryKey:["lark-config"]})},onComplete:se=>{i.setQueryData(["lark-config"],se.config),h(se.appId),p(1),r(!1)}}),d.jsx("div",{inert:n,"aria-hidden":n||void 0,className:"ui-overlay fixed inset-0 z-30 grid place-items-center bg-zinc-950/25 p-4",onMouseDown:se=>{se.currentTarget===se.target&&xe()},children:d.jsxs("form",{onSubmit:se=>{se.preventDefault(),Ae&&(Re?p(2):lt.mutate())},className:"ui-dialog flex max-h-[calc(100dvh-2rem)] w-full max-w-[640px] flex-col overflow-hidden rounded-[14px] border border-zinc-200 bg-white shadow-[0_20px_64px_rgba(24,24,27,.18)]",children:[d.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-y-2 border-b border-zinc-100 px-4 py-3",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("h2",{className:"text-[16px] font-semibold text-zinc-900",children:"飞书机器人"}),d.jsx("p",{className:"mt-0.5 truncate text-[12px] text-zinc-500",children:"每个机器人拥有独立工作区和会话"})]}),d.jsxs("div",{className:"col-span-2 row-start-2 flex min-w-0 flex-wrap items-center justify-end gap-0.5",children:[d.jsxs("a",{href:"https://open.larkoffice.com/app",target:"_blank",rel:"noreferrer",className:"flex h-8 items-center gap-1.5 whitespace-nowrap rounded-lg px-2.5 text-[12px] font-medium text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400/50",children:["飞书开发者后台",d.jsx(rl,{size:12})]}),d.jsxs("a",{href:"https://open.larkoffice.com/page/launcher?from=backend_oneclick",target:"_blank",rel:"noreferrer",className:"flex h-8 items-center gap-1.5 whitespace-nowrap rounded-lg px-2.5 text-[12px] font-medium text-zinc-600 transition-colors hover:bg-zinc-100 hover:text-zinc-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400/50",children:["快速创建机器人",d.jsx(rl,{size:12})]}),d.jsxs("button",{type:"button",onClick:()=>r(!0),disabled:!s.data||lt.isPending,className:"flex h-8 items-center gap-1.5 whitespace-nowrap rounded-lg px-2.5 text-[12px] font-medium text-zinc-700 transition-colors hover:bg-zinc-100 disabled:opacity-40",children:["扫码创建机器人",d.jsx(oa,{size:12})]})]}),d.jsx("span",{className:"col-start-2 row-start-1 ml-1",children:d.jsx(Ro,{label:"关闭",onClick:xe,children:d.jsx(Yn,{size:15})})})]}),d.jsxs("div",{className:"flex shrink-0 gap-1 overflow-x-auto border-b border-zinc-100 bg-zinc-50/70 px-3 py-2",children:[(jn=s.data)==null?void 0:jn.bots.map(se=>d.jsxs("button",{type:"button",onClick:()=>{h(se.appId),p(se.setupComplete?1:2)},className:`flex h-8 max-w-[250px] shrink-0 items-center gap-1.5 rounded-lg px-2.5 text-[12px] font-medium transition-colors ${u===se.appId?"bg-white text-zinc-900 shadow-sm ring-1 ring-zinc-200":"text-zinc-500 hover:bg-white/70 hover:text-zinc-800"}`,children:[se.avatarUrl?d.jsx(f9,{url:se.avatarUrl,size:13,className:"h-[13px] w-[13px] shrink-0 rounded-sm object-cover"}):d.jsx(ii,{size:13,className:"shrink-0"}),d.jsx("span",{title:se.name,className:"min-w-0 max-w-32 truncate",children:se.tabLabel}),se.setupComplete?d.jsxs("span",{title:"配置完成",className:"flex shrink-0 items-center gap-0.5 rounded bg-emerald-50 px-1 py-0.5 text-[12px] font-medium text-emerald-700",children:[d.jsx(ni,{size:9}),"已配置"]}):d.jsx("span",{className:"shrink-0 rounded bg-amber-100 px-1 py-0.5 text-[12px] text-amber-700",children:"待配置"}),se.activeListening&&d.jsx("span",{title:"长连接已连接",className:"h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500"})]},se.appId)),d.jsxs("button",{type:"button",onClick:()=>{h(""),p(1)},className:`flex h-8 shrink-0 items-center gap-1 rounded-lg px-2.5 text-[12px] font-medium ${u===""?"bg-white text-zinc-900 shadow-sm ring-1 ring-zinc-200":"text-zinc-500 hover:bg-white/70 hover:text-zinc-800"}`,children:[d.jsx(oa,{size:13}),"新增机器人"]})]}),d.jsxs("div",{className:"space-y-3.5 overflow-y-auto px-4 py-4",children:[d.jsx(bl,{placeholder:d.jsx("div",{className:"min-h-[420px]",children:d.jsx(yl,{})}),children:s.isLoading?d.jsxs("div",{className:"space-y-2.5",children:[d.jsx("div",{className:"h-9 ui-skeleton rounded-md bg-zinc-100"}),d.jsx("div",{className:"h-9 ui-skeleton rounded-md bg-zinc-100"}),d.jsx("div",{className:"h-9 ui-skeleton rounded-md bg-zinc-100"})]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"mb-1 grid grid-cols-2 rounded-lg bg-zinc-100 p-1",children:[d.jsxs("button",{type:"button",onClick:()=>p(1),className:`rounded-md px-3 py-2 text-[12px] font-medium transition-colors ${f===1?"bg-white text-zinc-900 shadow-sm":"text-zinc-500"}`,children:[d.jsx("span",{className:"mr-1.5 inline-grid h-4 w-4 place-items-center rounded-full bg-zinc-900 text-[12px] text-white",children:"1"}),"飞书与白名单"]}),d.jsxs("button",{type:"button",disabled:!ve&&!be,onClick:()=>p(2),className:`rounded-md px-3 py-2 text-[12px] font-medium transition-colors disabled:opacity-40 ${f===2?"bg-white text-zinc-900 shadow-sm":"text-zinc-500"}`,children:[d.jsx("span",{className:"mr-1.5 inline-grid h-4 w-4 place-items-center rounded-full bg-zinc-900 text-[12px] text-white",children:"2"}),"Agent 与门禁"]})]}),d.jsx("p",{className:"-mt-1 text-[12px] leading-4 text-zinc-400",children:f===1?"点「下一步」继续配置 Agent,最后点「保存」才会一次性生效;指定成员和机器人的姓名在实际使用时再校验。":"Agent 配置不影响长连接;收到消息时才会校验运行配置。"}),f===1?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[d.jsxs("label",{className:"block",children:[d.jsx("span",{className:"text-[12px] font-medium text-zinc-700",children:"机器人名称"}),d.jsx(ir,{size:"large",value:g,readOnly:!0,variant:"filled",placeholder:"校验凭证后自动识别",className:"mt-1.5 font-mono text-[12px]"})]}),d.jsxs("label",{className:"block",children:[d.jsx("span",{className:"text-[12px] font-medium text-zinc-700",children:"App ID"}),d.jsx(ir,{size:"large",value:S,onChange:se=>{C(se.target.value),v("")},placeholder:"cli_xxx",autoComplete:"off",className:"mt-1.5 font-mono text-[12px]"})]})]}),d.jsxs("label",{className:"block",children:[d.jsxs("span",{className:"flex items-center text-[12px] font-medium text-zinc-700",children:["App Secret",ve&&d.jsx("span",{className:"ml-2 font-normal text-zinc-400",children:"留空不修改"})]}),d.jsx(ir.Password,{size:"large",value:_,onChange:se=>k(se.target.value),visibilityToggle:{visible:Ee,onVisibleChange:Ie},iconRender:se=>se?d.jsx(xX,{size:13}):d.jsx(Jg,{size:13}),placeholder:ve?"已保存":"输入 App Secret",autoComplete:"new-password",className:"mt-1.5 font-mono text-[12px]"})]}),d.jsxs("div",{children:[d.jsxs("span",{className:"text-[12px] font-medium text-zinc-700",children:["工作区 ",d.jsx("span",{className:"font-normal text-zinc-400",children:"可选"})]}),d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("div",{className:"min-w-0 flex-1",children:d.jsx(tj,{value:x,onChange:b,label:"工作区",placeholder:"留空使用默认工作目录",suggestion:Ue,suggestionLabel:"使用默认工作目录"})}),d.jsxs("button",{type:"button",disabled:!((et=o.data)!=null&&et.directoryPicker)||ct.isPending,onClick:()=>ct.mutate(),className:"mt-1.5 flex h-9 shrink-0 items-center gap-1.5 rounded-md border border-zinc-300 bg-white px-3 text-[12px] font-medium text-zinc-700 hover:bg-zinc-50 disabled:cursor-not-allowed disabled:opacity-40",children:[d.jsx(fa,{size:13}),(ft=o.data)!=null&&ft.directoryPicker?"选择":"仅支持 Mac"]})]}),d.jsx("p",{className:"mt-1 text-[12px] leading-4 text-zinc-400",children:"留空时使用所选 Agent 的默认工作目录;路径位于 AgentDock 服务所在机器。"})]}),d.jsxs("div",{className:"block",children:[d.jsxs("span",{className:"text-[12px] font-medium text-zinc-700",children:["Web 访问地址 ",d.jsx("span",{className:"font-normal text-zinc-400",children:"可选"})]}),d.jsx(c1e,{value:y,onChange:w}),d.jsx("p",{className:"mt-1 text-[12px] leading-4 text-zinc-400",children:"配置后,飞书卡片底部会显示“查看详情”链接,指向该域名下的会话 Trace 页面。"})]}),!ve&&d.jsxs("button",{type:"button",disabled:!S.trim()||!_.trim()||Ye.isPending,onClick:()=>Ye.mutate(),className:"flex h-9 w-full items-center justify-center gap-2 rounded-md border border-zinc-300 bg-white text-[12px] font-medium text-zinc-700 hover:bg-zinc-50 disabled:opacity-40",children:[Ye.isPending?d.jsx(Wn,{size:12,className:"animate-spin"}):d.jsx(ii,{size:12}),"校验凭证并识别机器人名称"]}),d.jsxs("div",{className:"overflow-hidden rounded-xl border border-zinc-200 bg-white",children:[d.jsx(Wi,{title:"可使用机器人的成员",description:"输入飞书真实姓名;收到消息时再解析为稳定的 open_id,不读取邮箱。",children:d.jsx(n4,{value:z?"restricted":"all",onChange:se=>j(se==="restricted"),options:[{value:"all",label:"所有人"},{value:"restricted",label:"指定成员"}]})}),z&&d.jsxs("div",{className:"border-t border-zinc-100 px-4 pb-3.5 pt-3",children:[!!(ve!=null&&ve.allowedEmails.length&&!ve.allowedUsers.length)&&d.jsx("div",{className:"mb-2 border-l-2 border-amber-400 bg-amber-50 px-2.5 py-2 text-[12px] leading-5 text-amber-800",children:"检测到旧邮箱白名单。请重新填写真实姓名;保存后改用姓名白名单,使用时解析 open_id,停止查询通讯录。"}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[12px] font-medium text-zinc-500",children:"成员真实姓名"}),d.jsx(h_,{value:N,onChange:$,placeholder:"输入姓名后按 Enter"}),d.jsx("p",{className:"mt-1 text-[12px] leading-5 text-zinc-400",children:"支持 Enter、逗号或粘贴多行生成标签。保存时不查询群成员;使用时精确匹配,找不到或重名时拒绝访问。"})]})]})]}),d.jsxs("div",{className:"overflow-hidden rounded-xl border border-zinc-200 bg-white",children:[d.jsx(Wi,{title:"可调用机器人的其他机器人",description:"输入机器人名称;收到调用时再在群成员中解析 open_id。",children:d.jsx(n4,{value:E?"all":"restricted",onChange:se=>M(se==="all"),options:[{value:"all",label:"所有机器人"},{value:"restricted",label:"指定机器人"}]})}),!E&&d.jsx("div",{className:"border-t border-zinc-100 px-4 pb-3.5 pt-3",children:d.jsxs("div",{children:[d.jsx("div",{className:"text-[12px] font-medium text-zinc-500",children:"机器人名称"}),d.jsx(h_,{value:R,onChange:P,placeholder:"输入机器人名称后按 Enter"})]})})]}),d.jsxs("div",{className:"overflow-hidden rounded-xl border border-zinc-200 bg-white",children:[d.jsxs("div",{className:"px-4 py-3",children:[d.jsx("div",{className:"text-[14px] font-medium text-zinc-900",children:"Trace 卡片"}),d.jsx("div",{className:"mt-0.5 text-[12px] leading-5 text-zinc-500",children:"控制任务过程中推送的 trace 卡片如何渲染与刷新。"})]}),d.jsx(Wi,{title:"静默回复(不显示 trace 卡片)",description:"不发送 trace 卡片,任务结束时由服务自动把最终回复以文本发送到会话;Agent 会被提示如何在本模式下 @ 他人。",children:d.jsx(Xi,{size:"small",checked:Se,onChange:()=>Te(se=>!se)})}),!Se&&d.jsxs(d.Fragment,{children:[d.jsx(Wi,{title:"飞书推送间隔",description:"500-20000 ms;心跳消息的最短间隔。",children:d.jsx(Jx,{size:"middle",min:500,max:2e4,step:100,value:pe,onChange:se=>De(se??1e3),suffix:"ms",className:"!w-40 font-mono"})}),d.jsx(Wi,{title:"Trace 阶段上限",description:`默认 ${Vw};心跳渲染时最多保留最近 N 个执行阶段,超过飞书 24KB / 180 组件限制时仍会自动裁剪较早记录。`,children:d.jsx(Jx,{size:"middle",min:1,max:200,step:1,precision:0,value:ee===""?null:Number(ee),onChange:se=>fe(se==null?"":String(se)),className:"!w-40 font-mono"})})]})]}),d.jsx("div",{className:"overflow-hidden rounded-xl border border-zinc-200 bg-white",children:d.jsx(Wi,{className:(q=s.data)!=null&&q.listeningDisabled||!Je?"opacity-50":"",title:"监听飞书消息",description:(Ce=s.data)!=null&&Ce.listeningDisabled?"本次启动已通过 --no-lark-listen 禁用,保存值不受影响":Je?ve!=null&&ve.activeListening?"长连接已连接":ve!=null&&ve.setupComplete?"使用长连接接收机器人消息":"可先监听;收到消息时再校验 Agent 运行配置":"请先填写飞书凭证",children:d.jsx(Xi,{size:"small",checked:Pe&&!((He=s.data)!=null&&He.listeningDisabled),disabled:((Ct=s.data)==null?void 0:Ct.listeningDisabled)||!Je,onChange:()=>$e(se=>!se)})})})]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"overflow-hidden rounded-xl border border-zinc-200 bg-white",children:[d.jsx(Wi,{title:"默认 Agent",description:Oe?"硬门禁已开启,保存关闭后解锁。":"飞书会话默认使用的 Agent。",children:d.jsx("div",{className:"w-64",children:d.jsx(MFe,{size:"sm",popupWidth:360,agents:e,value:T,disabled:Oe,onChange:se=>{D(se),H(""),B(""),ge(!1),re(!1)}})})}),d.jsx(Wi,{title:"默认模型",description:!je.isFetching&&!((pt=je.data)!=null&&pt.models.length)?"暂未取得可选模型,保留当前配置;可尝试重新读取。":"由 Agent 提供,可覆盖 Agent 默认模型。",children:d.jsx("div",{className:"w-64",children:d.jsx(da,{size:"sm",popupWidth:380,options:[{value:"",label:(tn=je.data)!=null&&tn.defaultModel?`Agent 默认 (${je.data.defaultModel})`:"使用 Agent 默认模型"},...vb(((Ut=je.data)==null?void 0:Ut.models)??[],A).map(se=>({value:se.id,label:se.name,meta:se.name===se.id?void 0:se.id}))],value:A,placeholder:"选择默认模型",disabled:!((Xt=je.data)!=null&&Xt.models.length),disabledText:"",onChange:se=>{H(se),B("")}})})}),d.jsx(Wi,{title:"推理强度",description:!je.isFetching&&!((zn=je.data)!=null&&zn.reasoningEfforts.length)?"该 Agent / 模型暂未提供可选强度,保留当前配置。":"由 Agent / 模型提供。",children:d.jsx("div",{className:"w-64",children:d.jsx(da,{size:"sm",popupWidth:300,options:[{value:"",label:(ln=je.data)!=null&&ln.defaultReasoningEffort?`Agent 默认 (${je.data.defaultReasoningEffort})`:"使用 Agent 默认强度"},...vb(((mn=je.data)==null?void 0:mn.reasoningEfforts)??[],Xe).map(se=>({value:se.id,label:se.name}))],value:Xe,placeholder:"选择推理强度",disabled:!((hr=je.data)!=null&&hr.reasoningEfforts.length),disabledText:"",onChange:B})})}),d.jsxs("div",{className:"flex items-center justify-between gap-2 border-t border-zinc-100 px-4 py-2 text-[12px] text-zinc-400",children:[d.jsx("span",{children:je.isFetching||ke.isPending?"正在读取 Agent 配置…":"模型与推理强度由 Agent 提供"}),d.jsxs("button",{type:"button",disabled:!T||je.isFetching||ke.isPending,onClick:()=>ke.mutate({agentId:T,model:A||void 0}),className:"flex h-7 items-center gap-1 rounded px-1.5 text-[12px] text-zinc-500 hover:bg-zinc-100 disabled:opacity-40",children:[d.jsx(Wn,{size:12}),"重新读取"]})]}),(((fr=je.data)==null?void 0:fr.warning)||je.isError||ke.isError)&&d.jsx("p",{role:"status",className:"mx-4 mb-3 border-l-2 border-amber-300 bg-amber-50 px-2 py-1.5 text-[12px] leading-5 text-amber-800",children:((hn=je.data)==null?void 0:hn.warning)??"Agent 配置请求失败,请检查服务连接后重新读取。"})]}),d.jsxs("div",{children:[d.jsxs("span",{className:"text-[12px] font-medium text-zinc-700",children:["预注入 Prompt ",d.jsx("span",{className:"font-normal text-zinc-400",children:"可选,Markdown"})]}),d.jsx(m.Suspense,{fallback:d.jsx("div",{className:"mt-1.5 rounded-md border border-zinc-200 bg-zinc-50 p-3 text-[12px] text-zinc-400",children:"正在加载编辑器…"}),children:d.jsx(kFe,{value:L,onChange:O,aiContext:ht})}),d.jsx("p",{className:"mt-1 text-[12px] leading-5 text-zinc-400",children:"每轮飞书对话都会在用户请求前隐式注入,不会在 Agent 聊天记录中重复显示为用户消息。"})]}),d.jsxs("div",{className:"overflow-hidden rounded-xl border border-zinc-200 bg-white",children:[d.jsx(Wi,{title:"启用 Agent 群协作工具",description:"允许 Agent 在当前飞书群发现其他已配置 Agent,并读取增量消息。",children:d.jsx(Xi,{size:"small",checked:W,onChange:()=>F(se=>!se)})}),W&&d.jsx(Wi,{title:"允许 Agent 发消息与 @交接",description:"关闭后仅保留 self、peers、messages 和 wait 只读能力。",children:d.jsx(Xi,{size:"small",checked:U,onChange:()=>X(se=>!se)})}),W&&d.jsx(Wi,{title:"群聊主流消息的会话隔离",description:"话题内消息始终按话题隔离;此处仅影响群主流(非话题)消息。",children:d.jsx(zFe,{value:Q,onChange:se=>ae(se),options:[{value:"user",label:"按发送人隔离"},{value:"chat",label:"全群共享"}]})}),d.jsxs("div",{className:"flex items-start gap-1.5 border-t border-zinc-100 px-4 py-3 text-[12px] leading-5 text-zinc-500",children:[d.jsx(kX,{size:14,className:"mt-0.5 shrink-0"}),d.jsx("span",{children:"缺少群成员、消息或发消息权限时,Agent 会停止对应操作并给出管理员授权链接;不会索要 App Secret。"})]})]}),d.jsx("div",{className:"overflow-hidden rounded-xl border border-zinc-200 bg-white",children:d.jsx(Wi,{title:"启用高危操作门禁",description:"启用后强制开启软门禁,并可继续配置 Hook 硬门禁。",children:d.jsx(Xi,{size:"small",checked:le,onChange:()=>{const se=!le;me(se),se||ge(!1)}})})}),le&&d.jsxs("div",{className:"rounded-xl border border-zinc-200 bg-zinc-50/70 p-3",children:[d.jsx("div",{className:"px-1 text-[14px] font-medium text-zinc-900",children:"高危操作门禁"}),d.jsx("p",{className:"mt-1 px-1 text-[12px] leading-5 text-zinc-500",children:"不在允许名单内的发送人会收到软门禁 Prompt;开启硬门禁后,再通过 ACP 权限层和 Agent 原生工具调用 Hook 拦截。"}),d.jsxs("div",{className:"mt-3",children:[d.jsxs("div",{className:"text-[12px] font-medium text-zinc-700",children:["允许执行高危操作的成员 ",d.jsx("span",{className:"font-normal text-zinc-400",children:"留空则继承普通成员名单"})]}),d.jsx("p",{className:"mt-0.5 text-[12px] leading-5 text-zinc-500",children:"输入真实姓名,保存时解析为 open_id。"}),st&&d.jsx("div",{className:"mt-2 border-l-2 border-amber-400 bg-amber-50 px-2.5 py-2 text-[12px] leading-5 text-amber-800",children:"检测到旧高危邮箱名单。请重新选择成员后再保存,避免意外扩大高危权限。"}),d.jsx(h_,{value:ne,onChange:ie,placeholder:"输入姓名后按 Enter"})]}),d.jsxs("label",{className:"mt-3 block",children:[d.jsx("span",{className:"text-[12px] font-medium text-zinc-700",children:"高危操作正则表达式"}),d.jsx(ir.TextArea,{value:oe,onChange:se=>G(se.target.value),autoSize:{minRows:4,maxRows:10},status:he.valid?void 0:"error",className:"mt-1.5 font-mono text-[12px] leading-5"}),!he.valid&&d.jsxs("p",{className:"mt-1.5 flex items-start gap-1 text-[12px] leading-5 text-red-600",children:[d.jsx(fl,{size:12,className:"mt-0.5 shrink-0"}),he.error]})]}),d.jsxs("div",{className:"mt-3 overflow-hidden rounded-lg border border-zinc-200 bg-white",children:[d.jsx(Wi,{title:"软门禁",description:"门禁启用后固定开启,隐式注入禁止绕过的安全 Prompt。",children:d.jsx(Xi,{size:"small",checked:!0,disabled:!0})}),d.jsx(Wi,{className:!((Zn=_e.data)!=null&&Zn.installed)&&!Y?"opacity-60":"",title:"硬门禁",description:(jr=_e.data)!=null&&jr.installed?"Hook 已配置,可以开启硬门禁。":ce?((zr=_e.data)==null?void 0:zr.reason)??"请先检测并配置 Hook。":"点击下方按钮会先保存当前默认 Agent,再检测并配置 Hook。",children:d.jsx(Xi,{size:"small",checked:Y,disabled:!vt,onChange:()=>ge(se=>!se)})})]}),$t&&d.jsx("div",{className:"mt-2 rounded-md border border-amber-200 bg-amber-50 px-2.5 py-2 text-[12px] leading-5 text-amber-800",children:"已保存的硬门禁 Hook 当前未检测到。其他设置仍可保存;如需恢复硬门禁,请先关闭上方开关,再重新检测并配置 Hook。"}),d.jsxs("button",{type:"button",disabled:!ve||Y||kt.isPending||st||!x.trim()||!he.valid||((Yr=_e.data)==null?void 0:Yr.supported)===!1,onClick:()=>kt.mutate(),className:"mt-3 flex h-9 w-full items-center justify-center gap-2 rounded-md border border-zinc-300 bg-white text-[12px] font-medium text-zinc-700 hover:bg-zinc-50 disabled:cursor-not-allowed disabled:opacity-40",children:[d.jsx(wN,{size:13}),kt.isPending?"正在检测并配置 Hook":(fi=_e.data)!=null&&fi.installed?"重新检测并配置 Hook":"检测并配置 Hook"]}),((Ft=_e.data)==null?void 0:Ft.supported)===!1&&d.jsx("div",{className:"mt-2 rounded-md border border-amber-200 bg-amber-50 px-2.5 py-2 text-[12px] leading-5 text-amber-800",children:_e.data.reason}),((Rt=_e.data)==null?void 0:Rt.trustInstructions)&&d.jsx("div",{className:"mt-2 rounded-md border border-zinc-200 bg-white px-3 py-2 text-[12px] leading-5 text-zinc-500",children:_e.data.trustInstructions})]})]})]})}),ot&&d.jsxs("div",{className:"rounded-md border border-red-100 bg-red-50 px-2.5 py-2 text-[12px] leading-4 text-red-700",children:[d.jsx("div",{children:ot.message}),Lt&&Tt&&d.jsxs("a",{href:Tt,target:"_blank",rel:"noreferrer",className:"mt-2 inline-flex items-center gap-1 font-medium text-red-800 underline decoration-red-300 underline-offset-2 hover:text-red-950",children:["打开当前机器人的权限配置",d.jsx(rl,{size:11})]})]})]}),d.jsxs("div",{className:"flex items-center border-t border-zinc-100 px-4 py-3",children:[ve?d.jsxs("button",{type:"button",onClick:()=>{_t.reset(),l("delete")},className:"flex items-center gap-1.5 rounded-md px-2 py-1.5 text-[12px] font-medium text-red-600 hover:bg-red-50",children:[d.jsx(Of,{size:13}),"删除配置"]}):d.jsx("span",{className:"text-[12px] text-zinc-400",children:"App ID 将作为唯一主键,不能重复配置"}),f===2&&d.jsx("button",{type:"button",onClick:()=>p(1),className:"ml-auto rounded-md px-3 py-1.5 text-xs font-medium text-zinc-600 hover:bg-zinc-100",children:"上一步"}),d.jsx("button",{type:"button",onClick:xe,className:`${f===2?"":"ml-auto"} rounded-md px-3 py-1.5 text-xs font-medium text-zinc-600 hover:bg-zinc-100`,children:f===2&&ve&&!ve.setupComplete?"稍后完成":"取消"}),d.jsx("button",{type:"submit",disabled:!Ae||lt.isPending,className:"ml-1 min-w-20 rounded-md bg-zinc-900 px-3 py-1.5 text-xs font-medium text-white hover:bg-zinc-700 active:scale-[.98] disabled:cursor-not-allowed disabled:opacity-35",children:lt.isPending?"保存中":yt?"读取模型中":Re?"下一步":"保存"})]})]})}),d.jsx(Rs,{open:!!a,tone:a==="delete"?"danger":"warning",title:a==="delete"?"删除机器人配置?":a==="incomplete"?"稍后再完成配置?":"放弃未保存的配置?",description:a==="delete"?`将删除“${(ve==null?void 0:ve.name)??"当前机器人"}”的凭证、监听和门禁配置。已有会话记录不会删除。`:a==="incomplete"?"Agent 配置尚未完成。若已开启监听,机器人仍会接收消息,并提示发送人补充运行配置。":"当前填写的机器人信息尚未保存,关闭后需要重新填写。",confirmLabel:a==="delete"?"确认删除":a==="incomplete"?"稍后完成":"放弃修改",busy:a==="delete"&&_t.isPending,error:a==="delete"&&_t.error?_t.error.message:void 0,onCancel:()=>{_t.isPending||l(void 0)},onConfirm:()=>{a==="delete"?_t.mutate():(l(void 0),t())}})]})}function $Fe({onClose:e}){return d.jsx("div",{className:"ui-overlay fixed inset-0 z-[60] grid place-items-center bg-zinc-950/30 p-2 sm:p-4",onMouseDown:t=>{t.currentTarget===t.target&&e()},children:d.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"AI 飞书替身",className:"ui-dialog flex h-[min(860px,calc(100dvh-2rem))] w-full max-w-[1120px] flex-col overflow-hidden rounded-[14px] border border-zinc-200 bg-white shadow-xl",children:[d.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-100 px-4 py-3",children:[d.jsx("h2",{className:"text-[16px] font-semibold text-zinc-900",children:"AI 飞书替身"}),d.jsx("button",{type:"button","aria-label":"关闭 AI 飞书替身",onClick:e,className:"grid h-8 w-8 place-items-center rounded-lg text-zinc-500 hover:bg-zinc-100",children:d.jsx(Yn,{size:15})})]}),d.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:d.jsx(l1e,{})})]})})}function RFe({session:e,size:t=12}){return Qa.has(e.state)&&e.state!=="waiting_for_permission"?d.jsx(Ci,{size:t,"aria-label":sg[e.state],className:`shrink-0 animate-spin ${VSe[e.state]??"text-zinc-400"}`}):d.jsx("span",{"aria-label":sg[e.state],className:`h-1.5 w-1.5 shrink-0 rounded-full ${dj[e.state]??"bg-zinc-400"}`})}function OFe({session:e,agent:t,botName:n,parentLabel:r,active:i,drag:s,noteOf:o,renameRequest:a,onClick:l,onOpenContextMenu:c}){const u=sj(e),h=!!nj(e),f=(t==null?void 0:t.name)??e.agentId,p=ra(e,t==null?void 0:t.name),g=d.jsx(fLe,{session:e,agentName:f,botName:n,parentLabel:r,now:new Date}),x=Qa.has(e.state)||e.state==="failed"?d.jsx(RFe,{session:e,size:12}):d.jsx("span",{className:"text-[12px] tabular-nums text-zinc-400 max-md:hidden",children:lwe(ig(e))}),b=m.useRef(null),y=m.useRef({}),w=m.useRef(!1),S=m.useRef(0),C=()=>{y.current.timer&&clearTimeout(y.current.timer),y.current={}};m.useEffect(()=>()=>C(),[]);const _=j=>{b.current&&c(j,b.current)},k=()=>{w.current&&(S.current=Date.now()+900),w.current=!1,C()},z=d.jsxs("div",{ref:b,onClick:()=>{wLe(S.current,Date.now())&&l()},onContextMenu:j=>{j.preventDefault(),_({x:j.clientX,y:j.clientY})},onPointerDown:j=>{if(j.pointerType==="mouse")return;C(),w.current=!1;const N={x:j.clientX,y:j.clientY};y.current.start=N,y.current.timer=setTimeout(()=>{y.current={},w.current=!0,_(N)},480)},onPointerMove:j=>{const N=y.current.start;N&&Math.hypot(j.clientX-N.x,j.clientY-N.y)>8&&C()},onPointerUp:k,onPointerCancel:k,role:"button",tabIndex:0,onKeyDown:j=>{if(yLe(j)){j.preventDefault();const N=j.currentTarget.getBoundingClientRect();_({x:N.left+16,y:N.top+N.height});return}(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),l())},...(s==null?void 0:s.props)??{},className:`group relative flex h-[34px] w-full cursor-pointer items-center gap-2 rounded-lg px-2 text-left transition-colors ${i?"bg-zinc-100 text-zinc-900":"text-zinc-700 hover:bg-zinc-100/60"} ${s!=null&&s.dragging?"opacity-40":""} ${s!=null&&s.over?"ring-1 ring-zinc-300":""}`,children:[u?d.jsx(dl,{size:12,"aria-label":"定时任务会话",className:"shrink-0 text-zinc-400"}):o?d.jsx(ry,{size:12,"aria-label":`${o}派出的便签`,className:"shrink-0 text-amber-600/80"}):h?d.jsx(ey,{size:12,"aria-label":"侧边会话",className:"shrink-0 text-zinc-400"}):null,d.jsx(iwe,{session:e,label:p,nameClassName:"min-w-0 flex-1 truncate text-[14px]",editRequest:a}),d.jsx("span",{className:"flex shrink-0 items-center justify-end",children:x})]});return d.jsx(on,{content:g,side:"right",align:"start",hoverOnly:!0,children:z})}function PFe(){var wt,Wt,an,Bn,qt,jn,et,ft;const e=Fn(),{primarySessionId:t,setSession:n,openTab:r,closeTab:i,activateTab:s,renameTab:o,restoreFromUrl:a,togglePane:l}=Xa(),c=Xa(q=>q.tabs),u=m.useMemo(()=>c.filter(q=>q.ownerSessionId===t),[c,t]),h=Xa(q=>q.paneOpen),f=Xa(q=>q.activeTabId),p=u.find(q=>q.id===f),[g,v]=m.useState();kr("agentdock:web-access-denied",q=>{v(q.detail),e.cancelQueries({predicate:fwe})},{target:()=>window});const[x,b]=m.useState(!1),[y,w]=m.useState(new Set),[S,C]=m.useState(new Set),[_,k]=m.useState("all"),z=twe(),j=It({queryKey:["agents"],queryFn:()=>Ne.agents(),enabled:!g}),N=It({queryKey:["sessions"],queryFn:Ne.sessions,enabled:!g,refetchInterval:g?!1:2e3,refetchIntervalInBackground:!0}),$=It({queryKey:["lark-config"],queryFn:Ne.larkConfig,enabled:!g,refetchInterval:g?!1:5e3});It({queryKey:["system-capabilities"],queryFn:Ne.systemCapabilities,enabled:!g});const R=lj(!g),P=()=>{const q=window.location.pathname.match(/^\/sessions\/([^/]+)$/),Ce=q!=null&&q[1]?decodeURIComponent(q[1]):void 0,He=J1e(window.location.search,Ce);if(!He||!Ce){a(Ce);return}if(He.kind==="session"){He.sessionId&&a(Ce,LP(Ce,He.sessionId,He.sessionId));return}a(Ce,{id:`${He.kind}:${Ce}`,kind:He.kind,anchorSessionId:Ce,title:He.kind==="terminal"?"终端":He.kind==="files"?"文件":"原始日志"})};Xb(P),kr("popstate",P),Wu(()=>{window.history.replaceState(null,"",R7(t,h?p:void 0))},[t,f,u,h]);const E=m.useMemo(()=>[...N.data??[]].sort((q,Ce)=>ig(Ce).localeCompare(ig(q))),[N.data]),M=m.useMemo(()=>E.filter(q=>{var Ce,He;return q.id!==((Ce=R.data)==null?void 0:Ce.mainSessionId)&&!q.archivedAt&&(_==="all"||_==="local"?_==="all"||q.source!=="lark":q.source==="lark"&&((He=q.sourceId)==null?void 0:He.startsWith(`${_}:`)))}),[E,_,(wt=R.data)==null?void 0:wt.mainSessionId]),T=m.useMemo(()=>E.filter(q=>q.archivedAt),[E]),D=m.useMemo(()=>swe(M,j.data??[]),[M,j.data]),A=((Wt=R.data)==null?void 0:Wt.mainSessionId)??void 0,[H,I]=hh("agentdock:sidebar-item-order",{defaultValue:BP}),B=m.useMemo(()=>vv(H),[H]),L=m.useMemo(()=>Gw(D,B.workspaces,q=>q.cwd).map(q=>({...q,agents:Gw(q.agents,B.agents[q.cwd],Ce=>Ce.agentId).map(Ce=>({...Ce,sessions:Gw(Ce.sessions,B.sessions[`${q.cwd}\0${Ce.agentId}`],He=>He.id)}))})),[D,B]),O=m.useMemo(()=>!cwe(D,L),[D,L]),[W,F]=hh("agentdock:sidebar-grouping",{defaultValue:"time"}),U=W==="project"?"project":"time",X=m.useRef(null),Q=Cn(()=>{Mt.getState().setHomeTarget("new"),n(void 0),$e(!1),b(!1),ke(void 0),requestAnimationFrame(()=>{var q;return(q=X.current)==null?void 0:q.focus()})}),ae=Cn(()=>{b(!1),_r("search")});kr("keydown",q=>{(q.metaKey||q.ctrlKey)&&q.key.toLowerCase()==="k"&&(q.preventDefault(),ae())});const ne=q=>w(Ce=>{const He=new Set(Ce);return He.has(q)?He.delete(q):He.add(q),He}),ie=q=>C(Ce=>{const He=new Set(Ce);return He.has(q)?He.delete(q):He.add(q),He}),oe=m.useRef(!1);Wu(()=>{oe.current||!D.length||(oe.current=!0,w(new Set(D.slice(1).map(q=>q.cwd))))},[D]);const G=E.find(q=>q.id===t);dwe(G?ra(G,(Bn=(an=j.data)==null?void 0:an.find(q=>q.id===G.agentId))==null?void 0:Bn.name):void 0);const le=q=>{n(q),b(!1),ke(void 0)},me=q=>{var He,Ct;if(!t||q===t)return;const Ce=E.find(pt=>pt.id===q);Ce&&r(LP(t,q,ra(Ce,(Ct=(He=j.data)==null?void 0:He.find(pt=>pt.id===Ce.agentId))==null?void 0:Ct.name)),t)};Wu(()=>{var q,Ce;for(const He of c){if(He.kind!=="session"&&He.kind!=="side-chat")continue;const Ct=E.find(pt=>pt.id===He.sessionId);Ct&&o(He.id,ra(Ct,(Ce=(q=j.data)==null?void 0:q.find(pt=>pt.id===Ct.agentId))==null?void 0:Ce.name))}},[c,E,j.data]);const Y=Cn(q=>{t&&r({id:`raw:${q}`,kind:"raw",anchorSessionId:q,title:q===t?"原始日志":"侧边日志"},t)}),ge=Cn(q=>{if(ke(void 0),!!t){if(q==="raw"){const Ce=u.find(He=>He.id===f);Y((Ce==null?void 0:Ce.sessionId)??(Ce==null?void 0:Ce.anchorSessionId)??t);return}if(q==="terminal"||q==="files"){r({id:`${q}:${t}`,kind:q,anchorSessionId:t,title:q==="terminal"?"终端":"文件"});return}G&&ye.mutate(G)}}),ye=bt({mutationFn:async q=>Ne.create({agentId:q.agentId,cwd:q.cwd,systemPrompt:S1e(q.id),source:y7,sourceId:q.id}),onSuccess:(q,Ce)=>{e.invalidateQueries({queryKey:["sessions"]}),r({id:`side-chat:${q.id}`,kind:"side-chat",sessionId:q.id,title:"侧边聊天"},Ce.id)},onError:q=>at(q instanceof Error?q.message:String(q))}),re=[{key:"t",label:Uw("t"),description:"终端",run:()=>ge("terminal")},{key:"s",shift:!0,label:Uw("s",!0),description:"侧边聊天",run:()=>ge("side-chat")},{key:"p",label:Uw("p"),description:"文件",run:()=>ge("files")}];w1e(re);const[Ee,Ie]=hh("agentdock:sidebar-width",{defaultValue:268}),[Pe,$e]=hh("agentdock:sidebar-collapsed",{defaultValue:!1}),[pe,De]=m.useState(),[ee,fe]=m.useState(),[Se,Te]=m.useState(!1),ve=m.useRef({x:0,width:268}),Ue=Math.min(480,Math.max(200,Ee??268));kr("pointermove",q=>{if(!Se)return;const Ce=Math.min(560,Math.max(140,ve.current.width+(q.clientX-ve.current.x)));Ie(Ce)},{target:()=>document,enable:Se}),kr("pointerup",()=>{Se&&(Te(!1),(Ee??268)<180&&$e(!0))},{target:()=>document,enable:Se});const[ce,Oe]=m.useState(null),[he,_e]=m.useState(),[je,ke]=m.useState(),[Le,at]=m.useState(),[vt,$t]=m.useState({status:"closed"}),[st,Xe]=m.useState(),[ht,Ye]=m.useState(),lt=Ea(1800),kt=m.useMemo(()=>ELe({archive:async q=>{const Ce=await Ne.archive(q);return e.setQueryData(["sessions"],He=>He==null?void 0:He.map(Ct=>Ct.id===Ce.id?Ce:Ct)),Ce},onChange:$t}),[e]),_t=bt({mutationFn:({agentId:q,cwd:Ce})=>Ne.create({agentId:q,cwd:Ce}),onMutate:q=>_e(q),onSuccess:q=>{e.invalidateQueries({queryKey:["sessions"]}),_e(void 0),Oe(null),le(q.id)},onError:()=>_e(void 0)}),ct=Cn(()=>{Mt.getState().requestAdoption(),n(void 0),b(!1),ke(void 0)}),yt=Cn(q=>{const Ce=q??A;if(!Ce){ct();return}if(Mt.getState().closeDrawer(),t===Ce){b(!1);return}Iwe(()=>le(Ce))}),de=Cn((q,Ce="auto")=>{if(!q.sessionId){Mt.getState().openDrawer({highlight:q.id});return}const He=E.find(pt=>pt.id===q.sessionId);if((Ce==="pane"||Ce==="auto"&&!!t&&t===A)&&t&&He&&q.sessionId!==t){me(q.sessionId);return}le(q.sessionId)}),be=Cn(()=>{b(!1),_r("assistant")}),ue=Cn(q=>{Mt.getState().closeDrawer(),le(q)}),Re=m.useMemo(()=>({openMain:yt,openTask:de,goAdopt:ct,openSettings:be,openSession:ue}),[yt,de,ct,be,ue]),Ae=G?G.id===A?"main":"session":"home";if(g)return d.jsx(mwe,{denied:g});const Je=(q,Ce,He,Ct)=>{const pt=(pe==null?void 0:pe.scope)===q&&pe.id===Ce,tn=(ee==null?void 0:ee.scope)===q&&ee.id===Ce;return{dragging:pt,over:tn,props:{draggable:!0,onDragStart:Ut=>{De({scope:q,id:Ce,...Ct?{sessionId:Ct}:{}}),Ut.dataTransfer.effectAllowed="move"},onDragEnd:()=>{De(void 0),fe(void 0)},onDragOver:Ut=>{!pe||pe.scope!==q||pe.id===Ce||(Ut.preventDefault(),Ut.dataTransfer.dropEffect="move",fe(Xt=>(Xt==null?void 0:Xt.scope)===q&&Xt.id===Ce?Xt:{scope:q,id:Ce}))},onDragLeave:()=>fe(Ut=>(Ut==null?void 0:Ut.scope)===q&&Ut.id===Ce?void 0:Ut),onDrop:Ut=>{Ut.preventDefault(),pe&&pe.scope===q&&pe.id!==Ce&&He(pe.id,Ce),De(void 0),fe(void 0)}}}},ot=q=>({dragging:(pe==null?void 0:pe.scope)==="session-pane"&&pe.id===q,over:!1,props:{draggable:!0,onDragStart:Ce=>{De({scope:"session-pane",id:q,sessionId:q}),Ce.dataTransfer.effectAllowed="copy"},onDragEnd:()=>{De(void 0),fe(void 0)}}}),Tt=(q,Ce)=>I(He=>{const Ct=L.map(pt=>pt.cwd);return{...vv(He),workspaces:Kw(Ct,q,Ce)}}),Lt=(q,Ce,He)=>I(Ct=>{var Ut;const pt=(((Ut=L.find(Xt=>Xt.cwd===q))==null?void 0:Ut.agents)??[]).map(Xt=>Xt.agentId),tn=vv(Ct);return{...tn,agents:{...tn.agents,[q]:Kw(pt,Ce,He)}}}),xe=(q,Ce,He)=>I(Ct=>{var zn,ln;const[pt,tn]=q.split("\0"),Ut=(((ln=(zn=L.find(mn=>mn.cwd===pt))==null?void 0:zn.agents.find(mn=>mn.agentId===tn))==null?void 0:ln.sessions)??[]).map(mn=>mn.id),Xt=vv(Ct);return{...Xt,sessions:{...Xt.sessions,[q]:Kw(Ut,Ce,He)}}}),ut=(q,Ce)=>{var pt,tn,Ut,Xt,zn,ln,mn,hr,fr;const He=q.sourceId?E.find(hn=>hn.id===q.sourceId):void 0,Ct=A&&vSe(q.sourceId,A,(tn=(pt=R.data)==null?void 0:pt.lifecycle)==null?void 0:tn.ancestorSessionIds)&&nj(q)?((Xt=(Ut=R.data)==null?void 0:Ut.companion)==null?void 0:Xt.name)??"小猫":void 0;return d.jsx(OFe,{session:q,drag:Ce,noteOf:Ct,agent:(zn=j.data)==null?void 0:zn.find(hn=>hn.id===q.agentId),botName:(mn=(ln=$.data)==null?void 0:ln.bots.find(hn=>{var Zn;return(Zn=q.sourceId)==null?void 0:Zn.startsWith(`${hn.appId}:`)}))==null?void 0:mn.name,parentLabel:He?ra(He,(fr=(hr=j.data)==null?void 0:hr.find(hn=>hn.id===He.agentId))==null?void 0:fr.name):void 0,active:t===q.id||u.some(hn=>(hn.kind==="session"||hn.kind==="side-chat")&&hn.sessionId===q.id),renameRequest:(ht==null?void 0:ht.sessionId)===q.id?ht.nonce:void 0,onClick:()=>le(q.id),onOpenContextMenu:(hn,Zn)=>Xe({sessionId:q.id,point:hn,anchor:Zn})},q.id)};return d.jsx(Upe,{children:d.jsx(Ywe,{value:Re,children:d.jsxs("div",{ref:z,className:"ui-shell relative flex h-full overflow-hidden bg-canvas font-sans text-zinc-900",children:[x&&d.jsx("button",{type:"button","aria-label":"关闭会话列表",onClick:()=>b(!1),className:"ui-overlay fixed inset-0 z-40 bg-zinc-950/20 md:hidden"}),d.jsxs("aside",{style:{"--sb-w":`${Ue}px`},className:`ui-sidebar-safe fixed inset-y-0 left-0 z-50 flex shrink-0 flex-col overflow-hidden border-r border-zinc-200 bg-rail shadow-[12px_0_36px_rgba(24,24,27,.08)] transition-transform duration-300 ease-[cubic-bezier(.16,1,.3,1)] w-[286px] md:static md:z-20 md:translate-x-0 md:shadow-none ${x?"translate-x-0":"-translate-x-full"} ${Pe?"md:w-11":"md:w-[var(--sb-w)]"}`,children:[!Pe&&d.jsx("div",{onPointerDown:q=>{q.preventDefault(),ve.current={x:q.clientX,width:Ue},Te(!0)},title:"拖拽调整宽度,拖到最窄可收起",className:"absolute inset-y-0 right-0 z-20 hidden w-1.5 cursor-col-resize touch-none bg-transparent hover:bg-blue-400/30 md:block"}),d.jsxs("div",{className:`flex h-full flex-col ${Pe?"md:hidden":""}`,children:[d.jsx("div",{className:"flex min-w-[268px] items-center pr-3",children:d.jsxs("button",{type:"button",onClick:()=>{n(void 0),b(!1),ke(void 0)},title:"回到首页","aria-label":"回到首页",className:"flex h-14 min-w-0 flex-1 items-center gap-2.5 px-4 text-left transition-colors hover:bg-zinc-100/70 active:bg-zinc-200/60",children:[d.jsx(EFe,{className:"h-7 w-7 shrink-0"}),d.jsx("span",{className:"text-sm font-semibold tracking-[-.02em]",children:"AgentDock"})]})}),d.jsxs("div",{className:"flex min-w-[268px] flex-col gap-1 px-2.5",children:[d.jsxs("button",{onClick:Q,"aria-label":"新建对话",className:"flex h-9 w-full items-center gap-2 rounded-lg px-2.5 text-[14px] font-medium text-zinc-700 transition-colors hover:bg-zinc-100 active:bg-zinc-200/60",children:[d.jsx(oa,{size:16}),"新建对话"]}),d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsxs("button",{type:"button",onClick:ae,"aria-label":"搜索会话(⌘K)",className:"flex h-9 min-w-0 flex-1 items-center gap-2 rounded-lg border border-zinc-200 bg-white px-2.5 text-[13px] text-zinc-500 transition-colors hover:border-zinc-300 hover:text-zinc-700",children:[d.jsx(pa,{size:14,className:"shrink-0"}),"搜索会话",d.jsx("span",{className:"ml-auto shrink-0 rounded border border-zinc-200 bg-zinc-50 px-1 py-0.5 font-sans text-[12px] leading-none text-zinc-400",children:"⌘K"})]}),d.jsx(rwe,{compact:!0,value:_,bots:((qt=$.data)==null?void 0:qt.bots)??[],agents:j.data??[],onChange:k})]})]}),d.jsx("div",{className:"mt-3 min-w-[268px] px-2",children:d.jsx(eFe,{active:!!A&&t===A})}),d.jsxs("div",{className:"mt-3 flex min-w-[268px] items-center justify-between pl-3.5 pr-2",children:[d.jsx("span",{className:"text-[12px] font-medium text-zinc-500",children:"会话列表"}),d.jsxs("div",{className:"flex items-center gap-1",children:[U==="project"&&O&&d.jsx("button",{type:"button",title:"恢复默认排序(按最近对话时间)",onClick:()=>I(BP),className:"grid h-6 w-6 place-items-center rounded text-zinc-400 transition-colors hover:bg-zinc-100 hover:text-zinc-700",children:d.jsx(Bc,{size:12})}),d.jsx("div",{className:"flex rounded-md bg-zinc-100 p-0.5",children:["time","project"].map(q=>d.jsx("button",{type:"button",onClick:()=>F(q),"aria-pressed":U===q,className:`h-6 rounded-[5px] px-2 text-[12px] font-medium transition-colors ${U===q?"bg-white text-zinc-900 shadow-[0_1px_2px_rgba(0,0,0,.06)]":"text-zinc-500 hover:text-zinc-700"}`,children:q==="time"?"时间":"项目"},q))})]})]}),_!=="all"&&d.jsx("div",{className:"mt-1 flex min-w-[268px] items-center gap-1.5 px-3.5",children:d.jsxs("div",{className:"flex h-6 min-w-0 flex-1 items-center gap-1 rounded-md bg-zinc-100 px-2 text-[12px] text-zinc-600",children:[d.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["来源:",_==="local"?"本地":`飞书 · ${((et=(jn=$.data)==null?void 0:jn.bots.find(q=>q.appId===_))==null?void 0:et.name)??"机器人"}`]}),d.jsx("button",{type:"button","aria-label":"清除来源筛选",onClick:()=>k("all"),className:"grid h-4 w-4 shrink-0 place-items-center rounded text-zinc-400 transition-colors hover:bg-zinc-200 hover:text-zinc-700",children:d.jsx(Yn,{size:12})})]})}),d.jsx("div",{className:"mt-1 flex min-h-0 min-w-[268px] flex-1 flex-col px-2",children:N.isLoading?d.jsxs("div",{className:"space-y-1 px-2 pt-1",children:[d.jsx("div",{className:"h-[34px] ui-skeleton rounded-lg bg-zinc-200/70"}),d.jsx("div",{className:"h-[34px] ui-skeleton rounded-lg bg-zinc-200/50"}),d.jsx("div",{className:"h-[34px] ui-skeleton rounded-lg bg-zinc-200/40"})]}):M.length?d.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto pb-2",children:U==="time"?awe(M).map(q=>d.jsxs("section",{className:"mb-2",children:[d.jsx("div",{className:"flex h-7 items-center px-2 text-[12px] font-medium text-zinc-400",children:q.label}),q.sessions.map(Ce=>ut(Ce,ot(Ce.id)))]},q.key)):L.map(q=>{const Ce=y.has(q.cwd),He=Je("workspaces",q.cwd,Tt),Ct=q.agents.reduce((pt,tn)=>pt+tn.sessions.filter(Ut=>Qa.has(Ut.state)).length,0);return d.jsxs("div",{className:"mb-0.5",children:[d.jsxs("div",{role:"button",tabIndex:0,...He.props,onClick:()=>ne(q.cwd),onKeyDown:pt=>{(pt.key==="Enter"||pt.key===" ")&&(pt.preventDefault(),ne(q.cwd))},title:`${q.cwd}(拖拽可换位)`,className:`group sticky top-0 z-[1] flex h-7 w-full cursor-pointer items-center gap-1.5 rounded-lg bg-rail pl-2 pr-1 text-left transition-opacity hover:bg-zinc-100/70 ${He.dragging?"opacity-40":""} ${He.over?"ring-1 ring-zinc-300":""}`,children:[Ce?d.jsx(lo,{size:12,className:"shrink-0 text-zinc-400"}):d.jsx(Qi,{size:12,className:"shrink-0 text-zinc-400"}),d.jsx(Rf,{size:12,className:"shrink-0 text-zinc-400"}),d.jsx(qH,{content:q.cwd,className:"min-w-0 flex-1 truncate text-[12px] font-medium text-zinc-600",children:q.label}),Ct>0&&d.jsx("span",{className:"ui-status-pulse h-1.5 w-1.5 shrink-0 rounded-full bg-blue-500"}),d.jsx("span",{role:"button",tabIndex:-1,onClick:pt=>{pt.stopPropagation();const tn=pt.currentTarget.getBoundingClientRect();Oe({cwd:q.cwd,top:tn.bottom+4,left:Math.min(tn.left,window.innerWidth-224)})},className:"grid h-5 w-5 shrink-0 place-items-center rounded text-zinc-400 opacity-0 transition-opacity hover:bg-zinc-200 hover:text-zinc-800 focus:opacity-100 group-hover:opacity-100 max-md:opacity-100",children:d.jsx(oa,{size:12})}),d.jsx(wI,{size:11,className:"shrink-0 cursor-grab text-zinc-300 opacity-0 transition-opacity group-hover:opacity-100"}),d.jsx("span",{className:"shrink-0 text-[12px] tabular-nums text-zinc-400",children:q.agents.reduce((pt,tn)=>pt+tn.sessions.length,0)})]}),!Ce&&d.jsx("div",{className:"ml-1.5 border-l border-zinc-200 pl-1",children:q.agents.map(pt=>{const tn=`${q.cwd}\0${pt.agentId}`,Ut=S.has(tn),Xt=Je(`agents:${q.cwd}`,pt.agentId,(ln,mn)=>Lt(q.cwd,ln,mn)),zn=pt.sessions.some(ln=>Qa.has(ln.state));return d.jsxs("div",{className:"group/agent",children:[d.jsxs("div",{role:"button",tabIndex:0,...Xt.props,onClick:()=>ie(tn),onKeyDown:ln=>{(ln.key==="Enter"||ln.key===" ")&&(ln.preventDefault(),ie(tn))},title:Ut?`展开 ${pt.agentName}(拖拽可换位)`:`收起 ${pt.agentName}(拖拽可换位)`,className:`flex h-7 w-full cursor-pointer items-center gap-1 rounded-lg px-2 text-left text-[12px] text-zinc-500 transition-opacity hover:bg-zinc-100/70 hover:text-zinc-700 ${Xt.dragging?"opacity-40":""} ${Xt.over?"ring-1 ring-zinc-300":""}`,children:[Ut?d.jsx(lo,{size:11,className:"shrink-0"}):d.jsx(Qi,{size:11,className:"shrink-0"}),d.jsx(Wr,{agentId:pt.agentId,agentName:pt.agentName,size:12}),d.jsx("span",{className:"min-w-0 flex-1 truncate",children:pt.agentName}),zn&&!Ut&&d.jsx("span",{className:"ui-status-pulse h-1.5 w-1.5 shrink-0 rounded-full bg-blue-500"}),d.jsx("button",{type:"button",title:`用 ${pt.agentName} 在此工作区新建会话`,disabled:!!he,onClick:ln=>{ln.stopPropagation(),_t.mutate({agentId:pt.agentId,cwd:q.cwd})},className:"grid h-4 w-4 shrink-0 place-items-center rounded opacity-0 transition-opacity hover:bg-zinc-200 hover:text-zinc-800 focus:opacity-100 group-hover/agent:opacity-100 max-md:opacity-100 disabled:opacity-50",children:(he==null?void 0:he.agentId)===pt.agentId&&he.cwd===q.cwd?d.jsx(Wn,{size:10,className:"animate-spin"}):d.jsx(oa,{size:10})}),d.jsx(wI,{size:10,className:"shrink-0 cursor-grab text-zinc-300 opacity-0 transition-opacity group-hover/agent:opacity-100"}),d.jsx("span",{className:"shrink-0 tabular-nums",children:pt.sessions.length})]}),!Ut&&d.jsx("div",{className:"ml-1.5 border-l border-zinc-200 pl-1",children:pt.sessions.map(ln=>d.jsxs("div",{children:[ut(ln,Je(`sessions:${tn}`,ln.id,(mn,hr)=>xe(tn,mn,hr),ln.id)),(pt.sideChats.get(ln.id)??[]).map(mn=>ut(mn,ot(mn.id)))]},ln.id))})]},`${q.cwd}:${pt.agentId}`)})})]},q.cwd)})}):d.jsx("div",{className:"px-3 py-6 text-xs leading-5 text-zinc-500",children:"当前分类暂无会话。"})}),d.jsx(kme,{webDenied:!!g,archivedCount:T.length,onSchedule:()=>{b(!1),_r("schedule")},onArchived:()=>{b(!1),_r("archived")},onImport:()=>{b(!1),_r("import")},onAgentConfig:()=>{b(!1),_r("agent")},onAssistant:be,onLark:()=>{b(!1),_r("lark")},onLarkAvatar:()=>{b(!1),_r("lark-avatar")},onShare:()=>{b(!1),_r("share")}})]}),d.jsxs("div",{className:`hidden h-full w-full flex-col items-center gap-1 py-3 ${Pe?"md:flex":""}`,children:[d.jsx(on,{content:"展开会话列表",children:d.jsx("button",{type:"button",onClick:()=>$e(!1),"aria-label":"展开会话列表",className:"grid h-8 w-8 place-items-center rounded-lg text-zinc-600 hover:bg-white hover:text-zinc-900",children:d.jsx(AX,{size:16})})}),d.jsx(on,{content:"新建对话",children:d.jsx("button",{type:"button",onClick:Q,"aria-label":"新建对话",className:"grid h-8 w-8 place-items-center rounded-lg text-zinc-600 hover:bg-white hover:text-zinc-900",children:d.jsx(oa,{size:16})})}),d.jsx(on,{content:"搜索会话(⌘K)",children:d.jsx("button",{type:"button",onClick:ae,"aria-label":"搜索会话",className:"grid h-8 w-8 place-items-center rounded-lg text-zinc-600 hover:bg-white hover:text-zinc-900",children:d.jsx(pa,{size:16})})}),d.jsx(tFe,{}),d.jsxs("span",{className:"mt-auto flex flex-col items-center gap-1",children:[d.jsx(on,{content:"定时任务",children:d.jsx("button",{type:"button",onClick:()=>_r("schedule"),"aria-label":"定时任务",className:"grid h-8 w-8 place-items-center rounded-lg text-zinc-500 hover:bg-white hover:text-zinc-900",children:d.jsx(dl,{size:15})})}),d.jsx(on,{content:"归档会话",children:d.jsx("button",{type:"button",onClick:()=>_r("archived"),"aria-label":"归档会话",className:"grid h-8 w-8 place-items-center rounded-lg text-zinc-500 hover:bg-white hover:text-zinc-900",children:d.jsx(jd,{size:15})})}),d.jsx(on,{content:"导入外部会话",children:d.jsx("button",{type:"button",onClick:()=>{$e(!1),_r("import")},"aria-label":"导入外部会话",className:"grid h-8 w-8 place-items-center rounded-lg text-zinc-500 hover:bg-white hover:text-zinc-900",children:d.jsx(fa,{size:15})})}),d.jsx(on,{content:"Agent 设置",children:d.jsx("button",{type:"button",onClick:()=>{$e(!1),_r("agent")},"aria-label":"Agent 设置",className:"grid h-8 w-8 place-items-center rounded-lg text-zinc-500 hover:bg-white hover:text-zinc-900",children:d.jsx(ii,{size:15})})}),d.jsx(on,{content:"飞书设置",children:d.jsx("button",{type:"button",onClick:()=>{$e(!1),_r("lark")},"aria-label":"飞书设置",className:"grid h-8 w-8 place-items-center rounded-lg text-zinc-500 hover:bg-white hover:text-zinc-900",children:d.jsx(ty,{size:15})})}),d.jsx(on,{content:"在手机上打开",children:d.jsx("button",{type:"button",onClick:()=>_r("share"),"aria-label":"在手机上打开",className:"grid h-8 w-8 place-items-center rounded-lg text-zinc-500 hover:bg-white hover:text-zinc-900",children:d.jsx(KL,{size:15})})})]})]})]}),d.jsx("main",{className:"flex min-w-0 flex-1 bg-canvas",children:G?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:`flex min-w-0 flex-1 ${h?"max-lg:hidden":""}`,children:d.jsx(qD,{session:G,agent:(ft=j.data)==null?void 0:ft.find(q=>q.id===G.agentId),pane:"primary",onOpenSidebar:()=>b(!0),paneOpen:h,onTogglePane:()=>{ke(void 0),l()}},`primary:${G.id}`)}),(h||c.length>0)&&d.jsx(v1e,{tabs:u,mountedTabs:c,activeTabId:f,visible:h,shortcuts:re,acceptsDrop:!!(pe!=null&&pe.sessionId),onDropSession:()=>{const q=pe==null?void 0:pe.sessionId;De(void 0),fe(void 0),q&&me(q)},onActivate:s,onClose:i,onAdd:q=>ke(q),onPick:ge,onHide:()=>{ke(void 0),l()},children:Object.fromEntries(c.map(q=>{var Ce;return[q.id,q.kind==="terminal"?d.jsx($3e,{sessionId:q.anchorSessionId??G.id,sshHost:(E.find(He=>He.id===q.anchorSessionId)??G).sshHost},q.id):q.kind==="files"?d.jsx(O3e,{sessionId:q.anchorSessionId??G.id,cwd:((Ce=E.find(He=>He.id===q.anchorSessionId))==null?void 0:Ce.cwd)??G.cwd,initialPath:q.filePath,disabledReason:(E.find(He=>He.id===q.anchorSessionId)??G).sshHost?`SSH 远端会话(${(E.find(He=>He.id===q.anchorSessionId)??G).sshHost})暂不支持文件浏览;终端面板可以直接连到远端。`:void 0},q.id):q.kind==="raw"?d.jsx(oLe,{sessionId:q.anchorSessionId??G.id,active:h&&q.id===f},q.id):(()=>{var Ct;const He=E.find(pt=>pt.id===q.sessionId);return He?d.jsx(qD,{session:He,agent:(Ct=j.data)==null?void 0:Ct.find(pt=>pt.id===He.agentId),pane:"secondary",onOpenSidebar:()=>b(!0),onOpenRawLog:Y},q.id):d.jsx("div",{className:"grid h-full place-items-center text-[12px] text-zinc-400",children:"会话已不存在。"})})()]}))}),(pe==null?void 0:pe.sessionId)&&!h&&d.jsx("div",{onDragOver:q=>q.preventDefault(),onDrop:q=>{q.preventDefault();const Ce=pe==null?void 0:pe.sessionId;De(void 0),fe(void 0),Ce&&me(Ce)},className:"fixed inset-y-0 right-0 z-40 flex w-20 items-center justify-center border-l-2 border-dashed border-zinc-400 bg-zinc-900/5",children:d.jsx("span",{className:"text-[12px] font-medium text-zinc-600 [writing-mode:vertical-rl]",children:"放到这里,在副屏打开"})})]}):d.jsxs("div",{className:"ui-page relative flex flex-1 justify-center overflow-y-auto px-4 sm:px-8",children:[d.jsx("span",{className:"absolute left-[max(0.75rem,env(safe-area-inset-left))] top-[max(0.75rem,env(safe-area-inset-top))] md:hidden",children:d.jsx(Ro,{label:"打开会话列表",onClick:()=>b(!0),children:d.jsx(dL,{size:17})})}),d.jsx(CFe,{editorRef:X,agents:j.data??[],sessions:N.data??[],onCreated:q=>le(q.id)})]})}),je&&d.jsx(p1e,{anchor:je,shortcuts:re,onPick:ge,onClose:()=>ke(void 0)}),st&&(()=>{var Ce,He;const q=E.find(Ct=>Ct.id===st.sessionId);return q?d.jsx(kLe,{session:q,agentName:(He=(Ce=j.data)==null?void 0:Ce.find(Ct=>Ct.id===q.agentId))==null?void 0:He.name,point:st.point,origin:window.location.origin,anchor:st.anchor,onClose:()=>Xe(void 0),onRename:()=>{Xe(void 0),Ye(Ct=>({sessionId:q.id,nonce:((Ct==null?void 0:Ct.nonce)??0)+1}))},onArchive:()=>{Xe(void 0),kt.open(q.id)},onNotice:Ct=>lt.show(Ct,"info")}):null})(),lt.toast,Le&&d.jsxs("div",{className:"fixed bottom-4 left-1/2 z-50 -translate-x-1/2 rounded-lg border border-red-200 bg-red-50 px-3.5 py-2 text-[12px] text-red-700 shadow-[0_12px_32px_rgba(24,24,27,.12)]",children:[d.jsx("button",{type:"button",onClick:()=>at(void 0),className:"mr-2 font-medium underline",children:"关闭"}),Le]}),d.jsx(XY,{dialogs:{lark:d.jsx(IFe,{agents:j.data??[],onClose:Ei}),"lark-avatar":d.jsx($Fe,{onClose:Ei}),agent:d.jsx(Swe,{onClose:Ei}),assistant:d.jsx(kSe,{onClose:Ei,onOpenMain:()=>{Ei(),yt()},onAdopt:()=>{Ei(),ct()},onOpenSession:q=>{Ei(),le(q)}}),schedule:q=>d.jsx(X1e,{...q?{session:E.find(Ce=>Ce.id===q)}:{},sessions:E,onClose:Ei,onOpenSession:le}),handover:q=>{var He;const Ce=q?E.find(Ct=>Ct.id===q):void 0;return Ce?d.jsx(MSe,{session:Ce,agent:(He=j.data)==null?void 0:He.find(Ct=>Ct.id===Ce.agentId),onClose:Ei}):null},"system-prompt":q=>{const Ce=q?E.find(He=>He.id===q):void 0;return Ce!=null&&Ce.systemPrompt?d.jsx(DSe,{session:Ce,onClose:Ei}):null},share:d.jsx(HSe,{onClose:Ei}),archived:d.jsx(Q1e,{sessions:T,agents:j.data??[],mainSessionId:A,onClose:Ei,onOpenSession:q=>{Ei(),le(q)}}),import:d.jsx(ASe,{agents:j.data??[],onClose:Ei,onImported:q=>le(q.id)}),search:d.jsx(hwe,{agents:j.data??[],sessions:N.data??[],onClose:Ei,onOpen:q=>{Ei(),le(q.id)}})}}),(()=>{var He,Ct;const q=vt.status==="closed"?void 0:E.find(pt=>pt.id===vt.sessionId),Ce=q?ra(q,(Ct=(He=j.data)==null?void 0:He.find(pt=>pt.id===q.agentId))==null?void 0:Ct.name):"该会话";return d.jsx(Rs,{open:vt.status!=="closed",tone:"warning",title:`归档「${Ce}」?`,description:"归档后,该会话会从会话列表移入「归档会话」,历史消息和执行记录都会保留,不会被删除。正在运行的会话会先停止。之后可在侧栏设置里的「归档会话」中找回并查看。",confirmLabel:"确认归档",busy:vt.status==="archiving",error:vt.status==="error"?vt.message:void 0,onCancel:()=>kt.cancel(),onConfirm:()=>void kt.confirm()})})(),ce&&d.jsx(jFe,{cwd:ce.cwd,top:ce.top,left:ce.left,agents:j.data??[],creatingPair:he,onSelect:q=>_t.mutate({agentId:q,cwd:ce.cwd}),onClose:()=>Oe(null)}),d.jsx(JLe,{view:Ae})]})})})}const tY=new PY({defaultOptions:{queries:{retry:(e,t)=>!(t instanceof sy)&&e<3}}});tY.setQueryDefaults(["events"],{structuralSharing:!1,gcTime:6e4,staleTime:3e4});sY.createRoot(document.getElementById("root")).render(d.jsx(m.StrictMode,{children:d.jsx(cY,{client:tY,children:d.jsx(mme,{children:d.jsx(PFe,{})})})}));if(new URLSearchParams(window.location.search).get("vvdebug")==="1"&&window.visualViewport){const e=window.visualViewport,t=document.createElement("div");t.style.cssText="position:fixed;top:0;left:0;right:0;z-index:99999;margin:0;padding:6px 8px;font:11px/1.5 ui-monospace,Menlo,monospace;background:rgba(0,0,0,.78);color:#7CFC9A;pointer-events:none;white-space:pre-wrap;word-break:break-all",document.body.appendChild(t);const n=()=>`${(window.innerHeight/100).toFixed(1)}dvh?`,r=()=>{var i;t.textContent=[`vv.h=${Math.round(e.height)} offTop=${Math.round(e.offsetTop)} scale=${e.scale} w=${Math.round(e.width)}`,`innerH=${window.innerHeight} innerW=${window.innerWidth} dpr=${window.devicePixelRatio}`,`dvh100≈${n()} apply=${Math.abs(e.scale-1)<=.01}`,`docH=${document.documentElement.clientHeight} ua=${((i=navigator.userAgent.match(/OS [0-9_]+/))==null?void 0:i[0])??""}`].join(`
|
|
1140
1140
|
`)};r(),e.addEventListener("resize",r),e.addEventListener("scroll",r)}export{Jg as E,zh as M,xN as P,er as S,hl as a,Fc as b,Ne as c,s$e as k,ki as r,Ob as s};
|