@juejin-opensource/jusage 0.1.1-beta.8 → 0.1.1-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  import { spawnSync } from 'node:child_process';
2
+ import { homedir } from 'node:os';
2
3
  import { ensureDaemonLogDir, resolveServiceCommand } from './daemon.js';
3
4
  export const WINDOWS_TASK_NAME = 'jusage';
4
5
  /** Previous scheduled-task name; remove on start/stop so upgrades do not leave two daemons. */
@@ -26,7 +27,7 @@ export async function registerWindowsAutostart(cliBinPath, dataDir) {
26
27
  const script = `
27
28
  $ErrorActionPreference = 'Stop'
28
29
  $taskName = ${psQuote(WINDOWS_TASK_NAME)}
29
- $action = New-ScheduledTaskAction -Execute ${psQuote(nodePath)} -Argument ${psQuote(argument)}
30
+ $action = New-ScheduledTaskAction -Execute ${psQuote(nodePath)} -Argument ${psQuote(argument)} -WorkingDirectory ${psQuote(homedir())}
30
31
  $trigger = New-ScheduledTaskTrigger -AtLogOn
31
32
  $settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable -ExecutionTimeLimit ([TimeSpan]::Zero) -RestartCount 3 -RestartInterval (New-TimeSpan -Minutes 1)
32
33
  $principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -LogonType Interactive -RunLevel Limited
package/dist/service.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { platform } from 'node:os';
2
2
  import { DEFAULT_DATA_DIR, DEFAULT_PORT, getRunningOwner, loadConfig, runtimeKindLabel, touchStatsSince, } from '@juejin-opensource/jusage-core';
3
- import { clearPid, stopPid, waitForPid, } from './daemon.js';
3
+ import { clearPid, daemonLogPath, readDaemonLogTail, stopPid, waitForServiceReady, } from './daemon.js';
4
4
  import { isMacosAutostartRegistered, registerMacosAutostart, unregisterMacosAutostart, } from './service-macos.js';
5
5
  import { isWindowsAutostartRegistered, registerWindowsAutostart, unregisterWindowsAutostart, } from './service-windows.js';
6
6
  function assertSupportedPlatform() {
@@ -33,6 +33,19 @@ async function unregisterAutostart() {
33
33
  }
34
34
  export async function cmdServiceStart(cliBinPath, daysAgo) {
35
35
  assertSupportedPlatform();
36
+ const startedAt = Date.now();
37
+ const waitTimer = setInterval(() => {
38
+ const elapsed = Math.round((Date.now() - startedAt) / 1000);
39
+ console.log(` 仍在等待检测中(已 ${elapsed}s)…`);
40
+ }, 3_000);
41
+ try {
42
+ await cmdServiceStartBody(cliBinPath, daysAgo);
43
+ }
44
+ finally {
45
+ clearInterval(waitTimer);
46
+ }
47
+ }
48
+ async function cmdServiceStartBody(cliBinPath, daysAgo) {
36
49
  const { dir, config } = await loadConfig();
37
50
  // Seed statsSince before launchd starts `jusage start` (do not bake --days into plist).
38
51
  await touchStatsSince(dir, config, daysAgo != null ? { daysAgo } : undefined);
@@ -56,13 +69,23 @@ export async function cmdServiceStart(cliBinPath, daysAgo) {
56
69
  return;
57
70
  }
58
71
  await registerAutostart(cliBinPath, dir);
59
- const pid = await waitForPid(dir);
60
- if (pid == null) {
61
- throw new Error('自启已注册,但进程未在预期时间内启动,请查看 ~/.ai-usage/logs/daemon.log');
72
+ const port = config.serverPort || DEFAULT_PORT;
73
+ const ready = await waitForServiceReady(dir, port);
74
+ if (ready.pid == null && !ready.health) {
75
+ const logPath = daemonLogPath(dir);
76
+ const tail = await readDaemonLogTail(dir);
77
+ const hint = tail ? `\n--- daemon.log ---\n${tail}` : '';
78
+ throw new Error(`自启已注册,但进程未在预期时间内启动(/health 也未就绪),请查看 ${logPath}${hint}`);
62
79
  }
63
80
  const { config: refreshed } = await loadConfig(dir);
64
- console.log(`✓ 服务已在后台启动 (pid ${pid})`);
65
- console.log(` 面板: http://127.0.0.1:${refreshed.serverPort || DEFAULT_PORT}`);
81
+ const panelPort = refreshed.serverPort || DEFAULT_PORT;
82
+ if (ready.pid != null) {
83
+ console.log(`✓ 服务已在后台启动 (pid ${ready.pid})`);
84
+ }
85
+ else {
86
+ console.log('✓ 服务已在后台启动(面板 /health 已就绪)');
87
+ }
88
+ console.log(` 面板: http://127.0.0.1:${panelPort}`);
66
89
  console.log(` 数据: ${dir}`);
67
90
  console.log(` 开机自启: 已注册`);
68
91
  console.log(` 日志: ${dir}/logs/daemon.log`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juejin-opensource/jusage",
3
- "version": "0.1.1-beta.8",
3
+ "version": "0.1.1-beta.9",
4
4
  "description": "本地优先的 AI Agent Token 用量看板 CLI(采集 + 本地面板 + 可选云端上报)",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -30,12 +30,12 @@
30
30
  "access": "public"
31
31
  },
32
32
  "dependencies": {
33
- "@juejin-opensource/jusage-core": "0.1.1-beta.8"
33
+ "@juejin-opensource/jusage-core": "0.1.1-beta.9"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "^22.13.10",
37
37
  "typescript": "^5.8.2",
38
- "@juejin-opensource/jusage-dashboard": "0.1.1-beta.8"
38
+ "@juejin-opensource/jusage-dashboard": "0.1.1-beta.9"
39
39
  },
40
40
  "engines": {
41
41
  "node": ">=20"
@@ -1 +0,0 @@
1
- import{r as t,j as e,B as r,A as i,p as m}from"./index-1sV0Fo6m.js";import{C as a}from"./index-DcW6PDH-.js";const d=n=>t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},n),t.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M13.5 10.421V5.475l-2 .714V8.25a.75.75 0 0 1-1.5 0V6.725l-2.25.804v6.088l4.777-1.792a1.5 1.5 0 0 0 .973-1.404m-2.254-5.734 1.6-.571a2 2 0 0 0-.175-.104L9.499 2.427a1.5 1.5 0 0 0-1.197-.063l-.941.353 3.724 1.862q.09.045.16.108M5.444 3.435l3.878 1.94-2.273.811-3.805-1.903q.108-.063.23-.109zm.806 4.029L2.5 5.589v5.057a1.5 1.5 0 0 0 .83 1.342l2.92 1.46zM1 5.579c0-.436.094-.856.266-1.236a.75.75 0 0 1 .2-.37c.342-.54.855-.968 1.48-1.203L7.777.96a3 3 0 0 1 2.394.125l3.172 1.586A3 3 0 0 1 15 5.354v5.067a3 3 0 0 1-1.947 2.809l-4.828 1.81a3 3 0 0 1-2.395-.125l-3.172-1.586A3 3 0 0 1 1 10.646z",clipRule:"evenodd"})),u=n=>t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},n),t.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M10.418 2.489c.9-1.196 2.382-1.724 3.154-1.391.852.367 1.539 2.08 1.054 3.702a4 4 0 0 1-2.616 5.559c.309.471.49 1.035.49 1.641v2.25a.75.75 0 0 1-1.5 0V12a1.5 1.5 0 0 0-3 0v2.25a.75.75 0 0 1-1.5 0v-.75h-.876a2.626 2.626 0 0 1-2.625-2.625c0-.621-.504-1.125-1.125-1.125h-.125a.75.75 0 0 1 0-1.5h.125a2.625 2.625 0 0 1 2.625 2.625c0 .621.504 1.125 1.125 1.125H6.5c0-.606.18-1.17.488-1.641A4 4 0 0 1 4.373 4.8c-.484-1.623.202-3.335 1.054-3.702.772-.333 2.254.195 3.155 1.39zm2.549.02a1.4 1.4 0 0 0-.35.098 2.5 2.5 0 0 0-1 .784l-.451.598H7.834l-.45-.598a2.5 2.5 0 0 0-1.001-.784 1.4 1.4 0 0 0-.352-.099c-.063.088-.14.231-.204.429a2.5 2.5 0 0 0-.016 1.434l.163.546-.242.517c-.13.279-.21.586-.228.913l-.004.142a2.5 2.5 0 0 0 2.5 2.5h3a2.5 2.5 0 0 0 2.267-3.555l-.242-.517.163-.547a2.5 2.5 0 0 0-.016-1.433 1.6 1.6 0 0 0-.205-.429",clipRule:"evenodd"})),x={new_user:{label:"还没有使用记录",description:"下载 Juejin Usage,开始查看 AI Agent 用量与趋势。"},uninstalled:{label:"客户端暂未连接",description:"启动 Juejin Usage,继续同步你的用量。"}},o="https://github.com/juejin-cn/juejin-usage",h=`${o}/releases`;function p({reason:n}){const s=x[n],l=c=>{window.open(c,"_blank","noopener,noreferrer")};return e.jsx("section",{className:"flex min-h-[calc(100svh-9rem)] items-center justify-center py-12 sm:py-20",children:e.jsx(a,{className:"w-full max-w-xl text-center",variant:"transparent",children:e.jsxs(a.Content,{className:"flex min-h-72 flex-col items-center justify-center rounded-2xl px-5 py-6",children:[e.jsx("span",{className:"mb-4 grid size-16 place-items-center rounded-2xl bg-surface-secondary text-muted",children:e.jsx(d,{className:"size-8"})}),e.jsx(a.Title,{className:"text-xl font-normal",children:s.label}),e.jsx(a.Description,{className:"mt-2 max-w-sm text-base leading-6 font-normal",children:s.description}),e.jsxs("div",{className:"mt-4 grid w-full max-w-xs grid-cols-2 gap-3",children:[e.jsxs(r,{className:"font-normal",fullWidth:!0,onPress:()=>l(h),variant:"primary",children:[e.jsx(i,{}),"下载客户端"]}),e.jsxs(r,{className:"font-normal",fullWidth:!0,onPress:()=>l(o),variant:"secondary",children:[e.jsx(u,{}),"访问 GitHub"]})]})]})})})}function g(){const n=m(),s=(n==null?void 0:n.reason)==="uninstalled"?"uninstalled":"new_user";return e.jsx(p,{reason:s})}export{g as component};
@@ -1 +0,0 @@
1
- import{R as c,r as n,t as L,ad as de,ae as U,af as A,ag as _,ah as Wl,ai as Hl,aj as We,ak as B,al as Gl,am as Yl,an as Xl,ao as fe,ap as He,aq as Ge,ar as Fe,as as Q,at as ke,au as be,av as Jl,aw as Ql,ax as R,ay as ea,az as ee,aA as ta,aB as Ye,aC as H,aD as ne,aE as la,aF as aa,aG as ra,aH as oa,aI as Xe,aJ as ia,aK as na,aL as sa,aM as ua,aN as $e,aO as ge,aP as I,aQ as ca,aR as G,aS as da,aT as fa,aU as Je,aV as Qe,aW as et,aX as ba,aY as he,aZ as $a,a_ as Y,a$ as ga,b0 as ha,b1 as pa,b2 as xa,b3 as ma,b4 as va,b5 as ya,b6 as Pa,b7 as Da,b8 as Ca,b9 as tt,ba as Sa,bb as Ea,bc as pe,bd as lt,be as at,bf as rt,bg as Ba,bh as wa,bi as ot,j as m,H as O,w as K,bj as Ra,bk as Ma,bl as Aa,bm as Fa,z as T,bn as ka,bo as Ia,bp as za,bq as it,br as Ka,bs as La,bt as Ta,bu as Oa,bv as Va,bw as Na,E as ja,bx as _a,x as Ua,y as Za,by as Ie,bz as qa,bA as Wa,Y as Ha,T as V}from"./index-1sV0Fo6m.js";const nt={prefix:String(Math.round(Math.random()*1e10)),current:0},st=c.createContext(nt),Ga=c.createContext(!1);let re=new WeakMap;function Ya(t=!1){var a,r;let e=n.useContext(st),l=n.useRef(null);if(l.current===null&&!t){let o=(r=(a=c.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)==null?void 0:a.ReactCurrentOwner)==null?void 0:r.current;if(o){let i=re.get(o);i==null?re.set(o,{id:e.current,state:o.memoizedState}):o.memoizedState!==i.state&&(e.current=i.id,re.delete(o))}l.current=++e.current}return l.current}function Xa(t){let e=n.useContext(st),l=Ya(!!t),a=`react-aria${e.prefix}`;return t||`${a}-${l}`}function Ja(t){let e=c.useId(),[l]=n.useState(ut()),a=l?"react-aria":`react-aria${nt.prefix}`;return t||`${a}-${e}`}c.useId;function Qa(){return!1}function er(){return!0}function tr(t){return()=>{}}function ut(){return typeof c.useSyncExternalStore=="function"?c.useSyncExternalStore(tr,Qa,er):n.useContext(Ga)}const lr=L({defaultVariants:{color:"default",variant:"secondary"},slots:{base:"chip",label:"chip__label"},variants:{color:{accent:{base:"chip--accent"},danger:{base:"chip--danger"},default:{base:"chip--default"},success:{base:"chip--success"},warning:{base:"chip--warning"}},size:{lg:{base:"chip--lg"},md:{base:"chip--md"},sm:{base:"chip--sm"}},variant:{primary:{base:"chip--primary"},secondary:{base:"chip--secondary"},soft:{base:"chip--soft"},tertiary:{base:"chip--tertiary"}}}}),ar=L({base:"label",defaultVariants:{isDisabled:!1,isInvalid:!1,isRequired:!1},variants:{isDisabled:{true:"label--disabled"},isInvalid:{true:"label--invalid"},isRequired:{true:"label--required"}}}),rr=L({base:"list-box",defaultVariants:{variant:"default"},variants:{variant:{danger:"list-box--danger",default:"list-box--default"}}}),or=L({defaultVariants:{variant:"default"},slots:{indicator:"list-box-item__indicator",item:"list-box-item"},variants:{variant:{danger:{item:"list-box-item--danger"},default:{item:"list-box-item--default"}}}}),ir=L({base:"list-box-section"}),nr=L({defaultVariants:{fullWidth:!1,variant:"primary"},slots:{base:"select",indicator:"select__indicator",popover:"select__popover",trigger:"select__trigger",value:"select__value"},variants:{fullWidth:{false:{},true:{base:"select--full-width",trigger:"select__trigger--full-width"}},variant:{primary:{base:"select--primary"},secondary:{base:"select--secondary"}}}}),sr=L({defaultVariants:{animationType:"shimmer"},slots:{base:"skeleton"},variants:{animationType:{none:"skeleton--none",pulse:"skeleton--pulse",shimmer:"skeleton--shimmer"}}}),ur=L({defaultVariants:{size:"md"},slots:{base:"switch",content:"switch__content",control:"switch__control",icon:"switch__icon",thumb:"switch__thumb"},variants:{size:{lg:{base:"switch--lg"},md:{base:"switch--md"},sm:{base:"switch--sm"}}}}),cr=L({slots:{base:"tooltip",trigger:"tooltip__trigger"}}),xe=n.createContext({}),dr=de(function(e,l){[e,l]=U(e,l,xe);let{elementType:a="label",...r}=e,o=A[a];return c.createElement(o,{className:"react-aria-Label",...r,ref:l})});function ct(t){let{id:e,label:l,"aria-labelledby":a,"aria-label":r,labelElementType:o="label"}=t;e=_(e);let i=_(),u={};l&&(a=a?`${i} ${a}`:i,u={id:i,htmlFor:o==="label"?e:void 0});let s=Wl({id:e,"aria-label":r,"aria-labelledby":a});return{labelProps:u,fieldProps:s}}const fr=n.createContext(null),br=n.createContext({}),$r=n.createContext({}),Be=class Be extends Hl{filter(e,l){let a=l.getItem(this.prevKey);if(a&&a.type!=="separator"){let r=this.clone();return l.addDescendants(r,e),r}return null}};Be.type="separator";let ze=Be;var dt={};dt={longPressMessage:"اضغط مطولاً أو اضغط على Alt + السهم لأسفل لفتح القائمة"};var ft={};ft={longPressMessage:"Натиснете продължително или натиснете Alt+ стрелка надолу, за да отворите менюто"};var bt={};bt={longPressMessage:"Dlouhým stiskem nebo stisknutím kláves Alt + šipka dolů otevřete nabídku"};var $t={};$t={longPressMessage:"Langt tryk eller tryk på Alt + pil ned for at åbne menuen"};var gt={};gt={longPressMessage:"Drücken Sie lange oder drücken Sie Alt + Nach-unten, um das Menü zu öffnen"};var ht={};ht={longPressMessage:"Πιέστε παρατεταμένα ή πατήστε Alt + κάτω βέλος για να ανοίξετε το μενού"};var pt={};pt={longPressMessage:"Long press or press Alt + ArrowDown to open menu"};var xt={};xt={longPressMessage:"Mantenga pulsado o pulse Alt + flecha abajo para abrir el menú"};var mt={};mt={longPressMessage:"Menüü avamiseks vajutage pikalt või vajutage klahve Alt + allanool"};var vt={};vt={longPressMessage:"Avaa valikko painamalla pohjassa tai näppäinyhdistelmällä Alt + Alanuoli"};var yt={};yt={longPressMessage:"Appuyez de manière prolongée ou appuyez sur Alt + Flèche vers le bas pour ouvrir le menu."};var Pt={};Pt={longPressMessage:"לחץ לחיצה ארוכה או הקש Alt + ArrowDown כדי לפתוח את התפריט"};var Dt={};Dt={longPressMessage:"Dugo pritisnite ili pritisnite Alt + strelicu prema dolje za otvaranje izbornika"};var Ct={};Ct={longPressMessage:"Nyomja meg hosszan, vagy nyomja meg az Alt + lefele nyíl gombot a menü megnyitásához"};var St={};St={longPressMessage:"Premi a lungo o premi Alt + Freccia giù per aprire il menu"};var Et={};Et={longPressMessage:"長押しまたは Alt+下矢印キーでメニューを開く"};var Bt={};Bt={longPressMessage:"길게 누르거나 Alt + 아래쪽 화살표를 눌러 메뉴 열기"};var wt={};wt={longPressMessage:"Norėdami atidaryti meniu, nuspaudę palaikykite arba paspauskite „Alt + ArrowDown“."};var Rt={};Rt={longPressMessage:"Lai atvērtu izvēlni, turiet nospiestu vai nospiediet taustiņu kombināciju Alt + lejupvērstā bultiņa"};var Mt={};Mt={longPressMessage:"Langt trykk eller trykk Alt + PilNed for å åpne menyen"};var At={};At={longPressMessage:"Druk lang op Alt + pijl-omlaag of druk op Alt om het menu te openen"};var Ft={};Ft={longPressMessage:"Naciśnij i przytrzymaj lub naciśnij klawisze Alt + Strzałka w dół, aby otworzyć menu"};var kt={};kt={longPressMessage:"Pressione e segure ou pressione Alt + Seta para baixo para abrir o menu"};var It={};It={longPressMessage:"Prima continuamente ou prima Alt + Seta Para Baixo para abrir o menu"};var zt={};zt={longPressMessage:"Apăsați lung sau apăsați pe Alt + săgeată în jos pentru a deschide meniul"};var Kt={};Kt={longPressMessage:"Нажмите и удерживайте или нажмите Alt + Стрелка вниз, чтобы открыть меню"};var Lt={};Lt={longPressMessage:"Ponuku otvoríte dlhým stlačením alebo stlačením klávesu Alt + klávesu so šípkou nadol"};var Tt={};Tt={longPressMessage:"Za odprtje menija pritisnite in držite gumb ali pritisnite Alt+puščica navzdol"};var Ot={};Ot={longPressMessage:"Dugo pritisnite ili pritisnite Alt + strelicu prema dole da otvorite meni"};var Vt={};Vt={longPressMessage:"Håll nedtryckt eller tryck på Alt + pil nedåt för att öppna menyn"};var Nt={};Nt={longPressMessage:"Menüyü açmak için uzun basın veya Alt + Aşağı Ok tuşuna basın"};var jt={};jt={longPressMessage:"Довго або звичайно натисніть комбінацію клавіш Alt і стрілка вниз, щоб відкрити меню"};var _t={};_t={longPressMessage:"长按或按 Alt + 向下方向键以打开菜单"};var Ut={};Ut={longPressMessage:"長按或按 Alt+向下鍵以開啟功能表"};var Zt={};Zt={"ar-AE":dt,"bg-BG":ft,"cs-CZ":bt,"da-DK":$t,"de-DE":gt,"el-GR":ht,"en-US":pt,"es-ES":xt,"et-EE":mt,"fi-FI":vt,"fr-FR":yt,"he-IL":Pt,"hr-HR":Dt,"hu-HU":Ct,"it-IT":St,"ja-JP":Et,"ko-KR":Bt,"lt-LT":wt,"lv-LV":Rt,"nb-NO":Mt,"nl-NL":At,"pl-PL":Ft,"pt-BR":kt,"pt-PT":It,"ro-RO":zt,"ru-RU":Kt,"sk-SK":Lt,"sl-SI":Tt,"sr-SP":Ot,"sv-SE":Vt,"tr-TR":Nt,"uk-UA":jt,"zh-CN":_t,"zh-TW":Ut};function gr(t){let{onContextMenu:e}=t,l=n.useRef(!1),{longPressProps:a}=We({onLongPressStart(){l.current=!1},onLongPress(r){l.current?l.current=!1:e==null||e({target:r.target,x:r.x,y:r.y})}});return e?{contextMenuProps:B(Gl()?a:{},{onContextMenu(r){r.stopPropagation(),r.preventDefault(),l.current=!0;let o=r.currentTarget.getBoundingClientRect();e({target:r.currentTarget,x:r.clientX-o.x,y:r.clientY-o.y})},onKeyDown(r){if(Yl()&&r.ctrlKey&&r.key==="Enter"){l.current=!1;let o=r.currentTarget;r.stopPropagation(),setTimeout(()=>{if(l.current)l.current=!1;else{let i=o.getBoundingClientRect();e({target:o,x:i.width/2,y:i.height/2})}},10)}}})}:{contextMenuProps:{}}}function hr(t){return t&&t.__esModule?t.default:t}function pr(t,e,l){let{type:a="menu",isDisabled:r,trigger:o="press"}=t,i=_(),{triggerProps:u,overlayProps:s}=Xl({type:a},e,l),d=(f,y,P="first")=>{if(!f||y.isDefaultPrevented())return!1;e.toggle(P)},{keyboardProps:b}=fe({isDisabled:r,shortcuts:{Enter:f=>d(o!=="longPress",f,"first")," ":f=>d(o!=="longPress",f,"first"),ArrowDown:f=>d(o!=="longPress",f,"first"),ArrowUp:f=>d(o!=="longPress",f,"last"),"Alt+Enter":f=>d(o==="longPress",f,"first"),"Alt+ ":f=>d(o==="longPress",f,"first"),"Alt+ArrowDown":f=>d(!0,f,"first"),"Alt+ArrowUp":f=>d(!0,f,"last")}}),g=He(hr(Zt),"@react-aria/menu"),{longPressProps:p}=We({isDisabled:r||o!=="longPress",accessibilityDescription:g.format("longPressMessage"),onLongPressStart(){e.close()},onLongPress(){e.open("first")}}),$={preventFocusOnPress:!0,onPressStart(f){f.pointerType!=="touch"&&f.pointerType!=="keyboard"&&!r&&(Fe(f.target),e.open(f.pointerType==="virtual"?"first":null))},onPress(f){f.pointerType==="touch"&&!r&&(Fe(f.target),e.toggle())}};delete u.onPress;let{contextMenuProps:x}=gr({onContextMenu(f){let y=f.target.getBoundingClientRect();e.setPoint({x:y.x+f.x,y:y.y+f.y}),e.open()}});n.useEffect(()=>{if(e.isOpen&&o==="contextMenu"){let f=y=>{(y.button===2||y.button===0&&y.ctrlKey===!0)&&Ge(y)===document.body&&e.close()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)}},[e,o]);let v;if(o==="press")v={...$,...b};else if(o==="longPress")v={...p,...b};else if(o==="contextMenu"){v=x;let{"aria-haspopup":f,"aria-expanded":y,"aria-controls":P,...h}=u;u=h}return{menuTriggerProps:{...u,...v,id:i},menuProps:{...s,"aria-labelledby":i,autoFocus:e.focusStrategy||!0,onClose:e.close}}}class Ke{constructor(e){this.ref=e}getItemRect(e){let l=this.ref.current;if(!l)return null;let a=e!=null?Q(this.ref,e):null;if(!a)return null;let r=l.getBoundingClientRect(),o=a.getBoundingClientRect();return{x:o.left-r.left-l.clientLeft+l.scrollLeft,y:o.top-r.top-l.clientTop+l.scrollTop,width:o.width,height:o.height}}getContentSize(){let e=this.ref.current;return{width:(e==null?void 0:e.scrollWidth)??0,height:(e==null?void 0:e.scrollHeight)??0}}getVisibleRect(){let e=this.ref.current;return{x:(e==null?void 0:e.scrollLeft)??0,y:(e==null?void 0:e.scrollTop)??0,width:(e==null?void 0:e.clientWidth)??0,height:(e==null?void 0:e.clientHeight)??0}}}class me{constructor(...e){if(e.length===1){let l=e[0];this.collection=l.collection,this.ref=l.ref,this.collator=l.collator,this.disabledKeys=l.disabledKeys||new Set,this.disabledBehavior=l.disabledBehavior||"all",this.orientation=l.orientation||"vertical",this.direction=l.direction,this.layout=l.layout||"stack",this.layoutDelegate=l.layoutDelegate||new Ke(l.ref)}else this.collection=e[0],this.disabledKeys=e[1],this.ref=e[2],this.collator=e[3],this.layout="stack",this.orientation="vertical",this.disabledBehavior="all",this.layoutDelegate=new Ke(this.ref);this.layout==="stack"&&this.orientation==="vertical"&&(this.getKeyLeftOf=void 0,this.getKeyRightOf=void 0)}isDisabled(e){var l,a;return this.disabledBehavior==="all"&&(((l=e.props)==null?void 0:l.isDisabled)||this.disabledKeys.has(e.key))&&((a=e.props)==null?void 0:a.disabledBehavior)!=="selection"}findNextNonDisabled(e,l,a=!1){let r=e;for(;r!=null;){let o=this.collection.getItem(r);if((o==null?void 0:o.type)==="item"&&(a||!this.isDisabled(o)))return r;r=l(r)}return null}getNextKey(e,l){let a=e;return a=this.collection.getKeyAfter(a),this.findNextNonDisabled(a,r=>this.collection.getKeyAfter(r),l==null?void 0:l.includeDisabled)}getPreviousKey(e,l){let a=e;return a=this.collection.getKeyBefore(a),this.findNextNonDisabled(a,r=>this.collection.getKeyBefore(r),l==null?void 0:l.includeDisabled)}findKey(e,l,a){let r=e,o=this.layoutDelegate.getItemRect(r);if(!o||r==null)return null;let i=o;do{if(r=l(r),r==null)break;o=this.layoutDelegate.getItemRect(r)}while(o&&a(i,o)&&r!=null);return r}isSameRow(e,l){return e.y===l.y||e.x!==l.x}isSameColumn(e,l){return e.x===l.x||e.y!==l.y}isReversed(e){let l=this.getNextKey(e),a=Q(this.ref,e);if(l!=null){let o=Q(this.ref,l);return!a||!o?!1:a.getBoundingClientRect().top>o.getBoundingClientRect().top}let r=this.getPreviousKey(e);if(r!=null){let o=Q(this.ref,r);return!a||!o?!1:o.getBoundingClientRect().top>a.getBoundingClientRect().top}return!1}getKeyBelow(e,l){return this.layout==="grid"&&this.orientation==="vertical"?this.findKey(e,a=>this.getNextKey(a,l),this.isSameRow):this.orientation==="vertical"?this.isReversed(e)?this.getPreviousKey(e,l):this.getNextKey(e,l):this.getNextKey(e,l)}getKeyAbove(e,l){return this.layout==="grid"&&this.orientation==="vertical"?this.findKey(e,a=>this.getPreviousKey(a,l),this.isSameRow):this.orientation==="vertical"?this.isReversed(e)?this.getNextKey(e,l):this.getPreviousKey(e,l):this.getPreviousKey(e,l)}getNextColumn(e,l,a){return l?this.getPreviousKey(e,a):this.getNextKey(e,a)}getKeyRightOf(e,l){let a=this.direction==="ltr"?"getKeyRightOf":"getKeyLeftOf";return this.layoutDelegate[a]?(e=this.layoutDelegate[a](e),this.findNextNonDisabled(e,r=>this.layoutDelegate[a](r),l==null?void 0:l.includeDisabled)):this.layout==="grid"?this.orientation==="vertical"?this.getNextColumn(e,this.direction==="rtl",l):this.findKey(e,r=>this.getNextColumn(r,this.direction==="rtl",l),this.isSameColumn):this.orientation==="horizontal"?this.getNextColumn(e,this.direction==="rtl",l):null}getKeyLeftOf(e,l){let a=this.direction==="ltr"?"getKeyLeftOf":"getKeyRightOf";return this.layoutDelegate[a]?(e=this.layoutDelegate[a](e),this.findNextNonDisabled(e,r=>this.layoutDelegate[a](r),l==null?void 0:l.includeDisabled)):this.layout==="grid"?this.orientation==="vertical"?this.getNextColumn(e,this.direction==="ltr",l):this.findKey(e,r=>this.getNextColumn(r,this.direction==="ltr",l),this.isSameColumn):this.orientation==="horizontal"?this.getNextColumn(e,this.direction==="ltr",l):null}getFirstKey(){let e=this.collection.getFirstKey();return this.findNextNonDisabled(e,l=>this.collection.getKeyAfter(l))}getLastKey(){let e=this.collection.getLastKey();return this.findNextNonDisabled(e,l=>this.collection.getKeyBefore(l))}getKeyPageAbove(e){let l=this.ref.current,a=this.layoutDelegate.getItemRect(e);if(!a)return null;let r=this.isReversed(e);if(l&&!ke(l))return this.getFirstKey();let o=e;if(this.orientation==="horizontal"){let i=Math.max(0,a.x+a.width-this.layoutDelegate.getVisibleRect().width);for(;a&&a.x>i&&o!=null;)o=this.getKeyAbove(o),a=o==null?null:this.layoutDelegate.getItemRect(o)}else{let i=this.layoutDelegate.getVisibleRect(),u=r?a.y-i.height:Math.max(0,a.y+a.height-i.height);for(;a&&a.y>u&&o!=null;)o=this.getKeyAbove(o),a=o==null?null:this.layoutDelegate.getItemRect(o)}return o??(r?this.getLastKey():this.getFirstKey())}getKeyPageBelow(e){let l=this.ref.current,a=this.layoutDelegate.getItemRect(e);if(!a)return null;let r=this.isReversed(e);if(l&&!ke(l))return this.getLastKey();let o=e;if(this.orientation==="horizontal"){let i=Math.min(this.layoutDelegate.getContentSize().width,a.x-a.width+this.layoutDelegate.getVisibleRect().width);for(;a&&a.x<i&&o!=null;)o=this.getKeyBelow(o),a=o==null?null:this.layoutDelegate.getItemRect(o)}else{let i=Math.min(this.layoutDelegate.getContentSize().height,a.y-a.height+this.layoutDelegate.getVisibleRect().height);for(;a&&a.y<i&&o!=null;)o=this.getKeyBelow(o),a=o==null?null:this.layoutDelegate.getItemRect(o)}return o??(r?this.getFirstKey():this.getLastKey())}getKeyForSearch(e,l){if(!this.collator)return null;let a=this.collection,r=l||this.getFirstKey();for(;r!=null;){let o=a.getItem(r);if(!o)return null;let i=o.textValue.slice(0,e.length);if(o.textValue&&this.collator.compare(i,e)===0)return r;r=this.getNextKey(r)}return null}}let oe=new Map;function ve(t){let{locale:e}=be(),l=e+(t?Object.entries(t).sort((r,o)=>r[0]<o[0]?-1:1).join():"");if(oe.has(l))return oe.get(l);let a=new Intl.Collator(e,t);return oe.set(l,a),a}function xr(t){let{selectionManager:e,collection:l,disabledKeys:a,ref:r,keyboardDelegate:o,layoutDelegate:i,orientation:u}=t,s=ve({usage:"search",sensitivity:"base"}),d=e.disabledBehavior,b=n.useMemo(()=>o||new me({collection:l,disabledKeys:a,disabledBehavior:d,ref:r,collator:s,layoutDelegate:i,orientation:u}),[o,i,l,a,r,s,d,u]),{collectionProps:g}=Jl({...t,ref:r,selectionManager:e,keyboardDelegate:b});return{listProps:g}}const Le=new WeakMap;function mr(t){let e=Le.get(t);if(e!=null)return e;let l=0,a=r=>{for(let o of r)o.type==="section"?a(Ql(o,t)):o.type==="item"&&l++};return a(t),Le.set(t,l),l}var qt={};qt={colorSwatchPicker:"تغييرات الألوان",dropzoneLabel:"DropZone",selectPlaceholder:"حدد عنصرًا",tableResizer:"أداة تغيير الحجم"};var Wt={};Wt={colorSwatchPicker:"Цветови мостри",dropzoneLabel:"DropZone",selectPlaceholder:"Изберете предмет",tableResizer:"Преоразмерител"};var Ht={};Ht={colorSwatchPicker:"Vzorky barev",dropzoneLabel:"Místo pro přetažení",selectPlaceholder:"Vyberte položku",tableResizer:"Změna velikosti"};var Gt={};Gt={colorSwatchPicker:"Farveprøver",dropzoneLabel:"DropZone",selectPlaceholder:"Vælg et element",tableResizer:"Størrelsesændring"};var Yt={};Yt={colorSwatchPicker:"Farbfelder",dropzoneLabel:"Ablegebereich",selectPlaceholder:"Element wählen",tableResizer:"Größenanpassung"};var Xt={};Xt={colorSwatchPicker:"Χρωματικά δείγματα",dropzoneLabel:"DropZone",selectPlaceholder:"Επιλέξτε ένα αντικείμενο",tableResizer:"Αλλαγή μεγέθους"};var Jt={};Jt={selectPlaceholder:"Select an item",tableResizer:"Resizer",dropzoneLabel:"DropZone",colorSwatchPicker:"Color swatches"};var Qt={};Qt={colorSwatchPicker:"Muestras de colores",dropzoneLabel:"DropZone",selectPlaceholder:"Seleccionar un artículo",tableResizer:"Cambiador de tamaño"};var el={};el={colorSwatchPicker:"Värvinäidised",dropzoneLabel:"DropZone",selectPlaceholder:"Valige üksus",tableResizer:"Suuruse muutja"};var tl={};tl={colorSwatchPicker:"Värimallit",dropzoneLabel:"DropZone",selectPlaceholder:"Valitse kohde",tableResizer:"Koon muuttaja"};var ll={};ll={colorSwatchPicker:"Échantillons de couleurs",dropzoneLabel:"DropZone",selectPlaceholder:"Sélectionner un élément",tableResizer:"Redimensionneur"};var al={};al={colorSwatchPicker:"דוגמיות צבע",dropzoneLabel:"DropZone",selectPlaceholder:"בחר פריט",tableResizer:"שינוי גודל"};var rl={};rl={colorSwatchPicker:"Uzorci boja",dropzoneLabel:"Zona spuštanja",selectPlaceholder:"Odaberite stavku",tableResizer:"Promjena veličine"};var ol={};ol={colorSwatchPicker:"Színtárak",dropzoneLabel:"DropZone",selectPlaceholder:"Válasszon ki egy elemet",tableResizer:"Átméretező"};var il={};il={colorSwatchPicker:"Campioni di colore",dropzoneLabel:"Zona di rilascio",selectPlaceholder:"Seleziona un elemento",tableResizer:"Ridimensionamento"};var nl={};nl={colorSwatchPicker:"カラースウォッチ",dropzoneLabel:"ドロップゾーン",selectPlaceholder:"項目を選択",tableResizer:"サイズ変更ツール"};var sl={};sl={colorSwatchPicker:"색상 견본",dropzoneLabel:"드롭 영역",selectPlaceholder:"항목 선택",tableResizer:"크기 조정기"};var ul={};ul={colorSwatchPicker:"Spalvų pavyzdžiai",dropzoneLabel:"„DropZone“",selectPlaceholder:"Pasirinkite elementą",tableResizer:"Dydžio keitiklis"};var cl={};cl={colorSwatchPicker:"Krāsu paraugi",dropzoneLabel:"DropZone",selectPlaceholder:"Izvēlēties vienumu",tableResizer:"Izmēra mainītājs"};var dl={};dl={colorSwatchPicker:"Fargekart",dropzoneLabel:"Droppsone",selectPlaceholder:"Velg et element",tableResizer:"Størrelsesendrer"};var fl={};fl={colorSwatchPicker:"kleurstalen",dropzoneLabel:"DropZone",selectPlaceholder:"Selecteer een item",tableResizer:"Resizer"};var bl={};bl={colorSwatchPicker:"Próbki kolorów",dropzoneLabel:"Strefa upuszczania",selectPlaceholder:"Wybierz element",tableResizer:"Zmiana rozmiaru"};var $l={};$l={colorSwatchPicker:"Amostras de cores",dropzoneLabel:"DropZone",selectPlaceholder:"Selecione um item",tableResizer:"Redimensionador"};var gl={};gl={colorSwatchPicker:"Amostras de cores",dropzoneLabel:"DropZone",selectPlaceholder:"Selecione um item",tableResizer:"Redimensionador"};var hl={};hl={colorSwatchPicker:"Specimene de culoare",dropzoneLabel:"Zonă de plasare",selectPlaceholder:"Selectați un element",tableResizer:"Instrument de redimensionare"};var pl={};pl={colorSwatchPicker:"Цветовые образцы",dropzoneLabel:"DropZone",selectPlaceholder:"Выберите элемент",tableResizer:"Средство изменения размера"};var xl={};xl={colorSwatchPicker:"Vzorkovníky farieb",dropzoneLabel:"DropZone",selectPlaceholder:"Vyberte položku",tableResizer:"Nástroj na zmenu veľkosti"};var ml={};ml={colorSwatchPicker:"Barvne palete",dropzoneLabel:"DropZone",selectPlaceholder:"Izberite element",tableResizer:"Spreminjanje velikosti"};var vl={};vl={colorSwatchPicker:"Uzorci boje",dropzoneLabel:"DropZone",selectPlaceholder:"Izaberite stavku",tableResizer:"Promena veličine"};var yl={};yl={colorSwatchPicker:"Färgrutor",dropzoneLabel:"DropZone",selectPlaceholder:"Välj en artikel",tableResizer:"Storleksändrare"};var Pl={};Pl={colorSwatchPicker:"Renk örnekleri",dropzoneLabel:"Bırakma Bölgesi",selectPlaceholder:"Bir öğe seçin",tableResizer:"Yeniden boyutlandırıcı"};var Dl={};Dl={colorSwatchPicker:"Зразки кольорів",dropzoneLabel:"DropZone",selectPlaceholder:"Виберіть елемент",tableResizer:"Засіб змінення розміру"};var Cl={};Cl={colorSwatchPicker:"颜色色板",dropzoneLabel:"放置区域",selectPlaceholder:"选择一个项目",tableResizer:"尺寸调整器"};var Sl={};Sl={colorSwatchPicker:"色票",dropzoneLabel:"放置區",selectPlaceholder:"選取項目",tableResizer:"大小調整器"};var El={};El={"ar-AE":qt,"bg-BG":Wt,"cs-CZ":Ht,"da-DK":Gt,"de-DE":Yt,"el-GR":Xt,"en-US":Jt,"es-ES":Qt,"et-EE":el,"fi-FI":tl,"fr-FR":ll,"he-IL":al,"hr-HR":rl,"hu-HU":ol,"it-IT":il,"ja-JP":nl,"ko-KR":sl,"lt-LT":ul,"lv-LV":cl,"nb-NO":dl,"nl-NL":fl,"pl-PL":bl,"pt-BR":$l,"pt-PT":gl,"ro-RO":hl,"ru-RU":pl,"sk-SK":xl,"sl-SI":ml,"sr-SP":vl,"sv-SE":yl,"tr-TR":Pl,"uk-UA":Dl,"zh-CN":Cl,"zh-TW":Sl};const te=n.createContext({}),Bl=n.createContext(null),vr=n.forwardRef(function(e,l){let{render:a}=n.useContext(Bl);return c.createElement(c.Fragment,null,a(e,l))});function wl(t,e){var o;let l=t==null?void 0:t.renderDropIndicator,a=(o=t==null?void 0:t.isVirtualDragging)==null?void 0:o.call(t),r=n.useCallback(i=>{if(a||e!=null&&e.isDropTarget(i))return l?l(i):c.createElement(vr,{target:i})},[e==null?void 0:e.target,a,l]);return t!=null&&t.useDropIndicator?r:void 0}function yr(t,e,l){var o,i,u;let a=t.focusedKey,r=null;if((o=e==null?void 0:e.isVirtualDragging)!=null&&o.call(e)&&((i=l==null?void 0:l.target)==null?void 0:i.type)==="item"&&(r=l.target.key,l.target.dropPosition==="after")){let s=l.collection.getKeyAfter(r),d=null;if(s!=null){let b=((u=l.collection.getItem(r))==null?void 0:u.level)??0;for(;s!=null;){let g=l.collection.getItem(s);if(!g)break;if(g.type!=="item"){s=l.collection.getKeyAfter(s);continue}if((g.level??0)<=b)break;d=s,s=l.collection.getKeyAfter(s)}}r=s??d??r}return n.useMemo(()=>new Set([a,r].filter(s=>s!=null)),[a,r])}const ye=new WeakMap;function Pr(t){return typeof t=="string"?t.replace(/\s*/g,""):""+t}function Dr(t,e){let l=ye.get(t);if(!l)throw new Error("Unknown list");return`${l.id}-option-${Pr(e)}`}function Cr(t,e,l){let a=R(t,{labelable:!0}),r=t.selectionBehavior||"toggle",o=t.orientation||"vertical",i=t.linkBehavior||(r==="replace"?"action":"override");r==="toggle"&&i==="action"&&(i="override");let{listProps:u}=xr({...t,ref:l,selectionManager:e.selectionManager,collection:e.collection,disabledKeys:e.disabledKeys,linkBehavior:i}),{focusWithinProps:s}=ea({onFocusWithin:t.onFocus,onBlurWithin:t.onBlur,onFocusWithinChange:t.onFocusChange}),d=_(t.id);ye.set(e,{id:d,shouldUseVirtualFocus:t.shouldUseVirtualFocus,shouldSelectOnPressUp:t.shouldSelectOnPressUp,shouldFocusOnHover:t.shouldFocusOnHover,isVirtualized:t.isVirtualized,onAction:t.onAction,linkBehavior:i,UNSTABLE_itemBehavior:t.UNSTABLE_itemBehavior});let{labelProps:b,fieldProps:g}=ct({...t,id:d,labelElementType:"span"});return{labelProps:b,listBoxProps:B(a,s,e.selectionManager.selectionMode==="multiple"?{"aria-multiselectable":"true"}:{},{role:"listbox","aria-orientation":o,...B(g,u)})}}function Sr(t,e,l){var D,F;let{key:a}=t,r=ye.get(e),o=t.isDisabled??e.selectionManager.isDisabled(a),i=t.isSelected??e.selectionManager.isSelected(a),u=t.shouldSelectOnPressUp??(r==null?void 0:r.shouldSelectOnPressUp),s=t.shouldFocusOnHover??(r==null?void 0:r.shouldFocusOnHover),d=t.shouldUseVirtualFocus??(r==null?void 0:r.shouldUseVirtualFocus),b=t.isVirtualized??(r==null?void 0:r.isVirtualized),g=ee(),p=ee(),$={role:"option","aria-disabled":o||void 0,"aria-selected":e.selectionManager.selectionMode!=="none"?i:void 0,"aria-label":t["aria-label"],"aria-labelledby":g,"aria-describedby":p},x=e.collection.getItem(a);if(b){let w=Number(x==null?void 0:x.index);$["aria-posinset"]=Number.isNaN(w)?void 0:w+1,$["aria-setsize"]=mr(e.collection)}let v=r!=null&&r.onAction?()=>{var w;return(w=r==null?void 0:r.onAction)==null?void 0:w.call(r,a)}:void 0,f=Dr(e,a),{itemProps:y,isPressed:P,isFocused:h,hasAction:E,allowsSelection:C}=ta({selectionManager:e.selectionManager,key:a,ref:l,shouldSelectOnPressUp:u,allowsDifferentPressOrigin:u&&s,isVirtualized:b,shouldUseVirtualFocus:d,isDisabled:o,onAction:v||(D=x==null?void 0:x.props)!=null&&D.onAction?Ye((F=x==null?void 0:x.props)==null?void 0:F.onAction,v):void 0,linkBehavior:r==null?void 0:r.linkBehavior,UNSTABLE_itemBehavior:r==null?void 0:r.UNSTABLE_itemBehavior,id:f}),{hoverProps:M}=H({isDisabled:o||!s,onHoverStart(){ne()||(e.selectionManager.setFocused(!0),e.selectionManager.setFocusedKey(a))}}),S=R(x==null?void 0:x.props);delete S.id;let z=la(x==null?void 0:x.props);return{optionProps:{...$,...B(S,y,M,z),id:f},labelProps:{id:g},descriptionProps:{id:p},isFocused:h,isFocusVisible:h&&e.selectionManager.isFocused&&ne(),isSelected:i,isDisabled:o,isPressed:P,allowsSelection:C,hasAction:E}}function Er(t){let{heading:e,"aria-label":l}=t,a=_();return{itemProps:{role:"presentation"},headingProps:e?{id:a,role:"presentation",onMouseDown:r=>{r.preventDefault()}}:{},groupProps:{role:"group","aria-label":l,"aria-labelledby":e?a:void 0}}}function Br(t,e){let{collection:l,onLoadMore:a,scrollOffset:r=1,direction:o="end"}=t,i=n.useRef(null),u=aa(s=>{for(let d of s)d.isIntersecting&&a&&a()});ra(()=>{if(e.current){const s=100*r,d=o==="start"?`${s}% 0px 0px 0px`:`0px ${s}% ${s}% ${s}%`;i.current=new IntersectionObserver(u,{root:oa(e==null?void 0:e.current),rootMargin:d}),i.current.observe(e.current)}return()=>{i.current&&i.current.disconnect()}},[l,e,r,o])}const Pe=n.createContext(null),q=n.createContext(null),wr=n.forwardRef(function(e,l){[e,l]=U(e,l,Pe);let a=n.useContext(q);return a?c.createElement(Rl,{state:a,props:e,listBoxRef:l}):c.createElement(Xe,{content:c.createElement(ia,e)},r=>c.createElement(Rr,{props:e,listBoxRef:l,collection:r}))});function Rr({props:t,listBoxRef:e,collection:l}){t={...t,collection:l,children:null,items:null};let{layoutDelegate:a}=n.useContext($e),r=Je({...t,layoutDelegate:a});return c.createElement(Rl,{state:r,props:t,listBoxRef:e})}function Rl({state:t,props:e,listBoxRef:l}){[e,l]=U(e,l,fr);let{dragAndDropHooks:a,layout:r="stack",orientation:o="vertical",filter:i}=e,u=ua(t,i),{collection:s,selectionManager:d}=u,b=!!(a!=null&&a.useDraggableCollectionState),g=!!(a!=null&&a.useDroppableCollectionState),{direction:p}=be(),{disabledBehavior:$,disabledKeys:x}=d,v=ve({usage:"search",sensitivity:"base"}),{isVirtualized:f,layoutDelegate:y,dropTargetDelegate:P,CollectionRoot:h}=n.useContext($e),E=n.useMemo(()=>e.keyboardDelegate||new me({collection:s,collator:v,ref:l,disabledKeys:x,disabledBehavior:$,layout:r,orientation:o,direction:p,layoutDelegate:y}),[s,v,l,$,x,o,p,e.keyboardDelegate,r,y]),{listBoxProps:C}=Cr({...e,shouldSelectOnPressUp:b||e.shouldSelectOnPressUp,keyboardDelegate:E,isVirtualized:f},u,l);n.useRef(b),n.useRef(g),n.useEffect(()=>{},[b,g]);let M,S,z,D=!1,F=null,w=n.useRef(null);if(b&&a){M=a.useDraggableCollectionState({collection:s,selectionManager:d,preview:a.renderDragPreview?w:void 0}),a.useDraggableCollection({},M,l);let ae=a.DragPreview;F=a.renderDragPreview?c.createElement(ae,{ref:w},a.renderDragPreview):null}if(g&&a){S=a.useDroppableCollectionState({collection:s,selectionManager:d});let ae=a.dropTargetDelegate||P||new a.ListDropTargetDelegate(s,l,{orientation:o,layout:r,direction:p});z=a.useDroppableCollection({keyboardDelegate:E,dropTargetDelegate:ae},S,l),D=S.isDropTarget({type:"root"})}let{focusProps:Ul,isFocused:we,isFocusVisible:Re}=ge(),le=u.collection.size===0,Me={isDropTarget:D,isEmpty:le,isFocused:we,isFocusVisible:Re,layout:e.layout||"stack",orientation:o,state:u},Zl=I({...e,children:void 0,defaultClassName:"react-aria-ListBox",values:Me}),Ae=null;le&&e.renderEmptyState&&(Ae=c.createElement("div",{role:"option",style:{display:"contents"}},e.renderEmptyState(Me)));let ql=R(e,{global:!0});return c.createElement(ca,null,c.createElement(A.div,{...B(ql,Zl,C,Ul,z==null?void 0:z.collectionProps),ref:l,slot:e.slot||void 0,onScroll:e.onScroll,"data-drop-target":D||void 0,"data-empty":le||void 0,"data-focused":we||void 0,"data-focus-visible":Re||void 0,"data-layout":e.layout||"stack","data-orientation":o},c.createElement(G,{values:[[Pe,e],[q,u],[te,{dragAndDropHooks:a,dragState:M,dropState:S}],[$r,{elementType:"div"}],[Bl,{render:Fr}],[da,{name:"ListBoxSection",render:Ml}]]},c.createElement(fa,null,c.createElement(h,{collection:s,scrollRef:l,persistedKeys:yr(d,a,S),renderDropIndicator:wl(a,S)}))),Ae,F))}function Ml(t,e,l,a="react-aria-ListBoxSection"){let r=n.useContext(q),{dragAndDropHooks:o,dropState:i}=n.useContext(te),{CollectionBranch:u}=n.useContext($e),[s,d]=Qe(),{headingProps:b,groupProps:g}=Er({heading:d,"aria-label":t["aria-label"]??void 0}),p=I({...t,id:void 0,children:void 0,defaultClassName:a,values:void 0}),$=R(t,{global:!0});return delete $.id,c.createElement(A.section,{...B($,p,g),ref:e},c.createElement(br.Provider,{value:{...b,ref:s}},c.createElement(u,{collection:r.collection,parent:l,renderDropIndicator:wl(o,i)})))}const Mr=na(sa,Ml),Ar=et(ba,function(e,l,a){let r=he(l),o=n.useContext(q),{dragAndDropHooks:i,dragState:u,dropState:s}=n.useContext(te),d=u&&!(u.isDisabled||u.selectionManager.isDisabled(a.key)),{optionProps:b,labelProps:g,descriptionProps:p,...$}=Sr({key:a.key,"aria-label":e==null?void 0:e["aria-label"]},o,r),{hoverProps:x,isHovered:v}=H({isDisabled:!$.allowsSelection&&!$.hasAction&&!d,onHoverStart:a.props.onHoverStart,onHoverChange:a.props.onHoverChange,onHoverEnd:a.props.onHoverEnd}),{keyboardProps:f}=fe(e),{focusProps:y}=$a(e),P=null;u&&i&&(P=i.useDraggableItem({key:a.key,hasAction:$.hasAction},u));let h=null;s&&i&&(h=i.useDroppableItem({target:{type:"item",key:a.key,dropPosition:"on"}},s,r));let E=u&&u.isDragging(a.key),C=I({...e,id:void 0,children:e.children,defaultClassName:"react-aria-ListBoxItem",values:{...$,isHovered:v,selectionMode:o.selectionManager.selectionMode,selectionBehavior:o.selectionManager.selectionBehavior,allowsDragging:!!u,isDragging:E,isDropTarget:h==null?void 0:h.isDropTarget}});n.useEffect(()=>{a.textValue},[a.textValue]);let M=e.href?A.a:A.div,S=R(e,{global:!0});return delete S.id,delete S.onClick,e.href&&b.tabIndex==null&&(b.tabIndex=-1),c.createElement(M,{...B(S,C,b,x,f,y,P==null?void 0:P.dragProps,h==null?void 0:h.dropProps),ref:r,"data-allows-dragging":!!u||void 0,"data-selected":$.isSelected||void 0,"data-disabled":$.isDisabled||void 0,"data-hovered":v||void 0,"data-focused":$.isFocused||void 0,"data-focus-visible":$.isFocusVisible||void 0,"data-pressed":$.isPressed||void 0,"data-dragging":E||void 0,"data-drop-target":(h==null?void 0:h.isDropTarget)||void 0,"data-selection-mode":o.selectionManager.selectionMode==="none"?void 0:o.selectionManager.selectionMode},c.createElement(G,{values:[[Y,{slots:{[ha]:g,label:g,description:p}}],[ga,{isSelected:$.isSelected}]]},C.children))});function Fr(t,e){e=he(e);let{dragAndDropHooks:l,dropState:a}=n.useContext(te),{dropIndicatorProps:r,isHidden:o,isDropTarget:i}=l.useDropIndicator(t,a,e);return o?null:c.createElement(Ir,{...t,dropIndicatorProps:r,isDropTarget:i,ref:e})}function kr(t,e){let{dropIndicatorProps:l,isDropTarget:a,...r}=t,o=I({...r,defaultClassName:"react-aria-DropIndicator",values:{isDropTarget:a}});return c.createElement(c.Fragment,null,c.createElement(A.div,{...l,...o,role:"option",ref:e,"data-drop-target":a||void 0}))}const Ir=n.forwardRef(kr);et(pa,function(e,l,a){let r=n.useContext(q),{isLoading:o,onLoadMore:i,scrollOffset:u,...s}=e,d=n.useRef(null),b=n.useMemo(()=>({onLoadMore:i,collection:r==null?void 0:r.collection,sentinelRef:d,scrollOffset:u}),[i,u,r==null?void 0:r.collection]);Br(b,d);let g=I({...s,id:void 0,children:a.rendered,defaultClassName:"react-aria-ListBoxLoadingIndicator",values:void 0}),p={tabIndex:-1};return c.createElement(c.Fragment,null,c.createElement("div",{style:{position:"relative",width:0,height:0},inert:xa(!0)},c.createElement("div",{"data-testid":"loadMoreSentinel",ref:d,style:{position:"absolute",height:1,width:1}})),o&&g.children&&c.createElement(c.Fragment,null,c.createElement(A.div,{...B(R(e,{global:!0}),p),...g,role:"option",ref:l},g.children)))});function zr(t){let{description:e,errorMessage:l,isInvalid:a,validationState:r}=t,{labelProps:o,fieldProps:i}=ct(t),u=ee([!!e,!!l,a,r]),s=ee([!!e,!!l,a,r]);return i=B(i,{"aria-describedby":[u,s,t["aria-describedby"]].filter(Boolean).join(" ")||void 0}),{labelProps:o,fieldProps:i,descriptionProps:{id:u},errorMessageProps:{id:s}}}const De=new WeakMap;function Kr(t,e,l){let{keyboardDelegate:a,isDisabled:r,isRequired:o,name:i,form:u,validationBehavior:s="aria"}=t,d=ve({usage:"search",sensitivity:"base"}),b=n.useMemo(()=>a||new me(e.collection,e.disabledKeys,l,d),[a,e.collection,e.disabledKeys,d,l]),{menuTriggerProps:g,menuProps:p}=pr({isDisabled:r,type:"listbox"},e,l),{keyboardProps:$}=fe({shortcuts:{ArrowLeft:()=>{var F,w;if(e.selectionManager.selectionMode==="multiple")return!1;let D=e.selectedKey!=null?(F=b.getKeyAbove)==null?void 0:F.call(b,e.selectedKey):(w=b.getFirstKey)==null?void 0:w.call(b);D!=null&&e.setSelectedKey(D)},ArrowRight:()=>{var F,w;if(e.selectionManager.selectionMode==="multiple")return!1;let D=e.selectedKey!=null?(F=b.getKeyBelow)==null?void 0:F.call(b,e.selectedKey):(w=b.getFirstKey)==null?void 0:w.call(b);D!=null&&e.setSelectedKey(D)}},allowRepeats:!0,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp}),{typeSelectProps:x}=ma({keyboardDelegate:b,selectionManager:e.selectionManager,onTypeSelect(D){e.setSelectedKey(D)}}),{isInvalid:v,validationErrors:f,validationDetails:y}=e.displayValidation,{labelProps:P,fieldProps:h,descriptionProps:E,errorMessageProps:C}=zr({...t,labelElementType:"span",isInvalid:v,errorMessage:t.errorMessage||f});e.selectionManager.selectionMode==="multiple"&&(x={});let M=R(t,{labelable:!0}),S=B(x,g,h),z=_();return De.set(e,{isDisabled:r,isRequired:o,name:i,form:u,validationBehavior:s}),{labelProps:{...P,onClick:()=>{var D;t.isDisabled||((D=l.current)==null||D.focus(),ya("keyboard"))}},triggerProps:B(M,{...S,isDisabled:r,onKeyDown:Ye(S.onKeyDown,$.onKeyDown),onKeyUp:$.onKeyUp,"aria-labelledby":[z,S["aria-labelledby"],S["aria-label"]&&!S["aria-labelledby"]?S.id:null].filter(Boolean).join(" "),onFocus(D){e.isFocused||(t.onFocus&&t.onFocus(D),t.onFocusChange&&t.onFocusChange(!0),e.setFocused(!0))},onBlur(D){e.isOpen||(t.onBlur&&t.onBlur(D),t.onFocusChange&&t.onFocusChange(!1),e.setFocused(!1))}}),valueProps:{id:z},menuProps:{...p,onAction:void 0,autoFocus:e.focusStrategy||!0,shouldSelectOnPressUp:!0,shouldFocusOnHover:!0,disallowEmptySelection:!0,linkBehavior:"selection",onBlur:D=>{va(D.currentTarget,D.relatedTarget)||(t.onBlur&&t.onBlur(D),t.onFocusChange&&t.onFocusChange(!1),e.setFocused(!1))},"aria-labelledby":[h["aria-labelledby"],S["aria-label"]&&!h["aria-labelledby"]?S.id:null].filter(Boolean).join(" ")},descriptionProps:E,errorMessageProps:C,isInvalid:v,validationErrors:f,validationDetails:y,hiddenSelectProps:{isDisabled:r,name:i,label:t.label,state:e,triggerRef:l,form:u}}}function Lr(t,e,l){let a=De.get(e)||{},{autoComplete:r,name:o=a.name,form:i=a.form,isDisabled:u=a.isDisabled}=t,{validationBehavior:s,isRequired:d}=a,{visuallyHiddenProps:b}=Pa({style:{position:"fixed",top:0,left:0}});Da(t.selectRef,e.defaultValue,e.setValue),Ca({validationBehavior:s,focus:()=>{var $;return($=l.current)==null?void 0:$.focus()}},e,t.selectRef);let g=e.setValue,p=n.useCallback($=>{let x=Ge($);x.multiple?g(Array.from(x.selectedOptions,v=>v.value)):g($.currentTarget.value)},[g]);return{containerProps:{...b,"aria-hidden":!0,"data-react-aria-prevent-focus":!0,"data-a11y-ignore":"aria-hidden-focus"},inputProps:{style:{display:"none"}},selectProps:{tabIndex:-1,autoComplete:r,disabled:u,multiple:e.selectionManager.selectionMode==="multiple",required:s==="native"&&d,name:o,form:i,value:e.value??"",onChange:p,onInput:p}}}function Tr(t){let{state:e,triggerRef:l,label:a,name:r,form:o,isDisabled:i}=t,u=n.useRef(null),s=n.useRef(null),{containerProps:d,selectProps:b}=Lr({...t,selectRef:e.collection.size<=300?u:s},e,l),g=Array.isArray(e.value)?e.value:[e.value];if(e.collection.size<=300)return c.createElement("div",{...d,"data-testid":"hidden-select-container"},c.createElement("label",null,a,c.createElement("select",{...b,ref:u},c.createElement("option",{value:"",label:" "}," "),[...e.collection.getKeys()].map(p=>{let $=e.collection.getItem(p);if($&&$.type==="item")return c.createElement("option",{key:$.key,value:$.key},$.textValue)}),e.collection.size===0&&r&&g.map((p,$)=>c.createElement("option",{key:$,value:p??""})))));if(r){let p=De.get(e)||{},{validationBehavior:$}=p;g.length===0&&(g=[null]);let x=g.map((v,f)=>{let y={type:"hidden",autoComplete:b.autoComplete,name:r,form:o,disabled:i,value:v??""};return $==="native"?c.createElement("input",{key:f,...y,ref:f===0?s:null,style:{display:"none"},type:"text",required:f===0?b.required:!1,onChange:()=>{}}):c.createElement("input",{key:f,...y,ref:f===0?s:null})});return c.createElement(c.Fragment,null,x)}return null}function Or(t){let{selectionMode:e="single",shouldCloseOnSelect:l=e==="single"}=t,a=tt(t),[r,o]=n.useState(null),i=n.useMemo(()=>t.defaultValue!==void 0?t.defaultValue:e==="single"?t.defaultSelectedKey??null:[],[t.defaultValue,t.defaultSelectedKey,e]),u=n.useMemo(()=>t.value!==void 0?t.value:e==="single"?t.selectedKey:void 0,[t.value,t.selectedKey,e]),[s,d]=Sa(u,i,t.onChange),b=e==="single"&&Array.isArray(s)?s[0]:s,g=h=>{var E;if(e==="single"){let C=Array.isArray(h)?h[0]??null:h;d(C),C!==b&&((E=t.onSelectionChange)==null||E.call(t,C))}else{let C=[];Array.isArray(h)?C=h:h!=null&&(C=[h]),d(C)}},p=Je({...t,selectionMode:e,disallowEmptySelection:e==="single",allowDuplicateSelectionEvents:!0,selectedKeys:n.useMemo(()=>Vr(b),[b]),onSelectionChange:h=>{if(h!=="all"){if(e==="single"){let E=h.values().next().value??null;g(E)}else g([...h]);l&&a.close(),v.commitValidation()}}}),$=p.selectionManager.firstSelectedKey,x=n.useMemo(()=>[...p.selectionManager.selectedKeys].map(h=>p.collection.getItem(h)).filter(h=>h!=null),[p.selectionManager.selectedKeys,p.collection]),v=Ea({...t,value:Array.isArray(b)&&b.length===0?null:b}),[f,y]=n.useState(!1),[P]=n.useState(b);return{...v,...p,...a,value:b,defaultValue:i??P,setValue:g,selectedKey:$,setSelectedKey:g,selectedItem:x[0]??null,selectedItems:x,defaultSelectedKey:t.defaultSelectedKey??(t.selectionMode==="single"?P:null),focusStrategy:r,open(h=null){(p.collection.size!==0||t.allowsEmptyCollection)&&(o(h),a.open())},toggle(h=null){(p.collection.size!==0||t.allowsEmptyCollection)&&(o(h),a.toggle())},isFocused:f,setFocused:y}}function Vr(t){if(t!==void 0)return t===null?[]:Array.isArray(t)?t:[t]}function Nr(t={}){let{locale:e}=be();return n.useMemo(()=>new Intl.ListFormat(e,t),[e,t])}function jr(t){return t&&t.__esModule?t.default:t}const Ce=n.createContext(null),Se=n.createContext(null),_r=de(function(e,l){[e,l]=U(e,l,Ce);let{children:a,isDisabled:r=!1,isInvalid:o=!1,isRequired:i=!1}=e,u=n.useMemo(()=>typeof a=="function"?a({isOpen:!1,isDisabled:r,isInvalid:o,isRequired:i,isFocused:!1,isFocusVisible:!1,defaultChildren:null}):a,[a,r,o,i]);return c.createElement(Xe,{content:u},s=>c.createElement(Zr,{props:e,collection:s,selectRef:l}))}),Ur=[xe,rt,Y];function Zr({props:t,selectRef:e,collection:l}){let{validationBehavior:a}=pe(lt)||{},r=t.validationBehavior??a??"native",o=Or({...t,collection:l,children:void 0,validationBehavior:r}),{isFocusVisible:i,focusProps:u}=ge({within:!0}),s=n.useRef(null),[d,b]=Qe(!t["aria-label"]&&!t["aria-labelledby"]),{labelProps:g,triggerProps:p,valueProps:$,menuProps:x,descriptionProps:v,errorMessageProps:f,hiddenSelectProps:y,...P}=Kr({...at(t),label:b,validationBehavior:r},o,s),h=n.useMemo(()=>({isOpen:o.isOpen,isFocused:o.isFocused,isFocusVisible:i,isDisabled:t.isDisabled||!1,isInvalid:P.isInvalid||!1,isRequired:t.isRequired||!1}),[o.isOpen,o.isFocused,i,t.isDisabled,P.isInvalid,t.isRequired]),E=I({...t,values:h,defaultClassName:"react-aria-Select"}),C=R(t,{global:!0});delete C.id;let M=n.useRef(null);return c.createElement(G,{values:[[Ce,t],[Se,o],[Al,$],[xe,{...g,ref:d,elementType:"span"}],[rt,{...p,ref:s,isPressed:o.isOpen,autoFocus:t.autoFocus}],[Ba,o],[wa,{trigger:"Select",triggerRef:s,scrollRef:M,placement:"bottom start","aria-labelledby":x["aria-labelledby"],clearContexts:Ur}],[Pe,{...x,ref:M}],[q,o],[Y,{slots:{description:v,errorMessage:f}}],[ot,P]]},c.createElement(A.div,{...B(C,E,u),ref:e,slot:t.slot||void 0,"data-focused":o.isFocused||void 0,"data-focus-visible":i||void 0,"data-open":o.isOpen||void 0,"data-disabled":t.isDisabled||void 0,"data-invalid":P.isInvalid||void 0,"data-required":t.isRequired||void 0},E.children,c.createElement(Tr,{...y,autoComplete:t.autoComplete})))}const Al=n.createContext(null),qr=de(function(e,l){var x;[e,l]=U(e,l,Al);let a=n.useContext(Se),{placeholder:r}=pe(Ce),o=a.selectedItems.map(v=>{var y;let f=(y=v.props)==null?void 0:y.children;return typeof f=="function"&&(f=f({isHovered:!1,isPressed:!1,isSelected:!1,isFocused:!1,isFocusVisible:!1,isDisabled:!1,selectionMode:"single",selectionBehavior:"toggle"})),f}),i=Nr(),u=n.useMemo(()=>a.selectedItems.map(v=>v==null?void 0:v.textValue),[a.selectedItems]),s=a.selectionManager.selectionMode,d=n.useMemo(()=>s==="single"?u[0]??"":i.format(u),[s,i,u]),b=n.useMemo(()=>{if(s==="single")return o[0];let v=i.formatToParts(u);if(v.length===0)return null;let f=0;return v.map(y=>y.type==="element"?c.createElement(n.Fragment,{key:f},o[f++]):y.value)},[s,i,u,o]),g=He(jr(El),"react-aria-components"),p=I({...e,defaultChildren:b??r??g.format("selectPlaceholder"),defaultClassName:"react-aria-SelectValue",values:{selectedItem:((x=a.selectedItems[0])==null?void 0:x.value)??null,selectedItems:n.useMemo(()=>a.selectedItems.map(v=>v.value??null),[a.selectedItems]),selectedText:d,isPlaceholder:a.selectedItems.length===0,state:a}}),$=R(e,{global:!0});return c.createElement(A.span,{ref:l,...$,...p,"data-placeholder":a.selectedItems.length===0||void 0},c.createElement(Y.Provider,{value:void 0},p.children))}),Wr=n.createContext(!1),Hr=({children:t})=>m.jsx(Wr,{value:!0,children:t}),Fl=n.createContext({}),Te=({children:t,className:e,color:l,size:a,variant:r,...o})=>{const i=c.useMemo(()=>lr({color:l,size:a,variant:r}),[l,a,r]),u=c.useMemo(()=>typeof t=="string"||typeof t=="number"?m.jsx(kl,{children:t}):t,[t]);return m.jsx(Fl,{value:{slots:i},children:m.jsx(O.span,{...o,className:K(i.base,e),"data-slot":"chip",children:u})})},kl=({children:t,className:e,...l})=>{const{slots:a}=n.use(Fl);return m.jsx(O.span,{className:K(a==null?void 0:a.label,e),"data-slot":"chip-label",...l,children:t})},Eo=Object.assign(Te,{Root:Te,Label:kl}),ie=new Map;function se(t,e,l=!0){const a=ut();return n.useMemo(()=>{if(e!==void 0)return e;if(!a){if(l&&ie.has(t))return ie.get(t);try{const r=document.documentElement,o=getComputedStyle(r).getPropertyValue(t).trim()||void 0;return l&&ie.set(t,o),o}catch{return}}},[t,e,a,l])}const Oe=({animationType:t,className:e,...l})=>{const a=se("--skeleton-animation",t),r=c.useMemo(()=>sr({animationType:a}),[a]);return m.jsx(O.div,{className:r.base({className:e}),...l})},Bo=Object.assign(Oe,{Root:Oe});function Gr(t,e,l){let{labelProps:a,inputProps:r,isSelected:o,...i}=Ra(t,e,l);return{labelProps:a,inputProps:{...r,role:"switch",checked:o},isSelected:o,...i}}const Yr=n.createContext(null),Il=n.createContext(null),zl=n.createContext(null),Xr=n.forwardRef(function(e,l){let{inputRef:a=null,...r}=e;[e,l]=U(r,l,Yr);let{validationBehavior:o}=pe(lt)||{},i=e.validationBehavior??o??"native",u=he(Ma(a,e.inputRef!==void 0?e.inputRef:null)),s=Aa(e),d=Gr({...at(e),children:typeof e.children=="function"?!0:e.children,validationBehavior:i},s,u),{descriptionProps:b,errorMessageProps:g,isSelected:p,isDisabled:$,isReadOnly:x,isInvalid:v,validationDetails:f,validationErrors:y}=d,P=I({...e,defaultClassName:"react-aria-SwitchField",values:{isSelected:p,isDisabled:$,isReadOnly:x,isInvalid:v,isRequired:e.isRequired||!1,state:s}}),h=R(e,{global:!0});return delete h.id,delete h.onClick,c.createElement(A.div,{...B(h,P),ref:l,slot:e.slot||void 0,"data-selected":p||void 0,"data-disabled":$||void 0,"data-readonly":x||void 0,"data-invalid":v||void 0,"data-required":e.isRequired||void 0},c.createElement(G,{values:[[Il,s],[zl,{...d,inputRef:u,defaultClassName:"react-aria-SwitchButton",isRequired:e.isRequired}],[Y,{slots:{description:b,errorMessage:g}}],[ot,{isInvalid:v,validationDetails:f,validationErrors:y}]]},P.children))}),Jr=n.forwardRef(function(e,l){let{labelProps:a,inputProps:r,isSelected:o,isDisabled:i,isReadOnly:u,isPressed:s,isInvalid:d,inputRef:b,defaultClassName:g,isRequired:p}=n.useContext(zl),{isFocused:$,isFocusVisible:x,focusProps:v}=ge(),f=i||u,y=n.useContext(Il),{hoverProps:P,isHovered:h}=H({...e,isDisabled:f}),E=I({...e,defaultClassName:g,values:{isSelected:o,isPressed:s,isHovered:h,isFocused:$,isFocusVisible:x,isDisabled:i,isReadOnly:u,isInvalid:d,isRequired:p||!1,state:y}}),C=R(e,{global:!0});return delete C.id,delete C.onClick,c.createElement(A.label,{...B(C,a,P,E),ref:l,slot:e.slot||void 0,"data-selected":o||void 0,"data-pressed":s||void 0,"data-hovered":h||void 0,"data-focused":$||void 0,"data-focus-visible":x||void 0,"data-disabled":i||void 0,"data-readonly":u||void 0,"data-invalid":d||void 0,"data-required":p||void 0},c.createElement(Fa,{elementType:"span"},c.createElement("input",{...B(r,v),ref:b})),E.children)}),X=n.createContext({}),ue=({children:t,className:e,size:l,...a})=>{const r=c.useMemo(()=>ur({size:l}),[l]);return m.jsx(Xr,{"data-slot":"switch",...a,className:T(e,r.base()),children:o=>m.jsx(X,{value:{slots:r,state:o},children:typeof t=="function"?t(o):t})})};ue.displayName="HeroUI.Switch";const Kl=({children:t,className:e,...l})=>{const{slots:a}=n.use(X);return m.jsx(Jr,{"data-slot":"switch-content",...l,className:T(e,a==null?void 0:a.content()),children:t})};Kl.displayName="HeroUI.Switch.Content";const Ll=({children:t,className:e,...l})=>{const{slots:a}=n.use(X);return m.jsx(O.span,{className:K(a==null?void 0:a.control,e),"data-slot":"switch-control",...l,children:t})};Ll.displayName="HeroUI.Switch.Control";const Tl=({children:t,className:e,...l})=>{const{slots:a}=n.use(X);return m.jsx(O.span,{className:K(a==null?void 0:a.thumb,e),"data-slot":"switch-thumb",...l,children:t})};Tl.displayName="HeroUI.Switch.Thumb";const Ol=({children:t,className:e,...l})=>{const{slots:a}=n.use(X);return m.jsx(O.span,{className:K(a==null?void 0:a.icon,e),"data-slot":"switch-icon",...l,children:t})};Ol.displayName="HeroUI.Switch.Icon";const wo=Object.assign(ue,{Root:ue,Content:Kl,Control:Ll,Thumb:Tl,Icon:Ol}),ce=c.createContext(null);function Qr(t){let{children:e}=t,l=n.useContext(ce),[a,r]=n.useState(0),o=n.useMemo(()=>({parent:l,modalCount:a,addModal(){r(i=>i+1),l&&l.addModal()},removeModal(){r(i=>i-1),l&&l.removeModal()}}),[l,a]);return c.createElement(ce.Provider,{value:o},e)}function eo(){let t=n.useContext(ce);return{modalProviderProps:{"aria-hidden":t&&t.modalCount>0?!0:void 0}}}function to(t){let{modalProviderProps:e}=eo();return c.createElement("div",{"data-overlay-container":!0,...t,...e})}function lo(t){return c.createElement(Qr,null,c.createElement(to,t))}function ao(t){let e=ka(),{portalContainer:l=e?null:document.body,...a}=t,{getContainer:r}=Ia();if(!t.portalContainer&&r&&(l=r()),c.useEffect(()=>{if(l!=null&&l.closest("[data-overlay-container]"))throw new Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.")},[l]),!l)return null;let o=c.createElement(lo,a);return za.createPortal(o,l)}const ro=1500,Ve=500;let N={},oo=0,Z=!1,k=null,j=null;function Vl(t={}){let{delay:e=ro,closeDelay:l=Ve}=t,{isOpen:a,open:r,close:o}=tt(t),[i,u]=n.useState(!1),s=n.useMemo(()=>`${++oo}`,[]),d=n.useRef(null),b=n.useRef(o),g=()=>{N[s]=x},p=()=>{for(let f in N)f!==s&&(N[f](!0,!0),delete N[f])},$=f=>{d.current&&clearTimeout(d.current),d.current=null,p(),g(),u(!!f),Z=!0,r(),k&&(clearTimeout(k),k=null),j&&(clearTimeout(j),j=null)},x=(f,y)=>{u(!!y),f||l<=0?(d.current&&clearTimeout(d.current),d.current=null,b.current()):d.current||(d.current=setTimeout(()=>{d.current=null,b.current()},l)),k&&(clearTimeout(k),k=null),Z&&(j&&clearTimeout(j),j=setTimeout(()=>{delete N[s],j=null,Z=!1},Math.max(Ve,l)))},v=()=>{p(),g(),!a&&!Z?(k&&clearTimeout(k),k=setTimeout(()=>{k=null,Z=!0,$(!1)},e)):a||$(!0)};return n.useEffect(()=>{b.current=o},[o]),n.useEffect(()=>()=>{d.current&&clearTimeout(d.current),N[s]&&delete N[s]},[s]),{isOpen:a,shouldSkipAnimation:i,open:f=>{!f&&e>0&&!d.current?v():$(Z)},close:x}}function io(t,e){let l=R(t,{labelable:!0}),{hoverProps:a}=H({onHoverStart:()=>e==null?void 0:e.open(!0),onHoverEnd:()=>e==null?void 0:e.close()});return{tooltipProps:B(l,a,{role:"tooltip"})}}function no(t,e,l){let{isDisabled:a,trigger:r,shouldCloseOnPress:o=!0}=t,i=_(),u=n.useRef(!1),s=n.useRef(!1),d=()=>{(u.current||s.current)&&e.open(s.current)},b=P=>{!u.current&&!s.current&&e.close(P)};n.useEffect(()=>{let P=h=>{l&&l.current&&h.key==="Escape"&&(h.stopPropagation(),e.close(!0))};if(e.isOpen)return document.addEventListener("keydown",P,!0),()=>{document.removeEventListener("keydown",P,!0)}},[l,e]);let g=()=>{r!=="focus"&&(Ka()==="pointer"?u.current=!0:u.current=!1,d())},p=()=>{r!=="focus"&&(s.current=!1,u.current=!1,b())},$=()=>{o&&(s.current=!1,u.current=!1,b(!0))},x=()=>{ne()&&(s.current=!0,d())},v=()=>{s.current=!1,u.current=!1,b(!0)},{hoverProps:f}=H({isDisabled:a,onHoverStart:g,onHoverEnd:p}),{focusableProps:y}=it({isDisabled:a,onFocus:x,onBlur:v},l);return{triggerProps:{"aria-describedby":e.isOpen?i:void 0,...B(y,f,{onPointerDown:$,onKeyDown:$}),tabIndex:void 0},tooltipProps:{id:i}}}const W=n.createContext(null),Nl=n.createContext(null);function so(t){let e=Vl(t),l=n.useRef(null),{triggerProps:a,tooltipProps:r}=no(t,e,l);return c.createElement(G,{values:[[W,e],[Nl,{...r,triggerRef:l}]]},c.createElement(La,{...a,ref:l},t.children))}const uo=n.forwardRef(function({UNSTABLE_portalContainer:e,...l},a){[l,a]=U(l,a,Nl);let r=n.useContext(W),o=Vl(l),i=l.isOpen!=null||l.defaultOpen!=null||!r?o:r,u=Ta(a,i.isOpen),s=l.isExiting||!i.shouldSkipAnimation&&u||!1;return!i.isOpen&&!s?null:c.createElement(ao,{portalContainer:e},c.createElement(co,{...l,tooltipRef:a,isExiting:s}))});function co(t){let e=n.useContext(W),l=n.useRef(null),{overlayProps:a,arrowProps:r,placement:o,triggerAnchorPoint:i}=Oa({placement:t.placement||"top",targetRef:t.triggerRef,overlayRef:t.tooltipRef,arrowRef:l,offset:t.offset,crossOffset:t.crossOffset,isOpen:e.isOpen,arrowBoundaryOffset:t.arrowBoundaryOffset,shouldFlip:t.shouldFlip,containerPadding:t.containerPadding,onClose:()=>e.close(!0)}),u=Va(t.tooltipRef,!!o),s=t.isEntering||!e.shouldSkipAnimation&&u||!1,d=I({...t,defaultClassName:"react-aria-Tooltip",values:{placement:o,isEntering:s,isExiting:t.isExiting,state:e}});t=B(t,a);let{tooltipProps:b}=io(t,e),g=R(t,{global:!0});return c.createElement(A.div,{...B(g,d,b),ref:t.tooltipRef,style:{...a.style,"--trigger-anchor-point":i?`${i.x}px ${i.y}px`:void 0,...d.style},"data-placement":o??void 0,"data-entering":s||void 0,"data-exiting":t.isExiting||void 0},c.createElement(Na.Provider,{value:{...r,placement:o,ref:l}},d.children))}const Ne=t=>{if(!t)return;const e=t.trim(),l=parseFloat(e);if(!Number.isNaN(l))return e.endsWith("ms")?l:e.endsWith("s")?l*1e3:l},Ee=n.createContext({}),fo=({children:t,shouldSkipAnimation:e})=>{const l=n.use(W);return!l||e?t:m.jsx(W,{value:{...l,shouldSkipAnimation:!1},children:t})},je=({children:t,closeDelay:e,delay:l,shouldSkipAnimation:a=!1,...r})=>{const o=c.useMemo(()=>cr(),[]),i=se("--tooltip-delay"),u=se("--tooltip-close-delay"),s=l??Ne(i),d=e??Ne(u);return m.jsx(Ee,{value:{slots:o},children:m.jsx(so,{closeDelay:d,"data-slot":"tooltip-root",delay:s,...r,children:m.jsx(fo,{shouldSkipAnimation:a,children:t})})})},bo=({children:t,className:e,offset:l,showArrow:a=!1,...r})=>{const{slots:o}=n.use(Ee),i=l||(a?7:3);return m.jsx(uo,{...r,className:T(e,o==null?void 0:o.base()),offset:i,children:t})},$o=({children:t,className:e,...l})=>{const a=m.jsx("svg",{"data-slot":"overlay-arrow",fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M0 0C5.48483 8 6.5 8 12 0Z"})}),r=c.isValidElement(t)?c.cloneElement(t,{"data-slot":"overlay-arrow"}):a;return m.jsx(ja,{"data-slot":"tooltip-arrow",...l,className:e,children:r})},go=({children:t,className:e,...l})=>{const{slots:a}=n.use(Ee),r=n.useRef(null),{focusableProps:o}=it({},r);return m.jsx(O.div,{ref:r,className:K(a==null?void 0:a.trigger,e),"data-slot":"tooltip-trigger",role:"button",..._a(o,l),children:t})},Ro=Object.assign(je,{Root:je,Trigger:go,Content:bo,Arrow:$o}),_e=({children:t,className:e,isDisabled:l,isInvalid:a,isRequired:r,...o})=>m.jsx(dr,{className:ar({isRequired:r,isDisabled:l,isInvalid:a,className:e}),"data-slot":"label",...o,children:t}),Mo=Object.assign(_e,{Root:_e}),jl=n.createContext({}),Ue=({children:t,className:e,variant:l,...a})=>{const r=c.useMemo(()=>or({variant:l}),[l]);return m.jsx(Ar,{className:T(e,r.item()),"data-slot":"list-box-item",...a,children:o=>m.jsx(jl,{value:{slots:r,state:o},children:typeof t=="function"?t(o):t})})},_l=({children:t,className:e,...l})=>{const{slots:a,state:r}=n.use(jl),o=r==null?void 0:r.isSelected,i=typeof t=="function"?t(r??{}):t||m.jsx("svg",{"aria-hidden":"true","data-slot":"list-box-item-indicator--checkmark",fill:"none",role:"presentation",stroke:"currentColor",strokeDasharray:22,strokeDashoffset:o?44:66,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 17 18",children:m.jsx("polyline",{points:"1 9 7 14 15 4"})});return m.jsx(O.span,{"aria-hidden":"true",className:K(a==null?void 0:a.indicator,e),"data-slot":"list-box-item-indicator","data-visible":o||void 0,...l,children:i})},ho=Object.assign(Ue,{Root:Ue,Indicator:_l}),po=({children:t,className:e,...l})=>{const a=c.useMemo(()=>ir({class:typeof e=="string"?e:void 0}),[e]);return m.jsx(Mr,{className:a,...l,children:t})},xo=po;function Ze({className:t,variant:e,...l}){const a=c.useMemo(()=>rr({variant:e}),[e]);return m.jsx(wr,{className:T(t,a),"data-slot":"list-box",...l})}const Ao=Object.assign(Ze,{Root:Ze,Item:ho,ItemIndicator:_l,Section:xo}),J=n.createContext({}),qe=({children:t,className:e,fullWidth:l,variant:a,...r})=>{const o=c.useMemo(()=>nr({fullWidth:l,variant:a}),[l,a]);return m.jsx(Hr,{children:m.jsx(J,{value:{slots:o},children:m.jsx(_r,{"data-slot":"select",...r,className:T(e,o==null?void 0:o.base()),children:i=>m.jsx(m.Fragment,{children:typeof t=="function"?t(i):t})})})})},mo=({children:t,className:e,...l})=>{const{slots:a}=n.use(J);return m.jsx(Wa,{className:T(e,a==null?void 0:a.trigger()),"data-slot":"select-trigger",...l,children:r=>m.jsx(m.Fragment,{children:typeof t=="function"?t(r):t})})},vo=({children:t,className:e,...l})=>{const{slots:a}=n.use(J);return m.jsx(qr,{className:T(e,a==null?void 0:a.value()),"data-slot":"select-value",...l,children:t})},yo=({children:t,className:e,...l})=>{const{slots:a}=n.use(J),r=n.use(Se);return t&&c.isValidElement(t)?c.cloneElement(t,{...l,className:K(a==null?void 0:a.indicator,e),"data-slot":"select-indicator","data-open":Ie(r==null?void 0:r.isOpen)}):m.jsx(qa,{className:K(a==null?void 0:a.indicator,e),"data-open":Ie(r==null?void 0:r.isOpen),"data-slot":"select-default-indicator",...l})},Po=({children:t,className:e,placement:l="bottom",...a})=>{const{slots:r}=n.use(J);return m.jsx(Ua,{value:{variant:"default"},children:m.jsx(Za,{...a,className:T(e,r==null?void 0:r.popover()),"data-slot":"select-popover",placement:l,children:t})})},Fo=Object.assign(qe,{Root:qe,Trigger:mo,Value:vo,Indicator:yo,Popover:Po}),Do=t=>n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},t),n.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M8 13.5a5.5 5.5 0 0 0 2.263-10.514 5.5 5.5 0 0 1-7.278 7.278A5.5 5.5 0 0 0 8 13.5M1.045 8.795a7.001 7.001 0 1 0 7.75-7.75l-.028-.003A7 7 0 0 0 8 1c-.527 0-.59.842-.185 1.18a4 4 0 0 1 .342.322A4 4 0 1 1 2.18 7.814C1.842 7.41 1 7.474 1 8a7 7 0 0 0 .045.794",clipRule:"evenodd"})),Co=t=>n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"none",viewBox:"0 0 16 16"},t),n.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M8 3a.75.75 0 0 1-.75-.75V.75a.75.75 0 0 1 1.5 0v1.5A.75.75 0 0 1 8 3m0 7.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5M8 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8m-.75 3.25a.75.75 0 0 0 1.5 0v-1.5a.75.75 0 0 0-1.5 0zM13 8a.75.75 0 0 1 .75-.75h1.5a.75.75 0 0 1 0 1.5h-1.5A.75.75 0 0 1 13 8M.75 7.25a.75.75 0 0 0 0 1.5h1.5a.75.75 0 0 0 0-1.5zm10.786-2.786a.75.75 0 0 1 0-1.06l1.06-1.06a.75.75 0 0 1 1.06 1.06l-1.06 1.06a.75.75 0 0 1-1.06 0m-9.193 8.132a.75.75 0 0 0 1.06 1.06l1.062-1.06a.75.75 0 0 0-1.061-1.06zm9.193-1.06a.75.75 0 0 1 1.06 0l1.06 1.06a.75.75 0 0 1-1.06 1.06l-1.06-1.06a.75.75 0 0 1 0-1.06M3.404 2.343a.75.75 0 0 0-1.06 1.06l1.06 1.061a.75.75 0 1 0 1.06-1.06z",clipRule:"evenodd"}));function ko(){const{theme:t,setTheme:e}=Ha(),l=a=>{const r=a;(r==="light"||r==="dark")&&e(r)};return m.jsx(V,{className:"w-fit shrink-0 text-center",selectedKey:t,onSelectionChange:a=>l(String(a)),children:m.jsx(V.ListContainer,{children:m.jsxs(V.List,{"aria-label":"页面主题",className:"w-fit",children:[m.jsxs(V.Tab,{"aria-label":"使用亮色模式",className:"h-6 w-6 px-0 text-xs data-[selected=true]:text-accent-foreground",id:"light",children:[m.jsx(Co,{className:"size-3.5"}),m.jsx(V.Indicator,{className:"bg-accent"})]}),m.jsxs(V.Tab,{"aria-label":"使用暗色模式",className:"h-6 w-6 px-0 text-xs data-[selected=true]:text-accent-foreground",id:"dark",children:[m.jsx(Do,{className:"size-3.5"}),m.jsx(V.Indicator,{className:"bg-accent"})]})]})})})}function Io(){return!1}export{Eo as C,Mo as L,Bo as S,Ro as T,ko as a,Fo as b,Ao as c,wo as d,Io as i};