@undefineds.co/xpod 0.3.71-rc.8 → 0.3.71

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.
Files changed (48) hide show
  1. package/dist/api/ai-gateway/connect/index.d.ts +2 -0
  2. package/dist/api/ai-gateway/connect/index.js +87 -24
  3. package/dist/api/ai-gateway/connect/index.js.map +1 -1
  4. package/dist/api/ai-gateway/pod/HostedPodDataAccess.js +2 -2
  5. package/dist/api/ai-gateway/pod/HostedPodDataAccess.js.map +1 -1
  6. package/dist/api/container/common.js +1 -1
  7. package/dist/api/container/common.js.map +1 -1
  8. package/dist/api/container/routes.js +1 -1
  9. package/dist/api/container/routes.js.map +1 -1
  10. package/dist/api/handlers/AiGatewayManagementHandler.js +28 -12
  11. package/dist/api/handlers/AiGatewayManagementHandler.js.map +1 -1
  12. package/dist/api/handlers/PodSettingsHandler.d.ts +12 -19
  13. package/dist/api/handlers/PodSettingsHandler.js +12 -51
  14. package/dist/api/handlers/PodSettingsHandler.js.map +1 -1
  15. package/dist/http/InternalPodDataHttpHandler.d.ts +3 -1
  16. package/dist/http/InternalPodDataHttpHandler.js +48 -7
  17. package/dist/http/InternalPodDataHttpHandler.js.map +1 -1
  18. package/dist/http/InternalPodDataHttpHandler.jsonld +10 -2
  19. package/dist/runtime/GatewayAdminProxyAuth.d.ts +1 -1
  20. package/dist/runtime/GatewayAdminProxyAuth.js +1 -1
  21. package/dist/runtime/GatewayAdminProxyAuth.js.map +1 -1
  22. package/dist/runtime/Proxy.d.ts +1 -0
  23. package/dist/runtime/Proxy.js +22 -0
  24. package/dist/runtime/Proxy.js.map +1 -1
  25. package/package.json +1 -1
  26. package/static/dashboard/assets/{NetworkPage-CXjiUMR1.js → NetworkPage-CsERgA2D.js} +1 -1
  27. package/static/dashboard/assets/{PaneListHeader-BSipfl0W.js → PaneListHeader-WJWFvTKY.js} +1 -1
  28. package/static/dashboard/assets/{PodPage-Bd3Xhmp-.js → PodPage-Bo_NbnK1.js} +1 -1
  29. package/static/dashboard/assets/{ServicesPage-CI3jWZGe.js → ServicesPage-CrNDXQlg.js} +1 -1
  30. package/static/dashboard/assets/{card-z5BV5hTo.js → card-Cjax171A.js} +1 -1
  31. package/static/dashboard/assets/{dashboard-CSrqAv2L.js → dashboard-CaE1mRUL.js} +4 -4
  32. package/static/dashboard/assets/{database-Ct5ZPe6L.js → database-B0sGiSz2.js} +1 -1
  33. package/static/dashboard/assets/{external-link-B7wD1hkm.js → external-link-C_ANDdCY.js} +1 -1
  34. package/static/dashboard/assets/{index-tOBaUnM1.js → index-CDoxbvUP.js} +1 -1
  35. package/static/dashboard/assets/{refresh-cw-CFDZPaE8.js → refresh-cw-DHzHxCme.js} +1 -1
  36. package/static/dashboard/assets/{services-status-context-DN1Icg4A.js → services-status-context-ukghtkFD.js} +1 -1
  37. package/static/dashboard/dashboard.html +1 -1
  38. package/static/settings/assets/ModelsPage-ClTKzRGm.js +1 -0
  39. package/static/settings/assets/{PaneListHeader-BtON8Z5Q.js → PaneListHeader-DTVY4Ig2.js} +1 -1
  40. package/static/settings/assets/{PodPage-9LGuOloQ.js → PodPage-L_JAOD-r.js} +1 -1
  41. package/static/settings/assets/{ServicesPage-ZoT9-B_0.js → ServicesPage-BwLxrSWw.js} +1 -1
  42. package/static/settings/assets/{SettingsPage-Bj4lB3mq.js → SettingsPage-DUGHDPQx.js} +1 -1
  43. package/static/settings/assets/{card-CCGngjas.js → card-BZF0jSa_.js} +1 -1
  44. package/static/settings/assets/{services-status-context-CBfImxL_.js → services-status-context-BnbZHZnu.js} +1 -1
  45. package/static/settings/assets/{settings-yUyFIJxi.js → settings-BN7FyntE.js} +4 -4
  46. package/static/settings/assets/{workspace-layout-B0wJpPze.js → workspace-layout-jzYHoh3_.js} +1 -1
  47. package/static/settings/settings.html +1 -1
  48. package/static/settings/assets/ModelsPage-D87RrLB0.js +0 -1
@@ -0,0 +1 @@
1
+ import{r as p,j as n,c as $e,B as S,I as X,s as Z,e as pt}from"./settings-BN7FyntE.js";import{C as De,a as _e,b as Le,c as Re,d as Me,B as Ue}from"./card-BZF0jSa_.js";import{T as ft}from"./workspace-layout-jzYHoh3_.js";function mt(e){if(!Te(e))throw new Error("Applet layout descriptor must be an object");if(typeof e.type!="string")throw new Error("Applet layout descriptor type must be a string");switch(e.type){case"single-pane":case"two-pane":return ge(e.context),e;case"three-pane":return ge(e.context),e;default:throw new Error(`Unsupported applet layout type: ${e.type}`)}}function Te(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ge(e){if(e!==void 0){if(!Te(e))throw new Error("Applet layout descriptor context must be an object");if("collapsible"in e&&typeof e.collapsible!="boolean")throw new Error("Applet layout descriptor context.collapsible must be a boolean");if("initiallyCollapsed"in e&&typeof e.initiallyCollapsed!="boolean")throw new Error("Applet layout descriptor context.initiallyCollapsed must be a boolean")}}const ht=mt;function yt(e,t){return xt(e,t)}function xt(e,t){const s=wt(e),i=e.createController(t);return s.type==="single-pane"?{layout:"single-pane",controller:i,element:p.createElement(s.render,{controller:i,host:t})}:s.type==="two-pane"?{layout:"two-pane",controller:i,slots:{listHeader:p.createElement(s.slots.listHeader,{controller:i,host:t}),list:p.createElement(s.slots.list,{controller:i,host:t}),mainHeader:p.createElement(s.slots.mainHeader,{controller:i,host:t}),main:p.createElement(s.slots.main,{controller:i,host:t})}}:{layout:"three-pane",controller:i,contextConfig:s.contextConfig,slots:{listHeader:p.createElement(s.slots.listHeader,{controller:i,host:t}),list:p.createElement(s.slots.list,{controller:i,host:t}),mainHeader:p.createElement(s.slots.mainHeader,{controller:i,host:t}),main:p.createElement(s.slots.main,{controller:i,host:t}),context:p.createElement(s.slots.context,{controller:i,host:t})}}}function wt(e){if("layout"in e){const t=At(e.layout),s=ht(t.descriptor),i=s.type;if(e.manifest.layout!==i)throw new Error(`Applet manifest layout ${e.manifest.layout} does not match descriptor layout ${i}`);if(i==="single-pane"){if(!("render"in t))throw new Error("Applet descriptor single-pane render must be a function");return _(t.render,"Applet descriptor single-pane render"),{type:"single-pane",render:t.render}}if(!("slots"in t))throw new Error(`Applet descriptor declares ${i} but no slots were provided`);return i==="two-pane"?(ne(t.slots,"Applet descriptor two-pane"),{type:"two-pane",slots:t.slots}):(gt(t.slots,"Applet descriptor three-pane"),{type:"three-pane",contextConfig:s.context,slots:t.slots})}if(e.manifest.layout==="single-pane"){if(!("render"in e))throw new Error("Applet manifest declares single-pane but no single-pane renderer was provided");return _(e.render,"Applet single-pane render"),{type:"single-pane",render:e.render}}if(e.manifest.layout==="two-pane"&&"slots"in e)return ne(e.slots,"Applet two-pane"),{type:"two-pane",slots:e.slots};throw new Error(`Applet manifest declares ${e.manifest.layout} but no supported applet layout was provided`)}function ne(e,t){bt(e,t),_(e.listHeader,`${t} slot listHeader`),_(e.list,`${t} slot list`),_(e.mainHeader,`${t} slot mainHeader`),_(e.main,`${t} slot main`)}function gt(e,t){ne(e,t),_(e.context,`${t} slot context`)}function bt(e,t){if(typeof e!="object"||e===null)throw new Error(`${t} slots must be an object`)}function _(e,t){if(typeof e!="function")throw new Error(`${t} must be a function`)}function At(e){if(typeof e!="object"||e===null||Array.isArray(e))throw new Error("Applet descriptor layout must be an object");if(!("descriptor"in e)||e.descriptor===void 0)throw new Error("Applet descriptor required");return e}const Ct=p.createContext(null);function jt(e){return n.jsx("nav",{className:$e("space-y-1 p-3",e.className),...e})}function Et({selected:e,className:t,onClick:s,...i}){const a=p.useContext(Ct);return n.jsx("button",{type:"button","aria-current":e?"page":void 0,className:$e("flex w-full items-center rounded-md px-3 py-2 text-left text-sm hover:bg-accent aria-[current=page]:bg-accent aria-[current=page]:font-medium",t),onClick:o=>{s?.(o),a?.showMain()},...i})}const ie=["openai","anthropic","kimi","bailian","deepseek"],Ke="AI Connection request failed. Please try again.";function oe(e){const t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")throw new Error("Current Pod URL must use HTTP or HTTPS");return t.origin}function vt({webId:e,podBaseUrl:t,authenticatedFetch:s}){const i=oe(t),a=async(d,f,g,y={})=>{const C=await s(`${i}${d}`,{method:f,credentials:"omit",mode:"cors",headers:{accept:"application/json",...g?{"content-type":"application/json"}:{}},...g?{body:JSON.stringify(g)}:{}}),E=await It(C);if(!C.ok)throw new Error(St(E,C.status,y));return E},o=d=>(ce(d),`/api/ai/gateway/providers/${d}`),c=async(d,f,g,y)=>{const C=await a(`${o(d)}${f}`,g,y,{provider:d});return Dt(C,d)};return{webId:e,apiBase:i,getServiceAccess(){return a("/api/applets/service-access/ai-connection","GET")},async listProviders(){const d=await a("/api/ai/connections/providers","GET");return Array.isArray(d.data)?d.data.map(Bt).filter(Ce):[]},async listModels(){const d=await a("/v1/models","GET");return Array.isArray(d.data)?d.data.map(kt).filter(Ce):[]},async beginConnect(d,f){return await c(d,"/connect/begin","POST",{mode:f})},connectStatus(d,f){if(!f.attemptId)throw new Error("Connect attempt id is required");const g=new URLSearchParams({state:f.state??"",signature:f.signature??""});return c(d,`/connect/status/${encodeURIComponent(f.attemptId)}?${g}`,"GET")},completeApiKey(d,f,g,y){return c(d,"/connect/complete-api-key","POST",L({attemptId:f.attemptId,state:f.state,signature:f.signature,apiKey:g,accountLabel:y}))},pollDevice(d,f){return c(d,"/connect/poll","POST",L({attemptId:f.attemptId,state:f.state,signature:f.signature}))},async disconnect(d){const f=await a(`${o(d)}/connect`,"DELETE");return $t(f.record)},quota(d,f=!1){return a(`${o(d)}/quota/${f?"refresh":"status"}`,f?"POST":"GET",f?{}:void 0,{provider:d})}}}function ae(e){return e instanceof Error?be(e.message):be(String(e))}function St(e,t,s={}){const i=Nt(e),a=i?Q(i,s.provider):void 0;if(a)return a;const o=R(e)&&typeof e.error=="string"?e.error:void 0;if(o){const c=Q(o,s.provider);if(c)return c;if(o==="AI Connection service identity is unavailable")return o}return t===401?"Please sign in again to continue.":t===403?"AI Connection permission was denied.":t===404&&s.provider?`${re(s.provider)} connection is not configured.`:t===429?"AI Connection is rate limited. Please try again later.":t===503?"AI Connection service is unavailable.":Ke}function be(e){const t=Q(e);if(t)return t;const s=e.split(":",1)[0]?.trim(),i=s?Q(s):void 0;return i||(e==="AI Connection service identity is unavailable"?e:e.startsWith("invalid_")?"AI Connection returned an invalid response.":Ke)}function Nt(e){if(R(e)){if(typeof e.code=="string")return e.code;if(typeof e.errorCode=="string")return e.errorCode;if(typeof e.error=="string"&&/^[a-z][a-z0-9_:-]{0,80}$/i.test(e.error))return e.error}}function Q(e,t){switch(e.trim().toLowerCase().replace(/-/g,"_")){case"not_configured":case"notconfigured":return t?`${re(t)} connection is not configured.`:"AI provider connection is not configured.";case"unsupported":return t?`${re(t)} does not support this operation.`:"This AI Connection operation is not supported.";case"service_identity_unavailable":return"AI Connection service identity is unavailable";case"unauthorized":return"Please sign in again to continue.";case"forbidden":case"permission_denied":return"AI Connection permission was denied.";case"rate_limited":return"AI Connection is rate limited. Please try again later.";case"service_unavailable":return"AI Connection service is unavailable.";default:return}}function re(e){switch(e){case"openai":return"OpenAI";case"anthropic":return"Anthropic";case"kimi":return"Kimi";case"bailian":return"Bailian";case"deepseek":return"DeepSeek"}}async function It(e){const t=await e.text();if(t)try{return JSON.parse(t)}catch{throw new Error(`AI Connection returned invalid JSON (${e.status})`)}}function ce(e){if(!ie.includes(e))throw new Error(`Unsupported AI provider: ${e}`)}function kt(e){if(!R(e)||typeof e.id!="string"||Pt(e.id))return;const t=V(e.provider)??V(e.providerId)??V(e.owned_by)??Ft(e.id);if(t)return L({id:e.id,provider:t,displayName:I(e.displayName)??I(e.name),contextWindow:Ae(e.contextWindow)??Ae(e.context_window),protocols:Array.isArray(e.protocols)?e.protocols.filter(s=>typeof s=="string"):void 0})}function Pt(e){const t=e.toLowerCase();return t==="linx"||t==="linx-lite"||t==="undefineds/linx"||t==="undefineds/linx-lite"}function V(e){if(typeof e!="string")return;const t=e.toLowerCase();return t==="alibaba"||t==="dashscope"?"bailian":ie.includes(t)?t:void 0}function Ft(e){const t=e.split("/",1)[0];return e.includes("/")?V(t):void 0}function Ae(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function Bt(e){if(!(!R(e)||typeof e.provider!="string"||!Lt(e.status)||!R(e.connect)||!Array.isArray(e.connect.modes)||!e.connect.modes.every(Oe)||typeof e.connect.configured!="boolean"))return ce(e.provider),L({provider:e.provider,status:e.status,authMode:I(e.authMode),accountLabel:I(e.accountLabel),expiresAt:I(e.expiresAt),reauthRequired:typeof e.reauthRequired=="boolean"?e.reauthRequired:void 0,credentialIri:I(e.credentialIri),version:typeof e.version=="number"?e.version:void 0,connect:L({modes:[...e.connect.modes],configured:e.connect.configured,message:I(e.connect.message)})})}function $t(e){if(!(!R(e)||typeof e.id!="string"||typeof e.credentialIri!="string"||typeof e.webId!="string"||typeof e.provider!="string"||typeof e.authMode!="string"||typeof e.status!="string"))return ce(e.provider),L({id:e.id,credentialIri:e.credentialIri,webId:e.webId,provider:e.provider,authMode:e.authMode,status:e.status,accountLabel:I(e.accountLabel),expiresAt:I(e.expiresAt),version:typeof e.version=="number"?e.version:void 0,reauthRequired:typeof e.reauthRequired=="boolean"?e.reauthRequired:void 0})}function Dt(e,t){if(!R(e)||!Oe(e.mode)||!_t(e.status)||e.provider!==t)throw new Error("AI Connection returned an invalid Connect response");return L({mode:e.mode,status:e.status,provider:t,attemptId:I(e.attemptId),state:I(e.state),signature:I(e.signature),expiresAt:I(e.expiresAt),authorizationUrl:ee(e.authorizationUrl),userCode:I(e.userCode),verificationUri:ee(e.verificationUri),verificationUriComplete:ee(e.verificationUriComplete),intervalSeconds:typeof e.intervalSeconds=="number"?e.intervalSeconds:void 0,apiKeyManagementSupported:typeof e.apiKeyManagementSupported=="boolean"?e.apiKeyManagementSupported:void 0,credentialId:I(e.credentialId),message:I(e.message)})}function L(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function I(e){return typeof e=="string"?e:void 0}function ee(e){if(typeof e=="string")try{const t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"?t.href:void 0}catch{return}}function Oe(e){return e==="browserAssistedApiKey"||e==="deviceCodeOAuth"||e==="connectUnsupported"}function _t(e){return e==="pending"||e==="authorization_pending"||e==="slow_down"||e==="completed"||e==="expired"||e==="cancelled"||e==="unsupported"}function Lt(e){return e==="connected"||e==="disconnected"||e==="reauthRequired"}function R(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Ce(e){return e!==void 0}const je="co.undefineds.ai-connection",Rt=new Set(["providerCredentials","providerDefinitions","quotaSnapshots"]);function Ee(e,t){if(!J(e))throw new Error("invalid_descriptor");if(e.appletId!==je)throw new Error("invalid_applet_id");const s=e.service;if(!J(s)||typeof s.webId!="string"||typeof s.label!="string"||!zt(s.webId))throw new Error("invalid_service");if(!Array.isArray(e.resources)||e.resources.length===0)throw new Error("invalid_empty_resources");const i=Ot(t),a=new Set,o=e.resources.map(c=>Mt(c,i,a));return{appletId:je,service:{webId:s.webId,label:s.label},resources:o}}function Mt(e,t,s){if(!J(e)||typeof e.id!="string"||typeof e.url!="string"||e.mediaType!=="text/turtle"||!J(e.access))throw new Error("invalid_resource");if(!Rt.has(e.id)||s.has(e.id))throw new Error("invalid_resource");Ut(e.url);let i;try{i=new URL(e.url)}catch{throw new Error("invalid_resource")}if(!Ht(i,t))throw new Error("invalid_resource");return s.add(e.id),{id:e.id,url:i.href,mediaType:"text/turtle",access:Kt(e.access)}}function Ut(e){if(/%(?![0-9a-fA-F]{2})/.test(e)||/%(?:2f|5c)/i.test(e)||e.includes("\\"))throw new Error("invalid_resource");const t=Tt(e);if(ve(t))throw new Error("invalid_resource");try{const s=decodeURIComponent(t);if(s.includes("\\")||ve(s))throw new Error("invalid_resource")}catch{throw new Error("invalid_resource")}}function Tt(e){const t=e.split("#",1)[0]??e;return(t.split("?",1)[0]??t).replace(/^[a-z][a-z0-9+.-]*:\/\/[^/\\?#]*/i,"")}function ve(e){return e.split("/").some(t=>t==="."||t==="..")}function Kt(e){if(Object.keys(e).some(s=>s!=="read"&&s!=="append"&&s!=="write")||e.read!==!0||e.append!==!0||e.write!==!0)throw new Error("invalid_resource");return{read:!0,append:!0,write:!0}}function Ot(e){const t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new Error("invalid_current_pod");return t.pathname.endsWith("/")||(t.pathname=`${t.pathname}/`),t}function Ht(e,t){return(e.protocol==="http:"||e.protocol==="https:")&&e.origin===t.origin&&e.pathname.startsWith(t.pathname)}function zt(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function J(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}const D=[{id:"openai",name:"OpenAI",browserMode:"browserAssistedApiKey",browserLabel:"打开官方控制台"},{id:"anthropic",name:"Anthropic",browserMode:"browserAssistedApiKey",browserLabel:"打开官方控制台"},{id:"kimi",name:"Kimi",browserMode:"deviceCodeOAuth",browserLabel:"浏览器鉴权"},{id:"bailian",name:"百炼",browserMode:"browserAssistedApiKey",browserLabel:"打开官方控制台"},{id:"deepseek",name:"DeepSeek",browserMode:"connectUnsupported",browserLabel:"浏览器鉴权不支持"}];if(D.map(e=>e.id).join(",")!==ie.join(","))throw new Error("AI Connection provider UI is out of sync with the client catalog");function qt(e){const t=e.solid.session.getSnapshot(),s=Vt(t),i=e.solid.pod,o=t.status==="authenticated"&&i.status==="ready"?vt({webId:t.webId,podBaseUrl:i.current.podUrl,authenticatedFetch:e.solid.session.fetch}):null;let c="openai",d="",f={},g={},y,C=0,E,v=o?"checking":"missing",l;const b=new Set,h=()=>b.forEach(m=>m()),j={client:o,sessionStatus:s,podStatus:i.status,error:i.status==="error"?i.error:t.status==="error"&&!t.webId?t.error:void 0,login:e.solid.requireLogin,openExternal:e.navigation.openExternal,clientConfigurationBridge:e.capabilities.aiClientConfiguration,clientCredentialManager:e.capabilities.aiClientCredentials,get selectedProvider(){return c},get searchQuery(){return d},get providerStates(){return f},get providerSummaries(){return g},get providerLoadError(){return y},get serviceAccessState(){return v},selectProvider(m){c!==m&&(c=m,h())},selectFirstUnconfiguredProvider(){const m=D.find(x=>f[x.id]==="unconfigured")??D[0];m&&j.selectProvider(m.id)},setSearchQuery(m){d!==m&&(d=m,h())},setProviderState(m,x){if(f[m]===x)return;C+=1,f={...f,[m]:x};const A=Xt(m,x);A&&(g={...g,[m]:A}),h()},async ensureServiceAccess(){return l||(l=(async()=>{if(!o){v="missing",h();return}if(!e.solid.permissions){v="capabilityUnavailable",h();return}if(e.solid.pod.status!=="ready"){v="missing",h();return}v="checking",h();try{const m=Ee(await o.getServiceAccess(),e.solid.pod.current.podUrl),x=await e.solid.permissions.ensureAgentAccess(m);v=x.status==="granted"?"granted":x.status,h(),x.status==="granted"&&await j.loadProviders()}catch(m){v=m instanceof Error&&m.message.startsWith("invalid_")?"invalidDescriptor":"permissionDenied",h()}finally{l=void 0}})(),l)},async revokeServiceAccess(){if(!o){v="missing",h();return}if(!e.solid.permissions){v="capabilityUnavailable",h();return}if(e.solid.pod.status!=="ready"){v="missing",h();return}v="checking",h();try{const m=Ee(await o.getServiceAccess(),e.solid.pod.current.podUrl),x=await e.solid.permissions.revokeAgentAccess(m);v=x.status==="granted"?"granted":x.status,h()}catch(m){v=m instanceof Error&&m.message.startsWith("invalid_")?"invalidDescriptor":"permissionDenied",h()}},async loadProviders(){if(o)return E||(E=(async()=>{const m=C+1;C=m,y=void 0,h();try{const x=await o.listProviders();if(m!==C)return;g=Object.fromEntries(x.map(A=>[A.provider,A])),f=Object.fromEntries(D.map(A=>[A.id,Gt(g[A.id])])),h()}catch(x){if(m!==C)return;y=Yt(x),h()}finally{E=void 0}})(),E)},subscribe(m){return b.add(m),()=>b.delete(m)}};return j}function Vt(e){return e.status==="initializing"?"authenticating":e.status==="authenticated"?"authenticated":e.status==="error"&&e.webId?"expired":"anonymous"}function de(e){return p.useSyncExternalStore(e.subscribe,()=>e.selectedProvider,()=>e.selectedProvider)}function He(e){return p.useSyncExternalStore(e.subscribe,()=>e.searchQuery,()=>e.searchQuery)}function Qt(e){return p.useSyncExternalStore(e.subscribe,()=>e.providerStates,()=>e.providerStates)}function Jt(e){return p.useSyncExternalStore(e.subscribe,()=>e.providerSummaries,()=>e.providerSummaries)}function ze(e){return p.useSyncExternalStore(e.subscribe,()=>e.providerLoadError,()=>e.providerLoadError)}function Wt(e){return p.useSyncExternalStore(e.subscribe,()=>e.serviceAccessState,()=>e.serviceAccessState)}function Gt(e){return!e||e.status==="disconnected"?"unconfigured":e.status==="reauthRequired"?"attention":e.authMode==="browserAssistedApiKey"?"configured":"connected"}function Xt(e,t){if(t==="configured")return{provider:e,status:"connected",authMode:"browserAssistedApiKey",connect:{modes:["browserAssistedApiKey"],configured:!0}};if(t==="connected")return{provider:e,status:"connected",connect:{modes:["deviceCodeOAuth","browserAssistedApiKey"],configured:!0}};if(t!=="attention"&&t!=="loading")return{provider:e,status:"disconnected",connect:{modes:["browserAssistedApiKey"],configured:!1}}}function Yt(e){return ae(e)}function Zt({controller:e}){const t=de(e),s=He(e).trim().toLocaleLowerCase(),i=Qt(e),a=ze(e),o=s?D.filter(c=>c.name.toLocaleLowerCase().includes(s)):D;return n.jsxs(jt,{"aria-label":"AI 服务",children:[o.map(c=>n.jsx(en,{provider:c,selected:t===c.id,state:i[c.id]??"loading",onSelect:()=>e.selectProvider(c.id)},c.id)),o.length===0?n.jsx("p",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"没有匹配的 Provider"}):null,a?n.jsxs("p",{className:"px-3 py-2 text-xs text-destructive",children:["Provider 状态读取失败:",a]}):null]})}function en({provider:e,selected:t,state:s,onSelect:i}){const a=`ai-connection-provider-${e.id}-status`,o=nn(s);return n.jsxs(Et,{selected:t,"aria-label":e.name,"aria-describedby":a,onClick:i,className:"gap-3 py-2.5",children:[n.jsx("span",{"aria-hidden":"true",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-muted text-[10px] font-semibold text-muted-foreground",children:tn(e.id)}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.name}),n.jsx("span",{id:a,role:"status","aria-live":"polite",className:"shrink-0 text-[11px] font-normal text-muted-foreground",children:o})]})}function tn(e){switch(e){case"openai":return"OA";case"anthropic":return"A";case"kimi":return"K";case"bailian":return"百";case"deepseek":return"DS"}}function nn(e){switch(e){case"unconfigured":return"未设置";case"configured":return"已配置";case"connected":return"已连接";case"attention":return"需处理";default:return"读取中"}}const rn=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),qe=(...e)=>e.filter((t,s,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===s).join(" ").trim();var sn={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const on=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:i,className:a="",children:o,iconNode:c,...d},f)=>p.createElement("svg",{ref:f,...sn,width:t,height:t,stroke:e,strokeWidth:i?Number(s)*24/Number(t):s,className:qe("lucide",a),...d},[...c.map(([g,y])=>p.createElement(g,y)),...Array.isArray(o)?o:[o]]));const P=(e,t)=>{const s=p.forwardRef(({className:i,...a},o)=>p.createElement(on,{ref:o,iconNode:t,className:qe(`lucide-${rn(e)}`,i),...a}));return s.displayName=`${e}`,s};const an=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],cn=P("Check",an);const dn=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],un=P("Copy",dn);const ln=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],pn=P("ExternalLink",ln);const fn=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],W=P("KeyRound",fn);const mn=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],G=P("LoaderCircle",mn);const hn=[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]],yn=P("LogOut",hn);const xn=[["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m15.2 4.9-.9-.4",key:"12wd2u"}],["path",{d:"m15.2 7.1-.9.4",key:"1r2vl7"}],["path",{d:"m16.9 3.2-.4-.9",key:"3zbo91"}],["path",{d:"m16.9 8.8-.4.9",key:"1qr2dn"}],["path",{d:"m19.5 2.3-.4.9",key:"1rjrkq"}],["path",{d:"m19.5 9.7-.4-.9",key:"heryx5"}],["path",{d:"m21.7 4.5-.9.4",key:"17fqt1"}],["path",{d:"m21.7 7.5-.9-.4",key:"14zyni"}],["path",{d:"M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"1tnzv8"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}]],wn=P("MonitorCog",xn);const gn=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],bn=P("Plus",gn);const An=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],Cn=P("RefreshCcw",An);const jn=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],En=P("RotateCcw",jn);const vn=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Sn=P("RotateCw",vn);const Nn=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],In=P("Search",Nn);const kn=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],Pn=P("Trash2",kn),Se=["codex","claude-code","pi","codebuddy"],M={codex:"Codex","claude-code":"Claude Code",pi:"Pi",codebuddy:"CodeBuddy"};function Fn({bridge:e,endpoint:t,createClientCredential:s}){const[i,a]=p.useState({}),[o,c]=p.useState({}),[d,f]=p.useState({}),[g,y]=p.useState();p.useEffect(()=>{if(!e)return;let l=!0;return Promise.all(Se.map(async b=>{let h;try{h=await e.inspect(b)}catch(j){h={status:"unavailable",message:O(j)}}l&&a(j=>({...j,[b]:h}))})),()=>{l=!1}},[e]);const C=async l=>{if(e){y(l);try{const b=await e.plan({client:l,endpoint:t});c(h=>({...h,[l]:b})),f(h=>({...h,[l]:""}))}catch(b){a(h=>({...h,[l]:{status:"unavailable",message:O(b)}}))}finally{y(void 0)}}},E=async l=>{const b=o[l];if(!e||!b||!s)return;y(l);let h,j=!1;try{h=await s(l),await e.apply({client:l,planId:b.planId,apiKey:h.apiKey,...b.confirmation?.required?{confirmation:{token:b.confirmation.token,targetHash:b.confirmation.targetHash}}:{}}),j=!0;const m=await e.verify({client:l,planId:b.planId});a(x=>({...x,[l]:m})),c(x=>({...x,[l]:void 0}))}catch(m){let x=O(m);if(h&&!j)try{await h.revoke()}catch(A){x=`${x};自动撤销新建 Client Credential 失败:${O(A)}。请到 Account Developer Access 手动撤销。`}a(A=>({...A,[l]:$n(m)?{status:"failedAndRestored",message:"配置验证失败,已自动恢复原配置。"}:{status:"unavailable",message:x}}))}finally{y(void 0)}},v=async l=>{if(e){y(l);try{const b=await e.restore(l);a(h=>({...h,[l]:b}))}catch(b){a(h=>({...h,[l]:{status:"unavailable",message:O(b)}}))}finally{y(void 0)}}};return n.jsxs(De,{children:[n.jsxs(_e,{children:[n.jsxs(Le,{className:"flex items-center gap-2 text-base",children:[n.jsx(wn,{className:"h-4 w-4"}),"Developer Access"]}),n.jsxs(Re,{children:["使用 Solid Client Credentials 生成 ",n.jsx("code",{children:"sk-*"})," API Key;Provider 凭证不会离开 Pod。"]})]}),n.jsx(Me,{className:"space-y-2",children:Se.map(l=>{const b=i[l]??{status:e?"notConfigured":"unavailable",message:e?void 0:"当前 Host 不支持修改本机客户端配置。"},h=o[l],j=h?.confirmation,m=d[l]??"",x=!j?.required||m===j.token;return n.jsxs("div",{className:"space-y-3 rounded-lg border p-3",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:M[l]}),n.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:b.message??Ne(b.status)})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ue,{variant:"secondary",children:Ne(b.status)}),n.jsx(S,{variant:"outline",size:"sm",disabled:!e||!!g,onClick:()=>{C(l)},children:"配置"}),n.jsx(S,{variant:"ghost",size:"icon","aria-label":`恢复 ${M[l]} 配置`,disabled:!e||b.status==="notConfigured"||!!g,onClick:()=>{v(l)},children:n.jsx(En,{className:"h-4 w-4"})})]})]}),h?n.jsxs("div",{className:"space-y-2 rounded-md border bg-muted/20 p-3",children:[n.jsx("div",{className:"text-xs font-medium",children:"将执行以下更改"}),h.changes.map(A=>n.jsxs("div",{className:"text-xs text-muted-foreground",children:[n.jsx("span",{className:"font-mono",children:A.target})," · ",Bn(A.action),A.backup?" · 创建备份":""]},`${A.target}:${A.action}`)),j?.required?n.jsxs("div",{className:"space-y-2",children:[j.message?n.jsx("div",{className:"text-xs text-muted-foreground",children:j.message}):null,n.jsx(X,{"aria-label":`输入确认码以应用 ${M[l]} 配置`,value:m,onChange:A=>f(Y=>({...Y,[l]:A.target.value}))})]}):null,n.jsxs("div",{className:"flex gap-2",children:[n.jsx(S,{size:"sm","aria-label":j?.required?`确认并应用 ${M[l]} 配置`:`应用 ${M[l]} 配置`,disabled:!s||!!g||!x,onClick:()=>{E(l)},children:j?.required?"确认并应用":"应用更改"}),n.jsx(S,{variant:"ghost",size:"sm",disabled:!!g,onClick:()=>{c(A=>({...A,[l]:void 0})),f(A=>({...A,[l]:void 0}))},children:"取消"})]})]}):null]},l)})})]})}function Bn(e){switch(e){case"update":return"更新";case"delete":return"删除";default:return"创建或更新"}}function Ne(e){switch(e){case"configured":return"已配置";case"drifted":return"配置已变化";case"unverifiable":return"无法验证";case"failedAndRestored":return"已恢复";case"unavailable":return"当前不可用";default:return"未配置"}}function $n(e){return!!(e&&typeof e=="object"&&"code"in e&&e.code==="verification_failed_restored")}function O(e){return ae(e)}function Dn({providerName:e,quota:t,busy:s,disabled:i=!1,onRefresh:a}){return n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("div",{className:"text-sm font-medium",children:"剩余额度"}),n.jsxs(S,{variant:"ghost",size:"sm","aria-label":`刷新 ${e} 额度`,disabled:s||i,onClick:a,children:[n.jsx(Cn,{className:"mr-2 h-3.5 w-3.5"}),"刷新"]})]}),t?t.status==="unsupported"?n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-sm",children:"官方额度接口不支持"}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["来源:",t.source]})]}):t.status==="error"?n.jsx("p",{className:"text-sm text-destructive",children:"额度查询失败"}):n.jsxs("div",{className:"space-y-1 text-sm",children:[typeof t.balance=="number"?n.jsxs("div",{children:["余额:",t.balance]}):null,t.windows.map((o,c)=>n.jsxs("div",{children:[o.name?`${o.name}:`:"",typeof o.remaining=="number"?`剩余 ${o.remaining}`:"官方数据可用"]},`${String(o.name)}-${c}`)),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["来源:",t.source,t.stale?" · 数据可能已过期":""]})]}):n.jsx("p",{className:"text-xs text-muted-foreground",children:"尚未检查"})]})}function _n({definition:e,status:t,accountLabel:s,attempt:i,apiKey:a,busy:o,disabled:c=!1,error:d,quota:f,models:g,onApiKeyChange:y,onBeginApiKey:C,onBeginBrowser:E,onSaveApiKey:v,onDisconnect:l,onRefreshQuota:b}){const h=i?.mode==="browserAssistedApiKey"&&i.status==="pending",j=t==="configured",m=t==="connected";return n.jsxs("div",{children:[n.jsxs("header",{className:"flex items-start justify-between gap-4 pb-5",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"text-lg font-semibold text-foreground",children:e.name}),n.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:Ln(e.id)})]}),n.jsx(Ue,{variant:m||j?"default":"secondary",children:Rn(t)})]}),n.jsxs("section",{className:"border-t border-border/60 py-5","aria-label":"当前连接",children:[n.jsxs("div",{className:"mb-4",children:[n.jsx("h3",{className:"text-sm font-medium",children:"当前连接"}),s?n.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:Mn(s)}):n.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Provider 凭证加密保存在当前 Pod。"})]}),i?.userCode?n.jsxs("div",{className:"mb-4 border-l-2 border-primary bg-muted/30 px-3 py-2 text-sm",children:["验证码:",n.jsx("strong",{className:"font-mono",children:i.userCode})]}):null,n.jsx("div",{className:"flex flex-wrap gap-2",children:m?n.jsxs(n.Fragment,{children:[n.jsxs(S,{variant:"outline",size:"sm",disabled:o||c,onClick:E,children:[o?n.jsx(G,{className:"mr-2 h-4 w-4 animate-spin"}):n.jsx(Sn,{className:"mr-2 h-4 w-4"}),"重新连接"]}),n.jsxs(S,{variant:"ghost",size:"sm",disabled:o||c,onClick:l,children:[n.jsx(yn,{className:"mr-2 h-4 w-4"}),"断开连接"]})]}):j?n.jsxs(n.Fragment,{children:[n.jsxs(S,{variant:"outline",size:"sm","aria-label":"更新 API Key",disabled:o||c,onClick:C,children:[n.jsx(W,{className:"mr-2 h-4 w-4"}),"更新 API Key"]}),n.jsx(S,{variant:"ghost",size:"sm",disabled:o||c,onClick:l,children:"移除配置"})]}):n.jsxs(n.Fragment,{children:[n.jsxs(S,{variant:"outline",size:"sm",disabled:o||c||e.browserMode==="connectUnsupported",onClick:E,children:[o?n.jsx(G,{className:"mr-2 h-4 w-4 animate-spin"}):n.jsx(pn,{className:"mr-2 h-4 w-4"}),e.browserLabel]}),n.jsxs(S,{variant:"outline",size:"sm","aria-label":`${e.name} API Key`,disabled:o||c,onClick:C,children:[n.jsx(W,{className:"mr-2 h-4 w-4"}),"配置 API Key"]})]})}),h?n.jsxs("div",{className:"mt-4 space-y-2",children:[n.jsx(X,{type:"password",autoComplete:"off","aria-label":`${e.name} API Key 输入`,placeholder:"从官方控制台复制 API Key",value:a,onChange:x=>y(x.target.value)}),n.jsx(S,{size:"sm","aria-label":`保存 ${e.name} API Key`,disabled:!a.trim()||o||c,onClick:v,children:"保存 API Key"})]}):null,d?n.jsx("p",{className:"mt-3 text-sm text-destructive",children:d}):null]}),n.jsx("section",{className:"border-t border-border/60 py-5",children:n.jsx(Dn,{providerName:e.name,quota:f,busy:o,disabled:c,onRefresh:b})}),n.jsxs("section",{className:"border-t border-border/60 py-5",children:[n.jsx("h3",{className:"text-sm font-medium",children:"可用模型"}),g.length===0?n.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"当前身份暂无可用模型"}):n.jsx("ul",{className:"mt-3 divide-y divide-border/50 text-sm",children:g.map(x=>n.jsxs("li",{className:"flex items-center justify-between gap-4 py-2.5",children:[n.jsx("span",{children:x.displayName??x.id}),x.displayName?n.jsx("span",{className:"truncate font-mono text-xs text-muted-foreground",children:x.id}):null]},x.id))})]})]})}function Ln(e){switch(e){case"openai":return"OpenAI 模型与编码能力";case"anthropic":return"Claude 模型与编码能力";case"kimi":return"Moonshot AI 模型服务";case"bailian":return"阿里云百炼模型服务";case"deepseek":return"DeepSeek 模型服务"}}function Rn(e){switch(e){case"pending":return"连接中";case"configured":return"已配置";case"connected":return"已连接";case"disconnected":return"未设置";case"reauthRequired":return"需要重新鉴权";case"failed":return"连接失败";default:return"未检查"}}function Mn(e){const t=e.indexOf("@");if(t>0){const s=e.slice(0,t);return`${s.length>1?`${s[0]}***${s[s.length-1]}`:`${s[0]}***`}${e.slice(t)}`}return e.length<=2?`${e[0]??""}***`:`${e[0]}***${e[e.length-1]}`}const Un={};function Tn({client:e,openExternal:t=Hn,clientConfigurationBridge:s,clientCredentialManager:i,selectedProvider:a,providerSummaries:o=Un,providerLoadError:c,serviceAccessGranted:d=!1,onProviderStateChange:f}){const[g,y]=p.useState([]),[C,E]=p.useState(!!i),[v,l]=p.useState(""),[b,h]=p.useState(!1),[j,m]=p.useState(),[x,A]=p.useState(),[Y,ue]=p.useState({}),[Xe,Ye]=p.useState([]),[le,T]=p.useState({}),[pe,fe]=p.useState({}),[Ze,et]=p.useState({}),[tt,nt]=p.useState({}),[rt,me]=p.useState({}),[he,ye]=p.useState(!1),q=p.useRef(0),B=p.useCallback((r,u)=>{ue(w=>({...w,[r]:u})),f?.(r,On(u))},[f]);p.useEffect(()=>{ue(Object.fromEntries(Object.values(o).filter(qn).map(r=>[r.provider,r.status==="connected"&&r.authMode==="browserAssistedApiKey"?"configured":r.status])))},[o]),p.useEffect(()=>{let r=!0;return i?(E(!0),i.list().then(u=>{r&&y(u)}).catch(u=>{r&&A($(u))}).finally(()=>{r&&E(!1)})):(E(!1),y([])),e.listModels().then(u=>{r&&Ye(u)}).catch(u=>{r&&A($(u))}),()=>{r=!1,q.current+=1}},[e,i]);const F=(r,u)=>{et(w=>({...w,[r]:u}))},k=(r,u)=>{nt(w=>({...w,[r]:u}))},xe=p.useCallback(async r=>{const u=r.verificationUriComplete??r.authorizationUrl??r.verificationUri;u&&await t(u)},[t]),we=async r=>{if(d){F(r,!0),k(r);try{const u=await e.beginConnect(r,"browserAssistedApiKey");T(N=>({...N,[r]:u}));const w=se(u.status);if(B(r,w?"pending":u.status==="completed"?"configured":"failed"),!w&&u.status!=="completed"){k(r,u.message??Ie(u.status));return}await xe(u)}catch(u){B(r,"failed"),k(r,$(u))}finally{F(r,!1)}}},st=async r=>{if(!d||r.browserMode==="connectUnsupported")return;if(r.browserMode==="browserAssistedApiKey"){await we(r.id);return}F(r.id,!0),k(r.id);const u=q.current+1;q.current=u;try{const w=await e.beginConnect(r.id,r.browserMode);if(T(N=>({...N,[r.id]:w})),!se(w.status)){const N=w.status==="completed";B(r.id,N?"connected":"failed"),N||k(r.id,w.message??Ie(w.status)),F(r.id,!1);return}B(r.id,"pending"),await xe(w),Kn(e,r.id,w,u,q,{onAttempt:N=>T(K=>({...K,[r.id]:N})),onConnected:()=>B(r.id,"connected"),onFailed:N=>{B(r.id,"failed"),k(r.id,N)},onFinished:()=>F(r.id,!1)})}catch(w){B(r.id,"failed"),k(r.id,$(w)),F(r.id,!1)}},it=async r=>{if(!d)return;const u=pe[r.id]?.trim(),w=le[r.id];if(!(!u||!w)){F(r.id,!0),k(r.id);try{const N=await e.completeApiKey(r.id,w,u);T(K=>({...K,[r.id]:N})),fe(K=>({...K,[r.id]:""})),B(r.id,"configured")}catch(N){k(r.id,$(N)),B(r.id,"failed")}finally{F(r.id,!1)}}},ot=async r=>{if(d){F(r,!0),k(r);try{await e.disconnect(r),T(u=>({...u,[r]:void 0})),me(u=>({...u,[r]:void 0})),B(r,"disconnected")}catch(u){k(r,$(u))}finally{F(r,!1)}}},at=async r=>{F(r,!0),k(r);try{const u=await e.quota(r,!0);me(w=>({...w,[r]:u}))}catch(u){k(r,$(u))}finally{F(r,!1)}},ct=async()=>{if(!(!d||!i)){h(!0),A(void 0),m(void 0);try{const r=await i.create({name:v.trim()||"AI Connection",webId:e.webId});m({clientId:r.clientId,clientSecret:r.clientSecret,apiKey:r.apiKey}),y(u=>[r,...u.filter(w=>w.resourceUrl!==r.resourceUrl)]),l("")}catch(r){A($(r))}finally{h(!1)}}},dt=async r=>{if(!(!d||!i)){A(void 0);try{await i.revoke(r.resourceUrl),y(u=>u.filter(w=>w.resourceUrl!==r.resourceUrl))}catch(u){A($(u))}}},ut=async()=>{j&&(await navigator.clipboard?.writeText(j.apiKey),ye(!0))},lt=p.useCallback(async r=>{if(!d)throw new Error("AI Connection service access is not granted");if(!i)throw new Error("Client Credentials are not available in this host");const u=await i.create({name:`AI Connection · ${M[r]}`,webId:e.webId});return y(w=>[u,...w.filter(N=>N.resourceUrl!==u.resourceUrl)]),{apiKey:u.apiKey,revoke:async()=>{await i.revoke(u.resourceUrl),y(w=>w.filter(N=>N.resourceUrl!==u.resourceUrl))}}},[e.webId,i,d]);return n.jsxs("div",{className:"mx-auto w-full max-w-3xl px-6 py-6",children:[n.jsxs("section",{children:[c?n.jsxs("p",{className:"mb-4 rounded-md border border-destructive/30 px-3 py-2 text-sm text-destructive",children:["Provider 状态读取失败:",c]}):null,D.filter(r=>r.id===(a??"openai")).map(r=>n.jsx(_n,{definition:r,status:Y[r.id]??"unknown",accountLabel:o[r.id]?.accountLabel,attempt:le[r.id],apiKey:pe[r.id]??"",busy:!!Ze[r.id],disabled:!d,error:tt[r.id],quota:rt[r.id],models:Xe.filter(u=>u.provider===r.id),onApiKeyChange:u=>fe(w=>({...w,[r.id]:u})),onBeginApiKey:()=>{we(r.id)},onBeginBrowser:()=>{st(r)},onSaveApiKey:()=>{it(r)},onDisconnect:()=>{ot(r.id)},onRefreshQuota:()=>{at(r.id)}},r.id))]}),n.jsxs("details",{className:"border-t border-border/60 py-5",children:[n.jsx("summary",{className:"cursor-pointer list-none text-sm font-medium",children:"客户端接入"}),n.jsxs("div",{className:"mt-4 space-y-6",children:[n.jsx(Fn,{bridge:s,endpoint:e.apiBase,createClientCredential:lt}),n.jsxs("details",{className:"border-t border-border/60 pt-4",children:[n.jsx("summary",{className:"cursor-pointer text-sm font-medium text-muted-foreground",children:"Client Credentials"}),n.jsx("div",{className:"mt-3",children:n.jsxs(De,{children:[n.jsxs(_e,{children:[n.jsxs(Le,{className:"flex items-center gap-2 text-base",children:[n.jsx(W,{className:"h-4 w-4"}),"Client Credentials"]}),n.jsxs(Re,{children:["为 Codex、Claude Code、Pi、CodeBuddy 创建 Solid Client Credentials。API Key 为 ",n.jsx("code",{children:"sk-base64(client_id:client_secret)"}),",只在创建后显示一次。"]})]}),n.jsxs(Me,{className:"space-y-4",children:[i?null:n.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4 text-sm text-muted-foreground",children:["当前 Host 没有提供 account-controls Client Credentials capability。",n.jsx("a",{className:"ml-1 underline",href:"/.account/",children:"打开 Account Developer Access"})," ","手动创建 API Key。"]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(X,{"aria-label":"Client Credential 名称",placeholder:"名称,例如 Codex",value:v,onChange:r=>l(r.target.value)}),n.jsxs(S,{onClick:()=>{ct()},disabled:b||!d||!i,children:[b?n.jsx(G,{className:"mr-2 h-4 w-4 animate-spin"}):n.jsx(W,{className:"mr-2 h-4 w-4"}),"创建 Client Credential"]})]}),j?n.jsxs("div",{className:"space-y-3 rounded-lg border border-amber-500/30 bg-amber-500/5 p-4",children:[n.jsx("p",{className:"text-sm font-medium",children:"请立即保存;关闭后无法再次查看。"}),n.jsxs("div",{className:"space-y-2 rounded bg-background p-3 text-xs",children:[n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground",children:"Client ID: "}),n.jsx("code",{children:j.clientId})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground",children:"Client Secret: "}),n.jsx("code",{children:j.clientSecret})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-muted-foreground",children:"API Key: "}),n.jsx("code",{children:j.apiKey})]})]}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsxs(S,{variant:"outline",size:"sm",onClick:()=>{ut()},children:[he?n.jsx(cn,{className:"mr-2 h-4 w-4"}):n.jsx(un,{className:"mr-2 h-4 w-4"}),he?"已复制":"复制 API Key"]}),n.jsx(S,{size:"sm",onClick:()=>{m(void 0),ye(!1)},children:"我已保存,隐藏密钥"})]})]}):null,x?n.jsx("p",{className:"text-sm text-destructive",children:x}):null,C?n.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[n.jsx(G,{className:"h-4 w-4 animate-spin"}),"正在读取 Client Credentials"]}):g.length===0?n.jsx("p",{className:"text-sm text-muted-foreground",children:"尚未创建 Client Credential。"}):n.jsx("div",{className:"space-y-2",children:g.map(r=>n.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border p-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"truncate text-sm font-medium",children:r.id}),n.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:r.webId??e.webId})]}),n.jsx(S,{variant:"ghost",size:"icon","aria-label":`撤销 ${r.id}`,disabled:!d||!i,onClick:()=>{dt(r)},children:n.jsx(Pn,{className:"h-4 w-4"})})]},r.resourceUrl))})]})]})})]})]})]})]})}async function Kn(e,t,s,i,a,o){let c=s;try{for(;a.current===i&&se(c.status);){if(await zn(Math.max(1,c.intervalSeconds??2)*1e3),a.current!==i)return;c=await e.pollDevice(t,c),o.onAttempt(c)}c.status==="completed"?o.onConnected():a.current===i&&o.onFailed(c.message||`连接${c.status==="expired"?"已过期":"失败"}`)}catch(d){a.current===i&&o.onFailed($(d))}finally{a.current===i&&o.onFinished()}}function se(e){return e==="pending"||e==="authorization_pending"||e==="slow_down"}function Ie(e){return e==="expired"?"连接已过期,请重新开始":e==="cancelled"?"连接已取消":e==="unsupported"?"当前 Provider 不支持此连接方式":"连接失败"}function On(e){return e==="configured"?"configured":e==="connected"?"connected":e==="failed"||e==="reauthRequired"?"attention":e==="pending"?"loading":"unconfigured"}function Hn(e){window.open(e,"_blank","noopener,noreferrer")}function zn(e){return new Promise(t=>window.setTimeout(t,e))}function $(e){return ae(e)}function qn(e){return e!==void 0}function Vn({controller:e}){const t=de(e),s=Jt(e),i=ze(e),a=Wt(e),o=D.find(c=>c.id===t);if(!e.client){const c=e.sessionStatus==="expired",d=e.sessionStatus==="authenticating"||e.podStatus==="opening",f=e.error??(e.sessionStatus==="authenticated"&&e.podStatus!=="ready"?new Error("当前 Pod 尚未就绪"):void 0);return d?n.jsx("section",{"aria-label":"AI Connection",className:"space-y-3 p-6",children:n.jsx("p",{role:"status",children:"正在打开当前 Pod..."})}):f?n.jsxs("section",{"aria-label":"AI Connection",className:"space-y-3 p-6",children:[n.jsx("p",{className:"text-sm text-destructive",children:f.message}),n.jsx(S,{size:"sm",onClick:()=>{e.login()},children:"重试登录"})]}):n.jsxs("section",{"aria-label":"AI Connection",className:"space-y-3 p-6",children:[n.jsx("p",{children:c?"当前登录已过期,请重新登录后继续。":"登录后即可管理当前 Pod 的 AI 连接。"}),n.jsx(S,{size:"sm",onClick:()=>{e.login()},children:c?"重新登录":"登录"})]})}return n.jsxs("section",{role:"region","aria-label":`${o?.name??t} 详情`,children:[n.jsx("p",{className:"px-6 pt-4 text-xs text-muted-foreground",role:"status",children:Qn(a)}),n.jsx(Tn,{client:e.client,selectedProvider:t,openExternal:e.openExternal,clientConfigurationBridge:e.clientConfigurationBridge,clientCredentialManager:e.clientCredentialManager,providerSummaries:s,providerLoadError:i,serviceAccessGranted:a==="granted",onProviderStateChange:e.setProviderState})]})}function Qn(e){return e==="granted"?"服务访问已授权":e==="checking"?"服务访问检查中":"服务访问未授权"}function Jn({controller:e}){const t=He(e);return n.jsxs("div",{className:"flex h-full min-w-0 items-center gap-2 px-3",children:[n.jsxs("div",{className:"relative min-w-0 flex-1",children:[n.jsx(In,{"aria-hidden":"true",className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),n.jsx(X,{type:"search","aria-label":"搜索 Provider",placeholder:"搜索 Provider",value:t,onChange:s=>e.setSearchQuery(s.target.value),className:"h-8 border-transparent bg-muted/50 pl-8 text-xs focus-visible:bg-background"})]}),n.jsx(S,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0","aria-label":"添加 AI Connection",title:"添加 AI Connection",onClick:()=>e.selectFirstUnconfiguredProvider(),children:n.jsx(bn,{className:"h-4 w-4","aria-hidden":"true"})})]})}function Wn({controller:e}){const t=de(e),s=D.find(i=>i.id===t);return n.jsx("div",{className:"flex h-full min-w-0 items-center px-4",children:n.jsx("h1",{className:"truncate text-sm font-medium text-foreground",children:s?.name??t})})}const Gn=["navigation.openExternal","aiClientConfiguration"];function Xn(e){const t=te(e,"Extension manifest");ke(t.extensionId,"extensionId"),U(t.name,"name"),U(t.version,"version"),U(t.sdkVersion,"sdkVersion");const s=te(t.contributes,"contributes");if(!Array.isArray(s.applets)||s.applets.length===0)throw new Error("Extension manifest must contribute at least one Applet");const i=new Set;for(const a of s.applets){const o=te(a,"Applet manifest"),c=ke(o.appId,"appId");if(i.has(c))throw new Error(`Extension manifest has duplicate appId: ${c}`);if(i.add(c),U(o.name,"Applet name"),U(o.entry,"Applet entry"),!Array.isArray(o.commands))throw new Error("Applet commands must be an array");if(o.layout!=="single-pane"&&o.layout!=="two-pane")throw new Error("Applet layout must be single-pane or two-pane")}if(!Array.isArray(t.dataModels))throw new Error("Extension dataModels must be an array");if(!Array.isArray(t.hostCapabilities))throw new Error("Extension hostCapabilities must be an array");for(const a of t.hostCapabilities)if(!Gn.includes(a))throw new Error(`Extension manifest requested unknown Host capability: ${String(a)}`);return e}function te(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object`);return e}function U(e,t){if(typeof e!="string"||e.trim().length===0)throw new Error(`${t} must be a non-empty string`);return e}function ke(e,t){const s=U(e,t);let i;try{i=new URL(s)}catch{throw new Error(`${t} must be a valid HTTPS URL`)}if(i.protocol!=="https:")throw new Error(`${t} must be a valid HTTPS URL`);return s}const Ve=Xn({extensionId:"https://undefineds.co/extensions/ai-connection",name:"AI Connection",version:"0.1.0",sdkVersion:"1",contributes:{applets:[{appId:"https://undefineds.co/applets/ai-connection",name:"AI Connection",entry:".",commands:[],layout:"two-pane"}]},dataModels:[],hostCapabilities:["navigation.openExternal","aiClientConfiguration"]}),Qe=Ve.contributes.applets[0],Yn={manifest:Qe,createController:qt,activate(e){e.ensureServiceAccess()},slots:{listHeader:Jn,list:Zt,mainHeader:Wn,main:Vn}},Zn={manifest:Ve,applets:{[Qe.appId]:Yn}};function er(){return Zn}const tr=3e4;function nr({podUrl:e,authenticatedFetch:t,now:s=()=>new Date}){const i=oe(e);let a,o;const c=async(y,C)=>{const E=await t(y,C);return a=await ir(E.clone()),E},d=async()=>{if(or(a,s()))return a;if(o)return o;o=f();try{return await o}finally{o=void 0}},f=async()=>{if(!(await c(`${i}/api/applets/service-access/ai-connection`,{method:"GET",credentials:"include",headers:{accept:"application/json"}})).ok)throw new Error("AI Connection request failed. Please try again.");const C=a;if(!C?.token)throw new Error("AI Connection request failed. Please try again.");return C},g=async(y,C)=>{const E=await d(),v=ar(E);if(!v)throw new Error("AI Connection request failed. Please try again.");const l=new Headers(C?.headers);return l.set("Authorization",`Bearer ${v}`),t(y,{...C,credentials:"omit",headers:l})};return(async(y,C)=>{if(sr(y,i))return c(y,C);const E=await g(y,C);if(E.status!==401)return Pe(E);await E.arrayBuffer(),a=void 0;const v=await g(y,C);return Pe(v)})}function rr({podUrl:e,authenticatedFetch:t,now:s}){const i=oe(e),a=nr({podUrl:e,authenticatedFetch:t,now:s});return{inspect:async o=>{const c=await a(H(i,o),{method:"GET",credentials:"omit",headers:{accept:"application/json"}});return c.status===403||c.status===404||c.status===503?(await c.arrayBuffer(),Fe()):z(c)},plan:async o=>z(await a(`${H(i,o.client)}/plan`,{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({endpoint:o.endpoint})})),apply:async o=>z(await a(`${H(i,o.client)}/apply`,{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({planId:o.planId,apiKey:o.apiKey,confirmation:o.confirmation})})),verify:async o=>z(await a(`${H(i,o.client)}/verify`,{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({planId:o.planId})})),restore:async o=>{const c=await a(`${H(i,o)}/restore`,{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({})});return c.status===403||c.status===404||c.status===503?(await c.arrayBuffer(),Fe()):z(c)}}}function sr(e,t){try{return new URL(String(e),t).pathname==="/api/applets/service-access/ai-connection"}catch{return!1}}async function ir(e){if(!(!e.ok||!e.headers.get("content-type")?.includes("application/json")))try{const t=await e.json();return cr(t.invocation)}catch{return}}function or(e,t){if(!e?.token)return!1;if(!e.expiresAt)return!0;const s=Date.parse(e.expiresAt);return Number.isFinite(s)&&s-t.getTime()>tr}function ar(e){return e?.token}function cr(e){if(!Je(e))return;const t=["gateway","Key"].join("");return{token:typeof e.token=="string"?e.token:typeof e[t]=="string"?e[t]:void 0,baseUrl:typeof e.baseUrl=="string"?e.baseUrl:void 0,expiresAt:typeof e.expiresAt=="string"?e.expiresAt:void 0}}async function Pe(e){return e.ok?e:e.headers.get("content-type")?.includes("application/json")?ur(e):(await e.arrayBuffer(),new Response(JSON.stringify({error:"internal_error"}),{status:e.status,statusText:e.statusText,headers:{"content-type":"application/json"}}))}function H(e,t){return`${e}/api/ai/client-configuration/${encodeURIComponent(t)}`}async function z(e){if(!e.ok)throw await dr(e);if(!e.headers.get("content-type")?.includes("application/json"))throw await e.arrayBuffer(),new Error("AI client configuration request failed. Please try again.");return await e.json()}async function dr(e){let t;try{t=e.headers.get("content-type")?.includes("application/json")?await e.json():void 0}catch{t=void 0}if(Je(t)){const s=typeof t.code=="string"?t.code:typeof t.error=="string"?t.error:void 0,i=typeof t.message=="string"?t.message:"AI client configuration request failed. Please try again.",a=new Error(i);return a.code=s,a.status=e.status,a.details=t.details,a}return await e.arrayBuffer().catch(()=>{}),new Error("AI client configuration request failed. Please try again.")}function Fe(){return{status:"unavailable",message:"Host does not support local client configuration. Use the manual setup instructions for your client."}}async function ur(e){let t;try{t=await e.clone().json()}catch{return e}return lr(t)?new Response(JSON.stringify({code:t.error.code,error:t.error.message}),{status:e.status,statusText:e.statusText,headers:{"content-type":"application/json"}}):e}function lr(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e.error;return!!(t&&typeof t=="object"&&!Array.isArray(t)&&typeof t.code=="string"&&typeof t.message=="string"&&typeof t.status=="number")}function Je(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function pr(e,t){return`sk-${btoa(`${e}:${t}`)}`}function fr(e,t,s=fetch){if(!e||!t)return;const i=new Set;return{available:!0,accountUrl:"/.account/",async list(){const a=await s(e,{method:"GET",headers:Z({Accept:"application/json"}),credentials:"include"});if(!a.ok)throw new Error("Failed to list Client Credentials");const o=await a.json(),c=mr(o.clientCredentials).filter(d=>d.webId===t);for(const d of c)i.add(d.resourceUrl);return c},async create(a){if(a.webId!==t)throw new Error("Cannot create a Client Credential for another WebID");const o=await s(e,{method:"POST",headers:Z({Accept:"application/json","Content-Type":"application/json"}),credentials:"include",body:JSON.stringify({name:a.name,webId:a.webId})});if(!o.ok)throw new Error("Failed to create Client Credential");const c=await o.json(),d=hr(c,a.webId,e);return i.add(d.resourceUrl),d},async revoke(a){if(!i.has(a))throw new Error("Cannot revoke a Client Credential outside the current WebID");if(!(await s(a,{method:"DELETE",headers:Z({Accept:"application/json"}),credentials:"include"})).ok)throw new Error("Failed to revoke Client Credential")}}}function mr(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Object.entries(e).map(([t,s])=>({id:yr(t),resourceUrl:t,webId:typeof s=="string"?s:void 0}))}function hr(e,t,s){if(!e.id||!e.secret)throw new Error("Client Credential response did not include the one-time secret");const i=e.resourceUrl??new URL(`${encodeURIComponent(e.id)}/`,s).href;return{id:e.id,resourceUrl:i,webId:e.webId??t,clientId:e.id,clientSecret:e.secret,apiKey:pr(e.id,e.secret)}}function yr(e){try{const t=new URL(e).pathname.split("/").filter(Boolean);return t[t.length-1]??e}catch{return e.split("/").filter(Boolean).pop()??e}}const We=er(),Be=We.manifest.contributes.applets[0]?.appId,Ge=Be?We.applets[Be]:void 0;if(!Ge)throw new Error("AI Connection extension did not contribute an applet");const xr=Ge;function wr(e,t,s=fetch){const i=e.currentPod?{status:"ready",current:e.currentPod}:e.state.status==="authenticated"?{status:"opening"}:e.state.status==="error"?{status:"error",error:e.state.error}:{status:"unavailable"};return{solid:{session:{getSnapshot:e.session.getSnapshot,subscribe:e.session.subscribe,fetch:e.fetch},pod:i,permissions:{inspectAgentAccess:async a=>({status:"granted",resources:a.resources}),ensureAgentAccess:async a=>({status:"granted",resources:a.resources}),revokeAgentAccess:async a=>({status:"missing",resources:a.resources})},requireLogin:async()=>e.login(window.location.origin)},navigation:{openExternal:async a=>{window.open(a,"_blank","noopener,noreferrer")}},capabilities:{aiClientConfiguration:e.currentPod&&e.aiClientConfiguration?.available===!0&&e.aiClientConfiguration.authority==="local-filesystem"?rr({podUrl:e.currentPod.podUrl,authenticatedFetch:e.fetch}):gr,aiClientCredentials:fr(t,e.webId,s)}}}const gr={inspect:async()=>({status:"unavailable",message:"Host does not support local client configuration. Use the manual setup instructions for your client."}),plan:async()=>{throw new Error("Host does not support local client configuration. Use the manual setup instructions for your client.")},apply:async()=>{throw new Error("Host does not support local client configuration. Use the manual setup instructions for your client.")},verify:async()=>({status:"unavailable",message:"Host does not support local client configuration. Use the manual setup instructions for your client."}),restore:async()=>({status:"unavailable",message:"Host does not support local client configuration. Use the manual setup instructions for your client."})};function br(e,t){const s=p.useMemo(()=>wr(e,t),[t,e]);return p.useMemo(()=>{const i=yt(xr,s);if(i.layout!=="two-pane")throw new Error("AI Connection applet must use a two-pane layout");return i},[s])}function Er(){const e=pt(),t=br(e,e.accountClientCredentialsUrl);return p.useEffect(()=>{t.controller.ensureServiceAccess()},[t.controller]),n.jsx(ft,{listHeader:t.slots.listHeader,list:t.slots.list,mainHeader:t.slots.mainHeader,main:t.slots.main,mode:"auto"})}export{Er as default};
@@ -1 +1 @@
1
- import{b as e,j as s}from"./settings-yUyFIJxi.js";const a=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],r=e("database",a);const o=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],n=e("refresh-cw",o);function d({title:t}){return s.jsx("div",{className:"flex h-full items-center px-4 text-sm font-semibold text-foreground",children:t})}export{r as D,d as P,n as R};
1
+ import{b as e,j as s}from"./settings-BN7FyntE.js";const a=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],r=e("database",a);const o=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],n=e("refresh-cw",o);function d({title:t}){return s.jsx("div",{className:"flex h-full items-center px-4 text-sm font-semibold text-foreground",children:t})}export{r as D,d as P,n as R};
@@ -1,2 +1,2 @@
1
- import{b as p,e as _,r as d,j as e,B as f}from"./settings-yUyFIJxi.js";import{P as $,D as A,R as E}from"./PaneListHeader-BtON8Z5Q.js";import{T as H}from"./workspace-layout-B0wJpPze.js";import{C as b,a as j,b as v,c as y,d as N,B as z}from"./card-CCGngjas.js";const D=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],T=p("external-link",D);const K=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],V=p("log-in",K);const F=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],O=p("log-out",F);const G=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],W=p("shield-check",G);async function X({webId:t,podUrl:s,authenticatedFetch:a}){const n=new URL("/",s).origin,i=await a(`${n}/api/pod/settings/status`,{method:"GET",credentials:"include",headers:{accept:"application/json"}});if(!i.ok)throw await i.arrayBuffer(),new Error("Pod settings request failed. Please try again.");if(!i.headers.get("content-type")?.includes("application/json"))throw await i.arrayBuffer(),new Error("Pod settings request failed. Please try again.");const o=await i.json();if(o.identity?.webId!==t)throw new Error("Pod settings response does not match the current Solid session.");return o}function ne({view:t="combined"}){const s=_(),[a,n]=d.useState(),[i,o]=d.useState(),[l,c]=d.useState(!1),u=d.useRef(0),P=d.useRef(void 0),w=d.useRef(!0),m=s.state.status==="authenticated"&&!!(s.webId&&s.podUrl)?`${s.webId}
1
+ import{b as p,e as _,r as d,j as e,B as f}from"./settings-BN7FyntE.js";import{P as $,D as A,R as E}from"./PaneListHeader-DTVY4Ig2.js";import{T as H}from"./workspace-layout-jzYHoh3_.js";import{C as b,a as j,b as v,c as y,d as N,B as z}from"./card-BZF0jSa_.js";const D=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],T=p("external-link",D);const K=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],V=p("log-in",K);const F=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],O=p("log-out",F);const G=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],W=p("shield-check",G);async function X({webId:t,podUrl:s,authenticatedFetch:a}){const n=new URL("/",s).origin,i=await a(`${n}/api/pod/settings/status`,{method:"GET",credentials:"include",headers:{accept:"application/json"}});if(!i.ok)throw await i.arrayBuffer(),new Error("Pod settings request failed. Please try again.");if(!i.headers.get("content-type")?.includes("application/json"))throw await i.arrayBuffer(),new Error("Pod settings request failed. Please try again.");const o=await i.json();if(o.identity?.webId!==t)throw new Error("Pod settings response does not match the current Solid session.");return o}function ne({view:t="combined"}){const s=_(),[a,n]=d.useState(),[i,o]=d.useState(),[l,c]=d.useState(!1),u=d.useRef(0),P=d.useRef(void 0),w=d.useRef(!0),m=s.state.status==="authenticated"&&!!(s.webId&&s.podUrl)?`${s.webId}
2
2
  ${s.podUrl}`:void 0;d.useEffect(()=>(w.current=!0,()=>{w.current=!1,u.current+=1}),[]);const k=d.useCallback(async()=>{const h=s.webId,B=s.podUrl,L=m;if(!h||!B||!L)return;const U=u.current+1;u.current=U;const I=()=>w.current&&u.current===U&&P.current===L;c(!0),o(void 0);try{const q=await X({webId:h,podUrl:B,authenticatedFetch:s.fetch});I()&&n(q)}catch{I()&&o("Pod settings request failed. Please try again.")}finally{I()&&c(!1)}},[m,s.fetch,s.podUrl,s.webId]);d.useEffect(()=>{let h=!1;return P.current=m,u.current+=1,queueMicrotask(()=>{h||(n(void 0),o(void 0),c(!1),m&&k())}),()=>{h=!0}},[m,k]);const x=d.useMemo(()=>({webId:s.webId??a?.identity.webId,podUrl:s.podUrl??a?.identity.podUrl,issuer:s.issuer}),[s.issuer,s.podUrl,s.webId,a]),M=()=>{x.podUrl&&window.open(x.podUrl,"_blank","noopener,noreferrer")},R=()=>{s.issuer&&s.login(s.issuer)};return e.jsx(H,{mode:"auto",listHeader:e.jsx($,{title:t==="usage"?"Usage":"Pod"}),list:e.jsxs("aside",{className:"flex h-full flex-col gap-3 border-r border-border bg-muted/30 p-4",children:[t!=="usage"?e.jsx(J,{webId:x.webId,podUrl:x.podUrl,issuer:x.issuer,sessionStatus:s.state.status,onOpenPod:M,onLogout:()=>{s.logout()},onLoginAgain:R,canLoginAgain:!!s.issuer}):null,t!=="settings"?e.jsx(Q,{storage:a?.storage,loading:l&&!a}):null]}),mainHeader:e.jsx(Z,{title:t==="usage"?"Usage":"Pod",loading:l,onRefresh:k}),main:e.jsxs("section",{className:"flex min-h-full flex-col gap-4 bg-background p-6",children:[i?e.jsx("div",{role:"alert",className:"rounded-md border border-destructive/30 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:i}):null,e.jsx(Y,{aiConnection:a?.aiConnection,loading:l&&!a}),e.jsxs(b,{children:[e.jsxs(j,{children:[e.jsxs(v,{className:"flex items-center gap-2 text-base",children:[e.jsx(W,{className:"h-4 w-4","aria-hidden":"true"}),"Access boundary"]}),e.jsx(y,{children:"This page reads the authenticated Solid session and current Pod only."})]}),e.jsxs(N,{className:"grid gap-3 text-sm text-muted-foreground",children:[e.jsx(r,{label:"Session",value:s.state.status}),e.jsx(r,{label:"Status generated",value:S(a?.generatedAt)})]})]})]}),className:"min-h-full"})}function J({webId:t,podUrl:s,issuer:a,sessionStatus:n,onOpenPod:i,onLogout:o,onLoginAgain:l,canLoginAgain:c}){return e.jsxs(b,{children:[e.jsxs(j,{children:[e.jsx(v,{className:"text-base",children:"Identity"}),e.jsx(y,{children:"Current Solid session"})]}),e.jsxs(N,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(r,{label:"WebID",value:t??"Not signed in"}),e.jsx(r,{label:"Pod",value:s??"Discovering"}),e.jsx(r,{label:"Issuer",value:a??"Unknown"}),e.jsx(r,{label:"Status",value:n})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(f,{type:"button",size:"sm",variant:"outline",onClick:i,disabled:!s,children:[e.jsx(T,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"Open Pod"]}),e.jsxs(f,{type:"button",size:"sm",variant:"subtle",onClick:o,children:[e.jsx(O,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"Logout"]}),e.jsxs(f,{type:"button",size:"sm",variant:"ghost",onClick:l,disabled:!c,children:[e.jsx(V,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"Login again"]})]})]})]})}function Q({storage:t,loading:s}){const a=t?.status==="available",n=a&&t.limits.storageLimitBytes?Math.min(100,Math.round(t.usage.storageBytes/t.limits.storageLimitBytes*100)):void 0;return e.jsxs(b,{children:[e.jsxs(j,{children:[e.jsxs(v,{className:"flex items-center gap-2 text-base",children:[e.jsx(A,{className:"h-4 w-4","aria-hidden":"true"}),"Storage usage"]}),e.jsx(y,{children:s?"Refreshing usage":"Current Pod quota view"})]}),e.jsx(N,{className:"space-y-4",children:a?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-semibold text-foreground",children:g(t.usage.storageBytes)}),e.jsx("div",{className:"text-sm text-muted-foreground",children:t.limits.storageLimitBytes==null?"No storage limit":`${g(t.limits.storageLimitBytes)} limit`})]}),e.jsx("div",{className:"h-2 overflow-hidden rounded-full bg-muted","aria-label":"Storage usage meter",children:e.jsx("div",{className:"h-full bg-primary",style:{width:`${n??0}%`}})}),e.jsxs("div",{className:"grid gap-2 text-sm text-muted-foreground",children:[e.jsx(r,{label:"Ingress",value:g(t.usage.ingressBytes)}),e.jsx(r,{label:"Egress",value:g(t.usage.egressBytes)}),e.jsx(r,{label:"Bandwidth",value:t.limits.bandwidthLimitBps==null?"No limit":`${g(t.limits.bandwidthLimitBps)}/s`})]})]}):e.jsx(C,{title:t?.status==="error"?"Usage unavailable":"Usage unsupported",detail:t?.reason??"usage_not_available"})})]})}function Y({aiConnection:t,loading:s}){const a=t?.status==="available";return e.jsxs(b,{children:[e.jsx(j,{children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(v,{className:"text-base",children:"AI Connection"}),e.jsx(y,{children:"Pod-backed provider configuration status"})]}),e.jsx(z,{variant:a?"secondary":"outline",children:a?"Available":s?"Loading":"Partial"})]})}),e.jsx(N,{className:"space-y-4",children:a?e.jsxs("div",{className:"grid gap-3 text-sm",children:[e.jsx(r,{label:"Providers",value:`${t.configuredProviders} providers`}),e.jsx(r,{label:"Data container",value:t.containerUrl??"Not declared"}),e.jsx(r,{label:"Last sync",value:S(t.lastSyncAt)}),e.jsx(r,{label:"Source",value:t.source??"drizzle-solid"})]}):e.jsx(C,{title:t?.status==="error"?"AI Connection unavailable":"AI Connection unsupported",detail:t?.reason??"not_configured"})})]})}function Z({title:t,loading:s,onRefresh:a}){return e.jsxs("div",{className:"flex h-full min-w-0 items-center justify-between gap-4 px-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold text-foreground",children:t}),e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"Identity, storage, and applet data status"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("a",{className:"inline-flex h-9 items-center justify-center rounded-md border border-input bg-background px-3 text-sm font-medium text-foreground hover:bg-accent",href:t==="Usage"?"/settings/pod":"/dashboard/usage",children:t==="Usage"?"Configure Pod":"View usage"}),e.jsxs(f,{type:"button",size:"sm",variant:"outline",onClick:a,disabled:s,children:[e.jsx(E,{className:"mr-2 h-4 w-4","aria-hidden":"true"}),"Refresh"]})]})]})}function r({label:t,value:s}){return e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:t}),e.jsx("div",{className:"break-words text-sm text-foreground",children:s??"Unknown"})]})}function C({title:t,detail:s}){return e.jsxs("div",{className:"rounded-md border border-border bg-muted/40 p-3",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:t}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:s})]})}function g(t){if(!Number.isFinite(t))return"Unknown";const s=["B","KB","MB","GB","TB"];let a=Math.max(0,t),n=0;for(;a>=1024&&n<s.length-1;)a/=1024,n+=1;return`${Number.isInteger(a)?a:a.toFixed(a>=10?1:2)} ${s[n]}`}function S(t){if(!t)return"Not observed";const s=new Date(t);return Number.isNaN(s.getTime())?"Not observed":s.toLocaleString()}export{J as IdentityCard,Q as PodUsageCard,ne as default};
@@ -1 +1 @@
1
- import{b as j,r as n,j as e,O as R,u as k,d as y,S as C,N as L}from"./settings-yUyFIJxi.js";import{f as M,S as I}from"./services-status-context-CBfImxL_.js";import{D as P,P as D,R as _}from"./PaneListHeader-BtON8Z5Q.js";import{T as A,u as w}from"./workspace-layout-B0wJpPze.js";const E=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],H=j("activity",E);const z=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],q=j("scroll-text",z);const $=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],V=j("settings",$),F=[{id:"runtime",label:"Runtime",path:"/services/runtime",description:"Xpod runtime, Solid server, AI Gateway, storage, and worker health.",icon:H},{id:"logs",label:"Logs",path:"/services/logs",description:"Runtime logs and sanitized diagnostics export.",icon:q},{id:"rdf",label:"RDF",path:"/services/rdf",description:"RDF indexing, storage stats, cache health, and slow query evidence.",icon:P},{id:"configuration",label:"Configuration",path:"/services/configuration",description:"Advanced local runtime configuration and restart-controlled changes.",icon:V}],S={supported:!1,reason:"capability_not_reported"};function K({mode:a="auto",product:s="legacy"}){const[r,i]=n.useState(null),[c,l]=n.useState(!0),[f,x]=n.useState(!1),[t,g]=n.useState(),o=n.useRef(0),d=n.useRef(null),u=n.useRef(!1),h=n.useCallback(async(m=!1)=>{const b=o.current+1;o.current=b,d.current?.abort();const p=new AbortController;d.current=p,m?l(!0):x(!0),g(void 0);try{const v=await M({signal:p.signal});u.current&&o.current===b&&!p.signal.aborted&&i(v)}catch(v){u.current&&o.current===b&&!p.signal.aborted&&!(v instanceof DOMException&&v.name==="AbortError")&&g("Services status request failed. Please try again.")}finally{u.current&&o.current===b&&!p.signal.aborted&&(l(!1),x(!1))}},[]);n.useEffect(()=>{u.current=!0,queueMicrotask(()=>{u.current&&h(!0)});const m=setInterval(()=>{h(!1)},1e4);return()=>{u.current=!1,o.current+=1,d.current?.abort(),d.current=null,clearInterval(m)}},[h]);const N=n.useMemo(()=>{const m=r?.adminData?.capabilities?.services;return{snapshot:r,loading:c,refreshing:f,error:t,refresh:()=>{h(!1)},restartCapability:m?.lifecycle?.restart??S,configurationWriteCapability:m?.configuration?.write??S}},[t,h,c,f,r]);return e.jsx(I.Provider,{value:N,children:e.jsx(A,{mode:a,listHeader:e.jsx(D,{title:"Services"}),list:e.jsx(W,{snapshot:r,loading:c&&!r,showSections:s==="legacy"}),mainHeader:e.jsx(T,{product:s,loading:c||f,onRefresh:N.refresh}),main:e.jsxs("section",{className:"min-h-full min-w-0 bg-background",children:[e.jsx(O,{}),t?e.jsx("div",{role:"alert",className:"mx-6 mt-6 rounded-md border border-destructive/30 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:t}):null,e.jsx(R,{})]}),className:"min-h-full"})})}function O(){const a=k(),s=w(),r=n.useRef(null),i=a.pathname.replace(/\/+$/,"")||"/services";return n.useEffect(()=>{if(r.current!==i){if(r.current=i,i==="/services"){s.openList();return}s.openMain()}},[i,s]),null}function T({product:a,loading:s,onRefresh:r}){return e.jsxs("div",{className:"flex h-full min-w-0 items-center justify-between gap-4 px-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Services"}),e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"Runtime health, logs, RDF indexing, and configuration"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[a!=="legacy"?e.jsx("a",{className:"inline-flex h-9 items-center justify-center rounded-md border border-input bg-background px-3 text-sm font-medium text-foreground hover:bg-accent",href:a==="dashboard"?"/settings/services":"/dashboard/runtime",children:a==="dashboard"?"Configure":"View runtime"}):null,e.jsxs("button",{type:"button",onClick:r,disabled:s,className:"inline-flex h-9 items-center justify-center rounded-md border border-input bg-background px-3 text-sm font-medium text-foreground transition-colors hover:bg-accent disabled:pointer-events-none disabled:opacity-50",children:[e.jsx(_,{className:y("mr-2 h-4 w-4",s&&"animate-spin"),"aria-hidden":"true"}),"Refresh"]})]})]})}function W({snapshot:a,loading:s,showSections:r}){const i=k(),c=w(),l=a?.servicesData??[],f=l.filter(t=>t.status==="running").length,x=l.length;return e.jsxs("aside",{className:"flex h-full flex-col gap-4 border-r border-border bg-muted/30 p-4",children:[e.jsxs("div",{className:"rounded-md border border-border bg-card",children:[e.jsxs("div",{className:"px-4 pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-base font-semibold text-foreground",children:[e.jsx(C,{className:"h-4 w-4","aria-hidden":"true"}),"Service health"]}),e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:s?"Loading runtime status":`${f}/${x||0} services running`})]}),e.jsx("div",{className:"space-y-2 px-4 pb-4 pt-3",children:x>0?l.map(t=>e.jsxs("div",{className:"flex items-center justify-between gap-3 text-sm",children:[e.jsx("span",{className:"font-medium text-foreground",children:t.name}),e.jsx("span",{className:y("rounded-md px-2 py-0.5 text-xs font-medium",t.status==="running"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:t.status})]},t.name)):e.jsx("div",{className:"text-sm text-muted-foreground",children:s?"Waiting for status":"No service status reported"})})]}),r?e.jsx("nav",{"aria-label":"Services sections",className:"space-y-1",children:F.map(t=>{const g=t.icon,o=t.id==="runtime"&&i.pathname==="/services";return e.jsxs(L,{to:t.path,onClick:()=>c.openMain(),className:({isActive:d})=>y("flex gap-3 rounded-md px-3 py-2 text-sm transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",d||o?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:[e.jsx(g,{className:"mt-0.5 h-4 w-4 shrink-0","aria-hidden":"true"}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block font-medium",children:t.label}),e.jsx("span",{className:"mt-0.5 block text-xs opacity-80",children:t.description})]})]},t.id)})}):null]})}export{K as default};
1
+ import{b as j,r as n,j as e,O as R,u as k,d as y,S as C,N as L}from"./settings-BN7FyntE.js";import{f as M,S as I}from"./services-status-context-BnbZHZnu.js";import{D as P,P as D,R as _}from"./PaneListHeader-DTVY4Ig2.js";import{T as A,u as w}from"./workspace-layout-jzYHoh3_.js";const E=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],H=j("activity",E);const z=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],q=j("scroll-text",z);const $=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],V=j("settings",$),F=[{id:"runtime",label:"Runtime",path:"/services/runtime",description:"Xpod runtime, Solid server, AI Gateway, storage, and worker health.",icon:H},{id:"logs",label:"Logs",path:"/services/logs",description:"Runtime logs and sanitized diagnostics export.",icon:q},{id:"rdf",label:"RDF",path:"/services/rdf",description:"RDF indexing, storage stats, cache health, and slow query evidence.",icon:P},{id:"configuration",label:"Configuration",path:"/services/configuration",description:"Advanced local runtime configuration and restart-controlled changes.",icon:V}],S={supported:!1,reason:"capability_not_reported"};function K({mode:a="auto",product:s="legacy"}){const[r,i]=n.useState(null),[c,l]=n.useState(!0),[f,x]=n.useState(!1),[t,g]=n.useState(),o=n.useRef(0),d=n.useRef(null),u=n.useRef(!1),h=n.useCallback(async(m=!1)=>{const b=o.current+1;o.current=b,d.current?.abort();const p=new AbortController;d.current=p,m?l(!0):x(!0),g(void 0);try{const v=await M({signal:p.signal});u.current&&o.current===b&&!p.signal.aborted&&i(v)}catch(v){u.current&&o.current===b&&!p.signal.aborted&&!(v instanceof DOMException&&v.name==="AbortError")&&g("Services status request failed. Please try again.")}finally{u.current&&o.current===b&&!p.signal.aborted&&(l(!1),x(!1))}},[]);n.useEffect(()=>{u.current=!0,queueMicrotask(()=>{u.current&&h(!0)});const m=setInterval(()=>{h(!1)},1e4);return()=>{u.current=!1,o.current+=1,d.current?.abort(),d.current=null,clearInterval(m)}},[h]);const N=n.useMemo(()=>{const m=r?.adminData?.capabilities?.services;return{snapshot:r,loading:c,refreshing:f,error:t,refresh:()=>{h(!1)},restartCapability:m?.lifecycle?.restart??S,configurationWriteCapability:m?.configuration?.write??S}},[t,h,c,f,r]);return e.jsx(I.Provider,{value:N,children:e.jsx(A,{mode:a,listHeader:e.jsx(D,{title:"Services"}),list:e.jsx(W,{snapshot:r,loading:c&&!r,showSections:s==="legacy"}),mainHeader:e.jsx(T,{product:s,loading:c||f,onRefresh:N.refresh}),main:e.jsxs("section",{className:"min-h-full min-w-0 bg-background",children:[e.jsx(O,{}),t?e.jsx("div",{role:"alert",className:"mx-6 mt-6 rounded-md border border-destructive/30 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:t}):null,e.jsx(R,{})]}),className:"min-h-full"})})}function O(){const a=k(),s=w(),r=n.useRef(null),i=a.pathname.replace(/\/+$/,"")||"/services";return n.useEffect(()=>{if(r.current!==i){if(r.current=i,i==="/services"){s.openList();return}s.openMain()}},[i,s]),null}function T({product:a,loading:s,onRefresh:r}){return e.jsxs("div",{className:"flex h-full min-w-0 items-center justify-between gap-4 px-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Services"}),e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"Runtime health, logs, RDF indexing, and configuration"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[a!=="legacy"?e.jsx("a",{className:"inline-flex h-9 items-center justify-center rounded-md border border-input bg-background px-3 text-sm font-medium text-foreground hover:bg-accent",href:a==="dashboard"?"/settings/services":"/dashboard/runtime",children:a==="dashboard"?"Configure":"View runtime"}):null,e.jsxs("button",{type:"button",onClick:r,disabled:s,className:"inline-flex h-9 items-center justify-center rounded-md border border-input bg-background px-3 text-sm font-medium text-foreground transition-colors hover:bg-accent disabled:pointer-events-none disabled:opacity-50",children:[e.jsx(_,{className:y("mr-2 h-4 w-4",s&&"animate-spin"),"aria-hidden":"true"}),"Refresh"]})]})]})}function W({snapshot:a,loading:s,showSections:r}){const i=k(),c=w(),l=a?.servicesData??[],f=l.filter(t=>t.status==="running").length,x=l.length;return e.jsxs("aside",{className:"flex h-full flex-col gap-4 border-r border-border bg-muted/30 p-4",children:[e.jsxs("div",{className:"rounded-md border border-border bg-card",children:[e.jsxs("div",{className:"px-4 pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-base font-semibold text-foreground",children:[e.jsx(C,{className:"h-4 w-4","aria-hidden":"true"}),"Service health"]}),e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:s?"Loading runtime status":`${f}/${x||0} services running`})]}),e.jsx("div",{className:"space-y-2 px-4 pb-4 pt-3",children:x>0?l.map(t=>e.jsxs("div",{className:"flex items-center justify-between gap-3 text-sm",children:[e.jsx("span",{className:"font-medium text-foreground",children:t.name}),e.jsx("span",{className:y("rounded-md px-2 py-0.5 text-xs font-medium",t.status==="running"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:t.status})]},t.name)):e.jsx("div",{className:"text-sm text-muted-foreground",children:s?"Waiting for status":"No service status reported"})})]}),r?e.jsx("nav",{"aria-label":"Services sections",className:"space-y-1",children:F.map(t=>{const g=t.icon,o=t.id==="runtime"&&i.pathname==="/services";return e.jsxs(L,{to:t.path,onClick:()=>c.openMain(),className:({isActive:d})=>y("flex gap-3 rounded-md px-3 py-2 text-sm transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",d||o?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:[e.jsx(g,{className:"mt-0.5 h-4 w-4 shrink-0","aria-hidden":"true"}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block font-medium",children:t.label}),e.jsx("span",{className:"mt-0.5 block text-xs opacity-80",children:t.description})]})]},t.id)})}):null]})}export{K as default};
@@ -1,4 +1,4 @@
1
- var Dn=e=>{throw TypeError(e)};var Ln=(e,t,n)=>t.has(e)||Dn("Cannot "+n);var oe=(e,t,n)=>(Ln(e,t,"read from private field"),n?n.call(e):t.get(e)),jn=(e,t,n)=>t.has(e)?Dn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),$t=(e,t,n,r)=>(Ln(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);import{f as Co,b as It,j as l,d as se,r as a,g as ne,h as tt,R as Dt}from"./settings-yUyFIJxi.js";import{u as Po,g as Oo,a as Ro,b as _o,c as No,t as To}from"./services-status-context-CBfImxL_.js";var ut=Co();const Ao=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Io=It("check",Ao);const Do=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Lo=It("chevron-down",Do);const jo=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],ko=It("key-round",jo);const Mo=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Fo=It("triangle-alert",Mo);function Fe(e){const{className:t,variant:n,children:r}=e;return l.jsx("div",{className:se("rounded-xl bg-background",n==="bordered"&&"border border-border",t),children:r})}function Ye(e){const{className:t,children:n}=e;return l.jsx("div",{className:se("px-5 pt-5",t),children:n})}function Ge(e){const{className:t,children:n}=e;return l.jsx("div",{className:se("text-base font-semibold",t),children:n})}function Ue(e){const{className:t,children:n}=e;return l.jsx("div",{className:se("px-5 pb-5 pt-4",t),children:n})}function Ze(e){const{className:t,variant:n="default",size:r="default",children:o,...s}=e,i="inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-primary active:translate-y-px disabled:opacity-50 disabled:pointer-events-none",c={default:"bg-primary text-primary-foreground hover:bg-primary/90",secondary:"bg-muted text-foreground hover:bg-muted/80",ghost:"bg-transparent hover:bg-muted text-foreground"},u={default:"h-10 px-4 py-2",sm:"h-8 px-3"};return l.jsx("button",{className:se(i,c[n],u[r],t),...s,children:o})}function fr(e){const{className:t,...n}=e;return l.jsx("input",{className:se("w-full h-10 rounded-md border border-input bg-background px-3 py-2 text-sm","placeholder:text-muted-foreground","focus:outline-none focus-visible:ring-2 focus-visible:ring-primary",t),...n})}function Qe(e){const{className:t,...n}=e;return l.jsx("label",{className:se("text-sm font-medium text-foreground",t),...n})}var Uo=Object.defineProperty,Bo=(e,t)=>Uo(e,"name",{value:t,configurable:!0});function en(e,[t,n]){return Math.min(n,Math.max(t,e))}Bo(en,"clamp");var Vo=Object.defineProperty,rt=(e,t)=>Vo(e,"name",{value:t,configurable:!0}),pr=!!(typeof window<"u"&&window.document&&window.document.createElement);function J(e,t,{checkForDefaultPrevented:n=!0}={}){return rt(function(o){if(e?.(o),n===!1||!o||!o.defaultPrevented)return t?.(o)},"handleEvent")}rt(J,"composeEventHandlers");function Ho(e){if(!pr)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}rt(Ho,"getOwnerWindow");function tn(e){if(!pr)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}rt(tn,"getOwnerDocument");function mr(e,t=!1){const{activeElement:n}=tn(e);if(!n?.nodeName)return null;if(hr(n)&&n.contentDocument)return mr(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const o=tn(n).getElementById(r);if(o)return o}}return n}rt(mr,"getActiveElement");function hr(e){return e.tagName==="IFRAME"}rt(hr,"isFrame");var $o=Object.defineProperty,he=(e,t)=>$o(e,"name",{value:t,configurable:!0});function Wo(e,t){const n=a.createContext(t);n.displayName=e+"Context";const r=he(s=>{const{children:i,...c}=s,u=a.useMemo(()=>c,Object.values(c));return l.jsx(n.Provider,{value:u,children:i})},"Provider");r.displayName=e+"Provider";function o(s,i={}){const{optional:c=!1}=i,u=a.useContext(n);if(u)return u;if(t!==void 0)return t;if(!c)throw new Error(`\`${s}\` must be used within \`${e}\``)}return he(o,"useContext"),[r,o]}he(Wo,"createContext");function dt(e,t=[]){let n=[];function r(s,i){const c=a.createContext(i);c.displayName=s+"Context";const u=n.length;n=[...n,i];const f=he(d=>{const{scope:m,children:x,...v}=d,h=m?.[e]?.[u]||c,p=a.useMemo(()=>v,Object.values(v));return l.jsx(h.Provider,{value:p,children:x})},"Provider");f.displayName=s+"Provider";function g(d,m,x={}){const{optional:v=!1}=x,h=m?.[e]?.[u]||c,p=a.useContext(h);if(p)return p;if(i!==void 0)return i;if(!v)throw new Error(`\`${d}\` must be used within \`${s}\``)}return he(g,"useContext"),[f,g]}he(r,"createContext");const o=he(()=>{const s=n.map(i=>a.createContext(i));return he(function(c){const u=c?.[e]||s;return a.useMemo(()=>({[`__scope${e}`]:{...c,[e]:u}}),[c,u])},"useScope")},"createScope");return o.scopeName=e,[r,vr(o,...t)]}he(dt,"createContextScope");function vr(...e){const t=e[0];if(e.length===1)return t;const n=he(()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return he(function(s){const i=r.reduce((c,{useScope:u,scopeName:f})=>{const d=u(s)[`__scope${f}`];return{...c,...d}},{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}he(vr,"composeContextScopes");var Ko=Object.defineProperty,te=(e,t)=>Ko(e,"name",{value:t,configurable:!0});function gr(e){const t=e+"CollectionProvider",[n,r]=dt(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=te(h=>{const{scope:p,children:w}=h,S=a.useRef(null),b=a.useRef(new Map).current;return l.jsx(o,{scope:p,itemMap:b,collectionRef:S,children:w})},"CollectionProvider");i.displayName=t;const c=e+"CollectionSlot",u=tt(c),f=a.forwardRef((h,p)=>{const{scope:w,children:S}=h,b=s(c,w),y=ne(p,b.collectionRef);return l.jsx(u,{ref:y,children:S})});f.displayName=c;const g=e+"CollectionItemSlot",d="data-radix-collection-item",m=tt(g),x=a.forwardRef((h,p)=>{const{scope:w,children:S,...b}=h,y=a.useRef(null),C=ne(p,y),P=s(g,w);return a.useEffect(()=>(P.itemMap.set(y,{ref:y,...b}),()=>{P.itemMap.delete(y)})),l.jsx(m,{[d]:"",ref:C,children:S})});x.displayName=g;function v(h){const p=s(e+"CollectionConsumer",h);return a.useCallback(()=>{const S=p.collectionRef.current;if(!S)return[];const b=Array.from(S.querySelectorAll(`[${d}]`));return Array.from(p.itemMap.values()).sort((P,O)=>b.indexOf(P.ref.current)-b.indexOf(O.ref.current))},[p.collectionRef,p.itemMap])}return te(v,"useCollection"),[{Provider:i,Slot:f,ItemSlot:x},v,r]}te(gr,"createCollection");var kn=new WeakMap,G,pe,Wt=(pe=class extends Map{constructor(n){super(n);jn(this,G);$t(this,G,[...super.keys()]),kn.set(this,!0)}set(n,r){return kn.get(this)&&(this.has(n)?oe(this,G)[oe(this,G).indexOf(n)]=n:oe(this,G).push(n)),super.set(n,r),this}insert(n,r,o){const s=this.has(r),i=oe(this,G).length,c=vn(n);let u=c>=0?c:i+c;const f=u<0||u>=i?-1:u;if(f===this.size||s&&f===this.size-1||f===-1)return this.set(r,o),this;const g=this.size+(s?0:1);c<0&&u++;const d=[...oe(this,G)];let m,x=!1;for(let v=u;v<g;v++)if(u===v){let h=d[v];d[v]===r&&(h=d[v+1]),s&&this.delete(r),m=this.get(h),this.set(r,o)}else{!x&&d[v-1]===r&&(x=!0);const h=d[x?v:v-1],p=m;m=this.get(h),this.delete(h),this.set(h,p)}return this}with(n,r,o){const s=new pe(this);return s.insert(n,r,o),s}before(n){const r=oe(this,G).indexOf(n)-1;if(!(r<0))return this.entryAt(r)}setBefore(n,r,o){const s=oe(this,G).indexOf(n);return s===-1?this:this.insert(s,r,o)}after(n){let r=oe(this,G).indexOf(n);if(r=r===-1||r===this.size-1?-1:r+1,r!==-1)return this.entryAt(r)}setAfter(n,r,o){const s=oe(this,G).indexOf(n);return s===-1?this:this.insert(s+1,r,o)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return $t(this,G,[]),super.clear()}delete(n){const r=super.delete(n);return r&&oe(this,G).splice(oe(this,G).indexOf(n),1),r}deleteAt(n){const r=this.keyAt(n);return r!==void 0?this.delete(r):!1}at(n){const r=Ct(oe(this,G),n);if(r!==void 0)return this.get(r)}entryAt(n){const r=Ct(oe(this,G),n);if(r!==void 0)return[r,this.get(r)]}indexOf(n){return oe(this,G).indexOf(n)}keyAt(n){return Ct(oe(this,G),n)}from(n,r){const o=this.indexOf(n);if(o===-1)return;let s=o+r;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.at(s)}keyFrom(n,r){const o=this.indexOf(n);if(o===-1)return;let s=o+r;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(n,r){let o=0;for(const s of this){if(Reflect.apply(n,r,[s,o,this]))return s;o++}}findIndex(n,r){let o=0;for(const s of this){if(Reflect.apply(n,r,[s,o,this]))return o;o++}return-1}filter(n,r){const o=[];let s=0;for(const i of this)Reflect.apply(n,r,[i,s,this])&&o.push(i),s++;return new pe(o)}map(n,r){const o=[];let s=0;for(const i of this)o.push([i[0],Reflect.apply(n,r,[i,s,this])]),s++;return new pe(o)}reduce(...n){const[r,o]=n;let s=0,i=o??this.at(0);for(const c of this)s===0&&n.length===1?i=c:i=Reflect.apply(r,this,[i,c,s,this]),s++;return i}reduceRight(...n){const[r,o]=n;let s=o??this.at(-1);for(let i=this.size-1;i>=0;i--){const c=this.at(i);i===this.size-1&&n.length===1?s=c:s=Reflect.apply(r,this,[s,c,i,this])}return s}toSorted(n){const r=[...this.entries()].sort(n);return new pe(r)}toReversed(){const n=new pe;for(let r=this.size-1;r>=0;r--){const o=this.keyAt(r),s=this.get(o);n.set(o,s)}return n}toSpliced(...n){const r=[...this.entries()];return r.splice(...n),new pe(r)}slice(n,r){const o=new pe;let s=this.size-1;if(n===void 0)return o;n<0&&(n=n+this.size),r!==void 0&&r>0&&(s=r-1);for(let i=n;i<=s;i++){const c=this.keyAt(i),u=this.get(c);o.set(c,u)}return o}every(n,r){let o=0;for(const s of this){if(!Reflect.apply(n,r,[s,o,this]))return!1;o++}return!0}some(n,r){let o=0;for(const s of this){if(Reflect.apply(n,r,[s,o,this]))return!0;o++}return!1}},G=new WeakMap,te(pe,"OrderedDict"),pe);function Ct(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=xr(e,t);return n===-1?void 0:e[n]}te(Ct,"at");function xr(e,t){const n=e.length,r=vn(t),o=r>=0?r:n+r;return o<0||o>=n?-1:o}te(xr,"toSafeIndex");function vn(e){return e!==e||e===0?0:Math.trunc(e)}te(vn,"toSafeInteger");function Xo(e){const t=e+"CollectionProvider",[n,r]=dt(t),[o,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Wt,setItemMap:te(()=>{},"setItemMap")}),i=te(({state:b,...y})=>b?l.jsx(u,{...y,state:b}):l.jsx(c,{...y}),"CollectionProvider");i.displayName=t;const c=te(b=>{const y=p();return l.jsx(u,{...b,state:y})},"CollectionInit");c.displayName=t+"Init";const u=te(b=>{const{scope:y,children:C,state:P}=b,O=a.useRef(null),[T,N]=a.useState(null),I=ne(O,N),[F,A]=P;return a.useEffect(()=>{if(!T)return;const _=wr(()=>{});return _.observe(T,{childList:!0,subtree:!0}),()=>{_.disconnect()}},[T]),l.jsx(o,{scope:y,itemMap:F,setItemMap:A,collectionRef:I,collectionRefObject:O,collectionElement:T,children:C})},"CollectionProviderImpl");u.displayName=t+"Impl";const f=e+"CollectionSlot",g=tt(f),d=a.forwardRef((b,y)=>{const{scope:C,children:P}=b,O=s(f,C),T=ne(y,O.collectionRef);return l.jsx(g,{ref:T,children:P})});d.displayName=f;const m=e+"CollectionItemSlot",x="data-radix-collection-item",v=tt(m),h=a.forwardRef((b,y)=>{const{scope:C,children:P,...O}=b,T=a.useRef(null),[N,I]=a.useState(null),F=ne(y,T,I),A=s(m,C),{setItemMap:_}=A,L=a.useRef(O);yr(L.current,O)||(L.current=O);const H=L.current;return a.useEffect(()=>{const k=H;return _(M=>N?M.has(N)?M.set(N,{...k,element:N}).toSorted(nn):(M.set(N,{...k,element:N}),M.toSorted(nn)):M),()=>{_(M=>!N||!M.has(N)?M:(M.delete(N),new Wt(M)))}},[N,H,_]),l.jsx(v,{[x]:"",ref:F,children:P})});h.displayName=m;function p(){return a.useState(new Wt)}te(p,"useInitCollection");function w(b){const{itemMap:y}=s(e+"CollectionConsumer",b);return y}return te(w,"useCollection"),[{Provider:i,Slot:d,ItemSlot:h},{createCollectionScope:r,useCollection:w,useInitCollection:p}]}te(Xo,"createCollection");function yr(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||e[o]!==t[o])return!1;return!0}te(yr,"shallowEqual");function br(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}te(br,"isElementPreceding");function nn(e,t){return!e[1].element||!t[1].element?0:br(e[1].element,t[1].element)?-1:1}te(nn,"sortByDocumentPosition");function wr(e){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){e();return}})}te(wr,"getChildListObserver");var zo=Object.defineProperty,Yo=(e,t)=>zo(e,"name",{value:t,configurable:!0}),Go=a.createContext(void 0);function Sr(e){const t=a.useContext(Go);return e||t||"ltr"}Yo(Sr,"useDirection");var qo=Object.defineProperty,Zo=(e,t)=>qo(e,"name",{value:t,configurable:!0}),Qo=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],le=Qo.reduce((e,t)=>{const n=tt(`Primitive.${t}`),r=a.forwardRef((o,s)=>{const{asChild:i,...c}=o,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(u,{...c,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Er(e,t){e&&ut.flushSync(()=>e.dispatchEvent(t))}Zo(Er,"dispatchDiscreteCustomEvent");var Jo=Object.defineProperty,es=(e,t)=>Jo(e,"name",{value:t,configurable:!0});function Se(e){const t=a.useRef(e);return a.useEffect(()=>{t.current=e}),a.useMemo(()=>((...n)=>t.current?.(...n)),[])}es(Se,"useCallbackRef");var ts=Object.defineProperty,ee=(e,t)=>ts(e,"name",{value:t,configurable:!0}),rn="dismissableLayer.update",ns="dismissableLayer.pointerDownOutside",rs="dismissableLayer.focusOutside",Mn,Cr=a.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),os=a.forwardRef(ee(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:c,onInteractOutside:u,onDismiss:f,...g}=t,d=a.useContext(Cr),[m,x]=a.useState(null),v=m?.ownerDocument??globalThis?.document,[,h]=a.useState({}),p=ne(n,x),w=Array.from(d.layers),[S]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=S?w.indexOf(S):-1,y=m?w.indexOf(m):-1,C=d.layersWithOutsidePointerEventsDisabled.size>0,P=y>=b,O=a.useRef(!1),T=Pr(A=>{i?.(A),u?.(A),A.defaultPrevented||f?.()},{ownerDocument:v,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:O,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:a.useCallback(A=>{if(!(A instanceof Node))return!1;const _=[...d.branches].some(L=>L.contains(A));return P&&!_},[d.branches,P])}),N=Or(A=>{if(o&&O.current)return;const _=A.target;[...d.branches].some(H=>H.contains(_))||(c?.(A),u?.(A),A.defaultPrevented||f?.())},v),I=m?y===w.length-1:!1,F=Se(A=>{A.key==="Escape"&&(s?.(A),!A.defaultPrevented&&f&&(A.preventDefault(),f()))});return a.useEffect(()=>{if(I)return v.addEventListener("keydown",F,{capture:!0}),()=>v.removeEventListener("keydown",F,{capture:!0})},[v,I,F]),a.useEffect(()=>{if(m)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Mn=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(m)),d.layers.add(m),on(),()=>{r&&(d.layersWithOutsidePointerEventsDisabled.delete(m),d.layersWithOutsidePointerEventsDisabled.size===0&&(v.body.style.pointerEvents=Mn))}},[m,v,r,d]),a.useEffect(()=>()=>{m&&(d.layers.delete(m),d.layersWithOutsidePointerEventsDisabled.delete(m),on())},[m,d]),a.useEffect(()=>{const A=ee(()=>h({}),"handleUpdate");return document.addEventListener(rn,A),()=>document.removeEventListener(rn,A)},[]),l.jsx(le.div,{...g,ref:p,style:{pointerEvents:C?P?"auto":"none":void 0,...t.style},onFocusCapture:J(t.onFocusCapture,N.onFocusCapture),onBlurCapture:J(t.onBlurCapture,N.onBlurCapture),onPointerDownCapture:J(t.onPointerDownCapture,T.onPointerDownCapture)})},"DismissableLayer"));function ss(){const e=a.useContext(Cr),[t,n]=a.useState(null);return a.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}ee(ss,"useDismissableLayerSurface");var is=ee(()=>!0,"IS_TRUE");function Pr(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:s,shouldHandlePointerDownOutside:i=is}=t,c=Se(e),u=a.useRef(!1),f=a.useRef(!1),g=a.useRef(new Map),d=a.useRef(()=>{});return a.useEffect(()=>{function m(){f.current=!1,o.current=!1,g.current.clear()}ee(m,"resetOutsideInteraction");function x(){return Array.from(g.current.values()).some(Boolean)}ee(x,"isOutsideInteractionIntercepted");function v(b){if(!f.current)return;const y=b.target;y instanceof Node&&[...s].some(P=>P.contains(y))||g.current.set(b.type,!0),b.type==="click"&&window.setTimeout(()=>{f.current&&d.current()},0)}ee(v,"handleInteractionCapture");function h(b){f.current&&g.current.set(b.type,!1)}ee(h,"handleInteractionBubble");const p=ee(b=>{if(b.target&&!u.current){let y=function(){n.removeEventListener("click",d.current);const P=x();m(),P||gn(ns,c,C,{discrete:!0})};if(ee(y,"handleAndDispatchPointerDownOutsideEvent"),!i(b.target)){n.removeEventListener("click",d.current),m(),u.current=!1;return}const C={originalEvent:b};f.current=!0,o.current=r&&b.button===0,g.current.clear(),!r||b.button!==0?y():(n.removeEventListener("click",d.current),d.current=y,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),m();u.current=!1},"handlePointerDown"),w=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const b of w)n.addEventListener(b,v,!0),n.addEventListener(b,h);const S=window.setTimeout(()=>{n.addEventListener("pointerdown",p)},0);return()=>{window.clearTimeout(S),n.removeEventListener("pointerdown",p),n.removeEventListener("click",d.current);for(const b of w)n.removeEventListener(b,v,!0),n.removeEventListener(b,h)}},[n,c,r,o,s,i]),{onPointerDownCapture:ee(()=>u.current=!0,"onPointerDownCapture")}}ee(Pr,"usePointerDownOutside");function Or(e,t=globalThis?.document){const n=Se(e),r=a.useRef(!1);return a.useEffect(()=>{const o=ee(s=>{s.target&&!r.current&&gn(rs,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:ee(()=>r.current=!0,"onFocusCapture"),onBlurCapture:ee(()=>r.current=!1,"onBlurCapture")}}ee(Or,"useFocusOutside");function on(){const e=new CustomEvent(rn);document.dispatchEvent(e)}ee(on,"dispatchUpdate");function gn(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Er(o,s):o.dispatchEvent(s)}ee(gn,"handleAndDispatchCustomEvent");var cs=Object.defineProperty,xn=(e,t)=>cs(e,"name",{value:t,configurable:!0}),mt=0,We=null;function as(e){return yn(),e.children}xn(as,"FocusGuards");function yn(){a.useEffect(()=>{We||(We={start:sn(),end:sn()});const{start:e,end:t}=We;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),mt++,()=>{mt===1&&(We?.start.remove(),We?.end.remove(),We=null),mt=Math.max(0,mt-1)}},[])}xn(yn,"useFocusGuards");function sn(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}xn(sn,"createFocusGuard");var ls=Object.defineProperty,ce=(e,t)=>ls(e,"name",{value:t,configurable:!0}),Kt="focusScope.autoFocusOnMount",Xt="focusScope.autoFocusOnUnmount",Fn={bubbles:!1,cancelable:!0},us=a.forwardRef(ce(function(t,n){const{loop:r=!1,trapped:o=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...c}=t,[u,f]=a.useState(null),g=Se(s),d=Se(i),m=a.useRef(null),x=ne(n,f),v=a.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;a.useEffect(()=>{if(o){let p=function(y){if(v.paused||!u)return;const C=y.target;u.contains(C)?m.current=C:Pe(m.current,{select:!0})},w=function(y){if(v.paused||!u)return;const C=y.relatedTarget;C!==null&&(u.contains(C)||Pe(m.current,{select:!0}))},S=function(y){if(document.activeElement===document.body)for(const P of y)P.removedNodes.length>0&&Pe(u)};ce(p,"handleFocusIn"),ce(w,"handleFocusOut"),ce(S,"handleMutations"),document.addEventListener("focusin",p),document.addEventListener("focusout",w);const b=new MutationObserver(S);return u&&b.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",w),b.disconnect()}}},[o,u,v.paused]),a.useEffect(()=>{if(u){Un.add(v);const p=document.activeElement;if(!u.contains(p)){const S=new CustomEvent(Kt,Fn);u.addEventListener(Kt,g),u.dispatchEvent(S),S.defaultPrevented||(Rr(Ir(bn(u)),{select:!0}),document.activeElement===p&&Pe(u))}return()=>{u.removeEventListener(Kt,g),setTimeout(()=>{const S=new CustomEvent(Xt,Fn);u.addEventListener(Xt,d),u.dispatchEvent(S),S.defaultPrevented||Pe(p??document.body,{select:!0}),u.removeEventListener(Xt,d),Un.remove(v)},0)}}},[u,g,d,v]);const h=a.useCallback(p=>{if(!r&&!o||v.paused)return;const w=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,S=document.activeElement;if(w&&S){const b=p.currentTarget,[y,C]=_r(b);y&&C?!p.shiftKey&&S===C?(p.preventDefault(),r&&Pe(y,{select:!0})):p.shiftKey&&S===y&&(p.preventDefault(),r&&Pe(C,{select:!0})):S===b&&p.preventDefault()}},[r,o,v.paused]);return l.jsx(le.div,{tabIndex:-1,...c,ref:x,onKeyDown:h})},"FocusScope"));function Rr(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Pe(r,{select:t}),document.activeElement!==n)return}ce(Rr,"focusFirst");function _r(e){const t=bn(e),n=cn(t,e),r=cn(t.reverse(),e);return[n,r]}ce(_r,"getTabbableEdges");function bn(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:ce(r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}ce(bn,"getTabbableCandidates");function cn(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Nr(r,{upTo:t})))return r}ce(cn,"findVisible");function Nr(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}ce(Nr,"isHidden");function Tr(e){return e instanceof HTMLInputElement&&"select"in e}ce(Tr,"isSelectableInput");function Pe(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Tr(e)&&t&&e.select()}}ce(Pe,"focus");var Un=Ar();function Ar(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=an(e,t),e.unshift(t)},remove(t){e=an(e,t),e[0]?.resume()}}}ce(Ar,"createFocusScopesStack");function an(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}ce(an,"arrayRemove");function Ir(e){return e.filter(t=>t.tagName!=="A")}ce(Ir,"removeLinks");var ae=globalThis?.document?a.useLayoutEffect:()=>{},ds=Object.defineProperty,fs=(e,t)=>ds(e,"name",{value:t,configurable:!0}),ps=Dt[" useId ".trim().toString()]||(()=>{}),ms=0;function wn(e){const[t,n]=a.useState(ps());return ae(()=>{e||n(r=>r??String(ms++))},[e]),e||(t?`radix-${t}`:"")}fs(wn,"useId");const hs=["top","right","bottom","left"],De=Math.min,Oe=Math.max,_t=Math.round,ht=Math.floor,Re=e=>({x:e,y:e}),vs={left:"right",right:"left",bottom:"top",top:"bottom"};function Dr(e,t,n){return Oe(e,De(t,n))}function _e(e,t){return typeof e=="function"?e(t):e}function Le(e){return e.split("-")[0]}function ot(e){return e.split("-")[1]}function Sn(e){return e==="x"?"y":"x"}function En(e){return e==="y"?"height":"width"}function we(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Cn(e){return Sn(we(e))}function gs(e,t,n){n===void 0&&(n=!1);const r=ot(e),o=Cn(e),s=En(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Nt(i)),[i,Nt(i)]}function xs(e){const t=Nt(e);return[ln(e),t,ln(t)]}function ln(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Bn=["left","right"],Vn=["right","left"],ys=["top","bottom"],bs=["bottom","top"];function ws(e,t,n){switch(e){case"top":case"bottom":return n?t?Vn:Bn:t?Bn:Vn;case"left":case"right":return t?ys:bs;default:return[]}}function Ss(e,t,n,r){const o=ot(e);let s=ws(Le(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ln)))),s}function Nt(e){const t=Le(e);return vs[t]+e.slice(t.length)}function Es(e){var t,n,r,o;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(o=e.left)!=null?o:0}}function Lr(e){return typeof e!="number"?Es(e):{top:e,right:e,bottom:e,left:e}}function Tt(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Hn(e,t,n){let{reference:r,floating:o}=e;const s=we(t),i=Cn(t),c=En(i),u=Le(t),f=s==="y",g=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,m=r[c]/2-o[c]/2;let x;switch(u){case"top":x={x:g,y:r.y-o.height};break;case"bottom":x={x:g,y:r.y+r.height};break;case"right":x={x:r.x+r.width,y:d};break;case"left":x={x:r.x-o.width,y:d};break;default:x={x:r.x,y:r.y}}const v=ot(t);return v&&(x[i]+=m*(v==="end"?1:-1)*(n&&f?-1:1)),x}async function Cs(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:u}=e,{boundary:f="clippingAncestors",rootBoundary:g="viewport",elementContext:d="floating",altBoundary:m=!1,padding:x=0}=_e(t,e),v=Lr(x),p=c[m?d==="floating"?"reference":"floating":d],w=Tt(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(p)))==null||n?p:p.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:f,rootBoundary:g,strategy:u})),S=d==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),y=await(s.isElement==null?void 0:s.isElement(b))&&await(s.getScale==null?void 0:s.getScale(b))||{x:1,y:1},C=Tt(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:S,offsetParent:b,strategy:u}):S);return{top:(w.top-C.top+v.top)/y.y,bottom:(C.bottom-w.bottom+v.bottom)/y.y,left:(w.left-C.left+v.left)/y.x,right:(C.right-w.right+v.right)/y.x}}const Ps=50,Os=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Cs},u=await(i.isRTL==null?void 0:i.isRTL(t));let f=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:g,y:d}=Hn(f,r,u),m=r,x=0;const v={};for(let h=0;h<s.length;h++){const p=s[h];if(!p)continue;const{name:w,fn:S}=p,{x:b,y,data:C,reset:P}=await S({x:g,y:d,initialPlacement:r,placement:m,strategy:o,middlewareData:v,rects:f,platform:c,elements:{reference:e,floating:t}});g=b??g,d=y??d,v[w]={...v[w],...C},P&&x<Ps&&(x++,typeof P=="object"&&(P.placement&&(m=P.placement),P.rects&&(f=P.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):P.rects),{x:g,y:d}=Hn(f,m,u)),h=-1)}return{x:g,y:d,placement:m,strategy:o,middlewareData:v}},Rs=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:u}=t,{element:f,padding:g=0}=_e(e,t)||{};if(f==null)return{};const d=Lr(g),m={x:n,y:r},x=Cn(o),v=En(x),h=await i.getDimensions(f),p=x==="y",w=p?"top":"left",S=p?"bottom":"right",b=p?"clientHeight":"clientWidth",y=s.reference[v]+s.reference[x]-m[x]-s.floating[v],C=m[x]-s.reference[x],P=await(i.getOffsetParent==null?void 0:i.getOffsetParent(f));let O=P?P[b]:0;(!O||!await(i.isElement==null?void 0:i.isElement(P)))&&(O=c.floating[b]||s.floating[v]);const T=y/2-C/2,N=O/2-h[v]/2-1,I=De(d[w],N),F=De(d[S],N),A=O-h[v]-F,_=O/2-h[v]/2+T,L=Dr(I,_,A),H=!u.arrow&&ot(o)!=null&&_!==L&&s.reference[v]/2-(_<I?I:F)-h[v]/2<0,k=H?_<I?_-I:_-A:0;return{[x]:m[x]+k,data:{[x]:L,centerOffset:_-L-k,...H&&{alignmentOffset:k}},reset:H}}}),_s=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:u,elements:f}=t,{mainAxis:g=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:h=!0,...p}=_e(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const w=Le(o),S=we(c),b=Le(c)===c,y=await(u.isRTL==null?void 0:u.isRTL(f.floating)),C=m||(b||!h?[Nt(c)]:xs(c)),P=v!=="none";!m&&P&&C.push(...Ss(c,h,v,y));const O=[c,...C],T=await u.detectOverflow(t,p),N=[];let I=((r=s.flip)==null?void 0:r.overflows)||[];if(g&&N.push(T[w]),d){const L=gs(o,i,y);N.push(T[L[0]],T[L[1]])}if(I=[...I,{placement:o,overflows:N}],!N.every(L=>L<=0)){var F,A;const L=(((F=s.flip)==null?void 0:F.index)||0)+1,H=O[L];if(H&&(!(d==="alignment"?S!==we(H):!1)||I.every(R=>we(R.placement)===S?R.overflows[0]>0:!0)))return{data:{index:L,overflows:I},reset:{placement:H}};let k=(A=I.filter(M=>M.overflows[0]<=0).sort((M,R)=>M.overflows[1]-R.overflows[1])[0])==null?void 0:A.placement;if(!k)switch(x){case"bestFit":{var _;const M=(_=I.filter(R=>{if(P){const U=we(R.placement);return U===S||U==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(U=>U>0).reduce((U,B)=>U+B,0)]).sort((R,U)=>R[1]-U[1])[0])==null?void 0:_[0];M&&(k=M);break}case"initialPlacement":k=c;break}if(o!==k)return{reset:{placement:k}}}return{}}}};function $n(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Wn(e){return hs.some(t=>e[t]>=0)}const Ns=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=_e(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),c=$n(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Wn(c)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),c=$n(i,n.floating);return{data:{escapedOffsets:c,escaped:Wn(c)}}}default:return{}}}}},jr=new Set(["left","top"]);async function Ts(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Le(n),c=ot(n),u=we(n)==="y",f=jr.has(i)?-1:1,g=s&&u?-1:1,d=_e(t,e);let{mainAxis:m,crossAxis:x,alignmentAxis:v}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof v=="number"&&(x=c==="end"?v*-1:v),u?{x:x*g,y:m*f}:{x:m*f,y:x*g}}const As=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,u=await Ts(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+u.x,y:s+u.y,data:{...u,placement:i}}}}},Is=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:u={fn:S=>{let{x:b,y}=S;return{x:b,y}}},...f}=_e(e,t),g={x:n,y:r},d=await s.detectOverflow(t,f),m=we(o),x=Sn(m);let v=g[x],h=g[m];const p=(S,b)=>Dr(b+d[S==="y"?"top":"left"],b,b-d[S==="y"?"bottom":"right"]);i&&(v=p(x,v)),c&&(h=p(m,h));const w=u.fn({...t,[x]:v,[m]:h});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[x]:i,[m]:c}}}}}},Ds=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:o,y:s,placement:i,rects:c,middlewareData:u}=t,{offset:f=0,mainAxis:g=!0,crossAxis:d=!0}=_e(e,t),m={x:o,y:s},x=we(i),v=Sn(x);let h=m[v],p=m[x];const w=_e(f,t),S=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:(n=w.mainAxis)!=null?n:0,crossAxis:(r=w.crossAxis)!=null?r:0};if(g){const C=v==="y"?"height":"width",P=c.reference[v]-c.floating[C]+S.mainAxis,O=c.reference[v]+c.reference[C]-S.mainAxis;h<P?h=P:h>O&&(h=O)}if(d){var b,y;const C=v==="y"?"width":"height",P=jr.has(Le(i)),O=c.reference[x]-c.floating[C]+(P&&((b=u.offset)==null?void 0:b[x])||0)+(P?0:S.crossAxis),T=c.reference[x]+c.reference[C]+(P?0:((y=u.offset)==null?void 0:y[x])||0)-(P?S.crossAxis:0);p<O?p=O:p>T&&(p=T)}return{[v]:h,[x]:p}}}},Ls=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:i=()=>{},...c}=_e(e,t),u=await o.detectOverflow(t,c),f=Le(n),g=ot(n),d=we(n)==="y",{width:m,height:x}=r.floating;let v,h;f==="top"||f==="bottom"?(v=f,h=g===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(h=f,v=g==="end"?"top":"bottom");const p=x-u.top-u.bottom,w=m-u.left-u.right,S=De(x-u[v],p),b=De(m-u[h],w),y=t.middlewareData.shift,C=!y;let P=S,O=b;y!=null&&y.enabled.x&&(O=w),y!=null&&y.enabled.y&&(P=p),C&&!g&&(d?O=m-2*Oe(u.left,u.right):P=x-2*Oe(u.top,u.bottom)),await i({...t,availableWidth:O,availableHeight:P});const T=await o.getDimensions(s.floating);return m!==T.width||x!==T.height?{reset:{rects:!0}}:{}}}};function Lt(){return typeof window<"u"}function st(e){return kr(e)?(e.nodeName||"").toLowerCase():"#document"}function fe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Te(e){var t;return(t=(kr(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function kr(e){return Lt()?e instanceof Node||e instanceof fe(e).Node:!1}function Ee(e){return Lt()?e instanceof Element||e instanceof fe(e).Element:!1}function je(e){return Lt()?e instanceof HTMLElement||e instanceof fe(e).HTMLElement:!1}function Kn(e){return!Lt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof fe(e).ShadowRoot}function jt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ce(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function js(e){return/^(table|td|th)$/.test(st(e))}function kt(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const ks=/transform|translate|scale|rotate|perspective|filter/,Ms=/paint|layout|strict|content/,Me=e=>!!e&&e!=="none";let zt;function Pn(e){const t=Ee(e)?Ce(e):e;return Me(t.transform)||Me(t.translate)||Me(t.scale)||Me(t.rotate)||Me(t.perspective)||!On()&&(Me(t.backdropFilter)||Me(t.filter))||ks.test(t.willChange||"")||Ms.test(t.contain||"")}function Fs(e){let t=Be(e);for(;je(t)&&!at(t);){if(Pn(t))return t;if(kt(t))return null;t=Be(t)}return null}function On(){return zt==null&&(zt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),zt}function at(e){return/^(html|body|#document)$/.test(st(e))}function Ce(e){return fe(e).getComputedStyle(e)}function Mt(e){return Ee(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Be(e){if(st(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Kn(e)&&e.host||Te(e);return Kn(t)?t.host:t}function Mr(e){const t=Be(e);return at(t)?(e.ownerDocument||e).body:je(t)&&jt(t)?t:Mr(t)}function lt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Mr(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=fe(o);if(s){const c=un(i);return t.concat(i,i.visualViewport||[],jt(o)?o:[],c&&n?lt(c):[])}else return t.concat(o,lt(o,[],n))}function un(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Fr(e){const t=Ce(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=je(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=_t(n)!==s||_t(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function Rn(e){return Ee(e)?e:e.contextElement}function Je(e){const t=Rn(e);if(!je(t))return Re(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Fr(t);let i=(s?_t(n.width):n.width)/r,c=(s?_t(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Us=Re(0);function Ur(e){const t=fe(e);return!On()||!t.visualViewport?Us:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Bs(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===fe(e)}function Ve(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Rn(e);let i=Re(1);t&&(r?Ee(r)&&(i=Je(r)):i=Je(e));const c=Bs(s,n,r)?Ur(s):Re(0);let u=(o.left+c.x)/i.x,f=(o.top+c.y)/i.y,g=o.width/i.x,d=o.height/i.y;if(s&&r){const m=fe(s),x=Ee(r)?fe(r):r;let v=m,h=un(v);for(;h&&x!==v;){const p=Je(h),w=h.getBoundingClientRect(),S=Ce(h),b=w.left+(h.clientLeft+parseFloat(S.paddingLeft))*p.x,y=w.top+(h.clientTop+parseFloat(S.paddingTop))*p.y;u*=p.x,f*=p.y,g*=p.x,d*=p.y,u+=b,f+=y,v=fe(h),h=un(v)}}return Tt({width:g,height:d,x:u,y:f})}function Ft(e,t){const n=Mt(e).scrollLeft;return t?t.left+n:Ve(Te(e)).left+n}function Br(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ft(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Vs(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Te(r),c=t?kt(t.floating):!1;if(r===i||c&&s)return n;let u={scrollLeft:0,scrollTop:0},f=Re(1);const g=Re(0),d=je(r);if((d||!s)&&((st(r)!=="body"||jt(i))&&(u=Mt(r)),d)){const x=Ve(r);f=Je(r),g.x=x.x+r.clientLeft,g.y=x.y+r.clientTop}const m=i&&!d&&!s?Br(i,u):Re(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-u.scrollLeft*f.x+g.x+m.x,y:n.y*f.y-u.scrollTop*f.y+g.y+m.y}}function Hs(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function $s(e){const t=Mt(e),n=e.ownerDocument.body,r=Oe(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=Oe(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+Ft(e);const i=-t.scrollTop;return Ce(n).direction==="rtl"&&(s+=Oe(e.clientWidth,n.clientWidth)-r),{width:r,height:o,x:s,y:i}}const Ws=25;function Ks(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",o=fe(e),s=Te(e),i=o.visualViewport;let c=s.clientWidth,u=s.clientHeight,f=0,g=0;if(i){const m=!On()||t==="fixed";r?m||(f=-i.offsetLeft,g=-i.offsetTop):(c=i.width,u=i.height,m&&(f=i.offsetLeft,g=i.offsetTop))}if(Ft(s)<=0){const m=s.ownerDocument,x=m.body,v=getComputedStyle(x),h=m.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,p=Math.abs(s.clientWidth-x.clientWidth-h),w=getComputedStyle(s).scrollbarGutter==="stable both-edges"?p/2:p;w<=Ws&&(c-=w)}return{width:c,height:u,x:f,y:g}}function Xs(e,t){const n=Ve(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Je(e),i=e.clientWidth*s.x,c=e.clientHeight*s.y,u=o*s.x,f=r*s.y;return{width:i,height:c,x:u,y:f}}function Xn(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=Ks(e,n,t);else if(t==="document")r=$s(Te(e));else if(Ee(t))r=Xs(t,n);else{const o=Ur(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Tt(r)}function zs(e,t){const n=t.get(e);if(n)return n;let r=lt(e,[],!1).filter(c=>Ee(c)&&st(c)!=="body"),o=null;const s=Ce(e).position==="fixed";let i=s?Be(e):e;for(;Ee(i)&&!at(i);){const c=Ce(i),u=Pn(i),f=o?o.position:s?"fixed":"";!u&&(f==="fixed"||f==="absolute"&&c.position==="static")?r=r.filter(d=>d!==i):o=c,i=Be(i)}return t.set(e,r),r}function Ys(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?kt(t)?[]:zs(t,this._c):[].concat(n),r],c=Xn(t,i[0],o);let u=c.top,f=c.right,g=c.bottom,d=c.left;for(let m=1;m<i.length;m++){const x=Xn(t,i[m],o);u=Oe(x.top,u),f=De(x.right,f),g=De(x.bottom,g),d=Oe(x.left,d)}return{width:f-d,height:g-u,x:d,y:u}}function Gs(e){const{width:t,height:n}=Fr(e);return{width:t,height:n}}function qs(e,t,n){const r=je(t),o=Te(t),s=n==="fixed",i=Ve(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const u=Re(0);if((r||!s)&&((st(t)!=="body"||jt(o))&&(c=Mt(t)),r)){const m=Ve(t,!0,s,t);u.x=m.x+t.clientLeft,u.y=m.y+t.clientTop}!r&&o&&(u.x=Ft(o));const f=o&&!r&&!s?Br(o,c):Re(0),g=i.left+c.scrollLeft-u.x-f.x,d=i.top+c.scrollTop-u.y-f.y;return{x:g,y:d,width:i.width,height:i.height}}function Yt(e){return Ce(e).position==="static"}function zn(e,t){if(!je(e)||Ce(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Te(e)===n&&(n=n.ownerDocument.body),n}function Vr(e,t){const n=fe(e);if(kt(e))return n;if(!je(e)){let o=Be(e);for(;o&&!at(o);){if(Ee(o)&&!Yt(o))return o;o=Be(o)}return n}let r=zn(e,t);for(;r&&js(r)&&Yt(r);)r=zn(r,t);return r&&at(r)&&Yt(r)&&!Pn(r)?n:r||Fs(e)||n}const Zs=async function(e){const t=this.getOffsetParent||Vr,n=this.getDimensions,r=await n(e.floating);return{reference:qs(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Qs(e){return Ce(e).direction==="rtl"}const Js={convertOffsetParentRelativeRectToViewportRelativeRect:Vs,getDocumentElement:Te,getClippingRect:Ys,getOffsetParent:Vr,getElementRects:Zs,getClientRects:Hs,getDimensions:Gs,getScale:Je,isElement:Ee,isRTL:Qs};function Hr(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ei(e,t,n){let r=null,o;const s=Te(e);function i(){var g;clearTimeout(o),(g=r)==null||g.disconnect(),r=null}function c(g,d){g===void 0&&(g=!1),d===void 0&&(d=1),i();const m=e.getBoundingClientRect(),{left:x,top:v,width:h,height:p}=m;if(g||t(),!h||!p)return;const w=ht(v),S=ht(s.clientWidth-(x+h)),b=ht(s.clientHeight-(v+p)),y=ht(x),P={rootMargin:-w+"px "+-S+"px "+-b+"px "+-y+"px",threshold:Oe(0,De(1,d))||1};let O=!0;function T(N){const I=N[0].intersectionRatio;if(!Hr(m,e.getBoundingClientRect()))return c();if(I!==d){if(!O)return c();I?c(!1,I):o=setTimeout(()=>{c(!1,1e-7)},1e3)}O=!1}try{r=new IntersectionObserver(T,{...P,root:s.ownerDocument})}catch{r=new IntersectionObserver(T,P)}r.observe(e)}const u=fe(e),f=()=>c(n);return u.addEventListener("resize",f),c(!0),()=>{u.removeEventListener("resize",f),i()}}function ti(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=Rn(e),g=o||s?[...f?lt(f):[],...t?lt(t):[]]:[];g.forEach(w=>{o&&w.addEventListener("scroll",n),s&&w.addEventListener("resize",n)});const d=f&&c?ei(f,n,s):null;let m=-1,x=null;i&&(x=new ResizeObserver(w=>{let[S]=w;S&&S.target===f&&x&&t&&(x.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var b;(b=x)==null||b.observe(t)})),n()}),f&&!u&&x.observe(f),t&&x.observe(t));let v,h=u?Ve(e):null;u&&p();function p(){const w=Ve(e);h&&!Hr(h,w)&&n(),h=w,v=requestAnimationFrame(p)}return n(),()=>{var w;g.forEach(S=>{o&&S.removeEventListener("scroll",n),s&&S.removeEventListener("resize",n)}),d?.(),(w=x)==null||w.disconnect(),x=null,u&&cancelAnimationFrame(v)}}const ni=As,ri=Is,oi=_s,si=Ls,ii=Ns,Yn=Rs,ci=Ds,ai=(e,t,n)=>{const r=new Map,o=n??{},s={...Js,...o.platform,_c:r};return Os(e,t,{...o,platform:s})};var li=typeof document<"u",ui=function(){},Pt=li?a.useLayoutEffect:ui;function At(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,o;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(!At(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!At(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function $r(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Gn(e,t){const n=$r(e);return Math.round(t*n)/n}function Gt(e){const t=a.useRef(e);return Pt(()=>{t.current=e}),t}function di(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:u,open:f}=e,[g,d]=a.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,x]=a.useState(r);At(m,r)||x(r);const[v,h]=a.useState(null),[p,w]=a.useState(null),S=a.useCallback(R=>{R!==P.current&&(P.current=R,h(R))},[]),b=a.useCallback(R=>{R!==O.current&&(O.current=R,w(R))},[]),y=s||v,C=i||p,P=a.useRef(null),O=a.useRef(null),T=a.useRef(g),N=u!=null,I=Gt(u),F=Gt(o),A=Gt(f),_=a.useCallback(()=>{if(!P.current||!O.current)return;const R={placement:t,strategy:n,middleware:m};F.current&&(R.platform=F.current),ai(P.current,O.current,R).then(U=>{const B={...U,isPositioned:A.current!==!1};L.current&&!At(T.current,B)&&(T.current=B,ut.flushSync(()=>{d(B)}))})},[m,t,n,F,A]);Pt(()=>{f===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(R=>({...R,isPositioned:!1})))},[f]);const L=a.useRef(!1);Pt(()=>(L.current=!0,()=>{L.current=!1}),[]),Pt(()=>{if(y&&(P.current=y),C&&(O.current=C),y&&C){if(I.current)return I.current(y,C,_);_()}},[y,C,_,I,N]);const H=a.useMemo(()=>({reference:P,floating:O,setReference:S,setFloating:b}),[S,b]),k=a.useMemo(()=>({reference:y,floating:C}),[y,C]),M=a.useMemo(()=>{const R={position:n,left:0,top:0};if(!k.floating)return R;const U=Gn(k.floating,g.x),B=Gn(k.floating,g.y);return c?{...R,transform:"translate("+U+"px, "+B+"px)",...$r(k.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:B}},[n,c,k.floating,g.x,g.y]);return a.useMemo(()=>({...g,update:_,refs:H,elements:k,floatingStyles:M}),[g,_,H,k,M])}const fi=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Yn({element:r.current,padding:o}).fn(n):{}:r?Yn({element:r,padding:o}).fn(n):{}}}},pi=(e,t)=>{const n=ni(e);return{name:n.name,fn:n.fn,options:[e,t]}},mi=(e,t)=>{const n=ri(e);return{name:n.name,fn:n.fn,options:[e,t]}},hi=(e,t)=>({fn:ci(e).fn,options:[e,t]}),vi=(e,t)=>{const n=oi(e);return{name:n.name,fn:n.fn,options:[e,t]}},gi=(e,t)=>{const n=si(e);return{name:n.name,fn:n.fn,options:[e,t]}},xi=(e,t)=>{const n=ii(e);return{name:n.name,fn:n.fn,options:[e,t]}},yi=(e,t)=>{const n=fi(e);return{name:n.name,fn:n.fn,options:[e,t]}};var bi=Object.defineProperty,wi=(e,t)=>bi(e,"name",{value:t,configurable:!0});function Wr(e){const[t,n]=a.useState(void 0);return ae(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,c;if("borderBoxSize"in s){const u=s.borderBoxSize,f=Array.isArray(u)?u[0]:u;i=f.inlineSize,c=f.blockSize}else i=e.offsetWidth,c=e.offsetHeight;n({width:i,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}wi(Wr,"useSize");var Si=Object.defineProperty,Ie=(e,t)=>Si(e,"name",{value:t,configurable:!0}),Kr="Popper",[Xr,zr]=dt(Kr),[Ei,Yr]=Xr(Kr),Ci=Ie(e=>{const{__scopePopper:t,children:n}=e,[r,o]=a.useState(null),[s,i]=a.useState(void 0);return l.jsx(Ei,{scope:t,anchor:r,onAnchorChange:o,placementState:s,setPlacementState:i,children:n})},"Popper"),Pi="PopperAnchor",Oi=a.forwardRef(Ie(function(t,n){const{__scopePopper:r,virtualRef:o,...s}=t,i=Yr(Pi,r),c=a.useRef(null),u=i.onAnchorChange,f=a.useCallback(h=>{c.current=h,h&&u(h)},[u]),g=ne(n,f),d=a.useRef(null);a.useEffect(()=>{if(!o)return;const h=d.current;d.current=o.current,h!==d.current&&u(d.current)});const m=i.placementState&&Ut(i.placementState),x=m?.[0],v=m?.[1];return o?null:l.jsx(le.div,{"data-radix-popper-side":x,"data-radix-popper-align":v,...s,ref:g})},"PopperAnchor")),Gr="PopperContent",[Ri,wa]=Xr(Gr),_i=a.forwardRef(Ie(function(t,n){const{__scopePopper:r,side:o="bottom",sideOffset:s=0,align:i="center",alignOffset:c=0,arrowPadding:u=0,avoidCollisions:f=!0,collisionBoundary:g=[],collisionPadding:d=0,sticky:m="partial",hideWhenDetached:x=!1,updatePositionStrategy:v="optimized",onPlaced:h,...p}=t,w=Yr(Gr,r),[S,b]=a.useState(null),y=ne(n,b),[C,P]=a.useState(null),O=Wr(C),T=O?.width??0,N=O?.height??0,I=o+(i!=="center"?"-"+i:""),F=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},A=Array.isArray(g)?g:[g],_=A.length>0,L={padding:F,boundary:A.filter(qr),altBoundary:_},{refs:H,floatingStyles:k,placement:M,isPositioned:R,middlewareData:U}=di({strategy:"fixed",placement:I,whileElementsMounted:Ie((...V)=>ti(...V,{animationFrame:v==="always"}),"whileElementsMounted"),elements:{reference:w.anchor},middleware:[pi({mainAxis:s+N,alignmentAxis:c}),f&&mi({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?hi():void 0,...L}),f&&vi({...L}),gi({...L,apply:Ie(({elements:V,rects:Q,availableWidth:W,availableHeight:K})=>{const{width:Y,height:ve}=Q.reference,de=V.floating.style;de.setProperty("--radix-popper-available-width",`${W}px`),de.setProperty("--radix-popper-available-height",`${K}px`),de.setProperty("--radix-popper-anchor-width",`${Y}px`),de.setProperty("--radix-popper-anchor-height",`${ve}px`)},"apply")}),C&&yi({element:C,padding:u}),Ni({arrowWidth:T,arrowHeight:N}),x&&xi({strategy:"referenceHidden",...L,boundary:_?L.boundary:void 0})]}),B=w.setPlacementState;ae(()=>(B(M),()=>{B(void 0)}),[M,B]);const[ue,X]=Ut(M),Z=Se(h);ae(()=>{R&&Z?.()},[R,Z]);const ie=U.arrow?.x,re=U.arrow?.y,q=U.arrow?.centerOffset!==0,[xe,D]=a.useState();return ae(()=>{S&&D(window.getComputedStyle(S).zIndex)},[S]),l.jsx("div",{ref:H.setFloating,"data-radix-popper-content-wrapper":"",style:{...k,transform:R?k.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:xe,"--radix-popper-transform-origin":[U.transformOrigin?.x,U.transformOrigin?.y].join(" "),...U.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:l.jsx(Ri,{scope:r,placedSide:ue,placedAlign:X,onArrowChange:P,arrowX:ie,arrowY:re,shouldHideArrow:q,children:l.jsx(le.div,{"data-side":ue,"data-align":X,...p,ref:y,style:{...p.style,animation:R?p.style?.animation:"none"}})})})},"PopperContent"));function qr(e){return e!==null}Ie(qr,"isNotNull");var Ni=Ie(e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,c=i?0:e.arrowWidth,u=i?0:e.arrowHeight,[f,g]=Ut(n),d={start:"0%",center:"50%",end:"100%"}[g],m=(o.arrow?.x??0)+c/2,x=(o.arrow?.y??0)+u/2;let v="",h="";return f==="bottom"?(v=i?d:`${m}px`,h=`${-u}px`):f==="top"?(v=i?d:`${m}px`,h=`${r.floating.height+u}px`):f==="right"?(v=`${-u}px`,h=i?d:`${x}px`):f==="left"&&(v=`${r.floating.width+u}px`,h=i?d:`${x}px`),{data:{x:v,y:h}}}}),"transformOrigin");function Ut(e){const[t,n="center"]=e.split("-");return[t,n]}Ie(Ut,"getSideAndAlignFromPlacement");var Ti=Ci,Ai=Oi,Ii=_i,Di=Object.defineProperty,Li=(e,t)=>Di(e,"name",{value:t,configurable:!0}),ji=a.forwardRef(Li(function(t,n){const{container:r,...o}=t,[s,i]=a.useState(!1);ae(()=>i(!0),[]);const c=r||s&&globalThis?.document?.body;return c?ut.createPortal(l.jsx(le.div,{...o,ref:n}),c):null},"Portal")),ki=Object.defineProperty,Ne=(e,t)=>ki(e,"name",{value:t,configurable:!0});function Zr(e,t){return a.useReducer((n,r)=>t[n][r]??n,e)}Ne(Zr,"useStateMachine");var Mi=Ne(e=>{const{present:t,children:n}=e,r=Qr(t),o=typeof n=="function"?n({present:r.isPresent}):a.Children.only(n),s=Jr(r.ref,eo(o));return typeof n=="function"||r.isPresent?a.cloneElement(o,{ref:s}):null},"Presence");function Qr(e){const[t,n]=a.useState(),r=a.useRef(null),o=a.useRef(e),s=a.useRef("none"),i=a.useRef(void 0),c=e?"mounted":"unmounted",[u,f]=Zr(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.useEffect(()=>{u==="mounted"?(s.current=i.current??qe(r.current),i.current=void 0):s.current="none"},[u]),ae(()=>{const g=r.current,d=o.current;if(d!==e){const x=s.current,v=qe(g);e?(i.current=v,f("MOUNT")):v==="none"||g?.display==="none"?f("UNMOUNT"):f(d&&x!==v?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,f]),ae(()=>{if(t){let g;const d=t.ownerDocument.defaultView??window,m=Ne(v=>{const p=qe(r.current).includes(CSS.escape(v.animationName));if(v.target===t&&p&&(f("ANIMATION_END"),!o.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",g=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},"handleAnimationEnd"),x=Ne(v=>{v.target===t&&(s.current=qe(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{d.clearTimeout(g),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:a.useCallback(g=>{if(g){const d=getComputedStyle(g);r.current=d,i.current=qe(d)}else r.current=null;n(g)},[])}}Ne(Qr,"usePresence");function dn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Ne(dn,"setRef");function Jr(...e){const t=a.useRef(e);return t.current=e,a.useCallback(n=>{const r=t.current;let o=!1;const s=r.map(i=>{const c=dn(i,n);return!o&&typeof c=="function"&&(o=!0),c});if(o)return()=>{for(let i=0;i<s.length;i++){const c=s[i];typeof c=="function"?c():dn(r[i],null)}}},[])}Ne(Jr,"useStableComposedRefs");function qe(e){return e?.animationName||"none"}Ne(qe,"getAnimationName");function eo(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Ne(eo,"getElementRef");var Fi=Object.defineProperty,Ui=(e,t)=>Fi(e,"name",{value:t,configurable:!0}),qn=Dt[" useEffectEvent ".trim().toString()],Zn=Dt[" useInsertionEffect ".trim().toString()];function to(e){if(typeof qn=="function")return qn(e);const t=a.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Zn=="function"?Zn(()=>{t.current=e}):ae(()=>{t.current=e}),a.useMemo(()=>((...n)=>t.current?.(...n)),[])}Ui(to,"useEffectEvent");var Bi=Object.defineProperty,ft=(e,t)=>Bi(e,"name",{value:t,configurable:!0}),Vi=Dt[" useInsertionEffect ".trim().toString()]||ae;function fn({prop:e,defaultProp:t,onChange:n=ft(()=>{},"onChange"),caller:r}){const[o,s,i]=no({defaultProp:t,onChange:n}),c=e!==void 0,u=c?e:o,f=a.useCallback(g=>{if(c){const d=ro(g)?g(e):g;d!==e&&i.current?.(d)}else s(g)},[c,e,s,i]);return[u,f]}ft(fn,"useControllableState");function no({defaultProp:e,onChange:t}){const[n,r]=a.useState(e),o=a.useRef(n),s=a.useRef(t);return Vi(()=>{s.current=t},[t]),a.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}ft(no,"useUncontrolledState");function ro(e){return typeof e=="function"}ft(ro,"isFunction");var Qn=Symbol("RADIX:SYNC_STATE");function Hi(e,t,n,r){const{prop:o,defaultProp:s,onChange:i,caller:c}=t,u=o!==void 0,f=to(i),g=[{...n,state:s}];r&&g.push(r);const[d,m]=a.useReducer((p,w)=>{if(w.type===Qn)return{...p,state:w.state};const S=e(p,w);return u&&!Object.is(S.state,p.state)&&f(S.state),S},...g),x=d.state,v=a.useRef(x);a.useEffect(()=>{v.current!==x&&(v.current=x,u||f(x))},[x,v,u]);const h=a.useMemo(()=>o!==void 0?{...d,state:o}:d,[d,o]);return a.useEffect(()=>{u&&!Object.is(o,d.state)&&m({type:Qn,state:o})},[o,d.state,u]),[h,m]}ft(Hi,"useControllableStateReducer");var $i=Object.defineProperty,Wi=(e,t)=>$i(e,"name",{value:t,configurable:!0});function oo(e){const t=a.useRef({value:e,previous:e});return a.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}Wi(oo,"usePrevious");var Ki=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"}),Xi=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ke=new WeakMap,vt=new WeakMap,gt={},qt=0,so=function(e){return e&&(e.host||so(e.parentNode))},zi=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=so(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Yi=function(e,t,n,r){var o=zi(t,Array.isArray(e)?e:[e]);gt[n]||(gt[n]=new WeakMap);var s=gt[n],i=[],c=new Set,u=new Set(o),f=function(d){!d||c.has(d)||(c.add(d),f(d.parentNode))};o.forEach(f);var g=function(d){!d||u.has(d)||Array.prototype.forEach.call(d.children,function(m){if(c.has(m))g(m);else try{var x=m.getAttribute(r),v=x!==null&&x!=="false",h=(Ke.get(m)||0)+1,p=(s.get(m)||0)+1;Ke.set(m,h),s.set(m,p),i.push(m),h===1&&v&&vt.set(m,!0),p===1&&m.setAttribute(n,"true"),v||m.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",m,w)}})};return g(t),c.clear(),qt++,function(){i.forEach(function(d){var m=Ke.get(d)-1,x=s.get(d)-1;Ke.set(d,m),s.set(d,x),m||(vt.has(d)||d.removeAttribute(r),vt.delete(d)),x||d.removeAttribute(n)}),qt--,qt||(Ke=new WeakMap,Ke=new WeakMap,vt=new WeakMap,gt={})}},Gi=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Xi(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Yi(r,o,n,"aria-hidden")):function(){return null}},be=function(){return be=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},be.apply(this,arguments)};function io(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 o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function qi(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Ot="right-scroll-bar-position",Rt="width-before-scroll-bar",Zi="with-scroll-bars-hidden",Qi="--removed-body-scroll-bar-size";function Zt(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Ji(e,t){var n=a.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var ec=typeof window<"u"?a.useLayoutEffect:a.useEffect,Jn=new WeakMap;function tc(e,t){var n=Ji(null,function(r){return e.forEach(function(o){return Zt(o,r)})});return ec(function(){var r=Jn.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(c){s.has(c)||Zt(c,null)}),s.forEach(function(c){o.has(c)||Zt(c,i)})}Jn.set(n,e)},[e]),n}function nc(e){return e}function rc(e,t){t===void 0&&(t=nc);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(c){return c!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(c){return s(c)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var c=n;n=[],c.forEach(s),i=n}var u=function(){var g=i;i=[],g.forEach(s)},f=function(){return Promise.resolve().then(u)};f(),n={push:function(g){i.push(g),f()},filter:function(g){return i=i.filter(g),n}}}};return o}function oc(e){e===void 0&&(e={});var t=rc(null);return t.options=be({async:!0,ssr:!1},e),t}var co=function(e){var t=e.sideCar,n=io(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return a.createElement(r,be({},n))};co.isSideCarExport=!0;function sc(e,t){return e.useMedium(t),co}var ao=oc(),Qt=function(){},Bt=a.forwardRef(function(e,t){var n=a.useRef(null),r=a.useState({onScrollCapture:Qt,onWheelCapture:Qt,onTouchMoveCapture:Qt}),o=r[0],s=r[1],i=e.forwardProps,c=e.children,u=e.className,f=e.removeScrollBar,g=e.enabled,d=e.shards,m=e.sideCar,x=e.noRelative,v=e.noIsolation,h=e.inert,p=e.allowPinchZoom,w=e.as,S=w===void 0?"div":w,b=e.gapMode,y=io(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=m,P=tc([n,t]),O=be(be({},y),o);return a.createElement(a.Fragment,null,g&&a.createElement(C,{sideCar:ao,removeScrollBar:f,shards:d,noRelative:x,noIsolation:v,inert:h,setCallbacks:s,allowPinchZoom:!!p,lockRef:n,gapMode:b}),i?a.cloneElement(a.Children.only(c),be(be({},O),{ref:P})):a.createElement(S,be({},O,{className:u,ref:P}),c))});Bt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Bt.classNames={fullWidth:Rt,zeroRight:Ot};var ic=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function cc(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=ic();return t&&e.setAttribute("nonce",t),e}function ac(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function lc(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var uc=function(){var e=0,t=null;return{add:function(n){e==0&&(t=cc())&&(ac(t,n),lc(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},dc=function(){var e=uc();return function(t,n){a.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},lo=function(){var e=dc(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},fc={left:0,top:0,right:0,gap:0},Jt=function(e){return parseInt(e||"",10)||0},pc=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Jt(n),Jt(r),Jt(o)]},mc=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return fc;var t=pc(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},hc=lo(),et="data-scroll-locked",vc=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,c=e.gap;return n===void 0&&(n="margin"),`
1
+ var Dn=e=>{throw TypeError(e)};var Ln=(e,t,n)=>t.has(e)||Dn("Cannot "+n);var oe=(e,t,n)=>(Ln(e,t,"read from private field"),n?n.call(e):t.get(e)),jn=(e,t,n)=>t.has(e)?Dn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),$t=(e,t,n,r)=>(Ln(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);import{f as Co,b as It,j as l,d as se,r as a,g as ne,h as tt,R as Dt}from"./settings-BN7FyntE.js";import{u as Po,g as Oo,a as Ro,b as _o,c as No,t as To}from"./services-status-context-BnbZHZnu.js";var ut=Co();const Ao=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Io=It("check",Ao);const Do=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Lo=It("chevron-down",Do);const jo=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],ko=It("key-round",jo);const Mo=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Fo=It("triangle-alert",Mo);function Fe(e){const{className:t,variant:n,children:r}=e;return l.jsx("div",{className:se("rounded-xl bg-background",n==="bordered"&&"border border-border",t),children:r})}function Ye(e){const{className:t,children:n}=e;return l.jsx("div",{className:se("px-5 pt-5",t),children:n})}function Ge(e){const{className:t,children:n}=e;return l.jsx("div",{className:se("text-base font-semibold",t),children:n})}function Ue(e){const{className:t,children:n}=e;return l.jsx("div",{className:se("px-5 pb-5 pt-4",t),children:n})}function Ze(e){const{className:t,variant:n="default",size:r="default",children:o,...s}=e,i="inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-primary active:translate-y-px disabled:opacity-50 disabled:pointer-events-none",c={default:"bg-primary text-primary-foreground hover:bg-primary/90",secondary:"bg-muted text-foreground hover:bg-muted/80",ghost:"bg-transparent hover:bg-muted text-foreground"},u={default:"h-10 px-4 py-2",sm:"h-8 px-3"};return l.jsx("button",{className:se(i,c[n],u[r],t),...s,children:o})}function fr(e){const{className:t,...n}=e;return l.jsx("input",{className:se("w-full h-10 rounded-md border border-input bg-background px-3 py-2 text-sm","placeholder:text-muted-foreground","focus:outline-none focus-visible:ring-2 focus-visible:ring-primary",t),...n})}function Qe(e){const{className:t,...n}=e;return l.jsx("label",{className:se("text-sm font-medium text-foreground",t),...n})}var Uo=Object.defineProperty,Bo=(e,t)=>Uo(e,"name",{value:t,configurable:!0});function en(e,[t,n]){return Math.min(n,Math.max(t,e))}Bo(en,"clamp");var Vo=Object.defineProperty,rt=(e,t)=>Vo(e,"name",{value:t,configurable:!0}),pr=!!(typeof window<"u"&&window.document&&window.document.createElement);function J(e,t,{checkForDefaultPrevented:n=!0}={}){return rt(function(o){if(e?.(o),n===!1||!o||!o.defaultPrevented)return t?.(o)},"handleEvent")}rt(J,"composeEventHandlers");function Ho(e){if(!pr)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}rt(Ho,"getOwnerWindow");function tn(e){if(!pr)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}rt(tn,"getOwnerDocument");function mr(e,t=!1){const{activeElement:n}=tn(e);if(!n?.nodeName)return null;if(hr(n)&&n.contentDocument)return mr(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const o=tn(n).getElementById(r);if(o)return o}}return n}rt(mr,"getActiveElement");function hr(e){return e.tagName==="IFRAME"}rt(hr,"isFrame");var $o=Object.defineProperty,he=(e,t)=>$o(e,"name",{value:t,configurable:!0});function Wo(e,t){const n=a.createContext(t);n.displayName=e+"Context";const r=he(s=>{const{children:i,...c}=s,u=a.useMemo(()=>c,Object.values(c));return l.jsx(n.Provider,{value:u,children:i})},"Provider");r.displayName=e+"Provider";function o(s,i={}){const{optional:c=!1}=i,u=a.useContext(n);if(u)return u;if(t!==void 0)return t;if(!c)throw new Error(`\`${s}\` must be used within \`${e}\``)}return he(o,"useContext"),[r,o]}he(Wo,"createContext");function dt(e,t=[]){let n=[];function r(s,i){const c=a.createContext(i);c.displayName=s+"Context";const u=n.length;n=[...n,i];const f=he(d=>{const{scope:m,children:x,...v}=d,h=m?.[e]?.[u]||c,p=a.useMemo(()=>v,Object.values(v));return l.jsx(h.Provider,{value:p,children:x})},"Provider");f.displayName=s+"Provider";function g(d,m,x={}){const{optional:v=!1}=x,h=m?.[e]?.[u]||c,p=a.useContext(h);if(p)return p;if(i!==void 0)return i;if(!v)throw new Error(`\`${d}\` must be used within \`${s}\``)}return he(g,"useContext"),[f,g]}he(r,"createContext");const o=he(()=>{const s=n.map(i=>a.createContext(i));return he(function(c){const u=c?.[e]||s;return a.useMemo(()=>({[`__scope${e}`]:{...c,[e]:u}}),[c,u])},"useScope")},"createScope");return o.scopeName=e,[r,vr(o,...t)]}he(dt,"createContextScope");function vr(...e){const t=e[0];if(e.length===1)return t;const n=he(()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return he(function(s){const i=r.reduce((c,{useScope:u,scopeName:f})=>{const d=u(s)[`__scope${f}`];return{...c,...d}},{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}he(vr,"composeContextScopes");var Ko=Object.defineProperty,te=(e,t)=>Ko(e,"name",{value:t,configurable:!0});function gr(e){const t=e+"CollectionProvider",[n,r]=dt(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=te(h=>{const{scope:p,children:w}=h,S=a.useRef(null),b=a.useRef(new Map).current;return l.jsx(o,{scope:p,itemMap:b,collectionRef:S,children:w})},"CollectionProvider");i.displayName=t;const c=e+"CollectionSlot",u=tt(c),f=a.forwardRef((h,p)=>{const{scope:w,children:S}=h,b=s(c,w),y=ne(p,b.collectionRef);return l.jsx(u,{ref:y,children:S})});f.displayName=c;const g=e+"CollectionItemSlot",d="data-radix-collection-item",m=tt(g),x=a.forwardRef((h,p)=>{const{scope:w,children:S,...b}=h,y=a.useRef(null),C=ne(p,y),P=s(g,w);return a.useEffect(()=>(P.itemMap.set(y,{ref:y,...b}),()=>{P.itemMap.delete(y)})),l.jsx(m,{[d]:"",ref:C,children:S})});x.displayName=g;function v(h){const p=s(e+"CollectionConsumer",h);return a.useCallback(()=>{const S=p.collectionRef.current;if(!S)return[];const b=Array.from(S.querySelectorAll(`[${d}]`));return Array.from(p.itemMap.values()).sort((P,O)=>b.indexOf(P.ref.current)-b.indexOf(O.ref.current))},[p.collectionRef,p.itemMap])}return te(v,"useCollection"),[{Provider:i,Slot:f,ItemSlot:x},v,r]}te(gr,"createCollection");var kn=new WeakMap,G,pe,Wt=(pe=class extends Map{constructor(n){super(n);jn(this,G);$t(this,G,[...super.keys()]),kn.set(this,!0)}set(n,r){return kn.get(this)&&(this.has(n)?oe(this,G)[oe(this,G).indexOf(n)]=n:oe(this,G).push(n)),super.set(n,r),this}insert(n,r,o){const s=this.has(r),i=oe(this,G).length,c=vn(n);let u=c>=0?c:i+c;const f=u<0||u>=i?-1:u;if(f===this.size||s&&f===this.size-1||f===-1)return this.set(r,o),this;const g=this.size+(s?0:1);c<0&&u++;const d=[...oe(this,G)];let m,x=!1;for(let v=u;v<g;v++)if(u===v){let h=d[v];d[v]===r&&(h=d[v+1]),s&&this.delete(r),m=this.get(h),this.set(r,o)}else{!x&&d[v-1]===r&&(x=!0);const h=d[x?v:v-1],p=m;m=this.get(h),this.delete(h),this.set(h,p)}return this}with(n,r,o){const s=new pe(this);return s.insert(n,r,o),s}before(n){const r=oe(this,G).indexOf(n)-1;if(!(r<0))return this.entryAt(r)}setBefore(n,r,o){const s=oe(this,G).indexOf(n);return s===-1?this:this.insert(s,r,o)}after(n){let r=oe(this,G).indexOf(n);if(r=r===-1||r===this.size-1?-1:r+1,r!==-1)return this.entryAt(r)}setAfter(n,r,o){const s=oe(this,G).indexOf(n);return s===-1?this:this.insert(s+1,r,o)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return $t(this,G,[]),super.clear()}delete(n){const r=super.delete(n);return r&&oe(this,G).splice(oe(this,G).indexOf(n),1),r}deleteAt(n){const r=this.keyAt(n);return r!==void 0?this.delete(r):!1}at(n){const r=Ct(oe(this,G),n);if(r!==void 0)return this.get(r)}entryAt(n){const r=Ct(oe(this,G),n);if(r!==void 0)return[r,this.get(r)]}indexOf(n){return oe(this,G).indexOf(n)}keyAt(n){return Ct(oe(this,G),n)}from(n,r){const o=this.indexOf(n);if(o===-1)return;let s=o+r;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.at(s)}keyFrom(n,r){const o=this.indexOf(n);if(o===-1)return;let s=o+r;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(n,r){let o=0;for(const s of this){if(Reflect.apply(n,r,[s,o,this]))return s;o++}}findIndex(n,r){let o=0;for(const s of this){if(Reflect.apply(n,r,[s,o,this]))return o;o++}return-1}filter(n,r){const o=[];let s=0;for(const i of this)Reflect.apply(n,r,[i,s,this])&&o.push(i),s++;return new pe(o)}map(n,r){const o=[];let s=0;for(const i of this)o.push([i[0],Reflect.apply(n,r,[i,s,this])]),s++;return new pe(o)}reduce(...n){const[r,o]=n;let s=0,i=o??this.at(0);for(const c of this)s===0&&n.length===1?i=c:i=Reflect.apply(r,this,[i,c,s,this]),s++;return i}reduceRight(...n){const[r,o]=n;let s=o??this.at(-1);for(let i=this.size-1;i>=0;i--){const c=this.at(i);i===this.size-1&&n.length===1?s=c:s=Reflect.apply(r,this,[s,c,i,this])}return s}toSorted(n){const r=[...this.entries()].sort(n);return new pe(r)}toReversed(){const n=new pe;for(let r=this.size-1;r>=0;r--){const o=this.keyAt(r),s=this.get(o);n.set(o,s)}return n}toSpliced(...n){const r=[...this.entries()];return r.splice(...n),new pe(r)}slice(n,r){const o=new pe;let s=this.size-1;if(n===void 0)return o;n<0&&(n=n+this.size),r!==void 0&&r>0&&(s=r-1);for(let i=n;i<=s;i++){const c=this.keyAt(i),u=this.get(c);o.set(c,u)}return o}every(n,r){let o=0;for(const s of this){if(!Reflect.apply(n,r,[s,o,this]))return!1;o++}return!0}some(n,r){let o=0;for(const s of this){if(Reflect.apply(n,r,[s,o,this]))return!0;o++}return!1}},G=new WeakMap,te(pe,"OrderedDict"),pe);function Ct(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=xr(e,t);return n===-1?void 0:e[n]}te(Ct,"at");function xr(e,t){const n=e.length,r=vn(t),o=r>=0?r:n+r;return o<0||o>=n?-1:o}te(xr,"toSafeIndex");function vn(e){return e!==e||e===0?0:Math.trunc(e)}te(vn,"toSafeInteger");function Xo(e){const t=e+"CollectionProvider",[n,r]=dt(t),[o,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Wt,setItemMap:te(()=>{},"setItemMap")}),i=te(({state:b,...y})=>b?l.jsx(u,{...y,state:b}):l.jsx(c,{...y}),"CollectionProvider");i.displayName=t;const c=te(b=>{const y=p();return l.jsx(u,{...b,state:y})},"CollectionInit");c.displayName=t+"Init";const u=te(b=>{const{scope:y,children:C,state:P}=b,O=a.useRef(null),[T,N]=a.useState(null),I=ne(O,N),[F,A]=P;return a.useEffect(()=>{if(!T)return;const _=wr(()=>{});return _.observe(T,{childList:!0,subtree:!0}),()=>{_.disconnect()}},[T]),l.jsx(o,{scope:y,itemMap:F,setItemMap:A,collectionRef:I,collectionRefObject:O,collectionElement:T,children:C})},"CollectionProviderImpl");u.displayName=t+"Impl";const f=e+"CollectionSlot",g=tt(f),d=a.forwardRef((b,y)=>{const{scope:C,children:P}=b,O=s(f,C),T=ne(y,O.collectionRef);return l.jsx(g,{ref:T,children:P})});d.displayName=f;const m=e+"CollectionItemSlot",x="data-radix-collection-item",v=tt(m),h=a.forwardRef((b,y)=>{const{scope:C,children:P,...O}=b,T=a.useRef(null),[N,I]=a.useState(null),F=ne(y,T,I),A=s(m,C),{setItemMap:_}=A,L=a.useRef(O);yr(L.current,O)||(L.current=O);const H=L.current;return a.useEffect(()=>{const k=H;return _(M=>N?M.has(N)?M.set(N,{...k,element:N}).toSorted(nn):(M.set(N,{...k,element:N}),M.toSorted(nn)):M),()=>{_(M=>!N||!M.has(N)?M:(M.delete(N),new Wt(M)))}},[N,H,_]),l.jsx(v,{[x]:"",ref:F,children:P})});h.displayName=m;function p(){return a.useState(new Wt)}te(p,"useInitCollection");function w(b){const{itemMap:y}=s(e+"CollectionConsumer",b);return y}return te(w,"useCollection"),[{Provider:i,Slot:d,ItemSlot:h},{createCollectionScope:r,useCollection:w,useInitCollection:p}]}te(Xo,"createCollection");function yr(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||e[o]!==t[o])return!1;return!0}te(yr,"shallowEqual");function br(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}te(br,"isElementPreceding");function nn(e,t){return!e[1].element||!t[1].element?0:br(e[1].element,t[1].element)?-1:1}te(nn,"sortByDocumentPosition");function wr(e){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){e();return}})}te(wr,"getChildListObserver");var zo=Object.defineProperty,Yo=(e,t)=>zo(e,"name",{value:t,configurable:!0}),Go=a.createContext(void 0);function Sr(e){const t=a.useContext(Go);return e||t||"ltr"}Yo(Sr,"useDirection");var qo=Object.defineProperty,Zo=(e,t)=>qo(e,"name",{value:t,configurable:!0}),Qo=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],le=Qo.reduce((e,t)=>{const n=tt(`Primitive.${t}`),r=a.forwardRef((o,s)=>{const{asChild:i,...c}=o,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(u,{...c,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Er(e,t){e&&ut.flushSync(()=>e.dispatchEvent(t))}Zo(Er,"dispatchDiscreteCustomEvent");var Jo=Object.defineProperty,es=(e,t)=>Jo(e,"name",{value:t,configurable:!0});function Se(e){const t=a.useRef(e);return a.useEffect(()=>{t.current=e}),a.useMemo(()=>((...n)=>t.current?.(...n)),[])}es(Se,"useCallbackRef");var ts=Object.defineProperty,ee=(e,t)=>ts(e,"name",{value:t,configurable:!0}),rn="dismissableLayer.update",ns="dismissableLayer.pointerDownOutside",rs="dismissableLayer.focusOutside",Mn,Cr=a.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),os=a.forwardRef(ee(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:c,onInteractOutside:u,onDismiss:f,...g}=t,d=a.useContext(Cr),[m,x]=a.useState(null),v=m?.ownerDocument??globalThis?.document,[,h]=a.useState({}),p=ne(n,x),w=Array.from(d.layers),[S]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=S?w.indexOf(S):-1,y=m?w.indexOf(m):-1,C=d.layersWithOutsidePointerEventsDisabled.size>0,P=y>=b,O=a.useRef(!1),T=Pr(A=>{i?.(A),u?.(A),A.defaultPrevented||f?.()},{ownerDocument:v,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:O,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:a.useCallback(A=>{if(!(A instanceof Node))return!1;const _=[...d.branches].some(L=>L.contains(A));return P&&!_},[d.branches,P])}),N=Or(A=>{if(o&&O.current)return;const _=A.target;[...d.branches].some(H=>H.contains(_))||(c?.(A),u?.(A),A.defaultPrevented||f?.())},v),I=m?y===w.length-1:!1,F=Se(A=>{A.key==="Escape"&&(s?.(A),!A.defaultPrevented&&f&&(A.preventDefault(),f()))});return a.useEffect(()=>{if(I)return v.addEventListener("keydown",F,{capture:!0}),()=>v.removeEventListener("keydown",F,{capture:!0})},[v,I,F]),a.useEffect(()=>{if(m)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Mn=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(m)),d.layers.add(m),on(),()=>{r&&(d.layersWithOutsidePointerEventsDisabled.delete(m),d.layersWithOutsidePointerEventsDisabled.size===0&&(v.body.style.pointerEvents=Mn))}},[m,v,r,d]),a.useEffect(()=>()=>{m&&(d.layers.delete(m),d.layersWithOutsidePointerEventsDisabled.delete(m),on())},[m,d]),a.useEffect(()=>{const A=ee(()=>h({}),"handleUpdate");return document.addEventListener(rn,A),()=>document.removeEventListener(rn,A)},[]),l.jsx(le.div,{...g,ref:p,style:{pointerEvents:C?P?"auto":"none":void 0,...t.style},onFocusCapture:J(t.onFocusCapture,N.onFocusCapture),onBlurCapture:J(t.onBlurCapture,N.onBlurCapture),onPointerDownCapture:J(t.onPointerDownCapture,T.onPointerDownCapture)})},"DismissableLayer"));function ss(){const e=a.useContext(Cr),[t,n]=a.useState(null);return a.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}ee(ss,"useDismissableLayerSurface");var is=ee(()=>!0,"IS_TRUE");function Pr(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:s,shouldHandlePointerDownOutside:i=is}=t,c=Se(e),u=a.useRef(!1),f=a.useRef(!1),g=a.useRef(new Map),d=a.useRef(()=>{});return a.useEffect(()=>{function m(){f.current=!1,o.current=!1,g.current.clear()}ee(m,"resetOutsideInteraction");function x(){return Array.from(g.current.values()).some(Boolean)}ee(x,"isOutsideInteractionIntercepted");function v(b){if(!f.current)return;const y=b.target;y instanceof Node&&[...s].some(P=>P.contains(y))||g.current.set(b.type,!0),b.type==="click"&&window.setTimeout(()=>{f.current&&d.current()},0)}ee(v,"handleInteractionCapture");function h(b){f.current&&g.current.set(b.type,!1)}ee(h,"handleInteractionBubble");const p=ee(b=>{if(b.target&&!u.current){let y=function(){n.removeEventListener("click",d.current);const P=x();m(),P||gn(ns,c,C,{discrete:!0})};if(ee(y,"handleAndDispatchPointerDownOutsideEvent"),!i(b.target)){n.removeEventListener("click",d.current),m(),u.current=!1;return}const C={originalEvent:b};f.current=!0,o.current=r&&b.button===0,g.current.clear(),!r||b.button!==0?y():(n.removeEventListener("click",d.current),d.current=y,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),m();u.current=!1},"handlePointerDown"),w=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const b of w)n.addEventListener(b,v,!0),n.addEventListener(b,h);const S=window.setTimeout(()=>{n.addEventListener("pointerdown",p)},0);return()=>{window.clearTimeout(S),n.removeEventListener("pointerdown",p),n.removeEventListener("click",d.current);for(const b of w)n.removeEventListener(b,v,!0),n.removeEventListener(b,h)}},[n,c,r,o,s,i]),{onPointerDownCapture:ee(()=>u.current=!0,"onPointerDownCapture")}}ee(Pr,"usePointerDownOutside");function Or(e,t=globalThis?.document){const n=Se(e),r=a.useRef(!1);return a.useEffect(()=>{const o=ee(s=>{s.target&&!r.current&&gn(rs,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:ee(()=>r.current=!0,"onFocusCapture"),onBlurCapture:ee(()=>r.current=!1,"onBlurCapture")}}ee(Or,"useFocusOutside");function on(){const e=new CustomEvent(rn);document.dispatchEvent(e)}ee(on,"dispatchUpdate");function gn(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Er(o,s):o.dispatchEvent(s)}ee(gn,"handleAndDispatchCustomEvent");var cs=Object.defineProperty,xn=(e,t)=>cs(e,"name",{value:t,configurable:!0}),mt=0,We=null;function as(e){return yn(),e.children}xn(as,"FocusGuards");function yn(){a.useEffect(()=>{We||(We={start:sn(),end:sn()});const{start:e,end:t}=We;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),mt++,()=>{mt===1&&(We?.start.remove(),We?.end.remove(),We=null),mt=Math.max(0,mt-1)}},[])}xn(yn,"useFocusGuards");function sn(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}xn(sn,"createFocusGuard");var ls=Object.defineProperty,ce=(e,t)=>ls(e,"name",{value:t,configurable:!0}),Kt="focusScope.autoFocusOnMount",Xt="focusScope.autoFocusOnUnmount",Fn={bubbles:!1,cancelable:!0},us=a.forwardRef(ce(function(t,n){const{loop:r=!1,trapped:o=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...c}=t,[u,f]=a.useState(null),g=Se(s),d=Se(i),m=a.useRef(null),x=ne(n,f),v=a.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;a.useEffect(()=>{if(o){let p=function(y){if(v.paused||!u)return;const C=y.target;u.contains(C)?m.current=C:Pe(m.current,{select:!0})},w=function(y){if(v.paused||!u)return;const C=y.relatedTarget;C!==null&&(u.contains(C)||Pe(m.current,{select:!0}))},S=function(y){if(document.activeElement===document.body)for(const P of y)P.removedNodes.length>0&&Pe(u)};ce(p,"handleFocusIn"),ce(w,"handleFocusOut"),ce(S,"handleMutations"),document.addEventListener("focusin",p),document.addEventListener("focusout",w);const b=new MutationObserver(S);return u&&b.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",w),b.disconnect()}}},[o,u,v.paused]),a.useEffect(()=>{if(u){Un.add(v);const p=document.activeElement;if(!u.contains(p)){const S=new CustomEvent(Kt,Fn);u.addEventListener(Kt,g),u.dispatchEvent(S),S.defaultPrevented||(Rr(Ir(bn(u)),{select:!0}),document.activeElement===p&&Pe(u))}return()=>{u.removeEventListener(Kt,g),setTimeout(()=>{const S=new CustomEvent(Xt,Fn);u.addEventListener(Xt,d),u.dispatchEvent(S),S.defaultPrevented||Pe(p??document.body,{select:!0}),u.removeEventListener(Xt,d),Un.remove(v)},0)}}},[u,g,d,v]);const h=a.useCallback(p=>{if(!r&&!o||v.paused)return;const w=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,S=document.activeElement;if(w&&S){const b=p.currentTarget,[y,C]=_r(b);y&&C?!p.shiftKey&&S===C?(p.preventDefault(),r&&Pe(y,{select:!0})):p.shiftKey&&S===y&&(p.preventDefault(),r&&Pe(C,{select:!0})):S===b&&p.preventDefault()}},[r,o,v.paused]);return l.jsx(le.div,{tabIndex:-1,...c,ref:x,onKeyDown:h})},"FocusScope"));function Rr(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Pe(r,{select:t}),document.activeElement!==n)return}ce(Rr,"focusFirst");function _r(e){const t=bn(e),n=cn(t,e),r=cn(t.reverse(),e);return[n,r]}ce(_r,"getTabbableEdges");function bn(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:ce(r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}ce(bn,"getTabbableCandidates");function cn(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Nr(r,{upTo:t})))return r}ce(cn,"findVisible");function Nr(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}ce(Nr,"isHidden");function Tr(e){return e instanceof HTMLInputElement&&"select"in e}ce(Tr,"isSelectableInput");function Pe(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Tr(e)&&t&&e.select()}}ce(Pe,"focus");var Un=Ar();function Ar(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=an(e,t),e.unshift(t)},remove(t){e=an(e,t),e[0]?.resume()}}}ce(Ar,"createFocusScopesStack");function an(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}ce(an,"arrayRemove");function Ir(e){return e.filter(t=>t.tagName!=="A")}ce(Ir,"removeLinks");var ae=globalThis?.document?a.useLayoutEffect:()=>{},ds=Object.defineProperty,fs=(e,t)=>ds(e,"name",{value:t,configurable:!0}),ps=Dt[" useId ".trim().toString()]||(()=>{}),ms=0;function wn(e){const[t,n]=a.useState(ps());return ae(()=>{e||n(r=>r??String(ms++))},[e]),e||(t?`radix-${t}`:"")}fs(wn,"useId");const hs=["top","right","bottom","left"],De=Math.min,Oe=Math.max,_t=Math.round,ht=Math.floor,Re=e=>({x:e,y:e}),vs={left:"right",right:"left",bottom:"top",top:"bottom"};function Dr(e,t,n){return Oe(e,De(t,n))}function _e(e,t){return typeof e=="function"?e(t):e}function Le(e){return e.split("-")[0]}function ot(e){return e.split("-")[1]}function Sn(e){return e==="x"?"y":"x"}function En(e){return e==="y"?"height":"width"}function we(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Cn(e){return Sn(we(e))}function gs(e,t,n){n===void 0&&(n=!1);const r=ot(e),o=Cn(e),s=En(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Nt(i)),[i,Nt(i)]}function xs(e){const t=Nt(e);return[ln(e),t,ln(t)]}function ln(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Bn=["left","right"],Vn=["right","left"],ys=["top","bottom"],bs=["bottom","top"];function ws(e,t,n){switch(e){case"top":case"bottom":return n?t?Vn:Bn:t?Bn:Vn;case"left":case"right":return t?ys:bs;default:return[]}}function Ss(e,t,n,r){const o=ot(e);let s=ws(Le(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ln)))),s}function Nt(e){const t=Le(e);return vs[t]+e.slice(t.length)}function Es(e){var t,n,r,o;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(o=e.left)!=null?o:0}}function Lr(e){return typeof e!="number"?Es(e):{top:e,right:e,bottom:e,left:e}}function Tt(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Hn(e,t,n){let{reference:r,floating:o}=e;const s=we(t),i=Cn(t),c=En(i),u=Le(t),f=s==="y",g=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,m=r[c]/2-o[c]/2;let x;switch(u){case"top":x={x:g,y:r.y-o.height};break;case"bottom":x={x:g,y:r.y+r.height};break;case"right":x={x:r.x+r.width,y:d};break;case"left":x={x:r.x-o.width,y:d};break;default:x={x:r.x,y:r.y}}const v=ot(t);return v&&(x[i]+=m*(v==="end"?1:-1)*(n&&f?-1:1)),x}async function Cs(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:u}=e,{boundary:f="clippingAncestors",rootBoundary:g="viewport",elementContext:d="floating",altBoundary:m=!1,padding:x=0}=_e(t,e),v=Lr(x),p=c[m?d==="floating"?"reference":"floating":d],w=Tt(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(p)))==null||n?p:p.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:f,rootBoundary:g,strategy:u})),S=d==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),y=await(s.isElement==null?void 0:s.isElement(b))&&await(s.getScale==null?void 0:s.getScale(b))||{x:1,y:1},C=Tt(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:S,offsetParent:b,strategy:u}):S);return{top:(w.top-C.top+v.top)/y.y,bottom:(C.bottom-w.bottom+v.bottom)/y.y,left:(w.left-C.left+v.left)/y.x,right:(C.right-w.right+v.right)/y.x}}const Ps=50,Os=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Cs},u=await(i.isRTL==null?void 0:i.isRTL(t));let f=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:g,y:d}=Hn(f,r,u),m=r,x=0;const v={};for(let h=0;h<s.length;h++){const p=s[h];if(!p)continue;const{name:w,fn:S}=p,{x:b,y,data:C,reset:P}=await S({x:g,y:d,initialPlacement:r,placement:m,strategy:o,middlewareData:v,rects:f,platform:c,elements:{reference:e,floating:t}});g=b??g,d=y??d,v[w]={...v[w],...C},P&&x<Ps&&(x++,typeof P=="object"&&(P.placement&&(m=P.placement),P.rects&&(f=P.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):P.rects),{x:g,y:d}=Hn(f,m,u)),h=-1)}return{x:g,y:d,placement:m,strategy:o,middlewareData:v}},Rs=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:u}=t,{element:f,padding:g=0}=_e(e,t)||{};if(f==null)return{};const d=Lr(g),m={x:n,y:r},x=Cn(o),v=En(x),h=await i.getDimensions(f),p=x==="y",w=p?"top":"left",S=p?"bottom":"right",b=p?"clientHeight":"clientWidth",y=s.reference[v]+s.reference[x]-m[x]-s.floating[v],C=m[x]-s.reference[x],P=await(i.getOffsetParent==null?void 0:i.getOffsetParent(f));let O=P?P[b]:0;(!O||!await(i.isElement==null?void 0:i.isElement(P)))&&(O=c.floating[b]||s.floating[v]);const T=y/2-C/2,N=O/2-h[v]/2-1,I=De(d[w],N),F=De(d[S],N),A=O-h[v]-F,_=O/2-h[v]/2+T,L=Dr(I,_,A),H=!u.arrow&&ot(o)!=null&&_!==L&&s.reference[v]/2-(_<I?I:F)-h[v]/2<0,k=H?_<I?_-I:_-A:0;return{[x]:m[x]+k,data:{[x]:L,centerOffset:_-L-k,...H&&{alignmentOffset:k}},reset:H}}}),_s=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:u,elements:f}=t,{mainAxis:g=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:h=!0,...p}=_e(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const w=Le(o),S=we(c),b=Le(c)===c,y=await(u.isRTL==null?void 0:u.isRTL(f.floating)),C=m||(b||!h?[Nt(c)]:xs(c)),P=v!=="none";!m&&P&&C.push(...Ss(c,h,v,y));const O=[c,...C],T=await u.detectOverflow(t,p),N=[];let I=((r=s.flip)==null?void 0:r.overflows)||[];if(g&&N.push(T[w]),d){const L=gs(o,i,y);N.push(T[L[0]],T[L[1]])}if(I=[...I,{placement:o,overflows:N}],!N.every(L=>L<=0)){var F,A;const L=(((F=s.flip)==null?void 0:F.index)||0)+1,H=O[L];if(H&&(!(d==="alignment"?S!==we(H):!1)||I.every(R=>we(R.placement)===S?R.overflows[0]>0:!0)))return{data:{index:L,overflows:I},reset:{placement:H}};let k=(A=I.filter(M=>M.overflows[0]<=0).sort((M,R)=>M.overflows[1]-R.overflows[1])[0])==null?void 0:A.placement;if(!k)switch(x){case"bestFit":{var _;const M=(_=I.filter(R=>{if(P){const U=we(R.placement);return U===S||U==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(U=>U>0).reduce((U,B)=>U+B,0)]).sort((R,U)=>R[1]-U[1])[0])==null?void 0:_[0];M&&(k=M);break}case"initialPlacement":k=c;break}if(o!==k)return{reset:{placement:k}}}return{}}}};function $n(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Wn(e){return hs.some(t=>e[t]>=0)}const Ns=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=_e(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),c=$n(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Wn(c)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),c=$n(i,n.floating);return{data:{escapedOffsets:c,escaped:Wn(c)}}}default:return{}}}}},jr=new Set(["left","top"]);async function Ts(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Le(n),c=ot(n),u=we(n)==="y",f=jr.has(i)?-1:1,g=s&&u?-1:1,d=_e(t,e);let{mainAxis:m,crossAxis:x,alignmentAxis:v}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof v=="number"&&(x=c==="end"?v*-1:v),u?{x:x*g,y:m*f}:{x:m*f,y:x*g}}const As=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,u=await Ts(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+u.x,y:s+u.y,data:{...u,placement:i}}}}},Is=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:u={fn:S=>{let{x:b,y}=S;return{x:b,y}}},...f}=_e(e,t),g={x:n,y:r},d=await s.detectOverflow(t,f),m=we(o),x=Sn(m);let v=g[x],h=g[m];const p=(S,b)=>Dr(b+d[S==="y"?"top":"left"],b,b-d[S==="y"?"bottom":"right"]);i&&(v=p(x,v)),c&&(h=p(m,h));const w=u.fn({...t,[x]:v,[m]:h});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[x]:i,[m]:c}}}}}},Ds=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:o,y:s,placement:i,rects:c,middlewareData:u}=t,{offset:f=0,mainAxis:g=!0,crossAxis:d=!0}=_e(e,t),m={x:o,y:s},x=we(i),v=Sn(x);let h=m[v],p=m[x];const w=_e(f,t),S=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:(n=w.mainAxis)!=null?n:0,crossAxis:(r=w.crossAxis)!=null?r:0};if(g){const C=v==="y"?"height":"width",P=c.reference[v]-c.floating[C]+S.mainAxis,O=c.reference[v]+c.reference[C]-S.mainAxis;h<P?h=P:h>O&&(h=O)}if(d){var b,y;const C=v==="y"?"width":"height",P=jr.has(Le(i)),O=c.reference[x]-c.floating[C]+(P&&((b=u.offset)==null?void 0:b[x])||0)+(P?0:S.crossAxis),T=c.reference[x]+c.reference[C]+(P?0:((y=u.offset)==null?void 0:y[x])||0)-(P?S.crossAxis:0);p<O?p=O:p>T&&(p=T)}return{[v]:h,[x]:p}}}},Ls=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:i=()=>{},...c}=_e(e,t),u=await o.detectOverflow(t,c),f=Le(n),g=ot(n),d=we(n)==="y",{width:m,height:x}=r.floating;let v,h;f==="top"||f==="bottom"?(v=f,h=g===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(h=f,v=g==="end"?"top":"bottom");const p=x-u.top-u.bottom,w=m-u.left-u.right,S=De(x-u[v],p),b=De(m-u[h],w),y=t.middlewareData.shift,C=!y;let P=S,O=b;y!=null&&y.enabled.x&&(O=w),y!=null&&y.enabled.y&&(P=p),C&&!g&&(d?O=m-2*Oe(u.left,u.right):P=x-2*Oe(u.top,u.bottom)),await i({...t,availableWidth:O,availableHeight:P});const T=await o.getDimensions(s.floating);return m!==T.width||x!==T.height?{reset:{rects:!0}}:{}}}};function Lt(){return typeof window<"u"}function st(e){return kr(e)?(e.nodeName||"").toLowerCase():"#document"}function fe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Te(e){var t;return(t=(kr(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function kr(e){return Lt()?e instanceof Node||e instanceof fe(e).Node:!1}function Ee(e){return Lt()?e instanceof Element||e instanceof fe(e).Element:!1}function je(e){return Lt()?e instanceof HTMLElement||e instanceof fe(e).HTMLElement:!1}function Kn(e){return!Lt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof fe(e).ShadowRoot}function jt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ce(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function js(e){return/^(table|td|th)$/.test(st(e))}function kt(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const ks=/transform|translate|scale|rotate|perspective|filter/,Ms=/paint|layout|strict|content/,Me=e=>!!e&&e!=="none";let zt;function Pn(e){const t=Ee(e)?Ce(e):e;return Me(t.transform)||Me(t.translate)||Me(t.scale)||Me(t.rotate)||Me(t.perspective)||!On()&&(Me(t.backdropFilter)||Me(t.filter))||ks.test(t.willChange||"")||Ms.test(t.contain||"")}function Fs(e){let t=Be(e);for(;je(t)&&!at(t);){if(Pn(t))return t;if(kt(t))return null;t=Be(t)}return null}function On(){return zt==null&&(zt=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),zt}function at(e){return/^(html|body|#document)$/.test(st(e))}function Ce(e){return fe(e).getComputedStyle(e)}function Mt(e){return Ee(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Be(e){if(st(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Kn(e)&&e.host||Te(e);return Kn(t)?t.host:t}function Mr(e){const t=Be(e);return at(t)?(e.ownerDocument||e).body:je(t)&&jt(t)?t:Mr(t)}function lt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Mr(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=fe(o);if(s){const c=un(i);return t.concat(i,i.visualViewport||[],jt(o)?o:[],c&&n?lt(c):[])}else return t.concat(o,lt(o,[],n))}function un(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Fr(e){const t=Ce(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=je(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=_t(n)!==s||_t(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function Rn(e){return Ee(e)?e:e.contextElement}function Je(e){const t=Rn(e);if(!je(t))return Re(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Fr(t);let i=(s?_t(n.width):n.width)/r,c=(s?_t(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Us=Re(0);function Ur(e){const t=fe(e);return!On()||!t.visualViewport?Us:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Bs(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===fe(e)}function Ve(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Rn(e);let i=Re(1);t&&(r?Ee(r)&&(i=Je(r)):i=Je(e));const c=Bs(s,n,r)?Ur(s):Re(0);let u=(o.left+c.x)/i.x,f=(o.top+c.y)/i.y,g=o.width/i.x,d=o.height/i.y;if(s&&r){const m=fe(s),x=Ee(r)?fe(r):r;let v=m,h=un(v);for(;h&&x!==v;){const p=Je(h),w=h.getBoundingClientRect(),S=Ce(h),b=w.left+(h.clientLeft+parseFloat(S.paddingLeft))*p.x,y=w.top+(h.clientTop+parseFloat(S.paddingTop))*p.y;u*=p.x,f*=p.y,g*=p.x,d*=p.y,u+=b,f+=y,v=fe(h),h=un(v)}}return Tt({width:g,height:d,x:u,y:f})}function Ft(e,t){const n=Mt(e).scrollLeft;return t?t.left+n:Ve(Te(e)).left+n}function Br(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ft(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Vs(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Te(r),c=t?kt(t.floating):!1;if(r===i||c&&s)return n;let u={scrollLeft:0,scrollTop:0},f=Re(1);const g=Re(0),d=je(r);if((d||!s)&&((st(r)!=="body"||jt(i))&&(u=Mt(r)),d)){const x=Ve(r);f=Je(r),g.x=x.x+r.clientLeft,g.y=x.y+r.clientTop}const m=i&&!d&&!s?Br(i,u):Re(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-u.scrollLeft*f.x+g.x+m.x,y:n.y*f.y-u.scrollTop*f.y+g.y+m.y}}function Hs(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function $s(e){const t=Mt(e),n=e.ownerDocument.body,r=Oe(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=Oe(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+Ft(e);const i=-t.scrollTop;return Ce(n).direction==="rtl"&&(s+=Oe(e.clientWidth,n.clientWidth)-r),{width:r,height:o,x:s,y:i}}const Ws=25;function Ks(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",o=fe(e),s=Te(e),i=o.visualViewport;let c=s.clientWidth,u=s.clientHeight,f=0,g=0;if(i){const m=!On()||t==="fixed";r?m||(f=-i.offsetLeft,g=-i.offsetTop):(c=i.width,u=i.height,m&&(f=i.offsetLeft,g=i.offsetTop))}if(Ft(s)<=0){const m=s.ownerDocument,x=m.body,v=getComputedStyle(x),h=m.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,p=Math.abs(s.clientWidth-x.clientWidth-h),w=getComputedStyle(s).scrollbarGutter==="stable both-edges"?p/2:p;w<=Ws&&(c-=w)}return{width:c,height:u,x:f,y:g}}function Xs(e,t){const n=Ve(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Je(e),i=e.clientWidth*s.x,c=e.clientHeight*s.y,u=o*s.x,f=r*s.y;return{width:i,height:c,x:u,y:f}}function Xn(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=Ks(e,n,t);else if(t==="document")r=$s(Te(e));else if(Ee(t))r=Xs(t,n);else{const o=Ur(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Tt(r)}function zs(e,t){const n=t.get(e);if(n)return n;let r=lt(e,[],!1).filter(c=>Ee(c)&&st(c)!=="body"),o=null;const s=Ce(e).position==="fixed";let i=s?Be(e):e;for(;Ee(i)&&!at(i);){const c=Ce(i),u=Pn(i),f=o?o.position:s?"fixed":"";!u&&(f==="fixed"||f==="absolute"&&c.position==="static")?r=r.filter(d=>d!==i):o=c,i=Be(i)}return t.set(e,r),r}function Ys(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?kt(t)?[]:zs(t,this._c):[].concat(n),r],c=Xn(t,i[0],o);let u=c.top,f=c.right,g=c.bottom,d=c.left;for(let m=1;m<i.length;m++){const x=Xn(t,i[m],o);u=Oe(x.top,u),f=De(x.right,f),g=De(x.bottom,g),d=Oe(x.left,d)}return{width:f-d,height:g-u,x:d,y:u}}function Gs(e){const{width:t,height:n}=Fr(e);return{width:t,height:n}}function qs(e,t,n){const r=je(t),o=Te(t),s=n==="fixed",i=Ve(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const u=Re(0);if((r||!s)&&((st(t)!=="body"||jt(o))&&(c=Mt(t)),r)){const m=Ve(t,!0,s,t);u.x=m.x+t.clientLeft,u.y=m.y+t.clientTop}!r&&o&&(u.x=Ft(o));const f=o&&!r&&!s?Br(o,c):Re(0),g=i.left+c.scrollLeft-u.x-f.x,d=i.top+c.scrollTop-u.y-f.y;return{x:g,y:d,width:i.width,height:i.height}}function Yt(e){return Ce(e).position==="static"}function zn(e,t){if(!je(e)||Ce(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Te(e)===n&&(n=n.ownerDocument.body),n}function Vr(e,t){const n=fe(e);if(kt(e))return n;if(!je(e)){let o=Be(e);for(;o&&!at(o);){if(Ee(o)&&!Yt(o))return o;o=Be(o)}return n}let r=zn(e,t);for(;r&&js(r)&&Yt(r);)r=zn(r,t);return r&&at(r)&&Yt(r)&&!Pn(r)?n:r||Fs(e)||n}const Zs=async function(e){const t=this.getOffsetParent||Vr,n=this.getDimensions,r=await n(e.floating);return{reference:qs(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Qs(e){return Ce(e).direction==="rtl"}const Js={convertOffsetParentRelativeRectToViewportRelativeRect:Vs,getDocumentElement:Te,getClippingRect:Ys,getOffsetParent:Vr,getElementRects:Zs,getClientRects:Hs,getDimensions:Gs,getScale:Je,isElement:Ee,isRTL:Qs};function Hr(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ei(e,t,n){let r=null,o;const s=Te(e);function i(){var g;clearTimeout(o),(g=r)==null||g.disconnect(),r=null}function c(g,d){g===void 0&&(g=!1),d===void 0&&(d=1),i();const m=e.getBoundingClientRect(),{left:x,top:v,width:h,height:p}=m;if(g||t(),!h||!p)return;const w=ht(v),S=ht(s.clientWidth-(x+h)),b=ht(s.clientHeight-(v+p)),y=ht(x),P={rootMargin:-w+"px "+-S+"px "+-b+"px "+-y+"px",threshold:Oe(0,De(1,d))||1};let O=!0;function T(N){const I=N[0].intersectionRatio;if(!Hr(m,e.getBoundingClientRect()))return c();if(I!==d){if(!O)return c();I?c(!1,I):o=setTimeout(()=>{c(!1,1e-7)},1e3)}O=!1}try{r=new IntersectionObserver(T,{...P,root:s.ownerDocument})}catch{r=new IntersectionObserver(T,P)}r.observe(e)}const u=fe(e),f=()=>c(n);return u.addEventListener("resize",f),c(!0),()=>{u.removeEventListener("resize",f),i()}}function ti(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=Rn(e),g=o||s?[...f?lt(f):[],...t?lt(t):[]]:[];g.forEach(w=>{o&&w.addEventListener("scroll",n),s&&w.addEventListener("resize",n)});const d=f&&c?ei(f,n,s):null;let m=-1,x=null;i&&(x=new ResizeObserver(w=>{let[S]=w;S&&S.target===f&&x&&t&&(x.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var b;(b=x)==null||b.observe(t)})),n()}),f&&!u&&x.observe(f),t&&x.observe(t));let v,h=u?Ve(e):null;u&&p();function p(){const w=Ve(e);h&&!Hr(h,w)&&n(),h=w,v=requestAnimationFrame(p)}return n(),()=>{var w;g.forEach(S=>{o&&S.removeEventListener("scroll",n),s&&S.removeEventListener("resize",n)}),d?.(),(w=x)==null||w.disconnect(),x=null,u&&cancelAnimationFrame(v)}}const ni=As,ri=Is,oi=_s,si=Ls,ii=Ns,Yn=Rs,ci=Ds,ai=(e,t,n)=>{const r=new Map,o=n??{},s={...Js,...o.platform,_c:r};return Os(e,t,{...o,platform:s})};var li=typeof document<"u",ui=function(){},Pt=li?a.useLayoutEffect:ui;function At(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,o;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(!At(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!At(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function $r(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Gn(e,t){const n=$r(e);return Math.round(t*n)/n}function Gt(e){const t=a.useRef(e);return Pt(()=>{t.current=e}),t}function di(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:u,open:f}=e,[g,d]=a.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,x]=a.useState(r);At(m,r)||x(r);const[v,h]=a.useState(null),[p,w]=a.useState(null),S=a.useCallback(R=>{R!==P.current&&(P.current=R,h(R))},[]),b=a.useCallback(R=>{R!==O.current&&(O.current=R,w(R))},[]),y=s||v,C=i||p,P=a.useRef(null),O=a.useRef(null),T=a.useRef(g),N=u!=null,I=Gt(u),F=Gt(o),A=Gt(f),_=a.useCallback(()=>{if(!P.current||!O.current)return;const R={placement:t,strategy:n,middleware:m};F.current&&(R.platform=F.current),ai(P.current,O.current,R).then(U=>{const B={...U,isPositioned:A.current!==!1};L.current&&!At(T.current,B)&&(T.current=B,ut.flushSync(()=>{d(B)}))})},[m,t,n,F,A]);Pt(()=>{f===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(R=>({...R,isPositioned:!1})))},[f]);const L=a.useRef(!1);Pt(()=>(L.current=!0,()=>{L.current=!1}),[]),Pt(()=>{if(y&&(P.current=y),C&&(O.current=C),y&&C){if(I.current)return I.current(y,C,_);_()}},[y,C,_,I,N]);const H=a.useMemo(()=>({reference:P,floating:O,setReference:S,setFloating:b}),[S,b]),k=a.useMemo(()=>({reference:y,floating:C}),[y,C]),M=a.useMemo(()=>{const R={position:n,left:0,top:0};if(!k.floating)return R;const U=Gn(k.floating,g.x),B=Gn(k.floating,g.y);return c?{...R,transform:"translate("+U+"px, "+B+"px)",...$r(k.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:B}},[n,c,k.floating,g.x,g.y]);return a.useMemo(()=>({...g,update:_,refs:H,elements:k,floatingStyles:M}),[g,_,H,k,M])}const fi=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Yn({element:r.current,padding:o}).fn(n):{}:r?Yn({element:r,padding:o}).fn(n):{}}}},pi=(e,t)=>{const n=ni(e);return{name:n.name,fn:n.fn,options:[e,t]}},mi=(e,t)=>{const n=ri(e);return{name:n.name,fn:n.fn,options:[e,t]}},hi=(e,t)=>({fn:ci(e).fn,options:[e,t]}),vi=(e,t)=>{const n=oi(e);return{name:n.name,fn:n.fn,options:[e,t]}},gi=(e,t)=>{const n=si(e);return{name:n.name,fn:n.fn,options:[e,t]}},xi=(e,t)=>{const n=ii(e);return{name:n.name,fn:n.fn,options:[e,t]}},yi=(e,t)=>{const n=fi(e);return{name:n.name,fn:n.fn,options:[e,t]}};var bi=Object.defineProperty,wi=(e,t)=>bi(e,"name",{value:t,configurable:!0});function Wr(e){const[t,n]=a.useState(void 0);return ae(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,c;if("borderBoxSize"in s){const u=s.borderBoxSize,f=Array.isArray(u)?u[0]:u;i=f.inlineSize,c=f.blockSize}else i=e.offsetWidth,c=e.offsetHeight;n({width:i,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}wi(Wr,"useSize");var Si=Object.defineProperty,Ie=(e,t)=>Si(e,"name",{value:t,configurable:!0}),Kr="Popper",[Xr,zr]=dt(Kr),[Ei,Yr]=Xr(Kr),Ci=Ie(e=>{const{__scopePopper:t,children:n}=e,[r,o]=a.useState(null),[s,i]=a.useState(void 0);return l.jsx(Ei,{scope:t,anchor:r,onAnchorChange:o,placementState:s,setPlacementState:i,children:n})},"Popper"),Pi="PopperAnchor",Oi=a.forwardRef(Ie(function(t,n){const{__scopePopper:r,virtualRef:o,...s}=t,i=Yr(Pi,r),c=a.useRef(null),u=i.onAnchorChange,f=a.useCallback(h=>{c.current=h,h&&u(h)},[u]),g=ne(n,f),d=a.useRef(null);a.useEffect(()=>{if(!o)return;const h=d.current;d.current=o.current,h!==d.current&&u(d.current)});const m=i.placementState&&Ut(i.placementState),x=m?.[0],v=m?.[1];return o?null:l.jsx(le.div,{"data-radix-popper-side":x,"data-radix-popper-align":v,...s,ref:g})},"PopperAnchor")),Gr="PopperContent",[Ri,wa]=Xr(Gr),_i=a.forwardRef(Ie(function(t,n){const{__scopePopper:r,side:o="bottom",sideOffset:s=0,align:i="center",alignOffset:c=0,arrowPadding:u=0,avoidCollisions:f=!0,collisionBoundary:g=[],collisionPadding:d=0,sticky:m="partial",hideWhenDetached:x=!1,updatePositionStrategy:v="optimized",onPlaced:h,...p}=t,w=Yr(Gr,r),[S,b]=a.useState(null),y=ne(n,b),[C,P]=a.useState(null),O=Wr(C),T=O?.width??0,N=O?.height??0,I=o+(i!=="center"?"-"+i:""),F=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},A=Array.isArray(g)?g:[g],_=A.length>0,L={padding:F,boundary:A.filter(qr),altBoundary:_},{refs:H,floatingStyles:k,placement:M,isPositioned:R,middlewareData:U}=di({strategy:"fixed",placement:I,whileElementsMounted:Ie((...V)=>ti(...V,{animationFrame:v==="always"}),"whileElementsMounted"),elements:{reference:w.anchor},middleware:[pi({mainAxis:s+N,alignmentAxis:c}),f&&mi({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?hi():void 0,...L}),f&&vi({...L}),gi({...L,apply:Ie(({elements:V,rects:Q,availableWidth:W,availableHeight:K})=>{const{width:Y,height:ve}=Q.reference,de=V.floating.style;de.setProperty("--radix-popper-available-width",`${W}px`),de.setProperty("--radix-popper-available-height",`${K}px`),de.setProperty("--radix-popper-anchor-width",`${Y}px`),de.setProperty("--radix-popper-anchor-height",`${ve}px`)},"apply")}),C&&yi({element:C,padding:u}),Ni({arrowWidth:T,arrowHeight:N}),x&&xi({strategy:"referenceHidden",...L,boundary:_?L.boundary:void 0})]}),B=w.setPlacementState;ae(()=>(B(M),()=>{B(void 0)}),[M,B]);const[ue,X]=Ut(M),Z=Se(h);ae(()=>{R&&Z?.()},[R,Z]);const ie=U.arrow?.x,re=U.arrow?.y,q=U.arrow?.centerOffset!==0,[xe,D]=a.useState();return ae(()=>{S&&D(window.getComputedStyle(S).zIndex)},[S]),l.jsx("div",{ref:H.setFloating,"data-radix-popper-content-wrapper":"",style:{...k,transform:R?k.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:xe,"--radix-popper-transform-origin":[U.transformOrigin?.x,U.transformOrigin?.y].join(" "),...U.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:l.jsx(Ri,{scope:r,placedSide:ue,placedAlign:X,onArrowChange:P,arrowX:ie,arrowY:re,shouldHideArrow:q,children:l.jsx(le.div,{"data-side":ue,"data-align":X,...p,ref:y,style:{...p.style,animation:R?p.style?.animation:"none"}})})})},"PopperContent"));function qr(e){return e!==null}Ie(qr,"isNotNull");var Ni=Ie(e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,c=i?0:e.arrowWidth,u=i?0:e.arrowHeight,[f,g]=Ut(n),d={start:"0%",center:"50%",end:"100%"}[g],m=(o.arrow?.x??0)+c/2,x=(o.arrow?.y??0)+u/2;let v="",h="";return f==="bottom"?(v=i?d:`${m}px`,h=`${-u}px`):f==="top"?(v=i?d:`${m}px`,h=`${r.floating.height+u}px`):f==="right"?(v=`${-u}px`,h=i?d:`${x}px`):f==="left"&&(v=`${r.floating.width+u}px`,h=i?d:`${x}px`),{data:{x:v,y:h}}}}),"transformOrigin");function Ut(e){const[t,n="center"]=e.split("-");return[t,n]}Ie(Ut,"getSideAndAlignFromPlacement");var Ti=Ci,Ai=Oi,Ii=_i,Di=Object.defineProperty,Li=(e,t)=>Di(e,"name",{value:t,configurable:!0}),ji=a.forwardRef(Li(function(t,n){const{container:r,...o}=t,[s,i]=a.useState(!1);ae(()=>i(!0),[]);const c=r||s&&globalThis?.document?.body;return c?ut.createPortal(l.jsx(le.div,{...o,ref:n}),c):null},"Portal")),ki=Object.defineProperty,Ne=(e,t)=>ki(e,"name",{value:t,configurable:!0});function Zr(e,t){return a.useReducer((n,r)=>t[n][r]??n,e)}Ne(Zr,"useStateMachine");var Mi=Ne(e=>{const{present:t,children:n}=e,r=Qr(t),o=typeof n=="function"?n({present:r.isPresent}):a.Children.only(n),s=Jr(r.ref,eo(o));return typeof n=="function"||r.isPresent?a.cloneElement(o,{ref:s}):null},"Presence");function Qr(e){const[t,n]=a.useState(),r=a.useRef(null),o=a.useRef(e),s=a.useRef("none"),i=a.useRef(void 0),c=e?"mounted":"unmounted",[u,f]=Zr(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.useEffect(()=>{u==="mounted"?(s.current=i.current??qe(r.current),i.current=void 0):s.current="none"},[u]),ae(()=>{const g=r.current,d=o.current;if(d!==e){const x=s.current,v=qe(g);e?(i.current=v,f("MOUNT")):v==="none"||g?.display==="none"?f("UNMOUNT"):f(d&&x!==v?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,f]),ae(()=>{if(t){let g;const d=t.ownerDocument.defaultView??window,m=Ne(v=>{const p=qe(r.current).includes(CSS.escape(v.animationName));if(v.target===t&&p&&(f("ANIMATION_END"),!o.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",g=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},"handleAnimationEnd"),x=Ne(v=>{v.target===t&&(s.current=qe(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{d.clearTimeout(g),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:a.useCallback(g=>{if(g){const d=getComputedStyle(g);r.current=d,i.current=qe(d)}else r.current=null;n(g)},[])}}Ne(Qr,"usePresence");function dn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Ne(dn,"setRef");function Jr(...e){const t=a.useRef(e);return t.current=e,a.useCallback(n=>{const r=t.current;let o=!1;const s=r.map(i=>{const c=dn(i,n);return!o&&typeof c=="function"&&(o=!0),c});if(o)return()=>{for(let i=0;i<s.length;i++){const c=s[i];typeof c=="function"?c():dn(r[i],null)}}},[])}Ne(Jr,"useStableComposedRefs");function qe(e){return e?.animationName||"none"}Ne(qe,"getAnimationName");function eo(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Ne(eo,"getElementRef");var Fi=Object.defineProperty,Ui=(e,t)=>Fi(e,"name",{value:t,configurable:!0}),qn=Dt[" useEffectEvent ".trim().toString()],Zn=Dt[" useInsertionEffect ".trim().toString()];function to(e){if(typeof qn=="function")return qn(e);const t=a.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Zn=="function"?Zn(()=>{t.current=e}):ae(()=>{t.current=e}),a.useMemo(()=>((...n)=>t.current?.(...n)),[])}Ui(to,"useEffectEvent");var Bi=Object.defineProperty,ft=(e,t)=>Bi(e,"name",{value:t,configurable:!0}),Vi=Dt[" useInsertionEffect ".trim().toString()]||ae;function fn({prop:e,defaultProp:t,onChange:n=ft(()=>{},"onChange"),caller:r}){const[o,s,i]=no({defaultProp:t,onChange:n}),c=e!==void 0,u=c?e:o,f=a.useCallback(g=>{if(c){const d=ro(g)?g(e):g;d!==e&&i.current?.(d)}else s(g)},[c,e,s,i]);return[u,f]}ft(fn,"useControllableState");function no({defaultProp:e,onChange:t}){const[n,r]=a.useState(e),o=a.useRef(n),s=a.useRef(t);return Vi(()=>{s.current=t},[t]),a.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}ft(no,"useUncontrolledState");function ro(e){return typeof e=="function"}ft(ro,"isFunction");var Qn=Symbol("RADIX:SYNC_STATE");function Hi(e,t,n,r){const{prop:o,defaultProp:s,onChange:i,caller:c}=t,u=o!==void 0,f=to(i),g=[{...n,state:s}];r&&g.push(r);const[d,m]=a.useReducer((p,w)=>{if(w.type===Qn)return{...p,state:w.state};const S=e(p,w);return u&&!Object.is(S.state,p.state)&&f(S.state),S},...g),x=d.state,v=a.useRef(x);a.useEffect(()=>{v.current!==x&&(v.current=x,u||f(x))},[x,v,u]);const h=a.useMemo(()=>o!==void 0?{...d,state:o}:d,[d,o]);return a.useEffect(()=>{u&&!Object.is(o,d.state)&&m({type:Qn,state:o})},[o,d.state,u]),[h,m]}ft(Hi,"useControllableStateReducer");var $i=Object.defineProperty,Wi=(e,t)=>$i(e,"name",{value:t,configurable:!0});function oo(e){const t=a.useRef({value:e,previous:e});return a.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}Wi(oo,"usePrevious");var Ki=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"}),Xi=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ke=new WeakMap,vt=new WeakMap,gt={},qt=0,so=function(e){return e&&(e.host||so(e.parentNode))},zi=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=so(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Yi=function(e,t,n,r){var o=zi(t,Array.isArray(e)?e:[e]);gt[n]||(gt[n]=new WeakMap);var s=gt[n],i=[],c=new Set,u=new Set(o),f=function(d){!d||c.has(d)||(c.add(d),f(d.parentNode))};o.forEach(f);var g=function(d){!d||u.has(d)||Array.prototype.forEach.call(d.children,function(m){if(c.has(m))g(m);else try{var x=m.getAttribute(r),v=x!==null&&x!=="false",h=(Ke.get(m)||0)+1,p=(s.get(m)||0)+1;Ke.set(m,h),s.set(m,p),i.push(m),h===1&&v&&vt.set(m,!0),p===1&&m.setAttribute(n,"true"),v||m.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",m,w)}})};return g(t),c.clear(),qt++,function(){i.forEach(function(d){var m=Ke.get(d)-1,x=s.get(d)-1;Ke.set(d,m),s.set(d,x),m||(vt.has(d)||d.removeAttribute(r),vt.delete(d)),x||d.removeAttribute(n)}),qt--,qt||(Ke=new WeakMap,Ke=new WeakMap,vt=new WeakMap,gt={})}},Gi=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Xi(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Yi(r,o,n,"aria-hidden")):function(){return null}},be=function(){return be=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},be.apply(this,arguments)};function io(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 o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function qi(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Ot="right-scroll-bar-position",Rt="width-before-scroll-bar",Zi="with-scroll-bars-hidden",Qi="--removed-body-scroll-bar-size";function Zt(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Ji(e,t){var n=a.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var ec=typeof window<"u"?a.useLayoutEffect:a.useEffect,Jn=new WeakMap;function tc(e,t){var n=Ji(null,function(r){return e.forEach(function(o){return Zt(o,r)})});return ec(function(){var r=Jn.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(c){s.has(c)||Zt(c,null)}),s.forEach(function(c){o.has(c)||Zt(c,i)})}Jn.set(n,e)},[e]),n}function nc(e){return e}function rc(e,t){t===void 0&&(t=nc);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(c){return c!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(c){return s(c)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var c=n;n=[],c.forEach(s),i=n}var u=function(){var g=i;i=[],g.forEach(s)},f=function(){return Promise.resolve().then(u)};f(),n={push:function(g){i.push(g),f()},filter:function(g){return i=i.filter(g),n}}}};return o}function oc(e){e===void 0&&(e={});var t=rc(null);return t.options=be({async:!0,ssr:!1},e),t}var co=function(e){var t=e.sideCar,n=io(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return a.createElement(r,be({},n))};co.isSideCarExport=!0;function sc(e,t){return e.useMedium(t),co}var ao=oc(),Qt=function(){},Bt=a.forwardRef(function(e,t){var n=a.useRef(null),r=a.useState({onScrollCapture:Qt,onWheelCapture:Qt,onTouchMoveCapture:Qt}),o=r[0],s=r[1],i=e.forwardProps,c=e.children,u=e.className,f=e.removeScrollBar,g=e.enabled,d=e.shards,m=e.sideCar,x=e.noRelative,v=e.noIsolation,h=e.inert,p=e.allowPinchZoom,w=e.as,S=w===void 0?"div":w,b=e.gapMode,y=io(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=m,P=tc([n,t]),O=be(be({},y),o);return a.createElement(a.Fragment,null,g&&a.createElement(C,{sideCar:ao,removeScrollBar:f,shards:d,noRelative:x,noIsolation:v,inert:h,setCallbacks:s,allowPinchZoom:!!p,lockRef:n,gapMode:b}),i?a.cloneElement(a.Children.only(c),be(be({},O),{ref:P})):a.createElement(S,be({},O,{className:u,ref:P}),c))});Bt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Bt.classNames={fullWidth:Rt,zeroRight:Ot};var ic=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function cc(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=ic();return t&&e.setAttribute("nonce",t),e}function ac(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function lc(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var uc=function(){var e=0,t=null;return{add:function(n){e==0&&(t=cc())&&(ac(t,n),lc(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},dc=function(){var e=uc();return function(t,n){a.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},lo=function(){var e=dc(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},fc={left:0,top:0,right:0,gap:0},Jt=function(e){return parseInt(e||"",10)||0},pc=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Jt(n),Jt(r),Jt(o)]},mc=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return fc;var t=pc(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},hc=lo(),et="data-scroll-locked",vc=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,c=e.gap;return n===void 0&&(n="margin"),`
2
2
  .`.concat(Zi,` {
3
3
  overflow: hidden `).concat(r,`;
4
4
  padding-right: `).concat(c,"px ").concat(r,`;
@@ -1 +1 @@
1
- import{j as t,c as s,a as d,r as o}from"./settings-yUyFIJxi.js";const n=d("inline-flex items-center rounded-lg border px-2.5 py-0.5 text-xs font-semibold transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-ring/50 focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow-sm shadow-primary/20 hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow-sm shadow-destructive/20 hover:bg-destructive/90",outline:"border-border/40 text-foreground bg-muted/30 backdrop-blur-sm"}},defaultVariants:{variant:"default"}});function x({className:r,variant:e,...a}){return t.jsx("div",{className:s(n({variant:e}),r),...a})}const i=o.forwardRef(({className:r,...e},a)=>t.jsx("div",{ref:a,className:s("rounded-2xl border border-border/50 bg-card shadow-lg shadow-black/5 transition-all duration-200",r),...e}));i.displayName="Card";const c=o.forwardRef(({className:r,...e},a)=>t.jsx("div",{ref:a,className:s("flex flex-col gap-1 p-6",r),...e}));c.displayName="CardHeader";const f=o.forwardRef(({className:r,...e},a)=>t.jsx("h3",{ref:a,className:s("text-2xl font-semibold tracking-tight",r),...e}));f.displayName="CardTitle";const l=o.forwardRef(({className:r,...e},a)=>t.jsx("p",{ref:a,className:s("text-sm text-muted-foreground",r),...e}));l.displayName="CardDescription";const m=o.forwardRef(({className:r,...e},a)=>t.jsx("div",{ref:a,className:s("p-6 pt-0",r),...e}));m.displayName="CardContent";const p=o.forwardRef(({className:r,...e},a)=>t.jsx("div",{ref:a,className:s("flex items-center p-6 pt-0",r),...e}));p.displayName="CardFooter";export{x as B,i as C,c as a,f as b,l as c,m as d};
1
+ import{j as t,c as s,a as d,r as o}from"./settings-BN7FyntE.js";const n=d("inline-flex items-center rounded-lg border px-2.5 py-0.5 text-xs font-semibold transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-ring/50 focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow-sm shadow-primary/20 hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow-sm shadow-destructive/20 hover:bg-destructive/90",outline:"border-border/40 text-foreground bg-muted/30 backdrop-blur-sm"}},defaultVariants:{variant:"default"}});function x({className:r,variant:e,...a}){return t.jsx("div",{className:s(n({variant:e}),r),...a})}const i=o.forwardRef(({className:r,...e},a)=>t.jsx("div",{ref:a,className:s("rounded-2xl border border-border/50 bg-card shadow-lg shadow-black/5 transition-all duration-200",r),...e}));i.displayName="Card";const c=o.forwardRef(({className:r,...e},a)=>t.jsx("div",{ref:a,className:s("flex flex-col gap-1 p-6",r),...e}));c.displayName="CardHeader";const f=o.forwardRef(({className:r,...e},a)=>t.jsx("h3",{ref:a,className:s("text-2xl font-semibold tracking-tight",r),...e}));f.displayName="CardTitle";const l=o.forwardRef(({className:r,...e},a)=>t.jsx("p",{ref:a,className:s("text-sm text-muted-foreground",r),...e}));l.displayName="CardDescription";const m=o.forwardRef(({className:r,...e},a)=>t.jsx("div",{ref:a,className:s("p-6 pt-0",r),...e}));m.displayName="CardContent";const p=o.forwardRef(({className:r,...e},a)=>t.jsx("div",{ref:a,className:s("flex items-center p-6 pt-0",r),...e}));p.displayName="CardFooter";export{x as B,i as C,c as a,f as b,l as c,m as d};