@undefineds.co/xpod 0.3.71-rc.8 → 0.3.71-rc.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/static/settings/assets/{ModelsPage-D87RrLB0.js → ModelsPage-03NPWzoX.js} +1 -1
- package/static/settings/assets/{PaneListHeader-BtON8Z5Q.js → PaneListHeader-DMD8OJef.js} +1 -1
- package/static/settings/assets/{PodPage-9LGuOloQ.js → PodPage-DT4EMYhL.js} +1 -1
- package/static/settings/assets/{ServicesPage-ZoT9-B_0.js → ServicesPage-CJ0ub6IH.js} +1 -1
- package/static/settings/assets/{SettingsPage-Bj4lB3mq.js → SettingsPage-BkR7ZK18.js} +1 -1
- package/static/settings/assets/{card-CCGngjas.js → card-Cjsia0_V.js} +1 -1
- package/static/settings/assets/{services-status-context-CBfImxL_.js → services-status-context-CkuKmH5h.js} +1 -1
- package/static/settings/assets/{settings-yUyFIJxi.js → settings-Cyyv6-SD.js} +2 -2
- package/static/settings/assets/{workspace-layout-B0wJpPze.js → workspace-layout-B47luv6r.js} +1 -1
- package/static/settings/settings.html +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@undefineds.co/xpod",
|
|
3
|
-
"version": "0.3.71-rc.
|
|
3
|
+
"version": "0.3.71-rc.9",
|
|
4
4
|
"description": "Xpod is an extended Community Solid Server, offering rich-feature, production-level Solid Pod and identity management.",
|
|
5
5
|
"repository": "https://github.com/undefinedsco/xpod",
|
|
6
6
|
"author": "developer@undefineds.co",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as p,j as n,c as Be,B as S,I as X,e as mt}from"./settings-yUyFIJxi.js";import{C as _e,a as De,b as Le,c as Re,d as Ue,B as Te}from"./card-CCGngjas.js";import{T as ht}from"./workspace-layout-B0wJpPze.js";function yt(e){if(!Me(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 Me(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ge(e){if(e!==void 0){if(!Me(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 xt=yt;function wt(e,t){return gt(e,t)}function gt(e,t){const r=At(e),s=e.createController(t);return r.type==="single-pane"?{layout:"single-pane",controller:s,element:p.createElement(r.render,{controller:s,host:t})}:r.type==="two-pane"?{layout:"two-pane",controller:s,slots:{listHeader:p.createElement(r.slots.listHeader,{controller:s,host:t}),list:p.createElement(r.slots.list,{controller:s,host:t}),mainHeader:p.createElement(r.slots.mainHeader,{controller:s,host:t}),main:p.createElement(r.slots.main,{controller:s,host:t})}}:{layout:"three-pane",controller:s,contextConfig:r.contextConfig,slots:{listHeader:p.createElement(r.slots.listHeader,{controller:s,host:t}),list:p.createElement(r.slots.list,{controller:s,host:t}),mainHeader:p.createElement(r.slots.mainHeader,{controller:s,host:t}),main:p.createElement(r.slots.main,{controller:s,host:t}),context:p.createElement(r.slots.context,{controller:s,host:t})}}}function At(e){if("layout"in e){const t=jt(e.layout),r=xt(t.descriptor),s=r.type;if(e.manifest.layout!==s)throw new Error(`Applet manifest layout ${e.manifest.layout} does not match descriptor layout ${s}`);if(s==="single-pane"){if(!("render"in t))throw new Error("Applet descriptor single-pane render must be a function");return D(t.render,"Applet descriptor single-pane render"),{type:"single-pane",render:t.render}}if(!("slots"in t))throw new Error(`Applet descriptor declares ${s} but no slots were provided`);return s==="two-pane"?(ne(t.slots,"Applet descriptor two-pane"),{type:"two-pane",slots:t.slots}):(Ct(t.slots,"Applet descriptor three-pane"),{type:"three-pane",contextConfig:r.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 D(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),D(e.listHeader,`${t} slot listHeader`),D(e.list,`${t} slot list`),D(e.mainHeader,`${t} slot mainHeader`),D(e.main,`${t} slot main`)}function Ct(e,t){ne(e,t),D(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 D(e,t){if(typeof e!="function")throw new Error(`${t} must be a function`)}function jt(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 Et=p.createContext(null);function vt(e){return n.jsx("nav",{className:Be("space-y-1 p-3",e.className),...e})}function St({selected:e,className:t,onClick:r,...s}){const a=p.useContext(Et);return n.jsx("button",{type:"button","aria-current":e?"page":void 0,className:Be("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=>{r?.(o),a?.showMain()},...s})}const ie=["openai","anthropic","kimi","bailian","deepseek"],Oe="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 Nt({webId:e,podBaseUrl:t,authenticatedFetch:r}){const s=oe(t),a=async(d,f,g,y={})=>{const b=await r(`${s}${d}`,{method:f,credentials:"omit",mode:"cors",headers:{accept:"application/json",...g?{"content-type":"application/json"}:{}},...g?{body:JSON.stringify(g)}:{}}),E=await Pt(b);if(!b.ok)throw new Error(It(E,b.status,y));return E},o=d=>(ce(d),`/api/ai/gateway/providers/${d}`),c=async(d,f,g,y)=>{const b=await a(`${o(d)}${f}`,g,y,{provider:d});return Lt(b,d)};return{webId:e,apiBase:s,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(_t).filter(be):[]},async listModels(){const d=await a("/v1/models","GET");return Array.isArray(d.data)?d.data.map(Ft).filter(be):[]},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 Dt(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?Ae(e.message):Ae(String(e))}function It(e,t,r={}){const s=kt(e),a=s?Q(s,r.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,r.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&&r.provider?`${re(r.provider)} connection is not configured.`:t===429?"AI Connection is rate limited. Please try again later.":t===503?"AI Connection service is unavailable.":Oe}function Ae(e){const t=Q(e);if(t)return t;const r=e.split(":",1)[0]?.trim(),s=r?Q(r):void 0;return s||(e==="AI Connection service identity is unavailable"?e:e.startsWith("invalid_")?"AI Connection returned an invalid response.":Oe)}function kt(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 Pt(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 Ft(e){if(!R(e)||typeof e.id!="string"||$t(e.id))return;const t=V(e.provider)??V(e.providerId)??V(e.owned_by)??Bt(e.id);if(t)return L({id:e.id,provider:t,displayName:I(e.displayName)??I(e.name),contextWindow:Ce(e.contextWindow)??Ce(e.context_window),protocols:Array.isArray(e.protocols)?e.protocols.filter(r=>typeof r=="string"):void 0})}function $t(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 Bt(e){const t=e.split("/",1)[0];return e.includes("/")?V(t):void 0}function Ce(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function _t(e){if(!(!R(e)||typeof e.provider!="string"||!Ut(e.status)||!R(e.connect)||!Array.isArray(e.connect.modes)||!e.connect.modes.every(Ke)||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 Dt(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 Lt(e,t){if(!R(e)||!Ke(e.mode)||!Rt(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:Z(e.authorizationUrl),userCode:I(e.userCode),verificationUri:Z(e.verificationUri),verificationUriComplete:Z(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 Z(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 Ke(e){return e==="browserAssistedApiKey"||e==="deviceCodeOAuth"||e==="connectUnsupported"}function Rt(e){return e==="pending"||e==="authorization_pending"||e==="slow_down"||e==="completed"||e==="expired"||e==="cancelled"||e==="unsupported"}function Ut(e){return e==="connected"||e==="disconnected"||e==="reauthRequired"}function R(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function be(e){return e!==void 0}const je="co.undefineds.ai-connection",Tt=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 r=e.service;if(!J(r)||typeof r.webId!="string"||typeof r.label!="string"||!Vt(r.webId))throw new Error("invalid_service");if(!Array.isArray(e.resources)||e.resources.length===0)throw new Error("invalid_empty_resources");const s=zt(t),a=new Set,o=e.resources.map(c=>Mt(c,s,a));return{appletId:je,service:{webId:r.webId,label:r.label},resources:o}}function Mt(e,t,r){if(!J(e)||typeof e.id!="string"||typeof e.url!="string"||e.mediaType!=="text/turtle"||!J(e.access))throw new Error("invalid_resource");if(!Tt.has(e.id)||r.has(e.id))throw new Error("invalid_resource");Ot(e.url);let s;try{s=new URL(e.url)}catch{throw new Error("invalid_resource")}if(!qt(s,t))throw new Error("invalid_resource");return r.add(e.id),{id:e.id,url:s.href,mediaType:"text/turtle",access:Ht(e.access)}}function Ot(e){if(/%(?![0-9a-fA-F]{2})/.test(e)||/%(?:2f|5c)/i.test(e)||e.includes("\\"))throw new Error("invalid_resource");const t=Kt(e);if(ve(t))throw new Error("invalid_resource");try{const r=decodeURIComponent(t);if(r.includes("\\")||ve(r))throw new Error("invalid_resource")}catch{throw new Error("invalid_resource")}}function Kt(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 Ht(e){if(Object.keys(e).some(r=>r!=="read"&&r!=="append"&&r!=="write")||e.read!==!0||e.append!==!0||e.write!==!0)throw new Error("invalid_resource");return{read:!0,append:!0,write:!0}}function zt(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 qt(e,t){return(e.protocol==="http:"||e.protocol==="https:")&&e.origin===t.origin&&e.pathname.startsWith(t.pathname)}function Vt(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 _=[{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(_.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(),r=Jt(t),s=e.solid.pod,o=t.status==="authenticated"&&s.status==="ready"?Nt({webId:t.webId,podBaseUrl:s.current.podUrl,authenticatedFetch:e.solid.session.fetch}):null;let c="openai",d="",f={},g={},y,b=0,E,v=o?"checking":"missing",l;const A=new Set,h=()=>A.forEach(m=>m()),j={client:o,sessionStatus:r,podStatus:s.status,error:s.status==="error"?s.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=_.find(x=>f[x.id]==="unconfigured")??_[0];m&&j.selectProvider(m.id)},setSearchQuery(m){d!==m&&(d=m,h())},setProviderState(m,x){if(f[m]===x)return;b+=1,f={...f,[m]:x};const C=Zt(m,x);C&&(g={...g,[m]:C}),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=b+1;b=m,y=void 0,h();try{const x=await o.listProviders();if(m!==b)return;g=Object.fromEntries(x.map(C=>[C.provider,C])),f=Object.fromEntries(_.map(C=>[C.id,Yt(g[C.id])])),h()}catch(x){if(m!==b)return;y=en(x),h()}finally{E=void 0}})(),E)},subscribe(m){return A.add(m),()=>A.delete(m)}};return j}function Jt(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 Wt(e){return p.useSyncExternalStore(e.subscribe,()=>e.providerStates,()=>e.providerStates)}function Gt(e){return p.useSyncExternalStore(e.subscribe,()=>e.providerSummaries,()=>e.providerSummaries)}function ze(e){return p.useSyncExternalStore(e.subscribe,()=>e.providerLoadError,()=>e.providerLoadError)}function Xt(e){return p.useSyncExternalStore(e.subscribe,()=>e.serviceAccessState,()=>e.serviceAccessState)}function Yt(e){return!e||e.status==="disconnected"?"unconfigured":e.status==="reauthRequired"?"attention":e.authMode==="browserAssistedApiKey"?"configured":"connected"}function Zt(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 en(e){return ae(e)}function tn({controller:e}){const t=de(e),r=He(e).trim().toLocaleLowerCase(),s=Wt(e),a=ze(e),o=r?_.filter(c=>c.name.toLocaleLowerCase().includes(r)):_;return n.jsxs(vt,{"aria-label":"AI 服务",children:[o.map(c=>n.jsx(nn,{provider:c,selected:t===c.id,state:s[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 nn({provider:e,selected:t,state:r,onSelect:s}){const a=`ai-connection-provider-${e.id}-status`,o=sn(r);return n.jsxs(St,{selected:t,"aria-label":e.name,"aria-describedby":a,onClick:s,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:rn(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 rn(e){switch(e){case"openai":return"OA";case"anthropic":return"A";case"kimi":return"K";case"bailian":return"百";case"deepseek":return"DS"}}function sn(e){switch(e){case"unconfigured":return"未设置";case"configured":return"已配置";case"connected":return"已连接";case"attention":return"需处理";default:return"读取中"}}const on=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),qe=(...e)=>e.filter((t,r,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===r).join(" ").trim();var an={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 cn=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:a="",children:o,iconNode:c,...d},f)=>p.createElement("svg",{ref:f,...an,width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:qe("lucide",a),...d},[...c.map(([g,y])=>p.createElement(g,y)),...Array.isArray(o)?o:[o]]));const P=(e,t)=>{const r=p.forwardRef(({className:s,...a},o)=>p.createElement(cn,{ref:o,iconNode:t,className:qe(`lucide-${on(e)}`,s),...a}));return r.displayName=`${e}`,r};const dn=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],un=P("Check",dn);const ln=[["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"}]],pn=P("Copy",ln);const fn=[["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"}]],mn=P("ExternalLink",fn);const hn=[["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",hn);const yn=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],G=P("LoaderCircle",yn);const xn=[["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"}]],wn=P("LogOut",xn);const gn=[["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"}]],An=P("MonitorCog",gn);const Cn=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],bn=P("Plus",Cn);const jn=[["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"}]],En=P("RefreshCcw",jn);const vn=[["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"}]],Sn=P("RotateCcw",vn);const Nn=[["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"}]],In=P("RotateCw",Nn);const kn=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Pn=P("Search",kn);const Fn=[["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"}]],$n=P("Trash2",Fn),Se=["codex","claude-code","pi","codebuddy"],U={codex:"Codex","claude-code":"Claude Code",pi:"Pi",codebuddy:"CodeBuddy"};function Bn({bridge:e,endpoint:t,createClientCredential:r}){const[s,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 A=>{let h;try{h=await e.inspect(A)}catch(j){h={status:"unavailable",message:K(j)}}l&&a(j=>({...j,[A]:h}))})),()=>{l=!1}},[e]);const b=async l=>{if(e){y(l);try{const A=await e.plan({client:l,endpoint:t});c(h=>({...h,[l]:A})),f(h=>({...h,[l]:""}))}catch(A){a(h=>({...h,[l]:{status:"unavailable",message:K(A)}}))}finally{y(void 0)}}},E=async l=>{const A=o[l];if(!e||!A||!r)return;y(l);let h,j=!1;try{h=await r(l),await e.apply({client:l,planId:A.planId,apiKey:h.apiKey,...A.confirmation?.required?{confirmation:{token:A.confirmation.token,targetHash:A.confirmation.targetHash}}:{}}),j=!0;const m=await e.verify({client:l,planId:A.planId});a(x=>({...x,[l]:m})),c(x=>({...x,[l]:void 0}))}catch(m){let x=K(m);if(h&&!j)try{await h.revoke()}catch(C){x=`${x};自动撤销新建 Client Credential 失败:${K(C)}。请到 Account Developer Access 手动撤销。`}a(C=>({...C,[l]:Dn(m)?{status:"failedAndRestored",message:"配置验证失败,已自动恢复原配置。"}:{status:"unavailable",message:x}}))}finally{y(void 0)}},v=async l=>{if(e){y(l);try{const A=await e.restore(l);a(h=>({...h,[l]:A}))}catch(A){a(h=>({...h,[l]:{status:"unavailable",message:K(A)}}))}finally{y(void 0)}}};return n.jsxs(_e,{children:[n.jsxs(De,{children:[n.jsxs(Le,{className:"flex items-center gap-2 text-base",children:[n.jsx(An,{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(Ue,{className:"space-y-2",children:Se.map(l=>{const A=s[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:U[l]}),n.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:A.message??Ne(A.status)})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Te,{variant:"secondary",children:Ne(A.status)}),n.jsx(S,{variant:"outline",size:"sm",disabled:!e||!!g,onClick:()=>{b(l)},children:"配置"}),n.jsx(S,{variant:"ghost",size:"icon","aria-label":`恢复 ${U[l]} 配置`,disabled:!e||A.status==="notConfigured"||!!g,onClick:()=>{v(l)},children:n.jsx(Sn,{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(C=>n.jsxs("div",{className:"text-xs text-muted-foreground",children:[n.jsx("span",{className:"font-mono",children:C.target})," · ",_n(C.action),C.backup?" · 创建备份":""]},`${C.target}:${C.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":`输入确认码以应用 ${U[l]} 配置`,value:m,onChange:C=>f(Y=>({...Y,[l]:C.target.value}))})]}):null,n.jsxs("div",{className:"flex gap-2",children:[n.jsx(S,{size:"sm","aria-label":j?.required?`确认并应用 ${U[l]} 配置`:`应用 ${U[l]} 配置`,disabled:!r||!!g||!x,onClick:()=>{E(l)},children:j?.required?"确认并应用":"应用更改"}),n.jsx(S,{variant:"ghost",size:"sm",disabled:!!g,onClick:()=>{c(C=>({...C,[l]:void 0})),f(C=>({...C,[l]:void 0}))},children:"取消"})]})]}):null]},l)})})]})}function _n(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 Dn(e){return!!(e&&typeof e=="object"&&"code"in e&&e.code==="verification_failed_restored")}function K(e){return ae(e)}function Ln({providerName:e,quota:t,busy:r,disabled:s=!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:r||s,onClick:a,children:[n.jsx(En,{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 Rn({definition:e,status:t,accountLabel:r,attempt:s,apiKey:a,busy:o,disabled:c=!1,error:d,quota:f,models:g,onApiKeyChange:y,onBeginApiKey:b,onBeginBrowser:E,onSaveApiKey:v,onDisconnect:l,onRefreshQuota:A}){const h=s?.mode==="browserAssistedApiKey"&&s.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:Un(e.id)})]}),n.jsx(Te,{variant:m||j?"default":"secondary",children:Tn(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:"当前连接"}),r?n.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:Mn(r)}):n.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Provider 凭证加密保存在当前 Pod。"})]}),s?.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:s.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(In,{className:"mr-2 h-4 w-4"}),"重新连接"]}),n.jsxs(S,{variant:"ghost",size:"sm",disabled:o||c,onClick:l,children:[n.jsx(wn,{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:b,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(mn,{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:b,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(Ln,{providerName:e.name,quota:f,busy:o,disabled:c,onRefresh:A})}),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 Un(e){switch(e){case"openai":return"OpenAI 模型与编码能力";case"anthropic":return"Claude 模型与编码能力";case"kimi":return"Moonshot AI 模型服务";case"bailian":return"阿里云百炼模型服务";case"deepseek":return"DeepSeek 模型服务"}}function Tn(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 r=e.slice(0,t);return`${r.length>1?`${r[0]}***${r[r.length-1]}`:`${r[0]}***`}${e.slice(t)}`}return e.length<=2?`${e[0]??""}***`:`${e[0]}***${e[e.length-1]}`}const On={};function Kn({client:e,openExternal:t=qn,clientConfigurationBridge:r,clientCredentialManager:s,selectedProvider:a,providerSummaries:o=On,providerLoadError:c,serviceAccessGranted:d=!1,onProviderStateChange:f}){const[g,y]=p.useState([]),[b,E]=p.useState(!!s),[v,l]=p.useState(""),[A,h]=p.useState(!1),[j,m]=p.useState(),[x,C]=p.useState(),[Y,ue]=p.useState({}),[Ze,et]=p.useState([]),[le,M]=p.useState({}),[pe,fe]=p.useState({}),[tt,nt]=p.useState({}),[rt,st]=p.useState({}),[it,me]=p.useState({}),[he,ye]=p.useState(!1),q=p.useRef(0),$=p.useCallback((i,u)=>{ue(w=>({...w,[i]:u})),f?.(i,zn(u))},[f]);p.useEffect(()=>{ue(Object.fromEntries(Object.values(o).filter(Qn).map(i=>[i.provider,i.status==="connected"&&i.authMode==="browserAssistedApiKey"?"configured":i.status])))},[o]),p.useEffect(()=>{let i=!0;return s?(E(!0),s.list().then(u=>{i&&y(u)}).catch(u=>{i&&C(B(u))}).finally(()=>{i&&E(!1)})):(E(!1),y([])),e.listModels().then(u=>{i&&et(u)}).catch(u=>{i&&C(B(u))}),()=>{i=!1,q.current+=1}},[e,s]);const F=(i,u)=>{nt(w=>({...w,[i]:u}))},k=(i,u)=>{st(w=>({...w,[i]:u}))},xe=p.useCallback(async i=>{const u=i.verificationUriComplete??i.authorizationUrl??i.verificationUri;u&&await t(u)},[t]),we=async i=>{if(d){F(i,!0),k(i);try{const u=await e.beginConnect(i,"browserAssistedApiKey");M(N=>({...N,[i]:u}));const w=se(u.status);if($(i,w?"pending":u.status==="completed"?"configured":"failed"),!w&&u.status!=="completed"){k(i,u.message??Ie(u.status));return}await xe(u)}catch(u){$(i,"failed"),k(i,B(u))}finally{F(i,!1)}}},ot=async i=>{if(!d||i.browserMode==="connectUnsupported")return;if(i.browserMode==="browserAssistedApiKey"){await we(i.id);return}F(i.id,!0),k(i.id);const u=q.current+1;q.current=u;try{const w=await e.beginConnect(i.id,i.browserMode);if(M(N=>({...N,[i.id]:w})),!se(w.status)){const N=w.status==="completed";$(i.id,N?"connected":"failed"),N||k(i.id,w.message??Ie(w.status)),F(i.id,!1);return}$(i.id,"pending"),await xe(w),Hn(e,i.id,w,u,q,{onAttempt:N=>M(O=>({...O,[i.id]:N})),onConnected:()=>$(i.id,"connected"),onFailed:N=>{$(i.id,"failed"),k(i.id,N)},onFinished:()=>F(i.id,!1)})}catch(w){$(i.id,"failed"),k(i.id,B(w)),F(i.id,!1)}},at=async i=>{if(!d)return;const u=pe[i.id]?.trim(),w=le[i.id];if(!(!u||!w)){F(i.id,!0),k(i.id);try{const N=await e.completeApiKey(i.id,w,u);M(O=>({...O,[i.id]:N})),fe(O=>({...O,[i.id]:""})),$(i.id,"configured")}catch(N){k(i.id,B(N)),$(i.id,"failed")}finally{F(i.id,!1)}}},ct=async i=>{if(d){F(i,!0),k(i);try{await e.disconnect(i),M(u=>({...u,[i]:void 0})),me(u=>({...u,[i]:void 0})),$(i,"disconnected")}catch(u){k(i,B(u))}finally{F(i,!1)}}},dt=async i=>{F(i,!0),k(i);try{const u=await e.quota(i,!0);me(w=>({...w,[i]:u}))}catch(u){k(i,B(u))}finally{F(i,!1)}},ut=async()=>{if(!(!d||!s)){h(!0),C(void 0),m(void 0);try{const i=await s.create({name:v.trim()||"AI Connection",webId:e.webId});m({clientId:i.clientId,clientSecret:i.clientSecret,apiKey:i.apiKey}),y(u=>[i,...u.filter(w=>w.resourceUrl!==i.resourceUrl)]),l("")}catch(i){C(B(i))}finally{h(!1)}}},lt=async i=>{if(!(!d||!s)){C(void 0);try{await s.revoke(i.resourceUrl),y(u=>u.filter(w=>w.resourceUrl!==i.resourceUrl))}catch(u){C(B(u))}}},pt=async()=>{j&&(await navigator.clipboard?.writeText(j.apiKey),ye(!0))},ft=p.useCallback(async i=>{if(!d)throw new Error("AI Connection service access is not granted");if(!s)throw new Error("Client Credentials are not available in this host");const u=await s.create({name:`AI Connection · ${U[i]}`,webId:e.webId});return y(w=>[u,...w.filter(N=>N.resourceUrl!==u.resourceUrl)]),{apiKey:u.apiKey,revoke:async()=>{await s.revoke(u.resourceUrl),y(w=>w.filter(N=>N.resourceUrl!==u.resourceUrl))}}},[e.webId,s,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,_.filter(i=>i.id===(a??"openai")).map(i=>n.jsx(Rn,{definition:i,status:Y[i.id]??"unknown",accountLabel:o[i.id]?.accountLabel,attempt:le[i.id],apiKey:pe[i.id]??"",busy:!!tt[i.id],disabled:!d,error:rt[i.id],quota:it[i.id],models:Ze.filter(u=>u.provider===i.id),onApiKeyChange:u=>fe(w=>({...w,[i.id]:u})),onBeginApiKey:()=>{we(i.id)},onBeginBrowser:()=>{ot(i)},onSaveApiKey:()=>{at(i)},onDisconnect:()=>{ct(i.id)},onRefreshQuota:()=>{dt(i.id)}},i.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(Bn,{bridge:r,endpoint:e.apiBase,createClientCredential:ft}),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(_e,{children:[n.jsxs(De,{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(Ue,{className:"space-y-4",children:[s?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:i=>l(i.target.value)}),n.jsxs(S,{onClick:()=>{ut()},disabled:A||!d||!s,children:[A?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:()=>{pt()},children:[he?n.jsx(un,{className:"mr-2 h-4 w-4"}):n.jsx(pn,{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,b?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(i=>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:i.id}),n.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:i.webId??e.webId})]}),n.jsx(S,{variant:"ghost",size:"icon","aria-label":`撤销 ${i.id}`,disabled:!d||!s,onClick:()=>{lt(i)},children:n.jsx($n,{className:"h-4 w-4"})})]},i.resourceUrl))})]})]})})]})]})]})]})}async function Hn(e,t,r,s,a,o){let c=r;try{for(;a.current===s&&se(c.status);){if(await Vn(Math.max(1,c.intervalSeconds??2)*1e3),a.current!==s)return;c=await e.pollDevice(t,c),o.onAttempt(c)}c.status==="completed"?o.onConnected():a.current===s&&o.onFailed(c.message||`连接${c.status==="expired"?"已过期":"失败"}`)}catch(d){a.current===s&&o.onFailed(B(d))}finally{a.current===s&&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 zn(e){return e==="configured"?"configured":e==="connected"?"connected":e==="failed"||e==="reauthRequired"?"attention":e==="pending"?"loading":"unconfigured"}function qn(e){window.open(e,"_blank","noopener,noreferrer")}function Vn(e){return new Promise(t=>window.setTimeout(t,e))}function B(e){return ae(e)}function Qn(e){return e!==void 0}function Jn({controller:e}){const t=de(e),r=Gt(e),s=ze(e),a=Xt(e),o=_.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:Wn(a)}),n.jsx(Kn,{client:e.client,selectedProvider:t,openExternal:e.openExternal,clientConfigurationBridge:e.clientConfigurationBridge,clientCredentialManager:e.clientCredentialManager,providerSummaries:r,providerLoadError:s,serviceAccessGranted:a==="granted",onProviderStateChange:e.setProviderState})]})}function Wn(e){return e==="granted"?"服务访问已授权":e==="checking"?"服务访问检查中":"服务访问未授权"}function Gn({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(Pn,{"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:r=>e.setSearchQuery(r.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 Xn({controller:e}){const t=de(e),r=_.find(s=>s.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:r?.name??t})})}const Yn=["navigation.openExternal","aiClientConfiguration"];function Zn(e){const t=ee(e,"Extension manifest");ke(t.extensionId,"extensionId"),T(t.name,"name"),T(t.version,"version"),T(t.sdkVersion,"sdkVersion");const r=ee(t.contributes,"contributes");if(!Array.isArray(r.applets)||r.applets.length===0)throw new Error("Extension manifest must contribute at least one Applet");const s=new Set;for(const a of r.applets){const o=ee(a,"Applet manifest"),c=ke(o.appId,"appId");if(s.has(c))throw new Error(`Extension manifest has duplicate appId: ${c}`);if(s.add(c),T(o.name,"Applet name"),T(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(!Yn.includes(a))throw new Error(`Extension manifest requested unknown Host capability: ${String(a)}`);return e}function ee(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object`);return e}function T(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 r=T(e,t);let s;try{s=new URL(r)}catch{throw new Error(`${t} must be a valid HTTPS URL`)}if(s.protocol!=="https:")throw new Error(`${t} must be a valid HTTPS URL`);return r}const Ve=Zn({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],er={manifest:Qe,createController:Qt,activate(e){e.ensureServiceAccess()},slots:{listHeader:Gn,list:tn,mainHeader:Xn,main:Jn}},tr={manifest:Ve,applets:{[Qe.appId]:er}};function nr(){return tr}const rr=3e4;function sr({podUrl:e,authenticatedFetch:t,now:r=()=>new Date}){const s=oe(e);let a,o;const c=async(y,b)=>{const E=await t(y,b);return a=await ar(E.clone()),E},d=async()=>{if(cr(a,r()))return a;if(o)return o;o=f();try{return await o}finally{o=void 0}},f=async()=>{if(!(await c(`${s}/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 b=a;if(!b?.token)throw new Error("AI Connection request failed. Please try again.");return b},g=async(y,b)=>{const E=await d(),v=dr(E);if(!v)throw new Error("AI Connection request failed. Please try again.");const l=new Headers(b?.headers);return l.set("Authorization",`Bearer ${v}`),t(y,{...b,credentials:"omit",headers:l})};return(async(y,b)=>{if(or(y,s))return c(y,b);const E=await g(y,b);if(E.status!==401)return Pe(E);await E.arrayBuffer(),a=void 0;const v=await g(y,b);return Pe(v)})}function ir({podUrl:e,authenticatedFetch:t,now:r}){const s=oe(e),a=sr({podUrl:e,authenticatedFetch:t,now:r});return{inspect:async o=>{const c=await a(H(s,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(s,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(s,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(s,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(s,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 or(e,t){try{return new URL(String(e),t).pathname==="/api/applets/service-access/ai-connection"}catch{return!1}}async function ar(e){if(!(!e.ok||!e.headers.get("content-type")?.includes("application/json")))try{const t=await e.json();return ur(t.invocation)}catch{return}}function cr(e,t){if(!e?.token)return!1;if(!e.expiresAt)return!0;const r=Date.parse(e.expiresAt);return Number.isFinite(r)&&r-t.getTime()>rr}function dr(e){return e?.token}function ur(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")?pr(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 lr(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 lr(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 r=typeof t.code=="string"?t.code:typeof t.error=="string"?t.error:void 0,s=typeof t.message=="string"?t.message:"AI client configuration request failed. Please try again.",a=new Error(s);return a.code=r,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 pr(e){let t;try{t=await e.clone().json()}catch{return e}return fr(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 fr(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))}const We="css-account",mr="xpod.cssAccountToken",hr="CSS-Account-Token";function Ge(){return typeof window<"u"&&typeof document<"u"}function yr(){if(!Ge())return;const e=document.cookie.split(";");for(const t of e){const[r,...s]=t.trim().split("=");if(r===We){const a=s.join("=");try{return a?decodeURIComponent(a):void 0}catch{return}}}}function xr(e){Ge()&&(document.cookie=`${We}=${encodeURIComponent(e)}; Path=/; SameSite=Lax`)}function wr(){if(!(typeof window>"u"))try{return window.sessionStorage.getItem(mr)||void 0}catch{return}}function gr(){const e=yr();if(e)return e;const t=wr();if(t)return xr(t),t}function Ar(e,t={Accept:"application/json"}){const r={...t};return e&&!Cr(r,"Authorization")&&(r.Authorization=`${hr} ${e}`),r}function te(e={Accept:"application/json"}){return Ar(gr(),e)}function Cr(e,t){const r=t.toLowerCase();return Object.keys(e).some(s=>s.toLowerCase()===r)}function br(e,t){return`sk-${btoa(`${e}:${t}`)}`}function jr(e,t,r=fetch){if(!e||!t)return;const s=new Set;return{available:!0,accountUrl:"/.account/",async list(){const a=await r(e,{method:"GET",headers:te({Accept:"application/json"}),credentials:"include"});if(!a.ok)throw new Error("Failed to list Client Credentials");const o=await a.json(),c=Er(o.clientCredentials).filter(d=>d.webId===t);for(const d of c)s.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 r(e,{method:"POST",headers:te({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=vr(c,a.webId,e);return s.add(d.resourceUrl),d},async revoke(a){if(!s.has(a))throw new Error("Cannot revoke a Client Credential outside the current WebID");if(!(await r(a,{method:"DELETE",headers:te({Accept:"application/json"}),credentials:"include"})).ok)throw new Error("Failed to revoke Client Credential")}}}function Er(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Object.entries(e).map(([t,r])=>({id:Sr(t),resourceUrl:t,webId:typeof r=="string"?r:void 0}))}function vr(e,t,r){if(!e.id||!e.secret)throw new Error("Client Credential response did not include the one-time secret");const s=e.resourceUrl??new URL(`${encodeURIComponent(e.id)}/`,r).href;return{id:e.id,resourceUrl:s,webId:e.webId??t,clientId:e.id,clientSecret:e.secret,apiKey:br(e.id,e.secret)}}function Sr(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 Xe=nr(),$e=Xe.manifest.contributes.applets[0]?.appId,Ye=$e?Xe.applets[$e]:void 0;if(!Ye)throw new Error("AI Connection extension did not contribute an applet");const Nr=Ye;function Ir(e,t){const r=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:r,permissions:{inspectAgentAccess:async s=>({status:"granted",resources:s.resources}),ensureAgentAccess:async s=>({status:"granted",resources:s.resources}),revokeAgentAccess:async s=>({status:"missing",resources:s.resources})},requireLogin:async()=>e.login(window.location.origin)},navigation:{openExternal:async s=>{window.open(s,"_blank","noopener,noreferrer")}},capabilities:{aiClientConfiguration:e.currentPod&&e.aiClientConfiguration?.available===!0&&e.aiClientConfiguration.authority==="local-filesystem"?ir({podUrl:e.currentPod.podUrl,authenticatedFetch:e.fetch}):kr,aiClientCredentials:jr(t?.account?.clientCredentials,e.webId,e.fetch)}}}const kr={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 Pr(e,t){const r=p.useMemo(()=>Ir(e,t),[e,t]);return p.useMemo(()=>{const s=wt(Nr,r);if(s.layout!=="two-pane")throw new Error("AI Connection applet must use a two-pane layout");return s},[r])}const Fr=p.createContext(null);function $r(){const e=p.useContext(Fr);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}function Lr(){const e=mt(),{controls:t}=$r(),r=Pr(e,t);return p.useEffect(()=>{r.controller.ensureServiceAccess()},[r.controller]),n.jsx(ht,{listHeader:r.slots.listHeader,list:r.slots.list,mainHeader:r.slots.mainHeader,main:r.slots.main,mode:"auto"})}export{Lr as default};
|
|
1
|
+
import{r as p,j as n,c as Be,B as S,I as X,e as mt}from"./settings-Cyyv6-SD.js";import{C as _e,a as De,b as Le,c as Re,d as Ue,B as Te}from"./card-Cjsia0_V.js";import{T as ht}from"./workspace-layout-B47luv6r.js";function yt(e){if(!Me(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 Me(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ge(e){if(e!==void 0){if(!Me(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 wt=yt;function xt(e,t){return gt(e,t)}function gt(e,t){const r=At(e),s=e.createController(t);return r.type==="single-pane"?{layout:"single-pane",controller:s,element:p.createElement(r.render,{controller:s,host:t})}:r.type==="two-pane"?{layout:"two-pane",controller:s,slots:{listHeader:p.createElement(r.slots.listHeader,{controller:s,host:t}),list:p.createElement(r.slots.list,{controller:s,host:t}),mainHeader:p.createElement(r.slots.mainHeader,{controller:s,host:t}),main:p.createElement(r.slots.main,{controller:s,host:t})}}:{layout:"three-pane",controller:s,contextConfig:r.contextConfig,slots:{listHeader:p.createElement(r.slots.listHeader,{controller:s,host:t}),list:p.createElement(r.slots.list,{controller:s,host:t}),mainHeader:p.createElement(r.slots.mainHeader,{controller:s,host:t}),main:p.createElement(r.slots.main,{controller:s,host:t}),context:p.createElement(r.slots.context,{controller:s,host:t})}}}function At(e){if("layout"in e){const t=jt(e.layout),r=wt(t.descriptor),s=r.type;if(e.manifest.layout!==s)throw new Error(`Applet manifest layout ${e.manifest.layout} does not match descriptor layout ${s}`);if(s==="single-pane"){if(!("render"in t))throw new Error("Applet descriptor single-pane render must be a function");return D(t.render,"Applet descriptor single-pane render"),{type:"single-pane",render:t.render}}if(!("slots"in t))throw new Error(`Applet descriptor declares ${s} but no slots were provided`);return s==="two-pane"?(ne(t.slots,"Applet descriptor two-pane"),{type:"two-pane",slots:t.slots}):(Ct(t.slots,"Applet descriptor three-pane"),{type:"three-pane",contextConfig:r.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 D(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),D(e.listHeader,`${t} slot listHeader`),D(e.list,`${t} slot list`),D(e.mainHeader,`${t} slot mainHeader`),D(e.main,`${t} slot main`)}function Ct(e,t){ne(e,t),D(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 D(e,t){if(typeof e!="function")throw new Error(`${t} must be a function`)}function jt(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 Et=p.createContext(null);function vt(e){return n.jsx("nav",{className:Be("space-y-1 p-3",e.className),...e})}function St({selected:e,className:t,onClick:r,...s}){const a=p.useContext(Et);return n.jsx("button",{type:"button","aria-current":e?"page":void 0,className:Be("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=>{r?.(o),a?.showMain()},...s})}const ie=["openai","anthropic","kimi","bailian","deepseek"],Oe="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 Nt({webId:e,podBaseUrl:t,authenticatedFetch:r}){const s=oe(t),a=async(d,f,g,y={})=>{const b=await r(`${s}${d}`,{method:f,credentials:"omit",mode:"cors",headers:{accept:"application/json",...g?{"content-type":"application/json"}:{}},...g?{body:JSON.stringify(g)}:{}}),E=await Pt(b);if(!b.ok)throw new Error(It(E,b.status,y));return E},o=d=>(ce(d),`/api/ai/gateway/providers/${d}`),c=async(d,f,g,y)=>{const b=await a(`${o(d)}${f}`,g,y,{provider:d});return Lt(b,d)};return{webId:e,apiBase:s,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(_t).filter(be):[]},async listModels(){const d=await a("/v1/models","GET");return Array.isArray(d.data)?d.data.map(Ft).filter(be):[]},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 Dt(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?Ae(e.message):Ae(String(e))}function It(e,t,r={}){const s=kt(e),a=s?Q(s,r.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,r.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&&r.provider?`${re(r.provider)} connection is not configured.`:t===429?"AI Connection is rate limited. Please try again later.":t===503?"AI Connection service is unavailable.":Oe}function Ae(e){const t=Q(e);if(t)return t;const r=e.split(":",1)[0]?.trim(),s=r?Q(r):void 0;return s||(e==="AI Connection service identity is unavailable"?e:e.startsWith("invalid_")?"AI Connection returned an invalid response.":Oe)}function kt(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 Pt(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 Ft(e){if(!R(e)||typeof e.id!="string"||$t(e.id))return;const t=V(e.provider)??V(e.providerId)??V(e.owned_by)??Bt(e.id);if(t)return L({id:e.id,provider:t,displayName:I(e.displayName)??I(e.name),contextWindow:Ce(e.contextWindow)??Ce(e.context_window),protocols:Array.isArray(e.protocols)?e.protocols.filter(r=>typeof r=="string"):void 0})}function $t(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 Bt(e){const t=e.split("/",1)[0];return e.includes("/")?V(t):void 0}function Ce(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function _t(e){if(!(!R(e)||typeof e.provider!="string"||!Ut(e.status)||!R(e.connect)||!Array.isArray(e.connect.modes)||!e.connect.modes.every(Ke)||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 Dt(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 Lt(e,t){if(!R(e)||!Ke(e.mode)||!Rt(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:Z(e.authorizationUrl),userCode:I(e.userCode),verificationUri:Z(e.verificationUri),verificationUriComplete:Z(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 Z(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 Ke(e){return e==="browserAssistedApiKey"||e==="deviceCodeOAuth"||e==="connectUnsupported"}function Rt(e){return e==="pending"||e==="authorization_pending"||e==="slow_down"||e==="completed"||e==="expired"||e==="cancelled"||e==="unsupported"}function Ut(e){return e==="connected"||e==="disconnected"||e==="reauthRequired"}function R(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function be(e){return e!==void 0}const je="co.undefineds.ai-connection",Tt=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 r=e.service;if(!J(r)||typeof r.webId!="string"||typeof r.label!="string"||!Vt(r.webId))throw new Error("invalid_service");if(!Array.isArray(e.resources)||e.resources.length===0)throw new Error("invalid_empty_resources");const s=zt(t),a=new Set,o=e.resources.map(c=>Mt(c,s,a));return{appletId:je,service:{webId:r.webId,label:r.label},resources:o}}function Mt(e,t,r){if(!J(e)||typeof e.id!="string"||typeof e.url!="string"||e.mediaType!=="text/turtle"||!J(e.access))throw new Error("invalid_resource");if(!Tt.has(e.id)||r.has(e.id))throw new Error("invalid_resource");Ot(e.url);let s;try{s=new URL(e.url)}catch{throw new Error("invalid_resource")}if(!qt(s,t))throw new Error("invalid_resource");return r.add(e.id),{id:e.id,url:s.href,mediaType:"text/turtle",access:Ht(e.access)}}function Ot(e){if(/%(?![0-9a-fA-F]{2})/.test(e)||/%(?:2f|5c)/i.test(e)||e.includes("\\"))throw new Error("invalid_resource");const t=Kt(e);if(ve(t))throw new Error("invalid_resource");try{const r=decodeURIComponent(t);if(r.includes("\\")||ve(r))throw new Error("invalid_resource")}catch{throw new Error("invalid_resource")}}function Kt(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 Ht(e){if(Object.keys(e).some(r=>r!=="read"&&r!=="append"&&r!=="write")||e.read!==!0||e.append!==!0||e.write!==!0)throw new Error("invalid_resource");return{read:!0,append:!0,write:!0}}function zt(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 qt(e,t){return(e.protocol==="http:"||e.protocol==="https:")&&e.origin===t.origin&&e.pathname.startsWith(t.pathname)}function Vt(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 _=[{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(_.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(),r=Jt(t),s=e.solid.pod,o=t.status==="authenticated"&&s.status==="ready"?Nt({webId:t.webId,podBaseUrl:s.current.podUrl,authenticatedFetch:e.solid.session.fetch}):null;let c="openai",d="",f={},g={},y,b=0,E,v=o?"checking":"missing",l;const A=new Set,h=()=>A.forEach(m=>m()),j={client:o,sessionStatus:r,podStatus:s.status,error:s.status==="error"?s.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=_.find(w=>f[w.id]==="unconfigured")??_[0];m&&j.selectProvider(m.id)},setSearchQuery(m){d!==m&&(d=m,h())},setProviderState(m,w){if(f[m]===w)return;b+=1,f={...f,[m]:w};const C=Zt(m,w);C&&(g={...g,[m]:C}),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),w=await e.solid.permissions.ensureAgentAccess(m);v=w.status==="granted"?"granted":w.status,h(),w.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),w=await e.solid.permissions.revokeAgentAccess(m);v=w.status==="granted"?"granted":w.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=b+1;b=m,y=void 0,h();try{const w=await o.listProviders();if(m!==b)return;g=Object.fromEntries(w.map(C=>[C.provider,C])),f=Object.fromEntries(_.map(C=>[C.id,Yt(g[C.id])])),h()}catch(w){if(m!==b)return;y=en(w),h()}finally{E=void 0}})(),E)},subscribe(m){return A.add(m),()=>A.delete(m)}};return j}function Jt(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 Wt(e){return p.useSyncExternalStore(e.subscribe,()=>e.providerStates,()=>e.providerStates)}function Gt(e){return p.useSyncExternalStore(e.subscribe,()=>e.providerSummaries,()=>e.providerSummaries)}function ze(e){return p.useSyncExternalStore(e.subscribe,()=>e.providerLoadError,()=>e.providerLoadError)}function Xt(e){return p.useSyncExternalStore(e.subscribe,()=>e.serviceAccessState,()=>e.serviceAccessState)}function Yt(e){return!e||e.status==="disconnected"?"unconfigured":e.status==="reauthRequired"?"attention":e.authMode==="browserAssistedApiKey"?"configured":"connected"}function Zt(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 en(e){return ae(e)}function tn({controller:e}){const t=de(e),r=He(e).trim().toLocaleLowerCase(),s=Wt(e),a=ze(e),o=r?_.filter(c=>c.name.toLocaleLowerCase().includes(r)):_;return n.jsxs(vt,{"aria-label":"AI 服务",children:[o.map(c=>n.jsx(nn,{provider:c,selected:t===c.id,state:s[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 nn({provider:e,selected:t,state:r,onSelect:s}){const a=`ai-connection-provider-${e.id}-status`,o=sn(r);return n.jsxs(St,{selected:t,"aria-label":e.name,"aria-describedby":a,onClick:s,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:rn(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 rn(e){switch(e){case"openai":return"OA";case"anthropic":return"A";case"kimi":return"K";case"bailian":return"百";case"deepseek":return"DS"}}function sn(e){switch(e){case"unconfigured":return"未设置";case"configured":return"已配置";case"connected":return"已连接";case"attention":return"需处理";default:return"读取中"}}const on=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),qe=(...e)=>e.filter((t,r,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===r).join(" ").trim();var an={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 cn=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:s,className:a="",children:o,iconNode:c,...d},f)=>p.createElement("svg",{ref:f,...an,width:t,height:t,stroke:e,strokeWidth:s?Number(r)*24/Number(t):r,className:qe("lucide",a),...d},[...c.map(([g,y])=>p.createElement(g,y)),...Array.isArray(o)?o:[o]]));const P=(e,t)=>{const r=p.forwardRef(({className:s,...a},o)=>p.createElement(cn,{ref:o,iconNode:t,className:qe(`lucide-${on(e)}`,s),...a}));return r.displayName=`${e}`,r};const dn=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],un=P("Check",dn);const ln=[["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"}]],pn=P("Copy",ln);const fn=[["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"}]],mn=P("ExternalLink",fn);const hn=[["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",hn);const yn=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],G=P("LoaderCircle",yn);const wn=[["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"}]],xn=P("LogOut",wn);const gn=[["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"}]],An=P("MonitorCog",gn);const Cn=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],bn=P("Plus",Cn);const jn=[["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"}]],En=P("RefreshCcw",jn);const vn=[["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"}]],Sn=P("RotateCcw",vn);const Nn=[["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"}]],In=P("RotateCw",Nn);const kn=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Pn=P("Search",kn);const Fn=[["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"}]],$n=P("Trash2",Fn),Se=["codex","claude-code","pi","codebuddy"],U={codex:"Codex","claude-code":"Claude Code",pi:"Pi",codebuddy:"CodeBuddy"};function Bn({bridge:e,endpoint:t,createClientCredential:r}){const[s,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 A=>{let h;try{h=await e.inspect(A)}catch(j){h={status:"unavailable",message:K(j)}}l&&a(j=>({...j,[A]:h}))})),()=>{l=!1}},[e]);const b=async l=>{if(e){y(l);try{const A=await e.plan({client:l,endpoint:t});c(h=>({...h,[l]:A})),f(h=>({...h,[l]:""}))}catch(A){a(h=>({...h,[l]:{status:"unavailable",message:K(A)}}))}finally{y(void 0)}}},E=async l=>{const A=o[l];if(!e||!A||!r)return;y(l);let h,j=!1;try{h=await r(l),await e.apply({client:l,planId:A.planId,apiKey:h.apiKey,...A.confirmation?.required?{confirmation:{token:A.confirmation.token,targetHash:A.confirmation.targetHash}}:{}}),j=!0;const m=await e.verify({client:l,planId:A.planId});a(w=>({...w,[l]:m})),c(w=>({...w,[l]:void 0}))}catch(m){let w=K(m);if(h&&!j)try{await h.revoke()}catch(C){w=`${w};自动撤销新建 Client Credential 失败:${K(C)}。请到 Account Developer Access 手动撤销。`}a(C=>({...C,[l]:Dn(m)?{status:"failedAndRestored",message:"配置验证失败,已自动恢复原配置。"}:{status:"unavailable",message:w}}))}finally{y(void 0)}},v=async l=>{if(e){y(l);try{const A=await e.restore(l);a(h=>({...h,[l]:A}))}catch(A){a(h=>({...h,[l]:{status:"unavailable",message:K(A)}}))}finally{y(void 0)}}};return n.jsxs(_e,{children:[n.jsxs(De,{children:[n.jsxs(Le,{className:"flex items-center gap-2 text-base",children:[n.jsx(An,{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(Ue,{className:"space-y-2",children:Se.map(l=>{const A=s[l]??{status:e?"notConfigured":"unavailable",message:e?void 0:"当前 Host 不支持修改本机客户端配置。"},h=o[l],j=h?.confirmation,m=d[l]??"",w=!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:U[l]}),n.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:A.message??Ne(A.status)})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Te,{variant:"secondary",children:Ne(A.status)}),n.jsx(S,{variant:"outline",size:"sm",disabled:!e||!!g,onClick:()=>{b(l)},children:"配置"}),n.jsx(S,{variant:"ghost",size:"icon","aria-label":`恢复 ${U[l]} 配置`,disabled:!e||A.status==="notConfigured"||!!g,onClick:()=>{v(l)},children:n.jsx(Sn,{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(C=>n.jsxs("div",{className:"text-xs text-muted-foreground",children:[n.jsx("span",{className:"font-mono",children:C.target})," · ",_n(C.action),C.backup?" · 创建备份":""]},`${C.target}:${C.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":`输入确认码以应用 ${U[l]} 配置`,value:m,onChange:C=>f(Y=>({...Y,[l]:C.target.value}))})]}):null,n.jsxs("div",{className:"flex gap-2",children:[n.jsx(S,{size:"sm","aria-label":j?.required?`确认并应用 ${U[l]} 配置`:`应用 ${U[l]} 配置`,disabled:!r||!!g||!w,onClick:()=>{E(l)},children:j?.required?"确认并应用":"应用更改"}),n.jsx(S,{variant:"ghost",size:"sm",disabled:!!g,onClick:()=>{c(C=>({...C,[l]:void 0})),f(C=>({...C,[l]:void 0}))},children:"取消"})]})]}):null]},l)})})]})}function _n(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 Dn(e){return!!(e&&typeof e=="object"&&"code"in e&&e.code==="verification_failed_restored")}function K(e){return ae(e)}function Ln({providerName:e,quota:t,busy:r,disabled:s=!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:r||s,onClick:a,children:[n.jsx(En,{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 Rn({definition:e,status:t,accountLabel:r,attempt:s,apiKey:a,busy:o,disabled:c=!1,error:d,quota:f,models:g,onApiKeyChange:y,onBeginApiKey:b,onBeginBrowser:E,onSaveApiKey:v,onDisconnect:l,onRefreshQuota:A}){const h=s?.mode==="browserAssistedApiKey"&&s.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:Un(e.id)})]}),n.jsx(Te,{variant:m||j?"default":"secondary",children:Tn(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:"当前连接"}),r?n.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:Mn(r)}):n.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Provider 凭证加密保存在当前 Pod。"})]}),s?.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:s.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(In,{className:"mr-2 h-4 w-4"}),"重新连接"]}),n.jsxs(S,{variant:"ghost",size:"sm",disabled:o||c,onClick:l,children:[n.jsx(xn,{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:b,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(mn,{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:b,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:w=>y(w.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(Ln,{providerName:e.name,quota:f,busy:o,disabled:c,onRefresh:A})}),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(w=>n.jsxs("li",{className:"flex items-center justify-between gap-4 py-2.5",children:[n.jsx("span",{children:w.displayName??w.id}),w.displayName?n.jsx("span",{className:"truncate font-mono text-xs text-muted-foreground",children:w.id}):null]},w.id))})]})]})}function Un(e){switch(e){case"openai":return"OpenAI 模型与编码能力";case"anthropic":return"Claude 模型与编码能力";case"kimi":return"Moonshot AI 模型服务";case"bailian":return"阿里云百炼模型服务";case"deepseek":return"DeepSeek 模型服务"}}function Tn(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 r=e.slice(0,t);return`${r.length>1?`${r[0]}***${r[r.length-1]}`:`${r[0]}***`}${e.slice(t)}`}return e.length<=2?`${e[0]??""}***`:`${e[0]}***${e[e.length-1]}`}const On={};function Kn({client:e,openExternal:t=qn,clientConfigurationBridge:r,clientCredentialManager:s,selectedProvider:a,providerSummaries:o=On,providerLoadError:c,serviceAccessGranted:d=!1,onProviderStateChange:f}){const[g,y]=p.useState([]),[b,E]=p.useState(!!s),[v,l]=p.useState(""),[A,h]=p.useState(!1),[j,m]=p.useState(),[w,C]=p.useState(),[Y,ue]=p.useState({}),[Ze,et]=p.useState([]),[le,M]=p.useState({}),[pe,fe]=p.useState({}),[tt,nt]=p.useState({}),[rt,st]=p.useState({}),[it,me]=p.useState({}),[he,ye]=p.useState(!1),q=p.useRef(0),$=p.useCallback((i,u)=>{ue(x=>({...x,[i]:u})),f?.(i,zn(u))},[f]);p.useEffect(()=>{ue(Object.fromEntries(Object.values(o).filter(Qn).map(i=>[i.provider,i.status==="connected"&&i.authMode==="browserAssistedApiKey"?"configured":i.status])))},[o]),p.useEffect(()=>{let i=!0;return s?(E(!0),s.list().then(u=>{i&&y(u)}).catch(u=>{i&&C(B(u))}).finally(()=>{i&&E(!1)})):(E(!1),y([])),e.listModels().then(u=>{i&&et(u)}).catch(u=>{i&&C(B(u))}),()=>{i=!1,q.current+=1}},[e,s]);const F=(i,u)=>{nt(x=>({...x,[i]:u}))},k=(i,u)=>{st(x=>({...x,[i]:u}))},we=p.useCallback(async i=>{const u=i.verificationUriComplete??i.authorizationUrl??i.verificationUri;u&&await t(u)},[t]),xe=async i=>{if(d){F(i,!0),k(i);try{const u=await e.beginConnect(i,"browserAssistedApiKey");M(N=>({...N,[i]:u}));const x=se(u.status);if($(i,x?"pending":u.status==="completed"?"configured":"failed"),!x&&u.status!=="completed"){k(i,u.message??Ie(u.status));return}await we(u)}catch(u){$(i,"failed"),k(i,B(u))}finally{F(i,!1)}}},ot=async i=>{if(!d||i.browserMode==="connectUnsupported")return;if(i.browserMode==="browserAssistedApiKey"){await xe(i.id);return}F(i.id,!0),k(i.id);const u=q.current+1;q.current=u;try{const x=await e.beginConnect(i.id,i.browserMode);if(M(N=>({...N,[i.id]:x})),!se(x.status)){const N=x.status==="completed";$(i.id,N?"connected":"failed"),N||k(i.id,x.message??Ie(x.status)),F(i.id,!1);return}$(i.id,"pending"),await we(x),Hn(e,i.id,x,u,q,{onAttempt:N=>M(O=>({...O,[i.id]:N})),onConnected:()=>$(i.id,"connected"),onFailed:N=>{$(i.id,"failed"),k(i.id,N)},onFinished:()=>F(i.id,!1)})}catch(x){$(i.id,"failed"),k(i.id,B(x)),F(i.id,!1)}},at=async i=>{if(!d)return;const u=pe[i.id]?.trim(),x=le[i.id];if(!(!u||!x)){F(i.id,!0),k(i.id);try{const N=await e.completeApiKey(i.id,x,u);M(O=>({...O,[i.id]:N})),fe(O=>({...O,[i.id]:""})),$(i.id,"configured")}catch(N){k(i.id,B(N)),$(i.id,"failed")}finally{F(i.id,!1)}}},ct=async i=>{if(d){F(i,!0),k(i);try{await e.disconnect(i),M(u=>({...u,[i]:void 0})),me(u=>({...u,[i]:void 0})),$(i,"disconnected")}catch(u){k(i,B(u))}finally{F(i,!1)}}},dt=async i=>{F(i,!0),k(i);try{const u=await e.quota(i,!0);me(x=>({...x,[i]:u}))}catch(u){k(i,B(u))}finally{F(i,!1)}},ut=async()=>{if(!(!d||!s)){h(!0),C(void 0),m(void 0);try{const i=await s.create({name:v.trim()||"AI Connection",webId:e.webId});m({clientId:i.clientId,clientSecret:i.clientSecret,apiKey:i.apiKey}),y(u=>[i,...u.filter(x=>x.resourceUrl!==i.resourceUrl)]),l("")}catch(i){C(B(i))}finally{h(!1)}}},lt=async i=>{if(!(!d||!s)){C(void 0);try{await s.revoke(i.resourceUrl),y(u=>u.filter(x=>x.resourceUrl!==i.resourceUrl))}catch(u){C(B(u))}}},pt=async()=>{j&&(await navigator.clipboard?.writeText(j.apiKey),ye(!0))},ft=p.useCallback(async i=>{if(!d)throw new Error("AI Connection service access is not granted");if(!s)throw new Error("Client Credentials are not available in this host");const u=await s.create({name:`AI Connection · ${U[i]}`,webId:e.webId});return y(x=>[u,...x.filter(N=>N.resourceUrl!==u.resourceUrl)]),{apiKey:u.apiKey,revoke:async()=>{await s.revoke(u.resourceUrl),y(x=>x.filter(N=>N.resourceUrl!==u.resourceUrl))}}},[e.webId,s,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,_.filter(i=>i.id===(a??"openai")).map(i=>n.jsx(Rn,{definition:i,status:Y[i.id]??"unknown",accountLabel:o[i.id]?.accountLabel,attempt:le[i.id],apiKey:pe[i.id]??"",busy:!!tt[i.id],disabled:!d,error:rt[i.id],quota:it[i.id],models:Ze.filter(u=>u.provider===i.id),onApiKeyChange:u=>fe(x=>({...x,[i.id]:u})),onBeginApiKey:()=>{xe(i.id)},onBeginBrowser:()=>{ot(i)},onSaveApiKey:()=>{at(i)},onDisconnect:()=>{ct(i.id)},onRefreshQuota:()=>{dt(i.id)}},i.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(Bn,{bridge:r,endpoint:e.apiBase,createClientCredential:ft}),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(_e,{children:[n.jsxs(De,{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(Ue,{className:"space-y-4",children:[s?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:i=>l(i.target.value)}),n.jsxs(S,{onClick:()=>{ut()},disabled:A||!d||!s,children:[A?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:()=>{pt()},children:[he?n.jsx(un,{className:"mr-2 h-4 w-4"}):n.jsx(pn,{className:"mr-2 h-4 w-4"}),he?"已复制":"复制 API Key"]}),n.jsx(S,{size:"sm",onClick:()=>{m(void 0),ye(!1)},children:"我已保存,隐藏密钥"})]})]}):null,w?n.jsx("p",{className:"text-sm text-destructive",children:w}):null,b?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(i=>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:i.id}),n.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:i.webId??e.webId})]}),n.jsx(S,{variant:"ghost",size:"icon","aria-label":`撤销 ${i.id}`,disabled:!d||!s,onClick:()=>{lt(i)},children:n.jsx($n,{className:"h-4 w-4"})})]},i.resourceUrl))})]})]})})]})]})]})]})}async function Hn(e,t,r,s,a,o){let c=r;try{for(;a.current===s&&se(c.status);){if(await Vn(Math.max(1,c.intervalSeconds??2)*1e3),a.current!==s)return;c=await e.pollDevice(t,c),o.onAttempt(c)}c.status==="completed"?o.onConnected():a.current===s&&o.onFailed(c.message||`连接${c.status==="expired"?"已过期":"失败"}`)}catch(d){a.current===s&&o.onFailed(B(d))}finally{a.current===s&&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 zn(e){return e==="configured"?"configured":e==="connected"?"connected":e==="failed"||e==="reauthRequired"?"attention":e==="pending"?"loading":"unconfigured"}function qn(e){window.open(e,"_blank","noopener,noreferrer")}function Vn(e){return new Promise(t=>window.setTimeout(t,e))}function B(e){return ae(e)}function Qn(e){return e!==void 0}function Jn({controller:e}){const t=de(e),r=Gt(e),s=ze(e),a=Xt(e),o=_.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:Wn(a)}),n.jsx(Kn,{client:e.client,selectedProvider:t,openExternal:e.openExternal,clientConfigurationBridge:e.clientConfigurationBridge,clientCredentialManager:e.clientCredentialManager,providerSummaries:r,providerLoadError:s,serviceAccessGranted:a==="granted",onProviderStateChange:e.setProviderState})]})}function Wn(e){return e==="granted"?"服务访问已授权":e==="checking"?"服务访问检查中":"服务访问未授权"}function Gn({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(Pn,{"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:r=>e.setSearchQuery(r.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 Xn({controller:e}){const t=de(e),r=_.find(s=>s.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:r?.name??t})})}const Yn=["navigation.openExternal","aiClientConfiguration"];function Zn(e){const t=ee(e,"Extension manifest");ke(t.extensionId,"extensionId"),T(t.name,"name"),T(t.version,"version"),T(t.sdkVersion,"sdkVersion");const r=ee(t.contributes,"contributes");if(!Array.isArray(r.applets)||r.applets.length===0)throw new Error("Extension manifest must contribute at least one Applet");const s=new Set;for(const a of r.applets){const o=ee(a,"Applet manifest"),c=ke(o.appId,"appId");if(s.has(c))throw new Error(`Extension manifest has duplicate appId: ${c}`);if(s.add(c),T(o.name,"Applet name"),T(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(!Yn.includes(a))throw new Error(`Extension manifest requested unknown Host capability: ${String(a)}`);return e}function ee(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object`);return e}function T(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 r=T(e,t);let s;try{s=new URL(r)}catch{throw new Error(`${t} must be a valid HTTPS URL`)}if(s.protocol!=="https:")throw new Error(`${t} must be a valid HTTPS URL`);return r}const Ve=Zn({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],er={manifest:Qe,createController:Qt,activate(e){e.ensureServiceAccess()},slots:{listHeader:Gn,list:tn,mainHeader:Xn,main:Jn}},tr={manifest:Ve,applets:{[Qe.appId]:er}};function nr(){return tr}const rr=3e4;function sr({podUrl:e,authenticatedFetch:t,now:r=()=>new Date}){const s=oe(e);let a,o;const c=async(y,b)=>{const E=await t(y,b);return a=await ar(E.clone()),E},d=async()=>{if(cr(a,r()))return a;if(o)return o;o=f();try{return await o}finally{o=void 0}},f=async()=>{if(!(await c(`${s}/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 b=a;if(!b?.token)throw new Error("AI Connection request failed. Please try again.");return b},g=async(y,b)=>{const E=await d(),v=dr(E);if(!v)throw new Error("AI Connection request failed. Please try again.");const l=new Headers(b?.headers);return l.set("Authorization",`Bearer ${v}`),t(y,{...b,credentials:"omit",headers:l})};return(async(y,b)=>{if(or(y,s))return c(y,b);const E=await g(y,b);if(E.status!==401)return Pe(E);await E.arrayBuffer(),a=void 0;const v=await g(y,b);return Pe(v)})}function ir({podUrl:e,authenticatedFetch:t,now:r}){const s=oe(e),a=sr({podUrl:e,authenticatedFetch:t,now:r});return{inspect:async o=>{const c=await a(H(s,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(s,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(s,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(s,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(s,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 or(e,t){try{return new URL(String(e),t).pathname==="/api/applets/service-access/ai-connection"}catch{return!1}}async function ar(e){if(!(!e.ok||!e.headers.get("content-type")?.includes("application/json")))try{const t=await e.json();return ur(t.invocation)}catch{return}}function cr(e,t){if(!e?.token)return!1;if(!e.expiresAt)return!0;const r=Date.parse(e.expiresAt);return Number.isFinite(r)&&r-t.getTime()>rr}function dr(e){return e?.token}function ur(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")?pr(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 lr(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 lr(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 r=typeof t.code=="string"?t.code:typeof t.error=="string"?t.error:void 0,s=typeof t.message=="string"?t.message:"AI client configuration request failed. Please try again.",a=new Error(s);return a.code=r,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 pr(e){let t;try{t=await e.clone().json()}catch{return e}return fr(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 fr(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))}const We="css-account",mr="xpod.cssAccountToken",hr="CSS-Account-Token";function Ge(){return typeof window<"u"&&typeof document<"u"}function yr(){if(!Ge())return;const e=document.cookie.split(";");for(const t of e){const[r,...s]=t.trim().split("=");if(r===We){const a=s.join("=");try{return a?decodeURIComponent(a):void 0}catch{return}}}}function wr(e){Ge()&&(document.cookie=`${We}=${encodeURIComponent(e)}; Path=/; SameSite=Lax`)}function xr(){if(!(typeof window>"u"))try{return window.sessionStorage.getItem(mr)||void 0}catch{return}}function gr(){const e=yr();if(e)return e;const t=xr();if(t)return wr(t),t}function Ar(e,t={Accept:"application/json"}){const r={...t};return e&&!Cr(r,"Authorization")&&(r.Authorization=`${hr} ${e}`),r}function te(e={Accept:"application/json"}){return Ar(gr(),e)}function Cr(e,t){const r=t.toLowerCase();return Object.keys(e).some(s=>s.toLowerCase()===r)}function br(e,t){return`sk-${btoa(`${e}:${t}`)}`}function jr(e,t,r=fetch){if(!e||!t)return;const s=new Set;return{available:!0,accountUrl:"/.account/",async list(){const a=await r(e,{method:"GET",headers:te({Accept:"application/json"}),credentials:"include"});if(!a.ok)throw new Error("Failed to list Client Credentials");const o=await a.json(),c=Er(o.clientCredentials).filter(d=>d.webId===t);for(const d of c)s.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 r(e,{method:"POST",headers:te({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=vr(c,a.webId,e);return s.add(d.resourceUrl),d},async revoke(a){if(!s.has(a))throw new Error("Cannot revoke a Client Credential outside the current WebID");if(!(await r(a,{method:"DELETE",headers:te({Accept:"application/json"}),credentials:"include"})).ok)throw new Error("Failed to revoke Client Credential")}}}function Er(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Object.entries(e).map(([t,r])=>({id:Sr(t),resourceUrl:t,webId:typeof r=="string"?r:void 0}))}function vr(e,t,r){if(!e.id||!e.secret)throw new Error("Client Credential response did not include the one-time secret");const s=e.resourceUrl??new URL(`${encodeURIComponent(e.id)}/`,r).href;return{id:e.id,resourceUrl:s,webId:e.webId??t,clientId:e.id,clientSecret:e.secret,apiKey:br(e.id,e.secret)}}function Sr(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 Xe=nr(),$e=Xe.manifest.contributes.applets[0]?.appId,Ye=$e?Xe.applets[$e]:void 0;if(!Ye)throw new Error("AI Connection extension did not contribute an applet");const Nr=Ye;function Ir(e,t=new URL("/.account/client-credentials/",window.location.origin).toString()){const r=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:r,permissions:{inspectAgentAccess:async s=>({status:"granted",resources:s.resources}),ensureAgentAccess:async s=>({status:"granted",resources:s.resources}),revokeAgentAccess:async s=>({status:"missing",resources:s.resources})},requireLogin:async()=>e.login(window.location.origin)},navigation:{openExternal:async s=>{window.open(s,"_blank","noopener,noreferrer")}},capabilities:{aiClientConfiguration:e.currentPod&&e.aiClientConfiguration?.available===!0&&e.aiClientConfiguration.authority==="local-filesystem"?ir({podUrl:e.currentPod.podUrl,authenticatedFetch:e.fetch}):kr,aiClientCredentials:jr(t,e.webId,e.fetch)}}}const kr={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 Pr(e){const t=p.useMemo(()=>Ir(e),[e]);return p.useMemo(()=>{const r=xt(Nr,t);if(r.layout!=="two-pane")throw new Error("AI Connection applet must use a two-pane layout");return r},[t])}function _r(){const e=mt(),t=Pr(e);return p.useEffect(()=>{t.controller.ensureServiceAccess()},[t.controller]),n.jsx(ht,{listHeader:t.slots.listHeader,list:t.slots.list,mainHeader:t.slots.mainHeader,main:t.slots.main,mode:"auto"})}export{_r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as e,j as s}from"./settings-
|
|
1
|
+
import{b as e,j as s}from"./settings-Cyyv6-SD.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-
|
|
1
|
+
import{b as p,e as _,r as d,j as e,B as f}from"./settings-Cyyv6-SD.js";import{P as $,D as A,R as E}from"./PaneListHeader-DMD8OJef.js";import{T as H}from"./workspace-layout-B47luv6r.js";import{C as b,a as j,b as v,c as y,d as N,B as z}from"./card-Cjsia0_V.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-
|
|
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-Cyyv6-SD.js";import{f as M,S as I}from"./services-status-context-CkuKmH5h.js";import{D as P,P as D,R as _}from"./PaneListHeader-DMD8OJef.js";import{T as A,u as w}from"./workspace-layout-B47luv6r.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-Cyyv6-SD.js";import{u as Po,g as Oo,a as Ro,b as _o,c as No,t as To}from"./services-status-context-CkuKmH5h.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-
|
|
1
|
+
import{j as t,c as s,a as d,r as o}from"./settings-Cyyv6-SD.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 +1 @@
|
|
|
1
|
-
import{r as c}from"./settings-
|
|
1
|
+
import{r as c}from"./settings-Cyyv6-SD.js";const n="/api/admin";async function o(t={}){try{const e=await fetch(`${n}/status`,{signal:t.signal});if(e.ok)return await e.json()}catch(e){console.error("Failed to get admin status:",e)}return null}async function u(t={}){try{const e=await fetch(`${n}/config`,{signal:t.signal});if(e.ok)return await e.json()}catch(e){console.error("Failed to get admin config:",e)}return null}async function l(t,e={}){try{const a=t?"?baseUrl="+encodeURIComponent(t):"",s=await fetch(n+"/public-ip"+a,{signal:e.signal});if(s.ok)return await s.json()}catch(a){console.error("Failed to get public ip check:",a)}return null}async function w(t){try{return(await fetch(`${n}/config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:t})})).ok}catch(e){return console.error("Failed to update admin config:",e),!1}}async function S(){try{return(await fetch(`${n}/restart`,{method:"POST"})).ok}catch(t){return console.error("Failed to trigger restart:",t),!1}}async function f(t={}){try{const e=await fetch("/service/status",{signal:t.signal});if(e.ok)return await e.json()}catch(e){console.error("Failed to get gateway status:",e)}return null}function g(t){return t?t.startsWith("http://")||t.startsWith("https://")?t:`https://${t}/`:""}function h(t,e,a=""){return e?.baseUrl||g(e?.fqdn)||t.CSS_BASE_URL||a}async function d(t={}){try{const e=await fetch(`${n}/ddns`,{signal:t.signal});if(e.ok)return await e.json()}catch(e){console.error("Failed to get ddns status:",e)}return null}async function m(t={}){const[e,a,s,r]=await Promise.all([f(t),o(t),u(t),d(t)]),i=await l(h(s?.env??{},r),t);return{servicesData:e,adminData:a,configData:s,ddnsData:r,publicCheck:i,checkedAt:new Date}}const y=c.createContext(null);function k(){return c.useContext(y)}export{y as S,u as a,l as b,w as c,m as f,d as g,S as t,k as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelsPage-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ModelsPage-03NPWzoX.js","assets/card-Cjsia0_V.js","assets/workspace-layout-B47luv6r.js","assets/PodPage-DT4EMYhL.js","assets/PaneListHeader-DMD8OJef.js","assets/ServicesPage-CJ0ub6IH.js","assets/services-status-context-CkuKmH5h.js","assets/SettingsPage-BkR7ZK18.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function _mergeNamespaces(i,e){for(var t=0;t<e.length;t++){const n=e[t];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in i)){const a=Object.getOwnPropertyDescriptor(n,s);a&&Object.defineProperty(i,s,a.get?a:{enumerable:!0,get:()=>n[s]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const u of a.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).observe(document,{childList:!0,subtree:!0});function t(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(s){if(s.ep)return;s.ep=!0;const a=t(s);fetch(s.href,a)}})();function getDefaultExportFromCjs(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var jsxRuntime={exports:{}},reactJsxRuntime_production={};var hasRequiredReactJsxRuntime_production;function requireReactJsxRuntime_production(){if(hasRequiredReactJsxRuntime_production)return reactJsxRuntime_production;hasRequiredReactJsxRuntime_production=1;var i=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,s,a){var u=null;if(a!==void 0&&(u=""+a),s.key!==void 0&&(u=""+s.key),"key"in s){a={};for(var c in s)c!=="key"&&(a[c]=s[c])}else a=s;return s=a.ref,{$$typeof:i,type:n,key:u,ref:s!==void 0?s:null,props:a}}return reactJsxRuntime_production.Fragment=e,reactJsxRuntime_production.jsx=t,reactJsxRuntime_production.jsxs=t,reactJsxRuntime_production}var hasRequiredJsxRuntime;function requireJsxRuntime(){return hasRequiredJsxRuntime||(hasRequiredJsxRuntime=1,jsxRuntime.exports=requireReactJsxRuntime_production()),jsxRuntime.exports}var jsxRuntimeExports=requireJsxRuntime(),react={exports:{}},react_production={};var hasRequiredReact_production;function requireReact_production(){if(hasRequiredReact_production)return react_production;hasRequiredReact_production=1;var i=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),u=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),y=Symbol.iterator;function S(G){return G===null||typeof G!="object"?null:(G=y&&G[y]||G["@@iterator"],typeof G=="function"?G:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,T={};function A(G,ce,oe){this.props=G,this.context=ce,this.refs=T,this.updater=oe||w}A.prototype.isReactComponent={},A.prototype.setState=function(G,ce){if(typeof G!="object"&&typeof G!="function"&&G!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,G,ce,"setState")},A.prototype.forceUpdate=function(G){this.updater.enqueueForceUpdate(this,G,"forceUpdate")};function F(){}F.prototype=A.prototype;function x(G,ce,oe){this.props=G,this.context=ce,this.refs=T,this.updater=oe||w}var D=x.prototype=new F;D.constructor=x,R(D,A.prototype),D.isPureReactComponent=!0;var O=Array.isArray;function K(){}var z={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function Ee(G,ce,oe){var Fe=oe.ref;return{$$typeof:i,type:G,key:ce,ref:Fe!==void 0?Fe:null,props:oe}}function q(G,ce){return Ee(G.type,ce,G.props)}function Y(G){return typeof G=="object"&&G!==null&&G.$$typeof===i}function Te(G){var ce={"=":"=0",":":"=2"};return"$"+G.replace(/[=:]/g,function(oe){return ce[oe]})}var re=/\/+/g;function $e(G,ce){return typeof G=="object"&&G!==null&&G.key!=null?Te(""+G.key):ce.toString(36)}function ze(G){switch(G.status){case"fulfilled":return G.value;case"rejected":throw G.reason;default:switch(typeof G.status=="string"?G.then(K,K):(G.status="pending",G.then(function(ce){G.status==="pending"&&(G.status="fulfilled",G.value=ce)},function(ce){G.status==="pending"&&(G.status="rejected",G.reason=ce)})),G.status){case"fulfilled":return G.value;case"rejected":throw G.reason}}throw G}function ye(G,ce,oe,Fe,Ue){var Je=typeof G;(Je==="undefined"||Je==="boolean")&&(G=null);var He=!1;if(G===null)He=!0;else switch(Je){case"bigint":case"string":case"number":He=!0;break;case"object":switch(G.$$typeof){case i:case e:He=!0;break;case p:return He=G._init,ye(He(G._payload),ce,oe,Fe,Ue)}}if(He)return Ue=Ue(G),He=Fe===""?"."+$e(G,0):Fe,O(Ue)?(oe="",He!=null&&(oe=He.replace(re,"$&/")+"/"),ye(Ue,ce,oe,"",function(Oe){return Oe})):Ue!=null&&(Y(Ue)&&(Ue=q(Ue,oe+(Ue.key==null||G&&G.key===Ue.key?"":(""+Ue.key).replace(re,"$&/")+"/")+He)),ce.push(Ue)),1;He=0;var he=Fe===""?".":Fe+":";if(O(G))for(var fe=0;fe<G.length;fe++)Fe=G[fe],Je=he+$e(Fe,fe),He+=ye(Fe,ce,oe,Je,Ue);else if(fe=S(G),typeof fe=="function")for(G=fe.call(G),fe=0;!(Fe=G.next()).done;)Fe=Fe.value,Je=he+$e(Fe,fe++),He+=ye(Fe,ce,oe,Je,Ue);else if(Je==="object"){if(typeof G.then=="function")return ye(ze(G),ce,oe,Fe,Ue);throw ce=String(G),Error("Objects are not valid as a React child (found: "+(ce==="[object Object]"?"object with keys {"+Object.keys(G).join(", ")+"}":ce)+"). If you meant to render a collection of children, use an array instead.")}return He}function Ve(G,ce,oe){if(G==null)return G;var Fe=[],Ue=0;return ye(G,Fe,"","",function(Je){return ce.call(oe,Je,Ue++)}),Fe}function pe(G){if(G._status===-1){var ce=G._result;ce=ce(),ce.then(function(oe){(G._status===0||G._status===-1)&&(G._status=1,G._result=oe)},function(oe){(G._status===0||G._status===-1)&&(G._status=2,G._result=oe)}),G._status===-1&&(G._status=0,G._result=ce)}if(G._status===1)return G._result.default;throw G._result}var De=typeof reportError=="function"?reportError:function(G){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ce=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof G=="object"&&G!==null&&typeof G.message=="string"?String(G.message):String(G),error:G});if(!window.dispatchEvent(ce))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",G);return}console.error(G)},$={map:Ve,forEach:function(G,ce,oe){Ve(G,function(){ce.apply(this,arguments)},oe)},count:function(G){var ce=0;return Ve(G,function(){ce++}),ce},toArray:function(G){return Ve(G,function(ce){return ce})||[]},only:function(G){if(!Y(G))throw Error("React.Children.only expected to receive a single React element child.");return G}};return react_production.Activity=g,react_production.Children=$,react_production.Component=A,react_production.Fragment=t,react_production.Profiler=s,react_production.PureComponent=x,react_production.StrictMode=n,react_production.Suspense=h,react_production.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,react_production.__COMPILER_RUNTIME={__proto__:null,c:function(G){return z.H.useMemoCache(G)}},react_production.cache=function(G){return function(){return G.apply(null,arguments)}},react_production.cacheSignal=function(){return null},react_production.cloneElement=function(G,ce,oe){if(G==null)throw Error("The argument must be a React element, but you passed "+G+".");var Fe=R({},G.props),Ue=G.key;if(ce!=null)for(Je in ce.key!==void 0&&(Ue=""+ce.key),ce)!X.call(ce,Je)||Je==="key"||Je==="__self"||Je==="__source"||Je==="ref"&&ce.ref===void 0||(Fe[Je]=ce[Je]);var Je=arguments.length-2;if(Je===1)Fe.children=oe;else if(1<Je){for(var He=Array(Je),he=0;he<Je;he++)He[he]=arguments[he+2];Fe.children=He}return Ee(G.type,Ue,Fe)},react_production.createContext=function(G){return G={$$typeof:u,_currentValue:G,_currentValue2:G,_threadCount:0,Provider:null,Consumer:null},G.Provider=G,G.Consumer={$$typeof:a,_context:G},G},react_production.createElement=function(G,ce,oe){var Fe,Ue={},Je=null;if(ce!=null)for(Fe in ce.key!==void 0&&(Je=""+ce.key),ce)X.call(ce,Fe)&&Fe!=="key"&&Fe!=="__self"&&Fe!=="__source"&&(Ue[Fe]=ce[Fe]);var He=arguments.length-2;if(He===1)Ue.children=oe;else if(1<He){for(var he=Array(He),fe=0;fe<He;fe++)he[fe]=arguments[fe+2];Ue.children=he}if(G&&G.defaultProps)for(Fe in He=G.defaultProps,He)Ue[Fe]===void 0&&(Ue[Fe]=He[Fe]);return Ee(G,Je,Ue)},react_production.createRef=function(){return{current:null}},react_production.forwardRef=function(G){return{$$typeof:c,render:G}},react_production.isValidElement=Y,react_production.lazy=function(G){return{$$typeof:p,_payload:{_status:-1,_result:G},_init:pe}},react_production.memo=function(G,ce){return{$$typeof:f,type:G,compare:ce===void 0?null:ce}},react_production.startTransition=function(G){var ce=z.T,oe={};z.T=oe;try{var Fe=G(),Ue=z.S;Ue!==null&&Ue(oe,Fe),typeof Fe=="object"&&Fe!==null&&typeof Fe.then=="function"&&Fe.then(K,De)}catch(Je){De(Je)}finally{ce!==null&&oe.types!==null&&(ce.types=oe.types),z.T=ce}},react_production.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},react_production.use=function(G){return z.H.use(G)},react_production.useActionState=function(G,ce,oe){return z.H.useActionState(G,ce,oe)},react_production.useCallback=function(G,ce){return z.H.useCallback(G,ce)},react_production.useContext=function(G){return z.H.useContext(G)},react_production.useDebugValue=function(){},react_production.useDeferredValue=function(G,ce){return z.H.useDeferredValue(G,ce)},react_production.useEffect=function(G,ce){return z.H.useEffect(G,ce)},react_production.useEffectEvent=function(G){return z.H.useEffectEvent(G)},react_production.useId=function(){return z.H.useId()},react_production.useImperativeHandle=function(G,ce,oe){return z.H.useImperativeHandle(G,ce,oe)},react_production.useInsertionEffect=function(G,ce){return z.H.useInsertionEffect(G,ce)},react_production.useLayoutEffect=function(G,ce){return z.H.useLayoutEffect(G,ce)},react_production.useMemo=function(G,ce){return z.H.useMemo(G,ce)},react_production.useOptimistic=function(G,ce){return z.H.useOptimistic(G,ce)},react_production.useReducer=function(G,ce,oe){return z.H.useReducer(G,ce,oe)},react_production.useRef=function(G){return z.H.useRef(G)},react_production.useState=function(G){return z.H.useState(G)},react_production.useSyncExternalStore=function(G,ce,oe){return z.H.useSyncExternalStore(G,ce,oe)},react_production.useTransition=function(){return z.H.useTransition()},react_production.version="19.2.8",react_production}var hasRequiredReact;function requireReact(){return hasRequiredReact||(hasRequiredReact=1,react.exports=requireReact_production()),react.exports}var reactExports=requireReact();const React3=getDefaultExportFromCjs(reactExports),React=_mergeNamespaces({__proto__:null,default:React3},[reactExports]);var client={exports:{}},reactDomClient_production={},scheduler={exports:{}},scheduler_production={};var hasRequiredScheduler_production;function requireScheduler_production(){return hasRequiredScheduler_production||(hasRequiredScheduler_production=1,(function(i){function e(ye,Ve){var pe=ye.length;ye.push(Ve);e:for(;0<pe;){var De=pe-1>>>1,$=ye[De];if(0<s($,Ve))ye[De]=Ve,ye[pe]=$,pe=De;else break e}}function t(ye){return ye.length===0?null:ye[0]}function n(ye){if(ye.length===0)return null;var Ve=ye[0],pe=ye.pop();if(pe!==Ve){ye[0]=pe;e:for(var De=0,$=ye.length,G=$>>>1;De<G;){var ce=2*(De+1)-1,oe=ye[ce],Fe=ce+1,Ue=ye[Fe];if(0>s(oe,pe))Fe<$&&0>s(Ue,oe)?(ye[De]=Ue,ye[Fe]=pe,De=Fe):(ye[De]=oe,ye[ce]=pe,De=ce);else if(Fe<$&&0>s(Ue,pe))ye[De]=Ue,ye[Fe]=pe,De=Fe;else break e}}return Ve}function s(ye,Ve){var pe=ye.sortIndex-Ve.sortIndex;return pe!==0?pe:ye.id-Ve.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;i.unstable_now=function(){return a.now()}}else{var u=Date,c=u.now();i.unstable_now=function(){return u.now()-c}}var h=[],f=[],p=1,g=null,y=3,S=!1,w=!1,R=!1,T=!1,A=typeof setTimeout=="function"?setTimeout:null,F=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;function D(ye){for(var Ve=t(f);Ve!==null;){if(Ve.callback===null)n(f);else if(Ve.startTime<=ye)n(f),Ve.sortIndex=Ve.expirationTime,e(h,Ve);else break;Ve=t(f)}}function O(ye){if(R=!1,D(ye),!w)if(t(h)!==null)w=!0,K||(K=!0,Te());else{var Ve=t(f);Ve!==null&&ze(O,Ve.startTime-ye)}}var K=!1,z=-1,X=5,Ee=-1;function q(){return T?!0:!(i.unstable_now()-Ee<X)}function Y(){if(T=!1,K){var ye=i.unstable_now();Ee=ye;var Ve=!0;try{e:{w=!1,R&&(R=!1,F(z),z=-1),S=!0;var pe=y;try{t:{for(D(ye),g=t(h);g!==null&&!(g.expirationTime>ye&&q());){var De=g.callback;if(typeof De=="function"){g.callback=null,y=g.priorityLevel;var $=De(g.expirationTime<=ye);if(ye=i.unstable_now(),typeof $=="function"){g.callback=$,D(ye),Ve=!0;break t}g===t(h)&&n(h),D(ye)}else n(h);g=t(h)}if(g!==null)Ve=!0;else{var G=t(f);G!==null&&ze(O,G.startTime-ye),Ve=!1}}break e}finally{g=null,y=pe,S=!1}Ve=void 0}}finally{Ve?Te():K=!1}}}var Te;if(typeof x=="function")Te=function(){x(Y)};else if(typeof MessageChannel<"u"){var re=new MessageChannel,$e=re.port2;re.port1.onmessage=Y,Te=function(){$e.postMessage(null)}}else Te=function(){A(Y,0)};function ze(ye,Ve){z=A(function(){ye(i.unstable_now())},Ve)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(ye){ye.callback=null},i.unstable_forceFrameRate=function(ye){0>ye||125<ye?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<ye?Math.floor(1e3/ye):5},i.unstable_getCurrentPriorityLevel=function(){return y},i.unstable_next=function(ye){switch(y){case 1:case 2:case 3:var Ve=3;break;default:Ve=y}var pe=y;y=Ve;try{return ye()}finally{y=pe}},i.unstable_requestPaint=function(){T=!0},i.unstable_runWithPriority=function(ye,Ve){switch(ye){case 1:case 2:case 3:case 4:case 5:break;default:ye=3}var pe=y;y=ye;try{return Ve()}finally{y=pe}},i.unstable_scheduleCallback=function(ye,Ve,pe){var De=i.unstable_now();switch(typeof pe=="object"&&pe!==null?(pe=pe.delay,pe=typeof pe=="number"&&0<pe?De+pe:De):pe=De,ye){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=pe+$,ye={id:p++,callback:Ve,priorityLevel:ye,startTime:pe,expirationTime:$,sortIndex:-1},pe>De?(ye.sortIndex=pe,e(f,ye),t(h)===null&&ye===t(f)&&(R?(F(z),z=-1):R=!0,ze(O,pe-De))):(ye.sortIndex=$,e(h,ye),w||S||(w=!0,K||(K=!0,Te()))),ye},i.unstable_shouldYield=q,i.unstable_wrapCallback=function(ye){var Ve=y;return function(){var pe=y;y=Ve;try{return ye.apply(this,arguments)}finally{y=pe}}}})(scheduler_production)),scheduler_production}var hasRequiredScheduler;function requireScheduler(){return hasRequiredScheduler||(hasRequiredScheduler=1,scheduler.exports=requireScheduler_production()),scheduler.exports}var reactDom={exports:{}},reactDom_production={};var hasRequiredReactDom_production;function requireReactDom_production(){if(hasRequiredReactDom_production)return reactDom_production;hasRequiredReactDom_production=1;var i=requireReact();function e(h){var f="https://react.dev/errors/"+h;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)f+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+h+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function t(){}var n={d:{f:t,r:function(){throw Error(e(522))},D:t,C:t,L:t,m:t,X:t,S:t,M:t},p:0,findDOMNode:null},s=Symbol.for("react.portal");function a(h,f,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:g==null?null:""+g,children:h,containerInfo:f,implementation:p}}var u=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(h,f){if(h==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return reactDom_production.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,reactDom_production.createPortal=function(h,f){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(e(299));return a(h,f,null,p)},reactDom_production.flushSync=function(h){var f=u.T,p=n.p;try{if(u.T=null,n.p=2,h)return h()}finally{u.T=f,n.p=p,n.d.f()}},reactDom_production.preconnect=function(h,f){typeof h=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,n.d.C(h,f))},reactDom_production.prefetchDNS=function(h){typeof h=="string"&&n.d.D(h)},reactDom_production.preinit=function(h,f){if(typeof h=="string"&&f&&typeof f.as=="string"){var p=f.as,g=c(p,f.crossOrigin),y=typeof f.integrity=="string"?f.integrity:void 0,S=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;p==="style"?n.d.S(h,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:g,integrity:y,fetchPriority:S}):p==="script"&&n.d.X(h,{crossOrigin:g,integrity:y,fetchPriority:S,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},reactDom_production.preinitModule=function(h,f){if(typeof h=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var p=c(f.as,f.crossOrigin);n.d.M(h,{crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&n.d.M(h)},reactDom_production.preload=function(h,f){if(typeof h=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var p=f.as,g=c(p,f.crossOrigin);n.d.L(h,p,{crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},reactDom_production.preloadModule=function(h,f){if(typeof h=="string")if(f){var p=c(f.as,f.crossOrigin);n.d.m(h,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else n.d.m(h)},reactDom_production.requestFormReset=function(h){n.d.r(h)},reactDom_production.unstable_batchedUpdates=function(h,f){return h(f)},reactDom_production.useFormState=function(h,f,p){return u.H.useFormState(h,f,p)},reactDom_production.useFormStatus=function(){return u.H.useHostTransitionStatus()},reactDom_production.version="19.2.8",reactDom_production}var hasRequiredReactDom;function requireReactDom(){if(hasRequiredReactDom)return reactDom.exports;hasRequiredReactDom=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(e){console.error(e)}}return i(),reactDom.exports=requireReactDom_production(),reactDom.exports}var hasRequiredReactDomClient_production;function requireReactDomClient_production(){if(hasRequiredReactDomClient_production)return reactDomClient_production;hasRequiredReactDomClient_production=1;var i=requireScheduler(),e=requireReact(),t=requireReactDom();function n(o){var l="https://react.dev/errors/"+o;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)l+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+o+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function a(o){var l=o,d=o;if(o.alternate)for(;l.return;)l=l.return;else{o=l;do l=o,(l.flags&4098)!==0&&(d=l.return),o=l.return;while(o)}return l.tag===3?d:null}function u(o){if(o.tag===13){var l=o.memoizedState;if(l===null&&(o=o.alternate,o!==null&&(l=o.memoizedState)),l!==null)return l.dehydrated}return null}function c(o){if(o.tag===31){var l=o.memoizedState;if(l===null&&(o=o.alternate,o!==null&&(l=o.memoizedState)),l!==null)return l.dehydrated}return null}function h(o){if(a(o)!==o)throw Error(n(188))}function f(o){var l=o.alternate;if(!l){if(l=a(o),l===null)throw Error(n(188));return l!==o?null:o}for(var d=o,m=l;;){var E=d.return;if(E===null)break;var C=E.alternate;if(C===null){if(m=E.return,m!==null){d=m;continue}break}if(E.child===C.child){for(C=E.child;C;){if(C===d)return h(E),o;if(C===m)return h(E),l;C=C.sibling}throw Error(n(188))}if(d.return!==m.return)d=E,m=C;else{for(var W=!1,le=E.child;le;){if(le===d){W=!0,d=E,m=C;break}if(le===m){W=!0,m=E,d=C;break}le=le.sibling}if(!W){for(le=C.child;le;){if(le===d){W=!0,d=C,m=E;break}if(le===m){W=!0,m=C,d=E;break}le=le.sibling}if(!W)throw Error(n(189))}}if(d.alternate!==m)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?o:l}function p(o){var l=o.tag;if(l===5||l===26||l===27||l===6)return o;for(o=o.child;o!==null;){if(l=p(o),l!==null)return l;o=o.sibling}return null}var g=Object.assign,y=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),F=Symbol.for("react.consumer"),x=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),Ee=Symbol.for("react.activity"),q=Symbol.for("react.memo_cache_sentinel"),Y=Symbol.iterator;function Te(o){return o===null||typeof o!="object"?null:(o=Y&&o[Y]||o["@@iterator"],typeof o=="function"?o:null)}var re=Symbol.for("react.client.reference");function $e(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===re?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case R:return"Fragment";case A:return"Profiler";case T:return"StrictMode";case O:return"Suspense";case K:return"SuspenseList";case Ee:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case w:return"Portal";case x:return o.displayName||"Context";case F:return(o._context.displayName||"Context")+".Consumer";case D:var l=o.render;return o=o.displayName,o||(o=l.displayName||l.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case z:return l=o.displayName||null,l!==null?l:$e(o.type)||"Memo";case X:l=o._payload,o=o._init;try{return $e(o(l))}catch{}}return null}var ze=Array.isArray,ye=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ve=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,pe={pending:!1,data:null,method:null,action:null},De=[],$=-1;function G(o){return{current:o}}function ce(o){0>$||(o.current=De[$],De[$]=null,$--)}function oe(o,l){$++,De[$]=o.current,o.current=l}var Fe=G(null),Ue=G(null),Je=G(null),He=G(null);function he(o,l){switch(oe(Je,l),oe(Ue,o),oe(Fe,null),l.nodeType){case 9:case 11:o=(o=l.documentElement)&&(o=o.namespaceURI)?Of(o):0;break;default:if(o=l.tagName,l=l.namespaceURI)l=Of(l),o=$f(l,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}ce(Fe),oe(Fe,o)}function fe(){ce(Fe),ce(Ue),ce(Je)}function Oe(o){o.memoizedState!==null&&oe(He,o);var l=Fe.current,d=$f(l,o.type);l!==d&&(oe(Ue,o),oe(Fe,d))}function ie(o){Ue.current===o&&(ce(Fe),ce(Ue)),He.current===o&&(ce(He),ia._currentValue=pe)}var j,N;function L(o){if(j===void 0)try{throw Error()}catch(d){var l=d.stack.trim().match(/\n( *(at )?)/);j=l&&l[1]||"",N=-1<d.stack.indexOf(`
|
|
3
3
|
at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
4
|
`+j+o+N}var V=!1;function ee(o,l){if(!o||V)return"";V=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var m={DetermineComponentFrameRoot:function(){try{if(l){var dt=function(){throw Error()};if(Object.defineProperty(dt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(dt,[])}catch(it){var tt=it}Reflect.construct(o,[],dt)}else{try{dt.call()}catch(it){tt=it}o.call(dt.prototype)}}else{try{throw Error()}catch(it){tt=it}(dt=o())&&typeof dt.catch=="function"&&dt.catch(function(){})}}catch(it){if(it&&tt&&typeof it.stack=="string")return[it.stack,tt.stack]}return[null,null]}};m.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var E=Object.getOwnPropertyDescriptor(m.DetermineComponentFrameRoot,"name");E&&E.configurable&&Object.defineProperty(m.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var C=m.DetermineComponentFrameRoot(),W=C[0],le=C[1];if(W&&le){var ke=W.split(`
|
|
@@ -302,4 +302,4 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
302
302
|
SELECT ?resource WHERE {
|
|
303
303
|
<${t}> ldp:contains ?resource .
|
|
304
304
|
}
|
|
305
|
-
`,prefixes:{ldp:"http://www.w3.org/ns/ldp#"}},a=await this.sparqlExecutor.queryContainer(t,s);for(const u of a){const c=u.resource;if(c){const h=hasStringValue(c)?c.value:String(c);n.push(h)}}}catch(s){console.warn("[listContainerResources] SPARQL query failed:",s)}return n}}_a=entityKind;PodDialect[_a]="PodDialect";function drizzle(i,e){if(!i||!i.info.isLoggedIn)throw new Error("需要有效的已认证Session");const t={session:i,preferredChannels:e?.notifications?.preferredChannels,createQueryEngine:e?.sparql?.createQueryEngine,disableInteropDiscovery:e?.disableInteropDiscovery,podUrl:e?.podUrl??i.info.podUrl,resourcePreparation:e?.resourcePreparation,storageTTL:e?.storageTTL,debug:e?.debug??e?.logger},n=new PodDialect(t);e?.schema&&n.setSchema(e.schema);const s=new PodAsyncSession(n);return new PodDatabase(n,s,e?.schema)}const SOLID_STORAGE_KEYS=new Set(["solid:storage","http://www.w3.org/ns/solid/terms#storage","pim:storage","http://www.w3.org/ns/pim/space#storage"]);async function fetchProfileStorageUrls(i,e){const t=await i(e,{headers:{Accept:"text/turtle, application/ld+json, application/json"},credentials:"include"}).catch(()=>{});if(!t?.ok)return[];const n=t.headers?.get?.("content-type")??"",s=await t.text().catch(()=>"");if(!s)return[];if(n.includes("json"))try{return uniqueNormalizedStorageUrls(extractStorageUrlsFromJson(JSON.parse(s)))}catch{return[]}return uniqueNormalizedStorageUrls(extractStorageUrlsFromTurtle(s))}function extractStorageUrlsFromTurtle(i){return Array.from(i.matchAll(/(?:solid:storage|pim:storage|<http:\/\/www\.w3\.org\/ns\/solid\/terms#storage>|<http:\/\/www\.w3\.org\/ns\/pim\/space#storage>)\s+<([^>]+)>/giu)).map(e=>e[1]).filter(e=>typeof e=="string"&&e.length>0)}function extractStorageUrlsFromJson(i){const e=new Set,t=new WeakSet,n=(s,a=!1)=>{if(typeof s=="string"){a&&e.add(s);return}if(!(!s||typeof s!="object")&&!t.has(s)){if(t.add(s),Array.isArray(s)){for(const u of s)n(u,a);return}for(const[u,c]of Object.entries(s)){const h=SOLID_STORAGE_KEYS.has(u);if(a&&u==="@id"){n(c,!0);continue}n(c,a||h)}}};return n(i),Array.from(e)}function normalizeStorageUrl(i){try{return ensureTrailingSlash(new URL(i).toString())}catch{return}}function uniqueNormalizedStorageUrls(i){const e=new Set;for(const t of i){const n=normalizeStorageUrl(t);n&&e.add(n)}return Array.from(e)}function ensureTrailingSlash(i){return i.replace(/\/+$/u,"")+"/"}const XPOD_LAST_OIDC_ISSUER_STORAGE_KEY="xpod.solid.lastOidcIssuer",XpodSolidRuntimeContext=reactExports.createContext(null),initializedRuntimes=new WeakSet;function snapshotToState(i,e,t){return i.status==="initializing"?{status:"loading",issuer:t}:i.status==="anonymous"?{status:"anonymous",issuer:t}:i.status==="error"?{status:"error",webId:i.webId,error:i.error,podUrl:e?.podUrl,issuer:t}:{status:"authenticated",webId:i.webId,podUrl:e?.podUrl,issuer:t}}async function discoverPodUrlFromWebId({webId:i,fetch:e}){const n=(await fetchProfileStorageUrls(e,i))[0];if(!n)throw new Error("WebID profile does not declare a Solid storage URL");return ensureTrailingSlash(new URL(n).toString())}function createXpodSolidRuntimeValue(i={}){const e=i.sessionFactory?.()??new Session;let t=readIssuerFromSessionInfo(e.info)??readStoredOidcIssuer();const n=createSolidSessionRuntime({session:e}),s={get info(){return e.info},fetch:e.fetch},a=createPodRuntime({adapter:{discoverPod:({webId:u,fetch:c})=>discoverPodUrlFromWebId({webId:u,fetch:c}),openDatabase:({podUrl:u})=>drizzle(s,{podUrl:u,resourcePreparation:"off"}),hydrateCollections:()=>{}}});return{session:n,pod:a,getIssuer:()=>readIssuerFromSessionInfo(e.info)??t??readStoredOidcIssuer(),setIssuer:u=>{const c=normalizeXpodOidcIssuer(u);t=c,c&&writeStoredOidcIssuer(c)}}}let defaultRuntime;function getXpodSolidRuntimeValue(){return defaultRuntime??=createXpodSolidRuntimeValue(),defaultRuntime}function safeAuthError(i){return i.message==="Solid session expired"?i:new Error("Solid login failed. Please reconnect your Pod.")}function useXpodSolidRuntimeContext(){const i=reactExports.useContext(XpodSolidRuntimeContext);if(!i)throw new Error("useXpodSolidRuntime must be used within XpodSolidRuntimeProvider");return i}function readIssuerFromSessionInfo(i){const e=i.issuer??i.oidcIssuer;return normalizeXpodOidcIssuer(e)}function normalizeXpodOidcIssuer(i){if(!(typeof i!="string"||!i.trim()))try{const e=new URL(i.trim());return e.protocol!=="https:"&&e.protocol!=="http:"||e.username||e.password||e.search||e.hash?void 0:e.toString()}catch{return}}function readStoredOidcIssuer(){try{return normalizeXpodOidcIssuer(globalThis.window?.sessionStorage.getItem(XPOD_LAST_OIDC_ISSUER_STORAGE_KEY))}catch{return}}function writeStoredOidcIssuer(i){try{globalThis.window?.sessionStorage.setItem(XPOD_LAST_OIDC_ISSUER_STORAGE_KEY,i)}catch{}}const useXpodSolidRuntime=useXpodSolidRuntimeContext;function SettingsAuthBoundary({children:i,product:e="Settings"}){const t=useXpodSolidRuntime(),n=t.state.status==="loading"?{status:"loading"}:t.state.status==="authenticated"?{status:"authenticated"}:t.state.status==="error"?{status:"error",message:t.state.error.message}:{status:"anonymous"};return jsxRuntimeExports.jsx(AuthBoundary,{state:n,login:t.login,loginView:{title:`Connect Xpod ${e}`,description:e==="Dashboard"?"Use your Solid identity to inspect Xpod status, runtime, logs, RDF, network, and usage.":"Use your Solid identity to manage model, Pod, network, and service settings.",defaultIssuer:window.location.origin},children:i})}const ModelsPage=reactExports.lazy(()=>__vitePreload(()=>import("./ModelsPage-D87RrLB0.js"),__vite__mapDeps([0,1,2]))),PodPage=reactExports.lazy(()=>__vitePreload(()=>import("./PodPage-9LGuOloQ.js"),__vite__mapDeps([3,4,2,1]))),ServicesPage=reactExports.lazy(()=>__vitePreload(()=>import("./ServicesPage-ZoT9-B_0.js"),__vite__mapDeps([5,6,4,2]))),SettingsPage=reactExports.lazy(()=>__vitePreload(()=>import("./SettingsPage-Bj4lB3mq.js"),__vite__mapDeps([7,6])).then(i=>({default:i.SettingsPage})));function lazyRoute(i){return jsxRuntimeExports.jsx(reactExports.Suspense,{fallback:jsxRuntimeExports.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Loading settings..."}),children:i})}function guardedRoute(i){return jsxRuntimeExports.jsx(SettingsAuthBoundary,{children:i})}const settingsRoutes=[{element:jsxRuntimeExports.jsx(XpodSettingsLayout,{}),children:[{index:!0,element:jsxRuntimeExports.jsx(Navigate,{to:"/models",replace:!0})},{path:"models",element:guardedRoute(lazyRoute(jsxRuntimeExports.jsx(ModelsPage,{})))},{path:"pod",element:guardedRoute(lazyRoute(jsxRuntimeExports.jsx(PodPage,{view:"settings"})))},{path:"network",element:guardedRoute(lazyRoute(jsxRuntimeExports.jsx(ServicesPage,{product:"settings"}))),children:[{index:!0,element:lazyRoute(jsxRuntimeExports.jsx(SettingsPage,{}))}]},{path:"services",element:guardedRoute(lazyRoute(jsxRuntimeExports.jsx(ServicesPage,{product:"settings"}))),children:[{index:!0,element:lazyRoute(jsxRuntimeExports.jsx(SettingsPage,{}))},{path:"configuration",element:lazyRoute(jsxRuntimeExports.jsx(SettingsPage,{}))}]},{path:"*",element:jsxRuntimeExports.jsx(Navigate,{to:"/models",replace:!0})}]}];function XpodSolidRuntimeProvider({children:i,value:e}){const t=e??getXpodSolidRuntimeValue(),[n,s]=reactExports.useState(()=>t.session.getSnapshot()),[a,u]=reactExports.useState(()=>t.getIssuer()),[c,h]=reactExports.useState(),[f,p]=reactExports.useState(),[g,y]=reactExports.useState();reactExports.useEffect(()=>t.session.subscribe(R=>{s(R),u(t.getIssuer()),R.status!=="authenticated"?(h(void 0),p(void 0),t.pod.clear()):R.webId!==n.webId&&y(void 0)}),[t,n.webId]),reactExports.useEffect(()=>{initializedRuntimes.has(t)||(initializedRuntimes.add(t),t.session.initialize({restorePreviousSession:!0}).then(R=>{s(R),u(t.getIssuer())}))},[t]),reactExports.useEffect(()=>{if(n.status!=="authenticated")return;let R=!1;return t.pod.open({webId:n.webId,fetch:t.session.fetch}).then(T=>{R||(h(T),p(void 0))},T=>{R||p({webId:n.webId,error:T instanceof Error?T:new Error(String(T))})}),()=>{R=!0}},[t,n]);const S=n.status==="authenticated"?n.webId:void 0;reactExports.useEffect(()=>{if(!S)return;let R=!1;return discoverAiClientConfigurationCapability(t.session.fetch).then(T=>{!R&&t.session.getSnapshot().status==="authenticated"&&t.session.getSnapshot().webId===S&&y(T)}),()=>{R=!0}},[S,t]);const w=reactExports.useMemo(()=>{const R=a??t.getIssuer(),T=n.status==="authenticated"&&f?.webId===n.webId?f.error:void 0,A=T?{status:"error",webId:n.webId,podUrl:c?.podUrl,issuer:R,error:T}:snapshotToState(n,c,R);return{session:t.session,pod:t.pod,fetch:t.session.fetch,state:A.status==="error"?{...A,error:safeAuthError(A.error)}:A,webId:A.webId,podUrl:A.podUrl,issuer:A.issuer,currentPod:c,aiClientConfiguration:g,login:async F=>{const x=normalizeXpodOidcIssuer(F);x&&(t.setIssuer(x),u(x),await t.session.login({oidcIssuer:x,redirectUrl:window.location.href}))},logout:async()=>{t.pod.clear(),h(void 0),await t.session.logout()}}},[g,c,a,f,t,n]);return jsxRuntimeExports.jsx(SolidRuntimeProvider,{value:{session:t.session,pod:t.pod,currentPod:c},children:jsxRuntimeExports.jsx(XpodSolidRuntimeContext.Provider,{value:w,children:i})})}async function discoverAiClientConfigurationCapability(i){try{const e=await i("/api/ai/client-configuration/capability",{method:"GET",credentials:"include",headers:{accept:"application/json"}});if(!e.ok||!e.headers.get("content-type")?.includes("application/json"))return await e.arrayBuffer().catch(()=>{}),manualAiClientConfigurationCapability();const t=await e.json();if(isRecord(t)&&t.available===!0&&t.authority==="local-filesystem")return{available:!0,authority:"local-filesystem",manualInstructions:typeof t.manualInstructions=="string"?t.manualInstructions:manualAiClientConfigurationCapability().manualInstructions}}catch{}return manualAiClientConfigurationCapability()}function manualAiClientConfigurationCapability(){return{available:!1,manualInstructions:"manual client setup is available"}}function isRecord(i){return!!(i&&typeof i=="object"&&!Array.isArray(i))}function SettingsRoutes(){return useRoutes(settingsRoutes)}function SettingsApp(){return jsxRuntimeExports.jsx(XpodSolidRuntimeProvider,{children:jsxRuntimeExports.jsx(BrowserRouter,{basename:"/settings",children:jsxRuntimeExports.jsx(SettingsRoutes,{})})})}clientExports.createRoot(document.getElementById("root")).render(jsxRuntimeExports.jsx(reactExports.StrictMode,{children:jsxRuntimeExports.jsx(SettingsApp,{})}));export{Button as B,Input as I,NavLink as N,Outlet as O,React as R,Server as S,cva as a,createLucideIcon as b,cn as c,clsx as d,useXpodSolidRuntime as e,requireReactDom as f,useComposedRefs as g,createSlot as h,jsxRuntimeExports as j,reactExports as r,useLocation as u};
|
|
305
|
+
`,prefixes:{ldp:"http://www.w3.org/ns/ldp#"}},a=await this.sparqlExecutor.queryContainer(t,s);for(const u of a){const c=u.resource;if(c){const h=hasStringValue(c)?c.value:String(c);n.push(h)}}}catch(s){console.warn("[listContainerResources] SPARQL query failed:",s)}return n}}_a=entityKind;PodDialect[_a]="PodDialect";function drizzle(i,e){if(!i||!i.info.isLoggedIn)throw new Error("需要有效的已认证Session");const t={session:i,preferredChannels:e?.notifications?.preferredChannels,createQueryEngine:e?.sparql?.createQueryEngine,disableInteropDiscovery:e?.disableInteropDiscovery,podUrl:e?.podUrl??i.info.podUrl,resourcePreparation:e?.resourcePreparation,storageTTL:e?.storageTTL,debug:e?.debug??e?.logger},n=new PodDialect(t);e?.schema&&n.setSchema(e.schema);const s=new PodAsyncSession(n);return new PodDatabase(n,s,e?.schema)}const SOLID_STORAGE_KEYS=new Set(["solid:storage","http://www.w3.org/ns/solid/terms#storage","pim:storage","http://www.w3.org/ns/pim/space#storage"]);async function fetchProfileStorageUrls(i,e){const t=await i(e,{headers:{Accept:"text/turtle, application/ld+json, application/json"},credentials:"include"}).catch(()=>{});if(!t?.ok)return[];const n=t.headers?.get?.("content-type")??"",s=await t.text().catch(()=>"");if(!s)return[];if(n.includes("json"))try{return uniqueNormalizedStorageUrls(extractStorageUrlsFromJson(JSON.parse(s)))}catch{return[]}return uniqueNormalizedStorageUrls(extractStorageUrlsFromTurtle(s))}function extractStorageUrlsFromTurtle(i){return Array.from(i.matchAll(/(?:solid:storage|pim:storage|<http:\/\/www\.w3\.org\/ns\/solid\/terms#storage>|<http:\/\/www\.w3\.org\/ns\/pim\/space#storage>)\s+<([^>]+)>/giu)).map(e=>e[1]).filter(e=>typeof e=="string"&&e.length>0)}function extractStorageUrlsFromJson(i){const e=new Set,t=new WeakSet,n=(s,a=!1)=>{if(typeof s=="string"){a&&e.add(s);return}if(!(!s||typeof s!="object")&&!t.has(s)){if(t.add(s),Array.isArray(s)){for(const u of s)n(u,a);return}for(const[u,c]of Object.entries(s)){const h=SOLID_STORAGE_KEYS.has(u);if(a&&u==="@id"){n(c,!0);continue}n(c,a||h)}}};return n(i),Array.from(e)}function normalizeStorageUrl(i){try{return ensureTrailingSlash(new URL(i).toString())}catch{return}}function uniqueNormalizedStorageUrls(i){const e=new Set;for(const t of i){const n=normalizeStorageUrl(t);n&&e.add(n)}return Array.from(e)}function ensureTrailingSlash(i){return i.replace(/\/+$/u,"")+"/"}const XPOD_LAST_OIDC_ISSUER_STORAGE_KEY="xpod.solid.lastOidcIssuer",XpodSolidRuntimeContext=reactExports.createContext(null),initializedRuntimes=new WeakSet;function snapshotToState(i,e,t){return i.status==="initializing"?{status:"loading",issuer:t}:i.status==="anonymous"?{status:"anonymous",issuer:t}:i.status==="error"?{status:"error",webId:i.webId,error:i.error,podUrl:e?.podUrl,issuer:t}:{status:"authenticated",webId:i.webId,podUrl:e?.podUrl,issuer:t}}async function discoverPodUrlFromWebId({webId:i,fetch:e}){const n=(await fetchProfileStorageUrls(e,i))[0];if(!n)throw new Error("WebID profile does not declare a Solid storage URL");return ensureTrailingSlash(new URL(n).toString())}function createXpodSolidRuntimeValue(i={}){const e=i.sessionFactory?.()??new Session;let t=readIssuerFromSessionInfo(e.info)??readStoredOidcIssuer();const n=createSolidSessionRuntime({session:e}),s={get info(){return e.info},fetch:e.fetch},a=createPodRuntime({adapter:{discoverPod:({webId:u,fetch:c})=>discoverPodUrlFromWebId({webId:u,fetch:c}),openDatabase:({podUrl:u})=>drizzle(s,{podUrl:u,resourcePreparation:"off"}),hydrateCollections:()=>{}}});return{session:n,pod:a,getIssuer:()=>readIssuerFromSessionInfo(e.info)??t??readStoredOidcIssuer(),setIssuer:u=>{const c=normalizeXpodOidcIssuer(u);t=c,c&&writeStoredOidcIssuer(c)}}}let defaultRuntime;function getXpodSolidRuntimeValue(){return defaultRuntime??=createXpodSolidRuntimeValue(),defaultRuntime}function safeAuthError(i){return i.message==="Solid session expired"?i:new Error("Solid login failed. Please reconnect your Pod.")}function useXpodSolidRuntimeContext(){const i=reactExports.useContext(XpodSolidRuntimeContext);if(!i)throw new Error("useXpodSolidRuntime must be used within XpodSolidRuntimeProvider");return i}function readIssuerFromSessionInfo(i){const e=i.issuer??i.oidcIssuer;return normalizeXpodOidcIssuer(e)}function normalizeXpodOidcIssuer(i){if(!(typeof i!="string"||!i.trim()))try{const e=new URL(i.trim());return e.protocol!=="https:"&&e.protocol!=="http:"||e.username||e.password||e.search||e.hash?void 0:e.toString()}catch{return}}function readStoredOidcIssuer(){try{return normalizeXpodOidcIssuer(globalThis.window?.sessionStorage.getItem(XPOD_LAST_OIDC_ISSUER_STORAGE_KEY))}catch{return}}function writeStoredOidcIssuer(i){try{globalThis.window?.sessionStorage.setItem(XPOD_LAST_OIDC_ISSUER_STORAGE_KEY,i)}catch{}}const useXpodSolidRuntime=useXpodSolidRuntimeContext;function SettingsAuthBoundary({children:i,product:e="Settings"}){const t=useXpodSolidRuntime(),n=t.state.status==="loading"?{status:"loading"}:t.state.status==="authenticated"?{status:"authenticated"}:t.state.status==="error"?{status:"error",message:t.state.error.message}:{status:"anonymous"};return jsxRuntimeExports.jsx(AuthBoundary,{state:n,login:t.login,loginView:{title:`Connect Xpod ${e}`,description:e==="Dashboard"?"Use your Solid identity to inspect Xpod status, runtime, logs, RDF, network, and usage.":"Use your Solid identity to manage model, Pod, network, and service settings.",defaultIssuer:window.location.origin},children:i})}const ModelsPage=reactExports.lazy(()=>__vitePreload(()=>import("./ModelsPage-03NPWzoX.js"),__vite__mapDeps([0,1,2]))),PodPage=reactExports.lazy(()=>__vitePreload(()=>import("./PodPage-DT4EMYhL.js"),__vite__mapDeps([3,4,2,1]))),ServicesPage=reactExports.lazy(()=>__vitePreload(()=>import("./ServicesPage-CJ0ub6IH.js"),__vite__mapDeps([5,6,4,2]))),SettingsPage=reactExports.lazy(()=>__vitePreload(()=>import("./SettingsPage-BkR7ZK18.js"),__vite__mapDeps([7,6])).then(i=>({default:i.SettingsPage})));function lazyRoute(i){return jsxRuntimeExports.jsx(reactExports.Suspense,{fallback:jsxRuntimeExports.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Loading settings..."}),children:i})}function guardedRoute(i){return jsxRuntimeExports.jsx(SettingsAuthBoundary,{children:i})}const settingsRoutes=[{element:jsxRuntimeExports.jsx(XpodSettingsLayout,{}),children:[{index:!0,element:jsxRuntimeExports.jsx(Navigate,{to:"/models",replace:!0})},{path:"models",element:guardedRoute(lazyRoute(jsxRuntimeExports.jsx(ModelsPage,{})))},{path:"pod",element:guardedRoute(lazyRoute(jsxRuntimeExports.jsx(PodPage,{view:"settings"})))},{path:"network",element:guardedRoute(lazyRoute(jsxRuntimeExports.jsx(ServicesPage,{product:"settings"}))),children:[{index:!0,element:lazyRoute(jsxRuntimeExports.jsx(SettingsPage,{}))}]},{path:"services",element:guardedRoute(lazyRoute(jsxRuntimeExports.jsx(ServicesPage,{product:"settings"}))),children:[{index:!0,element:lazyRoute(jsxRuntimeExports.jsx(SettingsPage,{}))},{path:"configuration",element:lazyRoute(jsxRuntimeExports.jsx(SettingsPage,{}))}]},{path:"*",element:jsxRuntimeExports.jsx(Navigate,{to:"/models",replace:!0})}]}];function XpodSolidRuntimeProvider({children:i,value:e}){const t=e??getXpodSolidRuntimeValue(),[n,s]=reactExports.useState(()=>t.session.getSnapshot()),[a,u]=reactExports.useState(()=>t.getIssuer()),[c,h]=reactExports.useState(),[f,p]=reactExports.useState(),[g,y]=reactExports.useState();reactExports.useEffect(()=>t.session.subscribe(R=>{s(R),u(t.getIssuer()),R.status!=="authenticated"?(h(void 0),p(void 0),t.pod.clear()):R.webId!==n.webId&&y(void 0)}),[t,n.webId]),reactExports.useEffect(()=>{initializedRuntimes.has(t)||(initializedRuntimes.add(t),t.session.initialize({restorePreviousSession:!0}).then(R=>{s(R),u(t.getIssuer())}))},[t]),reactExports.useEffect(()=>{if(n.status!=="authenticated")return;let R=!1;return t.pod.open({webId:n.webId,fetch:t.session.fetch}).then(T=>{R||(h(T),p(void 0))},T=>{R||p({webId:n.webId,error:T instanceof Error?T:new Error(String(T))})}),()=>{R=!0}},[t,n]);const S=n.status==="authenticated"?n.webId:void 0;reactExports.useEffect(()=>{if(!S)return;let R=!1;return discoverAiClientConfigurationCapability(t.session.fetch).then(T=>{!R&&t.session.getSnapshot().status==="authenticated"&&t.session.getSnapshot().webId===S&&y(T)}),()=>{R=!0}},[S,t]);const w=reactExports.useMemo(()=>{const R=a??t.getIssuer(),T=n.status==="authenticated"&&f?.webId===n.webId?f.error:void 0,A=T?{status:"error",webId:n.webId,podUrl:c?.podUrl,issuer:R,error:T}:snapshotToState(n,c,R);return{session:t.session,pod:t.pod,fetch:t.session.fetch,state:A.status==="error"?{...A,error:safeAuthError(A.error)}:A,webId:A.webId,podUrl:A.podUrl,issuer:A.issuer,currentPod:c,aiClientConfiguration:g,login:async F=>{const x=normalizeXpodOidcIssuer(F);x&&(t.setIssuer(x),u(x),await t.session.login({oidcIssuer:x,redirectUrl:window.location.href}))},logout:async()=>{t.pod.clear(),h(void 0),await t.session.logout()}}},[g,c,a,f,t,n]);return jsxRuntimeExports.jsx(SolidRuntimeProvider,{value:{session:t.session,pod:t.pod,currentPod:c},children:jsxRuntimeExports.jsx(XpodSolidRuntimeContext.Provider,{value:w,children:i})})}async function discoverAiClientConfigurationCapability(i){try{const e=await i("/api/ai/client-configuration/capability",{method:"GET",credentials:"include",headers:{accept:"application/json"}});if(!e.ok||!e.headers.get("content-type")?.includes("application/json"))return await e.arrayBuffer().catch(()=>{}),manualAiClientConfigurationCapability();const t=await e.json();if(isRecord(t)&&t.available===!0&&t.authority==="local-filesystem")return{available:!0,authority:"local-filesystem",manualInstructions:typeof t.manualInstructions=="string"?t.manualInstructions:manualAiClientConfigurationCapability().manualInstructions}}catch{}return manualAiClientConfigurationCapability()}function manualAiClientConfigurationCapability(){return{available:!1,manualInstructions:"manual client setup is available"}}function isRecord(i){return!!(i&&typeof i=="object"&&!Array.isArray(i))}function SettingsRoutes(){return useRoutes(settingsRoutes)}function SettingsApp(){return jsxRuntimeExports.jsx(XpodSolidRuntimeProvider,{children:jsxRuntimeExports.jsx(BrowserRouter,{basename:"/settings",children:jsxRuntimeExports.jsx(SettingsRoutes,{})})})}clientExports.createRoot(document.getElementById("root")).render(jsxRuntimeExports.jsx(reactExports.StrictMode,{children:jsxRuntimeExports.jsx(SettingsApp,{})}));export{Button as B,Input as I,NavLink as N,Outlet as O,React as R,Server as S,cva as a,createLucideIcon as b,cn as c,clsx as d,useXpodSolidRuntime as e,requireReactDom as f,useComposedRefs as g,createSlot as h,jsxRuntimeExports as j,reactExports as r,useLocation as u};
|
package/static/settings/assets/{workspace-layout-B0wJpPze.js → workspace-layout-B47luv6r.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,j as s,c as k}from"./settings-
|
|
1
|
+
import{r as t,j as s,c as k}from"./settings-Cyyv6-SD.js";const y=t.createContext(null);function P(){const e=t.useContext(y);if(!e)throw new Error("useWorkspaceLayout must be used inside TwoPaneLayout");return e}const g="(max-width: 767px)",v={gridTemplateColumns:"210px minmax(0, 1fr)"};function j(e){return e==="context"?"main":e}function C(e){if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};const a=window.matchMedia(g);return a.addEventListener("change",e),()=>a.removeEventListener("change",e)}function R(){return typeof window>"u"||typeof window.matchMedia!="function"?"split":window.matchMedia(g).matches?"stack":"split"}function L(){return"split"}function M(e){const a=t.useSyncExternalStore(C,R,L);return e==="auto"?a:e}function N({resolvedMode:e,history:a,resolvePane:l}){const[f,m]=t.useState("list"),c=t.useRef(null),h=t.useRef(null),r=t.useRef(null),i=t.useRef(null),u=t.useMemo(()=>({list:h,main:r,context:i}),[]),o=t.useCallback((n,b={})=>{const d=l?.(n)??n;m(d),e==="stack"&&(c.current=d,b.fromHistory||a?.push(d))},[a,l,e]),p=t.useCallback(()=>o("list"),[o]),x=t.useCallback(()=>o("main"),[o]),w=t.useCallback(()=>o("context"),[o]);return t.useLayoutEffect(()=>{if(e!=="stack"){c.current=null;return}const n=c.current;n&&(c.current=null,u[n].current?.focus())},[f,u,e]),t.useLayoutEffect(()=>{if(!(e!=="stack"||!a))return a.subscribe(n=>{o(n,{fromHistory:!0})})},[a,o,e]),{activePane:f,paneRefs:u,openList:p,openMain:x,openContext:w}}function S({listHeader:e,list:a,mainHeader:l,main:f,mode:m="auto",history:c,className:h}){const r=M(m),{activePane:i,paneRefs:u,openList:o,openMain:p,openContext:x}=N({resolvedMode:r,history:c,resolvePane:j}),w=t.useMemo(()=>({mode:r,activePane:i,openList:o,openMain:p,openContext:x}),[i,x,o,p,r]),n=r==="stack",b=n&&i!=="list",d=n&&i!=="main";return s.jsx(y.Provider,{value:w,children:s.jsx("section",{className:k("flex min-h-0 flex-1 flex-col bg-background",h),"data-workspace-layout":"two-pane","data-workspace-mode":r,children:s.jsxs("div",{className:k("grid min-h-0 flex-1",n?"grid-cols-1":null),style:n?void 0:v,"data-workspace-layout-mode":m,"data-workspace-active-pane":i,children:[s.jsxs("aside",{ref:u.list,className:k("flex min-h-0 flex-col overflow-hidden bg-layout-list-item @container",n?"border-r-0":"border-r border-border"),"data-testid":"workspace-list-pane","data-workspace-pane":"list",hidden:b,tabIndex:n?-1:void 0,children:[s.jsx("header",{className:"h-12 shrink-0 border-b border-border bg-layout-list-header","data-workspace-list-header":"true",children:e}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:a})]}),s.jsxs("main",{ref:u.main,className:"flex min-h-0 flex-col overflow-hidden bg-layout-content @container","data-testid":"workspace-main-pane","data-workspace-pane":"main",hidden:d,tabIndex:n?-1:void 0,children:[s.jsx("header",{className:"h-12 shrink-0 border-b border-border bg-layout-content","data-workspace-main-header":"true",children:l}),s.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[n?s.jsx("button",{type:"button",className:"inline-flex items-center px-4 py-3 text-sm text-muted-foreground hover:text-foreground",onClick:o,children:"返回列表"}):null,f]})]})]})})})}export{S as T,P as u};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Xpod Settings</title>
|
|
7
|
-
<script type="module" crossorigin src="/settings/assets/settings-
|
|
7
|
+
<script type="module" crossorigin src="/settings/assets/settings-Cyyv6-SD.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/settings/assets/settings-CSdewNeA.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|