tokentracker-cli 0.59.0 → 0.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +1 -1
- package/README.ko.md +1 -1
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/dashboard/dist/assets/{ActivityHeatmap-DrF_K5ys.js → ActivityHeatmap-DxRcGqb0.js} +1 -1
- package/dashboard/dist/assets/{Card-B13p4G_t.js → Card-CSvrNnBU.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-BCWtoeRf.js → DashboardPage-Cj-7LbVz.js} +1 -1
- package/dashboard/dist/assets/{DevicePage-Be88eLBY.js → DevicePage-MIwh75pN.js} +1 -1
- package/dashboard/dist/assets/DialogTitle-5Pz9G5vx.js +1 -0
- package/dashboard/dist/assets/{FadeIn-BEym_KpF.js → FadeIn-BswCXVn8.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-Ckhzj9HH.js → HeaderGithubStar-DcEFKMNV.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-CJb8fFzg.js → IpCheckPage-DNiWD9VI.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-CjTv2ISs.js → LandingPage-mipacgyL.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardAvatar-Cf0GnSTi.js → LeaderboardAvatar-Cha0prSv.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-rIE2Ygw4.js → LeaderboardPage-DB4L0VDC.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfileModal-CT876wK9.js → LeaderboardProfileModal-CXBulhhd.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-EyJsH0Yf.js → LeaderboardProfilePage-BHYi-9Nl.js} +1 -1
- package/dashboard/dist/assets/LimitsPage-BjD-_Cbj.js +2 -0
- package/dashboard/dist/assets/{LocalOnlyNotice-Dz8c-3ZD.js → LocalOnlyNotice-C4z5PX1u.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-iekpEtgT.js → LoginPage-awg65x0b.js} +1 -1
- package/dashboard/dist/assets/PopoverPopup-D-wymWwQ.js +1 -0
- package/dashboard/dist/assets/{ResetPasswordPage-B69CFuJ-.js → ResetPasswordPage-DBCOMvii.js} +1 -1
- package/dashboard/dist/assets/{Select-SwlPWXxZ.js → Select-CkunmlOy.js} +1 -1
- package/dashboard/dist/assets/SelectItemText-D7T3VeBt.js +1 -0
- package/dashboard/dist/assets/{SettingsPage-_spYM3Kx.js → SettingsPage-DIsoKZO8.js} +1 -1
- package/dashboard/dist/assets/SkillsPage-DIGp5OHK.js +1 -0
- package/dashboard/dist/assets/{WidgetsPage-Cs0kJgks.js → WidgetsPage-N_zvVc5J.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-9EChVGEl.js → WrappedPage-DKH7yGKN.js} +1 -1
- package/dashboard/dist/assets/{agent-logos-LiqKeIhs.js → agent-logos-CcHm05Tf.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-B7ItQsbP.js → arrow-up-right-Srji5q6H.js} +1 -1
- package/dashboard/dist/assets/{download-ZBU9wTAZ.js → download-D3OfnpNz.js} +1 -1
- package/dashboard/dist/assets/{info-CExabEBS.js → info-lMniNm1U.js} +1 -1
- package/dashboard/dist/assets/main-BGYbJv-h.js +1034 -0
- package/dashboard/dist/assets/use-limits-display-prefs-D9l2vQL-.js +1 -0
- package/dashboard/dist/assets/{use-native-settings-C3pXNNqf.js → use-native-settings-CtMHe825.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-8f1hUzNE.js → use-usage-limits-CsWdVm7H.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-CrMUx8Pg.js → useCurrency-8LyGElzm.js} +1 -1
- package/dashboard/dist/assets/useScrollLock-CuXeF5Ev.js +1 -0
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/cli.js +2 -2
- package/src/commands/status.js +4 -0
- package/src/commands/sync.js +2 -2
- package/src/lib/diagnostics.js +3 -0
- package/src/lib/openclaw-session-plugin.js +54 -2
- package/src/lib/opencode-go-limits.js +261 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/usage-limits.js +9 -1
- package/dashboard/dist/assets/DialogTitle-BZmopQRt.js +0 -1
- package/dashboard/dist/assets/LimitsPage-DNg_cqiC.js +0 -2
- package/dashboard/dist/assets/PopoverPopup-BhT2-G0O.js +0 -1
- package/dashboard/dist/assets/SelectItemText-DpUKUC8A.js +0 -1
- package/dashboard/dist/assets/SkillsPage-CfTvatpr.js +0 -1
- package/dashboard/dist/assets/main-CgiMNMS_.js +0 -1030
- package/dashboard/dist/assets/use-limits-display-prefs-bSTssszE.js +0 -1
- package/dashboard/dist/assets/useScrollLock-BaJCW9Ak.js +0 -1
package/src/lib/usage-limits.js
CHANGED
|
@@ -25,6 +25,7 @@ const {
|
|
|
25
25
|
} = require("./cursor-config");
|
|
26
26
|
const { fetchGrokLimits } = require("./grok-limits");
|
|
27
27
|
const { fetchZcodeLimits } = require("./zcode-limits");
|
|
28
|
+
const { fetchOpencodeGoLimits } = require("./opencode-go-limits");
|
|
28
29
|
const { readSqliteJsonRows } = require("./sqlite-reader");
|
|
29
30
|
|
|
30
31
|
// 2-minute in-memory cache
|
|
@@ -2290,7 +2291,7 @@ async function fetchUsageLimitsUncached({
|
|
|
2290
2291
|
const freshClaudeCache = claudeToken ? readFreshClaudeLimitsCache({ home, nowMs }) : null;
|
|
2291
2292
|
|
|
2292
2293
|
const providerFetch = withFetchTimeout(fetchImpl, providerTimeoutMs);
|
|
2293
|
-
const [claudeResult, codexResult, cursor, kimi, gemini, kiro, antigravity, copilot, grok, zcode] = await Promise.all([
|
|
2294
|
+
const [claudeResult, codexResult, cursor, kimi, gemini, kiro, antigravity, copilot, grok, zcode, opencodeGo] = await Promise.all([
|
|
2294
2295
|
claudeToken && !freshClaudeCache && !claudeRetryAtMs
|
|
2295
2296
|
? withProviderTimeout(fetchClaudeUsageLimits(claudeToken, { fetchImpl: providerFetch, maxAttempts: 1 }), "Claude", providerTimeoutMs).then(
|
|
2296
2297
|
(value) => ({ status: "fulfilled", value }),
|
|
@@ -2321,6 +2322,11 @@ async function fetchUsageLimitsUncached({
|
|
|
2321
2322
|
.catch((reason) => ({ configured: true, error: reason?.message || "Unknown error" })),
|
|
2322
2323
|
withProviderTimeout(fetchZcodeLimits({ home, env, fetchImpl: providerFetch }), "ZCode", providerTimeoutMs)
|
|
2323
2324
|
.catch((reason) => ({ configured: true, error: reason?.message || "Unknown error" })),
|
|
2325
|
+
// OpenCode Go scrapes the workspace dashboard (no public REST API yet,
|
|
2326
|
+
// tracked at anomalyco/opencode#16017). Auth is via two env vars, see
|
|
2327
|
+
// src/lib/opencode-go-limits.js for the exact endpoint + cookie shape.
|
|
2328
|
+
withProviderTimeout(fetchOpencodeGoLimits({ env, fetchImpl: providerFetch }), "OpenCode Go", providerTimeoutMs)
|
|
2329
|
+
.catch((reason) => ({ configured: true, error: reason?.message || "Unknown error" })),
|
|
2324
2330
|
]);
|
|
2325
2331
|
|
|
2326
2332
|
let claude;
|
|
@@ -2403,6 +2409,7 @@ async function fetchUsageLimitsUncached({
|
|
|
2403
2409
|
copilot: withPlanLabel(copilot, copilot.plan_name, "Copilot"),
|
|
2404
2410
|
grok: withPlanLabel(grok, null, "Grok"),
|
|
2405
2411
|
zcode: withPlanLabel(zcode, zcode.plan_label, "ZCode"),
|
|
2412
|
+
opencodeGo: withPlanLabel(opencodeGo, opencodeGo?.plan_label, "OpenCode Go"),
|
|
2406
2413
|
};
|
|
2407
2414
|
|
|
2408
2415
|
cache = { data, fetchedAt: nowMs };
|
|
@@ -2435,4 +2442,5 @@ module.exports = {
|
|
|
2435
2442
|
describeCopilotOtelStatus,
|
|
2436
2443
|
fetchGrokLimits,
|
|
2437
2444
|
fetchZcodeLimits,
|
|
2445
|
+
fetchOpencodeGoLimits,
|
|
2438
2446
|
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bQ as s,b9 as T,r as i,b4 as W,a as k,bf as K,be as ee,j as I,bY as te,b$ as ne,b as oe,bR as se,bG as re,bJ as ae,b8 as ie,bL as le}from"./main-CgiMNMS_.js";import{x as z,P as G,w as L,A as x,l as H,v as ue,r as de,I as pe,h as ce,i as ge,j as fe,k as me,z as Se,m as Ce,s as Pe,e as Oe,f as Re,u as xe}from"./useScrollLock-BaJCW9Ak.js";function Ee(){return new z({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new G,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function he(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Ee(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:T,inactiveTriggerProps:T,popupProps:T}}function Ie(e,t,o=!1){return new z({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:o,onOpenChange:void 0})}const w=s(e=>e.triggerIdProp??e.activeTriggerId),Y=s(e=>e.openProp??e.open),$=s(e=>(e.popupElement?.id??e.floatingId)||void 0);function Q(e,t){return t!==void 0&&Y(e)&&w(e)===t}function ve(e,t){return Q(e,t)?!0:t!==void 0&&Y(e)&&w(e)==null&&e.triggerCount===1}const ye={open:Y,mounted:s(e=>e.mounted),transitionStatus:s(e=>e.transitionStatus),floatingRootContext:s(e=>e.floatingRootContext),triggerCount:s(e=>e.triggerCount),preventUnmountingOnClose:s(e=>e.preventUnmountingOnClose),payload:s(e=>e.payload),activeTriggerId:w,activeTriggerElement:s(e=>e.mounted?e.activeTriggerElement:null),popupId:$,isTriggerActive:s((e,t)=>t!==void 0&&w(e)===t),isOpenedByTrigger:s((e,t)=>Q(e,t)),isMountedByTrigger:s((e,t)=>t!==void 0&&w(e)===t&&e.mounted),triggerProps:s((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:s((e,t)=>ve(e,t)?$(e):void 0),popupProps:s(e=>e.popupProps),popupElement:s(e=>e.popupElement),positionerElement:s(e=>e.positionerElement)},q=i.createContext(!1),X=i.createContext(void 0);function b(e){const t=i.useContext(X);if(e===!1&&t===void 0)throw new Error(W(27));return t}const be={...L,...K},Ye=i.forwardRef(function(t,o){const{render:r,className:a,style:l,forceRender:u=!1,...d}=t,{store:p}=b(),n=p.useState("open"),C=p.useState("nested"),m=p.useState("mounted"),S=p.useState("transitionStatus");return k("div",t,{state:{open:n,transitionStatus:S},ref:[p.context.backdropRef,o],stateAttributesMapping:be,props:[{role:"presentation",hidden:!m,style:{userSelect:"none",WebkitUserSelect:"none"}},d],enabled:u||!C})});let Te=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),we=(function(e){return e[e.open=x.open]="open",e[e.closed=x.closed]="closed",e[e.startingStyle=x.startingStyle]="startingStyle",e[e.endingStyle=x.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Z=i.createContext(void 0);function V(){const e=i.useContext(Z);if(e===void 0)throw new Error(W(26));return e}const De={...L,...K,nestedDialogOpen(e){return e?{[we.nestedDialogOpen]:""}:null}},_e=i.forwardRef(function(t,o){const{render:r,className:a,style:l,finalFocus:u,initialFocus:d,...p}=t,{store:n}=b(),C=n.useState("descriptionElementId"),m=n.useState("disablePointerDismissal"),S=n.useState("floatingRootContext"),O=n.useState("popupProps"),f=n.useState("modal"),R=n.useState("mounted"),E=n.useState("nested"),h=n.useState("nestedOpenDialogCount"),g=n.useState("open"),v=n.useState("openMethod"),P=n.useState("titleElementId"),c=n.useState("transitionStatus"),M=n.useState("role"),N=S.useState("floatingId"),F=p.id??N;V(),ee({open:g,ref:n.context.popupRef,onComplete(){g&&n.context.onOpenChangeComplete?.(!0)}});function B(D){return D==="touch"?n.context.popupRef.current:!0}const j=d===void 0?B:d,U=h>0,y=n.useStateSetter("popupElement"),A=k("div",t,{state:{open:g,nested:E,transitionStatus:c,nestedDialogOpen:U},props:[O,{id:F,"aria-labelledby":P??void 0,"aria-describedby":C??void 0,role:M,...H,hidden:!R,onKeyDown(D){ue.has(D.key)&&D.stopPropagation()},style:{[Te.nestedDialogs]:h}},p],ref:[o,n.context.popupRef,y],stateAttributesMapping:De});return I.jsx(de,{context:S,openInteractionType:v,disabled:!R,closeOnFocusOut:!m,initialFocus:j,returnFocus:u,modal:f!==!1,restoreFocus:"popup",children:A})}),$e=i.forwardRef(function(t,o){const{keepMounted:r=!1,...a}=t,{store:l}=b(),u=l.useState("mounted"),d=l.useState("modal"),p=l.useState("open");return u||r?I.jsx(Z.Provider,{value:r,children:I.jsxs(te,{ref:o,...a,children:[u&&d===!0&&I.jsx(pe,{ref:l.context.internalBackdropRef,inert:ne(!p)}),t.children]})}):null});function ke(e){const{store:t,parentContext:o,actionsRef:r,isDrawer:a}=e,l=t.useState("open");ce(t,l),ge(t);const{forceUnmount:u}=fe(l,t),d=i.useCallback(()=>{t.setOpen(!1,oe(se))},[t]);return i.useImperativeHandle(r,()=>({unmount:u,close:d}),[u,d]),{parentContext:o,isDrawer:a}}function Me({store:e,dialogRoot:t}){const{parentContext:o,isDrawer:r}=t,a=e.useState("open"),l=e.useState("disablePointerDismissal"),u=e.useState("modal"),d=e.useState("popupElement"),p=e.useState("floatingRootContext"),[n,C]=i.useState(0),[m,S]=i.useState(0),O=n===0,f=me(p,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:u==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(g){if(!e.context.outsidePressEnabledRef.current||"button"in g&&g.button!==0||"touches"in g&&g.touches.length!==1)return!1;const v=re(g);if(O&&!l){const P=v;return u&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===P||e.context.backdropRef.current===P||ae(P,d)&&!P?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:O});Se(a&&u===!0,d),e.useContextCallback("onNestedDialogOpen",(g,v)=>{C(g),S(v)}),e.useContextCallback("onNestedDialogClose",()=>{C(0),S(0)}),i.useEffect(()=>(o?.onNestedDialogOpen&&a&&o.onNestedDialogOpen(n+1,m+(r?1:0)),o?.onNestedDialogClose&&!a&&o.onNestedDialogClose(),()=>{o?.onNestedDialogClose&&a&&o.onNestedDialogClose()}),[r,a,n,m,o]);const R=f.reference??T,E=f.trigger??T,h=i.useMemo(()=>ie(H,f.floating),[f.floating]);return Ce(e,{activeTriggerProps:R,inactiveTriggerProps:E,popupProps:h,nestedOpenDialogCount:n,nestedOpenDrawerCount:m}),null}const Ne={...ye,modal:s(e=>e.modal),nested:s(e=>e.nested),nestedOpenDialogCount:s(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:s(e=>e.nestedOpenDrawerCount),disablePointerDismissal:s(e=>e.disablePointerDismissal),openMethod:s(e=>e.openMethod),descriptionElementId:s(e=>e.descriptionElementId),titleElementId:s(e=>e.titleElementId),viewportElement:s(e=>e.viewportElement),role:s(e=>e.role)};class _ extends le{constructor(t,o,r=!1){const a=new G,l=Fe(t);l.floatingRootContext=Ie(a,o,r),super(l,{popupRef:i.createRef(),backdropRef:i.createRef(),internalBackdropRef:i.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:a,onOpenChange:void 0,onOpenChangeComplete:void 0},Ne)}setOpen=(t,o)=>{if(o.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&o.trigger==null&&this.state.activeTriggerId!=null&&(o.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,o),o.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,o);const r={open:t};Pe(r,t,o.trigger),this.update(r)};static useStore(t,o){return Oe(t,(a,l)=>new _(o,a,l),!0).store}}function Fe(e={}){return{...he(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function Be(e,t="dialog"){const{children:o,open:r,defaultOpen:a=!1,onOpenChange:l,onOpenChangeComplete:u,disablePointerDismissal:d=!1,modal:p=!0,actionsRef:n,handle:C,triggerId:m,defaultTriggerId:S=null}=e,O=t==="drawer",f=t==="alert-dialog",R=f?!0:p,E=f||d,h=f?"alertdialog":"dialog",g=b(!0),P={modal:R,disablePointerDismissal:E,nested:!!g,role:h},c=_.useStore(C?.store,{open:a,openProp:r,activeTriggerId:S,triggerIdProp:m,...P});Re(()=>{const y=r===void 0&&c.state.open===!1&&a===!0?{open:!0,activeTriggerId:S}:null;f?c.update(y?{...P,...y}:P):y&&c.update(y)}),c.useControlledProp("openProp",r),c.useControlledProp("triggerIdProp",m),c.useSyncedValues(P),c.useContextCallback("onOpenChange",l),c.useContextCallback("onOpenChangeComplete",u);const M=c.useState("open"),N=c.useState("mounted"),F=c.useState("payload"),B=ke({store:c,actionsRef:n,parentContext:g?.store.context,isDrawer:O}),j=M||N,U=i.useMemo(()=>({store:c}),[c]);return I.jsx(q.Provider,{value:!1,children:I.jsxs(X.Provider,{value:U,children:[j&&I.jsx(Me,{store:c,dialogRoot:B}),typeof o=="function"?o({payload:F}):o]})})}function Je(e){const t=i.useContext(q)?"drawer":"dialog";return Be(e,t)}let J=(function(e){return e[e.open=x.open]="open",e[e.closed=x.closed]="closed",e[e.startingStyle=x.startingStyle]="startingStyle",e[e.endingStyle=x.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const je={...L,...K,nested(e){return e?{[J.nested]:""}:null},nestedDialogOpen(e){return e?{[J.nestedDialogOpen]:""}:null}},We=i.forwardRef(function(t,o){const{render:r,className:a,style:l,children:u,...d}=t,p=V(),{store:n}=b(),C=n.useState("open"),m=n.useState("nested"),S=n.useState("transitionStatus"),O=n.useState("nestedOpenDialogCount"),f=n.useState("mounted"),R=n.useStateSetter("viewportElement"),E=O>0;return k("div",t,{enabled:p||f,state:{open:C,nested:m,transitionStatus:S,nestedDialogOpen:E},ref:[o,R],stateAttributesMapping:je,props:[{role:"presentation",hidden:!f,style:{pointerEvents:C?void 0:"none"},children:u},d]})}),ze=i.forwardRef(function(t,o){const{render:r,className:a,style:l,id:u,...d}=t,{store:p}=b(),n=xe(u);return p.useSyncedValueWithCleanup("titleElementId",n),k("h2",t,{ref:o,props:[{id:n},d]})});export{Je as D,$e as a,Ye as b,We as c,_e as d,ze as e,Ie as f,he as g,ye as p,b as u};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as i,V as S,G as d,N as $,r as h,U as W,aG as z,i as B,L as G,aH as U}from"./main-CgiMNMS_.js";import{u as H}from"./use-usage-limits-8f1hUzNE.js";import{L as p,a as V,l as b,b as X,u as Y}from"./use-limits-display-prefs-bSTssszE.js";import{C as I}from"./Card-B13p4G_t.js";import{F as q}from"./FadeIn-BEym_KpF.js";import{L as J}from"./LocalOnlyNotice-Dz8c-3ZD.js";import"./arrow-up-right-B7ItQsbP.js";import"./download-ZBU9wTAZ.js";const Q=[3,2,3,3,2,2,3];function f({className:e}){return i.jsx("div",{className:S("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function Z(){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(f,{className:"h-3 w-12 shrink-0"}),i.jsx(f,{className:"flex-1 h-1.5 rounded-full min-w-0"}),i.jsx(f,{className:"h-3 w-[30px] shrink-0"}),i.jsx(f,{className:"h-3 w-6 shrink-0"})]})}function ee({bars:e,index:t}){const n=t%3===0?"w-24":t%3===1?"w-20":"w-[4.5rem]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(f,{className:"h-[14px] w-[14px] rounded shrink-0"}),i.jsx(f,{className:S("h-4",n)})]}),Array.from({length:e},(a,r)=>i.jsx(Z,{},r))]})}function te(){return i.jsx(I,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(f,{className:"h-3.5 w-28"}),Q.map((e,t)=>i.jsx(ee,{bars:e,index:t},t))]})})}function ie(e,t){if(!(e>0))return null;const n=(e-t)/e;return Number.isFinite(n)?Math.min(Math.max(n,0),1):null}function ne(e,t,n=.03){return e>t+n}function re(e){const t=Math.max(0,Math.floor(e)),n=Math.floor(t/3600);return n>24?`${Math.floor(n/24)}d`:n>0?`${n}h`:`${Math.floor(t/60)}m`}function ae(e,t){if(typeof e.windowSeconds=="number")return e.windowSeconds;if(e.windowSecondsField&&t){const n=t[e.windowSecondsField];return typeof n=="number"&&n>0?n:null}return null}function P(e){return e==null?NaN:typeof e=="number"?e*1e3:Date.parse(e)}function le({usedPercent:e,windowSeconds:t,resetMs:n,mode:a,now:r=Date.now()}){const o=Math.min(Math.max(Number(e)||0,0),100)/100,s={pacePercent:null,paceOver:!1,expectedPercent:null,runsOutEta:null,projectedEnd:null};if(!(t>0)||!Number.isFinite(n))return s;const c=Math.max(0,(n-r)/1e3),l=ie(t,c);if(l==null)return s;if(s.expectedPercent=Math.round(l*100),s.paceOver=ne(o,l),o>=.05){const u=a==="remaining"?1-l:l;s.pacePercent=u*100}if(l>.02&&o>0){const u=t*l,m=o/u,x=o/l;x>=1&&m>0?s.runsOutEta=re((1-o)/m):s.projectedEnd=Math.round(Math.min(x,1)*100)}return s}const _=100;function E(e){const t=Date.parse(e);return Number.isFinite(t)?t:null}function oe(e){return Math.max(0,Math.min(_,Math.round(e)))}function se(e){return new Intl.DateTimeFormat($(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e))}function de(e,t,n){if(e==null||e>=t)return _;const a=t-e,r=t-n;return oe(r/a*_)}function ce(e){const t=e.available_count;return t===null?null:Number.isInteger(t)&&t>=0?t:void 0}function ue(e,{now:t}={}){if(!e||typeof e!="object")return null;const n=ce(e);if(n===void 0)return null;const a=Array.isArray(e.credits)?e.credits:[],r=t instanceof Date?t.getTime():Number(t??Date.now()),o=[];for(const s of a){const c=E(s?.expires_at);if(c==null)continue;const l=o.length+1;o.push({key:`reset-${l}`,label:d("limits.codex_reset_bank.row_label",{index:l}),expiresAt:se(c),percent:de(E(s?.granted_at),c,r)})}return n===0?null:o.length>0?{kind:"rows",availableCount:n??o.length,rows:o}:n>0?{kind:"count_only",availableCount:n,rows:[]}:null}const L={claude:{windows(e){return[{key:"5h",labelKey:"limits.label.claude_5h",window:e.five_hour,pctField:"utilization",resetField:"resets_at",windowSeconds:5*3600},{key:"7d",labelKey:"limits.label.claude_7d",window:e.seven_day,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},{key:"opus",labelKey:"limits.label.claude_opus",window:e.seven_day_opus,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400}]}},codex:{extra:"codex_reset_bank",windows(e){return[{key:"5h",labelKey:"limits.label.codex_5h",window:e.primary_window,windowSecondsField:"limit_window_seconds"},{key:"7d",labelKey:"limits.label.codex_7d",window:e.secondary_window,windowSecondsField:"limit_window_seconds"},{key:"spark-5h",labelKey:"limits.label.codex_spark_5h",window:e.spark_primary_window,windowSecondsField:"limit_window_seconds"},{key:"spark-7d",labelKey:"limits.label.codex_spark_7d",window:e.spark_secondary_window,windowSecondsField:"limit_window_seconds"}]}},cursor:{windows(e){return[{key:"plan",labelKey:"limits.label.cursor_plan",window:e.primary_window},{key:"auto",labelKey:"limits.label.cursor_auto",window:e.secondary_window},{key:"api",labelKey:"limits.label.cursor_api",window:e.tertiary_window}]}},gemini:{windows(e){return[{key:"pro",labelKey:"limits.label.gemini_pro",window:e.primary_window},{key:"flash",labelKey:"limits.label.gemini_flash",window:e.secondary_window},{key:"lite",labelKey:"limits.label.gemini_lite",window:e.tertiary_window}]}},kimi:{extra:"kimi_parallel",windows(e){return[{key:"weekly",labelKey:"limits.label.kimi_weekly",window:e.primary_window,windowSeconds:7*86400},{key:"5h",labelKey:"limits.label.kimi_5h",window:e.secondary_window,windowSeconds:5*3600},{key:"total",labelKey:"limits.label.kimi_total",window:e.tertiary_window}]}},kiro:{windows(e){return[{key:"month",labelKey:"limits.label.kiro_month",window:e.primary_window},{key:"bonus",labelKey:"limits.label.kiro_bonus",window:e.secondary_window}]}},grok:{windows(e){return[{key:"month",labelKey:"limits.label.grok_month",window:e.primary_window},{key:"ondemand",labelKey:"limits.label.grok_ondemand",window:e.secondary_window}]}},antigravity:{windows(e){return[{key:"claude",labelKey:"limits.label.antigravity_claude",window:e.primary_window},{key:"gpro",labelKey:"limits.label.antigravity_gpro",window:e.secondary_window},{key:"flash",labelKey:"limits.label.antigravity_flash",window:e.tertiary_window}]}},copilot:{extra:"copilot_otel",windows(e){return[{key:"premium",labelKey:"limits.label.copilot_premium",window:e.primary_window},{key:"chat",labelKey:"limits.label.copilot_chat",window:e.secondary_window}]}},zcode:{windows(e){return[{key:"glm52",labelKey:"limits.label.zcode_glm52",window:e.primary_window},{key:"glm5t",labelKey:"limits.label.zcode_glm5t",window:e.secondary_window}]}}},me="shrink-0 text-oai-black dark:text-oai-white";function xe(e){const t=P(e);if(!Number.isFinite(t))return null;const n=t-Date.now();if(n<=0)return d("shared.time.now");const a=Math.floor(n/6e4);if(a<60)return`${a}m`;const r=Math.floor(a/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function pe(e,t){const n=t===p.REMAINING?100-e:e;return n>=90?"bg-red-500":n>=70?"bg-amber-500":"bg-emerald-500"}function g(e,t="used_percent"){return e?t==="utilization"?e.utilization:e.used_percent:null}function R(e,t="reset_at"){return e?t==="resets_at"?e.resets_at:e.reset_at:null}function we(e,t){return le({usedPercent:g(e.window,e.pctField),windowSeconds:ae(e,e.window),resetMs:P(R(e.window,e.resetField)),mode:t})}function fe({label:e,pct:t,reset:n,mode:a=p.USED,pacePercent:r=null,paceOver:o=!1}){const s=Math.max(0,Math.min(100,Number(t)||0)),c=a===p.REMAINING?100-s:s,l=Math.round(c),u=c>0&&l===0?Math.max(c,.35):c;let m=String(l);c>0&&l===0&&(m=d("limits.bar.sub_one_percent"));const x=r==null?null:Math.max(0,Math.min(100,r));return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:e}),i.jsxs("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[i.jsx("div",{className:`${pe(c,a)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${u}%`,minWidth:c>0?"3px":0}}),x!=null&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"absolute top-0 h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{left:`calc(${x}% - 3px)`,width:"6px"}}),i.jsx("div",{className:`absolute top-0 h-full ${o?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${x}% - 1px)`,width:"2px"}})]})]}),i.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:[m,"%"]}),n&&i.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:n})]})}function he(e,t,n){const a=d(e.labelKey),r=n===p.REMAINING,o=l=>r?100-l:l;if(t.expectedPercent==null){const l=Math.round(Math.max(0,Math.min(100,Number(g(e.window,e.pctField))||0)));return r?d("limits.explain.remaining",{label:a,used:o(l)}):d("limits.explain.used",{label:a,used:l})}if(t.paceOver){if(t.runsOutEta)return d("limits.explain.ahead_eta",{label:a,eta:t.runsOutEta});const l=o(t.projectedEnd??100);return d(r?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:a,pct:l})}const s=Math.round(Math.max(0,Math.min(100,Number(g(e.window,e.pctField))||0))),c=o(t.projectedEnd??s);return d(r?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:a,pct:c})}function ye({rows:e,mode:t}){if(e.length===0)return null;const n=t===p.REMAINING;return i.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[e.map(({spec:a,pace:r})=>i.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:he(a,r,t)},a.key)),i.jsx("div",{className:"mt-1 pt-1.5 border-t border-oai-gray-200/70 dark:border-oai-gray-700/50 text-[10.5px] leading-snug text-oai-gray-400 dark:text-oai-gray-500",children:d(n?"limits.explain.body_remaining":"limits.explain.body")})]})}function k({name:e,providerId:t,children:n,expandable:a=!1,expanded:r=!1,onToggle:o}){const s=X(t),c=i.jsxs("div",{className:"flex items-center gap-1.5",children:[s?i.jsx(W,{provider:s,size:14,className:me}):null,i.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:e})]});return a?i.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":r,onClick:o,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),o?.())},className:"flex flex-col gap-1.5 -mx-1.5 px-1.5 py-1 rounded-lg cursor-pointer transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 aria-expanded:bg-oai-gray-50 dark:aria-expanded:bg-oai-gray-800/40",children:[c,n]}):i.jsxs("div",{className:"flex flex-col gap-1.5",children:[c,n]})}const ge=V;function y({children:e,tone:t="neutral"}){const n=t==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return i.jsx("div",{className:`text-[11px] leading-snug ${n}`,children:e})}function be({rows:e,mode:t,extra:n=null}){const a=e.length===0&&!n;return i.jsxs(i.Fragment,{children:[e.map(({spec:r,pace:o})=>i.jsx(fe,{label:d(r.labelKey),pct:g(r.window,r.pctField),reset:xe(R(r.window,r.resetField)),mode:t,pacePercent:o.pacePercent,paceOver:o.paceOver},r.key)),a?i.jsx(y,{children:d("limits.status.no_data")}):null,n]})}function _e({row:e}){const t=Math.max(0,Math.min(100,Number(e.percent)||0));return i.jsxs("div",{className:"flex items-center gap-2","data-reset-bank-row":"",children:[i.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:e.label}),i.jsx("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:i.jsx("div",{className:"bg-oai-gray-400 dark:bg-oai-gray-500 rounded-full h-full transition-[width] duration-500 ease-out",style:{width:`${t}%`,minWidth:t>0?"3px":0}})}),i.jsx("span",{className:"text-[10px] tabular-nums text-oai-gray-400 dark:text-oai-gray-500 w-[4.25rem] text-right shrink-0 whitespace-nowrap",children:e.expiresAt})]})}function ke({model:e}){const t=e.kind==="count_only"?d("limits.codex_reset_bank.count_only",{count:e.availableCount}):null;return i.jsxs("div",{className:"mt-1 flex flex-col gap-1","data-reset-bank-section":e.kind,children:[i.jsx("div",{className:"text-[10.5px] font-medium uppercase tracking-wide text-oai-gray-400 dark:text-oai-gray-500",children:d("limits.codex_reset_bank.title")}),t?i.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:t}):e.rows.map(n=>i.jsx(_e,{row:n},n.key))]})}function je(e,t){if(e==="codex_reset_bank"){const n=ue(t.reset_credits);return n?i.jsx(ke,{model:n}):null}return e==="kimi_parallel"&&t.parallel_limit?i.jsx(y,{children:d("limits.label.kimi_parallel",{count:t.parallel_limit})}):e==="copilot_otel"&&!t.otel_has_files&&!t.otel_enabled?i.jsx(Me,{defaultDir:t.otel_default_dir}):null}function ve(e,t,n,a,r,o){const s=L[e];if(!s)return null;const c=s.windows(t).filter(u=>u.window).map(u=>({spec:u,pace:we(u,a)})),l=je(s.extra,t);return i.jsxs(k,{name:n,providerId:e,expandable:c.length>0,expanded:r,onToggle:o,children:[i.jsx(be,{mode:a,rows:c,extra:l}),r?i.jsx(ye,{rows:c,mode:a}):null]},e)}function Ne(e,t,n,a,r){if(!L[e])return null;if(!t?.configured)return i.jsx(k,{name:b(e),providerId:e,children:i.jsx(y,{children:d("limits.status.not_connected")})},e);if(t.error)return i.jsx(k,{name:b(e),providerId:e,children:i.jsx(y,{tone:"error",children:d("shared.error.prefix",{error:t.error})})},e);const o=b(e),s=t.plan_label?`${o} ${t.plan_label}`:o;return ve(e,t,s,n,a,r)}function Me({defaultDir:e}){const[t,n]=h.useState(!1),r=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${e||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
|
|
2
|
-
`),o=async s=>{s.stopPropagation();try{await navigator.clipboard.writeText(r),n(!0),setTimeout(()=>n(!1),1600)}catch{}};return i.jsxs("div",{className:"mt-1 rounded-md border border-amber-300/60 dark:border-amber-700/40 bg-amber-50/50 dark:bg-amber-900/10 px-2.5 py-2 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[i.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:d("limits.copilot.otelHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug",children:d("limits.copilot.otelHint.body")}),i.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:r}),i.jsx("button",{type:"button",onClick:o,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:t?d("limits.copilot.otelHint.copied"):d("limits.copilot.otelHint.copy")})]})}function Ee(e){const[t,n]=h.useState(0);return h.useLayoutEffect(()=>{const a=e.current;if(!a)return;const r=a.querySelectorAll("[data-limit-label]");let o=0,s=null;if(r.length>0)try{s=document.createElement("canvas").getContext("2d")}catch{s=null}if(s){const l=window.getComputedStyle(r[0]);s.font=`${l.fontStyle} ${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;for(const u of r)o=Math.max(o,s.measureText(u.textContent).width)}const c=Math.ceil(o);n(l=>l===c?l:c)}),t}function Se({claude:e,codex:t,cursor:n,gemini:a,kimi:r,kiro:o,grok:s,antigravity:c,copilot:l,zcode:u,order:m,visibility:x,displayMode:F}){const K={claude:e,codex:t,cursor:n,gemini:a,kimi:r,kiro:o,grok:s,antigravity:c,copilot:l,zcode:u},j=h.useRef(null),v=Ee(j),[O,T]=h.useState(null),D=Array.isArray(m)&&m.length>0?m:ge,N=F===p.REMAINING?p.REMAINING:p.USED,A=N===p.REMAINING?d("limits.settings.display_mode_remaining"):d("limits.settings.display_mode_used"),M=D.filter(w=>!x||x[w]!==!1).map(w=>Ne(w,K[w],N,O===w,()=>T(C=>C===w?null:w))).filter(Boolean);return i.jsx(q,{delay:.15,children:i.jsx(I,{children:i.jsxs("div",{ref:j,className:"flex flex-col gap-3",style:v>0?{"--tt-limits-label-w":`${v}px`}:void 0,children:[i.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[d("limits.panel.title"),d("limits.panel.mode_separator"),A]}),M.length>0?M:i.jsx(y,{children:d("limits.status.all_hidden")})]})})})}const Ie=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function Ae(){const e=z(),{data:t,error:n,isLoading:a}=H(e?{initialRefresh:!0,initialState:e,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),r=Y();return!Ie&&!B()?i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx(J,{})}):i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:i.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[i.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:d("nav.limits")}),i.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:d("limits.page.subtitle")})]}),i.jsx(G,{to:"/settings","aria-label":d("limits.page.openSettings"),title:d("limits.page.openSettings"),className:"shrink-0 inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:i.jsx(U,{className:"h-4 w-4","aria-hidden":!0})})]}),a?i.jsx(te,{}):i.jsxs(i.Fragment,{children:[n?i.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:d("shared.error.prefix",{error:n})}):null,i.jsx(Se,{claude:t?.claude,codex:t?.codex,cursor:t?.cursor,gemini:t?.gemini,kimi:t?.kimi,kiro:t?.kiro,grok:t?.grok,antigravity:t?.antigravity,copilot:t?.copilot,zcode:t?.zcode,order:r.order,visibility:r.visibility,displayMode:r.displayMode})]})]})})})}export{Ae as LimitsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as we,bx as ge,b5 as Ue,by as Ke,bz as le,bA as We,bB as ne,b3 as me,r as m,bC as J,bD as he,bE as Ee,bF as oe,bG as be,bH as qe,bI as Le,bJ as $,b as z,bK as W,ar as ue,b4 as pe,bL as $e,bM as Te,bN as Qe,d as ze,bO as Je,bP as ve,bQ as q,j as Y,bR as Ze,b9 as Me,b8 as et,bS as tt,bT as nt,bU as ot,bV as st,u as rt,a as He,bW as it,bX as ye,bY as at,bZ as ct,b_ as lt,b$ as ut,be as ft,c0 as dt,bf as pt}from"./main-CgiMNMS_.js";import{b as Ae,c as Be,g as Ce,d as se,P as gt,e as mt,s as ht,F as Et,f as Tt,h as vt,i as Ct,j as Pt,k as bt,l as _e,m as Rt,u as St,n as Ot,p as It,t as Mt,o as yt,I as xt,q as Ft,r as kt,v as wt,w as Lt}from"./useScrollLock-BaJCW9Ak.js";import{f as Ht,p as At,g as Bt}from"./DialogTitle-BZmopQRt.js";import{p as _t,q as Dt,r as Nt,t as jt,v as Yt,w as Vt,x as Gt,y as Xt}from"./SelectItemText-DpUKUC8A.js";const Ut=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],En=we("chevron-right",Ut);const Kt=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Tn=we("loader-circle",Kt);function Wt(e,n){return n!=null&&!ge(n)?0:typeof e=="function"?e():e}function Pe(e,n,t){const c=Wt(e,t);return typeof c=="number"?c:c?.[n]}function xe(e){return typeof e=="function"?e():e}function De(e,n){return n||e==="click"||e==="mousedown"}function qt(e){return e?.includes("mouse")&&e!=="mousedown"}class Re{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new le,this.restTimeout=new le,this.handleCloseOptions=void 0}static create(){return new Re}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const fe=new WeakMap;function de(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&fe.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),fe.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Ne(e,n){const{scopeElement:t,referenceElement:c,floatingElement:i}=n,o=fe.get(t);o&&o!==e&&de(o),de(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=t,e.pointerEventsReferenceElement=c,e.pointerEventsFloatingElement=i,fe.set(t,e),t.style.pointerEvents="none",c.style.pointerEvents="auto",i.style.pointerEvents="auto"}function je(e){const n=e.context.dataRef.current,t=Ue(()=>n.hoverInteractionState??Re.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=t),Ke(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function $t(e,n={}){const{enabled:t=!0,closeDelay:c=0,nodeId:i}=n,o="rootStore"in e?e.rootStore:e,p=o.useState("open"),E=o.useState("floatingElement"),S=o.useState("domReferenceElement"),{dataRef:f}=o.context,r=Ae(),O=Be(),h=je(o),j=We(),l=ne(()=>De(f.current.openEvent?.type,h.interactedInside)),N=ne(()=>qt(f.current.openEvent?.type)),g=ne(()=>{de(h)});me(()=>{p||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,g())},[p,h,g]),m.useEffect(()=>g,[g]),me(()=>{if(t&&p&&h.handleCloseOptions?.blockPointerEvents&&N()&&J(S)&&E){const F=S,a=E,d=he(E),k=r?.nodesRef.current.find(b=>b.id===O)?.context?.elements.floating;k&&(k.style.pointerEvents="");const A=h.pointerEventsScopeElement!==a?h.pointerEventsScopeElement:null,T=k!==a?k:null,P=h.handleCloseOptions?.getScope?.()??A??T??F.closest("[data-rootownerid]")??d.body;return Ne(h,{scopeElement:P,referenceElement:F,floatingElement:a}),()=>{g()}}},[t,p,S,E,h,N,r,O,g]),m.useEffect(()=>{if(!t)return;function F(){return!!(r&&O&&Ce(r.nodesRef.current,O).length>0)}function a(b){const M=Pe(c,"close",h.pointerType),_=()=>{o.setOpen(!1,z(W,b)),r?.events.emit("floating.closed",b)};M?h.openChangeTimeout.start(M,_):(h.openChangeTimeout.clear(),_())}function d(b){const M=be(b);if(!qe(M)){h.interactedInside=!1;return}h.interactedInside=M?.closest("[aria-haspopup]")!=null}function k(){h.openChangeTimeout.clear(),j.clear(),r?.events.off("floating.closed",T),g()}function A(b){if(F()&&r){r.events.on("floating.closed",T);return}if(Le(b.relatedTarget,o.context.triggerElements))return;const M=f.current.floatingContext?.nodeId??i,_=b.relatedTarget;if(!(r&&M&&J(_)&&Ce(r.nodesRef.current,M,!1).some(X=>$(X.context?.elements.floating,_)))){if(h.handler){h.handler(b);return}g(),l()||a(b)}}function T(b){!r||!O||F()||j.start(0,()=>{r.events.off("floating.closed",T),o.setOpen(!1,z(W,b)),r.events.emit("floating.closed",b)})}const P=E;return Ee(P&&oe(P,"mouseenter",k),P&&oe(P,"mouseleave",A),P&&oe(P,"pointerdown",d,!0),()=>{r?.events.off("floating.closed",T)})},[t,E,o,f,c,i,l,g,h,r,O,j])}const Qt={current:null};function zt(e,n={}){const{enabled:t=!0,delay:c=0,handleClose:i=null,mouseOnly:o=!1,restMs:p=0,move:E=!0,triggerElementRef:S=Qt,externalTree:f,isActiveTrigger:r=!0,getHandleCloseContext:O,isClosing:h,shouldOpen:j}=n,l="rootStore"in e?e.rootStore:e,{dataRef:N,events:g}=l.context,F=Ae(f),a=je(l),d=m.useRef(!1),k=se(i),A=se(c),T=se(p),P=se(t),b=se(j),M=se(h),_=ne(()=>De(N.current.openEvent?.type,a.interactedInside)),G=ne(()=>b.current?.()!==!1),X=ne((s,v,H)=>{const R=l.context.triggerElements;if(R.hasElement(v))return!s||!$(s,v);if(!J(H))return!1;const u=H;return R.hasMatchingElement(B=>$(B,u))&&(!s||!$(s,u))}),D=ne(()=>{if(!a.handler)return;he(l.select("domReferenceElement")).removeEventListener("mousemove",a.handler),a.handler=void 0}),L=ne(()=>{de(a)});return r&&(a.handleCloseOptions=k.current?.__options),m.useEffect(()=>D,[D]),m.useEffect(()=>{if(!t)return;function s(v){v.open?d.current=!1:(d.current=v.reason===W,D(),a.openChangeTimeout.clear(),a.restTimeout.clear(),a.blockMouseMove=!0,a.restTimeoutPending=!1)}return g.on("openchange",s),()=>{g.off("openchange",s)}},[t,g,a,D]),m.useEffect(()=>{if(!t)return;function s(u,B=!0){const y=Pe(A.current,"close",a.pointerType);y?a.openChangeTimeout.start(y,()=>{l.setOpen(!1,z(W,u)),F?.events.emit("floating.closed",u)}):B&&(a.openChangeTimeout.clear(),l.setOpen(!1,z(W,u)),F?.events.emit("floating.closed",u))}const v=S.current??(r?l.select("domReferenceElement"):null);if(!J(v))return;function H(u){if(a.openChangeTimeout.clear(),a.blockMouseMove=!1,o&&!ge(a.pointerType))return;const B=xe(T.current),y=Pe(A.current,"open",a.pointerType),V=be(u),U=u.currentTarget??null,I=l.select("domReferenceElement");let w=U;if(J(V)&&!l.context.triggerElements.hasElement(V)){for(const Ie of l.context.triggerElements.elements())if($(Ie,V)){w=Ie;break}}J(U)&&J(I)&&!l.context.triggerElements.hasElement(U)&&$(U,I)&&(w=I);const C=w==null?!1:X(I,w,V),Q=l.select("open"),Z=M.current?.()??l.select("transitionStatus")==="ending",K=!Q&&Z&&d.current,ee=!C&&J(w)&&J(I)&&$(I,w)&&K,te=B>0&&!y,Xe=C&&(Q||K)||ee,Oe=!Q||C;if(Xe){G()&&l.setOpen(!0,z(W,u,w));return}te||(y?a.openChangeTimeout.start(y,()=>{Oe&&G()&&l.setOpen(!0,z(W,u,w))}):Oe&&G()&&l.setOpen(!0,z(W,u,w)))}function R(u){if(_()){L();return}D();const B=l.select("domReferenceElement"),y=he(B);a.restTimeout.clear(),a.restTimeoutPending=!1;const V=N.current.floatingContext??O?.();if(Le(u.relatedTarget,l.context.triggerElements))return;if(k.current&&V){l.select("open")||a.openChangeTimeout.clear();const I=S.current;a.handler=k.current({...V,tree:F,x:u.clientX,y:u.clientY,onClose(){L(),D(),P.current&&!_()&&I===l.select("domReferenceElement")&&s(u,!0)}}),y.addEventListener("mousemove",a.handler),a.handler(u);return}(a.pointerType!=="touch"||!$(l.select("floatingElement"),u.relatedTarget))&&s(u)}return E?Ee(oe(v,"mousemove",H,{once:!0}),oe(v,"mouseenter",H),oe(v,"mouseleave",R)):Ee(oe(v,"mouseenter",H),oe(v,"mouseleave",R))},[D,L,N,A,l,t,k,a,r,X,_,o,E,T,S,F,P,O,M,G]),m.useMemo(()=>{if(!t)return;function s(v){a.pointerType=v.pointerType}return{onPointerDown:s,onPointerEnter:s,onMouseMove(v){const{nativeEvent:H}=v,R=v.currentTarget,u=l.select("domReferenceElement"),B=l.select("open"),y=X(u,R,v.target);if(o&&!ge(a.pointerType))return;if(B&&y&&a.handleCloseOptions?.blockPointerEvents){const I=l.select("floatingElement");if(I){const w=a.handleCloseOptions?.getScope?.()??R.ownerDocument.body;Ne(a,{scopeElement:w,referenceElement:R,floatingElement:I})}}const V=xe(T.current);if(B&&!y||V===0||!y&&a.restTimeoutPending&&v.movementX**2+v.movementY**2<2)return;a.restTimeout.clear();function U(){if(a.restTimeoutPending=!1,_())return;const I=l.select("open");!a.blockMouseMove&&(!I||y)&&G()&&l.setOpen(!0,z(W,H,R))}a.pointerType==="touch"?ue.flushSync(()=>{U()}):y&&B?U():(a.restTimeoutPending=!0,a.restTimeout.start(V,U))}}},[t,a,_,X,o,l,T,G])}const Fe=.1,Jt=Fe*Fe,x=.5;function ie(e,n,t,c,i,o){return c>=n!=o>=n&&e<=(i-t)*(n-c)/(o-c)+t}function ae(e,n,t,c,i,o,p,E,S,f){let r=!1;return ie(e,n,t,c,i,o)&&(r=!r),ie(e,n,i,o,p,E)&&(r=!r),ie(e,n,p,E,S,f)&&(r=!r),ie(e,n,S,f,t,c)&&(r=!r),r}function Zt(e,n,t){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function ce(e,n,t,c,i,o){const p=Math.min(t,i),E=Math.max(t,i),S=Math.min(c,o),f=Math.max(c,o);return e>=p&&e<=E&&n>=S&&n<=f}function en(e={}){const{blockPointerEvents:n=!1}=e,t=new le,c=({x:i,y:o,placement:p,elements:E,onClose:S,nodeId:f,tree:r})=>{const O=p?.split("-")[0];let h=!1,j=null,l=null,N=typeof performance<"u"?performance.now():0;function g(a,d){const k=performance.now(),A=k-N;if(j===null||l===null||A===0)return j=a,l=d,N=k,!1;const T=a-j,P=d-l,b=T*T+P*P,M=A*A*Jt;return j=a,l=d,N=k,b<M}function F(){t.clear(),S()}return function(d){t.clear();const k=E.domReference,A=E.floating;if(!k||!A||O==null||i==null||o==null)return;const{clientX:T,clientY:P}=d,b=be(d),M=d.type==="mouseleave",_=$(A,b),G=$(k,b);if(_&&(h=!0,!M))return;if(G&&(h=!1,!M)){h=!0;return}if(M&&J(d.relatedTarget)&&$(A,d.relatedTarget))return;function X(){return!!(r&&Ce(r.nodesRef.current,f).length>0)}function D(){X()||F()}if(X())return;const L=k.getBoundingClientRect(),s=A.getBoundingClientRect(),v=i>s.right-s.width/2,H=o>s.bottom-s.height/2,R=s.width>L.width,u=s.height>L.height,B=(R?L:s).left,y=(R?L:s).right,V=(u?L:s).top,U=(u?L:s).bottom;if(O==="top"&&o>=L.bottom-1||O==="bottom"&&o<=L.top+1||O==="left"&&i>=L.right-1||O==="right"&&i<=L.left+1){D();return}let I=!1;switch(O){case"top":I=ce(T,P,B,L.top+1,y,s.bottom-1);break;case"bottom":I=ce(T,P,B,s.top+1,y,L.bottom-1);break;case"left":I=ce(T,P,s.right-1,U,L.left+1,V);break;case"right":I=ce(T,P,L.right-1,U,s.left+1,V);break}if(I)return;if(h&&!Zt(T,P,L)){D();return}if(!M&&g(T,P)){D();return}let w=!1;switch(O){case"top":{const C=R?x/2:x*4,Q=R||v?i+C:i-C,Z=R?i-C:v?i+C:i-C,K=o+x+1,ee=v||R?s.bottom-x:s.top,te=v?R?s.bottom-x:s.top:s.bottom-x;w=ae(T,P,Q,K,Z,K,s.left,ee,s.right,te);break}case"bottom":{const C=R?x/2:x*4,Q=R||v?i+C:i-C,Z=R?i-C:v?i+C:i-C,K=o-x,ee=v||R?s.top+x:s.bottom,te=v?R?s.top+x:s.bottom:s.top+x;w=ae(T,P,Q,K,Z,K,s.left,ee,s.right,te);break}case"left":{const C=u?x/2:x*4,Q=u||H?o+C:o-C,Z=u?o-C:H?o+C:o-C,K=i+x+1,ee=H||u?s.right-x:s.left,te=H?u?s.right-x:s.left:s.right-x;w=ae(T,P,ee,s.top,te,s.bottom,K,Q,K,Z);break}case"right":{const C=u?x/2:x*4,Q=u||H?o+C:o-C,Z=u?o-C:H?o+C:o-C,K=i-x,ee=H||u?s.left+x:s.right,te=H?u?s.left+x:s.right:s.left+x;w=ae(T,P,K,Q,K,Z,ee,s.top,te,s.bottom);break}}w?h||t.start(40,D):D()}};return c.__options={...e,blockPointerEvents:n},c}const Ye=m.createContext(void 0);function re(e){const n=m.useContext(Ye);if(n===void 0&&!e)throw new Error(pe(47));return n}function tn(){return{...Bt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const nn={...At,disabled:q(e=>e.disabled),instantType:q(e=>e.instantType),openMethod:q(e=>e.openMethod),openChangeReason:q(e=>e.openChangeReason),modal:q(e=>e.modal),focusManagerModal:q(e=>e.focusManagerModal),stickIfOpen:q(e=>e.stickIfOpen),titleElementId:q(e=>e.titleElementId),descriptionElementId:q(e=>e.descriptionElementId),openOnHover:q(e=>e.openOnHover),closeDelay:q(e=>e.closeDelay),hasViewport:q(e=>e.hasViewport)};class Se extends $e{constructor(n,t,c=!1){const i={...tn(),...n},o=new gt;i.open&&n?.mounted===void 0&&(i.mounted=!0),i.floatingRootContext=Ht(o,t,c),super(i,{popupRef:m.createRef(),backdropRef:m.createRef(),internalBackdropRef:m.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:m.createRef(),beforeContentFocusGuardRef:m.createRef(),stickIfOpenTimeout:new le,triggerElements:o},nn)}setOpen=(n,t)=>{const c=t.reason===W,i=t.reason===Te&&t.event.detail===0,o=!n&&(t.reason===Qe||t.reason==null);t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)};const p=this.select("activeTriggerId");if(!n&&t.reason===ze&&t.trigger==null&&p!=null&&(t.trigger=this.context.triggerElements.getById(p)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(n,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,t);const E=()=>{const S={open:n,openChangeReason:t.reason};ht(S,n,t.trigger),this.update(S)};c?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Je,()=>{this.set("stickIfOpen",!1)}),ue.flushSync(E)):E(),i||o?this.set("instantType",i?"click":"dismiss"):t.reason===ve?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(n,t){const{store:c,internalStore:i}=mt(n,(o,p)=>new Se(t,o,p));return m.useEffect(()=>i?.disposeEffect(),[i]),c}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function ke({props:e}){const{children:n,open:t,defaultOpen:c=!1,onOpenChange:i,onOpenChangeComplete:o,modal:p=!1,handle:E,triggerId:S,defaultTriggerId:f=null}=e,r=Se.useStore(E?.store,{modal:p,open:c,openProp:t,activeTriggerId:f,triggerIdProp:S});Tt(()=>{t===void 0&&r.state.open===!1&&c===!0&&r.update({open:!0,activeTriggerId:f})}),r.useControlledProp("openProp",t),r.useControlledProp("triggerIdProp",S);const O=r.useState("open"),h=r.useState("mounted"),j=r.useState("payload"),l=Be()!=null;r.useContextCallback("onOpenChange",i),r.useContextCallback("onOpenChangeComplete",o),vt(r,O),Ct(r);const{forceUnmount:N}=Pt(O,r,()=>{r.update({stickIfOpen:!0,openChangeReason:null})});r.useSyncedValues({modal:p,nested:l}),m.useEffect(()=>{O||r.context.stickIfOpenTimeout.clear()},[r,O]);const g=m.useCallback(()=>{r.setOpen(!1,z(Ze))},[r]);m.useImperativeHandle(e.actionsRef,()=>({unmount:N,close:g}),[N,g]);const F=O||h,a=m.useMemo(()=>({store:r}),[r]);return Y.jsxs(Ye.Provider,{value:a,children:[F&&Y.jsx(on,{store:r,modal:p}),typeof n=="function"?n({payload:j}):n]})}function vn(e){return re(!0)?Y.jsx(ke,{props:e}):Y.jsx(Et,{children:Y.jsx(ke,{props:e})})}function on({store:e,modal:n}){const t=e.useState("floatingRootContext"),c=bt(t,{outsidePressEvent:{mouse:n==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),i=c.reference??Me,o=c.trigger??Me,p=m.useMemo(()=>et(_e,c.floating),[c.floating]);return Rt(e,{activeTriggerProps:i,inactiveTriggerProps:o,popupProps:p}),null}const sn=300;function rn(e,n){const t=m.useRef(null);function c(o){ue.flushSync(()=>{e.setOpen(!1,z(ve,o.nativeEvent,o.currentTarget))}),st(t.current)?.focus()}function i(o){const p=e.select("positionerElement");if(p&&tt(o,p))e.context.beforeContentFocusGuardRef.current?.focus();else{ue.flushSync(()=>{e.setOpen(!1,z(ve,o.nativeEvent,o.currentTarget))});let E=nt(e.context.triggerFocusTargetRef.current||n.current);for(;E!==null&&$(p,E);){const S=E;if(E=ot(E),E===S)break}E?.focus()}}return{preFocusGuardRef:t,handlePreFocusGuardFocus:c,handleFocusTargetFocus:i}}const Cn=m.forwardRef(function(n,t){const{render:c,className:i,style:o,disabled:p=!1,nativeButton:E=!0,handle:S,payload:f,openOnHover:r=!1,delay:O=sn,closeDelay:h=0,id:j,...l}=n,N=re(!0),g=S?.store??N?.store;if(!g)throw new Error(pe(74));const F=St(j),a=g.useState("isTriggerActive",F),d=g.useState("floatingRootContext"),k=g.useState("isOpenedByTrigger",F),A=g.useState("triggerPopupId",F),T=m.useRef(null),{registerTrigger:P,isMountedByThisTrigger:b}=Ot(F,T,g,{payload:f,disabled:p,openOnHover:r,closeDelay:h}),M=g.useState("openChangeReason"),_=g.useState("stickIfOpen"),G=g.useState("openMethod"),X=g.useState("focusManagerModal"),D=zt(d,{enabled:d!=null&&r&&(G!=="touch"||M!==Te),mouseOnly:!0,move:!1,handleClose:en(),restMs:O,delay:{close:h},triggerElementRef:T,isActiveTrigger:a,isClosing:()=>g.select("transitionStatus")==="ending"}),L=_t(d,{enabled:d!=null,stickIfOpen:_}),s=Dt(()=>g.select("open"),w=>{g.set("openMethod",w)}),v=g.useState("triggerProps",b),{getButtonProps:H,buttonRef:R}=rt({disabled:p,native:E}),u={open(w){return w&&M===Te?It.open(w):Mt.open(w)}},{preFocusGuardRef:B,handlePreFocusGuardFocus:y,handleFocusTargetFocus:V}=rn(g,T),I=He("button",n,{state:{disabled:p,open:k},ref:[R,t,P,T],props:[L.reference,D,v,s,{[it]:"",id:F,"aria-haspopup":"dialog","aria-expanded":k,"aria-controls":A},l,H],stateAttributesMapping:u});return b&&!X?Y.jsxs(m.Fragment,{children:[Y.jsx(ye,{ref:B,onFocus:y}),Y.jsx(m.Fragment,{children:I},F),Y.jsx(ye,{ref:g.context.triggerFocusTargetRef,onFocus:V})]}):Y.jsx(m.Fragment,{children:I},F)}),Ve=m.createContext(void 0);function an(){const e=m.useContext(Ve);if(e===void 0)throw new Error(pe(45));return e}const Pn=m.forwardRef(function(n,t){const{keepMounted:c=!1,...i}=n,{store:o}=re();return o.useState("mounted")||c?Y.jsx(Ve.Provider,{value:c,children:Y.jsx(at,{ref:t,...i})}):null}),Ge=m.createContext(void 0);function cn(){const e=m.useContext(Ge);if(!e)throw new Error(pe(46));return e}const bn=m.forwardRef(function(n,t){const{render:c,className:i,style:o,anchor:p,positionMethod:E="absolute",side:S="bottom",align:f="center",sideOffset:r=0,alignOffset:O=0,collisionBoundary:h="clipping-ancestors",collisionPadding:j=5,arrowPadding:l=5,sticky:N=!1,disableAnchorTracking:g=!1,collisionAvoidance:F=ct,...a}=n,{store:d}=re(),k=an(),A=yt(),T=d.useState("floatingRootContext"),P=d.useState("mounted"),b=d.useState("open"),M=d.useState("openChangeReason"),_=d.useState("activeTriggerElement"),G=d.useState("modal"),X=d.useState("openMethod"),D=d.useState("positionerElement"),L=d.useState("instantType"),s=d.useState("transitionStatus"),v=d.useState("hasViewport"),H=m.useRef(null),R=lt(D,!1,!1),u=Nt({anchor:p,floatingRootContext:T,positionMethod:E,mounted:P,side:S,sideOffset:r,align:f,alignOffset:O,arrowPadding:l,collisionBoundary:h,collisionPadding:j,sticky:N,disableAnchorTracking:g,keepMounted:k,nodeId:A,collisionAvoidance:F,adaptiveOrigin:v?Vt:void 0}),B=T.useState("domReferenceElement");me(()=>{const I=B,w=H.current;if(I&&(H.current=I),w&&I&&I!==w){d.set("instantType",void 0);const C=new AbortController;return R(()=>{d.set("instantType","trigger-change")},C.signal),()=>{C.abort()}}},[B,R,d]),jt(b&&G===!0&&M!==W,X==="touch",D,_);const y=m.useCallback(I=>{d.set("positionerElement",I)},[d]),V={open:b,side:u.side,align:u.align,anchorHidden:u.anchorHidden,instant:L},U=Yt(n,V,{styles:u.positionerStyles,transitionStatus:s,props:a,refs:[t,y],hidden:!P,inert:!b});return Y.jsxs(Ge.Provider,{value:u,children:[P&&G===!0&&M!==W&&Y.jsx(xt,{ref:d.context.internalBackdropRef,inert:ut(!b),cutout:_}),Y.jsx(Ft,{id:A,children:U})]})}),ln=m.createContext(void 0);function un(){const[e,n]=m.useState(0),t=ne(()=>(n(i=>i+1),()=>{n(i=>Math.max(0,i-1))}));return{context:m.useMemo(()=>({register:t}),[t]),hasClosePart:e>0}}function fn(e){const{value:n,children:t}=e;return Y.jsx(ln.Provider,{value:n,children:t})}const dn={...Lt,...pt},Rn=m.forwardRef(function(n,t){const{render:c,className:i,style:o,initialFocus:p,finalFocus:E,...S}=n,{store:f}=re(),r=cn(),O=Gt()!=null,{context:h,hasClosePart:j}=un(),l=f.useState("open"),N=f.useState("openMethod"),g=f.useState("instantType"),F=f.useState("transitionStatus"),a=f.useState("popupProps"),d=f.useState("titleElementId"),k=f.useState("descriptionElementId"),A=f.useState("modal"),T=f.useState("mounted"),P=f.useState("openChangeReason"),b=f.useState("activeTriggerElement"),M=f.useState("floatingRootContext"),_=M.useState("floatingId"),G=f.useState("disabled"),X=f.useState("openOnHover"),D=f.useState("closeDelay"),L=S.id??_;ft({open:l,ref:f.context.popupRef,onComplete(){l&&f.context.onOpenChangeComplete?.(!0)}}),$t(M,{enabled:X&&!G,closeDelay:D});function s(y){return y==="touch"?f.context.popupRef.current:!0}const v=p===void 0?s:p,H=A!==!1&&j;f.useSyncedValue("focusManagerModal",H);const R=m.useCallback(y=>{f.set("popupElement",y)},[f]),u={open:l,side:r.side,align:r.align,instant:g,transitionStatus:F},B=He("div",n,{state:u,ref:[t,f.context.popupRef,R],props:[a,{id:L,role:"dialog",..._e,"aria-labelledby":d,"aria-describedby":k,onKeyDown(y){O&&wt.has(y.key)&&y.stopPropagation()}},Xt(F),S],stateAttributesMapping:dn});return Y.jsx(kt,{context:M,openInteractionType:N,modal:H,disabled:!T||P===W,initialFocus:v,returnFocus:E,restoreFocus:"popup",previousFocusableElement:dt(b)?b:void 0,nextFocusableElement:f.context.triggerFocusTargetRef,beforeContentFocusGuardRef:f.context.beforeContentFocusGuardRef,children:Y.jsx(fn,{value:h,children:B})})});export{En as C,Tn as L,vn as P,Cn as a,Pn as b,bn as c,Rn as d};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as Or,bM as Pr,r as l,c5 as Ut,bA as St,bx as xn,bG as _n,c6 as Lr,b9 as Et,b as We,c7 as tt,c8 as $e,c9 as Xe,ca as Dr,cb as Fr,cc as Vr,cd as kr,ce as xt,cf as It,cg as Ue,ch as Bn,ci as Wn,cj as Tt,ck as Nr,cl as Un,cm as on,cn as $n,bC as Ae,co as st,cp as sn,c0 as nt,cq as Je,cr as $t,cs as rt,ba as ze,ct as an,cu as At,cv as zt,cw as Hr,cx as zn,cy as _r,cz as un,cA as fn,cB as qt,cC as yn,cD as Dt,cE as Yn,ar as Br,cF as Wr,b5 as Mt,b3 as K,cG as jn,cH as Ur,bB as de,cI as Rn,cJ as Jt,cK as wn,cL as Qt,bD as ot,bJ as at,cM as Ze,cN as bn,cO as $r,cP as Zt,cQ as zr,cR as Yr,cS as Kt,cT as Ot,cU as Pt,cV as jr,cW as Ft,bP as qn,cX as Kn,cY as qr,cZ as Xn,c_ as Kr,c$ as Xr,a as dt,d0 as Gr,b4 as Lt,b6 as Be,j as Me,bQ as ne,b2 as U,be as dn,b8 as cn,b7 as Gn,bb as Jr,bc as Qr,bd as pn,d1 as vn,d2 as Zr,d3 as eo,u as Jn,d4 as to,bY as no,d5 as ro,b$ as oo,d6 as so,bF as io,d7 as co,bf as Qn,d8 as en}from"./main-CgiMNMS_.js";import{c as Zn,x as lo,P as ao,b as er,d as Ke,y as uo,w as tr,u as fo,a as nr,k as po,l as go,f as mo,p as ho,z as xo,I as yo,r as Ro,v as wo}from"./useScrollLock-BaJCW9Ak.js";const bo=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],mi=Or("chevron-down",bo);function wt(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function vo(e,t={}){const{enabled:n=!0,event:r="click",toggle:o=!0,ignoreMouse:i=!1,stickIfOpen:s=!0,touchOpenDelay:c=0,reason:d=Pr}=t,f="rootStore"in e?e.rootStore:e,h=f.context.dataRef,a=l.useRef(void 0),p=Ut(),u=St(),y=l.useMemo(()=>{function x(m,b,g,R){const v=We(d,b,g);m&&R==="touch"&&c>0?u.start(c,()=>{f.setOpen(!0,v)}):f.setOpen(m,v)}function w(m,b,g){const R=h.current.openEvent,v=f.select("domReferenceElement")!==b;return m&&v||!m||!o?!0:R&&s?!g(R.type):!1}return{onPointerDown(m){a.current=m.pointerType},onMouseDown(m){const b=a.current,g=m.nativeEvent,R=f.select("open");if(m.button!==0||r==="click"||xn(b,!0)&&i)return;const v=w(R,m.currentTarget,D=>D==="click"||D==="mousedown"),T=_n(g);if(Lr(T)){x(v,g,T,b);return}const E=m.currentTarget;p.request(()=>{x(v,g,E,b)})},onClick(m){if(r==="mousedown-only")return;const b=a.current;if(r==="mousedown"&&b){a.current=void 0;return}if(xn(b,!0)&&i)return;const g=f.select("open"),R=w(g,m.currentTarget,v=>v==="click"||v==="mousedown"||v==="keydown"||v==="keyup");x(R,m.nativeEvent,m.currentTarget,b)},onKeyDown(){a.current=void 0}}},[h,r,i,d,f,s,o,p,u,c]);return l.useMemo(()=>n?{reference:y}:Et,[n,y])}function Sn(e,t,n){let{reference:r,floating:o}=e;const i=Xe(t),s=Bn(t),c=Un(s),d=$e(t),f=i==="y",h=r.x+r.width/2-o.width/2,a=r.y+r.height/2-o.height/2,p=r[c]/2-o[c]/2;let u;switch(d){case"top":u={x:h,y:r.y-o.height};break;case"bottom":u={x:h,y:r.y+r.height};break;case"right":u={x:r.x+r.width,y:a};break;case"left":u={x:r.x-o.width,y:a};break;default:u={x:r.x,y:r.y}}switch(xt(t)){case"start":u[s]-=p*(n&&f?-1:1);break;case"end":u[s]+=p*(n&&f?-1:1);break}return u}async function So(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:c,strategy:d}=e,{boundary:f="clippingAncestors",rootBoundary:h="viewport",elementContext:a="floating",altBoundary:p=!1,padding:u=0}=tt(t,e),y=Wn(u),w=c[p?a==="floating"?"reference":"floating":a],m=Tt(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(w)))==null||n?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:f,rootBoundary:h,strategy:d})),b=a==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,g=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),R=await(i.isElement==null?void 0:i.isElement(g))?await(i.getScale==null?void 0:i.getScale(g))||{x:1,y:1}:{x:1,y:1},v=Tt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:g,strategy:d}):b);return{top:(m.top-v.top+y.top)/R.y,bottom:(v.bottom-m.bottom+y.bottom)/R.y,left:(m.left-v.left+y.left)/R.x,right:(v.right-m.right+y.right)/R.x}}const Co=50,Eo=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,c=s.detectOverflow?s:{...s,detectOverflow:So},d=await(s.isRTL==null?void 0:s.isRTL(t));let f=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:h,y:a}=Sn(f,r,d),p=r,u=0;const y={};for(let x=0;x<i.length;x++){const w=i[x];if(!w)continue;const{name:m,fn:b}=w,{x:g,y:R,data:v,reset:T}=await b({x:h,y:a,initialPlacement:r,placement:p,strategy:o,middlewareData:y,rects:f,platform:c,elements:{reference:e,floating:t}});h=g??h,a=R??a,y[m]={...y[m],...v},T&&u<Co&&(u++,typeof T=="object"&&(T.placement&&(p=T.placement),T.rects&&(f=T.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):T.rects),{x:h,y:a}=Sn(f,p,d)),x=-1)}return{x:h,y:a,placement:p,strategy:o,middlewareData:y}},Io=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:c,platform:d,elements:f}=t,{mainAxis:h=!0,crossAxis:a=!0,fallbackPlacements:p,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:x=!0,...w}=tt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const m=$e(o),b=Xe(c),g=$e(c)===c,R=await(d.isRTL==null?void 0:d.isRTL(f.floating)),v=p||(g||!x?[Dr(c)]:Fr(c)),T=y!=="none";!p&&T&&v.push(...Vr(c,x,y,R));const E=[c,...v],D=await d.detectOverflow(t,w),k=[];let V=((r=i.flip)==null?void 0:r.overflows)||[];if(h&&k.push(D[m]),a){const H=kr(o,s,R);k.push(D[H[0]],D[H[1]])}if(V=[...V,{placement:o,overflows:k}],!k.every(H=>H<=0)){var $,L;const H=((($=i.flip)==null?void 0:$.index)||0)+1,B=E[H];if(B&&(!(a==="alignment"?b!==Xe(B):!1)||V.every(A=>Xe(A.placement)===b?A.overflows[0]>0:!0)))return{data:{index:H,overflows:V},reset:{placement:B}};let z=(L=V.filter(I=>I.overflows[0]<=0).sort((I,A)=>I.overflows[1]-A.overflows[1])[0])==null?void 0:L.placement;if(!z)switch(u){case"bestFit":{var N;const I=(N=V.filter(A=>{if(T){const G=Xe(A.placement);return G===b||G==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(G=>G>0).reduce((G,M)=>G+M,0)]).sort((A,G)=>A[1]-G[1])[0])==null?void 0:N[0];I&&(z=I);break}case"initialPlacement":z=c;break}if(o!==z)return{reset:{placement:z}}}return{}}}};function Cn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function En(e){return Nr.some(t=>e[t]>=0)}const To=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=tt(e,t);switch(o){case"referenceHidden":{const s=await r.detectOverflow(t,{...i,elementContext:"reference"}),c=Cn(s,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:En(c)}}}case"escaped":{const s=await r.detectOverflow(t,{...i,altBoundary:!0}),c=Cn(s,n.floating);return{data:{escapedOffsets:c,escaped:En(c)}}}default:return{}}}}},rr=new Set(["left","top"]);async function Ao(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=$e(n),c=xt(n),d=Xe(n)==="y",f=rr.has(s)?-1:1,h=i&&d?-1:1,a=tt(t,e);let{mainAxis:p,crossAxis:u,alignmentAxis:y}=typeof a=="number"?{mainAxis:a,crossAxis:0,alignmentAxis:null}:{mainAxis:a.mainAxis||0,crossAxis:a.crossAxis||0,alignmentAxis:a.alignmentAxis};return c&&typeof y=="number"&&(u=c==="end"?y*-1:y),d?{x:u*h,y:p*f}:{x:p*f,y:u*h}}const Mo=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:c}=t,d=await Ao(t,e);return s===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+d.x,y:i+d.y,data:{...d,placement:s}}}}},Oo=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:s=!0,crossAxis:c=!1,limiter:d={fn:m=>{let{x:b,y:g}=m;return{x:b,y:g}}},...f}=tt(e,t),h={x:n,y:r},a=await i.detectOverflow(t,f),p=Xe($e(o)),u=$n(p);let y=h[u],x=h[p];if(s){const m=u==="y"?"top":"left",b=u==="y"?"bottom":"right",g=y+a[m],R=y-a[b];y=on(g,y,R)}if(c){const m=p==="y"?"top":"left",b=p==="y"?"bottom":"right",g=x+a[m],R=x-a[b];x=on(g,x,R)}const w=d.fn({...t,[u]:y,[p]:x});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[u]:s,[p]:c}}}}}},Po=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:c=0,mainAxis:d=!0,crossAxis:f=!0}=tt(e,t),h={x:n,y:r},a=Xe(o),p=$n(a);let u=h[p],y=h[a];const x=tt(c,t),w=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(d){const g=p==="y"?"height":"width",R=i.reference[p]-i.floating[g]+w.mainAxis,v=i.reference[p]+i.reference[g]-w.mainAxis;u<R?u=R:u>v&&(u=v)}if(f){var m,b;const g=p==="y"?"width":"height",R=rr.has($e(o)),v=i.reference[a]-i.floating[g]+(R&&((m=s.offset)==null?void 0:m[a])||0)+(R?0:w.crossAxis),T=i.reference[a]+i.reference[g]+(R?0:((b=s.offset)==null?void 0:b[a])||0)-(R?w.crossAxis:0);y<v?y=v:y>T&&(y=T)}return{[p]:u,[a]:y}}}},Lo=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:c}=t,{apply:d=()=>{},...f}=tt(e,t),h=await s.detectOverflow(t,f),a=$e(o),p=xt(o),u=Xe(o)==="y",{width:y,height:x}=i.floating;let w,m;a==="top"||a==="bottom"?(w=a,m=p===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(m=a,w=p==="end"?"top":"bottom");const b=x-h.top-h.bottom,g=y-h.left-h.right,R=It(x-h[w],b),v=It(y-h[m],g),T=!t.middlewareData.shift;let E=R,D=v;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(D=g),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=b),T&&!p){const V=Ue(h.left,0),$=Ue(h.right,0),L=Ue(h.top,0),N=Ue(h.bottom,0);u?D=y-2*(V!==0||$!==0?V+$:Ue(h.left,h.right)):E=x-2*(L!==0||N!==0?L+N:Ue(h.top,h.bottom))}await d({...t,availableWidth:D,availableHeight:E});const k=await s.getDimensions(c.floating);return y!==k.width||x!==k.height?{reset:{rects:!0}}:{}}}};function or(e){const t=rt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=nt(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,c=$t(n)!==i||$t(r)!==s;return c&&(n=i,r=s),{width:n,height:r,$:c}}function gn(e){return Ae(e)?e:e.contextElement}function mt(e){const t=gn(e);if(!nt(t))return Je(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=or(t);let s=(i?$t(n.width):n.width)/r,c=(i?$t(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const Do=Je(0);function sr(e){const t=ze(e);return!Yn()||!t.visualViewport?Do:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Fo(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ze(e)?!1:t}function ft(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=gn(e);let s=Je(1);t&&(r?Ae(r)&&(s=mt(r)):s=mt(e));const c=Fo(i,n,r)?sr(i):Je(0);let d=(o.left+c.x)/s.x,f=(o.top+c.y)/s.y,h=o.width/s.x,a=o.height/s.y;if(i){const p=ze(i),u=r&&Ae(r)?ze(r):r;let y=p,x=yn(y);for(;x&&r&&u!==y;){const w=mt(x),m=x.getBoundingClientRect(),b=rt(x),g=m.left+(x.clientLeft+parseFloat(b.paddingLeft))*w.x,R=m.top+(x.clientTop+parseFloat(b.paddingTop))*w.y;d*=w.x,f*=w.y,h*=w.x,a*=w.y,d+=g,f+=R,y=ze(x),x=yn(y)}}return Tt({width:h,height:a,x:d,y:f})}function Xt(e,t){const n=qt(e).scrollLeft;return t?t.left+n:ft(st(e)).left+n}function ir(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Xt(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Vo(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=st(r),c=t?an(t.floating):!1;if(r===s||c&&i)return n;let d={scrollLeft:0,scrollTop:0},f=Je(1);const h=Je(0),a=nt(r);if((a||!a&&!i)&&((un(r)!=="body"||fn(s))&&(d=qt(r)),a)){const u=ft(r);f=mt(r),h.x=u.x+r.clientLeft,h.y=u.y+r.clientTop}const p=s&&!a&&!i?ir(s,d):Je(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-d.scrollLeft*f.x+h.x+p.x,y:n.y*f.y-d.scrollTop*f.y+h.y+p.y}}function ko(e){return Array.from(e.getClientRects())}function No(e){const t=st(e),n=qt(e),r=e.ownerDocument.body,o=Ue(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Ue(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Xt(e);const c=-n.scrollTop;return rt(r).direction==="rtl"&&(s+=Ue(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:c}}const In=25;function Ho(e,t){const n=ze(e),r=st(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,c=0,d=0;if(o){i=o.width,s=o.height;const h=Yn();(!h||h&&t==="fixed")&&(c=o.offsetLeft,d=o.offsetTop)}const f=Xt(r);if(f<=0){const h=r.ownerDocument,a=h.body,p=getComputedStyle(a),u=h.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,y=Math.abs(r.clientWidth-a.clientWidth-u);y<=In&&(i-=y)}else f<=In&&(i+=f);return{width:i,height:s,x:c,y:d}}function _o(e,t){const n=ft(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=nt(e)?mt(e):Je(1),s=e.clientWidth*i.x,c=e.clientHeight*i.y,d=o*i.x,f=r*i.y;return{width:s,height:c,x:d,y:f}}function Tn(e,t,n){let r;if(t==="viewport")r=Ho(e,n);else if(t==="document")r=No(st(e));else if(Ae(t))r=_o(t,n);else{const o=sr(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Tt(r)}function cr(e,t){const n=At(e);return n===t||!Ae(n)||zt(n)?!1:rt(n).position==="fixed"||cr(n,t)}function Bo(e,t){const n=t.get(e);if(n)return n;let r=sn(e,[],!1).filter(c=>Ae(c)&&un(c)!=="body"),o=null;const i=rt(e).position==="fixed";let s=i?At(e):e;for(;Ae(s)&&!zt(s);){const c=rt(s),d=zn(s);!d&&c.position==="fixed"&&(o=null),(i?!d&&!o:!d&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||fn(s)&&!d&&cr(e,s))?r=r.filter(h=>h!==s):o=c,s=At(s)}return t.set(e,r),r}function Wo(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?an(t)?[]:Bo(t,this._c):[].concat(n),r],c=Tn(t,s[0],o);let d=c.top,f=c.right,h=c.bottom,a=c.left;for(let p=1;p<s.length;p++){const u=Tn(t,s[p],o);d=Ue(u.top,d),f=It(u.right,f),h=It(u.bottom,h),a=Ue(u.left,a)}return{width:f-a,height:h-d,x:a,y:d}}function Uo(e){const{width:t,height:n}=or(e);return{width:t,height:n}}function $o(e,t,n){const r=nt(t),o=st(t),i=n==="fixed",s=ft(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const d=Je(0);function f(){d.x=Xt(o)}if(r||!r&&!i)if((un(t)!=="body"||fn(o))&&(c=qt(t)),r){const u=ft(t,!0,i,t);d.x=u.x+t.clientLeft,d.y=u.y+t.clientTop}else o&&f();i&&!r&&o&&f();const h=o&&!r&&!i?ir(o,c):Je(0),a=s.left+c.scrollLeft-d.x-h.x,p=s.top+c.scrollTop-d.y-h.y;return{x:a,y:p,width:s.width,height:s.height}}function tn(e){return rt(e).position==="static"}function An(e,t){if(!nt(e)||rt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return st(e)===n&&(n=n.ownerDocument.body),n}function lr(e,t){const n=ze(e);if(an(e))return n;if(!nt(e)){let o=At(e);for(;o&&!zt(o);){if(Ae(o)&&!tn(o))return o;o=At(o)}return n}let r=An(e,t);for(;r&&Hr(r)&&tn(r);)r=An(r,t);return r&&zt(r)&&tn(r)&&!zn(r)?n:r||_r(e)||n}const zo=async function(e){const t=this.getOffsetParent||lr,n=this.getDimensions,r=await n(e.floating);return{reference:$o(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Yo(e){return rt(e).direction==="rtl"}const ar={convertOffsetParentRelativeRectToViewportRelativeRect:Vo,getDocumentElement:st,getClippingRect:Wo,getOffsetParent:lr,getElementRects:zo,getClientRects:ko,getDimensions:Uo,getScale:mt,isElement:Ae,isRTL:Yo};function ur(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function jo(e,t){let n=null,r;const o=st(e);function i(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function s(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),i();const f=e.getBoundingClientRect(),{left:h,top:a,width:p,height:u}=f;if(c||t(),!p||!u)return;const y=Dt(a),x=Dt(o.clientWidth-(h+p)),w=Dt(o.clientHeight-(a+u)),m=Dt(h),g={rootMargin:-y+"px "+-x+"px "+-w+"px "+-m+"px",threshold:Ue(0,It(1,d))||1};let R=!0;function v(T){const E=T[0].intersectionRatio;if(E!==d){if(!R)return s();E?s(!1,E):r=setTimeout(()=>{s(!1,1e-7)},1e3)}E===1&&!ur(f,e.getBoundingClientRect())&&s(),R=!1}try{n=new IntersectionObserver(v,{...g,root:o.ownerDocument})}catch{n=new IntersectionObserver(v,g)}n.observe(e)}return s(!0),i}function Mn(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,f=gn(e),h=o||i?[...f?sn(f):[],...t?sn(t):[]]:[];h.forEach(m=>{o&&m.addEventListener("scroll",n,{passive:!0}),i&&m.addEventListener("resize",n)});const a=f&&c?jo(f,n):null;let p=-1,u=null;s&&(u=new ResizeObserver(m=>{let[b]=m;b&&b.target===f&&u&&t&&(u.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var g;(g=u)==null||g.observe(t)})),n()}),f&&!d&&u.observe(f),t&&u.observe(t));let y,x=d?ft(e):null;d&&w();function w(){const m=ft(e);x&&!ur(x,m)&&n(),x=m,y=requestAnimationFrame(w)}return n(),()=>{var m;h.forEach(b=>{o&&b.removeEventListener("scroll",n),i&&b.removeEventListener("resize",n)}),a?.(),(m=u)==null||m.disconnect(),u=null,d&&cancelAnimationFrame(y)}}const qo=Mo,Ko=Oo,Xo=Io,Go=Lo,Jo=To,Qo=Po,Zo=(e,t,n)=>{const r=new Map,o={platform:ar,...n},i={...o.platform,_c:r};return Eo(e,t,{...o,platform:i})};var es=typeof document<"u",ts=function(){},Bt=es?l.useLayoutEffect:ts;function Yt(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(!Yt(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 i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Yt(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function fr(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function On(e,t){const n=fr(e);return Math.round(t*n)/n}function nn(e){const t=l.useRef(e);return Bt(()=>{t.current=e}),t}function ns(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:c=!0,whileElementsMounted:d,open:f}=e,[h,a]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,u]=l.useState(r);Yt(p,r)||u(r);const[y,x]=l.useState(null),[w,m]=l.useState(null),b=l.useCallback(A=>{A!==T.current&&(T.current=A,x(A))},[]),g=l.useCallback(A=>{A!==E.current&&(E.current=A,m(A))},[]),R=i||y,v=s||w,T=l.useRef(null),E=l.useRef(null),D=l.useRef(h),k=d!=null,V=nn(d),$=nn(o),L=nn(f),N=l.useCallback(()=>{if(!T.current||!E.current)return;const A={placement:t,strategy:n,middleware:p};$.current&&(A.platform=$.current),Zo(T.current,E.current,A).then(G=>{const M={...G,isPositioned:L.current!==!1};H.current&&!Yt(D.current,M)&&(D.current=M,Br.flushSync(()=>{a(M)}))})},[p,t,n,$,L]);Bt(()=>{f===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,a(A=>({...A,isPositioned:!1})))},[f]);const H=l.useRef(!1);Bt(()=>(H.current=!0,()=>{H.current=!1}),[]),Bt(()=>{if(R&&(T.current=R),v&&(E.current=v),R&&v){if(V.current)return V.current(R,v,N);N()}},[R,v,N,V,k]);const B=l.useMemo(()=>({reference:T,floating:E,setReference:b,setFloating:g}),[b,g]),z=l.useMemo(()=>({reference:R,floating:v}),[R,v]),I=l.useMemo(()=>{const A={position:n,left:0,top:0};if(!z.floating)return A;const G=On(z.floating,h.x),M=On(z.floating,h.y);return c?{...A,transform:"translate("+G+"px, "+M+"px)",...fr(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:G,top:M}},[n,c,z.floating,h.x,h.y]);return l.useMemo(()=>({...h,update:N,refs:B,elements:z,floatingStyles:I}),[h,N,B,z,I])}const rs=(e,t)=>{const n=qo(e);return{name:n.name,fn:n.fn,options:[e,t]}},os=(e,t)=>{const n=Ko(e);return{name:n.name,fn:n.fn,options:[e,t]}},ss=(e,t)=>({fn:Qo(e).fn,options:[e,t]}),is=(e,t)=>{const n=Xo(e);return{name:n.name,fn:n.fn,options:[e,t]}},cs=(e,t)=>{const n=Go(e);return{name:n.name,fn:n.fn,options:[e,t]}},ls=(e,t)=>{const n=Jo(e);return{name:n.name,fn:n.fn,options:[e,t]}};function dr(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Wr(),i=Zn()!=null,s=Mt(()=>new lo({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new ao,floatingId:o,syncOnly:!1,nested:i})).current;return K(()=>{const c={open:t,floatingId:o};r.reference!==void 0&&(c.referenceElement=r.reference,c.domReferenceElement=Ae(r.reference)?r.reference:null),r.floating!==void 0&&(c.floatingElement=r.floating),s.update(c)},[t,o,r.reference,r.floating,s]),s.context.onOpenChange=n,s.context.nested=i,s}function as(e={}){const{nodeId:t,externalTree:n}=e,r=dr(e),o=e.rootContext||r,i=o.useState("referenceElement"),s=o.useState("floatingElement"),c=o.useState("domReferenceElement"),d=o.useState("open"),f=o.useState("floatingId"),[h,a]=l.useState(null),[p,u]=l.useState(void 0),[y,x]=l.useState(void 0),w=l.useRef(null),m=er(n),b=l.useMemo(()=>({reference:i,floating:s,domReference:c}),[i,s,c]),g=ns({...e,elements:{...b,...h&&{reference:h}}}),R=Ae(p)?p:null,v=y===void 0?o.state.floatingElement:y;o.useSyncedValue("referenceElement",p??null),o.useSyncedValue("domReferenceElement",p===void 0?c:R),o.useSyncedValue("floatingElement",v);const T=l.useCallback(L=>{const N=Ae(L)?{getBoundingClientRect:()=>L.getBoundingClientRect(),getClientRects:()=>L.getClientRects(),contextElement:L}:L;a(N),g.refs.setReference(N)},[g.refs]),E=l.useCallback(L=>{(Ae(L)||L===null)&&(w.current=L,u(L)),(Ae(g.refs.reference.current)||g.refs.reference.current===null||L!==null&&!Ae(L))&&g.refs.setReference(L)},[g.refs,u]),D=l.useCallback(L=>{x(L),g.refs.setFloating(L)},[g.refs]),k=l.useMemo(()=>({...g.refs,setReference:E,setFloating:D,setPositionReference:T,domReference:w}),[g.refs,E,D,T]),V=l.useMemo(()=>({...g.elements,domReference:c}),[g.elements,c]),$=l.useMemo(()=>({...g,dataRef:o.context.dataRef,open:d,onOpenChange:o.setOpen,events:o.context.events,floatingId:f,refs:k,elements:V,nodeId:t,rootStore:o}),[g,k,V,t,o,d,f]);return K(()=>{c&&(w.current=c)},[c]),K(()=>{o.context.dataRef.current.floatingContext=$;const L=m?.nodesRef.current.find(N=>N.id===t);L&&(L.context=$)}),l.useMemo(()=>({...g,context:$,refs:k,elements:V,rootStore:o}),[g,k,V,$,o])}const us="Escape";function Gt(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Vt(e,t){return Gt(t,e===Xn||e===Kt,e===Ot||e===Pt)}function rn(e,t,n){return Gt(t,e===Kt,n?e===Ot:e===Pt)||e==="Enter"||e===" "||e===""}function fs(e,t,n){return Gt(t,n?e===Ot:e===Pt,e===Kt)}function ds(e,t,n,r){const o=n?e===Pt:e===Ot,i=e===Xn;return t==="both"||t==="horizontal"&&r&&r>1?e===us:Gt(t,o,i)}function ps(e,t){const{listRef:n,activeIndex:r,onNavigate:o=()=>{},enabled:i=!0,selectedIndex:s=null,allowEscape:c=!1,loopFocus:d=!1,nested:f=!1,rtl:h=!1,virtual:a=!1,focusItemOnOpen:p="auto",focusItemOnHover:u=!0,openOnArrowKeyDown:y=!0,disabledIndices:x=void 0,orientation:w="vertical",parentOrientation:m,cols:b=1,id:g,resetOnPointerLeave:R=!0,externalTree:v}=t,T="rootStore"in e?e.rootStore:e,E=T.useState("open"),D=T.useState("floatingElement"),k=T.useState("domReferenceElement"),V=T.context.dataRef,$=jn(D),L=Ur(k),N=Ke($),H=Zn(),B=er(v),z=l.useRef(p),I=l.useRef(s??-1),A=l.useRef(null),G=l.useRef(!0),M=de(P=>{o(I.current===-1?null:I.current,P)}),Z=l.useRef(M),re=l.useRef(!!D),S=l.useRef(E),O=l.useRef(!1),_=l.useRef(!1),ce=l.useRef(null),ee=Ke(x),le=Ke(E),pe=Ke(s),Le=Ke(R),Ne=Ut(),Ce=Ut(),Y=de(()=>{function P(j){a?B?.events.emit("virtualfocus",j):ce.current=uo(j,{sync:O.current,preventScroll:!0})}const C=n.current[I.current],X=_.current;C&&P(C),(O.current?j=>j():j=>Ne.request(j))(()=>{const j=n.current[I.current]||C;if(!j)return;C||P(j),ue&&(X||!G.current)&&j.scrollIntoView?.({block:"nearest",inline:"nearest"})})});K(()=>{V.current.orientation=w},[V,w]),K(()=>{i&&(E&&D?(I.current=s??-1,z.current&&s!=null&&(_.current=!0,M())):re.current&&(I.current=-1,Z.current()))},[i,E,D,s,M]),K(()=>{if(i){if(!E){O.current=!1;return}if(D)if(r==null){if(O.current=!1,pe.current!=null)return;if(re.current&&(I.current=-1,Y()),(!S.current||!re.current)&&z.current&&(A.current!=null||z.current===!0&&A.current==null)){let P=0;const C=()=>{n.current[0]==null?(P<2&&(P?F=>Ce.request(F):queueMicrotask)(C),P+=1):(I.current=A.current==null||rn(A.current,w,h)||f?Jt(n):wn(n),A.current=null,M())};C()}}else Rn(n.current,r)||(I.current=r,Y(),_.current=!1)}},[i,E,D,r,pe,f,n,w,h,M,Y,Ce]),K(()=>{if(!i||D||!B||a||!re.current)return;const P=B.nodesRef.current,C=P.find(j=>j.id===H)?.context?.elements.floating,X=Qt(ot(D)),F=P.some(j=>j.context&&at(j.context.elements.floating,X));C&&!F&&G.current&&C.focus({preventScroll:!0})},[i,D,B,H,a]),K(()=>{Z.current=M,S.current=E,re.current=!!D}),K(()=>{E||(A.current=null,z.current=p)},[E,p]);const oe=r!=null,xe=de(P=>{if(!le.current)return;const C=n.current.indexOf(P.currentTarget);C!==-1&&(I.current!==C||r!==C)&&(I.current=C,M(P))}),Ee=de(()=>m??B?.nodesRef.current.find(P=>P.id===H)?.context?.dataRef?.current.orientation),J=de(()=>Jt(n,ee.current)),ae=de(P=>{if(G.current=!1,O.current=!0,P.which===229||!le.current&&P.currentTarget===N.current)return;if(f&&ds(P.key,w,h,b)){Vt(P.key,Ee())||Ze(P),T.setOpen(!1,We(bn,P.nativeEvent)),nt(k)&&(a?B?.events.emit("virtualfocus",k):k.focus());return}const C=I.current,X=Jt(n,x),F=wn(n,x);if(L||(P.key==="Home"&&(Ze(P),I.current=X,M(P)),P.key==="End"&&(Ze(P),I.current=F,M(P))),b>1){const j=Array.from({length:n.current.length},()=>({width:1,height:1})),me=$r(j,b),Te=me.findIndex(he=>he!=null&&!Zt(n.current,he,x)),De=me.reduce((he,ye,Se)=>ye!=null&&!Zt(n.current,ye,x)?Se:he,-1),ve=me[zr(me.map(he=>he!=null?n.current[he]:null),{event:P,orientation:w,loopFocus:d,rtl:h,cols:b,disabledIndices:jr([...(typeof x!="function"?x:null)||n.current.map((he,ye)=>Zt(n.current,ye,x)?ye:void 0),void 0],me),minIndex:Te,maxIndex:De,prevIndex:Yr(I.current>F?X:I.current,j,me,b,P.key===Kt?"bl":P.key===(h?Ot:Pt)?"tr":"tl"),stopEvent:!0})];if(ve!=null&&(I.current=ve,M(P)),w==="both")return}if(Vt(P.key,w)){if(Ze(P),E&&!a&&Qt(P.currentTarget.ownerDocument)===P.currentTarget){I.current=rn(P.key,w,h)?X:F,M(P);return}rn(P.key,w,h)?d?C>=F?c&&C!==n.current.length?I.current=-1:(O.current=!1,I.current=X):I.current=Ft(n.current,{startingIndex:C,disabledIndices:x}):I.current=Math.min(F,Ft(n.current,{startingIndex:C,disabledIndices:x})):d?C<=X?c&&C!==-1?I.current=n.current.length:(O.current=!1,I.current=F):I.current=Ft(n.current,{startingIndex:C,decrement:!0,disabledIndices:x}):I.current=Math.max(X,Ft(n.current,{startingIndex:C,decrement:!0,disabledIndices:x})),Rn(n.current,I.current)&&(I.current=-1),M(P)}}),ue=l.useMemo(()=>({onFocus(C){O.current=!0,xe(C)},onClick:({currentTarget:C})=>C.focus({preventScroll:!0}),onMouseMove(C){O.current=!0,_.current=!1,u&&xe(C)},onPointerLeave(C){if(!le.current||!G.current||C.pointerType==="touch")return;O.current=!0;const X=C.relatedTarget;if(!(!u||n.current.includes(X))&&Le.current&&(ce.current?.(),ce.current=null,I.current=-1,M(C),!a)){const F=N.current,j=Qt(ot(F));F&&at(F,j)&&F.focus({preventScroll:!0})}}}),[xe,le,N,u,n,M,Le,a]),Re=l.useMemo(()=>a&&E&&oe&&{"aria-activedescendant":`${g}-${r}`},[a,E,oe,g,r]),ge=l.useMemo(()=>({"aria-orientation":w==="both"?void 0:w,...L?{}:Re,onKeyDown(P){if(P.key==="Tab"&&P.shiftKey&&E&&!a){const C=_n(P.nativeEvent);if(C&&!at(N.current,C))return;Ze(P),T.setOpen(!1,We(qn,P.nativeEvent)),nt(k)&&k.focus();return}ae(P)},onPointerMove(){G.current=!0}}),[Re,ae,N,w,L,T,E,a,k]),te=l.useMemo(()=>{function P(F){T.setOpen(!0,We(bn,F.nativeEvent,F.currentTarget))}function C(F){p==="auto"&&Kn(F.nativeEvent)&&(z.current=!a)}function X(F){z.current=p,p==="auto"&&qr(F.nativeEvent)&&(z.current=!0)}return{onKeyDown(F){const j=T.select("open");G.current=!1;const me=F.key.startsWith("Arrow"),Te=fs(F.key,Ee(),h),De=Vt(F.key,w),ve=(f?Te:De)||F.key==="Enter"||F.key.trim()==="";if(a&&j)return ae(F);if(!(!j&&!y&&me)){if(ve){const he=Vt(F.key,Ee());A.current=f&&he?null:F.key}if(f){Te&&(Ze(F),j?(I.current=J(),M(F)):P(F));return}De&&(pe.current!=null&&(I.current=pe.current),Ze(F),!j&&y?P(F):ae(F),j&&M(F))}},onFocus(F){T.select("open")&&!a&&(I.current=-1,M(F))},onPointerDown:X,onPointerEnter:X,onMouseDown:C,onClick:C}},[ae,p,J,f,M,T,y,w,Ee,h,pe,a]),se=l.useMemo(()=>({...Re,...te}),[Re,te]);return l.useMemo(()=>i?{reference:se,floating:ge,item:ue,trigger:te}:{},[i,se,ge,te,ue])}function gs(e,t){const{listRef:n,elementsRef:r,activeIndex:o,onMatch:i,onTyping:s,enabled:c=!0,resetMs:d=750,selectedIndex:f=null}=t,h="rootStore"in e?e.rootStore:e,a=h.useState("open"),p=St(),u=l.useRef(""),y=l.useRef(f??o??-1),x=l.useRef(null),w=de(g=>{function R(L){const N=r?.current[L];return!N||Kr(N)}function v(L,N,H=0){if(L.length===0)return-1;const B=(H%L.length+L.length)%L.length,z=N.toLocaleLowerCase();for(let I=0;I<L.length;I+=1){const A=(B+I)%L.length;if(!(!L[A]?.toLocaleLowerCase().startsWith(z)||!R(A)))return A}return-1}const T=n.current;if(u.current.length>0&&g.key===" "&&(Ze(g),s?.(!0)),u.current.length>0&&u.current[0]!==" "&&v(T,u.current)===-1&&g.key!==" "&&s?.(!1),T==null||g.key.length!==1||g.ctrlKey||g.metaKey||g.altKey)return;a&&g.key!==" "&&(Ze(g),s?.(!0));const E=u.current==="";E&&(y.current=f??o??-1),T.every(L=>L?L[0]?.toLocaleLowerCase()!==L[1]?.toLocaleLowerCase():!0)&&u.current===g.key&&(u.current="",y.current=x.current),u.current+=g.key,p.start(d,()=>{u.current="",y.current=x.current,s?.(!1)});const V=((E?f??o??-1:y.current)??0)+1,$=v(T,u.current,V);$!==-1?(i?.($),x.current=$):g.key!==" "&&(u.current="",s?.(!1))}),m=de(g=>{const R=g.relatedTarget,v=h.select("domReferenceElement"),T=h.select("floatingElement");at(v,R)||at(T,R)||(p.clear(),u.current="",y.current=x.current,s?.(!1))});K(()=>{!a&&f!==null||(p.clear(),x.current=null,u.current!==""&&(u.current=""))},[a,f,p]),K(()=>{a&&u.current===""&&(y.current=f??o??-1)},[a,f,o]);const b=l.useMemo(()=>({onKeyDown:w,onBlur:m}),[w,m]);return l.useMemo(()=>c?{reference:b,floating:b}:{},[c,b])}const ms=l.createContext(void 0);function pr(){return l.useContext(ms)?.direction??"ltr"}const hs=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:c,middlewareData:d}=t,{element:f,padding:h=0,offsetParent:a="real"}=tt(e,t)||{};if(f==null)return{};const p=Wn(h),u={x:n,y:r},y=Bn(o),x=Un(y),w=await s.getDimensions(f),m=y==="y",b=m?"top":"left",g=m?"bottom":"right",R=m?"clientHeight":"clientWidth",v=i.reference[x]+i.reference[y]-u[y]-i.floating[x],T=u[y]-i.reference[y],E=a==="real"?await s.getOffsetParent?.(f):c.floating;let D=c.floating[R]||i.floating[x];(!D||!await s.isElement?.(E))&&(D=c.floating[R]||i.floating[x]);const k=v/2-T/2,V=D/2-w[x]/2-1,$=Math.min(p[b],V),L=Math.min(p[g],V),N=$,H=D-w[x]-L,B=D/2-w[x]/2+k,z=on(N,B,H),I=!d.arrow&&xt(o)!=null&&B!==z&&i.reference[x]/2-(B<N?$:L)-w[x]/2<0,A=I?B<N?B-N:B-H:0;return{[y]:u[y]+A,data:{[y]:z,centerOffset:B-z-A,...I&&{alignmentOffset:A}},reset:I}}}),xs=(e,t)=>({...hs(e),options:[e,t]}),ys={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,i=t===0&&n===0&&r===0&&o===0;return{data:{referenceHidden:(await ls().fn(e)).data?.referenceHidden||i}}}},Wt={sideX:"left",sideY:"top"},hi={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:o},platform:i,strategy:s,placement:c}=e,d=ze(o),f=d.getComputedStyle(o);if(!(f.transitionDuration!=="0s"&&f.transitionDuration!==""))return{x:t,y:n,data:Wt};const a=await i.getOffsetParent?.(o);let p={width:0,height:0};if(s==="fixed"&&d?.visualViewport)p={width:d.visualViewport.width,height:d.visualViewport.height};else if(a===d){const b=ot(o);p={width:b.documentElement.clientWidth,height:b.documentElement.clientHeight}}else await i.isElement?.(a)&&(p=await i.getDimensions(a));const u=$e(c);let y=t,x=n;u==="left"&&(y=p.width-(t+r.width)),u==="top"&&(x=p.height-(n+r.height));const w=u==="left"?"right":Wt.sideX,m=u==="top"?"bottom":Wt.sideY;return{x:y,y:x,data:{sideX:w,sideY:m}}}};function gr(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function Pn(e,t,n){const{rects:r,placement:o}=e;return{side:gr(t,$e(o),n),align:xt(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Rs(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,collisionBoundary:c,collisionPadding:d=5,sticky:f=!1,arrowPadding:h=5,disableAnchorTracking:a=!1,inline:p,keepMounted:u=!1,floatingRootContext:y,mounted:x,collisionAvoidance:w,shiftCrossAxis:m=!1,nodeId:b,adaptiveOrigin:g,lazyFlip:R=!1,externalTree:v}=e,[T,E]=l.useState(null);!x&&T!==null&&E(null);const D=w.side||"flip",k=w.align||"flip",V=w.fallbackAxisSide||"end",$=typeof t=="function"?t:void 0,L=de($),N=$?L:t,H=Ke(t),B=Ke(x),I=pr()==="rtl",A=T||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":I?"left":"right","inline-start":I?"right":"left"}[r],G=i==="center"?A:`${A}-${i}`;let M=d;const Z=1,re=r==="bottom"?Z:0,S=r==="top"?Z:0,O=r==="right"?Z:0,_=r==="left"?Z:0;typeof M=="number"?M={top:M+re,right:M+_,bottom:M+S,left:M+O}:M&&(M={top:(M.top||0)+re,right:(M.right||0)+_,bottom:(M.bottom||0)+S,left:(M.left||0)+O});const ce={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:M},ee=l.useRef(null),le=Ke(o),pe=Ke(s),Le=typeof o!="function"?o:0,Ne=typeof s!="function"?s:0,Ce=[];p&&Ce.push(p),Ce.push(rs(Q=>{const we=Pn(Q,r,I),Ie=typeof le.current=="function"?le.current(we):le.current,ie=typeof pe.current=="function"?pe.current(we):pe.current;return{mainAxis:Ie,crossAxis:ie,alignmentAxis:ie}},[Le,Ne,I,r]));const Y=k==="none"&&D!=="shift",oe=!Y&&(f||m||D==="shift"),xe=D==="none"?null:is({...ce,padding:{top:M.top+Z,right:M.right+Z,bottom:M.bottom+Z,left:M.left+Z},mainAxis:!m&&D==="flip",crossAxis:k==="flip"?"alignment":!1,fallbackAxisSideDirection:V}),Ee=Y?null:os(Q=>{const we=ot(Q.elements.floating).documentElement;return{...ce,rootBoundary:m?{x:0,y:0,width:we.clientWidth,height:we.clientHeight}:void 0,mainAxis:k!=="none",crossAxis:oe,limiter:f||m?void 0:ss(Ie=>{if(!ee.current)return{};const{width:ie,height:Fe}=ee.current.getBoundingClientRect(),be=Xe($e(Ie.placement)),Pe=be==="y"?ie:Fe,Ve=be==="y"?M.left+M.right:M.top+M.bottom;return{offset:Pe/2+Ve/2}})}},[ce,f,m,M,k]);D==="shift"||k==="shift"||i==="center"?Ce.push(Ee,xe):Ce.push(xe,Ee),Ce.push(cs({...ce,apply({elements:{floating:Q},availableWidth:we,availableHeight:Ie,rects:ie}){if(!B.current)return;const Fe=Q.style;Fe.setProperty("--available-width",`${we}px`),Fe.setProperty("--available-height",`${Ie}px`);const be=ze(Q).devicePixelRatio||1,{x:Pe,y:Ve,width:je,height:Qe}=ie.reference,ct=(Math.round((Pe+je)*be)-Math.round(Pe*be))/be,ut=(Math.round((Ve+Qe)*be)-Math.round(Ve*be))/be;Fe.setProperty("--anchor-width",`${ct}px`),Fe.setProperty("--anchor-height",`${ut}px`)}}),xs(Q=>({element:ee.current||ot(Q.elements.floating).createElement("div"),padding:h,offsetParent:"floating"}),[h]),{name:"transformOrigin",fn(Q){const{elements:we,middlewareData:Ie,placement:ie,rects:Fe,y:be}=Q,Pe=$e(ie),Ve=Xe(Pe),je=ee.current,Qe=Ie.arrow?.x||0,ct=Ie.arrow?.y||0,ut=je?.clientWidth||0,He=je?.clientHeight||0,Ge=Qe+ut/2,lt=ct+He/2,yt=Math.abs(Ie.shift?.y||0),q=Fe.reference.height/2,fe=typeof o=="function"?o(Pn(Q,r,I)):o,ke=yt>fe,_e={top:`${Ge}px calc(100% + ${fe}px)`,bottom:`${Ge}px ${-fe}px`,left:`calc(100% + ${fe}px) ${lt}px`,right:`${-fe}px ${lt}px`}[Pe],qe=`${Ge}px ${Fe.reference.y+q-be}px`;return we.floating.style.setProperty("--transform-origin",oe&&Ve==="y"&&ke?qe:_e),{}}},ys,g),K(()=>{!x&&y&&y.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[x,y]);const J=l.useMemo(()=>({elementResize:!a&&typeof ResizeObserver<"u",layoutShift:!a&&typeof IntersectionObserver<"u"}),[a]),{refs:ae,elements:ue,x:Re,y:ge,middlewareData:te,update:se,placement:P,context:C,isPositioned:X,floatingStyles:F}=as({rootContext:y,open:u?x:void 0,placement:G,middleware:Ce,strategy:n,whileElementsMounted:u?void 0:(...Q)=>Mn(...Q,J),nodeId:b,externalTree:v}),{sideX:j,sideY:me}=te.adaptiveOrigin||Wt,Te=X?n:"fixed",De=l.useMemo(()=>{const Q=g?{position:Te,[j]:Re,[me]:ge}:{position:Te,...F};return X||(Q.opacity=0),Q},[g,Te,j,Re,me,ge,F,X]),ve=l.useRef(null);K(()=>{if(!x)return;const Q=H.current,we=typeof Q=="function"?Q():Q,ie=(Ln(we)?we.current:we)||null||null;ie!==ve.current&&(ae.setPositionReference(ie),ve.current=ie)},[x,ae,N,H]),l.useEffect(()=>{if(!x)return;const Q=H.current;typeof Q!="function"&&Ln(Q)&&Q.current!==ve.current&&(ae.setPositionReference(Q.current),ve.current=Q.current)},[x,ae,N,H]),l.useEffect(()=>{if(u&&x&&ue.domReference&&ue.floating)return Mn(ue.domReference,ue.floating,se,J)},[u,x,ue,se,J]);const he=$e(P),ye=gr(r,he,I),Se=xt(P)||"center",Ye=!!te.hide?.referenceHidden;K(()=>{R&&x&&X&&E(he)},[R,x,X,he]);const it=l.useMemo(()=>({position:"absolute",top:te.arrow?.y,left:te.arrow?.x}),[te.arrow]),Oe=te.arrow?.centerOffset!==0;return l.useMemo(()=>({positionerStyles:De,arrowStyles:it,arrowRef:ee,arrowUncentered:Oe,side:ye,align:Se,physicalSide:he,anchorHidden:Ye,refs:ae,context:C,isPositioned:X,update:se}),[De,it,ee,Oe,ye,Se,he,Ye,ae,C,X,se])}function Ln(e){return e!=null&&"current"in e}function mr(e){return e==="starting"?Xr:Et}function ws(e,t,{styles:n,transitionStatus:r,props:o,refs:i,hidden:s,inert:c=!1}){const d={...n};return c&&(d.pointerEvents="none"),dt("div",e,{state:t,ref:i,props:[{role:"presentation",hidden:s,style:d},mr(r),o],stateAttributesMapping:tr})}function bs(e){const t=l.useRef(""),n=l.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:l.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o?e(o,o.pointerType):e(o,t.current),t.current=""},[e]),onPointerDown:n}}function hr(e,t){const n=l.useRef(e),r=de(t);K(()=>{n.current!==e&&r(n.current)},[e,r]),K(()=>{n.current=e},[e])}function vs(e,t){const n=de((i,s)=>{(typeof e=="function"?e():e)||t(s||(Gr?"touch":""))}),{onClick:r,onPointerDown:o}=bs(n);return l.useMemo(()=>({onClick:r,onPointerDown:o}),[r,o])}function Ss(e){const[t,n]=l.useState(null),r=vs(e,n);return hr(e,o=>{o&&!e&&n(null)}),l.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function Cs(e){const[t,n]=l.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function Dn({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=l.useRef(e!==void 0),[i,s]=l.useState(t),c=o?e:i,d=l.useCallback(f=>{o||s(f)},[]);return[c,d]}const xr=l.createContext(null),yr=l.createContext(null);function pt(){const e=l.useContext(xr);if(e===null)throw new Error(Lt(60));return e}function Rr(){const e=l.useContext(yr);if(e===null)throw new Error(Lt(61));return e}let Fn=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Es={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},bt={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Is={disabled:!1,...bt},Ts={valid(e){return e===null?null:e?{[Fn.valid]:""}:{[Fn.invalid]:""}}},As={invalid:void 0,name:void 0,validityData:{state:Es,errors:[],error:"",value:"",initialValue:null},setValidityData:Be,disabled:void 0,touched:bt.touched,setTouched:Be,dirty:bt.dirty,setDirty:Be,filled:bt.filled,setFilled:Be,focused:bt.focused,setFocused:Be,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:Is,markedDirtyRef:{current:!1},registerFieldControl:Be,validation:{getValidationProps:(e=Et)=>e,getInputValidationProps:(e=Et)=>e,inputRef:{current:null},commit:async()=>{}}},Ms=l.createContext(As);function mn(e=!0){const t=l.useContext(Ms);if(t.setValidityData===Be&&!e)throw new Error(Lt(28));return t}function Os(e,t,n,r,o=!0){const{registerFieldControl:i}=mn(),s=l.useRef(null);s.current||(s.current=Symbol()),K(()=>{const c=s.current;return!c||!o?void 0:(i(c,{controlRef:e,getValue:r,id:t,value:n}),()=>{i(c,void 0)})},[e,o,r,t,i,n])}const Ps=l.createContext({controlId:void 0,registerControlId:Be,labelId:void 0,setLabelId:Be,messageIds:[],setMessageIds:Be,getDescriptionProps:e=>e});function wr(){return l.useContext(Ps)}function br(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:o,registerControlId:i}=wr(),s=fo(t),c=n?o:void 0,d=Mt(()=>Symbol("labelable-control")),f=l.useRef(!1),h=l.useRef(t!=null),a=de(()=>{!f.current||i===Be||(f.current=!1,i(d.current,void 0))});return K(()=>{if(i===Be)return;let p;if(n){const u=r?.current;Ae(u)&&u.closest("label")!=null?p=t??null:p=c??s}else if(t!=null)h.current=!0,p=t;else if(h.current)p=s;else{a();return}if(p===void 0){a();return}f.current=!0,i(d.current,p)},[t,r,c,i,n,s,d,a]),l.useEffect(()=>a,[a]),o??s}const Ls=(e,t)=>Object.is(e,t);function ht(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Ds(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:ht(t,r,n))}function Ct(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:ht(r,t,n))}function Fs(e,t,n){return e.filter(r=>!ht(t,r,n))}function ln(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function vr(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Vs(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(vr(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function Sr(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return ln(e)}function gt(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?ln(e.value):ln(e)}function Cr(e,t,n){function r(){return Sr(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){const o=t,i=vr(o)?o.flatMap(s=>s.items):o;if(e==null||typeof e!="object"){const s=i.find(c=>c.value===e);return s&&s.label!=null?s.label:r()}if("value"in e){const s=i.find(c=>c&&c.value===e.value);if(s&&s.label!=null)return s.label}}return r()}function ks(e,t,n){return e.reduce((r,o,i)=>(i>0&&r.push(", "),r.push(Me.jsx(l.Fragment,{children:Cr(o,t,n)},i)),r),[])}const W={id:ne(e=>e.id),labelId:ne(e=>e.labelId),modal:ne(e=>e.modal),multiple:ne(e=>e.multiple),items:ne(e=>e.items),itemToStringLabel:ne(e=>e.itemToStringLabel),itemToStringValue:ne(e=>e.itemToStringValue),isItemEqualToValue:ne(e=>e.isItemEqualToValue),value:ne(e=>e.value),hasSelectedValue:ne(e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:gt(t,r)!==""}),hasNullItemLabel:ne((e,t)=>t?Vs(e.items):!1),open:ne(e=>e.open),mounted:ne(e=>e.mounted),forceMount:ne(e=>e.forceMount),transitionStatus:ne(e=>e.transitionStatus),openMethod:ne(e=>e.openMethod),activeIndex:ne(e=>e.activeIndex),selectedIndex:ne(e=>e.selectedIndex),isActive:ne((e,t)=>e.activeIndex===t),isSelected:ne((e,t,n)=>{const r=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(i=>ht(n,i,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:ht(n,o,r)}),isSelectedByFocus:ne((e,t)=>e.selectedIndex===t),popupProps:ne(e=>e.popupProps),triggerProps:ne(e=>e.triggerProps),triggerElement:ne(e=>e.triggerElement),positionerElement:ne(e=>e.positionerElement),listElement:ne(e=>e.listElement),popupSide:ne(e=>e.popupSide),scrollUpArrowVisible:ne(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:ne(e=>e.scrollDownArrowVisible),hasScrollArrows:ne(e=>e.hasScrollArrows)},Ns=l.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Be,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Hs(){return l.useContext(Ns)}const et=1;function Er(e,t){return Math.max(0,e-t)}function _s(e,t){if(t<=0)return 0;const n=wt(e,0,t),r=n,o=t-n,i=r<=et,s=o<=et;return i&&s?r<=o?0:t:i?0:s?t:n}function xi(e){const{id:t,value:n,defaultValue:r=null,onValueChange:o,open:i,defaultOpen:s=!1,onOpenChange:c,name:d,form:f,autoComplete:h,disabled:a=!1,readOnly:p=!1,required:u=!1,modal:y=!0,actionsRef:x,inputRef:w,onOpenChangeComplete:m,items:b,multiple:g=!1,itemToStringLabel:R,itemToStringValue:v,isItemEqualToValue:T=Ls,highlightItemOnHover:E=!0,children:D}=e,{clearErrors:k}=Hs(),{setDirty:V,setTouched:$,setFocused:L,shouldValidateOnChange:N,validityData:H,setFilled:B,name:z,disabled:I,validation:A,validationMode:G}=mn(),M=br({id:t}),Z=I||a,re=z??d,[S,O]=Dn({controlled:n,default:g?r??vn:r,name:"Select",state:"value"}),[_,ce]=Dn({controlled:i,default:s,name:"Select",state:"open"}),ee=l.useRef([]),le=l.useRef([]),pe=l.useRef(null),Le=l.useRef(null),Ne=l.useRef(0),Ce=l.useRef(null),Y=l.useRef([]),oe=l.useRef(!1),xe=l.useRef(!1),Ee=l.useRef(null),J=l.useRef(null),ae=l.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ue=l.useRef(!1),{mounted:Re,setMounted:ge,transitionStatus:te}=nr(_),{openMethod:se,triggerProps:P}=Ss(_),C=Mt(()=>new Zr({id:M,labelId:void 0,modal:y,multiple:g,itemToStringLabel:R,itemToStringValue:v,isItemEqualToValue:T,value:S,open:_,mounted:Re,transitionStatus:te,items:b,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,X=U(C,W.activeIndex),F=U(C,W.selectedIndex),j=U(C,W.triggerElement),me=U(C,W.positionerElement),Te=Cs(se),De=se??Te,ve=l.useMemo(()=>g&&Array.isArray(S)&&S.length===0?"":gt(S,v),[g,S,v]),he=l.useMemo(()=>g&&Array.isArray(S)?S.map(q=>gt(q,v)):gt(S,v),[g,S,v]),ye=Ke(C.state.triggerElement),Se=de(()=>he);Os(ye,M,S,Se);const Ye=l.useRef(S),it=g?Array.isArray(S)&&S.length>0:S!=null;K(()=>{S!==Ye.current&&C.set("forceMount",!0)},[C,S]),K(()=>{B(it)},[it,B]),K(function(){const fe=Y.current;let ke;if(g){const _e=Array.isArray(S)?S:[];if(_e.length===0)ke=null;else{const qe=_e[_e.length-1],Rt=Ct(fe,qe,T);ke=Rt===-1?null:Rt}}else{const _e=Ct(fe,S,T);ke=_e===-1?null:_e}ke===null&&(J.current=null),!_&&C.set("selectedIndex",ke)},[it,g,_,S,Y,T,C,J]),hr(S,()=>{k(re),V(S!==H.initialValue),N()?A.commit(S):A.commit(S,!0)});const Oe=de((q,fe)=>{if(c?.(q,fe),!fe.isCanceled&&(ce(q),!q&&(fe.reason===qn||fe.reason===eo)&&($(!0),L(!1),G==="onBlur"&&A.commit(S)),!q&&C.state.activeIndex!==null)){const ke=ee.current[C.state.activeIndex];queueMicrotask(()=>{ke?.setAttribute("tabindex","-1")})}}),Q=de(()=>{ge(!1),C.update({activeIndex:null,openMethod:null}),m?.(!1)});dn({enabled:!x,open:_,ref:pe,onComplete(){_||Q()}}),l.useImperativeHandle(x,()=>({unmount:Q}),[Q]);const we=de((q,fe)=>{o?.(q,fe),!fe.isCanceled&&O(q)}),Ie=de(()=>{const q=C.state.listElement||pe.current;if(!q)return;const fe=Er(q.scrollHeight,q.clientHeight),ke=_s(q.scrollTop,fe),_e=ke>0,qe=ke<fe;C.state.scrollUpArrowVisible!==_e&&C.set("scrollUpArrowVisible",_e),C.state.scrollDownArrowVisible!==qe&&C.set("scrollDownArrowVisible",qe)}),ie=dr({open:_,onOpenChange:Oe,elements:{reference:j,floating:me}}),Fe=vo(ie,{enabled:!p&&!Z,event:"mousedown"}),be=po(ie),Pe=ps(ie,{enabled:!p&&!Z,listRef:ee,activeIndex:X,selectedIndex:F,disabledIndices:vn,onNavigate(q){q===null&&!_||C.set("activeIndex",q)},focusItemOnHover:E}),Ve=gs(ie,{enabled:!p&&!Z&&(_||!g),listRef:le,activeIndex:X,selectedIndex:F,onMatch(q){_?C.set("activeIndex",q):we(Y.current[q],We("none"))},onTyping(q){oe.current=q}}),je=l.useMemo(()=>{const q=cn(Ve.reference,Pe.reference,be.reference,Fe.reference,P);return M&&(q.id=M),q},[Fe.reference,Ve.reference,Pe.reference,be.reference,P,M]),Qe=l.useMemo(()=>cn(go,Ve.floating,Pe.floating,be.floating),[Ve.floating,Pe.floating,be.floating]),ct=Pe.item??Et;mo(()=>{C.update({popupProps:Qe,triggerProps:je})}),K(()=>{C.update({id:M,modal:y,multiple:g,value:S,open:_,mounted:Re,transitionStatus:te,popupProps:Qe,triggerProps:je,items:b,itemToStringLabel:R,itemToStringValue:v,isItemEqualToValue:T,openMethod:De})},[C,M,y,g,S,_,Re,te,Qe,je,b,R,v,T,De]);const ut=l.useMemo(()=>({store:C,name:re,required:u,disabled:Z,readOnly:p,multiple:g,highlightItemOnHover:E,setValue:we,setOpen:Oe,listRef:ee,popupRef:pe,scrollHandlerRef:Le,handleScrollArrowVisibility:Ie,scrollArrowsMountedCountRef:Ne,itemProps:ct,events:ie.context.events,valueRef:Ce,valuesRef:Y,labelsRef:le,typingRef:oe,selectionRef:ae,firstItemTextRef:Ee,selectedItemTextRef:J,validation:A,onOpenChangeComplete:m,keyboardActiveRef:xe,alignItemWithTriggerActiveRef:ue,initialValueRef:Ye}),[C,re,u,Z,p,g,E,we,Oe,ct,ie.context.events,A,m,Ie]),He=Gn(w,A.inputRef),Ge=g&&Array.isArray(S)&&S.length>0,lt=g?void 0:re,yt=l.useMemo(()=>!g||!Array.isArray(S)||!re?null:S.map(q=>{const fe=gt(q,v);return Me.jsx("input",{type:"hidden",form:f,name:re,value:fe},fe)}),[g,S,f,re,v]);return Me.jsx(xr.Provider,{value:ut,children:Me.jsxs(yr.Provider,{value:ie,children:[D,Me.jsx("input",{...A.getInputValidationProps({onFocus(){C.state.triggerElement?.focus({focusVisible:!0})},onChange(q){if(q.nativeEvent.defaultPrevented||Z||p){q.preventBaseUIHandler?.();return}const fe=q.currentTarget.value,ke=We(pn,q.nativeEvent);function _e(){if(g)return;const qe=Y.current.find(Rt=>gt(Rt,v).toLowerCase()===fe.toLowerCase()||Sr(Rt,R).toLowerCase()===fe.toLowerCase());qe!=null&&(V(qe!==H.initialValue),we(qe,ke),N()&&A.commit(qe))}C.set("forceMount",!0),queueMicrotask(_e)}}),id:M&<==null?`${M}-hidden-input`:void 0,form:f,name:lt,autoComplete:h,value:ve,disabled:Z,required:u&&!Ge,readOnly:p,ref:He,style:re?Jr:Qr,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),yt]})})}function Bs(e,t){return e??t}function Ws(e){const t=e.getBoundingClientRect(),n=ze(e),r=n.getComputedStyle(e,"::before"),o=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||o.content!=="none"))return t;const s=parseFloat(r.width)||0,c=parseFloat(r.height)||0,d=parseFloat(o.width)||0,f=parseFloat(o.height)||0,h=Math.max(t.width,s,d),a=Math.max(t.height,c,f),p=h-t.width,u=a-t.height;return{left:t.left-p/2,right:t.right+p/2,top:t.top-u/2,bottom:t.bottom+u/2}}const kt=2,Us=400,$s={...ho,...Ts,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},yi=l.forwardRef(function(t,n){const{render:r,className:o,id:i,disabled:s=!1,nativeButton:c=!0,style:d,...f}=t,{setTouched:h,setFocused:a,validationMode:p,state:u,disabled:y}=mn(),{labelId:x}=wr(),{store:w,setOpen:m,selectionRef:b,validation:g,readOnly:R,required:v,alignItemWithTriggerActiveRef:T,disabled:E,keyboardActiveRef:D}=pt(),k=y||E||s,V=U(w,W.open),$=U(w,W.mounted),L=U(w,W.value),N=U(w,W.triggerProps),H=U(w,W.positionerElement),B=U(w,W.listElement),z=U(w,W.popupSide),I=U(w,W.id),A=U(w,W.labelId),G=U(w,W.hasSelectedValue),M=$&&H?z:null,Z=i??I,re=Bs(x,A);br({id:Z});const S=Ke(H),O=l.useRef(null),{getButtonProps:_,buttonRef:ce}=Jn({disabled:k,native:c}),ee=de(oe=>{w.set("triggerElement",oe)}),le=Gn(n,O,ce,ee),pe=St(),Le=St(),Ne=St();l.useEffect(()=>{if(V)return Ne.start(Us,()=>{b.current.allowUnselectedMouseUp=!0,b.current.allowSelectedMouseUp=!0}),()=>{Ne.clear()};b.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},Le.clear()},[V,b,Le,Ne]);const Ce=cn(N,{id:Z,role:"combobox","aria-expanded":V?"true":"false","aria-haspopup":"listbox","aria-controls":V?B?.id??jn(H)?.id:void 0,"aria-labelledby":re,"aria-readonly":R||void 0,"aria-required":v||void 0,tabIndex:k?-1:0,ref:le,onFocus(oe){a(!0),V&&T.current&&m(!1,We(pn,oe.nativeEvent)),pe.start(0,()=>{w.set("forceMount",!0)})},onBlur(oe){at(H,oe.relatedTarget)||(h(!0),a(!1),p==="onBlur"&&g.commit(L))},onPointerMove(){D.current=!1},onKeyDown(){D.current=!0},onMouseDown(oe){if(V)return;const xe=ot(oe.currentTarget);function Ee(J){if(!O.current)return;const ae=J.target;if(at(O.current,ae)||at(S.current,ae)||ae===O.current)return;const ue=Ws(O.current);J.clientX>=ue.left-kt&&J.clientX<=ue.right+kt&&J.clientY>=ue.top-kt&&J.clientY<=ue.bottom+kt||m(!1,We(to,J))}Le.start(0,()=>{xe.addEventListener("mouseup",Ee,{once:!0})})}},g.getValidationProps,f,_);Ce.role="combobox";const Y={...u,open:V,disabled:k,value:L,readOnly:R,popupSide:M,placeholder:!G};return dt("button",t,{ref:[n,O],state:Y,stateAttributesMapping:$s,props:Ce})}),zs={value:()=>null},Ri=l.forwardRef(function(t,n){const{className:r,render:o,children:i,placeholder:s,style:c,...d}=t,{store:f,valueRef:h}=pt(),a=U(f,W.value),p=U(f,W.items),u=U(f,W.itemToStringLabel),y=U(f,W.hasSelectedValue),x=!y&&s!=null&&i==null,w=U(f,W.hasNullItemLabel,x),m={value:a,placeholder:!y};let b=null;return typeof i=="function"?b=i(a):i!=null?b=i:!y&&s!=null&&!w?b=s:Array.isArray(a)?b=ks(a,p,u):b=Cr(a,p,u),dt("span",t,{state:m,ref:[n,h],props:[{children:b},d],stateAttributesMapping:zs})}),Ys=l.createContext(void 0),wi=l.forwardRef(function(t,n){const{store:r}=pt(),o=U(r,W.mounted),i=U(r,W.forceMount);return o||i?Me.jsx(Ys.Provider,{value:!0,children:Me.jsx(no,{ref:n,...t})}):null}),Ir=l.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function js(){return l.useContext(Ir)}function qs(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,i=de(o),s=l.useRef(0),c=Mt(Xs).current,d=Mt(Ks).current,[f,h]=l.useState(0),a=l.useRef(f),p=de((m,b)=>{d.set(m,b??null),a.current+=1,h(a.current)}),u=de(m=>{d.delete(m),a.current+=1,h(a.current)}),y=l.useMemo(()=>{const m=new Map;return Array.from(d.keys()).filter(g=>g.isConnected).sort(Gs).forEach((g,R)=>{const v=d.get(g)??{};m.set(g,{...v,index:R})}),m},[d,f]);K(()=>{if(typeof MutationObserver!="function"||y.size===0)return;const m=new MutationObserver(b=>{const g=new Set,R=v=>g.has(v)?g.delete(v):g.add(v);b.forEach(v=>{v.removedNodes.forEach(R),v.addedNodes.forEach(R)}),g.size===0&&(a.current+=1,h(a.current))});return y.forEach((b,g)=>{g.parentElement&&m.observe(g.parentElement,{childList:!0})}),()=>{m.disconnect()}},[y]),K(()=>{a.current===f&&(n.current.length!==y.size&&(n.current.length=y.size),r&&r.current.length!==y.size&&(r.current.length=y.size),s.current=y.size),i(y)},[i,y,n,r,f]),K(()=>()=>{n.current=[]},[n]),K(()=>()=>{r&&(r.current=[])},[r]);const x=de(m=>(c.add(m),()=>{c.delete(m)}));K(()=>{c.forEach(m=>m(y))},[c,y]);const w=l.useMemo(()=>({register:p,unregister:u,subscribeMapChange:x,elementsRef:n,labelsRef:r,nextIndexRef:s}),[p,u,x,n,r,s]);return Me.jsx(Ir.Provider,{value:w,children:t})}function Ks(){return new Map}function Xs(){return new Set}function Gs(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Tr=l.createContext(void 0);function Js(){const e=l.useContext(Tr);if(!e)throw new Error(Lt(59));return e}function jt(e,t){e&&Object.assign(e.style,t)}const Qs={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Zs=20;function ei(e,t,n,r){const[o,i]=l.useState(!1);K(()=>{if(!e||!t||n==null){i(!1);return}const s=ot(n).documentElement.clientWidth,c=n.offsetWidth;i(s>0&&c>0&&c>=s-Zs)},[e,t,n]),xo(e&&(!t||o),r)}const ti={position:"fixed"},bi=l.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:i,render:s,side:c="bottom",align:d="center",sideOffset:f=0,alignOffset:h=0,collisionBoundary:a="clipping-ancestors",collisionPadding:p,arrowPadding:u=5,sticky:y=!1,disableAnchorTracking:x,alignItemWithTrigger:w=!0,collisionAvoidance:m=ro,style:b,...g}=t,{store:R,listRef:v,labelsRef:T,alignItemWithTriggerActiveRef:E,selectedItemTextRef:D,valuesRef:k,initialValueRef:V,popupRef:$,setValue:L}=pt(),N=Rr(),H=U(R,W.open),B=U(R,W.mounted),z=U(R,W.modal),I=U(R,W.value),A=U(R,W.openMethod),G=U(R,W.positionerElement),M=U(R,W.triggerElement),Z=U(R,W.isItemEqualToValue),re=U(R,W.transitionStatus),S=l.useRef(null),O=l.useRef(null),[_,ce]=l.useState(w),ee=B&&_&&A!=="touch";!B&&_!==w&&ce(w),K(()=>{B||(W.scrollUpArrowVisible(R.state)&&R.set("scrollUpArrowVisible",!1),W.scrollDownArrowVisible(R.state)&&R.set("scrollDownArrowVisible",!1))},[R,B]),l.useImperativeHandle(E,()=>ee),ei((ee||z)&&H,A==="touch",G,M);const le=Rs({anchor:r,floatingRootContext:N,positionMethod:o,mounted:B,side:c,sideOffset:f,align:d,alignOffset:h,arrowPadding:u,collisionBoundary:a,collisionPadding:p,sticky:y,disableAnchorTracking:x??ee,collisionAvoidance:m,keepMounted:!0}),pe=ee?"none":le.side,Le=ee?ti:le.positionerStyles,Ne={open:H,side:pe,align:le.align,anchorHidden:le.anchorHidden};K(()=>{R.set("popupSide",le.side)},[R,le.side]);const Ce=de(J=>{R.set("positionerElement",J)}),Y=ws(t,Ne,{styles:Le,transitionStatus:re,props:g,refs:[n,Ce],hidden:!B,inert:!H}),oe=l.useRef(0),xe=de(J=>{if(J.size===0&&oe.current===0||k.current.length===0)return;const ae=oe.current;if(oe.current=J.size,J.size===ae)return;const ue=We(pn);if(ae!==0&&!R.state.multiple&&I!==null&&Ct(k.current,I,Z)===-1){const ge=V.current,se=ge!=null&&Ct(k.current,ge,Z)!==-1?ge:null;L(se,ue),se===null&&(R.set("selectedIndex",null),D.current=null)}if(ae!==0&&R.state.multiple&&Array.isArray(I)){const Re=te=>Ct(k.current,te,Z)!==-1,ge=I.filter(te=>Re(te));(ge.length!==I.length||ge.some(te=>!Ds(I,te,Z)))&&(L(ge,ue),ge.length===0&&(R.set("selectedIndex",null),D.current=null))}if(H&&ee){R.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Re={height:""};jt(G,Re),jt($.current,Re)}}),Ee=l.useMemo(()=>({...le,side:pe,alignItemWithTriggerActive:ee,setControlledAlignItemWithTrigger:ce,scrollUpArrowRef:S,scrollDownArrowRef:O}),[le,pe,ee,ce]);return Me.jsx(qs,{elementsRef:v,labelsRef:T,onMapChange:xe,children:Me.jsxs(Tr.Provider,{value:Ee,children:[B&&z&&Me.jsx(yo,{inert:oo(!H),cutout:M}),Y]})})}),Nt="base-ui-disable-scrollbar",Vn={className:Nt,getElement(e){return Me.jsx("style",{nonce:e,href:Nt,precedence:"base-ui:low",children:`.${Nt}{scrollbar-width:none}.${Nt}::-webkit-scrollbar{display:none}`})}},ni=l.createContext(void 0);function ri(e){return l.useContext(ni)}const oi=l.createContext(void 0),si={disableStyleElements:!1};function ii(){return l.useContext(oi)??si}const ci={...tr,...Qn},vi=l.forwardRef(function(t,n){const{render:r,className:o,style:i,finalFocus:s,...c}=t,{store:d,popupRef:f,onOpenChangeComplete:h,setOpen:a,valueRef:p,firstItemTextRef:u,selectedItemTextRef:y,keyboardActiveRef:x,multiple:w,handleScrollArrowVisibility:m,scrollHandlerRef:b,listRef:g,highlightItemOnHover:R}=pt(),{side:v,align:T,alignItemWithTriggerActive:E,isPositioned:D,setControlledAlignItemWithTrigger:k,scrollDownArrowRef:V,scrollUpArrowRef:$}=Js(),L=ri()!=null,N=Rr(),H=pr(),{nonce:B,disableStyleElements:z}=ii(),I=U(d,W.id),A=U(d,W.open),G=U(d,W.mounted),M=U(d,W.popupProps),Z=U(d,W.transitionStatus),re=U(d,W.triggerElement),S=U(d,W.positionerElement),O=U(d,W.listElement),_=l.useRef(!1),ce=l.useRef(!1),ee=l.useRef({}),le=Ut(),pe=de(Y=>{if(!S||!f.current||!ce.current)return;if(_.current||!E){m();return}const oe=S.style.top==="0px",xe=S.style.bottom==="0px";if(!oe&&!xe){m();return}const Ee=Nn(S),J=vt(S.getBoundingClientRect().height,"y",Ee),ae=ot(S),ue=getComputedStyle(S),Re=parseFloat(ue.marginTop),ge=parseFloat(ue.marginBottom),te=kn(getComputedStyle(f.current)),se=Math.min(ae.documentElement.clientHeight-Re-ge,te),P=Y.scrollTop,C=Ht(Y);let X=0,F=null,j=!1,me=!1;const Te=ye=>{S.style.height=`${ye}px`},De=(ye,Se)=>{const Ye=wt(ye,0,se-J);Ye>0&&Te(J+Ye),Y.scrollTop=Se,se-(J+Ye)<=et&&(_.current=!0),m()},ve=oe?C-P:P,he=Math.min(J+ve,se);if(X=he,ve<=et){De(ve,oe?C:0);return}if(se-he>et)oe?me=!0:F=0;else if(j=!0,xe&&P<C){const ye=J+ve-se;F=P-(ve-ye)}if(X=Math.ceil(X),X!==0&&Te(X),me||F!=null){const ye=Ht(Y),Se=me?ye:wt(F,0,ye);Math.abs(Y.scrollTop-Se)>et&&(Y.scrollTop=Se)}(j||X>=se-et)&&(_.current=!0),m()});l.useImperativeHandle(b,()=>pe,[pe]),dn({open:A,ref:f,onComplete(){A&&h?.(!0)}});const Le={open:A,transitionStatus:Z,side:v,align:T};K(()=>{!S||!f.current||Object.keys(ee.current).length||(ee.current={top:S.style.top||"0",left:S.style.left||"0",right:S.style.right,height:S.style.height,bottom:S.style.bottom,minHeight:S.style.minHeight,maxHeight:S.style.maxHeight,marginTop:S.style.marginTop,marginBottom:S.style.marginBottom})},[f,S]),K(()=>{A||E||(ce.current=!1,_.current=!1,jt(S,ee.current))},[A,E,S,f]),K(()=>{const Y=f.current;if(!A||!re||!S||!Y||E&&!D||d.state.transitionStatus==="ending")return;if(!E){ce.current=!0,le.request(m),Y.style.removeProperty("--transform-origin");return}const oe=li(Y);Y.style.removeProperty("--transform-origin");try{let xe=y.current;xe?.isConnected||(xe=!W.hasSelectedValue(d.state)&&u.current?.isConnected?u.current:null);const Ee=p.current,J=getComputedStyle(S),ae=getComputedStyle(Y),ue=ot(re),Re=ze(S),ge=Nn(re),te=_t(re.getBoundingClientRect(),ge),se=_t(S.getBoundingClientRect(),ge),P=te.height,C=O||Y,X=C.scrollHeight,F=parseFloat(ae.borderBottomWidth),j=parseFloat(J.marginTop)||10,me=parseFloat(J.marginBottom)||10,Te=parseFloat(J.minHeight)||100,De=kn(ae),ve=5,he=5,ye=20,Se=ue.documentElement.clientHeight-j-me,Ye=ue.documentElement.clientWidth,it=Se-te.bottom+P;let Oe,Q=H==="rtl"?te.right-se.width:te.left,we=0;if(xe&&Ee){const He=_t(Ee.getBoundingClientRect(),ge);Oe=_t(xe.getBoundingClientRect(),ge),Q=se.left+(H==="rtl"?He.right-Oe.right:He.left-Oe.left);const Ge=He.top-te.top+He.height/2;we=Oe.top-se.top+Oe.height/2-Ge}const Ie=it+we+me+F;let ie=Math.min(Se,Ie);const Fe=Se-j-me,be=Ie-ie,Pe=Ye-he;S.style.left=`${wt(Q,ve,Pe-se.width)}px`,S.style.height=`${ie}px`,S.style.maxHeight="auto",S.style.marginTop=`${j}px`,S.style.marginBottom=`${me}px`,Y.style.height="100%";const Ve=Ht(C),je=be>=Ve-et;je&&(ie=Math.min(Se,se.height)-(be-Ve));const Qe=te.top<ye||te.bottom>Se-ye||Math.ceil(ie)+et<Math.min(X,Te),ct=(Re.visualViewport?.scale??1)!==1&&so;if(Qe||ct){ce.current=!0,jt(S,ee.current),k(!1);return}const ut=Math.max(Te,ie);if(je){const He=Math.max(0,Se-Ie);S.style.top=se.height>=Fe?"0":`${He}px`,S.style.height=`${ie}px`,C.scrollTop=Ht(C)}else S.style.bottom="0",C.scrollTop=be;if(Oe){const He=se.top,Ge=se.height,lt=Oe.top+Oe.height/2,yt=Ge>0?(lt-He)/Ge*100:50,q=wt(yt,0,100);Y.style.setProperty("--transform-origin",`50% ${q}%`)}(ut===Se||ie>=De)&&(_.current=!0),m(),R&&d.state.selectedIndex===null&&d.state.activeIndex===null&&g.current[0]!=null&&d.set("activeIndex",0),ce.current=!0}finally{oe()}},[d,A,S,re,p,u,y,f,m,E,k,le,V,$,O,g,R,H,D]),l.useEffect(()=>{if(!E||!S||!A)return;const Y=ze(S);function oe(xe){a(!1,We(co,xe))}return io(Y,"resize",oe)},[a,E,S,A]);const Ne={...O?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":w||void 0,id:`${I}-list`},onKeyDown(Y){x.current=!0,L&&wo.has(Y.key)&&Y.stopPropagation()},onMouseMove(){x.current=!1},onScroll(Y){O||pe(Y.currentTarget)},...E&&{style:O?{height:"100%"}:Qs}},Ce=dt("div",t,{ref:[n,f],state:Le,stateAttributesMapping:ci,props:[M,Ne,mr(Z),{className:!O&&E?Vn.className:void 0},c]});return Me.jsxs(l.Fragment,{children:[!z&&Vn.getElement(B),Me.jsx(Ro,{context:N,modal:!1,disabled:!G,returnFocus:s,restoreFocus:!0,children:Ce})]})});function kn(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function Ht(e){return Er(e.scrollHeight,e.clientHeight)}function Nn(e){return ar.getScale(e)}function vt(e,t,n){return e/n[t]}function _t(e,t){return Tt({x:vt(e.x,"x",t),y:vt(e.y,"y",t),width:vt(e.width,"x",t),height:vt(e.height,"y",t)})}const Hn=[["transform","none"],["scale","1"],["translate","0 0"]];function li(e){const{style:t}=e,n={};for(const[r,o]of Hn)n[r]=t.getPropertyValue(r),t.setProperty(r,o,"important");return()=>{for(const[r]of Hn){const o=n[r];o?t.setProperty(r,o):t.removeProperty(r)}}}let Ar=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function ai(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:o,index:i}=e,{register:s,unregister:c,subscribeMapChange:d,elementsRef:f,labelsRef:h,nextIndexRef:a}=js(),p=l.useRef(-1),[u,y]=l.useState(i??(o===Ar.GuessFromOrder?()=>{if(p.current===-1){const m=a.current;a.current+=1,p.current=m}return p.current}:-1)),x=l.useRef(null),w=l.useCallback(m=>{if(x.current=m,u!==-1&&m!==null&&(f.current[u]=m,h)){const b=t!==void 0;h.current[u]=b?t:r?.current?.textContent??m.textContent}},[u,f,h,t,r]);return K(()=>{if(i!=null)return;const m=x.current;if(m)return s(m,n),()=>{c(m)}},[i,s,c,n]),K(()=>{if(i==null)return d(m=>{const b=x.current?m.get(x.current)?.index:null;b!=null&&y(b)})},[i,d,y]),l.useMemo(()=>({ref:w,index:u}),[u,w])}const Mr=l.createContext(void 0);function hn(){const e=l.useContext(Mr);if(!e)throw new Error(Lt(57));return e}const Si=l.memo(l.forwardRef(function(t,n){const{render:r,className:o,style:i,value:s=null,label:c,disabled:d=!1,nativeButton:f=!1,...h}=t,a=l.useRef(null),p=ai({label:c,textRef:a,indexGuessBehavior:Ar.GuessFromOrder}),{store:u,itemProps:y,setOpen:x,setValue:w,selectionRef:m,typingRef:b,valuesRef:g,multiple:R,selectedItemTextRef:v}=pt(),T=U(u,W.isActive,p.index),E=U(u,W.isSelected,p.index,s),D=U(u,W.isSelectedByFocus,p.index),k=U(u,W.isItemEqualToValue),V=p.index,$=V!==-1,L=l.useRef(null);K(()=>{if(!$)return;const O=g.current;return O[V]=s,()=>{delete O[V]}},[$,V,s,g]),K(()=>{if(!$)return;const O=u.state.value;let _=O;R&&Array.isArray(O)&&O.length>0&&(_=O[O.length-1]),_!==void 0&&ht(s,_,k)&&(u.set("selectedIndex",V),a.current&&(v.current=a.current))},[$,V,R,k,u,s,v]);const N=l.useRef(null),H=l.useRef("mouse"),B=l.useRef(!1),{getButtonProps:z,buttonRef:I}=Jn({disabled:d,focusableWhenDisabled:!0,native:f,composite:!0}),A={disabled:d,selected:E,highlighted:T};function G(O){const _=u.state.value;if(R){const ce=Array.isArray(_)?_:[],ee=E?Fs(ce,s,k):[...ce,s];w(ee,We(en,O))}else w(s,We(en,O)),x(!1,We(en,O))}function M(){m.current.dragY=0}const Z={role:"option","aria-selected":E,tabIndex:T?0:-1,onKeyDown(O){N.current=O.key,u.set("activeIndex",V),O.key===" "&&b.current&&O.preventDefault()},onClick(O){const _=O.type==="click"&&H.current!=="touch",ce=O.nativeEvent.pointerType,ee=_&&Kn(O.nativeEvent)&&(ce!==void 0||T),le=_&&!ee&&!B.current;B.current=!1,!(O.type==="keydown"&&N.current===null)&&(d||O.type==="keydown"&&N.current===" "&&b.current||le||(N.current=null,G(O.nativeEvent)))},onPointerEnter(O){H.current=O.pointerType},onPointerMove(O){if(O.pointerType==="mouse"&&O.buttons===1){const _=m.current;_.dragY+=O.movementY,_.dragY**2>=64&&(_.allowUnselectedMouseUp=!0)}},onPointerDown(O){H.current=O.pointerType,B.current=!0,M()},onMouseUp(){if(M(),d||H.current==="touch"||B.current)return;const O=!m.current.allowSelectedMouseUp&&E,_=!m.current.allowUnselectedMouseUp&&!E;O||_||(B.current=!0,L.current?.click(),B.current=!1)}},re=dt("div",t,{ref:[I,n,p.ref,L],state:A,props:[y,Z,h,z]}),S=l.useMemo(()=>({selected:E,index:V,textRef:a,selectedByFocus:D,hasRegistered:$}),[E,V,a,D,$]);return Me.jsx(Mr.Provider,{value:S,children:re})})),Ci=l.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:o}=hn();return r||o?Me.jsx(ui,{...t,ref:n}):null}),ui=l.memo(l.forwardRef((e,t)=>{const{render:n,className:r,style:o,keepMounted:i,...s}=e,{selected:c}=hn(),d=l.useRef(null),{transitionStatus:f,setMounted:h}=nr(c),p=dt("span",e,{ref:[t,d],state:{selected:c,transitionStatus:f},props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:Qn});return dn({open:c,ref:d,onComplete(){c||h(!1)}}),p})),Ei=l.memo(l.forwardRef(function(t,n){const{index:r,textRef:o,selectedByFocus:i,hasRegistered:s}=hn(),{firstItemTextRef:c,selectedItemTextRef:d}=pt(),{render:f,className:h,style:a,...p}=t,u=l.useCallback(x=>{x&&(s&&r===0&&(c.current=x),s&&i&&(d.current=x))},[c,d,r,i,s]);return dt("div",t,{ref:[u,n,o],props:p})}));export{Vn as A,mi as C,Qs as L,xi as S,Hs as a,mn as b,wr as c,Dn as d,Os as e,Ts as f,hr as g,yi as h,Ri as i,wi as j,bi as k,vi as l,Si as m,Ei as n,Ci as o,vo as p,vs as q,Rs as r,W as s,ei as t,pt as u,ws as v,hi as w,ri as x,mr as y,Js as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as Oe,r as n,a as ea,j as e,M as U,V as W,b2 as nt,X as Se,G as s,b3 as da,b4 as Pa,b5 as ot,u as lt,b6 as xa,b7 as dt,b8 as ct,b9 as ut,ba as pa,bb as gt,bc as mt,b as ht,bd as xt,be as pt,bf as yt,S as ft,e as bt,m as ya,ad as kt,I as wt,U as ye,bg as vt,bh as jt,bi as Nt,bj as Ct,bk as St,bl as _t,i as Pt,aZ as Rt,bm as ca,R as Lt,bn as It,bo as fa,bp as Ce,bq as ba,br as ka,bs as Dt,bt as wa,bu as va,bv as $t,bw as Et}from"./main-CgiMNMS_.js";import{L as Bt}from"./LocalOnlyNotice-Dz8c-3ZD.js";import{C as Mt}from"./Card-B13p4G_t.js";import{u as Tt,D as Ot,a as Ut,b as zt,c as Ft,d as At,e as Kt}from"./DialogTitle-BZmopQRt.js";import{u as Qe,t as Vt,a as qt,C as _e}from"./useScrollLock-BaJCW9Ak.js";import{I as Ra}from"./info-CExabEBS.js";import{u as Ht}from"./useCurrency-CrMUx8Pg.js";import{L as ae,P as La,a as Ia,b as Da,c as $a,d as Ea,C as Gt}from"./PopoverPopup-BhT2-G0O.js";import{u as Wt,s as Qt,f as Ba,a as Xt,b as Yt,c as Jt,d as Zt,e as er,g as ar,S as Ma,h as Ta,i as Oa,C as ga,j as Ua,k as za,l as Fa,m as Xe,n as Ye,o as Je}from"./SelectItemText-DpUKUC8A.js";import{D as Aa}from"./download-ZBU9wTAZ.js";import"./arrow-up-right-B7ItQsbP.js";const tr=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]],Ka=Oe("circle-arrow-up",tr);const rr=[["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"}]],ua=Oe("external-link",rr);const sr=[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]],ir=Oe("flame",sr);const nr=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Va=Oe("plus",nr);const or=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ma=Oe("trash-2",or),lr=n.forwardRef(function(r,o){const{render:g,className:c,style:x,id:u,...m}=r,{store:h}=Tt(),y=Qe(u);return h.useSyncedValueWithCleanup("descriptionElementId",y),ea("p",r,{ref:o,props:[{id:y},m]})});function ja({open:a,title:r,description:o,confirmLabel:g,cancelLabel:c,destructive:x=!1,busy:u=!1,onConfirm:m,onCancel:h}){return e.jsx(Ot,{open:a,onOpenChange:y=>{!y&&!u&&h?.()},children:e.jsxs(Ut,{children:[e.jsx(zt,{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-[2px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),e.jsx(Ft,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:e.jsxs(At,{className:"relative w-full max-w-md rounded-2xl bg-white p-6 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] ring-1 ring-oai-gray-200 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-2 data-[ending-style]:scale-[0.96] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-2 data-[starting-style]:scale-[0.96] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] dark:ring-oai-gray-800",children:[e.jsx(Kt,{className:"text-base font-semibold text-oai-black dark:text-white",children:r}),o?e.jsx(lr,{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:o}):null,e.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[e.jsx(U,{type:"button",variant:"secondary",size:"sm",disabled:u,onClick:()=>h?.(),children:c}),e.jsx(U,{type:"button",size:"sm",disabled:u,onClick:()=>m?.(),className:W(x&&"!bg-red-600 hover:!bg-red-700 focus-visible:!outline-red-600 dark:!bg-red-600 dark:hover:!bg-red-500"),children:g})]})]})})]})})}function ha({id:a,value:r,onChange:o,placeholder:g,disabled:c=!1,type:x="text",label:u,error:m,className:h="",...y}){const l=n.useId(),k=a||l,C=m?`${k}-error`:void 0,N=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${c?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${m?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${h}`;return e.jsxs("div",{className:"w-full",children:[u&&e.jsx("label",{htmlFor:k,className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:u}),e.jsx("input",{id:k,type:x,value:r,onChange:o,placeholder:g,disabled:c,"aria-invalid":m?!0:void 0,"aria-describedby":C,className:N,...y}),m&&e.jsx("p",{id:C,className:"mt-1.5 text-sm text-oai-error",children:m})]})}const qa=n.forwardRef(function(r,o){const{render:g,className:c,style:x,...u}=r,{store:m}=Wt(),y={open:nt(m,Qt.open)};return ea("span",r,{state:y,ref:o,props:[{"aria-hidden":!0,children:"▼"},u],stateAttributesMapping:Vt})}),dr="tt:hint:dismissed:";function Ha(a){return dr+a}function cr(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Ha(a))==="1"}catch{return!1}}function ur({id:a,children:r,className:o,ariaLabel:g}){const[c,x]=n.useState(()=>cr(a)),u=n.useCallback(()=>{if(typeof window<"u")try{window.localStorage.setItem(Ha(a),"1")}catch{}x(!0)},[a]);return c?null:e.jsxs("div",{role:"note","aria-label":g||s("hint.dismissible_aria"),className:W("relative rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 py-3 text-sm text-oai-gray-700","dark:border-oai-gray-800 dark:bg-oai-gray-900/40 dark:text-oai-gray-300",o),children:[e.jsx("button",{type:"button",onClick:u,"aria-label":s("hint.dismiss"),className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-oai-gray-500 transition-colors hover:bg-oai-gray-200/70 hover:text-oai-gray-700 focus:outline-none focus:ring-2 focus:ring-oai-blue/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800/70 dark:hover:text-oai-gray-200",children:e.jsx(Se,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsxs("div",{className:"flex items-start gap-2 pr-8",children:[e.jsx(Ra,{className:"mt-0.5 h-4 w-4 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:r})]})]})}function gr(a){if(!a)return null;for(const r of a.elements){const o=r.tagName;if(o==="BUTTON"||o==="INPUT"){const g=r;if(g.type==="submit")return g}}return null}let Na=(function(a){return a.checked="data-checked",a.unchecked="data-unchecked",a.indeterminate="data-indeterminate",a.disabled="data-disabled",a.readonly="data-readonly",a.required="data-required",a.valid="data-valid",a.invalid="data-invalid",a.touched="data-touched",a.dirty="data-dirty",a.filled="data-filled",a.focused="data-focused",a})({});function Ga(a){return n.useMemo(()=>({checked(r){return a.indeterminate?{}:r?{[Na.checked]:""}:{[Na.unchecked]:""}},...Ba}),[a.indeterminate])}const mr=n.createContext({disabled:!1});function hr(){return n.useContext(mr)}function xr(a,r,o,g=!0,c){const[x,u]=n.useState(),m=Qe(c?`${c}-label`:void 0),h=a??r??x;return da(()=>{const y=a||r||!g?void 0:pr(o.current,m);x!==y&&u(y)}),h}function pr(a,r){const o=yr(a);if(o)return!o.id&&r&&(o.id=r),o.id||void 0}function yr(a){if(!a)return;const r=a.parentElement;if(r&&r.tagName==="LABEL")return r;const o=a.id;if(o){const c=a.nextElementSibling;if(c&&c.htmlFor===o)return c}const g=a.labels;return g&&g[0]}const fr=n.createContext(void 0);function br(a=!0){const r=n.useContext(fr);if(r===void 0&&!a)throw new Error(Pa(3));return r}const Wa=n.createContext(void 0);function kr(){const a=n.useContext(Wa);if(a===void 0)throw new Error(Pa(14));return a}const wr="data-parent",vr=n.forwardRef(function(r,o){const{checked:g,className:c,defaultChecked:x=!1,"aria-labelledby":u,disabled:m=!1,form:h,id:y,indeterminate:l=!1,inputRef:k,name:C,onCheckedChange:w,parent:v=!1,readOnly:f=!1,render:N,required:D=!1,uncheckedValue:z,value:Q,nativeButton:F=!1,style:de,...j}=r,{clearErrors:te}=Xt(),{disabled:$,name:H,setDirty:X,setFilled:re,setFocused:A,setTouched:fe,state:be,validationMode:Ue,validityData:Pe,shouldValidateOnChange:ze,validation:Fe}=Yt(),M=hr(),{labelId:se,controlId:Re,registerControlId:Y,getDescriptionProps:ke}=Jt(),S=br(),ie=S?.parent,ne=ie&&S.allValues,J=$||M.disabled||S?.disabled||m,Z=H??C,P=Q??Z,xe=Qe(),aa=Qe();let G=Re;ne?G=v?aa:`${ie.id}-${P}`:y&&(G=y);let we={};ne&&(v?we=S.parent.getParentProps():P&&(we=S.parent.getChildProps(P)));const{checked:ve=g,indeterminate:ce=l,onCheckedChange:je,...Ne}=we,T=S?.value,pe=S?.setValue,ue=S?.defaultValue,ge=n.useRef(null),oe=ot(()=>Symbol("checkbox-control")),Le=n.useRef(!1),{getButtonProps:Ae,buttonRef:Ke}=lt({disabled:J,native:F}),I=S?.validation??Fe,[E,ta]=Zt({controlled:P&&T&&!v?T.includes(P):ve,default:P&&ue&&!v?ue.includes(P):x,name:"Checkbox",state:"checked"});da(()=>{Y!==xa&&(Le.current=!0,Y(oe.current,G))},[G,Y,oe]),n.useEffect(()=>{const b=oe.current;return()=>{!Le.current||Y===xa||(Le.current=!1,Y(b,void 0))}},[Y,oe]),er(ge,xe,E,void 0,!S);const le=n.useRef(null),Ve=dt(k,le,I.inputRef),Ie=xr(u,se,le,!F,G??void 0);da(()=>{le.current&&(le.current.indeterminate=ce,E&&re(!0))},[E,ce,re]),ar(E,()=>{S&&!v||(te(Z),re(E),X(E!==Pe.initialValue),ze()?I.commit(E):I.commit(E,!0))});const ra=ct({checked:E,disabled:J,form:h,name:v?void 0:Z,id:F?void 0:G??void 0,required:D,ref:Ve,style:Z?gt:mt,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(b){if(b.nativeEvent.defaultPrevented)return;if(f){b.preventDefault();return}const K=b.currentTarget.checked,me=ht(xt,b.nativeEvent);if(je?.(K,me),w?.(K,me),!me.isCanceled&&(ta(K),P&&T&&pe&&!v&&!ne)){const R=K?[...T,P]:T.filter(V=>V!==P);pe(R,me)}},onFocus(){ge.current?.focus()}},Q!==void 0?{value:(S?E&&Q:Q)||""}:ut,ke,S?I.getValidationProps:I.getInputValidationProps),De=ne?!!ve:E,qe=ne&&ce||l;n.useEffect(()=>{if(!ie||!P)return;const b=ie.disabledStatesRef.current;return b.set(P,J),()=>{b.delete(P)}},[ie,J,P]);const $e=n.useMemo(()=>({...be,checked:De,disabled:J,readOnly:f,required:D,indeterminate:qe}),[be,De,J,f,D,qe]),sa=Ga($e),ia=ea("span",r,{state:$e,ref:[Ke,ge,o,S?.registerControlRef],props:[{id:F?G??void 0:xe,role:"checkbox","aria-checked":ce?"mixed":E,"aria-readonly":f||void 0,"aria-required":D||void 0,"aria-labelledby":Ie,[wr]:v?"":void 0,onFocus(){A(!0)},onBlur(){const b=le.current;b&&(fe(!0),A(!1),Ue==="onBlur"&&I.commit(S?T:b.checked))},onKeyDown(b){if(b.key!=="Enter"||(b.preventBaseUIHandler(),b.defaultPrevented))return;const K=le.current?.form??null,me=b.currentTarget,R=b.nativeEvent,V=b.preventDefault,Ee=R.preventDefault;let Be=!1;b.preventDefault=()=>{Be=!0,V.call(b)},R.preventDefault=()=>{Be=!0,Ee.call(R)},Ee.call(R),pa(me).queueMicrotask(()=>{b.preventDefault=V,R.preventDefault=Ee,Be||gr(K)?.click()})},onClick(b){if(f||J)return;b.preventDefault();const K=le.current;K&&K.dispatchEvent(new(pa(K)).PointerEvent("click",{bubbles:!0,shiftKey:b.shiftKey,ctrlKey:b.ctrlKey,altKey:b.altKey,metaKey:b.metaKey}))}},ke,I.getValidationProps,j,Ne,Ae],stateAttributesMapping:sa});return e.jsxs(Wa.Provider,{value:$e,children:[ia,!E&&!S&&Z&&!v&&z!==void 0&&e.jsx("input",{type:"hidden",form:h,name:Z,value:z}),e.jsx("input",{...ra,suppressHydrationWarning:!0})]})}),jr=n.forwardRef(function(r,o){const{render:g,className:c,style:x,keepMounted:u=!1,...m}=r,h=kr(),y=h.checked||h.indeterminate,{mounted:l,transitionStatus:k,setMounted:C}=qt(y),w=n.useRef(null),v={...h,transitionStatus:k};pt({open:y,ref:w,onComplete(){y||C(!1)}});const N={...Ga(h),...yt,...Ba},D=u||l,z=ea("span",r,{ref:[o,w],state:v,stateAttributesMapping:N,props:m});return D?z:null});function Nr(a,r){return`target:${a}:${r}`}function Cr(a){return`remove:${a.id||a.directory}`}function Qa(a){if(!a)return null;const r=new Date(a).getTime();return Number.isFinite(r)?Math.floor((Date.now()-r)/864e5):null}function Sr(a){const r=Qa(a);if(r==null)return null;if(r<=0)return s("skills.usage.today");if(r<30)return s("skills.usage.days_ago",{days:r});const o=Math.max(1,Math.floor(r/30));return s("skills.usage.months_ago",{months:o})}function _r(a){const r=Qa(a);return r==null?"bg-oai-gray-300 dark:bg-oai-gray-600":r<=7?"bg-emerald-500":r<=30?"bg-amber-500":"bg-oai-gray-300 dark:bg-oai-gray-600"}function oa({label:a,children:r}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2 text-sm",children:[e.jsx("dt",{className:"flex items-center gap-1 text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"text-right font-medium tabular-nums text-oai-black dark:text-white",children:r})]})}function Pr({skill:a,targets:r,busyKey:o,usage:g,hasUpdate:c,updating:x,onUpdate:u,onClose:m,onToggleTarget:h,onRemove:y}){return e.jsx(ft,{children:a?e.jsx(Rr,{skill:a,targets:r,busyKey:o,usage:g,hasUpdate:c,updating:x,onUpdate:u,onClose:m,onToggleTarget:h,onRemove:y},a.id||a.directory):null})}function Rr({skill:a,targets:r,busyKey:o,usage:g,hasUpdate:c,updating:x,onUpdate:u,onClose:m,onToggleTarget:h,onRemove:y}){const l=bt(),{currency:k,rate:C}=Ht(),w=n.useRef(null);n.useEffect(()=>{const j=$=>{$.key==="Escape"&&($.stopPropagation(),m?.())},te=$=>{const H=$.target;H instanceof Element&&(w.current?.contains(H)||H.closest('[data-skill-row="1"]')||m?.())};return document.addEventListener("keydown",j),document.addEventListener("mousedown",te),()=>{document.removeEventListener("keydown",j),document.removeEventListener("mousedown",te)}},[m]);const v=a.name||a.directory,f=!!(a.repoOwner&&a.repoName),N=f?`https://github.com/${a.repoOwner}/${a.repoName}`:null,D=new Set(a.targets||[]),z=o===Cr(a),Q=Sr(g?.lastUsedAt),F=!!(g&&g.invocations>0),de=l?{duration:0}:{type:"spring",stiffness:320,damping:30,mass:.7};return e.jsxs(e.Fragment,{children:[e.jsx(ya.div,{className:"fixed inset-0 z-20 bg-oai-black/30 backdrop-blur-[2px] lg:hidden",initial:l?!1:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:l?0:.15},onClick:m,"aria-hidden":!0}),e.jsxs(ya.aside,{ref:w,role:"complementary","aria-label":v,initial:l?!1:{opacity:0,x:24,scale:.98},animate:{opacity:1,x:0,scale:1},exit:l?{opacity:0}:{opacity:0,x:24,scale:.98},transition:de,className:"fixed inset-x-3 bottom-3 top-20 z-30 flex flex-col overflow-hidden rounded-2xl border border-white/40 bg-white/75 shadow-[0_24px_60px_-20px_rgba(15,23,42,0.25)] backdrop-blur-xl backdrop-saturate-150 supports-[backdrop-filter]:bg-white/65 dark:border-white/10 dark:bg-oai-gray-950/70 dark:shadow-[0_24px_60px_-20px_rgba(0,0,0,0.7)] dark:supports-[backdrop-filter]:bg-oai-gray-950/55 lg:inset-auto lg:right-6 lg:top-24 lg:bottom-6 lg:w-[22rem] lg:max-h-[calc(100vh-7.5rem)]",children:[e.jsxs("header",{className:"flex items-center gap-3 border-b border-white/40 bg-gradient-to-b from-white/30 to-transparent px-5 pb-4 pt-5 dark:border-white/10 dark:from-white/[0.04]",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",title:v,children:v}),f?e.jsxs("a",{href:N,target:"_blank",rel:"noreferrer noopener",className:"mt-1 inline-flex max-w-full items-center gap-1 truncate text-xs text-oai-gray-500 transition-colors hover:text-oai-black hover:underline dark:text-oai-gray-400 dark:hover:text-white",title:N,children:[e.jsxs("span",{className:"truncate",children:[a.repoOwner,"/",a.repoName]}),e.jsx(ua,{className:"h-3 w-3 shrink-0","aria-hidden":!0})]}):a.directory&&a.directory!==v?e.jsx("div",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",title:a.directory,children:a.directory}):null]}),e.jsx("button",{type:"button",onClick:m,"aria-label":s("skills.detail.close"),className:"-mr-1 inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-oai-gray-500 transition hover:bg-oai-gray-100 hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:e.jsx(Se,{className:"h-4 w-4","aria-hidden":!0})})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-5",children:[c?e.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-xl bg-sky-50/80 px-3 py-2.5 ring-1 ring-sky-200 dark:bg-sky-950/30 dark:ring-sky-800/60",children:[e.jsx(Ka,{className:"h-4 w-4 shrink-0 text-sky-600 dark:text-sky-300","aria-hidden":!0}),e.jsx("span",{className:"min-w-0 flex-1 text-xs text-sky-800 dark:text-sky-200",children:s("skills.update.available")}),e.jsxs("button",{type:"button",onClick:()=>u?.(a),disabled:x,className:"inline-flex h-7 shrink-0 items-center gap-1 rounded-md bg-sky-600 px-2.5 text-xs font-semibold text-white transition hover:bg-sky-700 focus:outline-none focus:ring-2 focus:ring-sky-400/40 disabled:cursor-not-allowed disabled:opacity-60 dark:bg-sky-500 dark:hover:bg-sky-400",children:[x?e.jsx(ae,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):null,s("skills.update.action")]})]}):null,a.description?e.jsx("p",{className:"text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:a.description}):null,e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.usage.section_title")}),e.jsxs("dl",{className:"divide-y divide-oai-gray-200/60 dark:divide-white/[0.06]",children:[e.jsx(oa,{label:s("skills.usage.invocations"),children:kt(g?.invocations||0)}),e.jsx(oa,{label:s("skills.usage.last_used"),children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:W("h-1.5 w-1.5 rounded-full",_r(g?.lastUsedAt)),"aria-hidden":!0}),F?Q||s("skills.usage.unknown"):s("skills.usage.never")]})}),e.jsx(oa,{label:e.jsxs(e.Fragment,{children:[s("skills.usage.cost"),e.jsx("span",{title:s("skills.usage.disclaimer"),className:"inline-flex cursor-help text-oai-gray-400 dark:text-oai-gray-500",children:e.jsx(Ra,{className:"h-3 w-3","aria-label":s("skills.usage.disclaimer")})})]}),children:wt(g?.cost||0,{currency:k,rate:C})})]}),F?null:e.jsx("p",{className:"mt-2 text-[11px] leading-4 text-oai-gray-400 dark:text-oai-gray-500",children:s("skills.usage.unused")})]}),e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.detail.sync_section_title")}),e.jsx("div",{children:(r||[]).map(j=>{const te=D.has(j.id),$=o===Nr(a.id,j.id),H=`skill-detail-sync-${a.id||a.directory}-${j.id}`;return e.jsxs("label",{htmlFor:H,className:"-mx-2 flex cursor-pointer items-center gap-3 rounded-md px-2 py-2 text-sm text-oai-black transition-colors hover:bg-oai-gray-100/70 dark:text-white dark:hover:bg-white/[0.05]",children:[e.jsx(vr,{id:H,checked:te,disabled:$,onCheckedChange:X=>h?.(a,j.id,!!X),className:"peer flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border border-oai-gray-300/80 bg-white/80 shadow-sm transition-colors hover:border-oai-gray-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent disabled:cursor-not-allowed disabled:opacity-50 data-[checked]:border-oai-black data-[checked]:bg-oai-black dark:border-oai-gray-500/60 dark:bg-oai-gray-900/60 dark:hover:border-oai-gray-400 dark:data-[checked]:border-white dark:data-[checked]:bg-white",children:e.jsx(jr,{className:"flex items-center justify-center text-white dark:text-oai-black",children:e.jsx(_e,{className:"h-3 w-3",strokeWidth:3.5,"aria-hidden":!0})})}),e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center","aria-hidden":!0,children:e.jsx(ye,{provider:j.id,size:16})}),e.jsx("span",{className:"flex-1",children:j.label}),$?e.jsx(ae,{className:"h-3.5 w-3.5 animate-spin text-oai-gray-400","aria-hidden":!0}):null]},j.id)})})]})]}),e.jsxs("footer",{className:"border-t border-white/40 bg-white/30 px-5 py-4 dark:border-white/10 dark:bg-white/[0.02]",children:[e.jsxs("button",{type:"button",onClick:()=>y?.(a),disabled:z,className:"inline-flex w-full items-center justify-center gap-2 rounded-lg border border-red-200/70 bg-white px-3 py-2 text-sm font-medium text-red-600 transition hover:border-red-300 hover:bg-red-50 focus:outline-none focus:ring-2 focus:ring-red-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:border-red-900/60 dark:bg-oai-gray-950 dark:text-red-300 dark:hover:border-red-800 dark:hover:bg-red-950/30",children:[z?e.jsx(ae,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ma,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("skills.detail.remove_button")]}),e.jsx("p",{className:"mt-2 text-center text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.detail.remove_confirm_hint")})]})]})]})}const Lr=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),la=["claude","codex"],O="popular",Ir={claude:"text-orange-500 dark:text-orange-300",codex:"text-emerald-600 dark:text-emerald-300",grok:"text-zinc-700 dark:text-zinc-200",antigravity:"text-violet-600 dark:text-violet-300",gemini:"text-sky-600 dark:text-sky-300",opencode:"text-amber-600 dark:text-amber-300",hermes:"text-indigo-500 dark:text-indigo-300"},he="all",B="skillssh";function Ze(a){return`${a.repoOwner||"local"}/${a.repoName||"local"}:${a.directory}`}function Xa(a){return String(a||"").replace(/\\/g,"/").trim().toLowerCase()}function Dr(a){return Xa(a).split("/").filter(Boolean).pop()||""}function $r(a){if(a.repoOwner||a.repoName)return"";const r=Xa(a.directory);return!r||r.includes("/")?"":`dir:${r}`}function Ca(a){const r=Dr(a.directory);return r?`dir:${r}`:""}function Sa(a){const r=new Set([Ze(a).toLowerCase()]);a.repoOwner&&a.repoName&&r.add(`${a.repoOwner}/${a.repoName}:${a.sourceDirectory||a.directory}`.toLowerCase());const o=$r(a);return o&&r.add(o),r}function We(a){return`install:${Ze(a)}`}function _a(a){return`remove:${a.id||a.directory}`}function Ya(a,r){return`target:${a}:${r}`}function Er({target:a,state:r,busy:o,onToggle:g}){const c=r==="synced",x=r==="orphan",u=x?s("skills.dot.orphan_aria",{agent:a.label}):c?s("skills.dot.synced_aria",{agent:a.label}):s("skills.dot.off_aria",{agent:a.label});return e.jsxs("button",{type:"button",title:u,"aria-label":u,"aria-pressed":c,disabled:o,onClick:m=>{m.stopPropagation(),g?.(a.id,!c)},className:"relative flex h-7 w-7 items-center justify-center rounded-md transition-colors hover:bg-oai-gray-100 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/40 disabled:cursor-not-allowed dark:hover:bg-oai-gray-800/60",children:[o?e.jsx(ae,{className:"h-4 w-4 animate-spin text-oai-gray-400","aria-hidden":!0}):e.jsx("span",{className:W("flex h-[18px] w-[18px] items-center justify-center transition",c&&Ir[a.id],!c&&!x&&"opacity-35 grayscale"),"aria-hidden":!0,children:e.jsx(ye,{provider:a.id,size:18})}),x&&!o?e.jsx("span",{className:"absolute -bottom-px -right-px h-2 w-2 rounded-full bg-amber-500 ring-2 ring-oai-white dark:ring-oai-gray-900","aria-hidden":!0}):null]})}function Br({skill:a,targets:r,onToggleTarget:o,busyKey:g}){return e.jsx("div",{className:"flex items-center gap-1",onClick:c=>c.stopPropagation(),children:r.map(c=>e.jsx(Er,{target:c,state:a.targetStates?.[c.id]||"off",busy:g===Ya(a.id,c.id),onToggle:(x,u)=>o?.(a,x,u)},c.id))})}function Mr({skill:a,targets:r,selected:o,onSelect:g,selectable:c,checked:x,onToggleSelect:u,onToggleTarget:m,hasUpdate:h,busyKey:y}){const l=a.repoOwner&&a.repoName?`${a.repoOwner}/${a.repoName}`:null,k=l?`${a.directory} · ${l}`:a.directory,C=w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),g?.(a))};return e.jsxs("div",{"data-skill-row":"1",role:"button",tabIndex:0,"aria-pressed":o,"aria-label":s("skills.row.open_details",{name:a.name||a.directory}),onClick:()=>g?.(a),onKeyDown:C,className:W("cursor-pointer rounded-md py-3 pr-2 transition focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30",o?"bg-oai-gray-100 ring-1 ring-oai-gray-200 dark:bg-oai-gray-800/60 dark:ring-oai-gray-800":x?"bg-oai-gray-50 dark:bg-oai-gray-900/40":"hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/40"),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[c?e.jsx("label",{className:"flex shrink-0 items-center",onClick:w=>w.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:x,onChange:w=>u?.(a,w.target.checked),"aria-label":s("skills.select.row_aria",{name:a.name||a.directory}),className:"h-4 w-4 rounded border-oai-gray-300 text-oai-black focus:ring-oai-gray-400 dark:border-oai-gray-600 dark:bg-oai-gray-900 dark:text-white"})}):null,e.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-oai-black dark:text-white",title:k,children:a.name||a.directory}),h?e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-sky-50 px-1.5 py-0.5 text-[10px] font-semibold text-sky-700 ring-1 ring-sky-200 dark:bg-sky-950/40 dark:text-sky-300 dark:ring-sky-800/60",children:[e.jsx(Ka,{className:"h-2.5 w-2.5","aria-hidden":!0}),s("skills.update.badge")]}):null,e.jsx(Br,{skill:a,targets:r,onToggleTarget:m,busyKey:y}),e.jsx(Gt,{className:W("hidden h-4 w-4 shrink-0 text-oai-gray-300 transition-colors dark:text-oai-gray-600 lg:block",o&&"text-oai-gray-500 dark:text-oai-gray-300"),"aria-hidden":!0})]}),a.description?e.jsx("p",{className:W("mt-1 line-clamp-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",c&&"pl-7"),children:a.description}):null]})}function Tr({agentFilter:a,agentOptions:r,onAgentFilter:o,filteredCount:g,totalCount:c,anyFilter:x,onClearFilters:u,searchQuery:m,onSearchQuery:h,searchPlaceholder:y}){return e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 pt-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsxs(Ma,{value:a,onValueChange:o,children:[e.jsxs(Ta,{"aria-label":s("skills.filter.agent_label"),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200 dark:hover:border-oai-gray-700",children:[e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:[s("skills.filter.agent_label"),":"]}),e.jsx(Oa,{children:l=>l==="all"?s("skills.filter.agent_all"):r.find(k=>k.id===l)?.label||l}),e.jsx(qa,{className:"text-oai-gray-400",children:e.jsx(ga,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx(Ua,{children:e.jsx(za,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Fa,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs(Xe,{value:"all",className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Ye,{children:s("skills.filter.agent_all")}),e.jsx(Je,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),r.map(l=>e.jsxs(Xe,{value:l.id,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ye,{provider:l.id,size:14}),e.jsx(Ye,{children:l.label})]}),e.jsx(Je,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},l.id))]})})})]}),e.jsxs("div",{className:"relative w-56 max-w-full",children:[e.jsx(ca,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx(ha,{type:"search",value:m,onChange:l=>h(l.target.value),onKeyDown:l=>{l.key==="Escape"&&m&&(l.preventDefault(),h(""))},"aria-label":s("skills.action.search_aria"),placeholder:y,className:"h-8 pl-9 pr-8 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20 [&::-webkit-search-cancel-button]:appearance-none"}),e.jsx("button",{type:"button",onMouseDown:l=>l.preventDefault(),onClick:()=>h(""),"aria-label":s("skills.action.search_clear"),"aria-hidden":!m,tabIndex:m?0:-1,className:W("absolute right-2 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-full text-oai-gray-400 transition duration-150 ease-out before:absolute before:-inset-1.5 before:content-[''] hover:bg-oai-gray-100 hover:text-oai-gray-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 motion-reduce:transition-none dark:hover:bg-oai-gray-800 dark:hover:text-oai-gray-200",m?"scale-100 opacity-100":"pointer-events-none scale-90 opacity-0"),children:e.jsx(Se,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx("span",{role:"status","aria-live":"polite",className:"ml-auto shrink-0 tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.filter.result_count",{filtered:g,total:c})}),x?e.jsxs("button",{type:"button",onClick:u,className:"shrink-0 inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),s("skills.filter.clear")]}):null]})}function Or({count:a,targets:r,busy:o,onBulkSync:g,onBulkRemove:c,onClear:x}){return e.jsxs("div",{role:"toolbar","aria-label":s("skills.select.toolbar_aria"),className:"mb-2 flex flex-wrap items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-3 py-2 dark:border-oai-gray-800 dark:bg-oai-gray-900/50",children:[e.jsx("span",{className:"text-xs font-medium text-oai-gray-700 dark:text-oai-gray-200","aria-live":"polite",children:s("skills.select.count",{count:a})}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsxs(La,{children:[e.jsxs(Ia,{disabled:o,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:opacity-60 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200",children:[e.jsx(Aa,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("skills.select.bulk_sync"),e.jsx(ga,{className:"h-3 w-3","aria-hidden":!0})]}),e.jsx(Da,{children:e.jsx($a,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(Ea,{className:"min-w-[200px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[e.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.select.bulk_sync_hint")}),r.map(u=>e.jsxs("button",{type:"button",onClick:()=>g(u.id),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-oai-black hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800",children:[e.jsx(ye,{provider:u.id,size:16}),e.jsx("span",{className:"flex-1",children:u.label})]},u.id))]})})})]}),e.jsxs(U,{type:"button",variant:"ghost",size:"sm",disabled:o,onClick:c,children:[e.jsx(ma,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),s("skills.select.bulk_remove")]}),e.jsxs("button",{type:"button",onClick:x,className:"inline-flex h-7 items-center gap-1 rounded-full px-2 text-[11px] font-medium text-oai-gray-500 transition hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:text-white",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),s("skills.select.clear")]})]})]})}function Ur({items:a,totalCount:r,targets:o,agentOptions:g,agentFilter:c,onAgentFilter:x,anyFilter:u,onClearFilters:m,searchQuery:h,onSearchQuery:y,searchPlaceholder:l,selectedId:k,onSelect:C,onToggleTarget:w,busyKey:v,updates:f,selectedIds:N,onToggleSelect:D,onClearSelection:z,onBulkSync:Q,onBulkRemove:F}){const de=N.size;return e.jsxs("div",{children:[de>0?e.jsx(Or,{count:de,targets:o,busy:v==="batch",onBulkSync:Q,onBulkRemove:F,onClear:z}):e.jsx(Tr,{agentFilter:c,agentOptions:g,onAgentFilter:x,filteredCount:a.length,totalCount:r,anyFilter:u,onClearFilters:m,searchQuery:h,onSearchQuery:y,searchPlaceholder:l}),a.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[e.jsx("p",{children:s("skills.empty.no_match")}),e.jsx(U,{type:"button",variant:"secondary",size:"sm",onClick:m,children:s("skills.filter.clear")})]}):e.jsx("div",{className:"divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:a.map(j=>e.jsx(Mr,{skill:j,targets:o,selected:k===(j.id||j.directory),onSelect:C,selectable:!0,checked:N.has(j.id),onToggleSelect:D,onToggleTarget:w,hasUpdate:!!(j.id&&f?.[j.id]),busyKey:v},j.id||j.key))})]})}const zr={contentVisibility:"auto",containIntrinsicSize:"0 240px"},Fr=Lt.memo(function({skill:r,installed:o,installing:g,allTargets:c,defaultTargets:x,onInstall:u,onManage:m}){const[h,y]=n.useState(()=>(x||[]).filter(f=>c.some(N=>N.id===f))),l=f=>{y(N=>N.includes(f)?N.filter(D=>D!==f):[...N,f])},k=r.repoOwner&&r.repoName?`${r.repoOwner}/${r.repoName}`:null,C=k?`https://github.com/${r.repoOwner}/${r.repoName}`:null,w=r.installs!=null?s("skills.card.installs",{count:Number(r.installs||0).toLocaleString()}):null,v=h.length?h.map(f=>c.find(N=>N.id===f)?.label||f).join(", "):s("skills.action.choose_targets");return e.jsxs(Mt,{className:"h-full rounded-lg",bodyClassName:"flex h-full flex-col",children:[e.jsx("div",{className:"flex items-start justify-between gap-3",children:e.jsxs("div",{className:"min-w-0",children:[r.readmeUrl?e.jsxs("a",{href:r.readmeUrl,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex max-w-full items-center gap-1 truncate text-base font-semibold text-oai-black hover:underline dark:text-white",title:r.readmeUrl,children:[e.jsx("span",{className:"truncate",children:r.name||r.directory}),e.jsx(ua,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400 opacity-0 transition-opacity group-hover:opacity-100","aria-hidden":!0})]}):e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:r.name||r.directory}),k||w?e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-1.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[C?e.jsxs("a",{href:C,target:"_blank",rel:"noopener noreferrer",onClick:f=>f.stopPropagation(),className:"inline-flex items-center gap-1 truncate rounded text-oai-gray-500 hover:text-oai-black hover:underline focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:text-white",title:C,children:[e.jsx("span",{className:"truncate",children:k}),e.jsx(ua,{className:"h-2.5 w-2.5 shrink-0","aria-hidden":!0})]}):null,k&&w?e.jsx("span",{"aria-hidden":!0,children:"·"}):null,w?e.jsx("span",{className:"truncate",children:w}):null]}):null]})}),r.description?e.jsx("p",{className:"mt-3 line-clamp-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:r.description}):null,e.jsx("div",{className:"mt-auto pt-5",children:o?e.jsxs(U,{type:"button",variant:"secondary",size:"sm",onClick:()=>m?.(r),className:"w-full",children:[e.jsx(_e,{className:"mr-1.5 h-3.5 w-3.5 text-emerald-500 dark:text-emerald-400","aria-hidden":!0}),s("skills.card.manage")]}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.card.targets_prefix")}),e.jsx("span",{className:"min-w-0 truncate font-medium text-oai-black dark:text-white",children:h.length?v:s("skills.target.none")}),e.jsxs(La,{children:[e.jsx(Ia,{disabled:g,"aria-label":s("skills.action.choose_targets"),className:"rounded text-xs font-medium text-oai-gray-500 underline decoration-oai-gray-300 decoration-dotted underline-offset-2 transition hover:text-oai-black hover:decoration-oai-gray-500 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:text-oai-gray-400 dark:decoration-oai-gray-600 dark:hover:text-white dark:hover:decoration-oai-gray-400",children:s("skills.card.targets_change")}),e.jsx(Da,{children:e.jsx($a,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(Ea,{className:"min-w-[220px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[e.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.target.menu_label")}),c.map(f=>{const N=h.includes(f.id);return e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm text-oai-black hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800",children:[e.jsx("input",{type:"checkbox",className:"h-4 w-4 shrink-0 rounded border-oai-gray-300 text-oai-black focus:ring-oai-gray-400 dark:border-oai-gray-600 dark:bg-oai-gray-900 dark:text-white",checked:N,onChange:()=>l(f.id)}),e.jsx(ye,{provider:f.id,size:16}),e.jsx("span",{className:"flex-1 text-left",children:f.label})]},f.id)})]})})})]})]}),e.jsxs(U,{type:"button",size:"sm",onClick:()=>u(r,h),disabled:g||h.length===0,className:"w-full",children:[g?e.jsx(ae,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(Aa,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),s("skills.action.install")]})]})})]})});function Ar({repos:a,repoInput:r,onRepoInput:o,busyKey:g,onAdd:c,onRemove:x}){return e.jsxs("div",{className:"rounded-lg border border-oai-gray-200 bg-white p-4 dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsx(ha,{value:r,onChange:u=>o(u.target.value),placeholder:s("skills.repo.placeholder"),className:"min-w-0 flex-1"}),e.jsxs(U,{type:"button",variant:"secondary",size:"md",onClick:c,disabled:g==="repo:add",className:"shrink-0 whitespace-nowrap",children:[g==="repo:add"?e.jsx(ae,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(Va,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),s("skills.repo.add")]})]}),a.length?e.jsx("div",{className:"mt-3 divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:a.map(u=>{const m=g===`repo:${u.owner}/${u.name}`;return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"truncate text-sm font-medium text-oai-black dark:text-white",children:[u.owner,"/",u.name]}),e.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:u.branch})]}),e.jsxs(U,{type:"button",variant:"ghost",size:"sm",disabled:m,onClick:()=>x(u),className:"shrink-0",children:[m?e.jsx(ae,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ma,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{className:"sr-only",children:s("skills.repo.remove")})]})]},`${u.owner}/${u.name}`)})}):null]})}function Kr(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function as(){const[a,r]=n.useState(Kr),[o,g]=n.useState({skills:[],targets:[]}),[c,x]=n.useState([]),[u,m]=n.useState([]),[h,y]=n.useState([]),[l,k]=n.useState(he),[C,w]=n.useState(""),[v,f]=n.useState(""),[N,D]=n.useState(""),[z,Q]=n.useState(""),[F,de]=n.useState(""),[j,te]=n.useState(!1),[$,H]=n.useState("all"),[X,re]=n.useState(null),[A,fe]=n.useState(""),[be,Ue]=n.useState(!0),[Pe,ze]=n.useState(!1),[Fe,M]=n.useState(""),[se,Re]=n.useState(null),[Y,ke]=n.useState(null),[S,ie]=n.useState(()=>new Set),[ne,J]=n.useState({}),[Z,P]=n.useState({}),[xe,aa]=n.useState([]),[G,we]=n.useState(!1),ve=n.useRef(!1),ce=n.useMemo(()=>{const t=new Set;for(const i of o.skills||[])for(const d of Sa(i))t.add(d);return t},[o.skills]),je=n.useCallback(async()=>{const t=await vt();g({skills:t.skills||[],targets:t.targets||[]})},[]),Ne=n.useCallback(async()=>{const t=await jt();y(t.repos||[])},[]),T=n.useCallback(async({force:t=!1}={})=>{ze(!0);try{const i=await Nt({force:t});x(i.skills||[])}finally{ze(!1)}},[]),pe=n.useCallback(async({force:t=!1}={})=>{we(!0);try{const i=await Ct({force:t});aa(i.skills||[])}finally{we(!1)}},[]),ue=n.useCallback(async()=>{try{const t=await St();J(t?.updates||{})}catch{J({})}},[]),ge=n.useCallback(async()=>{try{const t=await _t(),i={};for(const d of t?.skills||[])d.installed&&(d.directory&&(i[String(d.directory).toLowerCase()]=d),i[String(d.skill).toLowerCase()]=d);P(i)}catch{P({})}},[]),oe=n.useCallback(async()=>{Ue(!0),M("");try{await Promise.all([je(),Ne()])}catch(t){M(t?.message||s("skills.error.generic"))}finally{Ue(!1)}},[je,Ne]),Le=n.useCallback(async()=>{await oe();const t=i=>M(i?.message||s("skills.error.generic"));a==="my"?(ue(),ge()):l===O?pe({force:!0}).catch(t):l!==B&&T({force:!0}).catch(t)},[T,oe,pe,ue,ge,l,a]);n.useEffect(()=>{oe()},[oe]),n.useEffect(()=>{if(ve.current||typeof window>"u")return;const t=new URLSearchParams(window.location.search),i=t.get("skill");if(!i){ve.current=!0;return}const d=o.skills||[];if(!d.length)return;const p=d.find(_=>_.directory===i||_.id===i);p&&(r("my"),re(p.id||p.directory)),ve.current=!0,t.delete("skill");const L=t.toString();window.history.replaceState({},"",`${window.location.pathname}${L?`?${L}`:""}${window.location.hash}`)},[o.skills]),n.useEffect(()=>{a==="browse"&&(l===B||l===O||c.length===0&&T().catch(t=>M(t?.message||s("skills.error.generic"))))},[c.length,T,l,a]),n.useEffect(()=>{a!=="browse"||l!==O||xe.length===0&&pe().catch(t=>M(t?.message||s("skills.error.generic")))},[pe,xe.length,l,a]);const Ae=Object.keys(ne).length>0,Ke=Object.keys(Z).length>0;if(n.useEffect(()=>{a==="my"&&(Ae||ue(),Ke||ge())},[a,Ae,Ke,ue,ge]),n.useEffect(()=>{const t=setTimeout(()=>f(C),200);return()=>clearTimeout(t)},[C]),n.useEffect(()=>{const t=setTimeout(()=>Q(N),120);return()=>clearTimeout(t)},[N]),n.useEffect(()=>{if(typeof window>"u")return;const t=new URLSearchParams(window.location.search),i=t.get("tab");if(a==="my"){if(!i)return;t.delete("tab")}else{if(i===a)return;t.set("tab",a)}const d=t.toString(),p=`${window.location.pathname}${d?`?${d}`:""}${window.location.hash}`;window.history.replaceState({},"",p)},[a]),!Lr&&!Pt())return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(Bt,{})});const I=async(t,i)=>{fe(t),M("");try{await i(),await je()}catch(d){M(d?.message||s("skills.error.generic"))}finally{fe("")}},E=(t,i)=>{const d=(i&&i.length?i:la).filter(p=>(o.targets||[]).some(L=>L.id===p));I(We(t),async()=>{await fa(t,d);const p=d.map(L=>(o.targets||[]).find(_=>_.id===L)?.label||L).join(", ");Ce({title:s("skills.toast.installed",{name:t.name||t.directory,targets:p||s("skills.target.none")}),timeout:4e3})})},ta=t=>{Re(t)},le=()=>{const t=se;t&&(Re(null),I(_a(t),async()=>{let i=null;t.managed?i=await ba(t.id):await ka(t.directory,t.targets||[]);const d=!!(i?.trashed&&t.managed&&t.id);Ce({title:s("skills.toast.removed",{name:t.name||t.directory}),timeout:6e3,data:d?{onUndo:async()=>{try{await Dt(t.id),await je()}catch(p){M(p?.message||s("skills.error.generic"))}}}:void 0})}))},Ve=(t,i,d)=>I(Ya(t.id,i),async()=>{const p=new Set(t.targets||[]);d?p.add(i):p.delete(i),t.managed?await wa(t.id,Array.from(p)):await va(t.directory,Array.from(p));const L={name:t.name||t.directory,agent:De(i)};Ce({title:d?s("skills.toast.synced_one",L):s("skills.toast.unsynced_one",L),timeout:3e3})}),Ie=n.useCallback(()=>ie(new Set),[]),ra=n.useCallback((t,i)=>{ie(d=>{const p=new Set(d);return i?p.add(t.id):p.delete(t.id),p})},[]),De=t=>(o.targets||[]).find(i=>i.id===t)?.label||t,qe=t=>{const i=(o.skills||[]).filter(d=>S.has(d.id));i.length&&I("batch",async()=>{for(const d of i){const p=new Set(d.targets||[]);p.add(t),d.managed?await wa(d.id,Array.from(p)):await va(d.directory,Array.from(p))}Ie(),Ce({title:s("skills.toast.bulk_synced",{count:i.length,agent:De(t)}),timeout:4e3})})},$e=()=>{const t=(o.skills||[]).filter(i=>S.has(i.id));t.length&&ke(t)},sa=()=>{const t=Y;t&&(ke(null),I("batch",async()=>{for(const i of t)i.managed?await ba(i.id):await ka(i.directory,i.targets||[]);Ie(),Ce({title:s("skills.toast.bulk_removed",{count:t.length}),timeout:4e3})}))},ia=t=>{!t?.repoOwner||!t?.repoName||I(We(t),async()=>{await fa({key:t.key,name:t.name,description:t.description,directory:t.sourceDirectory||t.directory,repoOwner:t.repoOwner,repoName:t.repoName,repoBranch:t.repoBranch,readmeUrl:t.readmeUrl},t.targets&&t.targets.length?t.targets:la),await ue(),Ce({title:s("skills.toast.updated",{name:t.name||t.directory}),timeout:4e3})})},b=async()=>{const t=C.trim();if(!(t.length<2)){fe("search"),M("");try{const i=await It(t);m(i.skills||[])}catch(i){M(i?.message||s("skills.error.generic"))}finally{fe("")}}},K=async()=>{const t=F.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[i,d]=t.split("/");if(!i||!d){M(s("skills.repo.invalid"));return}await I("repo:add",async()=>{await Et({owner:i,name:d,branch:"main",enabled:!0}),de(""),await Ne(),await T()})},me=async t=>{await I(`repo:${t.owner}/${t.name}`,async()=>{await $t(t.owner,t.name),await Ne(),await T()})},R=o.targets||[],V=o.skills||[],Ee=n.useMemo(()=>{const t=$==="all"?V:V.filter(d=>(d.targets||[]).includes($)),i=z.trim().toLowerCase();return i?t.filter(d=>(d.name||"").toLowerCase().includes(i)||(d.directory||"").toLowerCase().includes(i)||(d.description||"").toLowerCase().includes(i)):t},[V,$,z]),Be=$!=="all",ee=n.useMemo(()=>X&&V.find(t=>(t.id||t.directory)===X)||null,[V,X]),Ja=n.useCallback(()=>{H("all"),D("")},[]),Za=n.useCallback(t=>{re(i=>{const d=t?.id||t?.directory||null;return i===d?null:d})},[]),et=n.useCallback(()=>re(null),[]),at=n.useCallback(t=>{const i=Ze(t).toLowerCase(),d=Ca(t),p=(o.skills||[]).find(L=>{const _=Sa(L);return _.has(i)||d&&_.has(d)});p&&re(p.id||p.directory)},[o.skills]);n.useEffect(()=>{a!=="my"&&S.size&&ie(new Set)},[a,S.size]),n.useEffect(()=>{X&&!ee&&re(null)},[ee,X]);const Me=n.useMemo(()=>{const t=l===B?u:l===O?xe:c,d=l===B||l===O||l===he?t:t.filter(_=>`${_.repoOwner}/${_.repoName}`===l),p=v.trim().toLowerCase();return(l===B||!p?d:d.filter(_=>(_.name||"").toLowerCase().includes(p)||(_.directory||"").toLowerCase().includes(p)||(_.description||"").toLowerCase().includes(p))).map(_=>{const na=Ze(_).toLowerCase(),q=Ca(_);return{..._,installed:ce.has(na)||q&&ce.has(q)}})},[v,c,ce,xe,u,l]),tt=e.jsx("div",{className:"flex h-64 items-center justify-center",children:e.jsx(ae,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0})}),rt=e.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 px-6 text-center",children:[e.jsx(ae,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0}),e.jsx("p",{className:"max-w-md text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.browse.loading_hint")})]}),He=(t,i=null)=>e.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[e.jsx("p",{children:s(t)}),i]});let Ge;if(be)Ge=tt;else if(a==="my")Ge=V.length?e.jsx(Ur,{items:Ee,totalCount:V.length,targets:R,agentOptions:R,agentFilter:$,onAgentFilter:H,anyFilter:Be,onClearFilters:Ja,searchQuery:N,onSearchQuery:D,searchPlaceholder:s("skills.my.placeholder"),selectedId:X,onSelect:Za,onToggleTarget:Ve,busyKey:A,updates:ne,selectedIds:S,onToggleSelect:ra,onClearSelection:Ie,onBulkSync:qe,onBulkRemove:$e}):e.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center dark:border-oai-gray-800",children:[R.length>0?e.jsxs("div",{className:"relative h-11 w-80 overflow-hidden","aria-hidden":!0,children:[e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)",WebkitMaskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)"},children:e.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",style:{filter:"blur(2.5px)"},children:[...R,...R].map((t,i)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(ye,{provider:t.id,size:30})},`b-${i}`))})}),e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)",WebkitMaskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)"},children:e.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",children:[...R,...R].map((t,i)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(ye,{provider:t.id,size:30})},`c-${i}`))})}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 w-20 bg-gradient-to-r from-oai-white to-transparent dark:from-oai-gray-900"}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 w-20 bg-gradient-to-l from-oai-white to-transparent dark:from-oai-gray-900"})]}):null,e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("skills.empty.my")}),e.jsx(U,{type:"button",size:"sm",onClick:()=>r("browse"),children:s("skills.empty.my_cta")})]});else{const t=l===B,i=l===O,d=h.length===0&&!t&&!i,p=Pe&&!t&&!i||i&&G,L=!t&&!i&&(v.trim()!==""||l!==he),_=()=>{w(""),k(he)},na=!d&&!p&&(Me.length>0||L)?e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 px-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:s("skills.filter.result_count_browse",{count:Me.length})}),L?e.jsxs("button",{type:"button",onClick:_,className:"ml-auto inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),s("skills.filter.clear")]}):null]}):null;let q;d?q=e.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 p-6 text-center dark:border-oai-gray-800",children:e.jsx("p",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:s("skills.browse.empty_sources")})}):p?q=rt:t&&C.trim().length<2?q=e.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 px-4 py-6 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:s("skills.browse.hint_skillssh")}):Me.length?q=e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Me.map(Te=>e.jsx("div",{style:zr,children:e.jsx(Fr,{skill:Te,installed:!!Te.installed,installing:A===We(Te),allTargets:R,defaultTargets:la,onInstall:E,onManage:at})},Te.id||Te.key))}):L?q=He("skills.empty.no_match",e.jsx(U,{type:"button",variant:"secondary",size:"sm",onClick:_,children:s("skills.filter.clear")})):t?q=He("skills.empty.search"):i?q=He("skills.empty.popular"):q=He("skills.empty.browse");const st=d||j?e.jsx("div",{className:"mb-5",children:e.jsx(Ar,{repos:h,repoInput:F,onRepoInput:de,busyKey:A,onAdd:K,onRemove:me})}):null,it=!j&&!t&&!i&&h.length<=1&&Me.length>0?e.jsx(ur,{id:"skills-browse-intro",className:"mt-6",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[e.jsx("span",{children:s("skills.browse.add_repo_hint")}),e.jsx("button",{type:"button",onClick:()=>te(!0),className:"rounded font-medium text-oai-gray-700 underline decoration-dotted underline-offset-2 transition hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-200 dark:hover:text-white",children:s("skills.browse.manage_sources")})]})}):null;Ge=e.jsxs(e.Fragment,{children:[st,na,q,it]})}return e.jsxs("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:[e.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-6 flex items-end justify-between gap-4",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("skills.page.title")}),e.jsxs(U,{type:"button",variant:"secondary",size:"sm",onClick:Le,disabled:be||Pe||G,children:[e.jsx(Rt,{className:W("mr-1.5 h-3.5 w-3.5",(be||Pe||G)&&"animate-spin"),"aria-hidden":!0}),s("skills.action.refresh")]})]}),e.jsx("div",{className:"mb-5 flex gap-6 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[["my",s("skills.tab.my")],["browse",s("skills.tab.browse")]].map(([t,i])=>e.jsx("button",{type:"button","aria-pressed":a===t,onClick:()=>r(t),className:W("-mb-px border-b-2 pb-2 text-sm font-medium transition-colors",a===t?"border-oai-black text-oai-black dark:border-white dark:text-white":"border-transparent text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:i},t))}),Fe?e.jsx("div",{className:"mb-4 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-200",children:Fe}):null,a==="browse"?e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx("div",{role:"tablist","aria-label":s("skills.source.label"),className:"inline-flex h-10 shrink-0 items-center rounded-md border border-oai-gray-200 bg-oai-white p-1 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:[["repo",s("skills.mode.repo"),l!==B&&l!==O],["popular",s("skills.mode.popular"),l===O],["skillssh",s("skills.mode.skillssh"),l===B]].map(([t,i,d])=>e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>{t==="skillssh"?k(B):t==="popular"?k(O):(l===B||l===O)&&k(he)},className:W("inline-flex items-center gap-1.5 rounded px-3 py-1 text-sm font-medium transition-colors",d?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-700 dark:text-white":"text-oai-gray-500 hover:text-oai-gray-800 dark:text-oai-gray-400 dark:hover:text-oai-gray-200"),children:[t==="popular"?e.jsx(ir,{className:"h-3.5 w-3.5","aria-hidden":!0}):null,i]},t))}),l!==B&&l!==O?e.jsxs(Ma,{value:l,onValueChange:k,children:[e.jsxs(Ta,{"aria-label":s("skills.source.label"),className:"inline-flex h-10 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-oai-white px-3 text-sm text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[e.jsx(Oa,{children:t=>t===he?s("skills.source.all"):t}),e.jsx(qa,{className:"text-oai-gray-400",children:e.jsx(ga,{className:"h-4 w-4","aria-hidden":!0})})]}),e.jsx(Ua,{children:e.jsx(za,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Fa,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none transition-[opacity,transform] duration-150 ease-out data-[ending-style]:scale-[0.97] data-[ending-style]:opacity-0 data-[starting-style]:scale-[0.97] data-[starting-style]:opacity-0 dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs(Xe,{value:he,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Ye,{children:s("skills.source.all")}),e.jsx(Je,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),h.map(t=>{const i=`${t.owner}/${t.name}`;return e.jsxs(Xe,{value:i,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Ye,{children:i}),e.jsx(Je,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},i)})]})})})]}):null,e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ca,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx(ha,{type:"search",value:C,onChange:t=>w(t.target.value),onKeyDown:t=>{t.key==="Enter"&&l===B&&b()},"aria-label":s("skills.action.search_aria"),placeholder:l===B?s("skills.browse.placeholder_skillssh"):l===O?s("skills.browse.placeholder_popular"):l===he?s("skills.browse.placeholder_all"):s("skills.browse.placeholder_repo",{repo:l}),className:"pl-9 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20"})]}),l===B?e.jsxs(U,{type:"button",onClick:b,disabled:C.trim().length<2||A==="search",className:"focus:!ring-oai-gray-400/30",children:[A==="search"?e.jsx(ae,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(ca,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),s("skills.action.search")]}):l===O?null:e.jsxs(U,{type:"button",variant:"secondary",size:"sm",onClick:()=>te(t=>!t),"aria-expanded":j,className:"!h-10 shrink-0 whitespace-nowrap !border-oai-gray-200 dark:!border-oai-gray-800 hover:!border-oai-gray-300 dark:hover:!border-oai-gray-700 hover:!text-oai-black dark:hover:!text-white focus:!ring-oai-gray-400/30",children:[e.jsx(Va,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),s("skills.browse.manage_sources"),e.jsx("span",{className:"ml-1.5 rounded bg-oai-gray-100 px-1.5 py-0.5 text-xs font-medium text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-300",children:h.length})]})]}):null,Ge,e.jsx(Pr,{skill:ee,targets:R,busyKey:A,usage:ee&&(Z[String(ee.directory||"").toLowerCase()]||Z[String(ee.name||"").toLowerCase()])||null,hasUpdate:!!(ee?.id&&ne?.[ee.id]),updating:ee?A===We(ee):!1,onUpdate:ia,onClose:et,onToggleTarget:Ve,onRemove:ta})]})}),e.jsx(ja,{open:!!se,title:s("skills.confirm.remove_title",{name:se?.name||se?.directory||""}),description:se?se.managed?s("skills.confirm.remove_managed"):s("skills.confirm.remove_local"):"",confirmLabel:s("skills.action.remove"),cancelLabel:s("shared.action.cancel"),destructive:!0,busy:A===_a(se||{}),onCancel:()=>Re(null),onConfirm:le}),e.jsx(ja,{open:!!Y,title:s("skills.confirm.bulk_remove_title",{count:Y?.length||0}),description:s("skills.confirm.bulk_remove_desc"),confirmLabel:s("skills.action.remove"),cancelLabel:s("shared.action.cancel"),destructive:!0,busy:A==="batch",onCancel:()=>ke(null),onConfirm:sa})]})}export{as as SkillsPage};
|