uifork 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli.js CHANGED
@@ -14,7 +14,7 @@ uifork - A CLI tool for managing UI component versions
14
14
  Usage:
15
15
  uifork <component-path> Initialize a new forked component (shorthand)
16
16
  uifork init <component-path> Initialize a new forked component (explicit)
17
- uifork watch [directory] Watch for version changes (defaults to current directory)
17
+ uifork watch [directory] [--port <port>] Watch for version changes (defaults to current directory)
18
18
  uifork new <component-path> [version-id] Create a new version
19
19
  uifork fork <component-path> <version-id> [target-version] Fork/duplicate a version
20
20
  uifork rename <component-path> <version-id> <new-version-id> Rename a version
@@ -26,6 +26,8 @@ Examples:
26
26
  uifork init frontend/src/SomeDropdownComponent.tsx
27
27
  uifork watch
28
28
  uifork watch ./src
29
+ uifork watch --port 3002
30
+ uifork watch ./src --port 3002
29
31
  uifork new SomeDropdownComponent
30
32
  uifork new SomeDropdownComponent v3
31
33
  uifork fork SomeDropdownComponent v1 v2
@@ -49,6 +51,7 @@ Options:
49
51
  -h, --help Show this help message
50
52
  -v, --version Show version number
51
53
  -w Start watching after init (init command only)
54
+ --port <port> Port for the watch server (default: 3030); also respects PORT env var
52
55
  --lazy Use lazy loading for component versions (watch command only)
53
56
  `);
54
57
  }
@@ -136,12 +139,25 @@ switch (command) {
136
139
  // Watch can be called without arguments - defaults to current directory
137
140
  // Parse --lazy flag
138
141
  const lazyMode = args.includes("--lazy");
142
+ // Parse --port flag
143
+ const portIndex = args.indexOf("--port");
144
+ const watchPort =
145
+ portIndex !== -1 && args[portIndex + 1]
146
+ ? parseInt(args[portIndex + 1], 10)
147
+ : undefined;
139
148
  // Filter out flags to get the actual directory argument
140
149
  const watchDir = args.find(
141
- (arg, index) => index > 0 && !arg.startsWith("--") && arg !== "watch",
150
+ (arg, index) =>
151
+ index > 0 &&
152
+ !arg.startsWith("--") &&
153
+ arg !== "watch" &&
154
+ (index !== portIndex + 1 || isNaN(parseInt(arg, 10))),
142
155
  );
143
156
  try {
144
- new VersionSync(watchDir || process.cwd(), { lazy: lazyMode });
157
+ new VersionSync(watchDir || process.cwd(), {
158
+ lazy: lazyMode,
159
+ ...(watchPort && !isNaN(watchPort) ? { port: watchPort } : {}),
160
+ });
145
161
  } catch (error) {
146
162
  console.error(`Error during watching: ${error.message}`);
147
163
  process.exit(1);
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentSelector.d.ts","sourceRoot":"","sources":["../../src/components/ComponentSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAI9C,UAAU,sBAAsB;IAC9B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,eAAe,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CAChD;AAED,wBAAgB,iBAAiB,CAAC,EAChC,iBAAiB,EACjB,QAAQ,EACR,eAAe,GAChB,EAAE,sBAAsB,2CAiCxB;AAED,wBAAgB,yBAAyB,CAAC,EACxC,iBAAiB,EACjB,iBAAiB,EACjB,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,oBAAoB,EACpB,WAAW,GACZ,EAAE;IACD,iBAAiB,EAAE,aAAa,EAAE,CAAC;IACnC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,QAAQ,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,oBAAoB,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACtD,WAAW,EAAE,OAAO,CAAC;CACtB,kDA0DA"}
1
+ {"version":3,"file":"ComponentSelector.d.ts","sourceRoot":"","sources":["../../src/components/ComponentSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAI9C,UAAU,sBAAsB;IAC9B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,eAAe,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CAChD;AAED,wBAAgB,iBAAiB,CAAC,EAChC,iBAAiB,EACjB,QAAQ,EACR,eAAe,GAChB,EAAE,sBAAsB,2CAiCxB;AAED,wBAAgB,yBAAyB,CAAC,EACxC,iBAAiB,EACjB,iBAAiB,EACjB,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,oBAAoB,EACpB,WAAW,GACZ,EAAE;IACD,iBAAiB,EAAE,aAAa,EAAE,CAAC;IACnC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,QAAQ,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,oBAAoB,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACtD,WAAW,EAAE,OAAO,CAAC;CACtB,kDA4DA"}
@@ -1,10 +1,13 @@
1
1
  import { ForkedComponentProps } from '../types';
2
2
  /**
3
- * A component2 that renders a specific version based on localStorage state.
3
+ * A component that renders a specific version based on localStorage state.
4
4
  * Used to wrap components that have multiple versions managed by uifork.
5
5
  *
6
6
  * The UIFork component controls which version is active by writing to localStorage.
7
7
  * ForkedComponent reads from localStorage and renders the appropriate version.
8
+ *
9
+ * For now, each version file must default-export its component. Named exports are
10
+ * being considered for the future.
8
11
  */
9
12
  export declare function ForkedComponent<T extends Record<string, unknown>>({ id, versions, props, defaultVersion, }: ForkedComponentProps<T>): import("react/jsx-runtime").JSX.Element | null;
10
13
  //# sourceMappingURL=ForkedComponent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ForkedComponent.d.ts","sourceRoot":"","sources":["../../src/components/ForkedComponent.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EACjE,EAAE,EACF,QAAQ,EACR,KAAK,EACL,cAAc,GACf,EAAE,oBAAoB,CAAC,CAAC,CAAC,kDAyEzB"}
1
+ {"version":3,"file":"ForkedComponent.d.ts","sourceRoot":"","sources":["../../src/components/ForkedComponent.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EACjE,EAAE,EACF,QAAQ,EACR,KAAK,EACL,cAAc,GACf,EAAE,oBAAoB,CAAC,CAAC,CAAC,kDAyEzB"}
@@ -5,6 +5,9 @@ import { ForkedComponentProps } from '../types';
5
5
  *
6
6
  * The UIFork component controls which version is active by writing to localStorage.
7
7
  * ForkedComponent reads from localStorage and renders the appropriate version.
8
+ *
9
+ * For now, each version file must default-export its component. Named exports are
10
+ * being considered for the future.
8
11
  */
9
12
  export declare function LazyForkedComponent<T extends Record<string, unknown>>({ id, versions, props, defaultVersion, }: ForkedComponentProps<T>): import("react/jsx-runtime").JSX.Element | null;
10
13
  //# sourceMappingURL=LazyForkedComponent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LazyForkedComponent.d.ts","sourceRoot":"","sources":["../../src/components/LazyForkedComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EACrE,EAAE,EACF,QAAQ,EACR,KAAK,EACL,cAAc,GACf,EAAE,oBAAoB,CAAC,CAAC,CAAC,kDA2FzB"}
1
+ {"version":3,"file":"LazyForkedComponent.d.ts","sourceRoot":"","sources":["../../src/components/LazyForkedComponent.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EACrE,EAAE,EACF,QAAQ,EACR,KAAK,EACL,cAAc,GACf,EAAE,oBAAoB,CAAC,CAAC,CAAC,kDA2FzB"}
@@ -1,14 +1,10 @@
1
- import { ConnectionStatus } from '../hooks/useWebSocketConnection';
2
- import { ActiveView } from './types';
3
1
  type TriggerContentProps = {
4
- activeView: ActiveView;
5
- connectionStatus: ConnectionStatus;
2
+ hasSelection: boolean;
6
3
  selectedComponent: string;
7
4
  activeVersion: string;
8
5
  activeVersionLabel?: string;
9
6
  formatVersionLabel: (version: string) => string;
10
- isConnected: boolean;
11
7
  };
12
- declare const TriggerContent: ({ activeView, connectionStatus, selectedComponent, activeVersion, activeVersionLabel, formatVersionLabel, isConnected, }: TriggerContentProps) => import("react/jsx-runtime").JSX.Element;
8
+ declare const TriggerContent: ({ hasSelection, selectedComponent, activeVersion, activeVersionLabel, formatVersionLabel, }: TriggerContentProps) => import("react/jsx-runtime").JSX.Element;
13
9
  export default TriggerContent;
14
10
  //# sourceMappingURL=TriggerContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TriggerContent.d.ts","sourceRoot":"","sources":["../../src/components/TriggerContent.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,KAAK,mBAAmB,GAAG;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IAChD,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,QAAA,MAAM,cAAc,GAAI,0HAQrB,mBAAmB,4CA+CrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"TriggerContent.d.ts","sourceRoot":"","sources":["../../src/components/TriggerContent.tsx"],"names":[],"mappings":"AAKA,KAAK,mBAAmB,GAAG;IACzB,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;CACjD,CAAC;AAEF,QAAA,MAAM,cAAc,GAAI,6FAMrB,mBAAmB,4CAwBrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"UIFork.d.ts","sourceRoot":"","sources":["../../src/components/UIFork.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAGxE,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,UAAU,CAAC;AAyBzD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,EAAE,IAAW,EAAE,SAAc,EAAE,KAAK,EAAE,EAAE,WAAW,4BAwiBzE"}
1
+ {"version":3,"file":"UIFork.d.ts","sourceRoot":"","sources":["../../src/components/UIFork.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAGxE,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,UAAU,CAAC;AAyBzD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,EAAE,IAAW,EAAE,SAAc,EAAE,KAAK,EAAE,EAAE,WAAW,4BAsiBzE"}
@@ -1,3 +1,5 @@
1
1
  export declare const ANIMATION_DURATION = 0.3;
2
2
  export declare const ANIMATION_EASING: readonly [0.04, 1.02, 0.13, 1.02];
3
+ /** localStorage key prefix for component version storage (e.g. uifork-component-MyComponent) */
4
+ export declare const COMPONENT_VERSION_STORAGE_PREFIX = "uifork-component-";
3
5
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/components/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,eAAO,MAAM,gBAAgB,mCAAoC,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/components/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,eAAO,MAAM,gBAAgB,mCAAoC,CAAC;AAElE,gGAAgG;AAChG,eAAO,MAAM,gCAAgC,sBAAsB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useVersionManagement.d.ts","sourceRoot":"","sources":["../../src/hooks/useVersionManagement.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,UAAU,2BAA2B;IACnC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,WAAW,EAAE,CAAC;CACzB;AAED,wBAAgB,oBAAoB,CAAC,EACnC,iBAAiB,EACjB,QAAQ,GACT,EAAE,2BAA2B;;;;;;2BAiEhB,MAAM;6BAUN,MAAM,KAAG,MAAM,GAAG,IAAI;;;mCA3BtB,MAAM;;EAuEnB"}
1
+ {"version":3,"file":"useVersionManagement.d.ts","sourceRoot":"","sources":["../../src/hooks/useVersionManagement.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,UAAU,2BAA2B;IACnC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,WAAW,EAAE,CAAC;CACzB;AAED,wBAAgB,oBAAoB,CAAC,EACnC,iBAAiB,EACjB,QAAQ,GACT,EAAE,2BAA2B;;;;;;2BAmEhB,MAAM;6BAUN,MAAM,KAAG,MAAM,GAAG,IAAI;;;mCA3BtB,MAAM;;EAuEnB"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode(`#uifork-root{--uifork-bg-dark: #262626;--uifork-bg-hover: #303030;--uifork-button-hover: #404040;--uifork-bg-input: #404040;--uifork-border-color: #2f2f2f;--uifork-text-primary: white;--uifork-text-secondary: #a3a3a3;--uifork-text-muted: #a3a3a3;--uifork-status-connected: #22c55e;--uifork-status-connecting: #eab308;--uifork-status-disconnected: #ef4444;--uifork-accent-success: #22c55e;--uifork-accent-danger: #ef4444;--uifork-accent-delete: #f87171;--uifork-shadow-sm: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -2px rgba(0, 0, 0, .05);--uifork-shadow-md: 0 25px 50px -12px rgba(0, 0, 0, .25);--uifork-bg: var(--uifork-bg-dark);--uifork-fg: var(--uifork-text-primary);--uifork-fg-secondary: var(--uifork-text-secondary);--uifork-hover-bg: rgba(255, 255, 255, .1);--uifork-menu-item-height: 32px;--uifork-trigger-height: 32px}#uifork-root[data-theme=light]{--uifork-bg-dark: #ffffff;--uifork-bg-hover: #f5f5f5;--uifork-button-hover: #e5e5e5;--uifork-bg-input: #e5e5e5;--uifork-border-color: #f0f0f0;--uifork-text-primary: #171717;--uifork-text-secondary: #525252;--uifork-text-muted: #737373;--uifork-shadow-sm: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -2px rgba(0, 0, 0, .05);--uifork-shadow-md: 0 25px 50px -12px rgba(0, 0, 0, .15);--uifork-hover-bg: rgba(0, 0, 0, .08)}@media(prefers-color-scheme:light){#uifork-root[data-theme=system]{--uifork-bg-dark: #ffffff;--uifork-bg-hover: #f5f5f5;--uifork-bg-input: #e5e5e5;--uifork-border-color: #f0f0f0;--uifork-text-primary: #171717;--uifork-text-secondary: #525252;--uifork-text-muted: #737373;--uifork-shadow-sm: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -2px rgba(0, 0, 0, .05);--uifork-shadow-md: 0 25px 50px -12px rgba(0, 0, 0, .15);--uifork-hover-bg: rgba(0, 0, 0, .08)}}@keyframes _popoverFadeIn_hdtc9_1{0%{opacity:0;transform:scale(.95);filter:blur(4px)}to{opacity:1;transform:scale(1);filter:blur(0)}}._container_hdtc9_66{position:fixed;z-index:1001;background-color:var(--uifork-bg-dark);box-shadow:var(--uifork-shadow-md);border:1px solid var(--uifork-border-color);overflow:hidden;display:flex;flex-direction:column;border-radius:12px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}._container_hdtc9_66._containerClosed_hdtc9_90{border-radius:16px}._container_hdtc9_66[data-dragging=true],._container_hdtc9_66[data-dragging=true] *{cursor:grabbing!important}._trigger_hdtc9_104{display:flex;align-items:center;gap:8px;padding:8px 12px;box-sizing:border-box;font-size:14px;color:var(--uifork-fg);cursor:pointer;background-color:transparent;border:none;white-space:nowrap;height:var(--uifork-trigger-height)}._trigger_hdtc9_104:hover{background-color:var(--uifork-hover-bg)}._trigger_hdtc9_104._triggerIconOnly_hdtc9_121{padding:4px;box-sizing:border-box;width:var(--uifork-trigger-height);height:var(--uifork-trigger-height);justify-content:center}._trigger_hdtc9_104._triggerEmpty_hdtc9_128{padding:4px;box-sizing:border-box;width:32px;height:32px;justify-content:center}._statusIndicator_hdtc9_137{width:8px;height:8px;border-radius:50%}._statusIndicatorConnected_hdtc9_143{background-color:var(--uifork-status-connected)}._statusIndicatorConnecting_hdtc9_147{background-color:var(--uifork-status-connecting)}._statusIndicatorDisconnected_hdtc9_151{background-color:var(--uifork-status-disconnected)}._statusIndicatorFailed_hdtc9_155{background-color:var(--uifork-status-disconnected);animation:_pulse_hdtc9_1 2s ease-in-out infinite}@keyframes _pulse_hdtc9_1{0%,to{opacity:1}50%{opacity:.5}}._menuItem_hdtc9_171{height:var(--uifork-menu-item-height);min-height:var(--uifork-menu-item-height);border-radius:8px}._triggerSeparator_hdtc9_178{color:var(--uifork-fg-secondary);margin:0 4px}._triggerLabel_hdtc9_183,._triggerVersion_hdtc9_184{white-space:nowrap}._triggerLabel_hdtc9_183{font-weight:500}._triggerVersion_hdtc9_184{color:var(--uifork-fg-secondary)}._triggerIconContainer_hdtc9_197{position:relative;display:flex;align-items:center;justify-content:center}._triggerIcon_hdtc9_121{width:16px;height:16px;transition:transform .2s,color .4s cubic-bezier(.4,0,.2,1),width .2s;color:var(--uifork-fg-secondary)}._triggerIcon_hdtc9_121._triggerIconOpen_hdtc9_214{transform:rotate(180deg)}._triggerIcon_hdtc9_121._triggerIconOnline_hdtc9_217{color:#22c55e}._triggerIcon_hdtc9_121._triggerIconOffline_hdtc9_220{color:var(--uifork-fg-secondary)}._connectionErrorDot_hdtc9_224{position:absolute;bottom:-2px;right:-2px;width:8px;height:8px;border-radius:50%;background-color:var(--uifork-status-disconnected);border:2px solid var(--uifork-bg-dark);box-sizing:border-box}._dropdown_hdtc9_237{min-width:200px;padding:4px;box-sizing:border-box;display:flex;flex-direction:column}._componentSelectorRow_hdtc9_246{display:flex;align-items:center;justify-content:space-between;padding:0;box-sizing:border-box}._componentSelector_hdtc9_246{padding:8px 12px;box-sizing:border-box;font-size:14px;color:var(--uifork-fg);background-color:transparent;border:none;border-radius:8px;cursor:pointer;display:flex;align-items:center;justify-content:space-between;gap:8px;text-align:left;flex-shrink:0}._componentSelector_hdtc9_246:hover{background-color:var(--uifork-hover-bg)}._componentSelectorLabel_hdtc9_275{font-weight:500;color:var(--uifork-fg)}._componentSelectorIcon_hdtc9_280{width:12px;height:12px;color:var(--uifork-fg-secondary);flex-shrink:0}._componentSelectorSettings_hdtc9_287{padding:8px;box-sizing:border-box;background-color:transparent;border:none;border-radius:8px;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--uifork-fg);transition:background-color .15s}._componentSelectorSettings_hdtc9_287:hover{background-color:var(--uifork-hover-bg)}._componentSelectorSettingsIcon_hdtc9_304{width:16px;height:16px}._divider_hdtc9_310{border-top:1px solid var(--uifork-border-color);margin:4px 0}._versionsList_hdtc9_316{display:flex;flex-direction:column;max-height:300px;overflow-y:auto;gap:2px}._versionsList_hdtc9_316::-webkit-scrollbar{width:4px}._versionsList_hdtc9_316::-webkit-scrollbar-track{background:transparent}._versionsList_hdtc9_316::-webkit-scrollbar-thumb{background:var(--uifork-border-color);border-radius:2px}._emptyState_hdtc9_336{padding:8px 12px;box-sizing:border-box;font-size:14px;color:var(--uifork-text-muted)}._emptyStateContainer_hdtc9_343{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:12px;box-sizing:border-box;gap:8px;text-align:center}._emptyStateHeading_hdtc9_354{font-size:14px;font-weight:500;color:var(--uifork-fg);margin:0}._emptyStateText_hdtc9_361{font-size:13px;color:var(--uifork-fg-secondary);margin:0;line-height:1.4;max-width:200px}._inlineCode_hdtc9_369{font-family:monospace;font-size:13px;background-color:var(--uifork-bg-input);padding:2px 4px;box-sizing:border-box;border-radius:3px;color:var(--uifork-fg)}._emptyStateCommandContainer_hdtc9_379{display:flex;align-items:center;gap:4px;background-color:var(--uifork-bg-input);padding:4px 8px;box-sizing:border-box;border-radius:4px;margin-top:4px;border:none;cursor:pointer;transition:background-color .15s}._emptyStateCommandContainer_hdtc9_379:hover{background-color:var(--uifork-hover-bg)}._emptyStateCommand_hdtc9_379{font-size:13px;color:var(--uifork-fg);margin:0;font-family:monospace}._emptyStateCopyIcon_hdtc9_403{width:14px;height:14px;color:var(--uifork-text-secondary);flex-shrink:0;transition:color .15s}._emptyStateCommandContainer_hdtc9_379:hover ._emptyStateCopyIcon_hdtc9_403{color:var(--uifork-text-primary)}._versionItem_hdtc9_415{padding:8px 4px 8px 8px;box-sizing:border-box;font-size:14px;color:var(--uifork-fg);background-color:transparent;border:none;border-radius:8px;cursor:pointer}._versionItem_hdtc9_415:hover{background-color:var(--uifork-hover-bg)}._versionItem_hdtc9_415{display:flex;align-items:center;gap:8px}._versionItem_hdtc9_415:hover ._actions_hdtc9_433{opacity:1}._checkmarkContainer_hdtc9_438{width:16px;height:16px;flex-shrink:0;display:flex;align-items:center;justify-content:center}._checkmarkIcon_hdtc9_447{width:16px;height:16px;opacity:.5}._versionLabel_hdtc9_454{flex:1;display:flex;align-items:center;gap:8px}._versionId_hdtc9_461{color:var(--uifork-fg)}._versionLabelText_hdtc9_465{opacity:.5}._versionItemEditing_hdtc9_470{padding:8px 4px 8px 8px;box-sizing:border-box;font-size:14px;color:var(--uifork-fg);background-color:var(--uifork-hover-bg);border:none;border-radius:8px;display:flex;align-items:center;gap:8px}._renameInput_hdtc9_484{flex:1;background-color:transparent;padding:0;box-sizing:border-box;font-size:14px;color:var(--uifork-fg);border:none;outline:none}._renameInput_hdtc9_484::placeholder{color:var(--uifork-text-muted)}._actions_hdtc9_433{display:flex;align-items:center;gap:2px;opacity:0;transition:opacity .15s}._actionButton_hdtc9_507{padding:4px;box-sizing:border-box;border-radius:4px;background-color:transparent;border:none;cursor:pointer;color:var(--uifork-fg);transition:background-color .15s ease;display:flex;align-items:center;justify-content:center;height:calc(var(--uifork-menu-item-height) - 8px);width:calc(var(--uifork-menu-item-height) - 8px)}._actionButton_hdtc9_507:hover{background-color:var(--uifork-hover-bg)}._actionIcon_hdtc9_526{width:14px;height:14px;color:var(--uifork-fg-secondary);transition:color .15s}._actionButton_hdtc9_507:hover ._actionIcon_hdtc9_526{color:var(--uifork-fg)}._disabled_hdtc9_537{opacity:.4;cursor:not-allowed;pointer-events:none}._actionButtonMore_hdtc9_543{position:relative}._popover_hdtc9_548{position:fixed;z-index:1002;min-width:140px;border-radius:12px;background-color:var(--uifork-bg-dark);box-shadow:var(--uifork-shadow-md);border:1px solid var(--uifork-border-color);padding:4px;box-sizing:border-box;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;transform-origin:left center;animation:_popoverFadeIn_hdtc9_1 .2s cubic-bezier(.04,1.02,.13,1.02)}._popoverMenuItem_hdtc9_575{display:flex;width:100%;align-items:center;gap:8px;padding:8px 4px 8px 8px;box-sizing:border-box;font-size:14px;color:var(--uifork-fg);background-color:transparent;border:none;cursor:pointer;text-align:left}._popoverMenuItem_hdtc9_575:hover{background-color:var(--uifork-hover-bg)}._popoverMenuItem_hdtc9_575._popoverMenuItemDelete_hdtc9_592{color:var(--uifork-accent-delete)}._popoverMenuItemIcon_hdtc9_596{width:16px;height:16px;color:var(--uifork-fg-secondary);flex-shrink:0}._popoverMenuItem_hdtc9_575._popoverMenuItemDelete_hdtc9_592 ._popoverMenuItemIcon_hdtc9_596{color:var(--uifork-accent-delete)}._confirmButton_hdtc9_607{padding:4px;box-sizing:border-box;border-radius:4px;background-color:transparent;border:none;cursor:pointer}._confirmIcon_hdtc9_616{width:16px;height:16px;color:var(--uifork-accent-success)}._cancelIcon_hdtc9_622{width:16px;height:16px;color:var(--uifork-accent-danger)}._newVersionButton_hdtc9_629{padding:8px 4px 8px 8px;box-sizing:border-box;font-size:14px;color:var(--uifork-fg);background-color:transparent;border:none;border-radius:8px;cursor:pointer}._newVersionButton_hdtc9_629{display:flex;width:100%;align-items:center;gap:8px;text-align:left;color:var(--uifork-fg)}._newVersionButton_hdtc9_629:hover{background-color:var(--uifork-hover-bg)}._newVersionIconContainer_hdtc9_654{width:16px;height:16px;flex-shrink:0;display:flex;align-items:center;justify-content:center}._newVersionIcon_hdtc9_654{width:16px;height:16px}._componentSelectorDropdown_hdtc9_669{position:fixed;z-index:1002;width:max-content;min-width:220px;border-radius:12px;background-color:var(--uifork-bg-dark);box-shadow:var(--uifork-shadow-md);border:1px solid var(--uifork-border-color);padding:4px;box-sizing:border-box;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;transform-origin:right center;animation:_popoverFadeIn_hdtc9_1 .2s cubic-bezier(.04,1.02,.13,1.02)}._componentSelectorItem_hdtc9_697{display:flex;align-items:center;gap:8px;padding:8px 12px;box-sizing:border-box;font-size:14px;color:var(--uifork-fg);background-color:transparent;border:none;cursor:pointer;text-align:left;width:100%}._componentSelectorItem_hdtc9_697:hover,._componentSelectorItem_hdtc9_697._componentSelectorItemSelected_hdtc9_712{background-color:var(--uifork-hover-bg)}._componentSelectorItemCheckmarkContainer_hdtc9_716{width:16px;height:16px;flex-shrink:0;display:flex;align-items:center;justify-content:center}._componentSelectorItemCheckmark_hdtc9_716{width:16px;height:16px}._componentSelectorItemName_hdtc9_730{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._componentSelectorItemCount_hdtc9_738{margin-left:auto;color:var(--uifork-text-muted);font-size:12px;flex-shrink:0}._componentSelectorDropdownTitle_hdtc9_745{font-size:12px;color:var(--uifork-text-muted);margin-bottom:4px;padding-left:4px;box-sizing:border-box;font-weight:500}._componentSelectorDropdownHint_hdtc9_754{font-size:11px;color:var(--uifork-text-muted);padding:4px 6px;box-sizing:border-box;line-height:1.4;max-width:230px;display:flex;align-items:flex-start;gap:6px}._componentSelectorDropdownHintIcon_hdtc9_766{flex-shrink:0;color:var(--uifork-text-muted);margin-top:1px}._componentSelectorDropdownHintCode_hdtc9_772{display:inline-flex;align-items:center;gap:4px;font-family:ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,monospace;font-size:10px;background:var(--uifork-bg-hover);color:var(--uifork-fg);padding:2px 5px;box-sizing:border-box;border-radius:4px}._settingsView_hdtc9_786{display:flex;flex-direction:column;gap:12px;padding:8px;box-sizing:border-box}._settingsBackButton_hdtc9_794{position:relative;display:flex;align-items:center;gap:4px;padding:0;box-sizing:border-box;font-size:14px;color:var(--uifork-fg);background-color:transparent;border:none;cursor:pointer;text-align:left;z-index:1}._settingsBackButton_hdtc9_794:before{content:"";position:absolute;inset:-6px -10px -6px -6px;background-color:transparent;border-radius:8px;transition:background-color .15s;z-index:-1}._settingsBackButton_hdtc9_794:hover:before{background-color:var(--uifork-hover-bg)}._settingsBackIcon_hdtc9_827{width:16px;height:16px;transform:rotate(180deg);margin-left:-2px}._settingsContent_hdtc9_834{flex:1;display:flex;flex-direction:column;gap:12px}._settingsTitle_hdtc9_841{font-size:16px;font-weight:500;color:var(--uifork-fg);margin:0 0 8px}._settingsText_hdtc9_848{font-size:14px;color:var(--uifork-fg-secondary);margin:0;line-height:1.5}._settingsGroup_hdtc9_855{display:flex;align-items:center;gap:8px}._settingsLabel_hdtc9_861{font-size:13px;font-weight:500;color:var(--uifork-fg);white-space:nowrap;width:100px;text-align:left;flex-shrink:0}._settingsSelect_hdtc9_871{flex:1;padding:0 30px 0 12px;box-sizing:border-box;height:var(--uifork-trigger-height);font-size:14px;color:var(--uifork-fg);background-color:var(--uifork-bg-input);border:1px solid var(--uifork-border-color);border-radius:8px;cursor:pointer;outline:none;transition:background-color .15s,border-color .15s;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23a3a3a3' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 8px center;text-align:left}._settingsSelect_hdtc9_871:hover{background-color:var(--uifork-hover-bg);border-color:var(--uifork-border-color);opacity:.9}._settingsSelect_hdtc9_871:focus{border-color:var(--uifork-border-color);background-color:var(--uifork-hover-bg);outline:2px solid var(--uifork-border-color);outline-offset:2px}._settingsSelect_hdtc9_871 option{background-color:var(--uifork-bg-dark);color:var(--uifork-fg)}._settingsCheckboxGroup_hdtc9_909{display:flex;flex-direction:column;align-items:flex-start;gap:0}._settingsCheckboxLabel_hdtc9_916{display:flex;flex-direction:row;gap:10px;width:100%;cursor:pointer;align-items:flex-start}._settingsCheckboxInput_hdtc9_925{position:absolute;opacity:0;width:0;height:0;margin:0;pointer-events:none}._settingsCheckboxVisual_hdtc9_934{width:16px;height:16px;border-radius:5px;border:1.5px solid var(--uifork-border-color);background-color:transparent;display:flex;align-items:center;justify-content:center;transition:all .15s ease;flex-shrink:0;margin-top:2px}._settingsCheckboxVisualChecked_hdtc9_948{background-color:#3b82f6;border-color:#3b82f6}._settingsCheckboxContent_hdtc9_953{display:flex;flex-direction:column;gap:0;flex:1}._settingsCheckboxLabelText_hdtc9_960{width:auto;margin:0;font-size:14px}._settingsCheckboxDescription_hdtc9_966{margin:0;font-size:13px;opacity:.8}._tooltip_hdtc9_973{position:fixed;z-index:1003;padding:2px 6px;box-sizing:border-box;font-size:12px;color:var(--uifork-text-primary);background-color:var(--uifork-bg-dark);border:1px solid var(--uifork-border-color);border-radius:6px;box-shadow:var(--uifork-shadow-md);pointer-events:none;white-space:nowrap;opacity:0;transition:opacity .15s ease-in-out;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}._tooltipVisible_hdtc9_1002{opacity:1}._offlineMessageCommandButton_hdtc9_1006{display:inline-flex;align-items:center;gap:4px;background-color:transparent;border:none;cursor:pointer;padding:0;box-sizing:border-box;transition:opacity .15s}._offlineMessageCommandButton_hdtc9_1006:hover{opacity:.8}._offlineMessageCopyIcon_hdtc9_1022{width:12px;height:12px;color:var(--uifork-text-muted);flex-shrink:0;transition:color .15s}._offlineMessageCommandButton_hdtc9_1006:hover ._offlineMessageCopyIcon_hdtc9_1022{color:var(--uifork-text-primary)}`)),document.head.appendChild(o)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
2
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("react"),fe=require("react-dom"),A=require("motion/react"),T=require("@floating-ui/dom"),Qe="_container_hdtc9_66",Ze="_containerClosed_hdtc9_90",et="_trigger_hdtc9_104",tt="_triggerIconOnly_hdtc9_121",nt="_triggerEmpty_hdtc9_128",ot="_statusIndicator_hdtc9_137",rt="_statusIndicatorConnected_hdtc9_143",st="_statusIndicatorConnecting_hdtc9_147",ct="_statusIndicatorDisconnected_hdtc9_151",it="_statusIndicatorFailed_hdtc9_155",at="_pulse_hdtc9_1",lt="_menuItem_hdtc9_171",ut="_triggerSeparator_hdtc9_178",dt="_triggerLabel_hdtc9_183",mt="_triggerVersion_hdtc9_184",pt="_triggerIconContainer_hdtc9_197",ft="_triggerIcon_hdtc9_121",gt="_triggerIconOpen_hdtc9_214",ht="_triggerIconOnline_hdtc9_217",yt="_triggerIconOffline_hdtc9_220",_t="_connectionErrorDot_hdtc9_224",vt="_dropdown_hdtc9_237",xt="_componentSelectorRow_hdtc9_246",Ct="_componentSelector_hdtc9_246",kt="_componentSelectorLabel_hdtc9_275",bt="_componentSelectorIcon_hdtc9_280",It="_componentSelectorSettings_hdtc9_287",St="_componentSelectorSettingsIcon_hdtc9_304",wt="_divider_hdtc9_310",jt="_versionsList_hdtc9_316",Et="_emptyState_hdtc9_336",Nt="_emptyStateContainer_hdtc9_343",Mt="_emptyStateHeading_hdtc9_354",Tt="_emptyStateText_hdtc9_361",Dt="_inlineCode_hdtc9_369",Lt="_emptyStateCommandContainer_hdtc9_379",Rt="_emptyStateCommand_hdtc9_379",Vt="_emptyStateCopyIcon_hdtc9_403",Pt="_versionItem_hdtc9_415",$t="_actions_hdtc9_433",Ot="_checkmarkContainer_hdtc9_438",Bt="_checkmarkIcon_hdtc9_447",Ht="_versionLabel_hdtc9_454",At="_versionId_hdtc9_461",Ft="_versionLabelText_hdtc9_465",Wt="_versionItemEditing_hdtc9_470",zt="_renameInput_hdtc9_484",Gt="_actionButton_hdtc9_507",qt="_actionIcon_hdtc9_526",Ut="_disabled_hdtc9_537",Jt="_actionButtonMore_hdtc9_543",Xt="_popover_hdtc9_548",Yt="_popoverFadeIn_hdtc9_1",Kt="_popoverMenuItem_hdtc9_575",Qt="_popoverMenuItemDelete_hdtc9_592",Zt="_popoverMenuItemIcon_hdtc9_596",en="_confirmButton_hdtc9_607",tn="_confirmIcon_hdtc9_616",nn="_cancelIcon_hdtc9_622",on="_newVersionButton_hdtc9_629",rn="_newVersionIconContainer_hdtc9_654",sn="_newVersionIcon_hdtc9_654",cn="_componentSelectorDropdown_hdtc9_669",an="_componentSelectorItem_hdtc9_697",ln="_componentSelectorItemSelected_hdtc9_712",un="_componentSelectorItemCheckmarkContainer_hdtc9_716",dn="_componentSelectorItemCheckmark_hdtc9_716",mn="_componentSelectorItemName_hdtc9_730",pn="_componentSelectorItemCount_hdtc9_738",fn="_componentSelectorDropdownTitle_hdtc9_745",gn="_componentSelectorDropdownHint_hdtc9_754",hn="_componentSelectorDropdownHintIcon_hdtc9_766",yn="_componentSelectorDropdownHintCode_hdtc9_772",_n="_settingsView_hdtc9_786",vn="_settingsBackButton_hdtc9_794",xn="_settingsBackIcon_hdtc9_827",Cn="_settingsContent_hdtc9_834",kn="_settingsTitle_hdtc9_841",bn="_settingsText_hdtc9_848",In="_settingsGroup_hdtc9_855",Sn="_settingsLabel_hdtc9_861",wn="_settingsSelect_hdtc9_871",jn="_settingsCheckboxGroup_hdtc9_909",En="_settingsCheckboxLabel_hdtc9_916",Nn="_settingsCheckboxInput_hdtc9_925",Mn="_settingsCheckboxVisual_hdtc9_934",Tn="_settingsCheckboxVisualChecked_hdtc9_948",Dn="_settingsCheckboxContent_hdtc9_953",Ln="_settingsCheckboxLabelText_hdtc9_960",Rn="_settingsCheckboxDescription_hdtc9_966",Vn="_tooltip_hdtc9_973",Pn="_tooltipVisible_hdtc9_1002",$n="_offlineMessageCommandButton_hdtc9_1006",On="_offlineMessageCopyIcon_hdtc9_1022",a={container:Qe,containerClosed:Ze,trigger:et,triggerIconOnly:tt,triggerEmpty:nt,statusIndicator:ot,statusIndicatorConnected:rt,statusIndicatorConnecting:st,statusIndicatorDisconnected:ct,statusIndicatorFailed:it,pulse:at,menuItem:lt,triggerSeparator:ut,triggerLabel:dt,triggerVersion:mt,triggerIconContainer:pt,triggerIcon:ft,triggerIconOpen:gt,triggerIconOnline:ht,triggerIconOffline:yt,connectionErrorDot:_t,dropdown:vt,componentSelectorRow:xt,componentSelector:Ct,componentSelectorLabel:kt,componentSelectorIcon:bt,componentSelectorSettings:It,componentSelectorSettingsIcon:St,divider:wt,versionsList:jt,emptyState:Et,emptyStateContainer:Nt,emptyStateHeading:Mt,emptyStateText:Tt,inlineCode:Dt,emptyStateCommandContainer:Lt,emptyStateCommand:Rt,emptyStateCopyIcon:Vt,versionItem:Pt,actions:$t,checkmarkContainer:Ot,checkmarkIcon:Bt,versionLabel:Ht,versionId:At,versionLabelText:Ft,versionItemEditing:Wt,renameInput:zt,actionButton:Gt,actionIcon:qt,disabled:Ut,actionButtonMore:Jt,popover:Xt,popoverFadeIn:Yt,popoverMenuItem:Kt,popoverMenuItemDelete:Qt,popoverMenuItemIcon:Zt,confirmButton:en,confirmIcon:tn,cancelIcon:nn,newVersionButton:on,newVersionIconContainer:rn,newVersionIcon:sn,componentSelectorDropdown:cn,componentSelectorItem:an,componentSelectorItemSelected:ln,componentSelectorItemCheckmarkContainer:un,componentSelectorItemCheckmark:dn,componentSelectorItemName:mn,componentSelectorItemCount:pn,componentSelectorDropdownTitle:fn,componentSelectorDropdownHint:gn,componentSelectorDropdownHintIcon:hn,componentSelectorDropdownHintCode:yn,settingsView:_n,settingsBackButton:vn,settingsBackIcon:xn,settingsContent:Cn,settingsTitle:kn,settingsText:bn,settingsGroup:In,settingsLabel:Sn,settingsSelect:wn,settingsCheckboxGroup:jn,settingsCheckboxLabel:En,settingsCheckboxInput:Nn,settingsCheckboxVisual:Mn,settingsCheckboxVisualChecked:Tn,settingsCheckboxContent:Dn,settingsCheckboxLabelText:Ln,settingsCheckboxDescription:Rn,tooltip:Vn,tooltipVisible:Pn,offlineMessageCommandButton:$n,offlineMessageCopyIcon:On};var Bn={outline:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},filled:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"}};const E=(e,t,l,i)=>{const u=o.forwardRef(({color:d="currentColor",size:c=24,stroke:s=2,title:r,className:h,children:m,...f},g)=>o.createElement("svg",{ref:g,...Bn[e],width:c,height:c,className:["tabler-icon",`tabler-icon-${t}`,h].join(" "),strokeWidth:s,stroke:d,...f},[r&&o.createElement("title",{key:"svg-title"},r),...i.map(([y,x])=>o.createElement(y,x)),...Array.isArray(m)?m:[m]]));return u.displayName=`${l}`,u};const Hn=[["path",{d:"M5 12l5 5l10 -10",key:"svg-0"}]],An=E("outline","check","Check",Hn);const Fn=[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]],Wn=E("outline","chevron-down","ChevronDown",Fn);const zn=[["path",{d:"M9 6l6 6l-6 6",key:"svg-0"}]],Gn=E("outline","chevron-right","ChevronRight",zn);const qn=[["path",{d:"M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666",key:"svg-0"}],["path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}]],Un=E("outline","copy","Copy",qn);const Jn=[["path",{d:"M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M11 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M11 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}]],Xn=E("outline","dots-vertical","DotsVertical",Jn);const Yn=[["path",{d:"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6",key:"svg-0"}],["path",{d:"M11 13l9 -9",key:"svg-1"}],["path",{d:"M15 4h5v5",key:"svg-2"}]],Kn=E("outline","external-link","ExternalLink",Yn);const Qn=[["path",{d:"M5 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M5 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M15 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-2"}],["path",{d:"M7 8l0 8",key:"svg-3"}],["path",{d:"M9 18h6a2 2 0 0 0 2 -2v-5",key:"svg-4"}],["path",{d:"M14 14l3 -3l3 3",key:"svg-5"}]],Zn=E("outline","git-branch","GitBranch",Qn);const eo=[["path",{d:"M10 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M5 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M15 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-2"}],["path",{d:"M7 8v2a2 2 0 0 0 2 2h6a2 2 0 0 0 2 -2v-2",key:"svg-3"}],["path",{d:"M12 12l0 4",key:"svg-4"}]],to=E("outline","git-fork","GitFork",eo);const no=[["path",{d:"M5 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M5 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M15 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-2"}],["path",{d:"M7 8l0 8",key:"svg-3"}],["path",{d:"M7 8a4 4 0 0 0 4 4h4",key:"svg-4"}]],oo=E("outline","git-merge","GitMerge",no);const ro=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M12 9h.01",key:"svg-1"}],["path",{d:"M11 12h1v4h1",key:"svg-2"}]],so=E("outline","info-circle","InfoCircle",ro);const co=[["path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4",key:"svg-0"}],["path",{d:"M13.5 6.5l4 4",key:"svg-1"}]],io=E("outline","pencil","Pencil",co);const ao=[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]],lo=E("outline","plus","Plus",ao);const uo=[["path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065",key:"svg-0"}],["path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}]],mo=E("outline","settings","Settings",uo);const po=[["path",{d:"M4 7l16 0",key:"svg-0"}],["path",{d:"M10 11l0 6",key:"svg-1"}],["path",{d:"M14 11l0 6",key:"svg-2"}],["path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12",key:"svg-3"}],["path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3",key:"svg-4"}]],fo=E("outline","trash","Trash",po);const go=[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]],ho=E("outline","x","X",go);function yo({className:e}){return n.jsx(Wn,{className:e,size:16,stroke:2})}function _o({className:e}){return n.jsx(mo,{className:e,size:16,stroke:1.5})}function U({className:e}){return n.jsx(An,{className:e,size:16,stroke:2})}function vo({className:e}){return n.jsx(so,{className:e,size:12,stroke:2})}const $=.3,H=[.04,1.02,.13,1.02];function ge({isActive:e,refs:t,onClickOutside:l,additionalCheck:i}){o.useEffect(()=>{if(!e)return;const u=d=>{const c=d.target;for(const s of t)if(s.current?.contains(c))return;i?.(c)||l()};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[e,t,l,i])}function xo({selectedComponent:e,onToggle:t,onSettingsClick:l}){return n.jsxs("div",{className:a.componentSelectorRow,children:[n.jsxs("button",{"data-component-selector":!0,onClick:t,className:`${a.componentSelector} ${a.menuItem}`,children:[n.jsx(A.motion.span,{layoutId:"component-name",layout:"position",className:a.componentSelectorLabel,transition:{layout:{duration:$,ease:H}},children:e||"Select component"}),n.jsx(yo,{className:a.componentSelectorIcon})]}),n.jsx("button",{onClick:l,className:a.componentSelectorSettings,title:"Settings","aria-label":"Open settings",children:n.jsx(_o,{className:a.componentSelectorSettingsIcon})})]})}function Co({mountedComponents:e,selectedComponent:t,isOpen:l,position:i,onSelect:u,onClose:d,componentSelectorRef:c,isConnected:s}){return ge({isActive:l,refs:[c],onClickOutside:d,additionalCheck:r=>!!r.closest?.("[data-component-selector]")}),l?n.jsxs("div",{ref:c,className:a.componentSelectorDropdown,style:{left:`${i.x}px`,top:`${i.y}px`,visibility:"hidden"},children:[n.jsx("div",{className:a.componentSelectorDropdownTitle,children:"Forked components"}),e.length===0?n.jsx("div",{className:a.emptyState,children:"No mounted components found"}):e.map(r=>n.jsxs("button",{onClick:()=>u(r.name),className:`${a.componentSelectorItem} ${a.menuItem} ${r.name===t?a.componentSelectorItemSelected:""}`,children:[n.jsx("div",{className:a.componentSelectorItemCheckmarkContainer,children:r.name===t&&n.jsx(U,{className:a.componentSelectorItemCheckmark})}),n.jsx("span",{className:a.componentSelectorItemName,children:r.name}),n.jsx("span",{className:a.componentSelectorItemCount,children:r.versions.length})]},r.name)),s&&n.jsxs("div",{className:a.componentSelectorDropdownHint,children:[n.jsx(vo,{className:a.componentSelectorDropdownHintIcon}),n.jsxs("span",{children:["Use ",n.jsx("code",{className:a.componentSelectorDropdownHintCode,children:"npx uifork init"})," to iterate on more components"]})]})]}):null}function ko({className:e}){return n.jsx(to,{className:e,size:16,stroke:1.5})}function bo({className:e}){return n.jsx(Xn,{className:e,size:16,stroke:2})}function Io({className:e}){return n.jsx(oo,{className:e,size:16,stroke:2})}function So({className:e}){return n.jsx(Kn,{className:e,size:16,stroke:1.5})}function wo({className:e}){return n.jsx(fo,{className:e,size:16,stroke:1.5})}function be({className:e}){return n.jsx(io,{className:e,size:16,stroke:1.5})}function ne({icon:e,label:t,onClick:l,variant:i="default",stopPropagation:u=!1}){const d=c=>{u&&c.stopPropagation(),l(c)};return n.jsxs("button",{onClick:d,className:`${a.popoverMenuItem} ${a.menuItem} ${i==="delete"?a.popoverMenuItemDelete:""}`,children:[n.jsx(e,{className:a.popoverMenuItemIcon}),n.jsx("span",{children:t})]})}function jo({version:e,label:t,position:l,onPromote:i,onOpenInEditor:u,onDelete:d,onRename:c,onClose:s,setDropdownRef:r}){const h=t&&t.trim()?"Edit label":"Add label",m=o.useRef(null),f=o.useCallback(y=>{m.current=y,r(y)},[r]);ge({isActive:!0,refs:[m],onClickOutside:s,additionalCheck:y=>!!y.closest?.("[data-actions]")});const g=typeof document<"u"?document.getElementById("uifork-root")||document.body:null;return g?fe.createPortal(n.jsxs("div",{ref:f,className:a.popover,"data-popover-dropdown":!0,style:{visibility:"hidden"},role:"menu",children:[n.jsx(ne,{icon:be,label:h,stopPropagation:!0,onClick:y=>{c(e,y),s()}}),n.jsx(ne,{icon:Io,label:"Promote",onClick:y=>{i(e,y),s()}}),n.jsx(ne,{icon:So,label:"Open in editor",onClick:y=>{u(e,y),s()}}),n.jsx("div",{className:a.divider}),n.jsx(ne,{icon:wo,label:"Delete",variant:"delete",stopPropagation:!0,onClick:y=>{d(e,y),s()}})]}),g):null}let he=!1,Ie=0;const Eo=1e3;function No(){he=!0,Ie=Date.now()}function le(){he=!1}function Mo(){const e=Date.now()-Ie;return he||e<Eo}function oe({label:e,children:t,placement:l="top"}){const[i,u]=o.useState(!1),[d,c]=o.useState({x:0,y:0}),s=o.useRef(null),r=o.useRef(null),h=o.useRef(null),m=o.useRef(null),f=o.useRef(null);o.useEffect(()=>{const v=document.getElementById("uifork-root");v&&(f.current=v)},[]),o.useEffect(()=>{if(!i||!s.current||!r.current)return;let v=null,p=!1;const k=async()=>{if(!(p||!s.current||!r.current))try{const{x:C,y:w}=await T.computePosition(s.current,r.current,{placement:l,strategy:"fixed",middleware:[T.offset(8),T.shift({padding:8})]});p||(c({x:C,y:w}),r.current&&(r.current.style.visibility="visible",r.current.classList.add(a.tooltipVisible)))}catch{}};return r.current&&(r.current.style.visibility="hidden"),k(),s.current&&r.current&&(v=T.autoUpdate(s.current,r.current,k)),()=>{p=!0,v&&v(),r.current&&r.current.classList.remove(a.tooltipVisible)}},[i,l]);const g=()=>{m.current&&(clearTimeout(m.current),m.current=null),h.current&&clearTimeout(h.current);const p=Mo()?0:300;h.current=setTimeout(()=>{u(!0),h.current=null},p)},y=()=>{h.current&&(clearTimeout(h.current),h.current=null),m.current=setTimeout(()=>{u(!1),le(),m.current=null},150)};o.useEffect(()=>{i?No():le()},[i]),o.useEffect(()=>()=>{h.current&&clearTimeout(h.current),m.current&&clearTimeout(m.current),i&&le()},[i]);const x=o.cloneElement(t,{ref:v=>{s.current=v;const p=t.ref;p&&(typeof p=="function"?p(v):p.current=v)},onMouseEnter:v=>{g(),t.props.onMouseEnter?.(v)},onMouseLeave:v=>{y(),t.props.onMouseLeave?.(v)}}),I=f.current||document.getElementById("uifork-root")||document.body;return n.jsxs(n.Fragment,{children:[x,i&&fe.createPortal(n.jsx("div",{ref:r,className:a.tooltip,style:{left:`${d.x}px`,top:`${d.y}px`,visibility:"hidden"},role:"tooltip",children:e}),I)]})}function To({version:e,label:t,isSelected:l,formatVersionLabel:i,popoverPosition:u,isPopoverOpen:d,isConnected:c,onSelect:s,onDuplicate:r,onTogglePopover:h,onPromote:m,onOpenInEditor:f,onDelete:g,onRename:y,setPopoverTriggerRef:x,setPopoverDropdownRef:I}){const v=i(e);return n.jsxs("div",{role:"option","aria-selected":l,"data-key":e,onClick:()=>s(e),className:`${a.versionItem} ${a.menuItem}`,children:[n.jsx("div",{className:a.checkmarkContainer,children:l&&n.jsx(U,{className:a.checkmarkIcon})}),n.jsxs("div",{className:a.versionLabel,children:[n.jsx("span",{className:a.versionId,children:v}),t&&n.jsx("span",{className:a.versionLabelText,children:t})]}),c&&n.jsxs("div",{"data-actions":!0,className:a.actions,onClick:p=>p.stopPropagation(),children:[n.jsx(oe,{label:"Fork version",placement:"top",children:n.jsx("button",{onClick:p=>{p.stopPropagation(),r(e,p)},className:a.actionButton,children:n.jsx(ko,{className:a.actionIcon})})}),n.jsxs("div",{className:a.actionButtonMore,children:[n.jsx(oe,{label:"More options",placement:"top",children:n.jsx("button",{ref:p=>x(e,p),onClick:p=>{p.stopPropagation(),h(e,p)},className:a.actionButton,children:n.jsx(bo,{className:a.actionIcon})})}),d&&n.jsx(jo,{version:e,label:t,position:u||{x:0,y:0},onPromote:m,onOpenInEditor:f,onDelete:g,onRename:y,onClose:()=>h(e),setDropdownRef:p=>I(e,p)})]})]})]})}function Do({className:e}){return n.jsx(ho,{className:e,size:16,stroke:2})}const Lo=o.forwardRef(function({containerStyle:t,containerClassName:l,className:i,value:u,placeholder:d,...c},s){const r=o.useRef(null),h=o.useRef(null),[m,f]=o.useState(void 0);return o.useImperativeHandle(s,()=>r.current),o.useLayoutEffect(()=>{if(h.current){const g=u?.toString()||d||"";h.current.textContent=g||" ";const y=h.current.offsetWidth;f(y+2)}},[u,d]),n.jsxs("span",{className:l,style:{display:"inline-block",position:"relative",overflow:"hidden",...t},children:[n.jsx("span",{ref:h,"aria-hidden":"true",style:{position:"absolute",visibility:"hidden",whiteSpace:"pre",font:"inherit",letterSpacing:"inherit",textTransform:"inherit"}}),n.jsx("input",{ref:r,type:"text",value:u,placeholder:d,className:i,style:{width:m!==void 0?`${m}px`:void 0,maxWidth:"100%",font:"inherit",letterSpacing:"inherit",textTransform:"inherit",boxSizing:"border-box",minWidth:0},...c})]})});function Ro({version:e,value:t,onChange:l,formatVersionLabel:i,onConfirm:u,onCancel:d}){const c=o.useRef(null),s=i(e);return o.useEffect(()=>{c.current&&(c.current.focus(),c.current.select())},[]),n.jsxs("div",{className:`${a.versionItemEditing} ${a.menuItem}`,onClick:r=>r.stopPropagation(),children:[n.jsx("div",{className:a.checkmarkContainer,children:n.jsx(be,{className:a.checkmarkIcon})}),n.jsxs("div",{className:a.versionLabel,children:[n.jsx("span",{className:a.versionId,children:s}),n.jsx(Lo,{ref:c,value:t,onChange:r=>l(r.target.value),onKeyDown:r=>{r.key==="Enter"?(r.preventDefault(),r.stopPropagation(),u(e)):r.key==="Escape"&&(r.preventDefault(),r.stopPropagation(),d())},onClick:r=>r.stopPropagation(),className:a.renameInput,placeholder:"Add label",containerStyle:{minWidth:60,maxWidth:220}})]}),n.jsxs("div",{className:a.actions,style:{opacity:1},children:[n.jsx(oe,{label:"Confirm",placement:"top",children:n.jsx("button",{onClick:r=>{r.stopPropagation(),u(e)},className:a.actionButton,children:n.jsx(U,{className:a.actionIcon})})}),n.jsx(oe,{label:"Cancel",placement:"top",children:n.jsx("button",{onClick:r=>{r.stopPropagation(),d()},className:a.actionButton,children:n.jsx(Do,{className:a.actionIcon})})})]})]})}function Vo({versions:e,activeVersion:t,editingVersion:l,renameValue:i,formatVersionLabel:u,openPopoverVersion:d,popoverPositions:c,isConnected:s,onSelectVersion:r,onDuplicateVersion:h,onTogglePopover:m,onPromoteVersion:f,onOpenInEditor:g,onDeleteVersion:y,onRenameVersion:x,onRenameValueChange:I,onConfirmRename:v,onCancelRename:p,setPopoverTriggerRef:k,setPopoverDropdownRef:C}){return e.length===0?n.jsx("div",{className:a.emptyState,children:"No versions found"}):n.jsx("div",{className:a.versionsList,children:e.slice().reverse().map(w=>{const{key:b,label:j}=w,N=b===t;return l===b?n.jsx(Ro,{version:b,value:i,onChange:I,formatVersionLabel:u,onConfirm:v,onCancel:p},b):n.jsx(To,{version:b,label:j,isSelected:N,formatVersionLabel:u,popoverPosition:c.get(b),isPopoverOpen:d===b,isConnected:s,onSelect:r,onDuplicate:h,onTogglePopover:m,onPromote:f,onOpenInEditor:g,onDelete:y,onRename:x,setPopoverTriggerRef:k,setPopoverDropdownRef:C},b)})})}function Po({className:e}){return n.jsx(Gn,{className:e,size:16,stroke:2})}function $o({onBack:e,theme:t,setTheme:l,position:i,setPosition:u,codeEditor:d,setCodeEditor:c}){return n.jsxs("div",{className:a.settingsView,children:[n.jsxs("button",{onClick:e,className:a.settingsBackButton,style:{width:"auto",alignSelf:"flex-start"},children:[n.jsx(Po,{className:a.settingsBackIcon}),n.jsx("span",{children:"Back"})]}),n.jsxs("div",{className:a.settingsContent,children:[n.jsxs("div",{className:a.settingsGroup,children:[n.jsx("label",{className:a.settingsLabel,children:"Theme"}),n.jsxs("select",{value:t,onChange:s=>l(s.target.value),className:a.settingsSelect,children:[n.jsx("option",{value:"light",children:"Light"}),n.jsx("option",{value:"dark",children:"Dark"}),n.jsx("option",{value:"system",children:"System"})]})]}),n.jsxs("div",{className:a.settingsGroup,children:[n.jsx("label",{className:a.settingsLabel,children:"Position"}),n.jsxs("select",{value:i,onChange:s=>u(s.target.value),className:a.settingsSelect,children:[n.jsx("option",{value:"top-left",children:"Top left"}),n.jsx("option",{value:"top-right",children:"Top right"}),n.jsx("option",{value:"bottom-left",children:"Bottom left"}),n.jsx("option",{value:"bottom-right",children:"Bottom right"})]})]}),n.jsxs("div",{className:a.settingsGroup,children:[n.jsx("label",{className:a.settingsLabel,children:"Code editor"}),n.jsxs("select",{value:d,onChange:s=>c(s.target.value),className:a.settingsSelect,children:[n.jsx("option",{value:"vscode",children:"VSCode"}),n.jsx("option",{value:"cursor",children:"Cursor"})]})]})]})]})}function Se({className:e}){return n.jsx(Un,{className:e,size:16,stroke:1.5})}function Oo({onCopyCommand:e,copied:t}){return n.jsxs("div",{className:a.emptyStateContainer,children:[n.jsx("h3",{className:a.emptyStateHeading,children:"Get started with uifork"}),n.jsx("p",{className:a.emptyStateText,children:"Choose a component and run the command in your root directory"}),n.jsxs("button",{onClick:e,className:a.emptyStateCommandContainer,title:"Copy command","aria-label":"Copy command to clipboard",children:[n.jsx("code",{className:a.emptyStateCommand,children:"npx uifork init <path to file>"}),t?n.jsx(U,{className:a.emptyStateCopyIcon}):n.jsx(Se,{className:a.emptyStateCopyIcon})]})]})}function Bo({className:e}){return n.jsx(lo,{className:e,size:16,stroke:2})}function Ho({onClick:e,disabled:t}){return n.jsxs("button",{onClick:t?void 0:e,className:`${a.newVersionButton} ${a.menuItem} ${t?a.disabled:""}`,title:t?"Connect to server to create new versions":"Create new version","aria-disabled":t,children:[n.jsx("div",{className:a.newVersionIconContainer,children:n.jsx(Bo,{className:a.newVersionIcon})}),n.jsx("span",{children:"New version"})]})}function we(){return typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname.startsWith("127.0.0.1")||window.location.hostname.startsWith("192.168.")||window.location.protocol==="file:")}function Ao(){const[e,t]=o.useState(!1),l=o.useCallback(async()=>{const i="npx uifork watch";try{await navigator.clipboard.writeText(i),t(!0),setTimeout(()=>t(!1),2e3)}catch{}},[]);return we()?n.jsx("div",{className:a.componentSelectorDropdownHint,children:n.jsxs("span",{children:["Run"," ",n.jsx("button",{onClick:l,className:a.offlineMessageCommandButton,title:"Copy command","aria-label":"Copy command to clipboard",children:n.jsxs("code",{className:a.componentSelectorDropdownHintCode,children:["npx uifork watch"," ",e?n.jsx(U,{className:a.offlineMessageCopyIcon}):n.jsx(Se,{className:a.offlineMessageCopyIcon})]})})," ","to fork, create, and promote versions from here."]})}):null}function Fo({port:e,selectedComponent:t,onFileChanged:l,onComponentsUpdate:i,onVersionAck:u,onPromoted:d,onError:c}){const[s,r]=o.useState(null),[h,m]=o.useState("disconnected"),f=o.useRef(t),g=o.useRef(l),y=o.useRef(i),x=o.useRef(u),I=o.useRef(d),v=o.useRef(c),p=o.useRef(null),k=o.useRef(!1),C=o.useRef(null),w=o.useRef(!0),b=o.useRef(!1),j=o.useRef(0),N=o.useRef("disconnected");o.useEffect(()=>{C.current=s},[s]),o.useEffect(()=>{N.current=h},[h]),o.useEffect(()=>{f.current=t},[t]),o.useEffect(()=>{g.current=l,y.current=i,x.current=u,I.current=d,v.current=c},[l,i,u,d,c]);const R=o.useCallback(()=>{if(C.current?.readyState===WebSocket.OPEN||k.current)return;const W=`ws://localhost:${e}/ws`;k.current=!0,(j.current===0||b.current)&&N.current!=="failed"&&m("connecting"),j.current++;const L=new WebSocket(W);let z=!1;L.onopen=()=>{z=!0,b.current=!0,j.current=0,k.current=!1,m("connected"),r(L),C.current=L,g.current?.(),p.current&&(clearTimeout(p.current),p.current=null)},L.onclose=()=>{k.current=!1,z?m("disconnected"):N.current!=="failed"&&m("failed"),r(null),C.current=null,w.current&&(p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{p.current=null,w.current&&R()},3e3))},L.onerror=X=>{k.current=!1,z?m("disconnected"):N.current!=="failed"&&m("failed")},L.onmessage=X=>{try{const M=JSON.parse(X.data);if(M.type==="components"&&M.payload?.components)y.current?.(M.payload.components);else if(M.type==="file_changed")g.current?.();else if(M.type==="ack"&&M.payload?.version){const Y=M.payload.message||"",re=M.payload.newVersion;if(Y.includes("promoted")){const se=M.payload.component||f.current;I.current?.(se);return}x.current?.({version:M.payload.version,message:Y,newVersion:re})}else M.type==="error"&&v.current?.(M.payload?.message||"Unknown error")}catch{}}},[e]);o.useEffect(()=>(w.current=!0,j.current=0,C.current?.readyState===WebSocket.OPEN&&C.current.close(),p.current&&(clearTimeout(p.current),p.current=null),R(),()=>{w.current=!1,p.current&&(clearTimeout(p.current),p.current=null),C.current?.readyState===WebSocket.OPEN&&C.current.close()}),[e,R]);const J=o.useCallback((W,L)=>{s&&s.readyState===WebSocket.OPEN&&s.send(JSON.stringify({type:W,payload:{...L,component:f.current}}))},[s]);return{connectionStatus:h,sendMessage:J}}function O(e,t,l=!1){const[i,u]=o.useState(()=>{if(typeof window>"u")return t;try{const c=window.localStorage.getItem(e);return c?JSON.parse(c):t}catch{return t}}),d=o.useCallback(c=>{try{u(s=>{const r=c instanceof Function?c(s):c;return typeof window<"u"&&(r===""&&typeof t=="string"?(window.localStorage.removeItem(e),l&&window.dispatchEvent(new StorageEvent("storage",{key:e,newValue:null}))):(window.localStorage.setItem(e,JSON.stringify(r)),l&&window.dispatchEvent(new StorageEvent("storage",{key:e,newValue:JSON.stringify(r)})))),r})}catch{}},[e,l,t]);return o.useEffect(()=>{if(!l)return;const c=s=>{if(s.key===e&&s.newValue)try{u(JSON.parse(s.newValue))}catch{}};return window.addEventListener("storage",c),()=>window.removeEventListener("storage",c)},[e,l]),[i,d]}const B=new Map,me=new Set;function je(e,t=[]){const l=B.get(e);l?B.set(e,{versions:t,refCount:l.refCount+1}):(B.set(e,{versions:t,refCount:1}),Ne())}function Ee(e){const t=B.get(e);t&&(t.refCount>1?B.set(e,{versions:t.versions,refCount:t.refCount-1}):(B.delete(e),Ne()))}function Wo(){return Array.from(B.keys())}function zo(){return Array.from(B.entries()).map(([e,{versions:t}])=>({name:e,versions:t}))}function Go(e){return me.add(e),()=>{me.delete(e)}}function Ne(){me.forEach(e=>e())}function qo({port:e}){const[t,l]=o.useState([]),[i,u]=o.useState([]),[d,c]=o.useState([]),[s,r]=O("uifork-selected-component","",!0),h=o.useMemo(()=>t.length>0?t.map(g=>{const y=i.find(I=>I.name===g.name),x=g.versions.map(I=>{const v=y?.versions.find(p=>p.key===I);return{key:I,label:v?.label}});return{name:g.name,path:g.path,versions:x}}):i.map(g=>({name:g.name,path:"",versions:g.versions})),[t,i]),m=o.useMemo(()=>h.filter(g=>d.includes(g.name)),[h,d]),f=o.useCallback(g=>{l(g),!s&&g.length>0&&r(g[0].name)},[s,r]);return o.useEffect(()=>{const g=()=>{c(Wo()),u(zo())};return g(),Go(g)},[]),o.useEffect(()=>{if(s&&d.length>0&&!d.includes(s)){const g=h.find(y=>d.includes(y.name));g&&r(g.name)}else if(!s&&d.length>0&&h.length>0){const g=h.find(y=>d.includes(y.name));g&&r(g.name)}},[s,d,h,r]),{components:h,mountedComponents:m,mountedComponentIds:d,selectedComponent:s,setSelectedComponent:r,onComponentsUpdate:f}}function Uo({selectedComponent:e,versions:t}){const l=t.map(v=>v.key),[i,u]=O(e||"uifork-default","",!0),[d,c]=o.useState(null),[s,r]=o.useState(""),h=o.useRef(null);o.useEffect(()=>{h.current=d},[d]),o.useEffect(()=>{if(e&&l.length>0){const v=`${e}-pending-version`,p=localStorage.getItem(v);if(p&&l.includes(p))u(p),localStorage.removeItem(v);else if(!l.includes(i)){const k=localStorage.getItem(e),C=k?JSON.parse(k):null;C&&l.includes(C)?u(C):u(l[0])}}},[e,l,i,u]);const m=o.useCallback(v=>{const p=`${e}-pending-version`;localStorage.setItem(p,v)},[e]),f=o.useCallback(v=>t.find(p=>p.key===v)?.label,[t]),g=o.useCallback(v=>{c(v);const p=f(v)||"";r(p)},[f]),y=o.useCallback(v=>{const p=s.trim(),k=f(v)||"";return p===k?(c(null),r(""),null):(c(null),r(""),p)},[s,f]),x=o.useCallback(()=>{c(null),r("")},[]),I=o.useCallback(()=>{h.current&&(c(null),r(""))},[]);return{activeVersion:i,setActiveVersion:u,editingVersion:d,renameValue:s,setRenameValue:r,startRename:g,confirmRename:y,cancelRename:x,clearEditingOnError:I,storePendingVersion:m,versionKeys:l}}function Jo({openPopoverVersion:e}){const t=o.useRef(new Map),l=o.useRef(new Map),i=o.useRef(new Map);o.useEffect(()=>{if(!e)return;let c=null,s=!1;const r=()=>{const m=t.current.get(e),f=l.current.get(e);if(!m||!f){s||requestAnimationFrame(r);return}const g=async()=>{if(!s)try{const{x:y,y:x}=await T.computePosition(m,f,{placement:"bottom-end",strategy:"fixed",middleware:[T.offset(4),T.flip({fallbackPlacements:["bottom-start","top-end","top-start"]}),T.shift({padding:8})]});s||(i.current.set(e,{x:y,y:x}),f.style.left=`${y}px`,f.style.top=`${x}px`,f.style.visibility="visible",f.classList.add(a.popoverVisible))}catch{}};f.style.visibility="hidden",g(),c=T.autoUpdate(m,f,g)},h=requestAnimationFrame(r);return()=>{s=!0,cancelAnimationFrame(h),c&&c();const m=l.current.get(e);m&&m.classList.remove(a.popoverVisible)}},[e]);const u=(c,s)=>{s?t.current.set(c,s):t.current.delete(c)},d=(c,s)=>{s?l.current.set(c,s):l.current.delete(c)};return{popoverPositions:i.current,setPopoverTriggerRef:u,setPopoverDropdownRef:d}}function Xo({versionKeys:e,activeVersion:t,setActiveVersion:l}){o.useEffect(()=>{const i=u=>{if(!u.metaKey||e.length===0)return;const d=e.indexOf(t);if(u.key==="ArrowDown"){u.preventDefault();const c=d-1;l(e[c>=0?c:e.length-1])}if(u.key==="ArrowUp"){u.preventDefault();const c=d+1;l(e[c<e.length?c:0])}};return window.addEventListener("keydown",i,{capture:!0}),()=>window.removeEventListener("keydown",i,{capture:!0})},[t,e,l])}function Yo({isOpen:e,containerRef:t,triggerRef:l,openPopoverVersion:i,isComponentSelectorOpen:u,editingVersion:d,onClosePopover:c,onCloseComponentSelector:s,onCancelRename:r,onClose:h}){o.useEffect(()=>{if(!e)return;const m=f=>{if(f.key==="Escape"){if(i){c();return}if(u){s();return}if(d){r();return}h(),l.current?.focus()}};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t,l,i,u,d,c,s,r,h])}function Ko({isOpen:e,containerRef:t,setPosition:l}){const[i,u]=o.useState(!1),[d,c]=o.useState(!1),[s,r]=o.useState(!1),[h,m]=o.useState(null),f=A.useDragControls(),g=5,y=o.useCallback((p,k)=>{const C=window.innerWidth,w=window.innerHeight,b=C/2,j=w/2;return p<b&&k<j?"top-left":p>=b&&k<j?"top-right":p<b&&k>=j?"bottom-left":"bottom-right"},[]),x=o.useCallback((p,k)=>{if(u(!1),r(!1),m(null),document.body.style.removeProperty("cursor"),document.body.style.userSelect="",t.current&&(t.current.style.removeProperty("cursor"),t.current.removeAttribute("data-drag-tracking"),t.current.removeAttribute("data-dragging")),!t.current)return;const C=t.current.getBoundingClientRect(),w=C.left+C.width/2,b=C.top+C.height/2,j=y(w,b);l(j),c(!0)},[y,l,t]),I=o.useCallback(p=>{if(e)return;const k=p.nativeEvent;m({x:p.clientX,y:p.clientY,event:k}),r(!1),t.current&&t.current.setAttribute("data-drag-tracking","true")},[e,t]);o.useEffect(()=>{if(!h||e)return;const p=C=>{const w=Math.abs(C.clientX-h.x),b=Math.abs(C.clientY-h.y);Math.sqrt(w*w+b*b)>g&&!s&&(r(!0),c(!1),f.start(C,{snapToCursor:!0}))},k=()=>{s||(m(null),r(!1),document.body.style.removeProperty("cursor"),t.current&&(t.current.style.removeProperty("cursor"),t.current.removeAttribute("data-drag-tracking")))};return window.addEventListener("pointermove",p),window.addEventListener("pointerup",k),()=>{window.removeEventListener("pointermove",p),window.removeEventListener("pointerup",k)}},[h,e,s,f,t]);const v=o.useCallback(()=>{u(!0),c(!1),document.body.style.setProperty("cursor","grabbing","important"),document.body.style.userSelect="none",t.current&&(t.current.style.setProperty("cursor","grabbing","important"),t.current.setAttribute("data-dragging","true"))},[t]);return o.useEffect(()=>{if(d&&!i){const p=setTimeout(()=>{c(!1)},$*1e3+50);return()=>clearTimeout(p)}},[d,i]),o.useEffect(()=>{e&&(i||s)&&(u(!1),r(!1),m(null),document.body.style.cursor="",document.body.style.userSelect="")},[e,i,s]),o.useEffect(()=>()=>{document.body.style.removeProperty("cursor"),document.body.style.userSelect="",t.current&&(t.current.style.removeProperty("cursor"),t.current.removeAttribute("data-drag-tracking"),t.current.removeAttribute("data-dragging"))},[t]),{isDragging:i,resetDrag:d,dragEnabled:s,dragControls:f,handlePointerDown:I,handleDragStart:v,handleDragEnd:x}}function Qo(e,t=20){return{"top-left":{top:`${t}px`,left:`${t}px`,bottom:"auto",right:"auto"},"top-right":{top:`${t}px`,right:`${t}px`,bottom:"auto",left:"auto"},"bottom-left":{bottom:`${t}px`,left:`${t}px`,top:"auto",right:"auto"},"bottom-right":{bottom:`${t}px`,right:`${t}px`,top:"auto",left:"auto"}}[e]}function Zo(e){return{"top-left":"top left","top-right":"top right","bottom-left":"bottom left","bottom-right":"bottom right"}[e]}function er({position:e,isComponentSelectorOpen:t,containerRef:l,componentSelectorRef:i,enableElementAwarePositioning:u=!1}){const[d,c]=o.useState({x:0,y:0}),s=ir(u),r=o.useMemo(()=>{const m=Qo(e);if(!u)return m;const g=(s||[]).filter(y=>y.position===e&&y.offset<=tr)[0];if(g){const y=g.offset+g.width+g.offset,x=window.innerHeight;switch(e){case"top-left":return{...m,top:`${g.rect.top}px`,left:`${y}px`};case"top-right":return{...m,top:`${g.rect.top}px`,right:`${y}px`};case"bottom-left":return{...m,bottom:`${x-g.rect.bottom}px`,left:`${y}px`};case"bottom-right":return{...m,bottom:`${x-g.rect.bottom}px`,right:`${y}px`}}}return m},[e,s,u]),h=o.useMemo(()=>Zo(e),[e]);return o.useEffect(()=>{if(!t||!l.current||!i.current)return;const m=async()=>{try{const{x:g,y}=await T.computePosition(l.current,i.current,{placement:"left-start",strategy:"fixed",middleware:[T.offset(4),T.flip(),T.shift({padding:8})]});c({x:g,y}),i.current&&(i.current.style.visibility="visible")}catch{}};return i.current&&(i.current.style.visibility="hidden"),m(),T.autoUpdate(l.current,i.current,m)},[t,l,i]),{containerPosition:r,transformOrigin:h,componentSelectorPosition:d}}const tr=50;function nr(){const e=document.querySelectorAll('[data-nextjs-dev-overlay="true"]');for(const t of e)if(t instanceof HTMLElement){const l=t.shadowRoot,i=t.querySelector("nextjs-portal");if(i instanceof HTMLElement){const u=i.shadowRoot;if(u){const d=u.getElementById("devtools-indicator");if(d instanceof HTMLElement)return d;const c=u.querySelector("#devtools-indicator");if(c instanceof HTMLElement)return c}}if(l){const u=l.getElementById("devtools-indicator");if(u instanceof HTMLElement)return u}}return null}function or(){const e=document.querySelectorAll("vercel-live-feedback");for(const t of e)if(t instanceof HTMLElement){const l=t.shadowRoot;if(l){const i=l.getElementById("shadow-container");if(i){const u=Array.from(i.children);for(const s of u)if(s instanceof HTMLElement&&window.getComputedStyle(s).position==="fixed")return s;const d=i.querySelectorAll("*");for(const s of d)if(s instanceof HTMLElement&&window.getComputedStyle(s).position==="fixed")return s;if(window.getComputedStyle(i).position==="fixed")return i}else{const u=Array.from(l.children);for(const d of u)if(d instanceof HTMLElement&&window.getComputedStyle(d).position==="fixed")return d}}}return null}function rr(e){if(!e||e==="none")return{x:0,y:0};const t=e.trim().split(/\s+/),l=parseFloat(t[0])||0,i=parseFloat(t[1])||0;return{x:l,y:i}}function sr(e){const t=e.querySelector(".dev-tools-grabbing");if(t instanceof HTMLElement){const l=t.style.translate;return rr(l)}return{x:0,y:0}}function pe(e,t,l,i,u,d,c=!1){if(t&&t.contains(e)||window.getComputedStyle(e).position!=="fixed")return null;const r=e.getBoundingClientRect(),h=c?sr(e):{x:0,y:0},m={top:r.top+h.y,bottom:r.bottom+h.y,left:r.left+h.x,right:r.right+h.x},f=m.left+r.width/2,g=m.top+r.height/2;let y;g<d?y=f<u?"top-left":"top-right":y=f<u?"bottom-left":"bottom-right";let x;switch(y){case"top-left":x=Math.max(m.left,m.top);break;case"top-right":x=Math.max(l-m.right,m.top);break;case"bottom-left":x=Math.max(m.left,i-m.bottom);break;case"bottom-right":x=Math.max(l-m.right,i-m.bottom);break}return{element:e,position:y,offset:x,width:r.width,height:r.height,rect:m,isNextJSDevTools:c}}function ue(e,t,l,i,u,d,c,s=!1){const r=pe(e,t,l,i,u,d,s);r&&c.push(r)}function cr(){const e=document.body.querySelectorAll("*"),t=document.getElementById("uifork-root"),l=window.innerWidth,i=window.innerHeight,u=l/2,d=i/2,c=[];e.forEach(h=>{h instanceof HTMLElement&&ue(h,t,l,i,u,d,c)});const s=nr();s&&ue(s,t,l,i,u,d,c,!0);const r=or();return r&&ue(r,t,l,i,u,d,c,!1),c}function ir(e=!0){const[t,l]=o.useState([]),i=o.useRef(new Map),u=o.useRef(new Map);return o.useEffect(()=>{if(!e){l([]),i.current.forEach(f=>f.disconnect()),i.current.clear(),u.current.clear();return}let d=!0;const c=100,s=(f,g)=>{if(!d)return;const y=u.current.get(f),x=Date.now();if(y&&x-y<c)return;u.current.set(f,x);const I=document.getElementById("uifork-root"),v=window.innerWidth,p=window.innerHeight,k=v/2,C=p/2,w=pe(f,I,v,p,k,C,g);if(!w){l(j=>j.filter(N=>N.element!==f));const b=i.current.get(f);b&&(b.disconnect(),i.current.delete(f)),u.current.delete(f);return}l(b=>{const j=b.findIndex(R=>R.element===f);if(j===-1)return b;const N=[...b];return N[j]=w,N})},r=(f,g)=>{if(i.current.has(f))return;const y=new MutationObserver(()=>{d&&s(f,g)});y.observe(f,{attributes:!0,attributeFilter:["style"],subtree:!1}),i.current.set(f,y)},h=()=>{if(!d)return;const f=document.getElementById("uifork-root"),g=window.innerWidth,y=window.innerHeight,x=g/2,I=y/2;l(v=>v.map(({element:p,isNextJSDevTools:k})=>pe(p,f,g,y,x,I,k)).filter(p=>p!==null))},m=setTimeout(()=>{if(!d)return;const f=cr();l(f),f.forEach(({element:g,isNextJSDevTools:y})=>{r(g,y)})},250);return window.addEventListener("resize",h),()=>{d=!1,clearTimeout(m),i.current.forEach(f=>f.disconnect()),i.current.clear(),u.current.clear(),window.removeEventListener("resize",h)}},[e]),t}function de({className:e}){return n.jsx(Zn,{className:e,size:16,stroke:1.5})}const ar=({activeView:e,connectionStatus:t,selectedComponent:l,activeVersion:i,activeVersionLabel:u,formatVersionLabel:d,isConnected:c})=>{const s=u||(i?d(i):"-");return n.jsx(n.Fragment,{children:e==="closed-trigger-icon"?n.jsx(n.Fragment,{children:t==="disconnected"||t==="failed"?n.jsxs("div",{className:a.triggerIconContainer,children:[n.jsx(de,{className:`${a.triggerIcon} ${a.triggerIconOffline}`}),n.jsx("div",{className:a.connectionErrorDot,title:"Disconnected from watch server"})]}):n.jsxs(n.Fragment,{children:[t==="connecting"&&n.jsx("div",{className:`${a.statusIndicator} ${a.statusIndicatorConnecting}`,title:"Connecting..."}),n.jsx(de,{className:a.triggerIcon})]})}):n.jsxs(n.Fragment,{children:[n.jsx(de,{className:`${a.triggerIcon} ${c?a.triggerIconOnline:a.triggerIconOffline}`}),n.jsx(A.motion.span,{layoutId:"component-name",layout:"position",className:a.triggerLabel,transition:{duration:$,ease:H},children:l||"No component"}),n.jsx("span",{className:a.triggerVersion,children:s})]})})};function lr({port:e=3001,className:t="",style:l}){const[i,u]=o.useState(!1),[d,c]=o.useState(!1),[s,r]=o.useState(!1),[h,m]=o.useState(!1),[f,g]=o.useState(null),[y,x]=o.useState(!1),I=o.useRef(null),v=o.useRef(null),p=o.useRef(null),k=o.useRef(null),C=o.useRef(null),w=o.useRef(""),[b,j]=O("uifork-theme","system"),[N,R]=O("uifork-position","bottom-right"),[J,W]=O("uifork-code-editor","vscode"),{containerPosition:L,transformOrigin:z,componentSelectorPosition:X}=er({position:N,isComponentSelectorOpen:s,containerRef:p,componentSelectorRef:C}),{isDragging:M,resetDrag:Y,dragEnabled:re,dragControls:se,handlePointerDown:Me,handleDragStart:Te,handleDragEnd:De}=Ko({isOpen:d,containerRef:p,setPosition:R}),{mountedComponents:G,selectedComponent:V,setSelectedComponent:ye,onComponentsUpdate:Le}=qo({port:e});o.useEffect(()=>{w.current=V},[V]);const ce=G.find(_=>_.name===V)?.versions||[],_e=_=>ce.find(S=>S.key===_)?.label,{activeVersion:K,setActiveVersion:ve,editingVersion:Q,renameValue:Re,setRenameValue:Ve,startRename:Pe,confirmRename:xe,cancelRename:Z,clearEditingOnError:$e,storePendingVersion:Oe,versionKeys:Be}=Uo({selectedComponent:V,versions:ce}),{connectionStatus:Ce,sendMessage:F}=Fo({port:e,selectedComponent:V,onComponentsUpdate:Le,onVersionAck:({version:_,message:S,newVersion:D})=>{let q=null;S?.includes("duplicated")||S?.includes("created new version")?q=_:S?.includes("renamed")&&D&&(q=D),q&&Oe(q)},onPromoted:_=>{const S=localStorage.getItem("uifork-selected-component"),D=S?JSON.parse(S):null;if(w.current===_||D===_){localStorage.removeItem("uifork-selected-component"),ye("");const te=()=>{const ae=localStorage.getItem("uifork-selected-component");if(ae)try{JSON.parse(ae)===_&&localStorage.removeItem("uifork-selected-component")}catch{ae===_&&localStorage.removeItem("uifork-selected-component")}};te(),setTimeout(te,0),setTimeout(te,50),setTimeout(te,100)}},onError:$e}),{popoverPositions:He,setPopoverTriggerRef:Ae,setPopoverDropdownRef:Fe}=Jo({openPopoverVersion:f});Xo({versionKeys:Be,activeVersion:K,setActiveVersion:ve}),Yo({isOpen:d,containerRef:p,triggerRef:v,openPopoverVersion:f,isComponentSelectorOpen:s,editingVersion:Q,onClosePopover:()=>g(null),onCloseComponentSelector:()=>r(!1),onCancelRename:Z,onClose:()=>{c(!1),m(!1)}}),ge({isActive:d,refs:[v,p],onClickOutside:o.useCallback(()=>{Q&&Z(),c(!1),m(!1),r(!1)},[Q,Z]),additionalCheck:o.useCallback(_=>{if(C.current?.contains(_))return!0;const S=document.querySelectorAll("[data-popover-dropdown]");for(const D of S)if(D.contains(_))return!0;return!1},[])}),o.useEffect(()=>{u(!0)},[]);const We=(_,S)=>{S.stopPropagation(),F("duplicate_version",{version:_})},ze=(_,S)=>{S.stopPropagation(),F("delete_version",{version:_})},Ge=_=>{_.stopPropagation(),F("new_version",{})},qe=(_,S)=>{S.stopPropagation(),Pe(_)},Ue=o.useCallback(_=>{const S=xe(_);S!==null&&F("rename_label",{version:_,newLabel:S})},[xe,F]),Je=(_,S)=>{S.stopPropagation();const D=_e(_)||ie(_);window.confirm(`Are you sure you want to promote version ${D}?
1
+ (function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode(`#uifork-root{--uifork-bg-dark: #262626;--uifork-bg-hover: #303030;--uifork-button-hover: #404040;--uifork-bg-input: #404040;--uifork-border-color: #2f2f2f;--uifork-text-primary: white;--uifork-text-secondary: #a3a3a3;--uifork-text-muted: #a3a3a3;--uifork-status-connected: #22c55e;--uifork-status-connecting: #eab308;--uifork-status-disconnected: #ef4444;--uifork-accent-success: #22c55e;--uifork-accent-danger: #ef4444;--uifork-accent-delete: #f87171;--uifork-shadow-sm: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -2px rgba(0, 0, 0, .05);--uifork-shadow-md: 0 25px 50px -12px rgba(0, 0, 0, .25);--uifork-bg: var(--uifork-bg-dark);--uifork-fg: var(--uifork-text-primary);--uifork-fg-secondary: var(--uifork-text-secondary);--uifork-hover-bg: rgba(255, 255, 255, .06);--uifork-bg-select: rgba(255, 255, 255, .06);--uifork-bg-select-hover: rgba(255, 255, 255, .1);--uifork-menu-item-height: 32px;--uifork-trigger-height: 32px}#uifork-root[data-theme=light]{--uifork-bg-dark: #ffffff;--uifork-bg-hover: #f5f5f5;--uifork-button-hover: #e5e5e5;--uifork-bg-input: #e5e5e5;--uifork-border-color: #f0f0f0;--uifork-text-primary: #171717;--uifork-text-secondary: #525252;--uifork-text-muted: #737373;--uifork-accent-delete: #dc2626;--uifork-shadow-sm: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -2px rgba(0, 0, 0, .05);--uifork-shadow-md: 0 25px 50px -12px rgba(0, 0, 0, .15);--uifork-hover-bg: rgba(0, 0, 0, .04);--uifork-bg-select: rgba(0, 0, 0, .04);--uifork-bg-select-hover: rgba(0, 0, 0, .08)}@media(prefers-color-scheme:light){#uifork-root[data-theme=system]{--uifork-bg-dark: #ffffff;--uifork-bg-hover: #f5f5f5;--uifork-bg-input: #e5e5e5;--uifork-border-color: #f0f0f0;--uifork-text-primary: #171717;--uifork-text-secondary: #525252;--uifork-text-muted: #737373;--uifork-accent-delete: #dc2626;--uifork-shadow-sm: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -2px rgba(0, 0, 0, .05);--uifork-shadow-md: 0 25px 50px -12px rgba(0, 0, 0, .15);--uifork-hover-bg: rgba(0, 0, 0, .04);--uifork-bg-select: rgba(0, 0, 0, .04);--uifork-bg-select-hover: rgba(0, 0, 0, .08)}}@keyframes _popoverFadeIn_1lnls_1{0%{opacity:0;transform:scale(.95);filter:blur(4px)}to{opacity:1;transform:scale(1);filter:blur(0)}}._container_1lnls_74{position:fixed;z-index:1001;background-color:var(--uifork-bg-dark);box-shadow:var(--uifork-shadow-md);border:1px solid var(--uifork-border-color);overflow:hidden;display:flex;flex-direction:column;border-radius:12px;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}._container_1lnls_74._containerClosed_1lnls_98{border-radius:16px}._container_1lnls_74[data-dragging=true],._container_1lnls_74[data-dragging=true] *{cursor:grabbing!important}._trigger_1lnls_112{display:flex;align-items:center;gap:8px;padding:8px 12px;box-sizing:border-box;font-size:14px;color:var(--uifork-fg);cursor:pointer;background-color:transparent;border:none;white-space:nowrap;height:var(--uifork-trigger-height)}._trigger_1lnls_112:hover{background-color:var(--uifork-hover-bg)}._trigger_1lnls_112._triggerIconOnly_1lnls_129{padding:4px;box-sizing:border-box;width:var(--uifork-trigger-height);height:var(--uifork-trigger-height);justify-content:center}._trigger_1lnls_112._triggerEmpty_1lnls_136{padding:4px;box-sizing:border-box;width:32px;height:32px;justify-content:center}._statusIndicator_1lnls_145{width:8px;height:8px;border-radius:50%}._statusIndicatorConnected_1lnls_151{background-color:var(--uifork-status-connected)}._statusIndicatorConnecting_1lnls_155{background-color:var(--uifork-status-connecting)}._statusIndicatorDisconnected_1lnls_159{background-color:var(--uifork-status-disconnected)}._statusIndicatorFailed_1lnls_163{background-color:var(--uifork-status-disconnected);animation:_pulse_1lnls_1 2s ease-in-out infinite}@keyframes _pulse_1lnls_1{0%,to{opacity:1}50%{opacity:.5}}._menuItem_1lnls_179{height:var(--uifork-menu-item-height);min-height:var(--uifork-menu-item-height);border-radius:8px}._triggerSeparator_1lnls_186{color:var(--uifork-fg-secondary);margin:0 4px}._triggerLabel_1lnls_191,._triggerVersion_1lnls_192{white-space:nowrap}._triggerLabel_1lnls_191{font-weight:500}._triggerVersion_1lnls_192{color:var(--uifork-fg-secondary)}._triggerIcon_1lnls_129{width:16px;height:16px;transition:transform .2s,color .4s cubic-bezier(.4,0,.2,1),width .2s;color:var(--uifork-fg-secondary)}._triggerIcon_1lnls_129._triggerIconOpen_1lnls_214{transform:rotate(180deg)}._dropdown_1lnls_219{min-width:200px;padding:4px;box-sizing:border-box;display:flex;flex-direction:column}._componentSelectorRow_1lnls_228{display:flex;align-items:center;justify-content:space-between;padding:0;box-sizing:border-box}._componentSelector_1lnls_228{padding:8px 12px;box-sizing:border-box;font-size:14px;color:var(--uifork-fg);background-color:transparent;border:none;border-radius:8px;cursor:pointer;display:flex;align-items:center;justify-content:space-between;gap:8px;text-align:left;flex-shrink:0}._componentSelector_1lnls_228:hover{background-color:var(--uifork-hover-bg)}._componentSelectorLabel_1lnls_257{font-weight:500;color:var(--uifork-fg)}._componentSelectorIcon_1lnls_262{width:12px;height:12px;color:var(--uifork-fg-secondary);flex-shrink:0}._componentSelectorSettings_1lnls_269{padding:8px;box-sizing:border-box;background-color:transparent;border:none;border-radius:8px;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--uifork-fg);transition:background-color .15s}._componentSelectorSettings_1lnls_269:hover{background-color:var(--uifork-hover-bg)}._componentSelectorSettingsIcon_1lnls_286{width:16px;height:16px}._divider_1lnls_292{border-top:1px solid var(--uifork-border-color);margin:4px 0}._versionsList_1lnls_298{display:flex;flex-direction:column;max-height:300px;overflow-y:auto;gap:2px}._versionsList_1lnls_298::-webkit-scrollbar{width:4px}._versionsList_1lnls_298::-webkit-scrollbar-track{background:transparent}._versionsList_1lnls_298::-webkit-scrollbar-thumb{background:var(--uifork-border-color);border-radius:2px}._emptyState_1lnls_318{padding:8px 12px;box-sizing:border-box;font-size:14px;color:var(--uifork-text-muted)}._emptyStateContainer_1lnls_325{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:12px;box-sizing:border-box;gap:8px;text-align:center}._emptyStateHeading_1lnls_336{font-size:14px;font-weight:500;color:var(--uifork-fg);margin:0}._emptyStateText_1lnls_343{font-size:13px;color:var(--uifork-fg-secondary);margin:0;line-height:1.4;max-width:220px;text-wrap:balance}._inlineCode_1lnls_352{font-family:monospace;font-size:13px;background-color:var(--uifork-bg-input);padding:2px 4px;box-sizing:border-box;border-radius:3px;color:var(--uifork-fg)}._emptyStateCommandContainer_1lnls_362{display:flex;align-items:center;gap:4px;background-color:var(--uifork-bg-input);padding:4px 8px;box-sizing:border-box;border-radius:4px;margin-top:4px;border:none;cursor:pointer;transition:background-color .15s}._emptyStateCommandContainer_1lnls_362:hover{background-color:var(--uifork-hover-bg)}._emptyStateCommand_1lnls_362{font-size:13px;color:var(--uifork-fg);margin:0;font-family:monospace}._emptyStateCopyIcon_1lnls_386{width:14px;height:14px;color:var(--uifork-text-secondary);flex-shrink:0;transition:color .15s}._emptyStateCommandContainer_1lnls_362:hover ._emptyStateCopyIcon_1lnls_386{color:var(--uifork-text-primary)}._versionItem_1lnls_398{padding:8px 4px 8px 8px;box-sizing:border-box;font-size:14px;color:var(--uifork-fg);background-color:transparent;border:none;border-radius:8px;cursor:pointer}._versionItem_1lnls_398:hover{background-color:var(--uifork-hover-bg)}._versionItem_1lnls_398{display:flex;align-items:center;gap:8px}._versionItem_1lnls_398:hover ._actions_1lnls_416{opacity:1}._checkmarkContainer_1lnls_421{width:16px;height:16px;flex-shrink:0;display:flex;align-items:center;justify-content:center}._checkmarkIcon_1lnls_430{width:16px;height:16px;opacity:.5}._versionLabel_1lnls_437{flex:1;display:flex;align-items:center;gap:8px}._versionId_1lnls_444{color:var(--uifork-fg)}._versionLabelText_1lnls_448{opacity:.5}._versionItemEditing_1lnls_453{padding:8px 4px 8px 8px;box-sizing:border-box;font-size:14px;color:var(--uifork-fg);background-color:var(--uifork-hover-bg);border:none;border-radius:8px;display:flex;align-items:center;gap:8px}._renameInput_1lnls_467{flex:1;background-color:transparent;padding:0;box-sizing:border-box;font-size:14px;color:var(--uifork-fg);border:none;outline:none}._renameInput_1lnls_467::placeholder{color:var(--uifork-text-muted)}._actions_1lnls_416{display:flex;align-items:center;gap:2px;opacity:0;transition:opacity .15s}._actionButton_1lnls_490{padding:4px;box-sizing:border-box;border-radius:4px;background-color:transparent;border:none;cursor:pointer;color:var(--uifork-fg);transition:background-color .15s ease;display:flex;align-items:center;justify-content:center;height:calc(var(--uifork-menu-item-height) - 8px);width:calc(var(--uifork-menu-item-height) - 8px)}._actionButton_1lnls_490:hover{background-color:var(--uifork-hover-bg)}._actionIcon_1lnls_509{width:14px;height:14px;color:var(--uifork-fg-secondary);transition:color .15s}._actionButton_1lnls_490:hover ._actionIcon_1lnls_509{color:var(--uifork-fg)}._disabled_1lnls_520{opacity:.4;cursor:not-allowed;pointer-events:none}._actionButtonMore_1lnls_526{position:relative}._popover_1lnls_531{position:fixed;z-index:1002;min-width:140px;border-radius:12px;background-color:var(--uifork-bg-dark);box-shadow:var(--uifork-shadow-md);border:1px solid var(--uifork-border-color);padding:4px;box-sizing:border-box;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;transform-origin:left center;animation:_popoverFadeIn_1lnls_1 .2s cubic-bezier(.04,1.02,.13,1.02)}._popoverMenuItem_1lnls_558{display:flex;width:100%;align-items:center;gap:8px;padding:8px 4px 8px 8px;box-sizing:border-box;font-size:14px;color:var(--uifork-fg);background-color:transparent;border:none;cursor:pointer;text-align:left}._popoverMenuItem_1lnls_558:hover{background-color:var(--uifork-hover-bg)}._popoverMenuItem_1lnls_558._popoverMenuItemDelete_1lnls_575{color:var(--uifork-accent-delete)}._popoverMenuItemIcon_1lnls_579{width:16px;height:16px;color:var(--uifork-fg-secondary);flex-shrink:0}._popoverMenuItem_1lnls_558._popoverMenuItemDelete_1lnls_575 ._popoverMenuItemIcon_1lnls_579{color:var(--uifork-accent-delete)}._confirmButton_1lnls_590{padding:4px;box-sizing:border-box;border-radius:4px;background-color:transparent;border:none;cursor:pointer}._confirmIcon_1lnls_599{width:16px;height:16px;color:var(--uifork-accent-success)}._cancelIcon_1lnls_605{width:16px;height:16px;color:var(--uifork-accent-danger)}._newVersionButton_1lnls_612{padding:8px 4px 8px 8px;box-sizing:border-box;font-size:14px;color:var(--uifork-fg);background-color:transparent;border:none;border-radius:8px;cursor:pointer}._newVersionButton_1lnls_612{display:flex;width:100%;align-items:center;gap:8px;text-align:left;color:var(--uifork-fg)}._newVersionButton_1lnls_612:hover{background-color:var(--uifork-hover-bg)}._newVersionIconContainer_1lnls_637{width:16px;height:16px;flex-shrink:0;display:flex;align-items:center;justify-content:center}._newVersionIcon_1lnls_637{width:16px;height:16px}._componentSelectorDropdown_1lnls_652{position:fixed;z-index:1002;width:max-content;min-width:220px;border-radius:12px;background-color:var(--uifork-bg-dark);box-shadow:var(--uifork-shadow-md);border:1px solid var(--uifork-border-color);padding:4px;box-sizing:border-box;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;transform-origin:right center;animation:_popoverFadeIn_1lnls_1 .2s cubic-bezier(.04,1.02,.13,1.02)}._componentSelectorItem_1lnls_680{display:flex;align-items:center;gap:8px;padding:8px 12px;box-sizing:border-box;font-size:14px;color:var(--uifork-fg);background-color:transparent;border:none;cursor:pointer;text-align:left;width:100%}._componentSelectorItem_1lnls_680:hover,._componentSelectorItem_1lnls_680._componentSelectorItemSelected_1lnls_695{background-color:var(--uifork-hover-bg)}._componentSelectorItemCheckmarkContainer_1lnls_699{width:16px;height:16px;flex-shrink:0;display:flex;align-items:center;justify-content:center}._componentSelectorItemCheckmark_1lnls_699{width:16px;height:16px}._componentSelectorItemName_1lnls_713{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._componentSelectorItemCount_1lnls_721{margin-left:auto;color:var(--uifork-text-muted);font-size:12px;flex-shrink:0}._componentSelectorDropdownTitle_1lnls_728{font-size:12px;color:var(--uifork-text-muted);margin-bottom:4px;padding-left:4px;box-sizing:border-box;font-weight:500}._componentSelectorDropdownHint_1lnls_737{font-size:11px;color:var(--uifork-text-muted);padding:6px 6px 4px;box-sizing:border-box;line-height:1.4;max-width:230px;display:flex;align-items:flex-start;gap:6px}._componentSelectorDropdownHintIcon_1lnls_749{flex-shrink:0;color:var(--uifork-text-muted);margin-top:1px}._componentSelectorDropdownHintCode_1lnls_755{display:inline-flex;align-items:center;gap:4px;font-family:ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,monospace;font-size:10px;background:var(--uifork-bg-hover);color:var(--uifork-fg);padding:2px 5px;box-sizing:border-box;border-radius:4px}._settingsView_1lnls_769{display:flex;flex-direction:column;gap:12px;padding:8px;box-sizing:border-box}._settingsBackButton_1lnls_777{position:relative;display:flex;align-items:center;gap:4px;padding:0;box-sizing:border-box;font-size:14px;color:var(--uifork-fg);background-color:transparent;border:none;cursor:pointer;text-align:left;z-index:1}._settingsBackButton_1lnls_777:before{content:"";position:absolute;inset:-6px -10px -6px -6px;background-color:transparent;border-radius:8px;transition:background-color .15s;z-index:-1}._settingsBackButton_1lnls_777:hover:before{background-color:var(--uifork-hover-bg)}._settingsBackIcon_1lnls_810{width:16px;height:16px;transform:rotate(180deg);margin-left:-2px}._settingsContent_1lnls_817{flex:1;display:flex;flex-direction:column;gap:12px}._settingsTitle_1lnls_824{font-size:16px;font-weight:500;color:var(--uifork-fg);margin:0 0 8px}._settingsText_1lnls_831{font-size:14px;color:var(--uifork-fg-secondary);margin:0;line-height:1.5}._settingsGroup_1lnls_838{display:flex;align-items:center;gap:8px}._settingsLabel_1lnls_844{font-size:13px;font-weight:500;color:var(--uifork-fg);white-space:nowrap;width:100px;text-align:left;flex-shrink:0}._settingsSelect_1lnls_854{flex:1;padding:0 30px 0 12px;box-sizing:border-box;height:var(--uifork-trigger-height);font-size:14px;color:var(--uifork-fg);background-color:var(--uifork-bg-select);border:1px solid var(--uifork-border-color);border-radius:8px;cursor:pointer;outline:none;transition:background-color .15s,border-color .15s;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23a3a3a3' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 8px center;text-align:left}._settingsSelect_1lnls_854:hover{background-color:var(--uifork-bg-select-hover);border-color:var(--uifork-border-color)}._settingsSelect_1lnls_854:focus{border-color:var(--uifork-border-color);background-color:var(--uifork-bg-select-hover);outline:2px solid var(--uifork-border-color);outline-offset:2px}._settingsSelect_1lnls_854 option{background-color:var(--uifork-bg-dark);color:var(--uifork-fg)}._settingsCheckboxGroup_1lnls_891{display:flex;flex-direction:column;align-items:flex-start;gap:0}._settingsCheckboxLabel_1lnls_898{display:flex;flex-direction:row;gap:10px;width:100%;cursor:pointer;align-items:flex-start}._settingsCheckboxInput_1lnls_907{position:absolute;opacity:0;width:0;height:0;margin:0;pointer-events:none}._settingsCheckboxVisual_1lnls_916{width:16px;height:16px;border-radius:5px;border:1.5px solid var(--uifork-border-color);background-color:transparent;display:flex;align-items:center;justify-content:center;transition:all .15s ease;flex-shrink:0;margin-top:2px}._settingsCheckboxVisualChecked_1lnls_930{background-color:#3b82f6;border-color:#3b82f6}._settingsCheckboxContent_1lnls_935{display:flex;flex-direction:column;gap:0;flex:1}._settingsCheckboxLabelText_1lnls_942{width:auto;margin:0;font-size:14px}._settingsCheckboxDescription_1lnls_948{margin:0;font-size:13px;opacity:.8}._tooltip_1lnls_955{position:fixed;z-index:1003;padding:2px 6px;box-sizing:border-box;font-size:12px;color:var(--uifork-text-primary);background-color:var(--uifork-bg-dark);border:1px solid var(--uifork-border-color);border-radius:6px;box-shadow:var(--uifork-shadow-md);pointer-events:none;white-space:nowrap;opacity:0;transition:opacity .15s ease-in-out;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}._tooltipVisible_1lnls_984{opacity:1}._offlineMessageCommandButton_1lnls_988{display:inline-flex;align-items:center;gap:4px;background-color:transparent;border:none;cursor:pointer;padding:0;box-sizing:border-box;transition:opacity .15s}._offlineMessageCommandButton_1lnls_988:hover{opacity:.8}._offlineMessageCopyIcon_1lnls_1004{width:12px;height:12px;color:var(--uifork-text-muted);flex-shrink:0;transition:color .15s}._offlineMessageCommandButton_1lnls_988:hover ._offlineMessageCopyIcon_1lnls_1004{color:var(--uifork-text-primary)}`)),document.head.appendChild(o)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
2
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("react"),fe=require("react-dom"),A=require("motion/react"),T=require("@floating-ui/dom"),Ze="_container_1lnls_74",et="_containerClosed_1lnls_98",tt="_trigger_1lnls_112",nt="_triggerIconOnly_1lnls_129",ot="_triggerEmpty_1lnls_136",st="_statusIndicator_1lnls_145",rt="_statusIndicatorConnected_1lnls_151",ct="_statusIndicatorConnecting_1lnls_155",it="_statusIndicatorDisconnected_1lnls_159",lt="_statusIndicatorFailed_1lnls_163",at="_pulse_1lnls_1",ut="_menuItem_1lnls_179",dt="_triggerSeparator_1lnls_186",pt="_triggerLabel_1lnls_191",mt="_triggerVersion_1lnls_192",ft="_triggerIcon_1lnls_129",gt="_triggerIconOpen_1lnls_214",ht="_dropdown_1lnls_219",yt="_componentSelectorRow_1lnls_228",vt="_componentSelector_1lnls_228",_t="_componentSelectorLabel_1lnls_257",xt="_componentSelectorIcon_1lnls_262",kt="_componentSelectorSettings_1lnls_269",Ct="_componentSelectorSettingsIcon_1lnls_286",St="_divider_1lnls_292",bt="_versionsList_1lnls_298",wt="_emptyState_1lnls_318",It="_emptyStateContainer_1lnls_325",jt="_emptyStateHeading_1lnls_336",Et="_emptyStateText_1lnls_343",Nt="_inlineCode_1lnls_352",Mt="_emptyStateCommandContainer_1lnls_362",Tt="_emptyStateCommand_1lnls_362",Rt="_emptyStateCopyIcon_1lnls_386",Lt="_versionItem_1lnls_398",Vt="_actions_1lnls_416",Dt="_checkmarkContainer_1lnls_421",Pt="_checkmarkIcon_1lnls_430",$t="_versionLabel_1lnls_437",Ot="_versionId_1lnls_444",Bt="_versionLabelText_1lnls_448",Ht="_versionItemEditing_1lnls_453",At="_renameInput_1lnls_467",Ft="_actionButton_1lnls_490",Wt="_actionIcon_1lnls_509",zt="_disabled_1lnls_520",Gt="_actionButtonMore_1lnls_526",qt="_popover_1lnls_531",Ut="_popoverFadeIn_1lnls_1",Jt="_popoverMenuItem_1lnls_558",Xt="_popoverMenuItemDelete_1lnls_575",Yt="_popoverMenuItemIcon_1lnls_579",Kt="_confirmButton_1lnls_590",Qt="_confirmIcon_1lnls_599",Zt="_cancelIcon_1lnls_605",en="_newVersionButton_1lnls_612",tn="_newVersionIconContainer_1lnls_637",nn="_newVersionIcon_1lnls_637",on="_componentSelectorDropdown_1lnls_652",sn="_componentSelectorItem_1lnls_680",rn="_componentSelectorItemSelected_1lnls_695",cn="_componentSelectorItemCheckmarkContainer_1lnls_699",ln="_componentSelectorItemCheckmark_1lnls_699",an="_componentSelectorItemName_1lnls_713",un="_componentSelectorItemCount_1lnls_721",dn="_componentSelectorDropdownTitle_1lnls_728",pn="_componentSelectorDropdownHint_1lnls_737",mn="_componentSelectorDropdownHintIcon_1lnls_749",fn="_componentSelectorDropdownHintCode_1lnls_755",gn="_settingsView_1lnls_769",hn="_settingsBackButton_1lnls_777",yn="_settingsBackIcon_1lnls_810",vn="_settingsContent_1lnls_817",_n="_settingsTitle_1lnls_824",xn="_settingsText_1lnls_831",kn="_settingsGroup_1lnls_838",Cn="_settingsLabel_1lnls_844",Sn="_settingsSelect_1lnls_854",bn="_settingsCheckboxGroup_1lnls_891",wn="_settingsCheckboxLabel_1lnls_898",In="_settingsCheckboxInput_1lnls_907",jn="_settingsCheckboxVisual_1lnls_916",En="_settingsCheckboxVisualChecked_1lnls_930",Nn="_settingsCheckboxContent_1lnls_935",Mn="_settingsCheckboxLabelText_1lnls_942",Tn="_settingsCheckboxDescription_1lnls_948",Rn="_tooltip_1lnls_955",Ln="_tooltipVisible_1lnls_984",Vn="_offlineMessageCommandButton_1lnls_988",Dn="_offlineMessageCopyIcon_1lnls_1004",d={container:Ze,containerClosed:et,trigger:tt,triggerIconOnly:nt,triggerEmpty:ot,statusIndicator:st,statusIndicatorConnected:rt,statusIndicatorConnecting:ct,statusIndicatorDisconnected:it,statusIndicatorFailed:lt,pulse:at,menuItem:ut,triggerSeparator:dt,triggerLabel:pt,triggerVersion:mt,triggerIcon:ft,triggerIconOpen:gt,dropdown:ht,componentSelectorRow:yt,componentSelector:vt,componentSelectorLabel:_t,componentSelectorIcon:xt,componentSelectorSettings:kt,componentSelectorSettingsIcon:Ct,divider:St,versionsList:bt,emptyState:wt,emptyStateContainer:It,emptyStateHeading:jt,emptyStateText:Et,inlineCode:Nt,emptyStateCommandContainer:Mt,emptyStateCommand:Tt,emptyStateCopyIcon:Rt,versionItem:Lt,actions:Vt,checkmarkContainer:Dt,checkmarkIcon:Pt,versionLabel:$t,versionId:Ot,versionLabelText:Bt,versionItemEditing:Ht,renameInput:At,actionButton:Ft,actionIcon:Wt,disabled:zt,actionButtonMore:Gt,popover:qt,popoverFadeIn:Ut,popoverMenuItem:Jt,popoverMenuItemDelete:Xt,popoverMenuItemIcon:Yt,confirmButton:Kt,confirmIcon:Qt,cancelIcon:Zt,newVersionButton:en,newVersionIconContainer:tn,newVersionIcon:nn,componentSelectorDropdown:on,componentSelectorItem:sn,componentSelectorItemSelected:rn,componentSelectorItemCheckmarkContainer:cn,componentSelectorItemCheckmark:ln,componentSelectorItemName:an,componentSelectorItemCount:un,componentSelectorDropdownTitle:dn,componentSelectorDropdownHint:pn,componentSelectorDropdownHintIcon:mn,componentSelectorDropdownHintCode:fn,settingsView:gn,settingsBackButton:hn,settingsBackIcon:yn,settingsContent:vn,settingsTitle:_n,settingsText:xn,settingsGroup:kn,settingsLabel:Cn,settingsSelect:Sn,settingsCheckboxGroup:bn,settingsCheckboxLabel:wn,settingsCheckboxInput:In,settingsCheckboxVisual:jn,settingsCheckboxVisualChecked:En,settingsCheckboxContent:Nn,settingsCheckboxLabelText:Mn,settingsCheckboxDescription:Tn,tooltip:Rn,tooltipVisible:Ln,offlineMessageCommandButton:Vn,offlineMessageCopyIcon:Dn};var Pn={outline:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},filled:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"}};const E=(e,t,c,i)=>{const a=o.forwardRef(({color:u="currentColor",size:l=24,stroke:s=2,title:r,className:f,children:p,...h},m)=>o.createElement("svg",{ref:m,...Pn[e],width:l,height:l,className:["tabler-icon",`tabler-icon-${t}`,f].join(" "),strokeWidth:s,stroke:u,...h},[r&&o.createElement("title",{key:"svg-title"},r),...i.map(([y,_])=>o.createElement(y,_)),...Array.isArray(p)?p:[p]]));return a.displayName=`${c}`,a};const $n=[["path",{d:"M5 12l5 5l10 -10",key:"svg-0"}]],On=E("outline","check","Check",$n);const Bn=[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]],Hn=E("outline","chevron-down","ChevronDown",Bn);const An=[["path",{d:"M9 6l6 6l-6 6",key:"svg-0"}]],Fn=E("outline","chevron-right","ChevronRight",An);const Wn=[["path",{d:"M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666",key:"svg-0"}],["path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}]],zn=E("outline","copy","Copy",Wn);const Gn=[["path",{d:"M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M11 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M11 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}]],qn=E("outline","dots-vertical","DotsVertical",Gn);const Un=[["path",{d:"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6",key:"svg-0"}],["path",{d:"M11 13l9 -9",key:"svg-1"}],["path",{d:"M15 4h5v5",key:"svg-2"}]],Jn=E("outline","external-link","ExternalLink",Un);const Xn=[["path",{d:"M5 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M5 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M15 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-2"}],["path",{d:"M7 8l0 8",key:"svg-3"}],["path",{d:"M9 18h6a2 2 0 0 0 2 -2v-5",key:"svg-4"}],["path",{d:"M14 14l3 -3l3 3",key:"svg-5"}]],Yn=E("outline","git-branch","GitBranch",Xn);const Kn=[["path",{d:"M10 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M5 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M15 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-2"}],["path",{d:"M7 8v2a2 2 0 0 0 2 2h6a2 2 0 0 0 2 -2v-2",key:"svg-3"}],["path",{d:"M12 12l0 4",key:"svg-4"}]],Qn=E("outline","git-fork","GitFork",Kn);const Zn=[["path",{d:"M5 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M5 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M15 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-2"}],["path",{d:"M7 8l0 8",key:"svg-3"}],["path",{d:"M7 8a4 4 0 0 0 4 4h4",key:"svg-4"}]],eo=E("outline","git-merge","GitMerge",Zn);const to=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M12 9h.01",key:"svg-1"}],["path",{d:"M11 12h1v4h1",key:"svg-2"}]],no=E("outline","info-circle","InfoCircle",to);const oo=[["path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4",key:"svg-0"}],["path",{d:"M13.5 6.5l4 4",key:"svg-1"}]],so=E("outline","pencil","Pencil",oo);const ro=[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]],co=E("outline","plus","Plus",ro);const io=[["path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065",key:"svg-0"}],["path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}]],lo=E("outline","settings","Settings",io);const ao=[["path",{d:"M4 7l16 0",key:"svg-0"}],["path",{d:"M10 11l0 6",key:"svg-1"}],["path",{d:"M14 11l0 6",key:"svg-2"}],["path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12",key:"svg-3"}],["path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3",key:"svg-4"}]],uo=E("outline","trash","Trash",ao);const po=[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]],mo=E("outline","x","X",po);function fo({className:e}){return n.jsx(Hn,{className:e,size:16,stroke:2})}function go({className:e}){return n.jsx(lo,{className:e,size:16,stroke:1.5})}function X({className:e}){return n.jsx(On,{className:e,size:16,stroke:2})}function ho({className:e}){return n.jsx(no,{className:e,size:12,stroke:2})}const P=.3,H=[.04,1.02,.13,1.02],W="uifork-component-";function ge({isActive:e,refs:t,onClickOutside:c,additionalCheck:i}){o.useEffect(()=>{if(!e)return;const a=u=>{const l=u.target;for(const s of t)if(s.current?.contains(l))return;i?.(l)||c()};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[e,t,c,i])}function yo({selectedComponent:e,onToggle:t,onSettingsClick:c}){return n.jsxs("div",{className:d.componentSelectorRow,children:[n.jsxs("button",{"data-component-selector":!0,onClick:t,className:`${d.componentSelector} ${d.menuItem}`,children:[n.jsx(A.motion.span,{layoutId:"component-name",layout:"position",className:d.componentSelectorLabel,transition:{layout:{duration:P,ease:H}},children:e||"Select component"}),n.jsx(fo,{className:d.componentSelectorIcon})]}),n.jsx("button",{onClick:c,className:d.componentSelectorSettings,title:"Settings","aria-label":"Open settings",children:n.jsx(go,{className:d.componentSelectorSettingsIcon})})]})}function vo({mountedComponents:e,selectedComponent:t,isOpen:c,position:i,onSelect:a,onClose:u,componentSelectorRef:l,isConnected:s}){return ge({isActive:c,refs:[l],onClickOutside:u,additionalCheck:r=>!!r.closest?.("[data-component-selector]")}),c?n.jsxs("div",{ref:l,className:d.componentSelectorDropdown,style:{left:`${i.x}px`,top:`${i.y}px`,visibility:"hidden"},children:[n.jsx("div",{className:d.componentSelectorDropdownTitle,children:"Forked components"}),e.length===0?n.jsx("div",{className:d.emptyState,children:"No mounted components found"}):n.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:e.map(r=>n.jsxs("button",{onClick:()=>a(r.name),className:`${d.componentSelectorItem} ${d.menuItem} ${r.name===t?d.componentSelectorItemSelected:""}`,children:[n.jsx("div",{className:d.componentSelectorItemCheckmarkContainer,children:r.name===t&&n.jsx(X,{className:d.componentSelectorItemCheckmark})}),n.jsx("span",{className:d.componentSelectorItemName,children:r.name}),n.jsx("span",{className:d.componentSelectorItemCount,children:r.versions.length})]},r.name))}),s&&n.jsxs("div",{className:d.componentSelectorDropdownHint,children:[n.jsx(ho,{className:d.componentSelectorDropdownHintIcon}),n.jsxs("span",{children:["Use ",n.jsx("code",{className:d.componentSelectorDropdownHintCode,children:"npx uifork init"})," to iterate on more components"]})]})]}):null}function _o({className:e}){return n.jsx(Qn,{className:e,size:16,stroke:1.5})}function xo({className:e}){return n.jsx(qn,{className:e,size:16,stroke:2})}function ko({className:e}){return n.jsx(eo,{className:e,size:16,stroke:2})}function Co({className:e}){return n.jsx(Jn,{className:e,size:16,stroke:1.5})}function So({className:e}){return n.jsx(uo,{className:e,size:16,stroke:1.5})}function Se({className:e}){return n.jsx(so,{className:e,size:16,stroke:1.5})}function oe({icon:e,label:t,onClick:c,variant:i="default",stopPropagation:a=!1}){const u=l=>{a&&l.stopPropagation(),c(l)};return n.jsxs("button",{onClick:u,className:`${d.popoverMenuItem} ${d.menuItem} ${i==="delete"?d.popoverMenuItemDelete:""}`,children:[n.jsx(e,{className:d.popoverMenuItemIcon}),n.jsx("span",{children:t})]})}function bo({version:e,label:t,position:c,onPromote:i,onOpenInEditor:a,onDelete:u,onRename:l,onClose:s,setDropdownRef:r}){const f=t&&t.trim()?"Edit label":"Add label",p=o.useRef(null),h=o.useCallback(y=>{p.current=y,r(y)},[r]);ge({isActive:!0,refs:[p],onClickOutside:s,additionalCheck:y=>!!y.closest?.("[data-actions]")});const m=typeof document<"u"?document.getElementById("uifork-root")||document.body:null;return m?fe.createPortal(n.jsxs("div",{ref:h,className:d.popover,"data-popover-dropdown":!0,style:{visibility:"hidden"},role:"menu",children:[n.jsx(oe,{icon:Se,label:f,stopPropagation:!0,onClick:y=>{l(e,y),s()}}),n.jsx(oe,{icon:ko,label:"Promote",onClick:y=>{i(e,y),s()}}),n.jsx(oe,{icon:Co,label:"Open in editor",onClick:y=>{a(e,y),s()}}),n.jsx("div",{className:d.divider}),n.jsx(oe,{icon:So,label:"Delete",variant:"delete",stopPropagation:!0,onClick:y=>{u(e,y),s()}})]}),m):null}let he=!1,be=0;const wo=1e3;function Io(){he=!0,be=Date.now()}function ue(){he=!1}function jo(){const e=Date.now()-be;return he||e<wo}function se({label:e,children:t,placement:c="top"}){const[i,a]=o.useState(!1),[u,l]=o.useState({x:0,y:0}),s=o.useRef(null),r=o.useRef(null),f=o.useRef(null),p=o.useRef(null),h=o.useRef(null);o.useEffect(()=>{const k=document.getElementById("uifork-root");k&&(h.current=k)},[]),o.useEffect(()=>{if(!i||!s.current||!r.current)return;let k=null,g=!1;const x=async()=>{if(!(g||!s.current||!r.current))try{const{x:S,y:I}=await T.computePosition(s.current,r.current,{placement:c,strategy:"fixed",middleware:[T.offset(8),T.shift({padding:8})]});g||(l({x:S,y:I}),r.current&&(r.current.style.visibility="visible",r.current.classList.add(d.tooltipVisible)))}catch{}};return r.current&&(r.current.style.visibility="hidden"),x(),s.current&&r.current&&(k=T.autoUpdate(s.current,r.current,x)),()=>{g=!0,k&&k(),r.current&&r.current.classList.remove(d.tooltipVisible)}},[i,c]);const m=()=>{p.current&&(clearTimeout(p.current),p.current=null),f.current&&clearTimeout(f.current);const g=jo()?0:300;f.current=setTimeout(()=>{a(!0),f.current=null},g)},y=()=>{f.current&&(clearTimeout(f.current),f.current=null),p.current=setTimeout(()=>{a(!1),ue(),p.current=null},150)};o.useEffect(()=>{i?Io():ue()},[i]),o.useEffect(()=>()=>{f.current&&clearTimeout(f.current),p.current&&clearTimeout(p.current),i&&ue()},[i]);const _=o.cloneElement(t,{ref:k=>{s.current=k;const g=t.ref;g&&(typeof g=="function"?g(k):g.current=k)},onMouseEnter:k=>{m(),t.props.onMouseEnter?.(k)},onMouseLeave:k=>{y(),t.props.onMouseLeave?.(k)}}),b=h.current||document.getElementById("uifork-root")||document.body;return n.jsxs(n.Fragment,{children:[_,i&&fe.createPortal(n.jsx("div",{ref:r,className:d.tooltip,style:{left:`${u.x}px`,top:`${u.y}px`,visibility:"hidden"},role:"tooltip",children:e}),b)]})}function Eo({version:e,label:t,isSelected:c,formatVersionLabel:i,popoverPosition:a,isPopoverOpen:u,isConnected:l,onSelect:s,onDuplicate:r,onTogglePopover:f,onPromote:p,onOpenInEditor:h,onDelete:m,onRename:y,setPopoverTriggerRef:_,setPopoverDropdownRef:b}){const k=i(e);return n.jsxs("div",{role:"option","aria-selected":c,"data-key":e,onClick:()=>s(e),className:`${d.versionItem} ${d.menuItem}`,children:[n.jsx("div",{className:d.checkmarkContainer,children:c&&n.jsx(X,{className:d.checkmarkIcon})}),n.jsxs("div",{className:d.versionLabel,children:[n.jsx("span",{className:d.versionId,children:k}),t&&n.jsx("span",{className:d.versionLabelText,children:t})]}),l&&n.jsxs("div",{"data-actions":!0,className:d.actions,onClick:g=>g.stopPropagation(),children:[n.jsx(se,{label:"Fork version",placement:"top",children:n.jsx("button",{onClick:g=>{g.stopPropagation(),r(e,g)},className:d.actionButton,children:n.jsx(_o,{className:d.actionIcon})})}),n.jsxs("div",{className:d.actionButtonMore,children:[n.jsx(se,{label:"More options",placement:"top",children:n.jsx("button",{ref:g=>_(e,g),onClick:g=>{g.stopPropagation(),f(e,g)},className:d.actionButton,children:n.jsx(xo,{className:d.actionIcon})})}),u&&n.jsx(bo,{version:e,label:t,position:a||{x:0,y:0},onPromote:p,onOpenInEditor:h,onDelete:m,onRename:y,onClose:()=>f(e),setDropdownRef:g=>b(e,g)})]})]})]})}function No({className:e}){return n.jsx(mo,{className:e,size:16,stroke:2})}const Mo=o.forwardRef(function({containerStyle:t,containerClassName:c,className:i,value:a,placeholder:u,...l},s){const r=o.useRef(null),f=o.useRef(null),[p,h]=o.useState(void 0);return o.useImperativeHandle(s,()=>r.current),o.useLayoutEffect(()=>{if(f.current){const m=a?.toString()||u||"";f.current.textContent=m||" ";const y=f.current.offsetWidth;h(y+2)}},[a,u]),n.jsxs("span",{className:c,style:{display:"inline-block",position:"relative",overflow:"hidden",...t},children:[n.jsx("span",{ref:f,"aria-hidden":"true",style:{position:"absolute",visibility:"hidden",whiteSpace:"pre",font:"inherit",letterSpacing:"inherit",textTransform:"inherit"}}),n.jsx("input",{ref:r,type:"text",value:a,placeholder:u,className:i,style:{width:p!==void 0?`${p}px`:void 0,maxWidth:"100%",font:"inherit",letterSpacing:"inherit",textTransform:"inherit",boxSizing:"border-box",minWidth:0},...l})]})});function To({version:e,value:t,onChange:c,formatVersionLabel:i,onConfirm:a,onCancel:u}){const l=o.useRef(null),s=i(e);return o.useEffect(()=>{l.current&&(l.current.focus(),l.current.select())},[]),n.jsxs("div",{className:`${d.versionItemEditing} ${d.menuItem}`,onClick:r=>r.stopPropagation(),children:[n.jsx("div",{className:d.checkmarkContainer,children:n.jsx(Se,{className:d.checkmarkIcon})}),n.jsxs("div",{className:d.versionLabel,children:[n.jsx("span",{className:d.versionId,children:s}),n.jsx(Mo,{ref:l,value:t,onChange:r=>c(r.target.value),onKeyDown:r=>{r.key==="Enter"?(r.preventDefault(),r.stopPropagation(),a(e)):r.key==="Escape"&&(r.preventDefault(),r.stopPropagation(),u())},onClick:r=>r.stopPropagation(),className:d.renameInput,placeholder:"Add label",containerStyle:{minWidth:60,maxWidth:220}})]}),n.jsxs("div",{className:d.actions,style:{opacity:1},children:[n.jsx(se,{label:"Confirm",placement:"top",children:n.jsx("button",{onClick:r=>{r.stopPropagation(),a(e)},className:d.actionButton,children:n.jsx(X,{className:d.actionIcon})})}),n.jsx(se,{label:"Cancel",placement:"top",children:n.jsx("button",{onClick:r=>{r.stopPropagation(),u()},className:d.actionButton,children:n.jsx(No,{className:d.actionIcon})})})]})]})}function Ro({versions:e,activeVersion:t,editingVersion:c,renameValue:i,formatVersionLabel:a,openPopoverVersion:u,popoverPositions:l,isConnected:s,onSelectVersion:r,onDuplicateVersion:f,onTogglePopover:p,onPromoteVersion:h,onOpenInEditor:m,onDeleteVersion:y,onRenameVersion:_,onRenameValueChange:b,onConfirmRename:k,onCancelRename:g,setPopoverTriggerRef:x,setPopoverDropdownRef:S}){return e.length===0?n.jsx("div",{className:d.emptyState,children:"No versions found"}):n.jsx("div",{className:d.versionsList,children:e.slice().reverse().map(I=>{const{key:C,label:j}=I,N=C===t;return c===C?n.jsx(To,{version:C,value:i,onChange:b,formatVersionLabel:a,onConfirm:k,onCancel:g},C):n.jsx(Eo,{version:C,label:j,isSelected:N,formatVersionLabel:a,popoverPosition:l.get(C),isPopoverOpen:u===C,isConnected:s,onSelect:r,onDuplicate:f,onTogglePopover:p,onPromote:h,onOpenInEditor:m,onDelete:y,onRename:_,setPopoverTriggerRef:x,setPopoverDropdownRef:S},C)})})}function Lo({className:e}){return n.jsx(Fn,{className:e,size:16,stroke:2})}function Vo({onBack:e,theme:t,setTheme:c,position:i,setPosition:a,codeEditor:u,setCodeEditor:l}){return n.jsxs("div",{className:d.settingsView,children:[n.jsxs("button",{onClick:e,className:d.settingsBackButton,style:{width:"auto",alignSelf:"flex-start"},children:[n.jsx(Lo,{className:d.settingsBackIcon}),n.jsx("span",{children:"Back"})]}),n.jsxs("div",{className:d.settingsContent,children:[n.jsxs("div",{className:d.settingsGroup,children:[n.jsx("label",{className:d.settingsLabel,children:"Theme"}),n.jsxs("select",{value:t,onChange:s=>c(s.target.value),className:d.settingsSelect,children:[n.jsx("option",{value:"light",children:"Light"}),n.jsx("option",{value:"dark",children:"Dark"}),n.jsx("option",{value:"system",children:"System"})]})]}),n.jsxs("div",{className:d.settingsGroup,children:[n.jsx("label",{className:d.settingsLabel,children:"Position"}),n.jsxs("select",{value:i,onChange:s=>a(s.target.value),className:d.settingsSelect,children:[n.jsx("option",{value:"top-left",children:"Top left"}),n.jsx("option",{value:"top-right",children:"Top right"}),n.jsx("option",{value:"bottom-left",children:"Bottom left"}),n.jsx("option",{value:"bottom-right",children:"Bottom right"})]})]}),n.jsxs("div",{className:d.settingsGroup,children:[n.jsx("label",{className:d.settingsLabel,children:"Code editor"}),n.jsxs("select",{value:u,onChange:s=>l(s.target.value),className:d.settingsSelect,children:[n.jsx("option",{value:"vscode",children:"VSCode"}),n.jsx("option",{value:"cursor",children:"Cursor"})]})]})]})]})}function we({className:e}){return n.jsx(zn,{className:e,size:16,stroke:1.5})}function Do({onCopyCommand:e,copied:t}){return n.jsxs("div",{className:d.emptyStateContainer,children:[n.jsx("h3",{className:d.emptyStateHeading,children:"Get started with uifork"}),n.jsx("p",{className:d.emptyStateText,children:"Choose a component and run the command in your root directory"}),n.jsxs("button",{onClick:e,className:d.emptyStateCommandContainer,title:"Copy command","aria-label":"Copy command to clipboard",children:[n.jsx("code",{className:d.emptyStateCommand,children:"npx uifork <path to file>"}),t?n.jsx(X,{className:d.emptyStateCopyIcon}):n.jsx(we,{className:d.emptyStateCopyIcon})]})]})}function Po({className:e}){return n.jsx(co,{className:e,size:16,stroke:2})}function $o({onClick:e,disabled:t}){return n.jsxs("button",{onClick:t?void 0:e,className:`${d.newVersionButton} ${d.menuItem} ${t?d.disabled:""}`,title:t?"Connect to server to create new versions":"Create new version","aria-disabled":t,children:[n.jsx("div",{className:d.newVersionIconContainer,children:n.jsx(Po,{className:d.newVersionIcon})}),n.jsx("span",{children:"New version"})]})}function Ie(){return typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname.startsWith("127.0.0.1")||window.location.hostname.startsWith("192.168.")||window.location.protocol==="file:")}function Oo(){const[e,t]=o.useState(!1),c=o.useCallback(async()=>{const i="npx uifork watch";try{await navigator.clipboard.writeText(i),t(!0),setTimeout(()=>t(!1),2e3)}catch{}},[]);return Ie()?n.jsx("div",{className:d.componentSelectorDropdownHint,children:n.jsxs("span",{children:["Run"," ",n.jsx("button",{onClick:c,className:d.offlineMessageCommandButton,title:"Copy command","aria-label":"Copy command to clipboard",children:n.jsxs("code",{className:d.componentSelectorDropdownHintCode,children:["npx uifork watch"," ",e?n.jsx(X,{className:d.offlineMessageCopyIcon}):n.jsx(we,{className:d.offlineMessageCopyIcon})]})})," ","to fork, create, and promote versions from here."]})}):null}function Bo({port:e,selectedComponent:t,onFileChanged:c,onComponentsUpdate:i,onVersionAck:a,onPromoted:u,onError:l}){const[s,r]=o.useState(null),[f,p]=o.useState("disconnected"),h=o.useRef(t),m=o.useRef(c),y=o.useRef(i),_=o.useRef(a),b=o.useRef(u),k=o.useRef(l),g=o.useRef(null),x=o.useRef(!1),S=o.useRef(null),I=o.useRef(!0),C=o.useRef(!1),j=o.useRef(0),N=o.useRef("disconnected");o.useEffect(()=>{S.current=s},[s]),o.useEffect(()=>{N.current=f},[f]),o.useEffect(()=>{h.current=t},[t]),o.useEffect(()=>{m.current=c,y.current=i,_.current=a,b.current=u,k.current=l},[c,i,a,u,l]);const D=o.useCallback(()=>{if(S.current?.readyState===WebSocket.OPEN||x.current)return;const z=`ws://localhost:${e}/ws`;x.current=!0,(j.current===0||C.current)&&N.current!=="failed"&&p("connecting"),j.current++;const V=new WebSocket(z);let G=!1;V.onopen=()=>{G=!0,C.current=!0,j.current=0,x.current=!1,p("connected"),r(V),S.current=V,m.current?.(),g.current&&(clearTimeout(g.current),g.current=null)},V.onclose=()=>{x.current=!1,G?p("disconnected"):N.current!=="failed"&&p("failed"),r(null),S.current=null,I.current&&(g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{g.current=null,I.current&&D()},3e3))},V.onerror=K=>{x.current=!1,G?p("disconnected"):N.current!=="failed"&&p("failed")},V.onmessage=K=>{try{const M=JSON.parse(K.data);if(M.type==="components"&&M.payload?.components)y.current?.(M.payload.components);else if(M.type==="file_changed")m.current?.();else if(M.type==="ack"&&M.payload?.version){const Q=M.payload.message||"",re=M.payload.newVersion;if(Q.includes("promoted")){const ce=M.payload.component||h.current;b.current?.(ce);return}_.current?.({version:M.payload.version,message:Q,newVersion:re})}else M.type==="error"&&k.current?.(M.payload?.message||"Unknown error")}catch{}}},[e]);o.useEffect(()=>(I.current=!0,j.current=0,S.current?.readyState===WebSocket.OPEN&&S.current.close(),g.current&&(clearTimeout(g.current),g.current=null),D(),()=>{I.current=!1,g.current&&(clearTimeout(g.current),g.current=null),S.current?.readyState===WebSocket.OPEN&&S.current.close()}),[e,D]);const Y=o.useCallback((z,V)=>{s&&s.readyState===WebSocket.OPEN&&s.send(JSON.stringify({type:z,payload:{...V,component:h.current}}))},[s]);return{connectionStatus:f,sendMessage:Y}}function $(e,t,c=!1){const[i,a]=o.useState(()=>{if(typeof window>"u")return t;try{const l=window.localStorage.getItem(e);return l?JSON.parse(l):t}catch{return t}}),u=o.useCallback(l=>{try{a(s=>{const r=l instanceof Function?l(s):l;return typeof window<"u"&&(r===""&&typeof t=="string"?(window.localStorage.removeItem(e),c&&window.dispatchEvent(new StorageEvent("storage",{key:e,newValue:null}))):(window.localStorage.setItem(e,JSON.stringify(r)),c&&window.dispatchEvent(new StorageEvent("storage",{key:e,newValue:JSON.stringify(r)})))),r})}catch{}},[e,c,t]);return o.useEffect(()=>{if(!c)return;const l=s=>{if(s.key===e&&s.newValue)try{a(JSON.parse(s.newValue))}catch{}};return window.addEventListener("storage",l),()=>window.removeEventListener("storage",l)},[e,c]),[i,u]}const O=new Map,pe=new Set;function je(e,t=[]){const c=O.get(e);c?O.set(e,{versions:t,refCount:c.refCount+1}):(O.set(e,{versions:t,refCount:1}),Ne())}function Ee(e){const t=O.get(e);t&&(t.refCount>1?O.set(e,{versions:t.versions,refCount:t.refCount-1}):(O.delete(e),Ne()))}function Ho(){return Array.from(O.keys())}function Ao(){return Array.from(O.entries()).map(([e,{versions:t}])=>({name:e,versions:t}))}function Fo(e){return pe.add(e),()=>{pe.delete(e)}}function Ne(){pe.forEach(e=>e())}function Wo({port:e}){const[t,c]=o.useState([]),[i,a]=o.useState([]),[u,l]=o.useState([]),[s,r]=$("uifork-selected-component","",!0),f=o.useMemo(()=>t.length>0?t.map(m=>{const y=i.find(b=>b.name===m.name),_=m.versions.map(b=>{const k=y?.versions.find(g=>g.key===b);return{key:b,label:k?.label}});return{name:m.name,path:m.path,versions:_}}):i.map(m=>({name:m.name,path:"",versions:m.versions})),[t,i]),p=o.useMemo(()=>f.filter(m=>u.includes(m.name)),[f,u]),h=o.useCallback(m=>{c(m),!s&&m.length>0&&r(m[0].name)},[s,r]);return o.useEffect(()=>{const m=()=>{l(Ho()),a(Ao())};return m(),Fo(m)},[]),o.useEffect(()=>{if(s&&u.length>0&&!u.includes(s)){const m=f.find(y=>u.includes(y.name));m&&r(m.name)}else if(!s&&u.length>0&&f.length>0){const m=f.find(y=>u.includes(y.name));m&&r(m.name)}},[s,u,f,r]),{components:f,mountedComponents:p,mountedComponentIds:u,selectedComponent:s,setSelectedComponent:r,onComponentsUpdate:h}}function zo({selectedComponent:e,versions:t}){const c=t.map(g=>g.key),i=`${W}${e||"uifork-default"}`,[a,u]=$(i,"",!0),[l,s]=o.useState(null),[r,f]=o.useState(""),p=o.useRef(null);o.useEffect(()=>{p.current=l},[l]),o.useEffect(()=>{if(e&&c.length>0){const g=`${W}${e}-pending-version`,x=localStorage.getItem(g);if(x&&c.includes(x))u(x),localStorage.removeItem(g);else if(!c.includes(a)){const S=`${W}${e}`,I=localStorage.getItem(S),C=I?JSON.parse(I):null;C&&c.includes(C)?u(C):u(c[0])}}},[e,c,a,u]);const h=o.useCallback(g=>{const x=`${W}${e}-pending-version`;localStorage.setItem(x,g)},[e]),m=o.useCallback(g=>t.find(x=>x.key===g)?.label,[t]),y=o.useCallback(g=>{s(g);const x=m(g)||"";f(x)},[m]),_=o.useCallback(g=>{const x=r.trim(),S=m(g)||"";return x===S?(s(null),f(""),null):(s(null),f(""),x)},[r,m]),b=o.useCallback(()=>{s(null),f("")},[]),k=o.useCallback(()=>{p.current&&(s(null),f(""))},[]);return{activeVersion:a,setActiveVersion:u,editingVersion:l,renameValue:r,setRenameValue:f,startRename:y,confirmRename:_,cancelRename:b,clearEditingOnError:k,storePendingVersion:h,versionKeys:c}}function Go({openPopoverVersion:e}){const t=o.useRef(new Map),c=o.useRef(new Map),i=o.useRef(new Map);o.useEffect(()=>{if(!e)return;let l=null,s=!1;const r=()=>{const p=t.current.get(e),h=c.current.get(e);if(!p||!h){s||requestAnimationFrame(r);return}const m=async()=>{if(!s)try{const{x:y,y:_}=await T.computePosition(p,h,{placement:"bottom-end",strategy:"fixed",middleware:[T.offset(4),T.flip({fallbackPlacements:["bottom-start","top-end","top-start"]}),T.shift({padding:8})]});s||(i.current.set(e,{x:y,y:_}),h.style.left=`${y}px`,h.style.top=`${_}px`,h.style.visibility="visible",h.classList.add(d.popoverVisible))}catch{}};h.style.visibility="hidden",m(),l=T.autoUpdate(p,h,m)},f=requestAnimationFrame(r);return()=>{s=!0,cancelAnimationFrame(f),l&&l();const p=c.current.get(e);p&&p.classList.remove(d.popoverVisible)}},[e]);const a=(l,s)=>{s?t.current.set(l,s):t.current.delete(l)},u=(l,s)=>{s?c.current.set(l,s):c.current.delete(l)};return{popoverPositions:i.current,setPopoverTriggerRef:a,setPopoverDropdownRef:u}}function qo({versionKeys:e,activeVersion:t,setActiveVersion:c}){o.useEffect(()=>{const i=a=>{if(!a.metaKey||e.length===0)return;const u=e.indexOf(t);if(a.key==="ArrowDown"){a.preventDefault();const l=u-1;c(e[l>=0?l:e.length-1])}if(a.key==="ArrowUp"){a.preventDefault();const l=u+1;c(e[l<e.length?l:0])}};return window.addEventListener("keydown",i,{capture:!0}),()=>window.removeEventListener("keydown",i,{capture:!0})},[t,e,c])}function Uo({isOpen:e,containerRef:t,triggerRef:c,openPopoverVersion:i,isComponentSelectorOpen:a,editingVersion:u,onClosePopover:l,onCloseComponentSelector:s,onCancelRename:r,onClose:f}){o.useEffect(()=>{if(!e)return;const p=h=>{if(h.key==="Escape"){if(i){l();return}if(a){s();return}if(u){r();return}f(),c.current?.focus()}};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t,c,i,a,u,l,s,r,f])}function Jo({isOpen:e,containerRef:t,setPosition:c}){const[i,a]=o.useState(!1),[u,l]=o.useState(!1),[s,r]=o.useState(!1),[f,p]=o.useState(null),h=A.useDragControls(),m=5,y=o.useCallback((g,x)=>{const S=window.innerWidth,I=window.innerHeight,C=S/2,j=I/2;return g<C&&x<j?"top-left":g>=C&&x<j?"top-right":g<C&&x>=j?"bottom-left":"bottom-right"},[]),_=o.useCallback((g,x)=>{if(a(!1),r(!1),p(null),document.body.style.removeProperty("cursor"),document.body.style.userSelect="",t.current&&(t.current.style.removeProperty("cursor"),t.current.removeAttribute("data-drag-tracking"),t.current.removeAttribute("data-dragging")),!t.current)return;const S=t.current.getBoundingClientRect(),I=S.left+S.width/2,C=S.top+S.height/2,j=y(I,C);c(j),l(!0)},[y,c,t]),b=o.useCallback(g=>{if(e)return;const x=g.nativeEvent;p({x:g.clientX,y:g.clientY,event:x}),r(!1),t.current&&t.current.setAttribute("data-drag-tracking","true")},[e,t]);o.useEffect(()=>{if(!f||e)return;const g=S=>{const I=Math.abs(S.clientX-f.x),C=Math.abs(S.clientY-f.y);Math.sqrt(I*I+C*C)>m&&!s&&(r(!0),l(!1),h.start(S,{snapToCursor:!0}))},x=()=>{s||(p(null),r(!1),document.body.style.removeProperty("cursor"),t.current&&(t.current.style.removeProperty("cursor"),t.current.removeAttribute("data-drag-tracking")))};return window.addEventListener("pointermove",g),window.addEventListener("pointerup",x),()=>{window.removeEventListener("pointermove",g),window.removeEventListener("pointerup",x)}},[f,e,s,h,t]);const k=o.useCallback(()=>{a(!0),l(!1),document.body.style.setProperty("cursor","grabbing","important"),document.body.style.userSelect="none",t.current&&(t.current.style.setProperty("cursor","grabbing","important"),t.current.setAttribute("data-dragging","true"))},[t]);return o.useEffect(()=>{if(u&&!i){const g=setTimeout(()=>{l(!1)},P*1e3+50);return()=>clearTimeout(g)}},[u,i]),o.useEffect(()=>{e&&(i||s)&&(a(!1),r(!1),p(null),document.body.style.cursor="",document.body.style.userSelect="")},[e,i,s]),o.useEffect(()=>()=>{document.body.style.removeProperty("cursor"),document.body.style.userSelect="",t.current&&(t.current.style.removeProperty("cursor"),t.current.removeAttribute("data-drag-tracking"),t.current.removeAttribute("data-dragging"))},[t]),{isDragging:i,resetDrag:u,dragEnabled:s,dragControls:h,handlePointerDown:b,handleDragStart:k,handleDragEnd:_}}function Xo(e,t=20){return{"top-left":{top:`${t}px`,left:`${t}px`,bottom:"auto",right:"auto"},"top-right":{top:`${t}px`,right:`${t}px`,bottom:"auto",left:"auto"},"bottom-left":{bottom:`${t}px`,left:`${t}px`,top:"auto",right:"auto"},"bottom-right":{bottom:`${t}px`,right:`${t}px`,top:"auto",left:"auto"}}[e]}function Yo(e){return{"top-left":"top left","top-right":"top right","bottom-left":"bottom left","bottom-right":"bottom right"}[e]}function Ko({position:e,isComponentSelectorOpen:t,containerRef:c,componentSelectorRef:i,enableElementAwarePositioning:a=!1}){const[u,l]=o.useState({x:0,y:0}),s=ss(a),r=o.useMemo(()=>{const p=Xo(e);if(!a)return p;const m=(s||[]).filter(y=>y.position===e&&y.offset<=Qo)[0];if(m){const y=m.offset+m.width+m.offset,_=window.innerHeight;switch(e){case"top-left":return{...p,top:`${m.rect.top}px`,left:`${y}px`};case"top-right":return{...p,top:`${m.rect.top}px`,right:`${y}px`};case"bottom-left":return{...p,bottom:`${_-m.rect.bottom}px`,left:`${y}px`};case"bottom-right":return{...p,bottom:`${_-m.rect.bottom}px`,right:`${y}px`}}}return p},[e,s,a]),f=o.useMemo(()=>Yo(e),[e]);return o.useEffect(()=>{if(!t||!c.current||!i.current)return;const p=async()=>{try{const{x:m,y}=await T.computePosition(c.current,i.current,{placement:"left-start",strategy:"fixed",middleware:[T.offset(4),T.flip(),T.shift({padding:8})]});l({x:m,y}),i.current&&(i.current.style.visibility="visible")}catch{}};return i.current&&(i.current.style.visibility="hidden"),p(),T.autoUpdate(c.current,i.current,p)},[t,c,i]),{containerPosition:r,transformOrigin:f,componentSelectorPosition:u}}const Qo=50;function Zo(){const e=document.querySelectorAll('[data-nextjs-dev-overlay="true"]');for(const t of e)if(t instanceof HTMLElement){const c=t.shadowRoot,i=t.querySelector("nextjs-portal");if(i instanceof HTMLElement){const a=i.shadowRoot;if(a){const u=a.getElementById("devtools-indicator");if(u instanceof HTMLElement)return u;const l=a.querySelector("#devtools-indicator");if(l instanceof HTMLElement)return l}}if(c){const a=c.getElementById("devtools-indicator");if(a instanceof HTMLElement)return a}}return null}function es(){const e=document.querySelectorAll("vercel-live-feedback");for(const t of e)if(t instanceof HTMLElement){const c=t.shadowRoot;if(c){const i=c.getElementById("shadow-container");if(i){const a=Array.from(i.children);for(const s of a)if(s instanceof HTMLElement&&window.getComputedStyle(s).position==="fixed")return s;const u=i.querySelectorAll("*");for(const s of u)if(s instanceof HTMLElement&&window.getComputedStyle(s).position==="fixed")return s;if(window.getComputedStyle(i).position==="fixed")return i}else{const a=Array.from(c.children);for(const u of a)if(u instanceof HTMLElement&&window.getComputedStyle(u).position==="fixed")return u}}}return null}function ts(e){if(!e||e==="none")return{x:0,y:0};const t=e.trim().split(/\s+/),c=parseFloat(t[0])||0,i=parseFloat(t[1])||0;return{x:c,y:i}}function ns(e){const t=e.querySelector(".dev-tools-grabbing");if(t instanceof HTMLElement){const c=t.style.translate;return ts(c)}return{x:0,y:0}}function me(e,t,c,i,a,u,l=!1){if(t&&t.contains(e)||window.getComputedStyle(e).position!=="fixed")return null;const r=e.getBoundingClientRect(),f=l?ns(e):{x:0,y:0},p={top:r.top+f.y,bottom:r.bottom+f.y,left:r.left+f.x,right:r.right+f.x},h=p.left+r.width/2,m=p.top+r.height/2;let y;m<u?y=h<a?"top-left":"top-right":y=h<a?"bottom-left":"bottom-right";let _;switch(y){case"top-left":_=Math.max(p.left,p.top);break;case"top-right":_=Math.max(c-p.right,p.top);break;case"bottom-left":_=Math.max(p.left,i-p.bottom);break;case"bottom-right":_=Math.max(c-p.right,i-p.bottom);break}return{element:e,position:y,offset:_,width:r.width,height:r.height,rect:p,isNextJSDevTools:l}}function de(e,t,c,i,a,u,l,s=!1){const r=me(e,t,c,i,a,u,s);r&&l.push(r)}function os(){const e=document.body.querySelectorAll("*"),t=document.getElementById("uifork-root"),c=window.innerWidth,i=window.innerHeight,a=c/2,u=i/2,l=[];e.forEach(f=>{f instanceof HTMLElement&&de(f,t,c,i,a,u,l)});const s=Zo();s&&de(s,t,c,i,a,u,l,!0);const r=es();return r&&de(r,t,c,i,a,u,l,!1),l}function ss(e=!0){const[t,c]=o.useState([]),i=o.useRef(new Map),a=o.useRef(new Map);return o.useEffect(()=>{if(!e){c([]),i.current.forEach(h=>h.disconnect()),i.current.clear(),a.current.clear();return}let u=!0;const l=100,s=(h,m)=>{if(!u)return;const y=a.current.get(h),_=Date.now();if(y&&_-y<l)return;a.current.set(h,_);const b=document.getElementById("uifork-root"),k=window.innerWidth,g=window.innerHeight,x=k/2,S=g/2,I=me(h,b,k,g,x,S,m);if(!I){c(j=>j.filter(N=>N.element!==h));const C=i.current.get(h);C&&(C.disconnect(),i.current.delete(h)),a.current.delete(h);return}c(C=>{const j=C.findIndex(D=>D.element===h);if(j===-1)return C;const N=[...C];return N[j]=I,N})},r=(h,m)=>{if(i.current.has(h))return;const y=new MutationObserver(()=>{u&&s(h,m)});y.observe(h,{attributes:!0,attributeFilter:["style"],subtree:!1}),i.current.set(h,y)},f=()=>{if(!u)return;const h=document.getElementById("uifork-root"),m=window.innerWidth,y=window.innerHeight,_=m/2,b=y/2;c(k=>k.map(({element:g,isNextJSDevTools:x})=>me(g,h,m,y,_,b,x)).filter(g=>g!==null))},p=setTimeout(()=>{if(!u)return;const h=os();c(h),h.forEach(({element:m,isNextJSDevTools:y})=>{r(m,y)})},250);return window.addEventListener("resize",f),()=>{u=!1,clearTimeout(p),i.current.forEach(h=>h.disconnect()),i.current.clear(),a.current.clear(),window.removeEventListener("resize",f)}},[e]),t}function Ce({className:e}){return n.jsx(Yn,{className:e,size:16,stroke:1.5})}const rs=({hasSelection:e,selectedComponent:t,activeVersion:c,activeVersionLabel:i,formatVersionLabel:a})=>{const u=i||(c?a(c):"-");return e?n.jsxs(n.Fragment,{children:[n.jsx(Ce,{className:d.triggerIcon}),n.jsx(A.motion.span,{layoutId:"component-name",layout:"position",className:d.triggerLabel,transition:{duration:P,ease:H},children:t}),n.jsx("span",{className:d.triggerVersion,children:u})]}):n.jsx(Ce,{className:d.triggerIcon})};function cs({port:e=3030,className:t="",style:c}){const[i,a]=o.useState(!1),[u,l]=o.useState(!1),[s,r]=o.useState(!1),[f,p]=o.useState(!1),[h,m]=o.useState(null),[y,_]=o.useState(!1),b=o.useRef(null),k=o.useRef(null),g=o.useRef(null),x=o.useRef(null),S=o.useRef(null),I=o.useRef(""),[C,j]=$("uifork-theme","system"),[N,D]=$("uifork-position","bottom-right"),[Y,z]=$("uifork-code-editor","vscode"),{containerPosition:V,transformOrigin:G,componentSelectorPosition:K}=Ko({position:N,isComponentSelectorOpen:s,containerRef:g,componentSelectorRef:S}),{isDragging:M,resetDrag:Q,dragEnabled:re,dragControls:ce,handlePointerDown:Me,handleDragStart:Te,handleDragEnd:Re}=Jo({isOpen:u,containerRef:g,setPosition:D}),{mountedComponents:q,selectedComponent:R,setSelectedComponent:ye,onComponentsUpdate:Le}=Wo({port:e});o.useEffect(()=>{I.current=R},[R]);const U=q.find(v=>v.name===R)?.versions||[],ve=v=>U.find(w=>w.key===v)?.label,{activeVersion:Z,setActiveVersion:_e,editingVersion:ee,renameValue:Ve,setRenameValue:De,startRename:Pe,confirmRename:xe,cancelRename:te,clearEditingOnError:$e,storePendingVersion:Oe,versionKeys:Be}=zo({selectedComponent:R,versions:U}),{connectionStatus:He,sendMessage:F}=Bo({port:e,selectedComponent:R,onComponentsUpdate:Le,onVersionAck:({version:v,message:w,newVersion:L})=>{let J=null;w?.includes("duplicated")||w?.includes("created new version")?J=v:w?.includes("renamed")&&L&&(J=L),J&&Oe(J)},onPromoted:v=>{const w=localStorage.getItem("uifork-selected-component"),L=w?JSON.parse(w):null;if(I.current===v||L===v){localStorage.removeItem("uifork-selected-component"),ye("");const ne=()=>{const ae=localStorage.getItem("uifork-selected-component");if(ae)try{JSON.parse(ae)===v&&localStorage.removeItem("uifork-selected-component")}catch{ae===v&&localStorage.removeItem("uifork-selected-component")}};ne(),setTimeout(ne,0),setTimeout(ne,50),setTimeout(ne,100)}},onError:$e}),{popoverPositions:Ae,setPopoverTriggerRef:Fe,setPopoverDropdownRef:We}=Go({openPopoverVersion:h});qo({versionKeys:Be,activeVersion:Z,setActiveVersion:_e}),Uo({isOpen:u,containerRef:g,triggerRef:k,openPopoverVersion:h,isComponentSelectorOpen:s,editingVersion:ee,onClosePopover:()=>m(null),onCloseComponentSelector:()=>r(!1),onCancelRename:te,onClose:()=>{l(!1),p(!1)}}),ge({isActive:u,refs:[k,g],onClickOutside:o.useCallback(()=>{ee&&te(),l(!1),p(!1),r(!1)},[ee,te]),additionalCheck:o.useCallback(v=>{if(S.current?.contains(v))return!0;const w=document.querySelectorAll("[data-popover-dropdown]");for(const L of w)if(L.contains(v))return!0;return!1},[])}),o.useEffect(()=>{a(!0)},[]);const ze=(v,w)=>{w.stopPropagation(),F("duplicate_version",{version:v})},Ge=(v,w)=>{w.stopPropagation(),F("delete_version",{version:v})},qe=v=>{v.stopPropagation(),F("new_version",{})},Ue=(v,w)=>{w.stopPropagation(),Pe(v)},Je=o.useCallback(v=>{const w=xe(v);w!==null&&F("rename_label",{version:v,newLabel:w})},[xe,F]),Xe=(v,w)=>{w.stopPropagation();const L=ve(v)||ie(v);window.confirm(`Are you sure you want to promote version ${L}?
3
3
 
4
4
  This will:
5
5
  - Replace the main component with this version
6
6
  - Remove all versioning scaffolding
7
- - This action cannot be undone`)&&(F("promote_version",{version:_}),g(null))},Xe=(_,S)=>{S?.stopPropagation(),g(f===_?null:_)},Ye=async(_,S)=>{S.stopPropagation();try{const D=await fetch(`http://localhost:${e}/open-in-editor`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({version:_,component:V,editor:J})});D.ok||await D.json()}catch{}g(null)},ie=_=>_.replace(/^v/,"V").replace(/_/g,"."),Ke=o.useCallback(async()=>{const _="npx uifork init ";try{await navigator.clipboard.writeText(_),x(!0),setTimeout(()=>x(!1),2e3)}catch{}},[]);o.useEffect(()=>{if(!i)return;let _=document.getElementById("uifork-root");return _||(_=document.createElement("div"),_.id="uifork-root",_.className=a.uiforkRoot||"uiforkRoot",document.body.appendChild(_)),I.current=_,_.setAttribute("data-theme",b),()=>{}},[i,b,a]);const ee=Ce==="connected",P=o.useMemo(()=>d?h?"opened-settings":G.length===0?"opened-no-components":"opened-version-list":G.length>0?"closed-trigger-label":"closed-trigger-icon",[d,h,G.length]);if(!i)return null;const ke=I.current||document.getElementById("uifork-root");return ke?fe.createPortal(n.jsxs(n.Fragment,{children:[n.jsx(A.motion.div,{ref:p,className:`${a.container} ${d?"":a.containerClosed} ${t}`,layout:!0,drag:re&&!d,dragControls:se,dragMomentum:!1,dragElastic:0,dragListener:!1,onPointerDown:Me,onDragStart:Te,onDragEnd:De,animate:Y?{x:0,y:0}:{},style:{borderRadius:d?12:20,boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",...L,transformOrigin:z,touchAction:d?"auto":"none",...l},transition:{layout:{duration:$,ease:H},x:{duration:$,ease:H},y:{duration:$,ease:H}},children:n.jsx(A.AnimatePresence,{mode:"popLayout",initial:!1,children:P==="closed-trigger-icon"||P==="closed-trigger-label"?n.jsx(A.motion.button,{suppressHydrationWarning:!0,ref:v,onClick:_=>{if(M){_.preventDefault();return}c(!0),m(!1)},"aria-label":"Select UI version","aria-expanded":!1,"aria-haspopup":"listbox",className:`${a.trigger} ${P==="closed-trigger-icon"?a.triggerIconOnly:""}`,layout:!0,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:$,ease:H},draggable:!1,children:n.jsx(ar,{activeView:P,connectionStatus:Ce,selectedComponent:V,activeVersion:K,activeVersionLabel:_e(K),formatVersionLabel:ie,isConnected:ee})},"trigger"):n.jsxs(A.motion.div,{ref:k,role:"listbox","aria-label":"UI version options",className:a.dropdown,layout:!0,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:$,ease:H},children:[P==="opened-no-components"&&n.jsx(Oo,{onCopyCommand:Ke,copied:y}),P==="opened-settings"&&n.jsx($o,{onBack:()=>m(!1),theme:b,setTheme:j,position:N,setPosition:R,codeEditor:J,setCodeEditor:W}),P==="opened-version-list"&&n.jsxs(n.Fragment,{children:[n.jsx(xo,{selectedComponent:V,onToggle:()=>r(!s),onSettingsClick:_=>{_.stopPropagation(),m(!0)}}),n.jsx("div",{className:a.divider}),n.jsx(Vo,{versions:ce,activeVersion:K,editingVersion:Q,renameValue:Re,formatVersionLabel:ie,openPopoverVersion:f,popoverPositions:He,isConnected:ee,onSelectVersion:_=>{ve(_)},onDuplicateVersion:We,onTogglePopover:Xe,onPromoteVersion:Je,onOpenInEditor:Ye,onDeleteVersion:ze,onRenameVersion:qe,onRenameValueChange:Ve,onConfirmRename:Ue,onCancelRename:Z,setPopoverTriggerRef:Ae,setPopoverDropdownRef:Fe}),we()&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:a.divider}),ee?n.jsx(Ho,{onClick:Ge}):n.jsx(Ao,{})]})]})]},"dropdown")})}),P!=="closed-trigger-icon"&&P!=="closed-trigger-label"&&n.jsx(Co,{mountedComponents:G,selectedComponent:V,isOpen:s,position:X,onSelect:_=>{ye(_),r(!1)},onClose:()=>r(!1),componentSelectorRef:C,isConnected:ee})]}),ke):null}function ur({id:e,versions:t,props:l,defaultVersion:i}){const[u,d]=o.useState(!1),c=Object.keys(t),s=i||c[0],r=o.useMemo(()=>Object.entries(t).map(([x,I])=>({key:x,label:I.label})),[t]),[h,m]=O(e,s,!0);o.useEffect(()=>(je(e,r),()=>{Ee(e)}),[e,r]);const[f,g]=o.useState(c.includes(h)?h:s);o.useEffect(()=>{t[h]&&g(h)},[h,t]),o.useEffect(()=>{if(c.length>0&&!c.includes(h)){const x=setTimeout(()=>{c.includes(h)||m(c[0])},2500);return()=>clearTimeout(x)}},[h,c,m]),o.useEffect(()=>{d(!0)},[]);const y=t[h]?.render??t[f]?.render??t[c[0]]?.render;return!y||!u?null:n.jsx(y,{...l})}function dr({id:e,versions:t,props:l,defaultVersion:i}){const u=Object.keys(t),d=i||u[0],c=o.useMemo(()=>Object.entries(t).map(([x,I])=>({key:x,label:I.label})),[t]),[s,r]=O(e,d,!0);o.useEffect(()=>(je(e,c),()=>{Ee(e)}),[e,c]);const[h,m]=o.useState(u.includes(s)?s:d);o.useEffect(()=>{t[s]&&m(s)},[s,t]),o.useEffect(()=>{if(u.length>0&&!u.includes(s)){const x=setTimeout(()=>{u.includes(s)||r(u[0])},2500);return()=>clearTimeout(x)}},[s,u,r]);const f=t[s]?.render??t[h]?.render??t[u[0]].render,[g,y]=o.useState(null);return o.useEffect(()=>{if(typeof f=="function"){const x=o.lazy(f);y(()=>x)}else y(()=>f)},[f]),g?typeof f=="function"?n.jsx(o.Suspense,{fallback:null,children:n.jsx(g,{...l})}):n.jsx(g,{...l}):null}exports.ForkedComponent=ur;exports.LazyForkedComponent=dr;exports.UIFork=lr;exports.useLocalStorage=O;
7
+ - This action cannot be undone`)&&(F("promote_version",{version:v}),m(null))},Ye=(v,w)=>{w?.stopPropagation(),m(h===v?null:v)},Ke=async(v,w)=>{w.stopPropagation();try{const L=await fetch(`http://localhost:${e}/open-in-editor`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({version:v,component:R,editor:Y})});L.ok||await L.json()}catch{}m(null)},ie=v=>v.replace(/^v/,"V").replace(/_/g,"."),Qe=o.useCallback(async()=>{const v="npx uifork ";try{await navigator.clipboard.writeText(v),_(!0),setTimeout(()=>_(!1),2e3)}catch{}},[]);o.useEffect(()=>{if(!i)return;let v=document.getElementById("uifork-root");return v||(v=document.createElement("div"),v.id="uifork-root",v.className=d.uiforkRoot||"uiforkRoot",document.body.appendChild(v)),b.current=v,v.setAttribute("data-theme",C),()=>{}},[i,C,d]);const le=He==="connected",B=o.useMemo(()=>u?f?"opened-settings":q.length===0?"opened-no-components":"opened-version-list":q.length>0?"closed-trigger-label":"closed-trigger-icon",[u,f,q.length]);if(!i)return null;const ke=b.current||document.getElementById("uifork-root");return ke?fe.createPortal(n.jsxs(n.Fragment,{children:[n.jsx(A.motion.div,{ref:g,className:`${d.container} ${u?"":d.containerClosed} ${t}`,layout:!0,drag:re&&!u,dragControls:ce,dragMomentum:!1,dragElastic:0,dragListener:!1,onPointerDown:Me,onDragStart:Te,onDragEnd:Re,animate:Q?{x:0,y:0}:{},style:{borderRadius:u?12:20,boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",...V,transformOrigin:G,touchAction:u?"auto":"none",...c},transition:{layout:{duration:P,ease:H},x:{duration:P,ease:H},y:{duration:P,ease:H}},children:n.jsx(A.AnimatePresence,{mode:"popLayout",initial:!1,children:B==="closed-trigger-icon"||B==="closed-trigger-label"?n.jsx(A.motion.button,{suppressHydrationWarning:!0,ref:k,onClick:v=>{if(M){v.preventDefault();return}l(!0),p(!1)},"aria-label":"Select UI version","aria-expanded":!1,"aria-haspopup":"listbox",className:`${d.trigger} ${!R||U.length===0?d.triggerIconOnly:""}`,layout:!0,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:P,ease:H},draggable:!1,children:n.jsx(rs,{hasSelection:!!R&&U.length>0,selectedComponent:R,activeVersion:Z,activeVersionLabel:ve(Z),formatVersionLabel:ie})},"trigger"):n.jsxs(A.motion.div,{ref:x,role:"listbox","aria-label":"UI version options",className:d.dropdown,layout:!0,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:P,ease:H},children:[B==="opened-no-components"&&n.jsx(Do,{onCopyCommand:Qe,copied:y}),B==="opened-settings"&&n.jsx(Vo,{onBack:()=>p(!1),theme:C,setTheme:j,position:N,setPosition:D,codeEditor:Y,setCodeEditor:z}),B==="opened-version-list"&&n.jsxs(n.Fragment,{children:[n.jsx(yo,{selectedComponent:R,onToggle:()=>r(!s),onSettingsClick:v=>{v.stopPropagation(),p(!0)}}),n.jsx("div",{className:d.divider}),n.jsx(Ro,{versions:U,activeVersion:Z,editingVersion:ee,renameValue:Ve,formatVersionLabel:ie,openPopoverVersion:h,popoverPositions:Ae,isConnected:le,onSelectVersion:v=>{_e(v)},onDuplicateVersion:ze,onTogglePopover:Ye,onPromoteVersion:Xe,onOpenInEditor:Ke,onDeleteVersion:Ge,onRenameVersion:Ue,onRenameValueChange:De,onConfirmRename:Je,onCancelRename:te,setPopoverTriggerRef:Fe,setPopoverDropdownRef:We}),Ie()&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:d.divider}),le?n.jsx($o,{onClick:qe}):n.jsx(Oo,{})]})]})]},"dropdown")})}),B!=="closed-trigger-icon"&&B!=="closed-trigger-label"&&n.jsx(vo,{mountedComponents:q,selectedComponent:R,isOpen:s,position:K,onSelect:v=>{ye(v),r(!1)},onClose:()=>r(!1),componentSelectorRef:S,isConnected:le})]}),ke):null}function is({id:e,versions:t,props:c,defaultVersion:i}){const[a,u]=o.useState(!1),l=Object.keys(t),s=i||l[0],r=o.useMemo(()=>Object.entries(t).map(([_,b])=>({key:_,label:b.label})),[t]),[f,p]=$(`${W}${e}`,s,!0);o.useEffect(()=>(je(e,r),()=>{Ee(e)}),[e,r]);const[h,m]=o.useState(l.includes(f)?f:s);o.useEffect(()=>{t[f]&&m(f)},[f,t]),o.useEffect(()=>{if(l.length>0&&!l.includes(f)){const _=setTimeout(()=>{l.includes(f)||p(l[0])},2500);return()=>clearTimeout(_)}},[f,l,p]),o.useEffect(()=>{u(!0)},[]);const y=t[f]?.render??t[h]?.render??t[l[0]]?.render;return!y||!a?null:n.jsx(y,{...c})}function ls({id:e,versions:t,props:c,defaultVersion:i}){const a=Object.keys(t),u=i||a[0],l=o.useMemo(()=>Object.entries(t).map(([_,b])=>({key:_,label:b.label})),[t]),[s,r]=$(`${W}${e}`,u,!0);o.useEffect(()=>(je(e,l),()=>{Ee(e)}),[e,l]);const[f,p]=o.useState(a.includes(s)?s:u);o.useEffect(()=>{t[s]&&p(s)},[s,t]),o.useEffect(()=>{if(a.length>0&&!a.includes(s)){const _=setTimeout(()=>{a.includes(s)||r(a[0])},2500);return()=>clearTimeout(_)}},[s,a,r]);const h=t[s]?.render??t[f]?.render??t[a[0]].render,[m,y]=o.useState(null);return o.useEffect(()=>{if(typeof h=="function"){const _=o.lazy(h);y(()=>_)}else y(()=>h)},[h]),m?typeof h=="function"?n.jsx(o.Suspense,{fallback:null,children:n.jsx(m,{...c})}):n.jsx(m,{...c}):null}exports.ForkedComponent=is;exports.LazyForkedComponent=ls;exports.UIFork=cs;exports.useLocalStorage=$;