@measured/puck 0.21.0-canary.79a26849 → 0.21.0-canary.7c2f9283

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 (52) hide show
  1. package/dist/Editor-32UYWE6W.mjs +204 -0
  2. package/dist/Editor-IQP25PUX.css +404 -0
  3. package/dist/Render-3OV4N4MT.css +102 -0
  4. package/dist/Render-FXZX6NFH.mjs +55 -0
  5. package/dist/{walk-tree-CgWnYC1X.d.mts → actions-BkBoKAc5.d.mts} +226 -37
  6. package/dist/{walk-tree-CgWnYC1X.d.ts → actions-BkBoKAc5.d.ts} +226 -37
  7. package/dist/chunk-3VQHXASI.mjs +33 -0
  8. package/dist/chunk-6KNQXLQR.mjs +708 -0
  9. package/dist/chunk-AOEDIUVK.mjs +11 -0
  10. package/dist/{chunk-UABEUL66.mjs → chunk-FCCNEDWR.mjs} +6964 -7964
  11. package/dist/chunk-GVKHZNTR.mjs +53 -0
  12. package/dist/chunk-K562SEXI.mjs +1813 -0
  13. package/dist/chunk-KN3XDS7U.mjs +528 -0
  14. package/dist/chunk-M6W7YEVX.mjs +95 -0
  15. package/dist/chunk-MEL7FUSF.mjs +63 -0
  16. package/dist/chunk-NYGQH27S.mjs +445 -0
  17. package/dist/chunk-Q3TJ2VYO.mjs +436 -0
  18. package/dist/chunk-REWRIUGR.mjs +156 -0
  19. package/dist/chunk-V2IQTPPK.mjs +111 -0
  20. package/dist/chunk-V5I7CVLT.mjs +103 -0
  21. package/dist/chunk-Y2EFNT5P.mjs +108 -0
  22. package/dist/full-2GJTAAZE.css +301 -0
  23. package/dist/full-4OS3O57Y.mjs +93 -0
  24. package/dist/index-bqD1SEOb.d.mts +118 -0
  25. package/dist/index-lt1zf5WR.d.ts +118 -0
  26. package/dist/index.css +1032 -385
  27. package/dist/index.d.mts +115 -115
  28. package/dist/index.d.ts +115 -115
  29. package/dist/index.js +9636 -5416
  30. package/dist/index.mjs +34 -12
  31. package/dist/internal.d.mts +27 -0
  32. package/dist/internal.d.ts +27 -0
  33. package/dist/internal.js +927 -0
  34. package/dist/internal.mjs +13 -0
  35. package/dist/loaded-DCQVLO7I.mjs +57 -0
  36. package/dist/loaded-JGRO7BH7.mjs +57 -0
  37. package/dist/loaded-KKVJE5KH.mjs +60 -0
  38. package/dist/loaded-RVWBFK7L.css +87 -0
  39. package/dist/no-external.css +1121 -470
  40. package/dist/no-external.d.mts +19 -2
  41. package/dist/no-external.d.ts +19 -2
  42. package/dist/no-external.js +9639 -5416
  43. package/dist/no-external.mjs +36 -9
  44. package/dist/rsc.css +102 -0
  45. package/dist/rsc.d.mts +17 -2
  46. package/dist/rsc.d.ts +17 -2
  47. package/dist/rsc.js +547 -98
  48. package/dist/rsc.mjs +18 -9
  49. package/dist/walk-tree-CRRDqx6_.d.mts +29 -0
  50. package/dist/walk-tree-CS7sEpfG.d.ts +29 -0
  51. package/package.json +31 -4
  52. package/dist/chunk-JA7SEUEH.mjs +0 -966
@@ -0,0 +1,1813 @@
1
+ import {
2
+ createReducer,
3
+ generateId,
4
+ getItem,
5
+ makeStatePublic
6
+ } from "./chunk-KN3XDS7U.mjs";
7
+ import {
8
+ defaultAppState,
9
+ defaultViewports,
10
+ getChanged,
11
+ resolveComponentData
12
+ } from "./chunk-REWRIUGR.mjs";
13
+ import {
14
+ get_class_name_factory_default
15
+ } from "./chunk-Y2EFNT5P.mjs";
16
+ import {
17
+ walkAppState
18
+ } from "./chunk-Q3TJ2VYO.mjs";
19
+ import {
20
+ __async,
21
+ __objRest,
22
+ __spreadProps,
23
+ __spreadValues,
24
+ init_react_import
25
+ } from "./chunk-M6W7YEVX.mjs";
26
+
27
+ // ../../node_modules/lucide-react/dist/esm/icons/align-left.js
28
+ init_react_import();
29
+
30
+ // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
31
+ init_react_import();
32
+ import { forwardRef as forwardRef2, createElement as createElement2 } from "react";
33
+
34
+ // ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
35
+ init_react_import();
36
+ var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
37
+ var mergeClasses = (...classes) => classes.filter((className, index, array) => {
38
+ return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
39
+ }).join(" ").trim();
40
+
41
+ // ../../node_modules/lucide-react/dist/esm/Icon.js
42
+ init_react_import();
43
+ import { forwardRef, createElement } from "react";
44
+
45
+ // ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
46
+ init_react_import();
47
+ var defaultAttributes = {
48
+ xmlns: "http://www.w3.org/2000/svg",
49
+ width: 24,
50
+ height: 24,
51
+ viewBox: "0 0 24 24",
52
+ fill: "none",
53
+ stroke: "currentColor",
54
+ strokeWidth: 2,
55
+ strokeLinecap: "round",
56
+ strokeLinejoin: "round"
57
+ };
58
+
59
+ // ../../node_modules/lucide-react/dist/esm/Icon.js
60
+ var Icon = forwardRef(
61
+ (_a, ref) => {
62
+ var _b = _a, {
63
+ color = "currentColor",
64
+ size = 24,
65
+ strokeWidth = 2,
66
+ absoluteStrokeWidth,
67
+ className = "",
68
+ children,
69
+ iconNode
70
+ } = _b, rest = __objRest(_b, [
71
+ "color",
72
+ "size",
73
+ "strokeWidth",
74
+ "absoluteStrokeWidth",
75
+ "className",
76
+ "children",
77
+ "iconNode"
78
+ ]);
79
+ return createElement(
80
+ "svg",
81
+ __spreadValues(__spreadProps(__spreadValues({
82
+ ref
83
+ }, defaultAttributes), {
84
+ width: size,
85
+ height: size,
86
+ stroke: color,
87
+ strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
88
+ className: mergeClasses("lucide", className)
89
+ }), rest),
90
+ [
91
+ ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
92
+ ...Array.isArray(children) ? children : [children]
93
+ ]
94
+ );
95
+ }
96
+ );
97
+
98
+ // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
99
+ var createLucideIcon = (iconName, iconNode) => {
100
+ const Component = forwardRef2(
101
+ (_a, ref) => {
102
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
103
+ return createElement2(Icon, __spreadValues({
104
+ ref,
105
+ iconNode,
106
+ className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className)
107
+ }, props));
108
+ }
109
+ );
110
+ Component.displayName = `${iconName}`;
111
+ return Component;
112
+ };
113
+
114
+ // ../../node_modules/lucide-react/dist/esm/icons/align-left.js
115
+ var AlignLeft = createLucideIcon("AlignLeft", [
116
+ ["path", { d: "M15 12H3", key: "6jk70r" }],
117
+ ["path", { d: "M17 18H3", key: "1amg6g" }],
118
+ ["path", { d: "M21 6H3", key: "1jwq7v" }]
119
+ ]);
120
+
121
+ // ../../node_modules/lucide-react/dist/esm/icons/heading.js
122
+ init_react_import();
123
+ var Heading = createLucideIcon("Heading", [
124
+ ["path", { d: "M6 12h12", key: "8npq4p" }],
125
+ ["path", { d: "M6 20V4", key: "1w1bmo" }],
126
+ ["path", { d: "M18 20V4", key: "o2hl4u" }]
127
+ ]);
128
+
129
+ // ../../node_modules/lucide-react/dist/esm/icons/list.js
130
+ init_react_import();
131
+ var List = createLucideIcon("List", [
132
+ ["path", { d: "M3 12h.01", key: "nlz23k" }],
133
+ ["path", { d: "M3 18h.01", key: "1tta3j" }],
134
+ ["path", { d: "M3 6h.01", key: "1rqtza" }],
135
+ ["path", { d: "M8 12h13", key: "1za7za" }],
136
+ ["path", { d: "M8 18h13", key: "1lx6n3" }],
137
+ ["path", { d: "M8 6h13", key: "ik3vkj" }]
138
+ ]);
139
+
140
+ // ../../node_modules/lucide-react/dist/esm/lucide-react.js
141
+ init_react_import();
142
+
143
+ // ../../node_modules/lucide-react/dist/esm/icons/align-center.js
144
+ init_react_import();
145
+ var AlignCenter = createLucideIcon("AlignCenter", [
146
+ ["path", { d: "M17 12H7", key: "16if0g" }],
147
+ ["path", { d: "M19 18H5", key: "18s9l3" }],
148
+ ["path", { d: "M21 6H3", key: "1jwq7v" }]
149
+ ]);
150
+
151
+ // ../../node_modules/lucide-react/dist/esm/icons/align-justify.js
152
+ init_react_import();
153
+ var AlignJustify = createLucideIcon("AlignJustify", [
154
+ ["path", { d: "M3 12h18", key: "1i2n21" }],
155
+ ["path", { d: "M3 18h18", key: "1h113x" }],
156
+ ["path", { d: "M3 6h18", key: "d0wm0j" }]
157
+ ]);
158
+
159
+ // ../../node_modules/lucide-react/dist/esm/icons/align-right.js
160
+ init_react_import();
161
+ var AlignRight = createLucideIcon("AlignRight", [
162
+ ["path", { d: "M21 12H9", key: "dn1m92" }],
163
+ ["path", { d: "M21 18H7", key: "1ygte8" }],
164
+ ["path", { d: "M21 6H3", key: "1jwq7v" }]
165
+ ]);
166
+
167
+ // ../../node_modules/lucide-react/dist/esm/icons/bold.js
168
+ init_react_import();
169
+ var Bold = createLucideIcon("Bold", [
170
+ [
171
+ "path",
172
+ { d: "M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8", key: "mg9rjx" }
173
+ ]
174
+ ]);
175
+
176
+ // ../../node_modules/lucide-react/dist/esm/icons/chevron-down.js
177
+ init_react_import();
178
+ var ChevronDown = createLucideIcon("ChevronDown", [
179
+ ["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
180
+ ]);
181
+
182
+ // ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
183
+ init_react_import();
184
+ var ChevronRight = createLucideIcon("ChevronRight", [
185
+ ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
186
+ ]);
187
+
188
+ // ../../node_modules/lucide-react/dist/esm/icons/chevron-up.js
189
+ init_react_import();
190
+ var ChevronUp = createLucideIcon("ChevronUp", [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]]);
191
+
192
+ // ../../node_modules/lucide-react/dist/esm/icons/circle-check-big.js
193
+ init_react_import();
194
+ var CircleCheckBig = createLucideIcon("CircleCheckBig", [
195
+ ["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }],
196
+ ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }]
197
+ ]);
198
+
199
+ // ../../node_modules/lucide-react/dist/esm/icons/code.js
200
+ init_react_import();
201
+ var Code = createLucideIcon("Code", [
202
+ ["polyline", { points: "16 18 22 12 16 6", key: "z7tu5w" }],
203
+ ["polyline", { points: "8 6 2 12 8 18", key: "1eg1df" }]
204
+ ]);
205
+
206
+ // ../../node_modules/lucide-react/dist/esm/icons/copy.js
207
+ init_react_import();
208
+ var Copy = createLucideIcon("Copy", [
209
+ ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
210
+ ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
211
+ ]);
212
+
213
+ // ../../node_modules/lucide-react/dist/esm/icons/corner-left-up.js
214
+ init_react_import();
215
+ var CornerLeftUp = createLucideIcon("CornerLeftUp", [
216
+ ["polyline", { points: "14 9 9 4 4 9", key: "m9oyvo" }],
217
+ ["path", { d: "M20 20h-7a4 4 0 0 1-4-4V4", key: "1blwi3" }]
218
+ ]);
219
+
220
+ // ../../node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.js
221
+ init_react_import();
222
+ var EllipsisVertical = createLucideIcon("EllipsisVertical", [
223
+ ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
224
+ ["circle", { cx: "12", cy: "5", r: "1", key: "gxeob9" }],
225
+ ["circle", { cx: "12", cy: "19", r: "1", key: "lyex9k" }]
226
+ ]);
227
+
228
+ // ../../node_modules/lucide-react/dist/esm/icons/expand.js
229
+ init_react_import();
230
+ var Expand = createLucideIcon("Expand", [
231
+ ["path", { d: "m21 21-6-6m6 6v-4.8m0 4.8h-4.8", key: "1c15vz" }],
232
+ ["path", { d: "M3 16.2V21m0 0h4.8M3 21l6-6", key: "1fsnz2" }],
233
+ ["path", { d: "M21 7.8V3m0 0h-4.8M21 3l-6 6", key: "hawz9i" }],
234
+ ["path", { d: "M3 7.8V3m0 0h4.8M3 3l6 6", key: "u9ee12" }]
235
+ ]);
236
+
237
+ // ../../node_modules/lucide-react/dist/esm/icons/globe.js
238
+ init_react_import();
239
+ var Globe = createLucideIcon("Globe", [
240
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
241
+ ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
242
+ ["path", { d: "M2 12h20", key: "9i4pu4" }]
243
+ ]);
244
+
245
+ // ../../node_modules/lucide-react/dist/esm/icons/hammer.js
246
+ init_react_import();
247
+ var Hammer = createLucideIcon("Hammer", [
248
+ ["path", { d: "m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9", key: "eefl8a" }],
249
+ ["path", { d: "m18 15 4-4", key: "16gjal" }],
250
+ [
251
+ "path",
252
+ {
253
+ d: "m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",
254
+ key: "b7pghm"
255
+ }
256
+ ]
257
+ ]);
258
+
259
+ // ../../node_modules/lucide-react/dist/esm/icons/hash.js
260
+ init_react_import();
261
+ var Hash = createLucideIcon("Hash", [
262
+ ["line", { x1: "4", x2: "20", y1: "9", y2: "9", key: "4lhtct" }],
263
+ ["line", { x1: "4", x2: "20", y1: "15", y2: "15", key: "vyu0kd" }],
264
+ ["line", { x1: "10", x2: "8", y1: "3", y2: "21", key: "1ggp8o" }],
265
+ ["line", { x1: "16", x2: "14", y1: "3", y2: "21", key: "weycgp" }]
266
+ ]);
267
+
268
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-1.js
269
+ init_react_import();
270
+ var Heading1 = createLucideIcon("Heading1", [
271
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
272
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
273
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
274
+ ["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
275
+ ]);
276
+
277
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-2.js
278
+ init_react_import();
279
+ var Heading2 = createLucideIcon("Heading2", [
280
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
281
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
282
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
283
+ ["path", { d: "M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1", key: "9jr5yi" }]
284
+ ]);
285
+
286
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-3.js
287
+ init_react_import();
288
+ var Heading3 = createLucideIcon("Heading3", [
289
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
290
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
291
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
292
+ ["path", { d: "M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2", key: "68ncm8" }],
293
+ ["path", { d: "M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2", key: "1ejuhz" }]
294
+ ]);
295
+
296
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-4.js
297
+ init_react_import();
298
+ var Heading4 = createLucideIcon("Heading4", [
299
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
300
+ ["path", { d: "M17 10v3a1 1 0 0 0 1 1h3", key: "tj5zdr" }],
301
+ ["path", { d: "M21 10v8", key: "1kdml4" }],
302
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
303
+ ["path", { d: "M4 18V6", key: "1rz3zl" }]
304
+ ]);
305
+
306
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-5.js
307
+ init_react_import();
308
+ var Heading5 = createLucideIcon("Heading5", [
309
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
310
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
311
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
312
+ ["path", { d: "M17 13v-3h4", key: "1nvgqp" }],
313
+ [
314
+ "path",
315
+ { d: "M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17", key: "2nebdn" }
316
+ ]
317
+ ]);
318
+
319
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-6.js
320
+ init_react_import();
321
+ var Heading6 = createLucideIcon("Heading6", [
322
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
323
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
324
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
325
+ ["circle", { cx: "19", cy: "16", r: "2", key: "15mx69" }],
326
+ ["path", { d: "M20 10c-2 2-3 3.5-3 6", key: "f35dl0" }]
327
+ ]);
328
+
329
+ // ../../node_modules/lucide-react/dist/esm/icons/italic.js
330
+ init_react_import();
331
+ var Italic = createLucideIcon("Italic", [
332
+ ["line", { x1: "19", x2: "10", y1: "4", y2: "4", key: "15jd3p" }],
333
+ ["line", { x1: "14", x2: "5", y1: "20", y2: "20", key: "bu0au3" }],
334
+ ["line", { x1: "15", x2: "9", y1: "4", y2: "20", key: "uljnxc" }]
335
+ ]);
336
+
337
+ // ../../node_modules/lucide-react/dist/esm/icons/layers.js
338
+ init_react_import();
339
+ var Layers = createLucideIcon("Layers", [
340
+ [
341
+ "path",
342
+ {
343
+ d: "M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",
344
+ key: "zw3jo"
345
+ }
346
+ ],
347
+ [
348
+ "path",
349
+ {
350
+ d: "M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",
351
+ key: "1wduqc"
352
+ }
353
+ ],
354
+ [
355
+ "path",
356
+ {
357
+ d: "M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",
358
+ key: "kqbvx6"
359
+ }
360
+ ]
361
+ ]);
362
+
363
+ // ../../node_modules/lucide-react/dist/esm/icons/layout-grid.js
364
+ init_react_import();
365
+ var LayoutGrid = createLucideIcon("LayoutGrid", [
366
+ ["rect", { width: "7", height: "7", x: "3", y: "3", rx: "1", key: "1g98yp" }],
367
+ ["rect", { width: "7", height: "7", x: "14", y: "3", rx: "1", key: "6d4xhi" }],
368
+ ["rect", { width: "7", height: "7", x: "14", y: "14", rx: "1", key: "nxv5o0" }],
369
+ ["rect", { width: "7", height: "7", x: "3", y: "14", rx: "1", key: "1bb6yr" }]
370
+ ]);
371
+
372
+ // ../../node_modules/lucide-react/dist/esm/icons/link.js
373
+ init_react_import();
374
+ var Link = createLucideIcon("Link", [
375
+ ["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
376
+ ["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
377
+ ]);
378
+
379
+ // ../../node_modules/lucide-react/dist/esm/icons/list-ordered.js
380
+ init_react_import();
381
+ var ListOrdered = createLucideIcon("ListOrdered", [
382
+ ["path", { d: "M10 12h11", key: "6m4ad9" }],
383
+ ["path", { d: "M10 18h11", key: "11hvi2" }],
384
+ ["path", { d: "M10 6h11", key: "c7qv1k" }],
385
+ ["path", { d: "M4 10h2", key: "16xx2s" }],
386
+ ["path", { d: "M4 6h1v4", key: "cnovpq" }],
387
+ ["path", { d: "M6 18H4c0-1 2-2 2-3s-1-1.5-2-1", key: "m9a95d" }]
388
+ ]);
389
+
390
+ // ../../node_modules/lucide-react/dist/esm/icons/lock-open.js
391
+ init_react_import();
392
+ var LockOpen = createLucideIcon("LockOpen", [
393
+ ["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
394
+ ["path", { d: "M7 11V7a5 5 0 0 1 9.9-1", key: "1mm8w8" }]
395
+ ]);
396
+
397
+ // ../../node_modules/lucide-react/dist/esm/icons/lock.js
398
+ init_react_import();
399
+ var Lock = createLucideIcon("Lock", [
400
+ ["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
401
+ ["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
402
+ ]);
403
+
404
+ // ../../node_modules/lucide-react/dist/esm/icons/maximize-2.js
405
+ init_react_import();
406
+ var Maximize2 = createLucideIcon("Maximize2", [
407
+ ["polyline", { points: "15 3 21 3 21 9", key: "mznyad" }],
408
+ ["polyline", { points: "9 21 3 21 3 15", key: "1avn1i" }],
409
+ ["line", { x1: "21", x2: "14", y1: "3", y2: "10", key: "ota7mn" }],
410
+ ["line", { x1: "3", x2: "10", y1: "21", y2: "14", key: "1atl0r" }]
411
+ ]);
412
+
413
+ // ../../node_modules/lucide-react/dist/esm/icons/minimize-2.js
414
+ init_react_import();
415
+ var Minimize2 = createLucideIcon("Minimize2", [
416
+ ["polyline", { points: "4 14 10 14 10 20", key: "11kfnr" }],
417
+ ["polyline", { points: "20 10 14 10 14 4", key: "rlmsce" }],
418
+ ["line", { x1: "14", x2: "21", y1: "10", y2: "3", key: "o5lafz" }],
419
+ ["line", { x1: "3", x2: "10", y1: "21", y2: "14", key: "1atl0r" }]
420
+ ]);
421
+
422
+ // ../../node_modules/lucide-react/dist/esm/icons/minus.js
423
+ init_react_import();
424
+ var Minus = createLucideIcon("Minus", [["path", { d: "M5 12h14", key: "1ays0h" }]]);
425
+
426
+ // ../../node_modules/lucide-react/dist/esm/icons/monitor.js
427
+ init_react_import();
428
+ var Monitor = createLucideIcon("Monitor", [
429
+ ["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
430
+ ["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
431
+ ["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
432
+ ]);
433
+
434
+ // ../../node_modules/lucide-react/dist/esm/icons/panel-left.js
435
+ init_react_import();
436
+ var PanelLeft = createLucideIcon("PanelLeft", [
437
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
438
+ ["path", { d: "M9 3v18", key: "fh3hqa" }]
439
+ ]);
440
+
441
+ // ../../node_modules/lucide-react/dist/esm/icons/panel-right.js
442
+ init_react_import();
443
+ var PanelRight = createLucideIcon("PanelRight", [
444
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
445
+ ["path", { d: "M15 3v18", key: "14nvp0" }]
446
+ ]);
447
+
448
+ // ../../node_modules/lucide-react/dist/esm/icons/plus.js
449
+ init_react_import();
450
+ var Plus = createLucideIcon("Plus", [
451
+ ["path", { d: "M5 12h14", key: "1ays0h" }],
452
+ ["path", { d: "M12 5v14", key: "s699le" }]
453
+ ]);
454
+
455
+ // ../../node_modules/lucide-react/dist/esm/icons/quote.js
456
+ init_react_import();
457
+ var Quote = createLucideIcon("Quote", [
458
+ [
459
+ "path",
460
+ {
461
+ d: "M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
462
+ key: "rib7q0"
463
+ }
464
+ ],
465
+ [
466
+ "path",
467
+ {
468
+ d: "M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
469
+ key: "1ymkrd"
470
+ }
471
+ ]
472
+ ]);
473
+
474
+ // ../../node_modules/lucide-react/dist/esm/icons/rectangle-ellipsis.js
475
+ init_react_import();
476
+ var RectangleEllipsis = createLucideIcon("RectangleEllipsis", [
477
+ ["rect", { width: "20", height: "12", x: "2", y: "6", rx: "2", key: "9lu3g6" }],
478
+ ["path", { d: "M12 12h.01", key: "1mp3jc" }],
479
+ ["path", { d: "M17 12h.01", key: "1m0b6t" }],
480
+ ["path", { d: "M7 12h.01", key: "eqddd0" }]
481
+ ]);
482
+
483
+ // ../../node_modules/lucide-react/dist/esm/icons/redo-2.js
484
+ init_react_import();
485
+ var Redo2 = createLucideIcon("Redo2", [
486
+ ["path", { d: "m15 14 5-5-5-5", key: "12vg1m" }],
487
+ ["path", { d: "M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13", key: "6uklza" }]
488
+ ]);
489
+
490
+ // ../../node_modules/lucide-react/dist/esm/icons/search.js
491
+ init_react_import();
492
+ var Search = createLucideIcon("Search", [
493
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
494
+ ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
495
+ ]);
496
+
497
+ // ../../node_modules/lucide-react/dist/esm/icons/sliders-horizontal.js
498
+ init_react_import();
499
+ var SlidersHorizontal = createLucideIcon("SlidersHorizontal", [
500
+ ["line", { x1: "21", x2: "14", y1: "4", y2: "4", key: "obuewd" }],
501
+ ["line", { x1: "10", x2: "3", y1: "4", y2: "4", key: "1q6298" }],
502
+ ["line", { x1: "21", x2: "12", y1: "12", y2: "12", key: "1iu8h1" }],
503
+ ["line", { x1: "8", x2: "3", y1: "12", y2: "12", key: "ntss68" }],
504
+ ["line", { x1: "21", x2: "16", y1: "20", y2: "20", key: "14d8ph" }],
505
+ ["line", { x1: "12", x2: "3", y1: "20", y2: "20", key: "m0wm8r" }],
506
+ ["line", { x1: "14", x2: "14", y1: "2", y2: "6", key: "14e1ph" }],
507
+ ["line", { x1: "8", x2: "8", y1: "10", y2: "14", key: "1i6ji0" }],
508
+ ["line", { x1: "16", x2: "16", y1: "18", y2: "22", key: "1lctlv" }]
509
+ ]);
510
+
511
+ // ../../node_modules/lucide-react/dist/esm/icons/smartphone.js
512
+ init_react_import();
513
+ var Smartphone = createLucideIcon("Smartphone", [
514
+ ["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2", key: "1yt0o3" }],
515
+ ["path", { d: "M12 18h.01", key: "mhygvu" }]
516
+ ]);
517
+
518
+ // ../../node_modules/lucide-react/dist/esm/icons/square-code.js
519
+ init_react_import();
520
+ var SquareCode = createLucideIcon("SquareCode", [
521
+ ["path", { d: "M10 9.5 8 12l2 2.5", key: "3mjy60" }],
522
+ ["path", { d: "m14 9.5 2 2.5-2 2.5", key: "1bir2l" }],
523
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }]
524
+ ]);
525
+
526
+ // ../../node_modules/lucide-react/dist/esm/icons/strikethrough.js
527
+ init_react_import();
528
+ var Strikethrough = createLucideIcon("Strikethrough", [
529
+ ["path", { d: "M16 4H9a3 3 0 0 0-2.83 4", key: "43sutm" }],
530
+ ["path", { d: "M14 12a4 4 0 0 1 0 8H6", key: "nlfj13" }],
531
+ ["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }]
532
+ ]);
533
+
534
+ // ../../node_modules/lucide-react/dist/esm/icons/tablet.js
535
+ init_react_import();
536
+ var Tablet = createLucideIcon("Tablet", [
537
+ ["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
538
+ ["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
539
+ ]);
540
+
541
+ // ../../node_modules/lucide-react/dist/esm/icons/toy-brick.js
542
+ init_react_import();
543
+ var ToyBrick = createLucideIcon("ToyBrick", [
544
+ ["rect", { width: "18", height: "12", x: "3", y: "8", rx: "1", key: "158fvp" }],
545
+ ["path", { d: "M10 8V5c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v3", key: "s0042v" }],
546
+ ["path", { d: "M19 8V5c0-.6-.4-1-1-1h-3a1 1 0 0 0-1 1v3", key: "9wmeh2" }]
547
+ ]);
548
+
549
+ // ../../node_modules/lucide-react/dist/esm/icons/trash.js
550
+ init_react_import();
551
+ var Trash = createLucideIcon("Trash", [
552
+ ["path", { d: "M3 6h18", key: "d0wm0j" }],
553
+ ["path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", key: "4alrt4" }],
554
+ ["path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2", key: "v07s0e" }]
555
+ ]);
556
+
557
+ // ../../node_modules/lucide-react/dist/esm/icons/type.js
558
+ init_react_import();
559
+ var Type = createLucideIcon("Type", [
560
+ ["polyline", { points: "4 7 4 4 20 4 20 7", key: "1nosan" }],
561
+ ["line", { x1: "9", x2: "15", y1: "20", y2: "20", key: "swin9y" }],
562
+ ["line", { x1: "12", x2: "12", y1: "4", y2: "20", key: "1tx1rr" }]
563
+ ]);
564
+
565
+ // ../../node_modules/lucide-react/dist/esm/icons/underline.js
566
+ init_react_import();
567
+ var Underline = createLucideIcon("Underline", [
568
+ ["path", { d: "M6 4v6a6 6 0 0 0 12 0V4", key: "9kb039" }],
569
+ ["line", { x1: "4", x2: "20", y1: "20", y2: "20", key: "nun2al" }]
570
+ ]);
571
+
572
+ // ../../node_modules/lucide-react/dist/esm/icons/undo-2.js
573
+ init_react_import();
574
+ var Undo2 = createLucideIcon("Undo2", [
575
+ ["path", { d: "M9 14 4 9l5-5", key: "102s5s" }],
576
+ ["path", { d: "M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11", key: "f3b9sd" }]
577
+ ]);
578
+
579
+ // ../../node_modules/lucide-react/dist/esm/icons/x.js
580
+ init_react_import();
581
+ var X = createLucideIcon("X", [
582
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
583
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
584
+ ]);
585
+
586
+ // ../../node_modules/lucide-react/dist/esm/icons/zoom-in.js
587
+ init_react_import();
588
+ var ZoomIn = createLucideIcon("ZoomIn", [
589
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
590
+ ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
591
+ ["line", { x1: "11", x2: "11", y1: "8", y2: "14", key: "1vmskp" }],
592
+ ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
593
+ ]);
594
+
595
+ // ../../node_modules/lucide-react/dist/esm/icons/zoom-out.js
596
+ init_react_import();
597
+ var ZoomOut = createLucideIcon("ZoomOut", [
598
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
599
+ ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
600
+ ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
601
+ ]);
602
+
603
+ // store/index.ts
604
+ init_react_import();
605
+ import { create as create2, useStore } from "zustand";
606
+ import { subscribeWithSelector as subscribeWithSelector2 } from "zustand/middleware";
607
+ import { createContext, useContext } from "react";
608
+
609
+ // store/slices/history.ts
610
+ init_react_import();
611
+ import { useEffect as useEffect2 } from "react";
612
+
613
+ // lib/use-hotkey.ts
614
+ init_react_import();
615
+ import { useEffect } from "react";
616
+ import { create } from "zustand";
617
+ import { subscribeWithSelector } from "zustand/middleware";
618
+ var keyCodeMap = {
619
+ ControlLeft: "ctrl",
620
+ ControlRight: "ctrl",
621
+ MetaLeft: "meta",
622
+ MetaRight: "meta",
623
+ ShiftLeft: "shift",
624
+ ShiftRight: "shift",
625
+ KeyA: "a",
626
+ KeyB: "b",
627
+ KeyC: "c",
628
+ KeyD: "d",
629
+ KeyE: "e",
630
+ KeyF: "f",
631
+ KeyG: "g",
632
+ KeyH: "h",
633
+ KeyI: "i",
634
+ KeyJ: "j",
635
+ KeyK: "k",
636
+ KeyL: "l",
637
+ KeyM: "m",
638
+ KeyN: "n",
639
+ KeyO: "o",
640
+ KeyP: "p",
641
+ KeyQ: "q",
642
+ KeyR: "r",
643
+ KeyS: "s",
644
+ KeyT: "t",
645
+ KeyU: "u",
646
+ KeyV: "v",
647
+ KeyW: "w",
648
+ KeyX: "x",
649
+ KeyY: "y",
650
+ KeyZ: "z",
651
+ Delete: "delete",
652
+ Backspace: "backspace"
653
+ };
654
+ var useHotkeyStore = create()(
655
+ subscribeWithSelector((set) => ({
656
+ held: {},
657
+ hold: (key) => set((s) => s.held[key] ? s : { held: __spreadProps(__spreadValues({}, s.held), { [key]: true }) }),
658
+ release: (key) => set((s) => s.held[key] ? { held: __spreadProps(__spreadValues({}, s.held), { [key]: false }) } : s),
659
+ reset: (held = {}) => set(() => ({ held })),
660
+ triggers: {}
661
+ }))
662
+ );
663
+ var monitorHotkeys = (doc) => {
664
+ const onKeyDown = (e) => {
665
+ const key = keyCodeMap[e.code];
666
+ if (key) {
667
+ useHotkeyStore.getState().hold(key);
668
+ const { held, triggers } = useHotkeyStore.getState();
669
+ Object.values(triggers).forEach(({ combo, cb }) => {
670
+ const conditionMet = Object.entries(combo).every(
671
+ ([key2, value]) => value === !!held[key2]
672
+ ) && Object.entries(held).every(
673
+ ([key2, value]) => value === !!combo[key2]
674
+ );
675
+ if (conditionMet) {
676
+ const handled = cb(e);
677
+ if (handled !== false) {
678
+ e.preventDefault();
679
+ }
680
+ }
681
+ });
682
+ if (key !== "meta" && key !== "ctrl" && key !== "shift") {
683
+ useHotkeyStore.getState().release(key);
684
+ }
685
+ }
686
+ };
687
+ const onKeyUp = (e) => {
688
+ const key = keyCodeMap[e.code];
689
+ if (key) {
690
+ if (key === "meta") {
691
+ useHotkeyStore.getState().reset();
692
+ } else {
693
+ useHotkeyStore.getState().release(key);
694
+ }
695
+ }
696
+ };
697
+ const onVisibilityChanged = (e) => {
698
+ if (document.visibilityState === "hidden") {
699
+ useHotkeyStore.getState().reset();
700
+ }
701
+ };
702
+ const onBlur = () => {
703
+ useHotkeyStore.getState().reset();
704
+ };
705
+ window.addEventListener("blur", onBlur);
706
+ doc.addEventListener("keydown", onKeyDown);
707
+ doc.addEventListener("keyup", onKeyUp);
708
+ doc.addEventListener("visibilitychange", onVisibilityChanged);
709
+ return () => {
710
+ doc.removeEventListener("keydown", onKeyDown);
711
+ doc.removeEventListener("keyup", onKeyUp);
712
+ doc.removeEventListener("visibilitychange", onVisibilityChanged);
713
+ window.removeEventListener("blur", onBlur);
714
+ };
715
+ };
716
+ var useMonitorHotkeys = () => {
717
+ useEffect(() => monitorHotkeys(document), []);
718
+ };
719
+ var useHotkey = (combo, cb) => {
720
+ useEffect(
721
+ () => useHotkeyStore.setState((s) => ({
722
+ triggers: __spreadProps(__spreadValues({}, s.triggers), {
723
+ [`${Object.keys(combo).join("+")}`]: { combo, cb }
724
+ })
725
+ })),
726
+ []
727
+ );
728
+ };
729
+
730
+ // store/slices/history.ts
731
+ var EMPTY_HISTORY_INDEX = 0;
732
+ function debounce(func, timeout = 300) {
733
+ let timer;
734
+ return (...args) => {
735
+ clearTimeout(timer);
736
+ timer = setTimeout(() => {
737
+ func(...args);
738
+ }, timeout);
739
+ };
740
+ }
741
+ var tidyState = (state) => {
742
+ return __spreadProps(__spreadValues({}, state), {
743
+ ui: __spreadProps(__spreadValues({}, state.ui), {
744
+ field: __spreadProps(__spreadValues({}, state.ui.field), {
745
+ focus: null
746
+ })
747
+ })
748
+ });
749
+ };
750
+ var createHistorySlice = (set, get) => {
751
+ const record = debounce((state) => {
752
+ const { histories, index } = get().history;
753
+ const history = {
754
+ state,
755
+ id: generateId("history")
756
+ };
757
+ const newHistories = [...histories.slice(0, index + 1), history];
758
+ set({
759
+ history: __spreadProps(__spreadValues({}, get().history), {
760
+ histories: newHistories,
761
+ index: newHistories.length - 1
762
+ })
763
+ });
764
+ }, 250);
765
+ return {
766
+ initialAppState: {},
767
+ index: EMPTY_HISTORY_INDEX,
768
+ histories: [],
769
+ hasPast: () => get().history.index > EMPTY_HISTORY_INDEX,
770
+ hasFuture: () => get().history.index < get().history.histories.length - 1,
771
+ prevHistory: () => {
772
+ const { history } = get();
773
+ return history.hasPast() ? history.histories[history.index - 1] : null;
774
+ },
775
+ nextHistory: () => {
776
+ const s = get().history;
777
+ return s.hasFuture() ? s.histories[s.index + 1] : null;
778
+ },
779
+ currentHistory: () => get().history.histories[get().history.index],
780
+ back: () => {
781
+ var _a;
782
+ const { history, dispatch } = get();
783
+ if (history.hasPast()) {
784
+ const state = tidyState(
785
+ ((_a = history.prevHistory()) == null ? void 0 : _a.state) || history.initialAppState
786
+ );
787
+ dispatch({
788
+ type: "set",
789
+ state
790
+ });
791
+ set({ history: __spreadProps(__spreadValues({}, history), { index: history.index - 1 }) });
792
+ }
793
+ },
794
+ forward: () => {
795
+ var _a;
796
+ const { history, dispatch } = get();
797
+ if (history.hasFuture()) {
798
+ const state = (_a = history.nextHistory()) == null ? void 0 : _a.state;
799
+ dispatch({ type: "set", state: state ? tidyState(state) : {} });
800
+ set({ history: __spreadProps(__spreadValues({}, history), { index: history.index + 1 }) });
801
+ }
802
+ },
803
+ setHistories: (histories) => {
804
+ var _a;
805
+ const { dispatch, history } = get();
806
+ dispatch({
807
+ type: "set",
808
+ state: ((_a = histories[histories.length - 1]) == null ? void 0 : _a.state) || history.initialAppState
809
+ });
810
+ set({ history: __spreadProps(__spreadValues({}, history), { histories, index: histories.length - 1 }) });
811
+ },
812
+ setHistoryIndex: (index) => {
813
+ var _a;
814
+ const { dispatch, history } = get();
815
+ dispatch({
816
+ type: "set",
817
+ state: ((_a = history.histories[index]) == null ? void 0 : _a.state) || history.initialAppState
818
+ });
819
+ set({ history: __spreadProps(__spreadValues({}, history), { index }) });
820
+ },
821
+ record
822
+ };
823
+ };
824
+ function useRegisterHistorySlice(appStore, {
825
+ histories,
826
+ index,
827
+ initialAppState
828
+ }) {
829
+ useEffect2(
830
+ () => appStore.setState({
831
+ history: __spreadProps(__spreadValues({}, appStore.getState().history), {
832
+ histories,
833
+ index,
834
+ initialAppState
835
+ })
836
+ }),
837
+ [histories, index, initialAppState]
838
+ );
839
+ const back = () => {
840
+ appStore.getState().history.back();
841
+ };
842
+ const forward = () => {
843
+ appStore.getState().history.forward();
844
+ };
845
+ useHotkey({ meta: true, z: true }, back);
846
+ useHotkey({ meta: true, shift: true, z: true }, forward);
847
+ useHotkey({ meta: true, y: true }, forward);
848
+ useHotkey({ ctrl: true, z: true }, back);
849
+ useHotkey({ ctrl: true, shift: true, z: true }, forward);
850
+ useHotkey({ ctrl: true, y: true }, forward);
851
+ }
852
+
853
+ // store/slices/nodes.ts
854
+ init_react_import();
855
+ var createNodesSlice = (set, get) => ({
856
+ nodes: {},
857
+ registerNode: (id, node) => {
858
+ const s = get().nodes;
859
+ const emptyNode = {
860
+ id,
861
+ methods: {
862
+ sync: () => null,
863
+ hideOverlay: () => null,
864
+ showOverlay: () => null
865
+ },
866
+ element: null
867
+ };
868
+ const existingNode = s.nodes[id];
869
+ set({
870
+ nodes: __spreadProps(__spreadValues({}, s), {
871
+ nodes: __spreadProps(__spreadValues({}, s.nodes), {
872
+ [id]: __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, emptyNode), existingNode), node), {
873
+ id
874
+ })
875
+ })
876
+ })
877
+ });
878
+ },
879
+ unregisterNode: (id) => {
880
+ const s = get().nodes;
881
+ const existingNode = s.nodes[id];
882
+ if (existingNode) {
883
+ const newNodes = __spreadValues({}, s.nodes);
884
+ delete newNodes[id];
885
+ set({
886
+ nodes: __spreadProps(__spreadValues({}, s), {
887
+ nodes: newNodes
888
+ })
889
+ });
890
+ }
891
+ }
892
+ });
893
+
894
+ // store/slices/permissions.ts
895
+ init_react_import();
896
+ import { useEffect as useEffect3 } from "react";
897
+
898
+ // lib/data/flatten-data.ts
899
+ init_react_import();
900
+ var flattenData = (state, config) => {
901
+ const data = [];
902
+ walkAppState(
903
+ state,
904
+ config,
905
+ (content) => content,
906
+ (item) => {
907
+ data.push(item);
908
+ return item;
909
+ }
910
+ );
911
+ return data;
912
+ };
913
+
914
+ // store/slices/permissions.ts
915
+ var createPermissionsSlice = (set, get) => {
916
+ const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
917
+ const { state, permissions, config } = get();
918
+ const { cache, globalPermissions } = permissions;
919
+ const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
920
+ var _a, _b;
921
+ const { config: config2, state: appState, setComponentLoading } = get();
922
+ const itemCache = cache[item2.props.id];
923
+ const nodes = appState.indexes.nodes;
924
+ const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
925
+ const parentNode = parentId ? nodes[parentId] : null;
926
+ const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
927
+ const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
928
+ if (!componentConfig) {
929
+ return;
930
+ }
931
+ const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
932
+ if (componentConfig.resolvePermissions) {
933
+ const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
934
+ const propsChanged = Object.values(changed).some((el) => el === true);
935
+ const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
936
+ if (propsChanged || parentChanged || force2) {
937
+ const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
938
+ const resolvedPermissions = yield componentConfig.resolvePermissions(
939
+ item2,
940
+ {
941
+ changed,
942
+ lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
943
+ permissions: initialPermissions,
944
+ appState: makeStatePublic(appState),
945
+ lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
946
+ parent: parentData
947
+ }
948
+ );
949
+ const latest = get().permissions;
950
+ set({
951
+ permissions: __spreadProps(__spreadValues({}, latest), {
952
+ cache: __spreadProps(__spreadValues({}, latest.cache), {
953
+ [item2.props.id]: {
954
+ lastParentId: parentId,
955
+ lastData: item2,
956
+ lastPermissions: resolvedPermissions
957
+ }
958
+ }),
959
+ resolvedPermissions: __spreadProps(__spreadValues({}, latest.resolvedPermissions), {
960
+ [item2.props.id]: resolvedPermissions
961
+ })
962
+ })
963
+ });
964
+ clearTimeout2();
965
+ }
966
+ }
967
+ });
968
+ const resolvePermissionsForRoot = (force2 = false) => {
969
+ const { state: appState } = get();
970
+ resolvePermissionsForItem(
971
+ // Shim the root data in by conforming to component data shape
972
+ {
973
+ type: "root",
974
+ props: __spreadProps(__spreadValues({}, appState.data.root.props), { id: "root" })
975
+ },
976
+ force2
977
+ );
978
+ };
979
+ const { item, type, root } = params;
980
+ if (item) {
981
+ yield resolvePermissionsForItem(item, force);
982
+ } else if (type) {
983
+ flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
984
+ yield resolvePermissionsForItem(item2, force);
985
+ }));
986
+ } else if (root) {
987
+ resolvePermissionsForRoot(force);
988
+ } else {
989
+ flattenData(state, config).map((item2) => __async(null, null, function* () {
990
+ yield resolvePermissionsForItem(item2, force);
991
+ }));
992
+ }
993
+ });
994
+ const refreshPermissions = (params) => resolvePermissions(params, true);
995
+ return {
996
+ cache: {},
997
+ globalPermissions: {
998
+ drag: true,
999
+ edit: true,
1000
+ delete: true,
1001
+ duplicate: true,
1002
+ insert: true
1003
+ },
1004
+ resolvedPermissions: {},
1005
+ getPermissions: ({ item, type, root } = {}) => {
1006
+ const { config, permissions } = get();
1007
+ const { globalPermissions, resolvedPermissions } = permissions;
1008
+ if (item) {
1009
+ const componentConfig = config.components[item.type];
1010
+ const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig == null ? void 0 : componentConfig.permissions);
1011
+ const resolvedForItem = resolvedPermissions[item.props.id];
1012
+ return resolvedForItem ? __spreadValues(__spreadValues({}, globalPermissions), resolvedForItem) : initialPermissions;
1013
+ } else if (type) {
1014
+ const componentConfig = config.components[type];
1015
+ return __spreadValues(__spreadValues({}, globalPermissions), componentConfig == null ? void 0 : componentConfig.permissions);
1016
+ } else if (root) {
1017
+ const rootConfig = config.root;
1018
+ const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), rootConfig == null ? void 0 : rootConfig.permissions);
1019
+ const resolvedForItem = resolvedPermissions["root"];
1020
+ return resolvedForItem ? __spreadValues(__spreadValues({}, globalPermissions), resolvedForItem) : initialPermissions;
1021
+ }
1022
+ return globalPermissions;
1023
+ },
1024
+ resolvePermissions,
1025
+ refreshPermissions
1026
+ };
1027
+ };
1028
+ var useRegisterPermissionsSlice = (appStore, globalPermissions) => {
1029
+ useEffect3(() => {
1030
+ const { permissions } = appStore.getState();
1031
+ const { globalPermissions: existingGlobalPermissions } = permissions;
1032
+ appStore.setState({
1033
+ permissions: __spreadProps(__spreadValues({}, permissions), {
1034
+ globalPermissions: __spreadValues(__spreadValues({}, existingGlobalPermissions), globalPermissions)
1035
+ })
1036
+ });
1037
+ permissions.resolvePermissions();
1038
+ }, [globalPermissions]);
1039
+ useEffect3(() => {
1040
+ return appStore.subscribe(
1041
+ (s) => s.state.data,
1042
+ () => {
1043
+ appStore.getState().permissions.resolvePermissions();
1044
+ }
1045
+ );
1046
+ }, []);
1047
+ useEffect3(() => {
1048
+ return appStore.subscribe(
1049
+ (s) => s.config,
1050
+ () => {
1051
+ appStore.getState().permissions.resolvePermissions();
1052
+ }
1053
+ );
1054
+ }, []);
1055
+ };
1056
+
1057
+ // store/slices/fields.ts
1058
+ init_react_import();
1059
+ import { useCallback, useEffect as useEffect4 } from "react";
1060
+ var createFieldsSlice = (_set, _get) => {
1061
+ return {
1062
+ fields: {},
1063
+ loading: false,
1064
+ lastResolvedData: {},
1065
+ id: void 0
1066
+ };
1067
+ };
1068
+ var useRegisterFieldsSlice = (appStore, id) => {
1069
+ const resolveFields = useCallback(
1070
+ (reset) => __async(null, null, function* () {
1071
+ var _a, _b;
1072
+ const { fields, lastResolvedData } = appStore.getState().fields;
1073
+ const metadata = appStore.getState().metadata;
1074
+ const nodes = appStore.getState().state.indexes.nodes;
1075
+ const node = nodes[id || "root"];
1076
+ const componentData = node == null ? void 0 : node.data;
1077
+ const parentNode = (node == null ? void 0 : node.parentId) ? nodes[node.parentId] : null;
1078
+ const parent = (parentNode == null ? void 0 : parentNode.data) || null;
1079
+ const { getComponentConfig, state } = appStore.getState();
1080
+ const componentConfig = getComponentConfig(componentData == null ? void 0 : componentData.type);
1081
+ if (!componentData || !componentConfig) return;
1082
+ const defaultFields = componentConfig.fields || {};
1083
+ const resolver = componentConfig.resolveFields;
1084
+ let lastFields = fields;
1085
+ if (reset) {
1086
+ appStore.setState((s) => ({
1087
+ fields: __spreadProps(__spreadValues({}, s.fields), { fields: defaultFields, id })
1088
+ }));
1089
+ lastFields = defaultFields;
1090
+ }
1091
+ if (resolver) {
1092
+ const timeout = setTimeout(() => {
1093
+ appStore.setState((s) => ({
1094
+ fields: __spreadProps(__spreadValues({}, s.fields), { loading: true })
1095
+ }));
1096
+ }, 50);
1097
+ const lastData = ((_a = lastResolvedData.props) == null ? void 0 : _a.id) === id ? lastResolvedData : null;
1098
+ const changed = getChanged(componentData, lastData);
1099
+ const newFields = yield resolver(componentData, {
1100
+ changed,
1101
+ fields: defaultFields,
1102
+ lastFields,
1103
+ metadata: __spreadValues(__spreadValues({}, metadata), componentConfig.metadata),
1104
+ lastData,
1105
+ appState: makeStatePublic(state),
1106
+ parent
1107
+ });
1108
+ clearTimeout(timeout);
1109
+ if (((_b = appStore.getState().selectedItem) == null ? void 0 : _b.props.id) !== id) {
1110
+ return;
1111
+ }
1112
+ appStore.setState({
1113
+ fields: {
1114
+ fields: newFields,
1115
+ loading: false,
1116
+ lastResolvedData: componentData,
1117
+ id
1118
+ }
1119
+ });
1120
+ } else {
1121
+ appStore.setState((s) => ({
1122
+ fields: __spreadProps(__spreadValues({}, s.fields), { fields: defaultFields, id })
1123
+ }));
1124
+ }
1125
+ }),
1126
+ [id]
1127
+ );
1128
+ useEffect4(() => {
1129
+ resolveFields(true);
1130
+ return appStore.subscribe(
1131
+ (s) => s.state.indexes.nodes[id || "root"],
1132
+ () => resolveFields()
1133
+ );
1134
+ }, [id]);
1135
+ };
1136
+
1137
+ // lib/data/to-root.ts
1138
+ init_react_import();
1139
+ var toRoot = (item) => {
1140
+ if ("type" in item && item.type !== "root") {
1141
+ throw new Error("Converting non-root item to root.");
1142
+ }
1143
+ const { readOnly } = item;
1144
+ if (item.props) {
1145
+ if ("id" in item.props) {
1146
+ const _a = item.props, { id } = _a, props = __objRest(_a, ["id"]);
1147
+ return { props, readOnly };
1148
+ }
1149
+ return { props: item.props, readOnly };
1150
+ }
1151
+ return { props: {}, readOnly };
1152
+ };
1153
+
1154
+ // store/index.ts
1155
+ var defaultPageFields = {
1156
+ title: { type: "text" }
1157
+ };
1158
+ var createAppStore = (initialAppStore) => create2()(
1159
+ subscribeWithSelector2((set, get) => {
1160
+ var _a, _b;
1161
+ return __spreadProps(__spreadValues({
1162
+ instanceId: generateId(),
1163
+ state: defaultAppState,
1164
+ config: { components: {} },
1165
+ componentState: {},
1166
+ plugins: [],
1167
+ overrides: {},
1168
+ viewports: defaultViewports,
1169
+ zoomConfig: {
1170
+ autoZoom: 1,
1171
+ rootHeight: 0,
1172
+ zoom: 1
1173
+ },
1174
+ status: "LOADING",
1175
+ iframe: {},
1176
+ metadata: {},
1177
+ fieldTransforms: {}
1178
+ }, initialAppStore), {
1179
+ fields: createFieldsSlice(set, get),
1180
+ history: createHistorySlice(set, get),
1181
+ nodes: createNodesSlice(set, get),
1182
+ permissions: createPermissionsSlice(set, get),
1183
+ getCurrentData: () => {
1184
+ var _a2;
1185
+ const s = get();
1186
+ return (_a2 = s.selectedItem) != null ? _a2 : s.state.data.root;
1187
+ },
1188
+ getComponentConfig: (type) => {
1189
+ var _a2;
1190
+ const { config, selectedItem } = get();
1191
+ const rootFields = ((_a2 = config.root) == null ? void 0 : _a2.fields) || defaultPageFields;
1192
+ return type && type !== "root" ? config.components[type] : selectedItem ? config.components[selectedItem.type] : __spreadProps(__spreadValues({}, config.root), { fields: rootFields });
1193
+ },
1194
+ selectedItem: ((_a = initialAppStore == null ? void 0 : initialAppStore.state) == null ? void 0 : _a.ui.itemSelector) ? getItem(
1195
+ (_b = initialAppStore == null ? void 0 : initialAppStore.state) == null ? void 0 : _b.ui.itemSelector,
1196
+ initialAppStore.state
1197
+ ) : null,
1198
+ dispatch: (action) => set((s) => {
1199
+ var _a2, _b2;
1200
+ const { record } = get().history;
1201
+ const dispatch = createReducer({
1202
+ record,
1203
+ appStore: s
1204
+ });
1205
+ const state = dispatch(s.state, action);
1206
+ const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
1207
+ (_b2 = (_a2 = get()).onAction) == null ? void 0 : _b2.call(_a2, action, state, get().state);
1208
+ return __spreadProps(__spreadValues({}, s), { state, selectedItem });
1209
+ }),
1210
+ setZoomConfig: (zoomConfig) => set({ zoomConfig }),
1211
+ setStatus: (status) => set({ status }),
1212
+ setComponentState: (componentState) => set({ componentState }),
1213
+ pendingLoadTimeouts: {},
1214
+ setComponentLoading: (id, loading = true, defer = 0) => {
1215
+ const { setComponentState, pendingLoadTimeouts } = get();
1216
+ const loadId = generateId();
1217
+ const setLoading = () => {
1218
+ var _a2;
1219
+ const { componentState } = get();
1220
+ setComponentState(__spreadProps(__spreadValues({}, componentState), {
1221
+ [id]: __spreadProps(__spreadValues({}, componentState[id]), {
1222
+ loadingCount: (((_a2 = componentState[id]) == null ? void 0 : _a2.loadingCount) || 0) + 1
1223
+ })
1224
+ }));
1225
+ };
1226
+ const unsetLoading = () => {
1227
+ var _a2;
1228
+ const { componentState } = get();
1229
+ clearTimeout(timeout);
1230
+ delete pendingLoadTimeouts[loadId];
1231
+ set({ pendingLoadTimeouts });
1232
+ setComponentState(__spreadProps(__spreadValues({}, componentState), {
1233
+ [id]: __spreadProps(__spreadValues({}, componentState[id]), {
1234
+ loadingCount: Math.max(
1235
+ (((_a2 = componentState[id]) == null ? void 0 : _a2.loadingCount) || 0) - 1,
1236
+ 0
1237
+ )
1238
+ })
1239
+ }));
1240
+ };
1241
+ const timeout = setTimeout(() => {
1242
+ if (loading) {
1243
+ setLoading();
1244
+ } else {
1245
+ unsetLoading();
1246
+ }
1247
+ delete pendingLoadTimeouts[loadId];
1248
+ set({ pendingLoadTimeouts });
1249
+ }, defer);
1250
+ set({
1251
+ pendingLoadTimeouts: __spreadProps(__spreadValues({}, pendingLoadTimeouts), {
1252
+ [id]: timeout
1253
+ })
1254
+ });
1255
+ return unsetLoading;
1256
+ },
1257
+ unsetComponentLoading: (id) => {
1258
+ const { setComponentLoading } = get();
1259
+ setComponentLoading(id, false);
1260
+ },
1261
+ // Helper
1262
+ setUi: (ui, recordHistory) => set((s) => {
1263
+ const dispatch = createReducer({
1264
+ record: () => {
1265
+ },
1266
+ appStore: s
1267
+ });
1268
+ const state = dispatch(s.state, {
1269
+ type: "setUi",
1270
+ ui,
1271
+ recordHistory
1272
+ });
1273
+ const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
1274
+ return __spreadProps(__spreadValues({}, s), { state, selectedItem });
1275
+ }),
1276
+ resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
1277
+ var _a2, _b2;
1278
+ const { config, metadata, setComponentLoading, permissions, state } = get();
1279
+ const componentId = "id" in componentData.props ? componentData.props.id : "root";
1280
+ const parentId = (_a2 = state.indexes.nodes[componentId]) == null ? void 0 : _a2.parentId;
1281
+ const parentNode = parentId ? state.indexes.nodes[parentId] : null;
1282
+ const parentData = (_b2 = parentNode == null ? void 0 : parentNode.data) != null ? _b2 : null;
1283
+ const timeouts = {};
1284
+ return yield resolveComponentData(
1285
+ componentData,
1286
+ config,
1287
+ metadata,
1288
+ (item) => {
1289
+ const id = "id" in item.props ? item.props.id : "root";
1290
+ timeouts[id] = setComponentLoading(id, true, 50);
1291
+ },
1292
+ (item) => __async(null, null, function* () {
1293
+ const id = "id" in item.props ? item.props.id : "root";
1294
+ if ("type" in item) {
1295
+ yield permissions.refreshPermissions({ item });
1296
+ } else {
1297
+ yield permissions.refreshPermissions({ root: true });
1298
+ }
1299
+ timeouts[id]();
1300
+ }),
1301
+ trigger,
1302
+ parentData
1303
+ );
1304
+ }),
1305
+ resolveAndCommitData: () => __async(null, null, function* () {
1306
+ const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
1307
+ walkAppState(
1308
+ state,
1309
+ config,
1310
+ (content) => content,
1311
+ (childItem) => {
1312
+ resolveComponentData2(childItem, "load").then((resolved) => {
1313
+ const { state: state2 } = get();
1314
+ const node = state2.indexes.nodes[resolved.node.props.id];
1315
+ if (node && resolved.didChange) {
1316
+ if (resolved.node.props.id === "root") {
1317
+ dispatch({
1318
+ type: "replaceRoot",
1319
+ root: toRoot(resolved.node)
1320
+ });
1321
+ } else {
1322
+ const zoneCompound = `${node.parentId}:${node.zone}`;
1323
+ const parentZone = state2.indexes.zones[zoneCompound];
1324
+ const index = parentZone.contentIds.indexOf(
1325
+ resolved.node.props.id
1326
+ );
1327
+ dispatch({
1328
+ type: "replace",
1329
+ data: resolved.node,
1330
+ destinationIndex: index,
1331
+ destinationZone: zoneCompound
1332
+ });
1333
+ }
1334
+ }
1335
+ });
1336
+ return childItem;
1337
+ }
1338
+ );
1339
+ })
1340
+ });
1341
+ })
1342
+ );
1343
+ var appStoreContext = createContext(createAppStore());
1344
+ function useAppStore(selector) {
1345
+ const context = useContext(appStoreContext);
1346
+ return useStore(context, selector);
1347
+ }
1348
+ function useAppStoreApi() {
1349
+ return useContext(appStoreContext);
1350
+ }
1351
+
1352
+ // components/RichTextMenu/lib/use-control-context.ts
1353
+ init_react_import();
1354
+ import { createContext as createContext2, useContext as useContext2 } from "react";
1355
+ var ControlContext = createContext2({});
1356
+ var useControlContext = () => {
1357
+ return useContext2(ControlContext);
1358
+ };
1359
+
1360
+ // components/RichTextMenu/components/SelectControl/index.tsx
1361
+ init_react_import();
1362
+ import { useMemo } from "react";
1363
+
1364
+ // components/Select/index.tsx
1365
+ init_react_import();
1366
+
1367
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Select/styles.module.css#css-module
1368
+ init_react_import();
1369
+ var styles_module_default = { "Select": "_Select_xjbef_1", "Select-button": "_Select-button_xjbef_6", "Select--hasOptions": "_Select--hasOptions_xjbef_19", "Select--disabled": "_Select--disabled_xjbef_23", "Select-buttonIcon": "_Select-buttonIcon_xjbef_27", "Select--standalone": "_Select--standalone_xjbef_33", "Select--actionBar": "_Select--actionBar_xjbef_38", "Select--hasValue": "_Select--hasValue_xjbef_44", "Select-items": "_Select-items_xjbef_61", "SelectItem": "_SelectItem_xjbef_72", "SelectItem--isSelected": "_SelectItem--isSelected_xjbef_87", "SelectItem-icon": "_SelectItem-icon_xjbef_93" };
1370
+
1371
+ // components/Select/index.tsx
1372
+ import { useState } from "react";
1373
+ import {
1374
+ Popover,
1375
+ PopoverContent,
1376
+ PopoverPortal,
1377
+ PopoverTrigger
1378
+ } from "@radix-ui/react-popover";
1379
+
1380
+ // lib/index.ts
1381
+ init_react_import();
1382
+
1383
+ // lib/filter.ts
1384
+ init_react_import();
1385
+
1386
+ // lib/data/reorder.ts
1387
+ init_react_import();
1388
+ var reorder = (list, startIndex, endIndex) => {
1389
+ const result = Array.from(list);
1390
+ const [removed] = result.splice(startIndex, 1);
1391
+ result.splice(endIndex, 0, removed);
1392
+ return result;
1393
+ };
1394
+
1395
+ // lib/data/replace.ts
1396
+ init_react_import();
1397
+ var replace = (list, index, newItem) => {
1398
+ const result = Array.from(list);
1399
+ result.splice(index, 1);
1400
+ result.splice(index, 0, newItem);
1401
+ return result;
1402
+ };
1403
+
1404
+ // lib/use-reset-auto-zoom.ts
1405
+ init_react_import();
1406
+
1407
+ // lib/get-zoom-config.ts
1408
+ init_react_import();
1409
+
1410
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
1411
+ init_react_import();
1412
+
1413
+ // ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
1414
+ init_react_import();
1415
+ var isProduction = process.env.NODE_ENV === "production";
1416
+ var prefix = "Invariant failed";
1417
+ function invariant(condition, message) {
1418
+ if (condition) {
1419
+ return;
1420
+ }
1421
+ if (isProduction) {
1422
+ throw new Error(prefix);
1423
+ }
1424
+ var provided = typeof message === "function" ? message() : message;
1425
+ var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
1426
+ throw new Error(value);
1427
+ }
1428
+
1429
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
1430
+ var getRect = function getRect2(_ref) {
1431
+ var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
1432
+ var width = right - left;
1433
+ var height = bottom - top;
1434
+ var rect = {
1435
+ top,
1436
+ right,
1437
+ bottom,
1438
+ left,
1439
+ width,
1440
+ height,
1441
+ x: left,
1442
+ y: top,
1443
+ center: {
1444
+ x: (right + left) / 2,
1445
+ y: (bottom + top) / 2
1446
+ }
1447
+ };
1448
+ return rect;
1449
+ };
1450
+ var expand = function expand2(target, expandBy) {
1451
+ return {
1452
+ top: target.top - expandBy.top,
1453
+ left: target.left - expandBy.left,
1454
+ bottom: target.bottom + expandBy.bottom,
1455
+ right: target.right + expandBy.right
1456
+ };
1457
+ };
1458
+ var shrink = function shrink2(target, shrinkBy) {
1459
+ return {
1460
+ top: target.top + shrinkBy.top,
1461
+ left: target.left + shrinkBy.left,
1462
+ bottom: target.bottom - shrinkBy.bottom,
1463
+ right: target.right - shrinkBy.right
1464
+ };
1465
+ };
1466
+ var noSpacing = {
1467
+ top: 0,
1468
+ right: 0,
1469
+ bottom: 0,
1470
+ left: 0
1471
+ };
1472
+ var createBox = function createBox2(_ref2) {
1473
+ var borderBox = _ref2.borderBox, _ref2$margin = _ref2.margin, margin = _ref2$margin === void 0 ? noSpacing : _ref2$margin, _ref2$border = _ref2.border, border = _ref2$border === void 0 ? noSpacing : _ref2$border, _ref2$padding = _ref2.padding, padding = _ref2$padding === void 0 ? noSpacing : _ref2$padding;
1474
+ var marginBox = getRect(expand(borderBox, margin));
1475
+ var paddingBox = getRect(shrink(borderBox, border));
1476
+ var contentBox = getRect(shrink(paddingBox, padding));
1477
+ return {
1478
+ marginBox,
1479
+ borderBox: getRect(borderBox),
1480
+ paddingBox,
1481
+ contentBox,
1482
+ margin,
1483
+ border,
1484
+ padding
1485
+ };
1486
+ };
1487
+ var parse = function parse2(raw) {
1488
+ var value = raw.slice(0, -2);
1489
+ var suffix = raw.slice(-2);
1490
+ if (suffix !== "px") {
1491
+ return 0;
1492
+ }
1493
+ var result = Number(value);
1494
+ !!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
1495
+ return result;
1496
+ };
1497
+ var calculateBox = function calculateBox2(borderBox, styles) {
1498
+ var margin = {
1499
+ top: parse(styles.marginTop),
1500
+ right: parse(styles.marginRight),
1501
+ bottom: parse(styles.marginBottom),
1502
+ left: parse(styles.marginLeft)
1503
+ };
1504
+ var padding = {
1505
+ top: parse(styles.paddingTop),
1506
+ right: parse(styles.paddingRight),
1507
+ bottom: parse(styles.paddingBottom),
1508
+ left: parse(styles.paddingLeft)
1509
+ };
1510
+ var border = {
1511
+ top: parse(styles.borderTopWidth),
1512
+ right: parse(styles.borderRightWidth),
1513
+ bottom: parse(styles.borderBottomWidth),
1514
+ left: parse(styles.borderLeftWidth)
1515
+ };
1516
+ return createBox({
1517
+ borderBox,
1518
+ margin,
1519
+ padding,
1520
+ border
1521
+ });
1522
+ };
1523
+ var getBox = function getBox2(el) {
1524
+ var borderBox = el.getBoundingClientRect();
1525
+ var styles = window.getComputedStyle(el);
1526
+ return calculateBox(borderBox, styles);
1527
+ };
1528
+
1529
+ // lib/get-zoom-config.ts
1530
+ var RESET_ZOOM_SMALLER_THAN_FRAME = true;
1531
+ var getZoomConfig = (uiViewport, frame, zoom) => {
1532
+ const box = getBox(frame);
1533
+ const { width: frameWidth, height: frameHeight } = box.contentBox;
1534
+ const viewportHeight = uiViewport.height === "auto" ? frameHeight : uiViewport.height;
1535
+ let rootHeight = 0;
1536
+ let autoZoom = 1;
1537
+ if (typeof uiViewport.width === "number" && (uiViewport.width > frameWidth || viewportHeight > frameHeight)) {
1538
+ const widthZoom = Math.min(frameWidth / uiViewport.width, 1);
1539
+ const heightZoom = Math.min(frameHeight / viewportHeight, 1);
1540
+ zoom = widthZoom;
1541
+ if (widthZoom < heightZoom) {
1542
+ rootHeight = viewportHeight / zoom;
1543
+ } else {
1544
+ rootHeight = viewportHeight;
1545
+ zoom = heightZoom;
1546
+ }
1547
+ autoZoom = zoom;
1548
+ } else {
1549
+ if (RESET_ZOOM_SMALLER_THAN_FRAME) {
1550
+ autoZoom = 1;
1551
+ zoom = 1;
1552
+ rootHeight = viewportHeight;
1553
+ }
1554
+ }
1555
+ return { autoZoom, rootHeight, zoom };
1556
+ };
1557
+
1558
+ // lib/use-reset-auto-zoom.ts
1559
+ var useResetAutoZoom = (frameRef) => {
1560
+ const appStoreApi = useAppStoreApi();
1561
+ const resetAutoZoom = (options) => {
1562
+ const { state, zoomConfig, setZoomConfig } = appStoreApi.getState();
1563
+ const { viewports } = state.ui;
1564
+ const newViewports = (options == null ? void 0 : options.viewports) || viewports;
1565
+ if (frameRef.current) {
1566
+ setZoomConfig(
1567
+ getZoomConfig(newViewports == null ? void 0 : newViewports.current, frameRef.current, zoomConfig.zoom)
1568
+ );
1569
+ }
1570
+ };
1571
+ return resetAutoZoom;
1572
+ };
1573
+
1574
+ // components/Select/index.tsx
1575
+ import { jsx, jsxs } from "react/jsx-runtime";
1576
+ var getClassName = get_class_name_factory_default("Select", styles_module_default);
1577
+ var getItemClassName = get_class_name_factory_default("SelectItem", styles_module_default);
1578
+ var Item = ({
1579
+ children,
1580
+ isSelected,
1581
+ onClick
1582
+ }) => {
1583
+ return /* @__PURE__ */ jsx("button", { className: getItemClassName({ isSelected }), onClick, children });
1584
+ };
1585
+ var Select = ({
1586
+ children,
1587
+ options,
1588
+ onChange,
1589
+ value,
1590
+ defaultValue,
1591
+ mode,
1592
+ disabled = false
1593
+ }) => {
1594
+ const [open, setOpen] = useState(false);
1595
+ const hasOptions = options.length > 0;
1596
+ return /* @__PURE__ */ jsx(
1597
+ "div",
1598
+ {
1599
+ className: getClassName({
1600
+ hasValue: value !== defaultValue,
1601
+ hasOptions,
1602
+ actionBar: mode === "actionBar",
1603
+ standalone: mode === "standalone",
1604
+ disabled
1605
+ }),
1606
+ children: /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
1607
+ hasOptions ? /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs("button", { className: getClassName("button"), children: [
1608
+ /* @__PURE__ */ jsx("span", { className: getClassName("buttonIcon"), children }),
1609
+ /* @__PURE__ */ jsx(ChevronDown, { size: 12 })
1610
+ ] }) }) : /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: getClassName("button"), children: [
1611
+ /* @__PURE__ */ jsx("span", { className: getClassName("buttonIcon"), children }),
1612
+ /* @__PURE__ */ jsx(ChevronDown, { size: 12 })
1613
+ ] }) }),
1614
+ options.length > 0 && /* @__PURE__ */ jsx(PopoverPortal, { children: /* @__PURE__ */ jsx(PopoverContent, { align: "start", children: /* @__PURE__ */ jsx("ul", { className: getClassName("items"), "data-puck-rte-menu": true, children: options.map((option) => {
1615
+ const Icon2 = option.icon;
1616
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
1617
+ Item,
1618
+ {
1619
+ isSelected: value === option.value,
1620
+ onClick: () => {
1621
+ onChange(option.value);
1622
+ setOpen(false);
1623
+ },
1624
+ children: [
1625
+ Icon2 && /* @__PURE__ */ jsx("div", { className: getItemClassName("icon"), children: /* @__PURE__ */ jsx(Icon2, { size: 16 }) }),
1626
+ option.label
1627
+ ]
1628
+ }
1629
+ ) }, option.value);
1630
+ }) }) }) })
1631
+ ] })
1632
+ }
1633
+ );
1634
+ };
1635
+
1636
+ // components/RichTextMenu/components/SelectControl/index.tsx
1637
+ import { jsx as jsx2 } from "react/jsx-runtime";
1638
+ function SelectControl({
1639
+ renderDefaultIcon,
1640
+ onChange,
1641
+ options,
1642
+ value,
1643
+ defaultValue
1644
+ }) {
1645
+ var _a, _b;
1646
+ const { inline, readOnly } = useControlContext();
1647
+ const optionsByValue = useMemo(
1648
+ () => options.reduce(
1649
+ (acc, option) => __spreadProps(__spreadValues({}, acc), { [option.value]: option }),
1650
+ {}
1651
+ ),
1652
+ [options]
1653
+ );
1654
+ const Node = (_b = value && ((_a = optionsByValue[value]) == null ? void 0 : _a.icon)) != null ? _b : renderDefaultIcon;
1655
+ return /* @__PURE__ */ jsx2(
1656
+ Select,
1657
+ {
1658
+ options,
1659
+ onChange,
1660
+ value,
1661
+ defaultValue,
1662
+ mode: inline ? "actionBar" : "standalone",
1663
+ disabled: readOnly,
1664
+ children: /* @__PURE__ */ jsx2(Node, {})
1665
+ }
1666
+ );
1667
+ }
1668
+
1669
+ export {
1670
+ AlignCenter,
1671
+ AlignJustify,
1672
+ AlignLeft,
1673
+ AlignRight,
1674
+ Bold,
1675
+ ChevronDown,
1676
+ ChevronRight,
1677
+ ChevronUp,
1678
+ CircleCheckBig,
1679
+ Code,
1680
+ Copy,
1681
+ CornerLeftUp,
1682
+ EllipsisVertical,
1683
+ Expand,
1684
+ Globe,
1685
+ Hammer,
1686
+ Hash,
1687
+ Heading1,
1688
+ Heading2,
1689
+ Heading3,
1690
+ Heading4,
1691
+ Heading5,
1692
+ Heading6,
1693
+ Heading,
1694
+ Italic,
1695
+ Layers,
1696
+ LayoutGrid,
1697
+ Link,
1698
+ ListOrdered,
1699
+ List,
1700
+ LockOpen,
1701
+ Lock,
1702
+ Maximize2,
1703
+ Minimize2,
1704
+ Minus,
1705
+ Monitor,
1706
+ PanelLeft,
1707
+ PanelRight,
1708
+ Plus,
1709
+ Quote,
1710
+ RectangleEllipsis,
1711
+ Redo2,
1712
+ Search,
1713
+ SlidersHorizontal,
1714
+ Smartphone,
1715
+ SquareCode,
1716
+ Strikethrough,
1717
+ Tablet,
1718
+ ToyBrick,
1719
+ Trash,
1720
+ Type,
1721
+ Underline,
1722
+ Undo2,
1723
+ X,
1724
+ ZoomIn,
1725
+ ZoomOut,
1726
+ reorder,
1727
+ replace,
1728
+ monitorHotkeys,
1729
+ useMonitorHotkeys,
1730
+ useHotkey,
1731
+ useRegisterHistorySlice,
1732
+ useRegisterPermissionsSlice,
1733
+ useRegisterFieldsSlice,
1734
+ createAppStore,
1735
+ appStoreContext,
1736
+ useAppStore,
1737
+ useAppStoreApi,
1738
+ getBox,
1739
+ useResetAutoZoom,
1740
+ ControlContext,
1741
+ useControlContext,
1742
+ SelectControl
1743
+ };
1744
+ /*! Bundled license information:
1745
+
1746
+ lucide-react/dist/esm/shared/src/utils.js:
1747
+ lucide-react/dist/esm/defaultAttributes.js:
1748
+ lucide-react/dist/esm/Icon.js:
1749
+ lucide-react/dist/esm/createLucideIcon.js:
1750
+ lucide-react/dist/esm/icons/align-left.js:
1751
+ lucide-react/dist/esm/icons/heading.js:
1752
+ lucide-react/dist/esm/icons/list.js:
1753
+ lucide-react/dist/esm/icons/align-center.js:
1754
+ lucide-react/dist/esm/icons/align-justify.js:
1755
+ lucide-react/dist/esm/icons/align-right.js:
1756
+ lucide-react/dist/esm/icons/bold.js:
1757
+ lucide-react/dist/esm/icons/chevron-down.js:
1758
+ lucide-react/dist/esm/icons/chevron-right.js:
1759
+ lucide-react/dist/esm/icons/chevron-up.js:
1760
+ lucide-react/dist/esm/icons/circle-check-big.js:
1761
+ lucide-react/dist/esm/icons/code.js:
1762
+ lucide-react/dist/esm/icons/copy.js:
1763
+ lucide-react/dist/esm/icons/corner-left-up.js:
1764
+ lucide-react/dist/esm/icons/ellipsis-vertical.js:
1765
+ lucide-react/dist/esm/icons/expand.js:
1766
+ lucide-react/dist/esm/icons/globe.js:
1767
+ lucide-react/dist/esm/icons/hammer.js:
1768
+ lucide-react/dist/esm/icons/hash.js:
1769
+ lucide-react/dist/esm/icons/heading-1.js:
1770
+ lucide-react/dist/esm/icons/heading-2.js:
1771
+ lucide-react/dist/esm/icons/heading-3.js:
1772
+ lucide-react/dist/esm/icons/heading-4.js:
1773
+ lucide-react/dist/esm/icons/heading-5.js:
1774
+ lucide-react/dist/esm/icons/heading-6.js:
1775
+ lucide-react/dist/esm/icons/italic.js:
1776
+ lucide-react/dist/esm/icons/layers.js:
1777
+ lucide-react/dist/esm/icons/layout-grid.js:
1778
+ lucide-react/dist/esm/icons/link.js:
1779
+ lucide-react/dist/esm/icons/list-ordered.js:
1780
+ lucide-react/dist/esm/icons/lock-open.js:
1781
+ lucide-react/dist/esm/icons/lock.js:
1782
+ lucide-react/dist/esm/icons/maximize-2.js:
1783
+ lucide-react/dist/esm/icons/minimize-2.js:
1784
+ lucide-react/dist/esm/icons/minus.js:
1785
+ lucide-react/dist/esm/icons/monitor.js:
1786
+ lucide-react/dist/esm/icons/panel-left.js:
1787
+ lucide-react/dist/esm/icons/panel-right.js:
1788
+ lucide-react/dist/esm/icons/plus.js:
1789
+ lucide-react/dist/esm/icons/quote.js:
1790
+ lucide-react/dist/esm/icons/rectangle-ellipsis.js:
1791
+ lucide-react/dist/esm/icons/redo-2.js:
1792
+ lucide-react/dist/esm/icons/search.js:
1793
+ lucide-react/dist/esm/icons/sliders-horizontal.js:
1794
+ lucide-react/dist/esm/icons/smartphone.js:
1795
+ lucide-react/dist/esm/icons/square-code.js:
1796
+ lucide-react/dist/esm/icons/strikethrough.js:
1797
+ lucide-react/dist/esm/icons/tablet.js:
1798
+ lucide-react/dist/esm/icons/toy-brick.js:
1799
+ lucide-react/dist/esm/icons/trash.js:
1800
+ lucide-react/dist/esm/icons/type.js:
1801
+ lucide-react/dist/esm/icons/underline.js:
1802
+ lucide-react/dist/esm/icons/undo-2.js:
1803
+ lucide-react/dist/esm/icons/x.js:
1804
+ lucide-react/dist/esm/icons/zoom-in.js:
1805
+ lucide-react/dist/esm/icons/zoom-out.js:
1806
+ lucide-react/dist/esm/lucide-react.js:
1807
+ (**
1808
+ * @license lucide-react v0.468.0 - ISC
1809
+ *
1810
+ * This source code is licensed under the ISC license.
1811
+ * See the LICENSE file in the root directory of this source tree.
1812
+ *)
1813
+ */