@popcraft/kit 0.39.2 → 0.39.3

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 (59) hide show
  1. package/dist/chunks/{agent-KI3CLDIB.js → agent-4E255LAP.js} +1 -1
  2. package/dist/chunks/{builtin-O4KTOKBA.js → builtin-AA5TFW3X.js} +3 -3
  3. package/dist/chunks/{buy-credits-M4ESEIRV.js → buy-credits-QUB7IW4X.js} +3 -2
  4. package/dist/chunks/{check-template-J5Y743LU.js → check-template-N7SAEIMQ.js} +2 -2
  5. package/dist/chunks/{chunk-367BWDP6.js → chunk-42LN72V2.js} +4 -4
  6. package/dist/chunks/{chunk-BWUHGZCD.js → chunk-5DY3YPFB.js} +13 -5
  7. package/dist/chunks/{chunk-UA5JCPK7.js → chunk-73SQPECB.js} +1 -1
  8. package/dist/chunks/{chunk-LUYQ7J7Y.js → chunk-BUUGRRLL.js} +2 -2
  9. package/dist/chunks/{chunk-2KJ5MNIQ.js → chunk-D7MJXRNN.js} +1 -1
  10. package/dist/chunks/{chunk-FUT34NIA.js → chunk-DIFI3JDD.js} +5 -5
  11. package/dist/chunks/{chunk-SJMBD4YT.js → chunk-GFGEQRH4.js} +3 -3
  12. package/dist/chunks/{chunk-3CDJFUR2.js → chunk-I3SIVY2F.js} +1 -1
  13. package/dist/chunks/{chunk-BKRKK6BL.js → chunk-INORGURH.js} +5 -5
  14. package/dist/chunks/{chunk-HA52ZAX6.js → chunk-IPUIH5FB.js} +8 -8
  15. package/dist/chunks/{chunk-SDP72PLQ.js → chunk-JZQSBIPM.js} +2 -2
  16. package/dist/chunks/{chunk-QHVNDHT2.js → chunk-KIRCO2V3.js} +5 -5
  17. package/dist/chunks/chunk-LHR354QM.js +45 -0
  18. package/dist/chunks/{chunk-Z2MTSNIE.js → chunk-NZZVIBR6.js} +41 -41
  19. package/dist/chunks/{chunk-UOS7S3ZA.js → chunk-OEEABDYO.js} +3 -3
  20. package/dist/chunks/{chunk-PFNKNCZA.js → chunk-PRW3HXHI.js} +1 -1
  21. package/dist/chunks/{chunk-5Y5AUX3W.js → chunk-Q7UXEZQ7.js} +2 -2
  22. package/dist/chunks/{chunk-FUPMMN3D.js → chunk-SWODQJ7B.js} +11 -11
  23. package/dist/chunks/{chunk-DL34EUOY.js → chunk-XFVEENSY.js} +6 -34
  24. package/dist/chunks/{chunk-DSCQ5MKG.js → chunk-XN3OPBM5.js} +4 -4
  25. package/dist/chunks/{client-JR265W25.js → client-DL74R6XP.js} +1 -1
  26. package/dist/chunks/{client-EI2EOEPW.js → client-I475VQKH.js} +4 -3
  27. package/dist/chunks/{client-4NHRIPID.js → client-RDOGDXZN.js} +2 -2
  28. package/dist/chunks/{client-actions-62ABT2DT.js → client-actions-GOSA5YS2.js} +6 -5
  29. package/dist/chunks/{dangerous-LDMEDFCO.js → dangerous-7LRNUZJL.js} +3 -3
  30. package/dist/chunks/{delete-current-file-O7FI5BDC.js → delete-current-file-OMPYBTLR.js} +6 -5
  31. package/dist/chunks/{editor-seams-ELICUY4D.js → editor-seams-SSDVF5EG.js} +11 -10
  32. package/dist/chunks/{editor-store-YFGN57WA.js → editor-store-FEIOZB4Q.js} +1 -1
  33. package/dist/chunks/{export-watermark-RHTHSC5Y.js → export-watermark-FGFZ4XBT.js} +8 -6
  34. package/dist/chunks/{eyedropper-RT7VFF4I.js → eyedropper-CBEEPFMO.js} +1 -1
  35. package/dist/chunks/{generate-media-2VIG43AJ.js → generate-media-7O3HIT34.js} +4 -3
  36. package/dist/chunks/{host-4R6JNGCA.js → host-DLDZDU67.js} +7 -6
  37. package/dist/chunks/{integrations-ZABOMQ4C.js → integrations-ZIEWOJ2U.js} +1 -1
  38. package/dist/chunks/{libraries-GSTMWQHL.js → libraries-5ARWVM4T.js} +6 -5
  39. package/dist/chunks/{live-XLEAXHIJ.js → live-QJUP4B2I.js} +1 -1
  40. package/dist/chunks/{media-tool-VBA4APYJ.js → media-tool-2E2IPYDH.js} +1 -1
  41. package/dist/chunks/{new-file-ENIMZ5RX.js → new-file-HMHD3U6D.js} +4 -3
  42. package/dist/chunks/{plugin-C4S5ZMSE.js → plugin-HM6RJQUE.js} +2 -2
  43. package/dist/chunks/{plugin-import-JW4RKYOO.js → plugin-import-GCL6XI6R.js} +15 -14
  44. package/dist/chunks/{presence-7PCBRAQ6.js → presence-XLFPN565.js} +2 -2
  45. package/dist/chunks/{project-YMGHL6U2.js → project-PP6WZJXJ.js} +1 -1
  46. package/dist/chunks/{publish-site-AZ7USE2L.js → publish-site-5BL3MPGS.js} +7 -6
  47. package/dist/chunks/{publish-store-VNZR3MCB.js → publish-store-VWDIEOO7.js} +4 -4
  48. package/dist/chunks/{raster-actions-THFED73I.js → raster-actions-MMWG6SUD.js} +1 -1
  49. package/dist/chunks/{runner-B5OWG6AJ.js → runner-3FMK4AQD.js} +19 -18
  50. package/dist/chunks/{store-KQA72SRV.js → store-XQSIY777.js} +7 -6
  51. package/dist/chunks/{sync-W5N4AOWZ.js → sync-B5K7ODIH.js} +6 -5
  52. package/dist/chunks/{tabs-BBAC3NDH.js → tabs-CPKH62U3.js} +9 -8
  53. package/dist/chunks/{team-UG6Q2MMC.js → team-UBSE6CP3.js} +1 -1
  54. package/dist/chunks/{team-client-RHC7Z4QT.js → team-client-3J5K4AT2.js} +1 -1
  55. package/dist/chunks/{tools-5GGJFQCU.js → tools-RTEMMKZ3.js} +2 -2
  56. package/dist/chunks/{ui-commands-UCIRSWID.js → ui-commands-CNEV6VXE.js} +13 -12
  57. package/dist/chunks/{versions-N4UU6PJJ.js → versions-VMGFWCH6.js} +6 -5
  58. package/dist/index.js +1 -1
  59. package/package.json +1 -1
@@ -18,7 +18,7 @@ import {
18
18
  renderDocument,
19
19
  toolView,
20
20
  underReviewKit
21
- } from "./chunk-SJMBD4YT.js";
21
+ } from "./chunk-GFGEQRH4.js";
22
22
  import "./chunk-PGPOGVEX.js";
23
23
  import "./chunk-OPXNBC45.js";
24
24
  import "./chunk-SYZKPGXJ.js";
@@ -7,8 +7,8 @@ const __dirname = __popcraftDirname(__filename);
7
7
  import {
8
8
  builtinTools,
9
9
  registerBuiltinTools
10
- } from "./chunk-5Y5AUX3W.js";
11
- import "./chunk-Z2MTSNIE.js";
10
+ } from "./chunk-Q7UXEZQ7.js";
11
+ import "./chunk-NZZVIBR6.js";
12
12
  import "./chunk-646V2BCD.js";
13
13
  import "./chunk-YYVXMVGK.js";
14
14
  import "./chunk-VEHX2IKV.js";
@@ -19,7 +19,7 @@ import "./chunk-AHVAV5HP.js";
19
19
  import "./chunk-WQQKMIBN.js";
20
20
  import "./chunk-G72FXOZV.js";
21
21
  import "./chunk-AX2KIQW3.js";
22
- import "./chunk-SJMBD4YT.js";
22
+ import "./chunk-GFGEQRH4.js";
23
23
  import "./chunk-PGPOGVEX.js";
24
24
  import "./chunk-2Z2BSKDD.js";
25
25
  import "./chunk-DASSWBD6.js";
@@ -7,10 +7,11 @@ const __dirname = __popcraftDirname(__filename);
7
7
  import {
8
8
  HYPERY_TEAM_HEADER,
9
9
  hyperyRequestHeaders
10
- } from "./chunk-BWUHGZCD.js";
10
+ } from "./chunk-5DY3YPFB.js";
11
+ import "./chunk-LHR354QM.js";
11
12
  import {
12
13
  useHyperyTeam
13
- } from "./chunk-3CDJFUR2.js";
14
+ } from "./chunk-I3SIVY2F.js";
14
15
  import {
15
16
  ApiError,
16
17
  inAppPurchases,
@@ -6,10 +6,10 @@ const __filename = __popcraftPath(import.meta.url);
6
6
  const __dirname = __popcraftDirname(__filename);
7
7
  import {
8
8
  appCommands
9
- } from "./chunk-HA52ZAX6.js";
9
+ } from "./chunk-IPUIH5FB.js";
10
10
  import {
11
11
  builtinCommands
12
- } from "./chunk-Z2MTSNIE.js";
12
+ } from "./chunk-NZZVIBR6.js";
13
13
  import "./chunk-646V2BCD.js";
14
14
  import "./chunk-YYVXMVGK.js";
15
15
  import "./chunk-VEHX2IKV.js";
@@ -14,14 +14,14 @@ import {
14
14
  newFileRefusal,
15
15
  reportNewFileBlocked,
16
16
  setCloudLink
17
- } from "./chunk-DL34EUOY.js";
17
+ } from "./chunk-XFVEENSY.js";
18
18
  import {
19
19
  parseDeepLink,
20
20
  withDeepLink
21
21
  } from "./chunk-IRKZQGUH.js";
22
22
  import {
23
23
  activeTeamWorkspaceId
24
- } from "./chunk-3CDJFUR2.js";
24
+ } from "./chunk-I3SIVY2F.js";
25
25
  import {
26
26
  ApiError,
27
27
  api,
@@ -29,7 +29,7 @@ import {
29
29
  } from "./chunk-SXZWSY3K.js";
30
30
  import {
31
31
  attachPresence
32
- } from "./chunk-UA5JCPK7.js";
32
+ } from "./chunk-73SQPECB.js";
33
33
  import {
34
34
  isPersistableDocument,
35
35
  isUnsavedPlaceholder,
@@ -40,7 +40,7 @@ import {
40
40
  setCollabHistory,
41
41
  storedDocument,
42
42
  useEditorStore
43
- } from "./chunk-QHVNDHT2.js";
43
+ } from "./chunk-KIRCO2V3.js";
44
44
  import {
45
45
  accessToken,
46
46
  cloudUser,
@@ -5,8 +5,13 @@ const require = __popcraftRequire(import.meta.url);
5
5
  const __filename = __popcraftPath(import.meta.url);
6
6
  const __dirname = __popcraftDirname(__filename);
7
7
  import {
8
- activeHyperyTeamId
9
- } from "./chunk-3CDJFUR2.js";
8
+ loadEntitlements
9
+ } from "./chunk-LHR354QM.js";
10
+ import {
11
+ activeHyperyTeamId,
12
+ activeTeamWorkspaceId,
13
+ useHyperyTeam
14
+ } from "./chunk-I3SIVY2F.js";
10
15
  import {
11
16
  inAppPurchases
12
17
  } from "./chunk-SXZWSY3K.js";
@@ -26,8 +31,11 @@ var HYPERY_TEAM_HEADER = "x-hypery-active-organization-id";
26
31
  var HYPERY_PAYMENT_SOURCE_HEADER = "x-hypery-payment-source";
27
32
 
28
33
  // lib/hypery/client.ts
29
- function paymentSourceHeaders() {
30
- return inAppPurchases() ? { [HYPERY_PAYMENT_SOURCE_HEADER]: "credits" } : {};
34
+ async function paymentSourceHeaders() {
35
+ if (!inAppPurchases()) return {};
36
+ const workspaceId = activeTeamWorkspaceId() ?? useHyperyTeam.getState().personalWorkspaceId;
37
+ const ent = workspaceId ? await loadEntitlements(workspaceId).catch(() => null) : null;
38
+ return ent?.appStoreOnly ? { [HYPERY_PAYMENT_SOURCE_HEADER]: "credits" } : {};
31
39
  }
32
40
  async function hyperyRequestHeaders() {
33
41
  const token = await accessToken();
@@ -35,7 +43,7 @@ async function hyperyRequestHeaders() {
35
43
  const headers = new Headers({ authorization: `Bearer ${token}` });
36
44
  const team = activeHyperyTeamId();
37
45
  if (team) headers.set(HYPERY_TEAM_HEADER, team);
38
- for (const [k, v] of Object.entries(paymentSourceHeaders())) headers.set(k, v);
46
+ for (const [k, v] of Object.entries(await paymentSourceHeaders())) headers.set(k, v);
39
47
  return headers;
40
48
  }
41
49
 
@@ -6,7 +6,7 @@ const __filename = __popcraftPath(import.meta.url);
6
6
  const __dirname = __popcraftDirname(__filename);
7
7
  import {
8
8
  useEditorStore
9
- } from "./chunk-QHVNDHT2.js";
9
+ } from "./chunk-KIRCO2V3.js";
10
10
  import {
11
11
  announce
12
12
  } from "./chunk-HUSCMMEQ.js";
@@ -28,10 +28,10 @@ import {
28
28
  requestImageAction,
29
29
  sizeForAspect,
30
30
  vectorSupport
31
- } from "./chunk-PFNKNCZA.js";
31
+ } from "./chunk-PRW3HXHI.js";
32
32
  import {
33
33
  useEditorStore
34
- } from "./chunk-QHVNDHT2.js";
34
+ } from "./chunk-KIRCO2V3.js";
35
35
  import {
36
36
  getActiveRenderer
37
37
  } from "./chunk-EROSOLIW.js";
@@ -13,7 +13,7 @@ import {
13
13
  agentTool,
14
14
  agentToolList,
15
15
  registerCommands
16
- } from "./chunk-SJMBD4YT.js";
16
+ } from "./chunk-GFGEQRH4.js";
17
17
  import {
18
18
  dispatch
19
19
  } from "./chunk-OPXNBC45.js";
@@ -20,23 +20,23 @@ import {
20
20
  } from "./chunk-YQMAG4BV.js";
21
21
  import {
22
22
  notice
23
- } from "./chunk-LUYQ7J7Y.js";
23
+ } from "./chunk-BUUGRRLL.js";
24
24
  import {
25
25
  agentContext
26
- } from "./chunk-SJMBD4YT.js";
26
+ } from "./chunk-GFGEQRH4.js";
27
27
  import {
28
28
  collabSession,
29
29
  syncStatus
30
- } from "./chunk-367BWDP6.js";
30
+ } from "./chunk-42LN72V2.js";
31
31
  import {
32
32
  loadEntitlements
33
- } from "./chunk-DL34EUOY.js";
33
+ } from "./chunk-LHR354QM.js";
34
34
  import {
35
35
  cloudApi
36
36
  } from "./chunk-SXZWSY3K.js";
37
37
  import {
38
38
  useEditorStore
39
- } from "./chunk-QHVNDHT2.js";
39
+ } from "./chunk-KIRCO2V3.js";
40
40
  import {
41
41
  plansEnabled
42
42
  } from "./chunk-XP52W6IF.js";
@@ -59,19 +59,19 @@ async function renderDocument(doc, nodeIds, options) {
59
59
  function generateCapability(ctx) {
60
60
  return async (prompt, options = {}) => {
61
61
  if (options.format === "audio") {
62
- const { requestAudio } = await import("./client-EI2EOEPW.js");
62
+ const { requestAudio } = await import("./client-I475VQKH.js");
63
63
  const { signal: signal2, format: _f, ...rest2 } = options;
64
64
  void _f;
65
65
  return requestAudio({ prompt, ...rest2 }, signal2 ?? ctx.signal);
66
66
  }
67
67
  if (options.format === "video") {
68
- const { generateVideoFile } = await import("./generate-media-2VIG43AJ.js");
68
+ const { generateVideoFile } = await import("./generate-media-7O3HIT34.js");
69
69
  const { format: _f, signal: signal2, ...rest2 } = options;
70
70
  void _f;
71
71
  return generateVideoFile({ ...rest2, prompt, doc: ctx.doc() }, { signal: signal2 ?? ctx.signal });
72
72
  }
73
73
  const [{ requestImage }, { effectiveImageModel, useAiStore }] = await Promise.all([
74
- import("./client-EI2EOEPW.js"),
74
+ import("./client-I475VQKH.js"),
75
75
  import("./client-store-SHEZJ52Z.js")
76
76
  ]);
77
77
  const modelId = effectiveImageModel(useAiStore.getState());
@@ -140,7 +140,7 @@ function startHyperyTeams() {
140
140
  maybePromptForTeam();
141
141
  void followFileTeam(linkedKey);
142
142
  });
143
- void import("./sync-W5N4AOWZ.js").then(({ onSyncStatus, syncStatus }) => {
143
+ void import("./sync-B5K7ODIH.js").then(({ onSyncStatus, syncStatus }) => {
144
144
  linkedKey = syncStatus().link?.key ?? null;
145
145
  void followFileTeam(linkedKey);
146
146
  onSyncStatus((_s, link) => {
@@ -15,11 +15,11 @@ import {
15
15
  } from "./chunk-2IHJ4DKZ.js";
16
16
  import {
17
17
  syncStatus
18
- } from "./chunk-367BWDP6.js";
18
+ } from "./chunk-42LN72V2.js";
19
19
  import {
20
20
  setPluginTabs,
21
21
  useEditorStore
22
- } from "./chunk-QHVNDHT2.js";
22
+ } from "./chunk-KIRCO2V3.js";
23
23
  import {
24
24
  openBeside
25
25
  } from "./chunk-UI2UXKWC.js";
@@ -57,7 +57,7 @@ init_define_POPCRAFT_COMPONENT_IDS();
57
57
  // lib/plugins/api.ts
58
58
  init_define_POPCRAFT_COMPONENT_IDS();
59
59
  async function handlePluginCall(env, method, params = {}) {
60
- const { dispatchPluginCall } = await import("./plugin-C4S5ZMSE.js");
60
+ const { dispatchPluginCall } = await import("./plugin-HM6RJQUE.js");
61
61
  return dispatchPluginCall(env, method, params);
62
62
  }
63
63
 
@@ -380,7 +380,7 @@ async function runPlugin(pluginId, commandId, opts = {}) {
380
380
  if (!openBeside(url)) throw new Error("The browser blocked the new tab");
381
381
  },
382
382
  createDocument: async (opts2) => {
383
- const { createFreshFileOrExplain } = await import("./new-file-ENIMZ5RX.js");
383
+ const { createFreshFileOrExplain } = await import("./new-file-HMHD3U6D.js");
384
384
  const created = await createFreshFileOrExplain({}, { name: opts2?.name });
385
385
  if (!created.ok) throw new Error(created.reason === "plan" ? "Plan limit reached" : created.reason === "guest-limit" ? "Sign in to create another file" : `Could not create file (${created.reason})`);
386
386
  await useEditorStore.getState().openDocument(created.docId);
@@ -540,7 +540,7 @@ if (typeof window !== "undefined") {
540
540
  const name = d.name || "Imported";
541
541
  void (async () => {
542
542
  try {
543
- const { importViaPlugin, applyPluginLayoutIr } = await import("./plugin-import-JW4RKYOO.js");
543
+ const { importViaPlugin, applyPluginLayoutIr } = await import("./plugin-import-GCL6XI6R.js");
544
544
  if (d.ir && typeof d.ir === "object") {
545
545
  await applyPluginLayoutIr(d.ir, { mode, name });
546
546
  return;
@@ -8,7 +8,7 @@ import {
8
8
  needsSelection,
9
9
  pageGo,
10
10
  selectionIsPicture
11
- } from "./chunk-Z2MTSNIE.js";
11
+ } from "./chunk-NZZVIBR6.js";
12
12
  import {
13
13
  external_exports
14
14
  } from "./chunk-AX2KIQW3.js";
@@ -31,7 +31,7 @@ var none = external_exports.object({});
31
31
  var emit = (name, detail) => {
32
32
  if (typeof window !== "undefined") window.dispatchEvent(new CustomEvent(name, { detail }));
33
33
  };
34
- var store = () => import("./editor-store-YFGN57WA.js").then((m) => m.useEditorStore.getState());
34
+ var store = () => import("./editor-store-FEIOZB4Q.js").then((m) => m.useEditorStore.getState());
35
35
  var MODE_IDS = MODE_LIST.map((m) => m.id);
36
36
  var MODE_ALIASES = { JAM: "POPCORN" };
37
37
  var modeSet = defineCommand({
@@ -167,7 +167,7 @@ var dialogOpen = defineCommand({
167
167
  (await import("./plan-limit-J5GJLLSV.js")).openPlanDialog();
168
168
  break;
169
169
  case "credits":
170
- await (await import("./buy-credits-M4ESEIRV.js")).buyAiCredits();
170
+ await (await import("./buy-credits-QUB7IW4X.js")).buyAiCredits();
171
171
  break;
172
172
  case "tokens":
173
173
  emit("popcraft-open-tokens");
@@ -213,7 +213,7 @@ var aiOpen = defineCommand({
213
213
  ] } },
214
214
  run: async ({ dialog, skillId }) => {
215
215
  if (dialog) (await import("./client-store-SHEZJ52Z.js")).openAiDialog(dialog);
216
- else (await import("./store-KQA72SRV.js")).openAgentPanel({ skillId: skillId ?? null });
216
+ else (await import("./store-XQSIY777.js")).openAgentPanel({ skillId: skillId ?? null });
217
217
  return { summary: dialog ? `Opened AI ${dialog}` : "Opened the agent" };
218
218
  }
219
219
  });
@@ -292,11 +292,11 @@ var toolPlace = defineCommand({
292
292
  run: async ({ what }) => {
293
293
  if (what === "media") {
294
294
  const s = await store();
295
- const { placeMediaFromPicker } = await import("./media-tool-VBA4APYJ.js");
295
+ const { placeMediaFromPicker } = await import("./media-tool-2E2IPYDH.js");
296
296
  await placeMediaFromPicker({ kind: "point", x: s.camera.x, y: s.camera.y });
297
297
  return { summary: "Placing media" };
298
298
  }
299
- const { beginEyedrop } = await import("./eyedropper-RT7VFF4I.js");
299
+ const { beginEyedrop } = await import("./eyedropper-CBEEPFMO.js");
300
300
  void beginEyedrop();
301
301
  return { summary: "Pick a color" };
302
302
  }
@@ -314,7 +314,7 @@ var nodeRasterize = defineCommand({
314
314
  keywords: ["rasterize", "raster", "flatten", "pixels", "paint layer", "erase", "bitmap"]
315
315
  } },
316
316
  run: async () => {
317
- const { flattenSelectionToPaintLayer } = await import("./raster-actions-THFED73I.js");
317
+ const { flattenSelectionToPaintLayer } = await import("./raster-actions-MMWG6SUD.js");
318
318
  await flattenSelectionToPaintLayer();
319
319
  return { summary: "Rasterized" };
320
320
  }
@@ -425,7 +425,7 @@ function pluginCommand(plugins) {
425
425
  params: external_exports.object({ pluginId: external_exports.string(), commandId: external_exports.string() }),
426
426
  expose: { ui: { label: "Run plugin", keywords: ["plugin", "extension", "run"], variants, palette: variants.length ? void 0 : false } },
427
427
  run: async ({ pluginId, commandId }) => {
428
- await (await import("./host-4R6JNGCA.js")).runPlugin(pluginId, commandId);
428
+ await (await import("./host-DLDZDU67.js")).runPlugin(pluginId, commandId);
429
429
  return { summary: "Plugin started" };
430
430
  }
431
431
  });
@@ -91,9 +91,9 @@ async function placeStockPhoto(photo, opts = {}) {
91
91
  }
92
92
  async function placePicture(imported, opts = {}) {
93
93
  const [{ useEditorStore }, { photoFrameOf }, { placeImage }] = await Promise.all([
94
- import("./editor-store-YFGN57WA.js"),
94
+ import("./editor-store-FEIOZB4Q.js"),
95
95
  import("../lib/document/photo-frames.js"),
96
- import("./media-tool-VBA4APYJ.js")
96
+ import("./media-tool-2E2IPYDH.js")
97
97
  ]);
98
98
  const st = useEditorStore.getState();
99
99
  const frame = photoFrameOf(st.document.nodes, opts.targetId !== void 0 ? opts.targetId : st.selection[0] ?? null);
@@ -4579,7 +4579,7 @@ function createPopcornSlice(set2, get2) {
4579
4579
  privateMode: false,
4580
4580
  setPrivateMode: (on) => {
4581
4581
  set2({ privateMode: on });
4582
- void import("./presence-7PCBRAQ6.js").then((m) => m.setPresencePrivate(on)).catch(() => {
4582
+ void import("./presence-XLFPN565.js").then((m) => m.setPresencePrivate(on)).catch(() => {
4583
4583
  });
4584
4584
  },
4585
4585
  /** Reveal every private item THIS user created (they sync to collaborators). Others' stay theirs. */
@@ -6632,7 +6632,7 @@ var useEditorStore = create()(
6632
6632
  // A copy is a new file, so it is cloud-backed like any other (see lib/client/cloud/new-file.ts).
6633
6633
  // Returns '' when it was refused (offline, signed out, plan full) or failed; nothing is left behind.
6634
6634
  duplicateDocument: async (id) => {
6635
- const { duplicateDocumentToCloud } = await import("./sync-W5N4AOWZ.js");
6635
+ const { duplicateDocumentToCloud } = await import("./sync-B5K7ODIH.js");
6636
6636
  return duplicateDocumentToCloud(id);
6637
6637
  },
6638
6638
  deleteDocument: async (id) => {
@@ -10084,9 +10084,9 @@ if (typeof window !== "undefined") {
10084
10084
  if (typeof window !== "undefined" && navigator.webdriver) {
10085
10085
  window.__vpDesign = async (script, o = {}) => {
10086
10086
  const [{ registerBuiltinTools, runTool }, { editorToolContext }, { createDesignPreview }] = await Promise.all([
10087
- import("./tools-5GGJFQCU.js").then(async (m) => ({ ...m, registerBuiltinTools: (await import("./builtin-O4KTOKBA.js")).registerBuiltinTools })),
10088
- import("./editor-seams-ELICUY4D.js"),
10089
- import("./live-XLEAXHIJ.js")
10087
+ import("./tools-RTEMMKZ3.js").then(async (m) => ({ ...m, registerBuiltinTools: (await import("./builtin-AA5TFW3X.js")).registerBuiltinTools })),
10088
+ import("./editor-seams-SSDVF5EG.js"),
10089
+ import("./live-QJUP4B2I.js")
10090
10090
  ]);
10091
10091
  registerBuiltinTools();
10092
10092
  const args = JSON.stringify({ ...o.name ? { name: o.name } : {}, ...o.size ? { size: o.size } : {}, ...o.frame ? { frame: o.frame } : {}, script });
@@ -0,0 +1,45 @@
1
+ import { createRequire as __popcraftRequire } from 'node:module';
2
+ import { fileURLToPath as __popcraftPath } from 'node:url';
3
+ import { dirname as __popcraftDirname } from 'node:path';
4
+ const require = __popcraftRequire(import.meta.url);
5
+ const __filename = __popcraftPath(import.meta.url);
6
+ const __dirname = __popcraftDirname(__filename);
7
+ import {
8
+ api
9
+ } from "./chunk-SXZWSY3K.js";
10
+ import {
11
+ require_react
12
+ } from "./chunk-VUHKDNL4.js";
13
+ import {
14
+ init_define_POPCRAFT_COMPONENT_IDS
15
+ } from "./chunk-SRMWT24M.js";
16
+ import {
17
+ __toESM
18
+ } from "./chunk-LJSVREWM.js";
19
+
20
+ // lib/client/cloud/entitlements.ts
21
+ init_define_POPCRAFT_COMPONENT_IDS();
22
+ var import_react = __toESM(require_react());
23
+ var TTL_MS = 3e4;
24
+ var cache = /* @__PURE__ */ new Map();
25
+ var lastResolved = null;
26
+ var cachedLimits = () => lastResolved?.limits ?? null;
27
+ function loadEntitlements(workspaceId, opts = {}) {
28
+ const hit = cache.get(workspaceId);
29
+ if (hit && !opts.fresh && Date.now() - hit.at < TTL_MS) return hit.value;
30
+ const value = api(`/api/billing/entitlements${workspaceId ? `?${new URLSearchParams({ workspaceId })}` : ""}`);
31
+ void value.then((e) => {
32
+ lastResolved = e;
33
+ }, () => {
34
+ });
35
+ cache.set(workspaceId, { at: Date.now(), value });
36
+ value.catch(() => {
37
+ if (cache.get(workspaceId)?.value === value) cache.delete(workspaceId);
38
+ });
39
+ return value;
40
+ }
41
+
42
+ export {
43
+ cachedLimits,
44
+ loadEntitlements
45
+ };