camox 0.14.2 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/components/AuthGate.js +6 -0
  2. package/dist/core/components/AddBlockControlBar.js +30 -26
  3. package/dist/core/components/lexical/InlineContentEditable.js +19 -15
  4. package/dist/core/components/lexical/InlineLexicalEditor.js +62 -42
  5. package/dist/core/components/lexical/SelectionBroadcaster.js +25 -21
  6. package/dist/core/components/lexical/SidebarLexicalEditor.js +33 -21
  7. package/dist/core/createBlock.js +524 -488
  8. package/dist/core/createLayout.js +40 -28
  9. package/dist/core/hooks/useFieldSelection.js +12 -8
  10. package/dist/core/hooks/useIsEditable.js +6 -0
  11. package/dist/core/hooks/useOverlayMessage.js +19 -15
  12. package/dist/core/lib/contentType.d.ts +8 -8
  13. package/dist/core/lib/contentType.js +63 -0
  14. package/dist/features/content/CamoxContent.js +92 -88
  15. package/dist/features/content/components/AssetCard.js +46 -42
  16. package/dist/features/content/components/AssetCardSkeleton.js +8 -4
  17. package/dist/features/content/components/ContentSidebar.js +8 -4
  18. package/dist/features/content/components/UploadDropZone.js +31 -27
  19. package/dist/features/content/components/UploadProgressDrawer.js +98 -90
  20. package/dist/features/preview/CamoxPreview.js +162 -146
  21. package/dist/features/preview/components/AddBlockSheet.js +105 -101
  22. package/dist/features/preview/components/AgentChatSheet.js +74 -21
  23. package/dist/features/preview/components/AssetFieldEditor.js +98 -90
  24. package/dist/features/preview/components/AssetLightbox.js +21 -17
  25. package/dist/features/preview/components/AssetPickerGrid.js +84 -80
  26. package/dist/features/preview/components/BlockActionsPopover.js +35 -31
  27. package/dist/features/preview/components/BlockErrorBoundary.js +12 -8
  28. package/dist/features/preview/components/CreatePageModal.js +1 -1
  29. package/dist/features/preview/components/DebouncedFieldEditor.js +41 -37
  30. package/dist/features/preview/components/EditPageModal.js +114 -98
  31. package/dist/features/preview/components/FieldOverlayStyles.js +8 -4
  32. package/dist/features/preview/components/FieldToolbar.js +95 -54
  33. package/dist/features/preview/components/Frame.js +50 -46
  34. package/dist/features/preview/components/ItemFieldsEditor.js +81 -79
  35. package/dist/features/preview/components/LinkFieldEditor.js +138 -134
  36. package/dist/features/preview/components/MultipleAssetFieldEditor.js +105 -97
  37. package/dist/features/preview/components/OverlayTracker.js +19 -15
  38. package/dist/features/preview/components/Overlays.js +27 -23
  39. package/dist/features/preview/components/PageContentSheet.js +54 -4
  40. package/dist/features/preview/components/PageLocationFieldset.js +113 -109
  41. package/dist/features/preview/components/PagePicker.js +1 -1
  42. package/dist/features/preview/components/PageTree.js +443 -399
  43. package/dist/features/preview/components/PeekedBlock.js +69 -65
  44. package/dist/features/preview/components/PreviewPanel.js +64 -52
  45. package/dist/features/preview/components/PreviewSideSheet.js +25 -16
  46. package/dist/features/preview/components/PreviewToolbar.js +127 -123
  47. package/dist/features/preview/components/RepeatableItemsList.js +176 -171
  48. package/dist/features/preview/components/ShikiMarkdown.js +18 -14
  49. package/dist/features/preview/components/UnlinkAssetButton.js +74 -70
  50. package/dist/features/preview/components/useRepeatableItemActions.js +266 -0
  51. package/dist/features/preview/components/useUpdateBlockPosition.js +13 -9
  52. package/dist/features/provider/CamoxProvider.js +60 -52
  53. package/dist/features/provider/components/CamoxAppContext.js +10 -6
  54. package/dist/features/provider/components/CommandPalette.js +77 -69
  55. package/dist/features/provider/useAdminShortcuts.js +11 -7
  56. package/dist/features/routes/pageRoute.js +8 -4
  57. package/dist/features/studio/CamoxStudio.js +23 -19
  58. package/dist/features/studio/components/EnvironmentMenu.js +32 -28
  59. package/dist/features/studio/components/Navbar.js +62 -54
  60. package/dist/features/studio/components/ProjectMenu.js +131 -123
  61. package/dist/features/studio/components/UserButton.js +15 -11
  62. package/dist/features/studio/useTheme.js +82 -42
  63. package/dist/features/vite/definitionsSync.js +5 -5
  64. package/dist/features/vite/skillGeneration.js +43 -8
  65. package/dist/features/vite/vite.d.ts +1 -1
  66. package/dist/features/vite/vite.js +20 -2
  67. package/dist/hooks/use-marquee-selection.js +36 -32
  68. package/dist/lib/auth.js +49 -22
  69. package/dist/lib/normalized-data.js +55 -47
  70. package/dist/lib/use-project-room.js +22 -18
  71. package/dist/studio.css +1 -1
  72. package/package.json +10 -11
  73. package/skills/camox-block/SKILL.md +4 -0
  74. package/skills/camox-cli/SKILL.md +142 -0
  75. package/skills/camox-layout/SKILL.md +4 -0
@@ -1,6 +1,6 @@
1
1
  import { createServerApiClient } from "../../lib/api-client-server.js";
2
2
  import path from "node:path";
3
- import { createServer, isRunnableDevEnvironment } from "vite";
3
+ import { createServer, isRunnableDevEnvironment } from "vite-plus";
4
4
 
5
5
  //#region src/features/vite/definitionsSync.ts
6
6
  const SYNC_DEBOUNCE_DELAY_MS = 100;
@@ -199,7 +199,7 @@ async function syncDefinitions(server, options) {
199
199
  try {
200
200
  await performInitialSync();
201
201
  } catch (error) {
202
- server.config.logger.error(`[camox] Failed to sync block definitions: ${error}`, { timestamp: true });
202
+ server.config.logger.error(`[camox] Failed to sync block definitions: ${String(error)}`, { timestamp: true });
203
203
  }
204
204
  const debounceTimers = /* @__PURE__ */ new Map();
205
205
  const layoutsDir = path.resolve(server.config.root, "src/camox/layouts");
@@ -218,7 +218,7 @@ async function syncDefinitions(server, options) {
218
218
  try {
219
219
  await upsertBlock(filePath);
220
220
  } catch (error) {
221
- server.config.logger.error(`[camox] Failed to sync block: ${error}`, { timestamp: true });
221
+ server.config.logger.error(`[camox] Failed to sync block: ${String(error)}`, { timestamp: true });
222
222
  }
223
223
  }, SYNC_DEBOUNCE_DELAY_MS));
224
224
  };
@@ -233,7 +233,7 @@ async function syncDefinitions(server, options) {
233
233
  try {
234
234
  await deleteBlock(filePath);
235
235
  } catch (error) {
236
- server.config.logger.error(`[camox] Failed to delete block: ${error}`, { timestamp: true });
236
+ server.config.logger.error(`[camox] Failed to delete block: ${String(error)}`, { timestamp: true });
237
237
  }
238
238
  }, SYNC_DEBOUNCE_DELAY_MS);
239
239
  };
@@ -249,7 +249,7 @@ async function syncDefinitions(server, options) {
249
249
  try {
250
250
  await performInitialSync();
251
251
  } catch (error) {
252
- server.config.logger.error(`[camox] Failed to sync layouts: ${error}`, { timestamp: true });
252
+ server.config.logger.error(`[camox] Failed to sync layouts: ${String(error)}`, { timestamp: true });
253
253
  }
254
254
  }, SYNC_DEBOUNCE_DELAY_MS);
255
255
  };
@@ -1,26 +1,61 @@
1
1
  import { writeIfChanged } from "./utils.js";
2
- import { lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, symlinkSync, writeFileSync } from "node:fs";
2
+ import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, symlinkSync, writeFileSync } from "node:fs";
3
3
  import { dirname, join, relative, resolve } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
 
6
6
  //#region src/features/vite/skillGeneration.ts
7
- const HEADER = `<!-- AUTO-GENERATED BY CAMOX — DO NOT EDIT
7
+ const NOTICE = `<!-- AUTO-GENERATED BY CAMOX — DO NOT EDIT
8
8
  This file is managed by the Camox Vite plugin.
9
- Any manual edits will be automatically reverted by the dev server. -->
10
-
11
- `;
9
+ Any manual edits will be automatically reverted by the dev server. -->`;
10
+ function injectNoticeAfterFrontmatter(source) {
11
+ if (!source.startsWith("---\n")) return `${NOTICE}\n\n${source}`;
12
+ const closeIdx = source.indexOf("\n---\n", 4);
13
+ if (closeIdx === -1) return `${NOTICE}\n\n${source}`;
14
+ const endOfClose = closeIdx + 5;
15
+ return `${source.slice(0, endOfClose)}\n${NOTICE}\n${source.slice(endOfClose)}`;
16
+ }
12
17
  const sdkRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../../..");
18
+ const camoxCmdByPm = {
19
+ pnpm: "pnpm camox",
20
+ yarn: "yarn camox",
21
+ bun: "bunx camox",
22
+ npm: "npx camox"
23
+ };
24
+ function detectPackageManagerInDir(dir) {
25
+ const packageJsonPath = resolve(dir, "package.json");
26
+ if (existsSync(packageJsonPath)) try {
27
+ const pkg = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
28
+ const name = (typeof pkg.packageManager === "string" ? pkg.packageManager : "").split("@", 1)[0];
29
+ if (name === "pnpm" || name === "yarn" || name === "bun" || name === "npm") return name;
30
+ } catch {}
31
+ if (existsSync(resolve(dir, "pnpm-lock.yaml"))) return "pnpm";
32
+ if (existsSync(resolve(dir, "bun.lock")) || existsSync(resolve(dir, "bun.lockb"))) return "bun";
33
+ if (existsSync(resolve(dir, "yarn.lock"))) return "yarn";
34
+ if (existsSync(resolve(dir, "package-lock.json"))) return "npm";
35
+ }
36
+ function detectPackageManager(appRoot) {
37
+ let dir = resolve(appRoot);
38
+ while (true) {
39
+ const found = detectPackageManagerInDir(dir);
40
+ if (found) return found;
41
+ const parent = dirname(dir);
42
+ if (parent === dir) return "npm";
43
+ dir = parent;
44
+ }
45
+ }
13
46
  function getSkillNames() {
14
47
  const skillsDir = resolve(sdkRoot, "skills");
15
48
  return readdirSync(skillsDir).filter((name) => lstatSync(resolve(skillsDir, name)).isDirectory());
16
49
  }
17
- function generateSkillContent(skillName) {
18
- return HEADER + readFileSync(resolve(sdkRoot, `skills/${skillName}/SKILL.md`), "utf-8");
50
+ function generateSkillContent(skillName, appRoot) {
51
+ const raw = readFileSync(resolve(sdkRoot, `skills/${skillName}/SKILL.md`), "utf-8");
52
+ const pm = detectPackageManager(appRoot);
53
+ return injectNoticeAfterFrontmatter(raw.replaceAll("{{PM_NAME}}", pm).replaceAll("{{CAMOX_CMD}}", camoxCmdByPm[pm]));
19
54
  }
20
55
  function getSkillFileEntries(appRoot) {
21
56
  return getSkillNames().map((name) => ({
22
57
  path: resolve(appRoot, `.agents/skills/${name}/SKILL.md`),
23
- content: generateSkillContent(name)
58
+ content: generateSkillContent(name, appRoot)
24
59
  }));
25
60
  }
26
61
  function generateSkillFiles(appRoot) {
@@ -1,4 +1,4 @@
1
- import { Plugin } from "vite";
1
+ import { Plugin } from "vite-plus";
2
2
 
3
3
  //#region src/features/vite/vite.d.ts
4
4
  interface CamoxPluginOptions {
@@ -3,11 +3,11 @@ import { watchNewBlockFiles } from "./blockBoilerplate.js";
3
3
  import { syncDefinitions, syncDefinitionsToApi } from "./definitionsSync.js";
4
4
  import { generateRouteFiles, watchRouteFiles } from "./routeGeneration.js";
5
5
  import { generateSkillFiles, watchSkillFiles } from "./skillGeneration.js";
6
- import { readFileSync } from "node:fs";
6
+ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
7
7
  import { homedir } from "node:os";
8
8
  import { dirname, join, resolve } from "node:path";
9
9
  import { fileURLToPath } from "node:url";
10
- import { createServer } from "vite";
10
+ import { createServer } from "vite-plus";
11
11
  import { z } from "zod";
12
12
 
13
13
  //#region src/features/vite/vite.ts
@@ -35,6 +35,18 @@ function readAuthEmail(authenticationUrl) {
35
35
  return null;
36
36
  }
37
37
  }
38
+ /**
39
+ * Drop a sidecar at `<root>/node_modules/.camox/runtime.json` so the `camox`
40
+ * CLI can pick up the same projectSlug / apiUrl / authenticationUrl /
41
+ * environmentName the plugin actually used. The CLI treats the vite config
42
+ * as the source of truth — there is no other reliable way to recover these
43
+ * values from outside vite.
44
+ */
45
+ function writeRuntimeSidecar(root, data) {
46
+ const dir = join(root, "node_modules", ".camox");
47
+ mkdirSync(dir, { recursive: true });
48
+ writeFileSync(join(dir, "runtime.json"), `${JSON.stringify(data, null, 2)}\n`);
49
+ }
38
50
  function resolveEnvironmentName(command, authenticationUrl) {
39
51
  if (command === "serve") {
40
52
  const email = readAuthEmail(authenticationUrl);
@@ -144,6 +156,12 @@ function camox(options) {
144
156
  configResolved(config) {
145
157
  resolvedConfig = config;
146
158
  const routesDir = resolve(config.root, "src/routes");
159
+ writeRuntimeSidecar(config.root, {
160
+ projectSlug: options.projectSlug,
161
+ apiUrl,
162
+ authenticationUrl,
163
+ environmentName
164
+ });
147
165
  if (!disableCodeGen) {
148
166
  generateAppFile(config.root);
149
167
  generateRouteFiles({
@@ -4,12 +4,16 @@ import { useRef, useState } from "react";
4
4
  //#region src/hooks/use-marquee-selection.ts
5
5
  const DRAG_THRESHOLD = 5;
6
6
  function useMarqueeSelection(containerRef, onSelectionChange) {
7
- const $ = c(17);
7
+ const $ = c(18);
8
+ if ($[0] !== "d6476ded33fc0bb3f0404905feeb866445a4281802c5c1350a0c10252b9e0e06") {
9
+ for (let $i = 0; $i < 18; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
10
+ $[0] = "d6476ded33fc0bb3f0404905feeb866445a4281802c5c1350a0c10252b9e0e06";
11
+ }
8
12
  const [selectionRect, setSelectionRect] = useState(null);
9
13
  const startPoint = useRef(null);
10
14
  const isDragging = useRef(false);
11
15
  let t0;
12
- if ($[0] !== containerRef) {
16
+ if ($[1] !== containerRef) {
13
17
  t0 = (e) => {
14
18
  const container = containerRef.current;
15
19
  if (!container) return null;
@@ -19,13 +23,13 @@ function useMarqueeSelection(containerRef, onSelectionChange) {
19
23
  y: e.clientY - bounds.top + container.scrollTop
20
24
  };
21
25
  };
22
- $[0] = containerRef;
23
- $[1] = t0;
24
- } else t0 = $[1];
26
+ $[1] = containerRef;
27
+ $[2] = t0;
28
+ } else t0 = $[2];
25
29
  const getContainerRelativePoint = t0;
26
30
  const computeRect = _temp;
27
31
  let t1;
28
- if ($[2] !== containerRef) {
32
+ if ($[3] !== containerRef) {
29
33
  t1 = (rect) => {
30
34
  const container_0 = containerRef.current;
31
35
  if (!container_0) return /* @__PURE__ */ new Set();
@@ -46,12 +50,12 @@ function useMarqueeSelection(containerRef, onSelectionChange) {
46
50
  }
47
51
  return ids;
48
52
  };
49
- $[2] = containerRef;
50
- $[3] = t1;
51
- } else t1 = $[3];
53
+ $[3] = containerRef;
54
+ $[4] = t1;
55
+ } else t1 = $[4];
52
56
  const findIntersectingIds = t1;
53
57
  let t2;
54
- if ($[4] !== getContainerRelativePoint) {
58
+ if ($[5] !== getContainerRelativePoint) {
55
59
  t2 = (e_0) => {
56
60
  if (e_0.button !== 0) return;
57
61
  if (e_0.target.closest("[data-asset-id]")) return;
@@ -61,12 +65,12 @@ function useMarqueeSelection(containerRef, onSelectionChange) {
61
65
  isDragging.current = false;
62
66
  e_0.currentTarget.setPointerCapture(e_0.pointerId);
63
67
  };
64
- $[4] = getContainerRelativePoint;
65
- $[5] = t2;
66
- } else t2 = $[5];
68
+ $[5] = getContainerRelativePoint;
69
+ $[6] = t2;
70
+ } else t2 = $[6];
67
71
  const onPointerDown = t2;
68
72
  let t3;
69
- if ($[6] !== findIntersectingIds || $[7] !== getContainerRelativePoint || $[8] !== onSelectionChange) {
73
+ if ($[7] !== findIntersectingIds || $[8] !== getContainerRelativePoint || $[9] !== onSelectionChange) {
70
74
  t3 = (e_1) => {
71
75
  if (!startPoint.current) return;
72
76
  const point_0 = getContainerRelativePoint(e_1);
@@ -81,15 +85,15 @@ function useMarqueeSelection(containerRef, onSelectionChange) {
81
85
  setSelectionRect(rect_0);
82
86
  onSelectionChange(findIntersectingIds(rect_0));
83
87
  };
84
- $[6] = findIntersectingIds;
85
- $[7] = getContainerRelativePoint;
86
- $[8] = onSelectionChange;
87
- $[9] = t3;
88
- } else t3 = $[9];
88
+ $[7] = findIntersectingIds;
89
+ $[8] = getContainerRelativePoint;
90
+ $[9] = onSelectionChange;
91
+ $[10] = t3;
92
+ } else t3 = $[10];
89
93
  const onPointerMove = t3;
90
94
  const didDrag = useRef(false);
91
95
  let t4;
92
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
96
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
93
97
  t4 = (e_2) => {
94
98
  if (!startPoint.current) return;
95
99
  e_2.currentTarget.releasePointerCapture(e_2.pointerId);
@@ -98,31 +102,31 @@ function useMarqueeSelection(containerRef, onSelectionChange) {
98
102
  isDragging.current = false;
99
103
  setSelectionRect(null);
100
104
  };
101
- $[10] = t4;
102
- } else t4 = $[10];
105
+ $[11] = t4;
106
+ } else t4 = $[11];
103
107
  const onPointerUp = t4;
104
108
  let t5;
105
- if ($[11] !== onPointerDown || $[12] !== onPointerMove) {
109
+ if ($[12] !== onPointerDown || $[13] !== onPointerMove) {
106
110
  t5 = {
107
111
  onPointerDown,
108
112
  onPointerMove,
109
113
  onPointerUp
110
114
  };
111
- $[11] = onPointerDown;
112
- $[12] = onPointerMove;
113
- $[13] = t5;
114
- } else t5 = $[13];
115
+ $[12] = onPointerDown;
116
+ $[13] = onPointerMove;
117
+ $[14] = t5;
118
+ } else t5 = $[14];
115
119
  let t6;
116
- if ($[14] !== selectionRect || $[15] !== t5) {
120
+ if ($[15] !== selectionRect || $[16] !== t5) {
117
121
  t6 = {
118
122
  selectionRect,
119
123
  didDragRef: didDrag,
120
124
  handlers: t5
121
125
  };
122
- $[14] = selectionRect;
123
- $[15] = t5;
124
- $[16] = t6;
125
- } else t6 = $[16];
126
+ $[15] = selectionRect;
127
+ $[16] = t5;
128
+ $[17] = t6;
129
+ } else t6 = $[17];
126
130
  return t6;
127
131
  }
128
132
  function _temp(a, b) {
package/dist/lib/auth.js CHANGED
@@ -163,11 +163,15 @@ function createCamoxAuthClient(apiUrl) {
163
163
  * Returns `true` once processing is complete (or if there was no OTT).
164
164
  */
165
165
  function useProcessOtt(authClient) {
166
- const $ = c(4);
166
+ const $ = c(5);
167
+ if ($[0] !== "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f") {
168
+ for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
169
+ $[0] = "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f";
170
+ }
167
171
  const [ready, setReady] = React.useState(_temp);
168
172
  let t0;
169
173
  let t1;
170
- if ($[0] !== authClient || $[1] !== ready) {
174
+ if ($[1] !== authClient || $[2] !== ready) {
171
175
  t0 = () => {
172
176
  if (ready) return;
173
177
  const url = new URL(window.location.href);
@@ -181,19 +185,19 @@ function useProcessOtt(authClient) {
181
185
  (async () => {
182
186
  try {
183
187
  await authClient.oneTimeToken.verify({ token: ott });
184
- authClient.updateSession();
188
+ await authClient.updateSession();
185
189
  } catch {}
186
190
  setReady(true);
187
191
  })();
188
192
  };
189
193
  t1 = [authClient, ready];
190
- $[0] = authClient;
191
- $[1] = ready;
192
- $[2] = t0;
193
- $[3] = t1;
194
+ $[1] = authClient;
195
+ $[2] = ready;
196
+ $[3] = t0;
197
+ $[4] = t1;
194
198
  } else {
195
- t0 = $[2];
196
- t1 = $[3];
199
+ t0 = $[3];
200
+ t1 = $[4];
197
201
  }
198
202
  React.useEffect(t0, t1);
199
203
  return ready;
@@ -204,11 +208,21 @@ function _temp() {
204
208
  }
205
209
  const AuthContext = React.createContext(null);
206
210
  function useAuthContext() {
211
+ const $ = c(1);
212
+ if ($[0] !== "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f") {
213
+ for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
214
+ $[0] = "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f";
215
+ }
207
216
  const ctx = React.useContext(AuthContext);
208
217
  if (!ctx) throw new Error("Missing CamoxProvider");
209
218
  return ctx;
210
219
  }
211
220
  function useProjectSlug() {
221
+ const $ = c(1);
222
+ if ($[0] !== "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f") {
223
+ for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
224
+ $[0] = "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f";
225
+ }
212
226
  return useAuthContext().projectSlug;
213
227
  }
214
228
  function useAuthState() {
@@ -220,34 +234,47 @@ function useAuthState() {
220
234
  };
221
235
  }
222
236
  function useIsAuthenticated() {
237
+ const $ = c(1);
238
+ if ($[0] !== "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f") {
239
+ for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
240
+ $[0] = "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f";
241
+ }
223
242
  const { isAuthenticated } = useAuthState();
224
243
  return isAuthenticated;
225
244
  }
226
245
  function useSignInRedirect() {
227
- const $ = c(2);
246
+ const $ = c(3);
247
+ if ($[0] !== "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f") {
248
+ for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
249
+ $[0] = "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f";
250
+ }
228
251
  const { authenticationUrl } = useAuthContext();
229
252
  let t0;
230
- if ($[0] !== authenticationUrl) {
253
+ if ($[1] !== authenticationUrl) {
231
254
  t0 = () => {
232
255
  if (typeof window !== "undefined") {
233
256
  const callback = encodeURIComponent(window.location.href);
234
257
  window.location.href = `${authenticationUrl}/studio-authorize?callback=${callback}`;
235
258
  }
236
259
  };
237
- $[0] = authenticationUrl;
238
- $[1] = t0;
239
- } else t0 = $[1];
260
+ $[1] = authenticationUrl;
261
+ $[2] = t0;
262
+ } else t0 = $[2];
240
263
  return t0;
241
264
  }
242
265
  /**
243
266
  * Registers sign-out and manage-account actions in the command palette.
244
267
  */
245
268
  function useAuthActions() {
246
- const $ = c(4);
269
+ const $ = c(5);
270
+ if ($[0] !== "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f") {
271
+ for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
272
+ $[0] = "e81e7f3a7847debd5cb6569770cedb214617cac7132fef9c515454bbdf62997f";
273
+ }
247
274
  const { authClient, authenticationUrl } = useAuthContext();
248
275
  let t0;
249
276
  let t1;
250
- if ($[0] !== authClient || $[1] !== authenticationUrl) {
277
+ if ($[1] !== authClient || $[2] !== authenticationUrl) {
251
278
  t0 = () => {
252
279
  actionsStore.send({
253
280
  type: "registerManyActions",
@@ -270,13 +297,13 @@ function useAuthActions() {
270
297
  return _temp4;
271
298
  };
272
299
  t1 = [authClient, authenticationUrl];
273
- $[0] = authClient;
274
- $[1] = authenticationUrl;
275
- $[2] = t0;
276
- $[3] = t1;
300
+ $[1] = authClient;
301
+ $[2] = authenticationUrl;
302
+ $[3] = t0;
303
+ $[4] = t1;
277
304
  } else {
278
- t0 = $[2];
279
- t1 = $[3];
305
+ t0 = $[3];
306
+ t1 = $[4];
280
307
  }
281
308
  React.useEffect(t0, t1);
282
309
  }
@@ -10,44 +10,48 @@ const NormalizedDataContext = React.createContext({
10
10
  itemsMap: /* @__PURE__ */ new Map()
11
11
  });
12
12
  const NormalizedDataProvider = (t0) => {
13
- const $ = c(12);
13
+ const $ = c(13);
14
+ if ($[0] !== "ed2e0d64351fc4fa3a6c3f757030e847f40cb4832316d8081cc486fd820c8a58") {
15
+ for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
16
+ $[0] = "ed2e0d64351fc4fa3a6c3f757030e847f40cb4832316d8081cc486fd820c8a58";
17
+ }
14
18
  const { files, repeatableItems, children } = t0;
15
19
  let t1;
16
- if ($[0] !== files) {
20
+ if ($[1] !== files) {
17
21
  t1 = new Map(files.map(_temp));
18
- $[0] = files;
19
- $[1] = t1;
20
- } else t1 = $[1];
22
+ $[1] = files;
23
+ $[2] = t1;
24
+ } else t1 = $[2];
21
25
  let t2;
22
- if ($[2] !== repeatableItems) {
26
+ if ($[3] !== repeatableItems) {
23
27
  t2 = new Map(repeatableItems.map(_temp2));
24
- $[2] = repeatableItems;
25
- $[3] = t2;
26
- } else t2 = $[3];
28
+ $[3] = repeatableItems;
29
+ $[4] = t2;
30
+ } else t2 = $[4];
27
31
  let t3;
28
- if ($[4] !== t1 || $[5] !== t2) {
32
+ if ($[5] !== t1 || $[6] !== t2) {
29
33
  t3 = {
30
34
  filesMap: t1,
31
35
  itemsMap: t2
32
36
  };
33
- $[4] = t1;
34
- $[5] = t2;
35
- $[6] = t3;
36
- } else t3 = $[6];
37
+ $[5] = t1;
38
+ $[6] = t2;
39
+ $[7] = t3;
40
+ } else t3 = $[7];
37
41
  const value = t3;
38
42
  let t4;
39
- if ($[7] !== children || $[8] !== value) {
43
+ if ($[8] !== children || $[9] !== value) {
40
44
  let t5;
41
- if ($[10] !== value) {
45
+ if ($[11] !== value) {
42
46
  t5 = { value };
43
- $[10] = value;
44
- $[11] = t5;
45
- } else t5 = $[11];
47
+ $[11] = value;
48
+ $[12] = t5;
49
+ } else t5 = $[12];
46
50
  t4 = React.createElement(NormalizedDataContext.Provider, t5, children);
47
- $[7] = children;
48
- $[8] = value;
49
- $[9] = t4;
50
- } else t4 = $[9];
51
+ $[8] = children;
52
+ $[9] = value;
53
+ $[10] = t4;
54
+ } else t4 = $[10];
51
55
  return t4;
52
56
  };
53
57
  function useNormalizedData() {
@@ -55,32 +59,36 @@ function useNormalizedData() {
55
59
  }
56
60
  const EMPTY_IDS = [];
57
61
  function usePageBlocks(pageStructure) {
58
- const $ = c(15);
62
+ const $ = c(16);
63
+ if ($[0] !== "ed2e0d64351fc4fa3a6c3f757030e847f40cb4832316d8081cc486fd820c8a58") {
64
+ for (let $i = 0; $i < 16; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
65
+ $[0] = "ed2e0d64351fc4fa3a6c3f757030e847f40cb4832316d8081cc486fd820c8a58";
66
+ }
59
67
  const blockIds = pageStructure.page.blockIds;
60
68
  const beforeIds = pageStructure.layout?.beforeBlockIds ?? EMPTY_IDS;
61
69
  const afterIds = pageStructure.layout?.afterBlockIds ?? EMPTY_IDS;
62
70
  let t0;
63
- if ($[0] !== afterIds || $[1] !== beforeIds || $[2] !== blockIds) {
71
+ if ($[1] !== afterIds || $[2] !== beforeIds || $[3] !== blockIds) {
64
72
  t0 = [
65
73
  ...blockIds,
66
74
  ...beforeIds,
67
75
  ...afterIds
68
76
  ];
69
- $[0] = afterIds;
70
- $[1] = beforeIds;
71
- $[2] = blockIds;
72
- $[3] = t0;
73
- } else t0 = $[3];
77
+ $[1] = afterIds;
78
+ $[2] = beforeIds;
79
+ $[3] = blockIds;
80
+ $[4] = t0;
81
+ } else t0 = $[4];
74
82
  const allIds = t0;
75
83
  let t1;
76
- if ($[4] !== allIds) {
84
+ if ($[5] !== allIds) {
77
85
  t1 = { queries: allIds.map(_temp3) };
78
- $[4] = allIds;
79
- $[5] = t1;
80
- } else t1 = $[5];
86
+ $[5] = allIds;
87
+ $[6] = t1;
88
+ } else t1 = $[6];
81
89
  const results = useQueries(t1);
82
90
  let t2;
83
- if ($[6] !== afterIds || $[7] !== allIds || $[8] !== beforeIds || $[9] !== blockIds || $[10] !== results) {
91
+ if ($[7] !== afterIds || $[8] !== allIds || $[9] !== beforeIds || $[10] !== blockIds || $[11] !== results) {
84
92
  const bundleMap = /* @__PURE__ */ new Map();
85
93
  for (let i = 0; i < allIds.length; i++) {
86
94
  const data = results[i]?.data;
@@ -89,12 +97,12 @@ function usePageBlocks(pageStructure) {
89
97
  const layoutFiles = [];
90
98
  const layoutItems = [];
91
99
  let t3;
92
- if ($[12] !== afterIds || $[13] !== beforeIds) {
100
+ if ($[13] !== afterIds || $[14] !== beforeIds) {
93
101
  t3 = [...beforeIds, ...afterIds];
94
- $[12] = afterIds;
95
- $[13] = beforeIds;
96
- $[14] = t3;
97
- } else t3 = $[14];
102
+ $[13] = afterIds;
103
+ $[14] = beforeIds;
104
+ $[15] = t3;
105
+ } else t3 = $[15];
98
106
  for (const id_0 of t3) {
99
107
  const bundle = bundleMap.get(id_0);
100
108
  if (bundle) {
@@ -109,13 +117,13 @@ function usePageBlocks(pageStructure) {
109
117
  layoutFiles,
110
118
  layoutItems
111
119
  };
112
- $[6] = afterIds;
113
- $[7] = allIds;
114
- $[8] = beforeIds;
115
- $[9] = blockIds;
116
- $[10] = results;
117
- $[11] = t2;
118
- } else t2 = $[11];
120
+ $[7] = afterIds;
121
+ $[8] = allIds;
122
+ $[9] = beforeIds;
123
+ $[10] = blockIds;
124
+ $[11] = results;
125
+ $[12] = t2;
126
+ } else t2 = $[12];
119
127
  return t2;
120
128
  }
121
129
  /** Check if a value is a { _fileId } marker */
@@ -7,31 +7,35 @@ import { usePartySocket } from "partysocket/react";
7
7
  //#region src/lib/use-project-room.ts
8
8
  const DEBOUNCE_MS = 300;
9
9
  function useProjectRoom(apiUrl, projectId) {
10
- const $ = c(9);
10
+ const $ = c(10);
11
+ if ($[0] !== "c94fdacdaeb446d7db77b7fee7efa4a24c7433c9c1f518f586565506a52bbbd7") {
12
+ for (let $i = 0; $i < 10; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
13
+ $[0] = "c94fdacdaeb446d7db77b7fee7efa4a24c7433c9c1f518f586565506a52bbbd7";
14
+ }
11
15
  const queryClient = useQueryClient();
12
16
  const timerRef = useRef(void 0);
13
17
  let t0;
14
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
18
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
15
19
  t0 = [];
16
- $[0] = t0;
17
- } else t0 = $[0];
20
+ $[1] = t0;
21
+ } else t0 = $[1];
18
22
  const pendingRef = useRef(t0);
19
23
  let t1;
20
- if ($[1] !== apiUrl) {
24
+ if ($[2] !== apiUrl) {
21
25
  let t2;
22
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
26
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
23
27
  t2 = /\/+$/;
24
- $[3] = t2;
25
- } else t2 = $[3];
28
+ $[4] = t2;
29
+ } else t2 = $[4];
26
30
  t1 = apiUrl.replace(/^https?:\/\//, "").replace(t2, "");
27
- $[1] = apiUrl;
28
- $[2] = t1;
29
- } else t1 = $[2];
31
+ $[2] = apiUrl;
32
+ $[3] = t1;
33
+ } else t1 = $[3];
30
34
  const host = t1;
31
35
  const t2 = String(projectId ?? "");
32
36
  const t3 = !!projectId;
33
37
  let t4;
34
- if ($[4] !== host || $[5] !== queryClient || $[6] !== t2 || $[7] !== t3) {
38
+ if ($[5] !== host || $[6] !== queryClient || $[7] !== t2 || $[8] !== t3) {
35
39
  t4 = {
36
40
  host,
37
41
  party: "project-room",
@@ -65,12 +69,12 @@ function useProjectRoom(apiUrl, projectId) {
65
69
  }, DEBOUNCE_MS);
66
70
  }
67
71
  };
68
- $[4] = host;
69
- $[5] = queryClient;
70
- $[6] = t2;
71
- $[7] = t3;
72
- $[8] = t4;
73
- } else t4 = $[8];
72
+ $[5] = host;
73
+ $[6] = queryClient;
74
+ $[7] = t2;
75
+ $[8] = t3;
76
+ $[9] = t4;
77
+ } else t4 = $[9];
74
78
  usePartySocket(t4);
75
79
  }
76
80
  function _temp() {