@popcraft/kit 0.53.1 → 0.53.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 (77) hide show
  1. package/dist/chunks/{agent-B4XH7FCC.js → agent-DVKYZ5MR.js} +1 -1
  2. package/dist/chunks/{builtin-3TWJNRDI.js → builtin-VDSMLZXH.js} +5 -3
  3. package/dist/chunks/{buy-credits-VZ2J2SR7.js → buy-credits-424PQFK4.js} +2 -2
  4. package/dist/chunks/{check-template-GMNQVCCI.js → check-template-E5WVEJ54.js} +4 -2
  5. package/dist/chunks/{chunk-SMF4YIFH.js → chunk-3OXHJA4W.js} +1 -1
  6. package/dist/chunks/{chunk-U3PY5BWW.js → chunk-4SD7TX7R.js} +11 -11
  7. package/dist/chunks/{chunk-MYCQCAXZ.js → chunk-4SPJEVG6.js} +4 -4
  8. package/dist/chunks/{chunk-YHQGAEC5.js → chunk-524RSKF3.js} +1 -1
  9. package/dist/chunks/{chunk-5JMMBP5Q.js → chunk-5SVFCWRP.js} +60 -101
  10. package/dist/chunks/{chunk-P5HF37GX.js → chunk-6HQI4NQA.js} +2 -2
  11. package/dist/chunks/{chunk-GNNRFMXK.js → chunk-777OZHEF.js} +9 -9
  12. package/dist/chunks/{chunk-DBGETMUH.js → chunk-7IH7U6KU.js} +4 -4
  13. package/dist/chunks/{chunk-UDUHQLOJ.js → chunk-AEVF4O3X.js} +2 -2
  14. package/dist/chunks/{chunk-MJMCMLHB.js → chunk-BKRXB4FD.js} +1 -1
  15. package/dist/chunks/{chunk-UNJ2Y726.js → chunk-FJSJT5ZM.js} +4 -4
  16. package/dist/chunks/{chunk-Z557VFSN.js → chunk-FMWUXVVS.js} +1 -1
  17. package/dist/chunks/{chunk-XMO6D5A2.js → chunk-GUGOVTVN.js} +55 -7
  18. package/dist/chunks/{chunk-IROVLB4V.js → chunk-HS4CR6HU.js} +19 -5
  19. package/dist/chunks/{chunk-XJFTD3EZ.js → chunk-JOUHQ5HK.js} +1 -1
  20. package/dist/chunks/{chunk-7CNZ5HLR.js → chunk-MQ73SYLV.js} +4 -4
  21. package/dist/chunks/{chunk-NPTJQ2AF.js → chunk-NBFZY6QK.js} +1 -1
  22. package/dist/chunks/{chunk-AJPYEZRT.js → chunk-NQPNGZ3C.js} +2 -2
  23. package/dist/chunks/{chunk-D7XGMFYM.js → chunk-ODM6DFGO.js} +4 -4
  24. package/dist/chunks/{chunk-U54RHZSX.js → chunk-OE2LGHLL.js} +3 -3
  25. package/dist/chunks/chunk-OLQTCVWP.js +92 -0
  26. package/dist/chunks/{chunk-T4FFRJAH.js → chunk-OWWBFGCR.js} +3 -3
  27. package/dist/chunks/{chunk-TCPSVZN3.js → chunk-Q23DL77U.js} +5 -5
  28. package/dist/chunks/{chunk-UT6GKZJF.js → chunk-UPLMAXNQ.js} +1 -1
  29. package/dist/chunks/{chunk-5ICU2TQ2.js → chunk-VYWXAGEE.js} +8 -8
  30. package/dist/chunks/{chunk-KPKVF2TA.js → chunk-W5KNQERV.js} +2 -2
  31. package/dist/chunks/{chunk-DFY5UNVM.js → chunk-ZLHMVVTT.js} +45 -5
  32. package/dist/chunks/{chunk-7XP5CWQO.js → chunk-ZPETEA54.js} +183 -71
  33. package/dist/chunks/{client-DNVGPZXT.js → client-2L4XUPQN.js} +1 -1
  34. package/dist/chunks/{client-SE7SVRWK.js → client-6XOD422W.js} +2 -2
  35. package/dist/chunks/{client-77HZDECD.js → client-NOHRL7S3.js} +3 -3
  36. package/dist/chunks/{client-actions-UNYIWTLI.js → client-actions-K54NVVVW.js} +13 -12
  37. package/dist/chunks/{dangerous-WMMPM5TV.js → dangerous-4QU6QUOD.js} +5 -3
  38. package/dist/chunks/{delete-current-file-WB6ZWMBO.js → delete-current-file-RMINS2BA.js} +7 -6
  39. package/dist/chunks/{editor-seams-AZ2NUX6J.js → editor-seams-SW67BCBW.js} +18 -17
  40. package/dist/chunks/{editor-store-TPVGGNLW.js → editor-store-WPRQJL2A.js} +5 -5
  41. package/dist/chunks/{export-PGMO7YEU.js → export-ILWWIDBI.js} +1 -1
  42. package/dist/chunks/{export-watermark-UGGZ5TX6.js → export-watermark-2QVKO7OR.js} +7 -6
  43. package/dist/chunks/{eyedropper-HPK6A4PE.js → eyedropper-WCIR6LL5.js} +3 -2
  44. package/dist/chunks/{generate-media-Y6MB3ENV.js → generate-media-WCNTS5OY.js} +4 -4
  45. package/dist/chunks/{host-FNER4M32.js → host-GLRRFC2S.js} +12 -11
  46. package/dist/chunks/{integrations-LPVAVUUV.js → integrations-5I6DGN6S.js} +1 -1
  47. package/dist/chunks/{libraries-I6J7YJQE.js → libraries-INCBCGOZ.js} +7 -6
  48. package/dist/chunks/{live-ZRJ2GT3E.js → live-SGBLJFAC.js} +3 -2
  49. package/dist/chunks/{lottie-CBQTJRYU.js → lottie-ZWAKIFY2.js} +4 -4
  50. package/dist/chunks/{media-tool-LTK46STY.js → media-tool-KSXO2AAJ.js} +4 -3
  51. package/dist/chunks/{new-file-XH7E3IEZ.js → new-file-56ACDQ35.js} +5 -4
  52. package/dist/chunks/{pdf-NHOWFQ66.js → pdf-HK3GJ6QP.js} +3 -3
  53. package/dist/chunks/{player-check-4LAIMR3H.js → player-check-3HTULNTP.js} +4 -4
  54. package/dist/chunks/{plugin-LAZVW4F4.js → plugin-GJXXN4UQ.js} +4 -2
  55. package/dist/chunks/{plugin-import-P4PD76X3.js → plugin-import-N2J7NVET.js} +23 -22
  56. package/dist/chunks/{pptx-LHJRZA42.js → pptx-O7RRDHAR.js} +2 -2
  57. package/dist/chunks/{presence-WSPF6N32.js → presence-S6FAMSP4.js} +4 -3
  58. package/dist/chunks/{project-M3KF66GG.js → project-IH23X2UG.js} +3 -3
  59. package/dist/chunks/{publish-site-PUHKHZF4.js → publish-site-7YFHE7PV.js} +8 -7
  60. package/dist/chunks/{publish-store-PZMIV6LJ.js → publish-store-I3NKMHZK.js} +5 -5
  61. package/dist/chunks/{raster-actions-NS2NSYLC.js → raster-actions-PRMIAQQ7.js} +3 -2
  62. package/dist/chunks/{reference-images-CYSRQG7A.js → reference-images-TAWHPRYN.js} +2 -2
  63. package/dist/chunks/{resolvers-BQ5WXLUC.js → resolvers-UTQHZ6ET.js} +5 -5
  64. package/dist/chunks/{runner-PGFSW23U.js → runner-OVYUXA4W.js} +30 -24
  65. package/dist/chunks/{store-BXDDRMK7.js → store-BYSDY5PO.js} +14 -13
  66. package/dist/chunks/{storefront-prepare-EXR7OIWW.js → storefront-prepare-6IUMZTCQ.js} +1 -1
  67. package/dist/chunks/{svg-export-J2YVV3WM.js → svg-export-LMGINUQK.js} +5 -5
  68. package/dist/chunks/{svg-place-ZAG7VYF6.js → svg-place-LWB4XU2O.js} +2 -1
  69. package/dist/chunks/{sync-4AHF7NWR.js → sync-TFB3VWFP.js} +7 -6
  70. package/dist/chunks/{tabs-KFQNMNUM.js → tabs-CNE4XGIM.js} +10 -9
  71. package/dist/chunks/{team-QUBELR4W.js → team-DFOKEFOE.js} +1 -1
  72. package/dist/chunks/{team-client-NCOTLKC5.js → team-client-QHRXYUPI.js} +1 -1
  73. package/dist/chunks/{tools-T5XCKKCW.js → tools-YDR7QIHQ.js} +4 -2
  74. package/dist/chunks/{ui-commands-77JZN35K.js → ui-commands-HB4FFFXA.js} +20 -19
  75. package/dist/chunks/{versions-5HYBXUPA.js → versions-G4PGAFLF.js} +7 -6
  76. package/dist/index.js +1 -1
  77. package/package.json +1 -1
@@ -18,7 +18,7 @@ import {
18
18
  renderDocument,
19
19
  toolView,
20
20
  underReviewKit
21
- } from "./chunk-UNJ2Y726.js";
21
+ } from "./chunk-FJSJT5ZM.js";
22
22
  import "./chunk-ZYK65XJJ.js";
23
23
  import "./chunk-CEVTHE4E.js";
24
24
  import "./chunk-OQZFD4BD.js";
@@ -7,8 +7,8 @@ const __dirname = __popcraftDirname(__filename);
7
7
  import {
8
8
  builtinTools,
9
9
  registerBuiltinTools
10
- } from "./chunk-P5HF37GX.js";
11
- import "./chunk-7XP5CWQO.js";
10
+ } from "./chunk-6HQI4NQA.js";
11
+ import "./chunk-ZPETEA54.js";
12
12
  import "./chunk-ZLWN6LBH.js";
13
13
  import "./chunk-Q7EITIAT.js";
14
14
  import "./chunk-X36CCQ76.js";
@@ -19,7 +19,7 @@ import "./chunk-A6XXXQQO.js";
19
19
  import "./chunk-ATSLWELA.js";
20
20
  import "./chunk-6B6ULEDJ.js";
21
21
  import "./chunk-VOOUF5TT.js";
22
- import "./chunk-UNJ2Y726.js";
22
+ import "./chunk-FJSJT5ZM.js";
23
23
  import "./chunk-ZYK65XJJ.js";
24
24
  import "./chunk-4LOAHKDJ.js";
25
25
  import "./chunk-UCNBKWJQ.js";
@@ -28,6 +28,7 @@ import "./chunk-YZKSEJHZ.js";
28
28
  import "./chunk-YD7Z3PGN.js";
29
29
  import "./chunk-3DMEPFEZ.js";
30
30
  import "./chunk-ZWKNYWUL.js";
31
+ import "./chunk-OLQTCVWP.js";
31
32
  import "./chunk-EOPTDAPJ.js";
32
33
  import "./chunk-R5O3E5HI.js";
33
34
  import "./chunk-CEVTHE4E.js";
@@ -43,6 +44,7 @@ import "./chunk-ZWGSFZFE.js";
43
44
  import "./chunk-PLHJR3CN.js";
44
45
  import "./chunk-RK3HJC3E.js";
45
46
  import "./chunk-A54HJQ6T.js";
47
+ import "./chunk-7DATU5VX.js";
46
48
  import "./chunk-6YZC5UXW.js";
47
49
  import "./chunk-E66ZNPHF.js";
48
50
  import "./chunk-INZZZ5M6.js";
@@ -7,11 +7,11 @@ const __dirname = __popcraftDirname(__filename);
7
7
  import {
8
8
  HYPERY_TEAM_HEADER,
9
9
  hyperyRequestHeaders
10
- } from "./chunk-UT6GKZJF.js";
10
+ } from "./chunk-UPLMAXNQ.js";
11
11
  import "./chunk-7SMURRFY.js";
12
12
  import {
13
13
  useHyperyTeam
14
- } from "./chunk-Z557VFSN.js";
14
+ } from "./chunk-FMWUXVVS.js";
15
15
  import {
16
16
  ApiError,
17
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-GNNRFMXK.js";
9
+ } from "./chunk-777OZHEF.js";
10
10
  import {
11
11
  builtinCommands
12
- } from "./chunk-7XP5CWQO.js";
12
+ } from "./chunk-ZPETEA54.js";
13
13
  import "./chunk-ZLWN6LBH.js";
14
14
  import "./chunk-Q7EITIAT.js";
15
15
  import "./chunk-X36CCQ76.js";
@@ -36,6 +36,7 @@ import "./chunk-3DMEPFEZ.js";
36
36
  import "./chunk-OZJ7KASI.js";
37
37
  import "./chunk-ZWKNYWUL.js";
38
38
  import "./chunk-VXB34VXD.js";
39
+ import "./chunk-OLQTCVWP.js";
39
40
  import "./chunk-EOPTDAPJ.js";
40
41
  import "./chunk-R5O3E5HI.js";
41
42
  import "./chunk-OQZFD4BD.js";
@@ -56,6 +57,7 @@ import {
56
57
  } from "./chunk-PLHJR3CN.js";
57
58
  import "./chunk-RK3HJC3E.js";
58
59
  import "./chunk-A54HJQ6T.js";
60
+ import "./chunk-7DATU5VX.js";
59
61
  import {
60
62
  fontDir,
61
63
  repoRoot
@@ -6,7 +6,7 @@ const __filename = __popcraftPath(import.meta.url);
6
6
  const __dirname = __popcraftDirname(__filename);
7
7
  import {
8
8
  encodeImageData
9
- } from "./chunk-U54RHZSX.js";
9
+ } from "./chunk-OE2LGHLL.js";
10
10
  import {
11
11
  selectionWorldBounds
12
12
  } from "./chunk-R5O3E5HI.js";
@@ -6,14 +6,14 @@ const __filename = __popcraftPath(import.meta.url);
6
6
  const __dirname = __popcraftDirname(__filename);
7
7
  import {
8
8
  pluginRun
9
- } from "./chunk-7CNZ5HLR.js";
9
+ } from "./chunk-MQ73SYLV.js";
10
10
  import {
11
11
  fileCommands,
12
12
  fontTeamRemove,
13
13
  integrationConfirmCommands,
14
14
  mediaDelete,
15
15
  publishCommands
16
- } from "./chunk-7XP5CWQO.js";
16
+ } from "./chunk-ZPETEA54.js";
17
17
  import {
18
18
  external_exports
19
19
  } from "./chunk-VOOUF5TT.js";
@@ -53,7 +53,7 @@ var collabSetSpotlight = defineCommand({
53
53
  }
54
54
  },
55
55
  run: async ({ on }, ctx) => {
56
- const { setSpotlight } = await import("./presence-WSPF6N32.js");
56
+ const { setSpotlight } = await import("./presence-S6FAMSP4.js");
57
57
  setSpotlight(on);
58
58
  ctx.notice(on ? "Spotlight on \u2014 everyone is following this view." : "Spotlight off.");
59
59
  return { summary: on ? "Spotlight on" : "Spotlight off", data: { spotlight: on } };
@@ -80,7 +80,7 @@ var collabRevealPrivate = defineCommand({
80
80
  }
81
81
  },
82
82
  run: async (_p, ctx) => {
83
- const { useEditorStore } = await import("./editor-store-TPVGGNLW.js");
83
+ const { useEditorStore } = await import("./editor-store-WPRQJL2A.js");
84
84
  const before = Object.values(useEditorStore.getState().document.nodes).filter((n) => n.privateTo).length;
85
85
  useEditorStore.getState().revealPrivate();
86
86
  ctx.notice(before ? `Revealed ${before} private item${before === 1 ? "" : "s"}.` : "Nothing was private.");
@@ -144,7 +144,7 @@ var documentDelete = defineCommand({
144
144
  }
145
145
  },
146
146
  run: async ({ id }, ctx) => {
147
- const { useEditorStore } = await import("./editor-store-TPVGGNLW.js");
147
+ const { useEditorStore } = await import("./editor-store-WPRQJL2A.js");
148
148
  const wasOpen = useEditorStore.getState().document.id === id;
149
149
  await useEditorStore.getState().deleteDocument(id);
150
150
  ctx.notice("Deleted the document.");
@@ -188,7 +188,7 @@ var libraryPublish = defineCommand({
188
188
  }
189
189
  },
190
190
  run: async (p, ctx) => {
191
- const { publishLibrary } = await import("./libraries-I6J7YJQE.js");
191
+ const { publishLibrary } = await import("./libraries-INCBCGOZ.js");
192
192
  const doc = ctx.doc();
193
193
  const pick = {
194
194
  componentIds: p.componentIds ?? Object.keys(doc.components ?? {}),
@@ -220,7 +220,7 @@ var libraryUnpublish = defineCommand({
220
220
  },
221
221
  run: async ({ libraryId }, ctx) => {
222
222
  if (!libraryId.trim()) throw new CommandError("Which library? Pass its `libraryId`.", "invalid_params");
223
- const { unpublishLibrary } = await import("./libraries-I6J7YJQE.js");
223
+ const { unpublishLibrary } = await import("./libraries-INCBCGOZ.js");
224
224
  await unpublishLibrary(libraryId);
225
225
  ctx.notice(`Unpublished library ${libraryId}.`);
226
226
  return { summary: `Unpublished library ${libraryId}`, data: { libraryId, unpublished: true } };
@@ -232,8 +232,8 @@ var libraryCommands = [libraryPublish, libraryUnpublish];
232
232
  init_define_POPCRAFT_COMPONENT_IDS();
233
233
  async function findVersion(id) {
234
234
  const [{ useEditorStore }, { versionLabel }] = await Promise.all([
235
- import("./editor-store-TPVGGNLW.js"),
236
- import("./versions-5HYBXUPA.js")
235
+ import("./editor-store-WPRQJL2A.js"),
236
+ import("./versions-G4PGAFLF.js")
237
237
  ]);
238
238
  const meta = useEditorStore.getState().versions.find((v) => v.id === id);
239
239
  if (!meta) {
@@ -266,7 +266,7 @@ var versionRestore = defineCommand({
266
266
  },
267
267
  run: async ({ id }) => {
268
268
  const found = await findVersion(id);
269
- const { restoreVersion } = await import("./versions-5HYBXUPA.js");
269
+ const { restoreVersion } = await import("./versions-G4PGAFLF.js");
270
270
  await restoreVersion(found.meta);
271
271
  return { summary: `Restored \u201C${found.label}\u201D`, data: { id, label: found.label, restored: true } };
272
272
  }
@@ -291,7 +291,7 @@ var versionDelete = defineCommand({
291
291
  },
292
292
  run: async ({ id }, ctx) => {
293
293
  const found = await findVersion(id);
294
- const { deleteVersion } = await import("./versions-5HYBXUPA.js");
294
+ const { deleteVersion } = await import("./versions-G4PGAFLF.js");
295
295
  await deleteVersion(found.meta);
296
296
  ctx.notice(`Deleted the version \u201C${found.label}\u201D.`);
297
297
  return { summary: `Deleted the version \u201C${found.label}\u201D`, data: { id, label: found.label, deleted: true } };
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-LRF3JAZW.js";
10
10
  import {
11
11
  notice
12
- } from "./chunk-TCPSVZN3.js";
12
+ } from "./chunk-Q23DL77U.js";
13
13
  import {
14
14
  effectiveChatModel,
15
15
  setModelPref,
@@ -17,7 +17,7 @@ import {
17
17
  } from "./chunk-A4CGHVJP.js";
18
18
  import {
19
19
  useEditorStore
20
- } from "./chunk-5JMMBP5Q.js";
20
+ } from "./chunk-5SVFCWRP.js";
21
21
  import {
22
22
  create
23
23
  } from "./chunk-QLJLPV5R.js";
@@ -1797,7 +1797,7 @@ async function sendMessage(text) {
1797
1797
  if (!useAgentStore.getState().activeThreadId) newThread();
1798
1798
  const mentions = pruneMentions(body, useAgentStore.getState().draftMentions);
1799
1799
  useAgentStore.setState({ draft: "", draftMentions: [], error: null });
1800
- const { runTurn } = await import("./runner-PGFSW23U.js");
1800
+ const { runTurn } = await import("./runner-OVYUXA4W.js");
1801
1801
  await runTurn(body, mentions);
1802
1802
  }
1803
1803
  function stop() {
@@ -1900,7 +1900,7 @@ var clearTaskChildren = () => useAgentStore.setState({ taskChildren: {} });
1900
1900
  function subscribeChildTools() {
1901
1901
  let dispose;
1902
1902
  let cancelled = false;
1903
- void import("./runner-PGFSW23U.js").then(({ onChildTool }) => {
1903
+ void import("./runner-OVYUXA4W.js").then(({ onChildTool }) => {
1904
1904
  const off = onChildTool((report) => {
1905
1905
  if (report?.status !== "running" || report.jobId) return;
1906
1906
  recordChildTool(report.toolCallId ?? "", report.name);
@@ -6,7 +6,7 @@ const __filename = __popcraftPath(import.meta.url);
6
6
  const __dirname = __popcraftDirname(__filename);
7
7
  import {
8
8
  hyperyRequestHeaders
9
- } from "./chunk-UT6GKZJF.js";
9
+ } from "./chunk-UPLMAXNQ.js";
10
10
  import {
11
11
  aiAvailability,
12
12
  effectiveChatModel,
@@ -34,6 +34,11 @@ import {
34
34
  spanOf,
35
35
  stopsOf
36
36
  } from "./chunk-VXB34VXD.js";
37
+ import {
38
+ rebuildVectorData,
39
+ scaleSubtreePatches,
40
+ scaleVectorPaths
41
+ } from "./chunk-OLQTCVWP.js";
37
42
  import {
38
43
  hrefOf,
39
44
  opensNewTab,
@@ -55,8 +60,9 @@ import {
55
60
  } from "./chunk-BNQZIEZX.js";
56
61
  import {
57
62
  computeBooleanMultiPoly,
63
+ nonzeroMultiPoly,
58
64
  require_polygon_clipping_cjs
59
- } from "./chunk-XMO6D5A2.js";
65
+ } from "./chunk-GUGOVTVN.js";
60
66
  import {
61
67
  selectionWorldBounds
62
68
  } from "./chunk-R5O3E5HI.js";
@@ -2303,8 +2309,15 @@ function nodeWorldMultiPoly(doc, id) {
2303
2309
  return mp.map((poly) => poly.map((ring) => ring.map(([x, y]) => place(x, y))));
2304
2310
  }
2305
2311
  const rings = nodeWorldRings(doc, id);
2306
- const mode = node.type === "VECTOR" && node.fillRule === "EVENODD" ? "xor" : "union";
2307
- return combineRings(rings, mode);
2312
+ if (node.type === "VECTOR") {
2313
+ if (node.fillRule === "EVENODD") return combineRings(rings, "xor");
2314
+ try {
2315
+ return nonzeroMultiPoly(rings);
2316
+ } catch {
2317
+ return combineRings(rings, "union");
2318
+ }
2319
+ }
2320
+ return combineRings(rings, "union");
2308
2321
  }
2309
2322
  function nodeAreaMultiPoly(doc, id) {
2310
2323
  if (!doc.nodes[id]) return [];
@@ -2314,10 +2327,20 @@ function nodeAreaMultiPoly(doc, id) {
2314
2327
  }
2315
2328
  function flattenNodesMultiPoly(doc, ids) {
2316
2329
  const operands = [];
2317
- for (const id of ids) {
2318
- const mp = nodeAreaMultiPoly(doc, id);
2319
- if (mp.length > 0) operands.push(mp);
2320
- }
2330
+ const visit = (id) => {
2331
+ const n = doc.nodes[id];
2332
+ if (!n || n.visible === false) return;
2333
+ if (n.type !== "GROUP") {
2334
+ const mp = n.type === "FRAME" || n.type === "COMPONENT" || n.type === "INSTANCE" || n.type === "SECTION" ? (n.fills ?? []).some((f) => f.visible !== false) ? nodeWorldMultiPoly(doc, id) : [] : nodeAreaMultiPoly(doc, id);
2335
+ if (mp.length > 0) operands.push(mp);
2336
+ }
2337
+ if (n.type !== "BOOLEAN") for (const c of n.childIds ?? []) visit(c);
2338
+ };
2339
+ ids.forEach(visit);
2340
+ return unionAll(operands);
2341
+ }
2342
+ function unionAll(mps) {
2343
+ const operands = mps.filter((mp) => mp.length > 0);
2321
2344
  if (operands.length === 0) return [];
2322
2345
  try {
2323
2346
  return operands.length > 1 ? import_polygon_clipping2.default.union(operands[0], ...operands.slice(1)) : operands[0];
@@ -4588,7 +4611,7 @@ function createPopcornSlice(set2, get2) {
4588
4611
  privateMode: false,
4589
4612
  setPrivateMode: (on) => {
4590
4613
  set2({ privateMode: on });
4591
- void import("./presence-WSPF6N32.js").then((m) => m.setPresencePrivate(on)).catch(() => {
4614
+ void import("./presence-S6FAMSP4.js").then((m) => m.setPresencePrivate(on)).catch(() => {
4592
4615
  });
4593
4616
  },
4594
4617
  /** Reveal every private item THIS user created (they sync to collaborators). Others' stay theirs. */
@@ -4976,25 +4999,6 @@ function resolveTipStamp(dyn) {
4976
4999
  }
4977
5000
  if (typeof window !== "undefined") window.__vpTipStamp = getTipStamp;
4978
5001
 
4979
- // lib/document/scale-geometry.ts
4980
- init_define_POPCRAFT_COMPONENT_IDS();
4981
- var scalePoint = (p, sx, sy) => ({
4982
- ...p,
4983
- x: p.x * sx,
4984
- y: p.y * sy,
4985
- // Bezier handles live in the same space as the point and have to scale with it, or a stretched curve
4986
- // keeps its original curvature and bulges out of the shape.
4987
- handleIn: p.handleIn ? { x: p.handleIn.x * sx, y: p.handleIn.y * sy } : void 0,
4988
- handleOut: p.handleOut ? { x: p.handleOut.x * sx, y: p.handleOut.y * sy } : void 0
4989
- });
4990
- function scaleVectorPaths(paths, sx, sy, rebuild) {
4991
- if (!paths?.length || sx === 1 && sy === 1) return paths;
4992
- return paths.map((path) => {
4993
- const points = path.points.map((p) => scalePoint(p, sx, sy));
4994
- return { ...path, points, data: rebuild(points, path.closed) };
4995
- });
4996
- }
4997
-
4998
5002
  // lib/editor/viewport.ts
4999
5003
  init_define_POPCRAFT_COMPONENT_IDS();
5000
5004
  var size = null;
@@ -6652,7 +6656,7 @@ var useEditorStore = create()(
6652
6656
  // A copy is a new file, so it is cloud-backed like any other (see lib/client/cloud/new-file.ts).
6653
6657
  // Returns '' when it was refused (offline, signed out, plan full) or failed; nothing is left behind.
6654
6658
  duplicateDocument: async (id) => {
6655
- const { duplicateDocumentToCloud } = await import("./sync-4AHF7NWR.js");
6659
+ const { duplicateDocumentToCloud } = await import("./sync-TFB3VWFP.js");
6656
6660
  return duplicateDocumentToCloud(id);
6657
6661
  },
6658
6662
  deleteDocument: async (id) => {
@@ -7877,10 +7881,10 @@ var useEditorStore = create()(
7877
7881
  if ("childIds" in node && node.childIds.length > 0) {
7878
7882
  newDoc = applyConstraints(newDoc, id, node.width, node.height, newWidth, newHeight);
7879
7883
  }
7880
- if (node.type === "GROUP" && node.width > 0 && node.height > 0) {
7881
- const scaleX = newWidth / node.width;
7882
- const scaleY = newHeight / node.height;
7883
- newDoc = scaleChildrenRecursively(newDoc, id, scaleX, scaleY);
7884
+ if ((node.type === "GROUP" || node.type === "VECTOR") && node.width > 0 && node.height > 0) {
7885
+ for (const [pid, patch] of scaleSubtreePatches(newDoc.nodes, id, newWidth / node.width, newHeight / node.height)) {
7886
+ newDoc = updateNode(newDoc, pid, patch);
7887
+ }
7884
7888
  } else if (node.type === "TABLE" && node.width > 0 && node.height > 0) {
7885
7889
  const table = node;
7886
7890
  const totalW = (table.colWidths || []).reduce((a, b) => a + b, 0) || 1;
@@ -8889,23 +8893,35 @@ var useEditorStore = create()(
8889
8893
  const geo = multiPolyToVectorGeometry(mp);
8890
8894
  if (!geo) return;
8891
8895
  const first = doc.nodes[state.selection[0]];
8896
+ const firstFills = (id) => {
8897
+ const n = doc.nodes[id];
8898
+ if (!n) return void 0;
8899
+ if (n.fills?.length && n.type !== "GROUP") return n.fills;
8900
+ for (const c of n.childIds ?? []) {
8901
+ const f = firstFills(c);
8902
+ if (f) return f;
8903
+ }
8904
+ return void 0;
8905
+ };
8906
+ const fills = state.selection.map(firstFills).find(Boolean);
8892
8907
  const vectorNode = createVector({
8893
8908
  ...geo,
8894
- fills: first?.fills?.length ? first.fills : [{ type: "SOLID", color: { r: 0.85, g: 0.85, b: 0.85, a: 1 }, visible: true }],
8909
+ fills: fills ?? [{ type: "SOLID", color: { r: 0.85, g: 0.85, b: 0.85, a: 1 }, visible: true }],
8895
8910
  strokes: [],
8896
8911
  fillRule: "EVENODD",
8897
8912
  name: state.selection.length > 1 ? "Flattened" : `${first?.name ?? "Vector"} (flattened)`
8898
8913
  });
8899
8914
  doc = addNode(doc, vectorNode, state.currentPageId);
8915
+ const parentId = first?.parentId;
8916
+ if (parentId && parentId !== state.currentPageId && doc.nodes[parentId]) {
8917
+ const placed2 = placementUnder(doc, vectorNode.id, parentId);
8918
+ if (placed2) doc = reparentNode(updateNode(doc, vectorNode.id, placed2), vectorNode.id, parentId);
8919
+ }
8900
8920
  state.selection.forEach((id) => {
8901
8921
  if (doc.nodes[id]) doc = removeNode(doc, id);
8902
8922
  });
8903
- const command = createCommand("FLATTEN", "Flatten selection", documentBefore, doc);
8904
- set2({
8905
- document: doc,
8906
- history: pushCommand(state.history, command),
8907
- selection: [vectorNode.id]
8908
- });
8923
+ if (documentBefore !== doc) get2().commitDocument(doc, "Flatten selection");
8924
+ set2({ selection: [vectorNode.id] });
8909
8925
  },
8910
8926
  joinPaths: () => {
8911
8927
  const state = get2();
@@ -10115,9 +10131,9 @@ if (typeof window !== "undefined") {
10115
10131
  if (typeof window !== "undefined" && navigator.webdriver) {
10116
10132
  window.__vpDesign = async (script, o = {}) => {
10117
10133
  const [{ registerBuiltinTools, runTool }, { editorToolContext }, { createDesignPreview }] = await Promise.all([
10118
- import("./tools-T5XCKKCW.js").then(async (m) => ({ ...m, registerBuiltinTools: (await import("./builtin-3TWJNRDI.js")).registerBuiltinTools })),
10119
- import("./editor-seams-AZ2NUX6J.js"),
10120
- import("./live-ZRJ2GT3E.js")
10134
+ import("./tools-YDR7QIHQ.js").then(async (m) => ({ ...m, registerBuiltinTools: (await import("./builtin-VDSMLZXH.js")).registerBuiltinTools })),
10135
+ import("./editor-seams-SW67BCBW.js"),
10136
+ import("./live-SGBLJFAC.js")
10121
10137
  ]);
10122
10138
  registerBuiltinTools();
10123
10139
  const args = JSON.stringify({ ...o.name ? { name: o.name } : {}, ...o.size ? { size: o.size } : {}, ...o.frame ? { frame: o.frame } : {}, script });
@@ -10174,7 +10190,7 @@ if (typeof window !== "undefined" && navigator.webdriver) {
10174
10190
  return { type, width: spec.width, height: spec.height, b64: btoa(bin) };
10175
10191
  };
10176
10192
  window.__vpLottieCheck = async (what, at) => {
10177
- const [{ lottieCheckFrames }, { getActiveRenderer: getActiveRenderer2 }] = await Promise.all([import("./player-check-4LAIMR3H.js"), import("./renderer-registry-JWAJEHL4.js")]);
10193
+ const [{ lottieCheckFrames }, { getActiveRenderer: getActiveRenderer2 }] = await Promise.all([import("./player-check-3HTULNTP.js"), import("./renderer-registry-JWAJEHL4.js")]);
10178
10194
  const renderer = getActiveRenderer2();
10179
10195
  if (!renderer) throw new Error("no renderer on this route");
10180
10196
  const doc = useEditorStore.getState().document;
@@ -10215,37 +10231,6 @@ if (typeof window !== "undefined" && navigator.webdriver) {
10215
10231
  return Object.keys(doc.nodes).length;
10216
10232
  };
10217
10233
  }
10218
- function rebuildVectorData(points, closed) {
10219
- if (points.length < 2) return [];
10220
- const data = [];
10221
- data.push("M", points[0].x, points[0].y);
10222
- for (let i = 1; i < points.length; i++) {
10223
- const prev = points[i - 1];
10224
- const curr = points[i];
10225
- if (prev.handleOut && curr.handleIn) {
10226
- data.push("C", prev.handleOut.x, prev.handleOut.y, curr.handleIn.x, curr.handleIn.y, curr.x, curr.y);
10227
- } else if (prev.handleOut) {
10228
- data.push("Q", prev.handleOut.x, prev.handleOut.y, curr.x, curr.y);
10229
- } else if (curr.handleIn) {
10230
- data.push("Q", curr.handleIn.x, curr.handleIn.y, curr.x, curr.y);
10231
- } else {
10232
- data.push("L", curr.x, curr.y);
10233
- }
10234
- }
10235
- if (closed) {
10236
- const prev = points[points.length - 1];
10237
- const curr = points[0];
10238
- if (prev.handleOut && curr.handleIn) {
10239
- data.push("C", prev.handleOut.x, prev.handleOut.y, curr.handleIn.x, curr.handleIn.y, curr.x, curr.y);
10240
- } else if (prev.handleOut) {
10241
- data.push("Q", prev.handleOut.x, prev.handleOut.y, curr.x, curr.y);
10242
- } else if (curr.handleIn) {
10243
- data.push("Q", curr.handleIn.x, curr.handleIn.y, curr.x, curr.y);
10244
- }
10245
- data.push("Z");
10246
- }
10247
- return data;
10248
- }
10249
10234
  function fixCorruptedVectors(doc) {
10250
10235
  let changed = false;
10251
10236
  const newNodes = { ...doc.nodes };
@@ -10402,30 +10387,6 @@ function recoverPointsFromData(data) {
10402
10387
  }
10403
10388
  return points;
10404
10389
  }
10405
- function scaleChildrenRecursively(doc, parentId, scaleX, scaleY) {
10406
- const parent = doc.nodes[parentId];
10407
- if (!parent || !parent.childIds) return doc;
10408
- const newDoc = { ...doc, nodes: { ...doc.nodes } };
10409
- const processNode = (nodeId) => {
10410
- const node = newDoc.nodes[nodeId];
10411
- if (!node) return;
10412
- const updates = {
10413
- x: node.x * scaleX,
10414
- y: node.y * scaleY,
10415
- width: node.width * scaleX,
10416
- height: node.height * scaleY
10417
- };
10418
- if (node.type === "TEXT") {
10419
- updates.fontSize = (node.fontSize ?? 16) * Math.min(scaleX, scaleY);
10420
- }
10421
- newDoc.nodes[nodeId] = { ...node, ...updates };
10422
- if (node.childIds) {
10423
- node.childIds.forEach(processNode);
10424
- }
10425
- };
10426
- parent.childIds.forEach(processNode);
10427
- return newDoc;
10428
- }
10429
10390
  if (typeof module !== "undefined") module.hot?.decline();
10430
10391
  function placeInstance(document2, mainComponentId, pageId, x, y) {
10431
10392
  const main = document2.nodes[mainComponentId];
@@ -10455,13 +10416,11 @@ export {
10455
10416
  tabPrefsOnly,
10456
10417
  MAX_OPEN_NODES,
10457
10418
  useEditorStore,
10458
- rebuildVectorData,
10459
10419
  useSelection,
10460
10420
  useActiveTool,
10461
10421
  useCamera,
10462
10422
  useCurrentPageId,
10463
10423
  useDocument,
10464
10424
  useMode,
10465
- recoverPointsFromData,
10466
- scaleChildrenRecursively
10425
+ recoverPointsFromData
10467
10426
  };
@@ -7,10 +7,10 @@ const __dirname = __popcraftDirname(__filename);
7
7
  import {
8
8
  builtinCommands,
9
9
  registerBuiltinCommands
10
- } from "./chunk-7XP5CWQO.js";
10
+ } from "./chunk-ZPETEA54.js";
11
11
  import {
12
12
  toolView
13
- } from "./chunk-UNJ2Y726.js";
13
+ } from "./chunk-FJSJT5ZM.js";
14
14
  import {
15
15
  init_define_POPCRAFT_COMPONENT_IDS
16
16
  } from "./chunk-WKDVCZ45.js";
@@ -8,7 +8,7 @@ import {
8
8
  needsSelection,
9
9
  pageGo,
10
10
  selectionIsPicture
11
- } from "./chunk-7XP5CWQO.js";
11
+ } from "./chunk-ZPETEA54.js";
12
12
  import {
13
13
  external_exports
14
14
  } from "./chunk-VOOUF5TT.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-TPVGGNLW.js").then((m) => m.useEditorStore.getState());
34
+ var store = () => import("./editor-store-WPRQJL2A.js").then((m) => m.useEditorStore.getState());
35
35
  var MODE_IDS = MODE_LIST.map((m) => m.id);
36
36
  var MODE_ALIASES = { JAM: "POPCORN", DEV: "VIEW" };
37
37
  var modeSet = defineCommand({
@@ -167,7 +167,7 @@ var dialogOpen = defineCommand({
167
167
  (await import("./plan-limit-YTIOM3WO.js")).openPlanDialog();
168
168
  break;
169
169
  case "credits":
170
- await (await import("./buy-credits-VZ2J2SR7.js")).buyAiCredits();
170
+ await (await import("./buy-credits-424PQFK4.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-3YCO6KV5.js")).openAiDialog(dialog);
216
- else (await import("./store-BXDDRMK7.js")).openAgentPanel({ skillId: skillId ?? null });
216
+ else (await import("./store-BYSDY5PO.js")).openAgentPanel({ skillId: skillId ?? null });
217
217
  return { summary: dialog ? `Opened AI ${dialog}` : "Opened the agent" };
218
218
  }
219
219
  });
@@ -226,7 +226,7 @@ var agentContinue = defineCommand({
226
226
  params: external_exports.object({}),
227
227
  expose: { ui: { label: "AI: Continue the agent\u2019s last turn", keywords: ["ai", "agent", "continue", "resume", "retry", "keep going"] } },
228
228
  run: async () => {
229
- const resumed = await (await import("./runner-PGFSW23U.js")).continueTurn();
229
+ const resumed = await (await import("./runner-OVYUXA4W.js")).continueTurn();
230
230
  return { summary: resumed ? "Continued the agent" : "Nothing to continue" };
231
231
  }
232
232
  });
@@ -305,11 +305,11 @@ var toolPlace = defineCommand({
305
305
  run: async ({ what }) => {
306
306
  if (what === "media") {
307
307
  const s = await store();
308
- const { placeMediaFromPicker } = await import("./media-tool-LTK46STY.js");
308
+ const { placeMediaFromPicker } = await import("./media-tool-KSXO2AAJ.js");
309
309
  await placeMediaFromPicker({ kind: "point", x: s.camera.x, y: s.camera.y });
310
310
  return { summary: "Placing media" };
311
311
  }
312
- const { beginEyedrop } = await import("./eyedropper-HPK6A4PE.js");
312
+ const { beginEyedrop } = await import("./eyedropper-WCIR6LL5.js");
313
313
  void beginEyedrop();
314
314
  return { summary: "Pick a color" };
315
315
  }
@@ -327,7 +327,7 @@ var nodeRasterize = defineCommand({
327
327
  keywords: ["rasterize", "raster", "flatten", "pixels", "paint layer", "erase", "bitmap"]
328
328
  } },
329
329
  run: async () => {
330
- const { flattenSelectionToPaintLayer } = await import("./raster-actions-NS2NSYLC.js");
330
+ const { flattenSelectionToPaintLayer } = await import("./raster-actions-PRMIAQQ7.js");
331
331
  await flattenSelectionToPaintLayer();
332
332
  return { summary: "Rasterized" };
333
333
  }
@@ -438,7 +438,7 @@ function pluginCommand(plugins) {
438
438
  params: external_exports.object({ pluginId: external_exports.string(), commandId: external_exports.string() }),
439
439
  expose: { ui: { label: "Run plugin", keywords: ["plugin", "extension", "run"], variants, palette: variants.length ? void 0 : false } },
440
440
  run: async ({ pluginId, commandId }) => {
441
- await (await import("./host-FNER4M32.js")).runPlugin(pluginId, commandId);
441
+ await (await import("./host-GLRRFC2S.js")).runPlugin(pluginId, commandId);
442
442
  return { summary: "Plugin started" };
443
443
  }
444
444
  });
@@ -16,14 +16,14 @@ import {
16
16
  reportOpenStage,
17
17
  setCloudLink,
18
18
  trackOpen
19
- } from "./chunk-KPKVF2TA.js";
19
+ } from "./chunk-W5KNQERV.js";
20
20
  import {
21
21
  parseDeepLink,
22
22
  withDeepLink
23
23
  } from "./chunk-EUF3VFBW.js";
24
24
  import {
25
25
  activeTeamWorkspaceId
26
- } from "./chunk-Z557VFSN.js";
26
+ } from "./chunk-FMWUXVVS.js";
27
27
  import {
28
28
  ApiError,
29
29
  api,
@@ -31,7 +31,7 @@ import {
31
31
  } from "./chunk-KWUXHRXD.js";
32
32
  import {
33
33
  attachPresence
34
- } from "./chunk-XJFTD3EZ.js";
34
+ } from "./chunk-JOUHQ5HK.js";
35
35
  import {
36
36
  isPersistableDocument,
37
37
  isUnsavedPlaceholder,
@@ -42,7 +42,7 @@ import {
42
42
  setCollabHistory,
43
43
  storedDocument,
44
44
  useEditorStore
45
- } from "./chunk-5JMMBP5Q.js";
45
+ } from "./chunk-5SVFCWRP.js";
46
46
  import {
47
47
  currentHistoryGroup
48
48
  } from "./chunk-76I6DIEM.js";
@@ -10,11 +10,11 @@ import {
10
10
  } from "./chunk-NPQT5C4A.js";
11
11
  import {
12
12
  walkNode
13
- } from "./chunk-MJMCMLHB.js";
13
+ } from "./chunk-BKRXB4FD.js";
14
14
  import {
15
15
  fittedRadii,
16
16
  vectorCmds
17
- } from "./chunk-NPTJQ2AF.js";
17
+ } from "./chunk-NBFZY6QK.js";
18
18
  import {
19
19
  strToU8,
20
20
  zipSync
@@ -18,7 +18,7 @@ import {
18
18
  ringsCmds,
19
19
  shapeCmds,
20
20
  vectorCmds
21
- } from "./chunk-NPTJQ2AF.js";
21
+ } from "./chunk-NBFZY6QK.js";
22
22
  import {
23
23
  strokeBehindFill
24
24
  } from "./chunk-YZKSEJHZ.js";