@measured/puck 0.21.0-canary.3aa27d1d → 0.21.0-canary.56be3202

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-CYTATURR.mjs +204 -0
  2. package/dist/Editor-F2LSS6SE.css +403 -0
  3. package/dist/Render-OFE6QLI2.mjs +55 -0
  4. package/dist/Render-QEMDIDQC.css +101 -0
  5. package/dist/{walk-tree-16XYcbNo.d.mts → actions-tsxxcX1z.d.mts} +29 -40
  6. package/dist/{walk-tree-16XYcbNo.d.ts → actions-tsxxcX1z.d.ts} +29 -40
  7. package/dist/chunk-72SA22GI.mjs +134 -0
  8. package/dist/chunk-CSSRLPHM.mjs +11 -0
  9. package/dist/chunk-M4QBB3JM.mjs +111 -0
  10. package/dist/chunk-M6W7YEVX.mjs +95 -0
  11. package/dist/chunk-MLTVJA2A.mjs +63 -0
  12. package/dist/chunk-MVJKIFF6.mjs +419 -0
  13. package/dist/chunk-NLUHDYVR.mjs +416 -0
  14. package/dist/chunk-NOJQSXRU.mjs +33 -0
  15. package/dist/{chunk-GFIVKP2H.mjs → chunk-PZ4SED7H.mjs} +6848 -9297
  16. package/dist/chunk-QBGM4ELA.mjs +528 -0
  17. package/dist/chunk-UNQOU2OI.mjs +53 -0
  18. package/dist/chunk-UUOBSXZR.mjs +1807 -0
  19. package/dist/chunk-V5I7CVLT.mjs +103 -0
  20. package/dist/chunk-V7333LON.mjs +708 -0
  21. package/dist/chunk-Y2EFNT5P.mjs +108 -0
  22. package/dist/full-2GJTAAZE.css +301 -0
  23. package/dist/full-GZ4L3XCF.mjs +93 -0
  24. package/dist/index-Ca6V6NQD.d.ts +118 -0
  25. package/dist/index-mQvUCH3C.d.mts +118 -0
  26. package/dist/index.css +856 -458
  27. package/dist/index.d.mts +32 -129
  28. package/dist/index.d.ts +32 -129
  29. package/dist/index.js +11790 -9359
  30. package/dist/index.mjs +32 -14
  31. package/dist/internal.d.mts +27 -0
  32. package/dist/internal.d.ts +27 -0
  33. package/dist/internal.js +908 -0
  34. package/dist/internal.mjs +13 -0
  35. package/dist/loaded-2MNXXPJP.mjs +57 -0
  36. package/dist/loaded-6QT4HD2O.mjs +57 -0
  37. package/dist/loaded-RVWBFK7L.css +87 -0
  38. package/dist/loaded-ZVPBQVNE.mjs +60 -0
  39. package/dist/no-external.css +988 -586
  40. package/dist/no-external.d.mts +4 -2
  41. package/dist/no-external.d.ts +4 -2
  42. package/dist/no-external.js +11793 -9359
  43. package/dist/no-external.mjs +34 -11
  44. package/dist/rsc.css +34 -26
  45. package/dist/rsc.d.mts +2 -2
  46. package/dist/rsc.d.ts +2 -2
  47. package/dist/rsc.js +249 -189
  48. package/dist/rsc.mjs +18 -9
  49. package/dist/walk-tree-Bh85NMeo.d.ts +29 -0
  50. package/dist/walk-tree-CDA3K5S3.d.mts +29 -0
  51. package/package.json +9 -4
  52. package/dist/chunk-SRDLYODX.mjs +0 -1245
@@ -0,0 +1,1807 @@
1
+ import {
2
+ createReducer,
3
+ generateId,
4
+ getItem,
5
+ makeStatePublic
6
+ } from "./chunk-QBGM4ELA.mjs";
7
+ import {
8
+ defaultAppState,
9
+ defaultViewports,
10
+ getChanged,
11
+ resolveComponentData
12
+ } from "./chunk-72SA22GI.mjs";
13
+ import {
14
+ get_class_name_factory_default
15
+ } from "./chunk-Y2EFNT5P.mjs";
16
+ import {
17
+ walkAppState
18
+ } from "./chunk-NLUHDYVR.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
+ const { config, metadata, setComponentLoading, permissions } = get();
1278
+ const timeouts = {};
1279
+ return yield resolveComponentData(
1280
+ componentData,
1281
+ config,
1282
+ metadata,
1283
+ (item) => {
1284
+ const id = "id" in item.props ? item.props.id : "root";
1285
+ timeouts[id] = setComponentLoading(id, true, 50);
1286
+ },
1287
+ (item) => __async(null, null, function* () {
1288
+ const id = "id" in item.props ? item.props.id : "root";
1289
+ if ("type" in item) {
1290
+ yield permissions.refreshPermissions({ item });
1291
+ } else {
1292
+ yield permissions.refreshPermissions({ root: true });
1293
+ }
1294
+ timeouts[id]();
1295
+ }),
1296
+ trigger
1297
+ );
1298
+ }),
1299
+ resolveAndCommitData: () => __async(null, null, function* () {
1300
+ const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
1301
+ walkAppState(
1302
+ state,
1303
+ config,
1304
+ (content) => content,
1305
+ (childItem) => {
1306
+ resolveComponentData2(childItem, "load").then((resolved) => {
1307
+ const { state: state2 } = get();
1308
+ const node = state2.indexes.nodes[resolved.node.props.id];
1309
+ if (node && resolved.didChange) {
1310
+ if (resolved.node.props.id === "root") {
1311
+ dispatch({
1312
+ type: "replaceRoot",
1313
+ root: toRoot(resolved.node)
1314
+ });
1315
+ } else {
1316
+ const zoneCompound = `${node.parentId}:${node.zone}`;
1317
+ const parentZone = state2.indexes.zones[zoneCompound];
1318
+ const index = parentZone.contentIds.indexOf(
1319
+ resolved.node.props.id
1320
+ );
1321
+ dispatch({
1322
+ type: "replace",
1323
+ data: resolved.node,
1324
+ destinationIndex: index,
1325
+ destinationZone: zoneCompound
1326
+ });
1327
+ }
1328
+ }
1329
+ });
1330
+ return childItem;
1331
+ }
1332
+ );
1333
+ })
1334
+ });
1335
+ })
1336
+ );
1337
+ var appStoreContext = createContext(createAppStore());
1338
+ function useAppStore(selector) {
1339
+ const context = useContext(appStoreContext);
1340
+ return useStore(context, selector);
1341
+ }
1342
+ function useAppStoreApi() {
1343
+ return useContext(appStoreContext);
1344
+ }
1345
+
1346
+ // components/RichTextMenu/lib/use-control-context.ts
1347
+ init_react_import();
1348
+ import { createContext as createContext2, useContext as useContext2 } from "react";
1349
+ var ControlContext = createContext2({});
1350
+ var useControlContext = () => {
1351
+ return useContext2(ControlContext);
1352
+ };
1353
+
1354
+ // components/RichTextMenu/components/SelectControl/index.tsx
1355
+ init_react_import();
1356
+ import { useMemo } from "react";
1357
+
1358
+ // components/Select/index.tsx
1359
+ init_react_import();
1360
+
1361
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Select/styles.module.css#css-module
1362
+ init_react_import();
1363
+ 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" };
1364
+
1365
+ // components/Select/index.tsx
1366
+ import { useState } from "react";
1367
+ import {
1368
+ Popover,
1369
+ PopoverContent,
1370
+ PopoverPortal,
1371
+ PopoverTrigger
1372
+ } from "@radix-ui/react-popover";
1373
+
1374
+ // lib/index.ts
1375
+ init_react_import();
1376
+
1377
+ // lib/filter.ts
1378
+ init_react_import();
1379
+
1380
+ // lib/data/reorder.ts
1381
+ init_react_import();
1382
+ var reorder = (list, startIndex, endIndex) => {
1383
+ const result = Array.from(list);
1384
+ const [removed] = result.splice(startIndex, 1);
1385
+ result.splice(endIndex, 0, removed);
1386
+ return result;
1387
+ };
1388
+
1389
+ // lib/data/replace.ts
1390
+ init_react_import();
1391
+ var replace = (list, index, newItem) => {
1392
+ const result = Array.from(list);
1393
+ result.splice(index, 1);
1394
+ result.splice(index, 0, newItem);
1395
+ return result;
1396
+ };
1397
+
1398
+ // lib/use-reset-auto-zoom.ts
1399
+ init_react_import();
1400
+
1401
+ // lib/get-zoom-config.ts
1402
+ init_react_import();
1403
+
1404
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
1405
+ init_react_import();
1406
+
1407
+ // ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
1408
+ init_react_import();
1409
+ var isProduction = process.env.NODE_ENV === "production";
1410
+ var prefix = "Invariant failed";
1411
+ function invariant(condition, message) {
1412
+ if (condition) {
1413
+ return;
1414
+ }
1415
+ if (isProduction) {
1416
+ throw new Error(prefix);
1417
+ }
1418
+ var provided = typeof message === "function" ? message() : message;
1419
+ var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
1420
+ throw new Error(value);
1421
+ }
1422
+
1423
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
1424
+ var getRect = function getRect2(_ref) {
1425
+ var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
1426
+ var width = right - left;
1427
+ var height = bottom - top;
1428
+ var rect = {
1429
+ top,
1430
+ right,
1431
+ bottom,
1432
+ left,
1433
+ width,
1434
+ height,
1435
+ x: left,
1436
+ y: top,
1437
+ center: {
1438
+ x: (right + left) / 2,
1439
+ y: (bottom + top) / 2
1440
+ }
1441
+ };
1442
+ return rect;
1443
+ };
1444
+ var expand = function expand2(target, expandBy) {
1445
+ return {
1446
+ top: target.top - expandBy.top,
1447
+ left: target.left - expandBy.left,
1448
+ bottom: target.bottom + expandBy.bottom,
1449
+ right: target.right + expandBy.right
1450
+ };
1451
+ };
1452
+ var shrink = function shrink2(target, shrinkBy) {
1453
+ return {
1454
+ top: target.top + shrinkBy.top,
1455
+ left: target.left + shrinkBy.left,
1456
+ bottom: target.bottom - shrinkBy.bottom,
1457
+ right: target.right - shrinkBy.right
1458
+ };
1459
+ };
1460
+ var noSpacing = {
1461
+ top: 0,
1462
+ right: 0,
1463
+ bottom: 0,
1464
+ left: 0
1465
+ };
1466
+ var createBox = function createBox2(_ref2) {
1467
+ 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;
1468
+ var marginBox = getRect(expand(borderBox, margin));
1469
+ var paddingBox = getRect(shrink(borderBox, border));
1470
+ var contentBox = getRect(shrink(paddingBox, padding));
1471
+ return {
1472
+ marginBox,
1473
+ borderBox: getRect(borderBox),
1474
+ paddingBox,
1475
+ contentBox,
1476
+ margin,
1477
+ border,
1478
+ padding
1479
+ };
1480
+ };
1481
+ var parse = function parse2(raw) {
1482
+ var value = raw.slice(0, -2);
1483
+ var suffix = raw.slice(-2);
1484
+ if (suffix !== "px") {
1485
+ return 0;
1486
+ }
1487
+ var result = Number(value);
1488
+ !!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
1489
+ return result;
1490
+ };
1491
+ var calculateBox = function calculateBox2(borderBox, styles) {
1492
+ var margin = {
1493
+ top: parse(styles.marginTop),
1494
+ right: parse(styles.marginRight),
1495
+ bottom: parse(styles.marginBottom),
1496
+ left: parse(styles.marginLeft)
1497
+ };
1498
+ var padding = {
1499
+ top: parse(styles.paddingTop),
1500
+ right: parse(styles.paddingRight),
1501
+ bottom: parse(styles.paddingBottom),
1502
+ left: parse(styles.paddingLeft)
1503
+ };
1504
+ var border = {
1505
+ top: parse(styles.borderTopWidth),
1506
+ right: parse(styles.borderRightWidth),
1507
+ bottom: parse(styles.borderBottomWidth),
1508
+ left: parse(styles.borderLeftWidth)
1509
+ };
1510
+ return createBox({
1511
+ borderBox,
1512
+ margin,
1513
+ padding,
1514
+ border
1515
+ });
1516
+ };
1517
+ var getBox = function getBox2(el) {
1518
+ var borderBox = el.getBoundingClientRect();
1519
+ var styles = window.getComputedStyle(el);
1520
+ return calculateBox(borderBox, styles);
1521
+ };
1522
+
1523
+ // lib/get-zoom-config.ts
1524
+ var RESET_ZOOM_SMALLER_THAN_FRAME = true;
1525
+ var getZoomConfig = (uiViewport, frame, zoom) => {
1526
+ const box = getBox(frame);
1527
+ const { width: frameWidth, height: frameHeight } = box.contentBox;
1528
+ const viewportHeight = uiViewport.height === "auto" ? frameHeight : uiViewport.height;
1529
+ let rootHeight = 0;
1530
+ let autoZoom = 1;
1531
+ if (typeof uiViewport.width === "number" && (uiViewport.width > frameWidth || viewportHeight > frameHeight)) {
1532
+ const widthZoom = Math.min(frameWidth / uiViewport.width, 1);
1533
+ const heightZoom = Math.min(frameHeight / viewportHeight, 1);
1534
+ zoom = widthZoom;
1535
+ if (widthZoom < heightZoom) {
1536
+ rootHeight = viewportHeight / zoom;
1537
+ } else {
1538
+ rootHeight = viewportHeight;
1539
+ zoom = heightZoom;
1540
+ }
1541
+ autoZoom = zoom;
1542
+ } else {
1543
+ if (RESET_ZOOM_SMALLER_THAN_FRAME) {
1544
+ autoZoom = 1;
1545
+ zoom = 1;
1546
+ rootHeight = viewportHeight;
1547
+ }
1548
+ }
1549
+ return { autoZoom, rootHeight, zoom };
1550
+ };
1551
+
1552
+ // lib/use-reset-auto-zoom.ts
1553
+ var useResetAutoZoom = (frameRef) => {
1554
+ const appStoreApi = useAppStoreApi();
1555
+ const resetAutoZoom = (options) => {
1556
+ const { state, zoomConfig, setZoomConfig } = appStoreApi.getState();
1557
+ const { viewports } = state.ui;
1558
+ const newViewports = (options == null ? void 0 : options.viewports) || viewports;
1559
+ if (frameRef.current) {
1560
+ setZoomConfig(
1561
+ getZoomConfig(newViewports == null ? void 0 : newViewports.current, frameRef.current, zoomConfig.zoom)
1562
+ );
1563
+ }
1564
+ };
1565
+ return resetAutoZoom;
1566
+ };
1567
+
1568
+ // components/Select/index.tsx
1569
+ import { jsx, jsxs } from "react/jsx-runtime";
1570
+ var getClassName = get_class_name_factory_default("Select", styles_module_default);
1571
+ var getItemClassName = get_class_name_factory_default("SelectItem", styles_module_default);
1572
+ var Item = ({
1573
+ children,
1574
+ isSelected,
1575
+ onClick
1576
+ }) => {
1577
+ return /* @__PURE__ */ jsx("button", { className: getItemClassName({ isSelected }), onClick, children });
1578
+ };
1579
+ var Select = ({
1580
+ children,
1581
+ options,
1582
+ onChange,
1583
+ value,
1584
+ defaultValue,
1585
+ mode,
1586
+ disabled = false
1587
+ }) => {
1588
+ const [open, setOpen] = useState(false);
1589
+ const hasOptions = options.length > 0;
1590
+ return /* @__PURE__ */ jsx(
1591
+ "div",
1592
+ {
1593
+ className: getClassName({
1594
+ hasValue: value !== defaultValue,
1595
+ hasOptions,
1596
+ actionBar: mode === "actionBar",
1597
+ standalone: mode === "standalone",
1598
+ disabled
1599
+ }),
1600
+ children: /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
1601
+ hasOptions ? /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs("button", { className: getClassName("button"), children: [
1602
+ /* @__PURE__ */ jsx("span", { className: getClassName("buttonIcon"), children }),
1603
+ /* @__PURE__ */ jsx(ChevronDown, { size: 12 })
1604
+ ] }) }) : /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: getClassName("button"), children: [
1605
+ /* @__PURE__ */ jsx("span", { className: getClassName("buttonIcon"), children }),
1606
+ /* @__PURE__ */ jsx(ChevronDown, { size: 12 })
1607
+ ] }) }),
1608
+ 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) => {
1609
+ const Icon2 = option.icon;
1610
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
1611
+ Item,
1612
+ {
1613
+ isSelected: value === option.value,
1614
+ onClick: () => {
1615
+ onChange(option.value);
1616
+ setOpen(false);
1617
+ },
1618
+ children: [
1619
+ Icon2 && /* @__PURE__ */ jsx("div", { className: getItemClassName("icon"), children: /* @__PURE__ */ jsx(Icon2, { size: 16 }) }),
1620
+ option.label
1621
+ ]
1622
+ }
1623
+ ) }, option.value);
1624
+ }) }) }) })
1625
+ ] })
1626
+ }
1627
+ );
1628
+ };
1629
+
1630
+ // components/RichTextMenu/components/SelectControl/index.tsx
1631
+ import { jsx as jsx2 } from "react/jsx-runtime";
1632
+ function SelectControl({
1633
+ renderDefaultIcon,
1634
+ onChange,
1635
+ options,
1636
+ value,
1637
+ defaultValue
1638
+ }) {
1639
+ var _a, _b;
1640
+ const { inline, readOnly } = useControlContext();
1641
+ const optionsByValue = useMemo(
1642
+ () => options.reduce(
1643
+ (acc, option) => __spreadProps(__spreadValues({}, acc), { [option.value]: option }),
1644
+ {}
1645
+ ),
1646
+ [options]
1647
+ );
1648
+ const Node = (_b = value && ((_a = optionsByValue[value]) == null ? void 0 : _a.icon)) != null ? _b : renderDefaultIcon;
1649
+ return /* @__PURE__ */ jsx2(
1650
+ Select,
1651
+ {
1652
+ options,
1653
+ onChange,
1654
+ value,
1655
+ defaultValue,
1656
+ mode: inline ? "actionBar" : "standalone",
1657
+ disabled: readOnly,
1658
+ children: /* @__PURE__ */ jsx2(Node, {})
1659
+ }
1660
+ );
1661
+ }
1662
+
1663
+ export {
1664
+ AlignCenter,
1665
+ AlignJustify,
1666
+ AlignLeft,
1667
+ AlignRight,
1668
+ Bold,
1669
+ ChevronDown,
1670
+ ChevronRight,
1671
+ ChevronUp,
1672
+ CircleCheckBig,
1673
+ Code,
1674
+ Copy,
1675
+ CornerLeftUp,
1676
+ EllipsisVertical,
1677
+ Expand,
1678
+ Globe,
1679
+ Hammer,
1680
+ Hash,
1681
+ Heading1,
1682
+ Heading2,
1683
+ Heading3,
1684
+ Heading4,
1685
+ Heading5,
1686
+ Heading6,
1687
+ Heading,
1688
+ Italic,
1689
+ Layers,
1690
+ LayoutGrid,
1691
+ Link,
1692
+ ListOrdered,
1693
+ List,
1694
+ LockOpen,
1695
+ Lock,
1696
+ Maximize2,
1697
+ Minimize2,
1698
+ Minus,
1699
+ Monitor,
1700
+ PanelLeft,
1701
+ PanelRight,
1702
+ Plus,
1703
+ Quote,
1704
+ RectangleEllipsis,
1705
+ Redo2,
1706
+ Search,
1707
+ SlidersHorizontal,
1708
+ Smartphone,
1709
+ SquareCode,
1710
+ Strikethrough,
1711
+ Tablet,
1712
+ ToyBrick,
1713
+ Trash,
1714
+ Type,
1715
+ Underline,
1716
+ Undo2,
1717
+ X,
1718
+ ZoomIn,
1719
+ ZoomOut,
1720
+ reorder,
1721
+ replace,
1722
+ monitorHotkeys,
1723
+ useMonitorHotkeys,
1724
+ useHotkey,
1725
+ useRegisterHistorySlice,
1726
+ useRegisterPermissionsSlice,
1727
+ useRegisterFieldsSlice,
1728
+ createAppStore,
1729
+ appStoreContext,
1730
+ useAppStore,
1731
+ useAppStoreApi,
1732
+ getBox,
1733
+ useResetAutoZoom,
1734
+ ControlContext,
1735
+ useControlContext,
1736
+ SelectControl
1737
+ };
1738
+ /*! Bundled license information:
1739
+
1740
+ lucide-react/dist/esm/shared/src/utils.js:
1741
+ lucide-react/dist/esm/defaultAttributes.js:
1742
+ lucide-react/dist/esm/Icon.js:
1743
+ lucide-react/dist/esm/createLucideIcon.js:
1744
+ lucide-react/dist/esm/icons/align-left.js:
1745
+ lucide-react/dist/esm/icons/heading.js:
1746
+ lucide-react/dist/esm/icons/list.js:
1747
+ lucide-react/dist/esm/icons/align-center.js:
1748
+ lucide-react/dist/esm/icons/align-justify.js:
1749
+ lucide-react/dist/esm/icons/align-right.js:
1750
+ lucide-react/dist/esm/icons/bold.js:
1751
+ lucide-react/dist/esm/icons/chevron-down.js:
1752
+ lucide-react/dist/esm/icons/chevron-right.js:
1753
+ lucide-react/dist/esm/icons/chevron-up.js:
1754
+ lucide-react/dist/esm/icons/circle-check-big.js:
1755
+ lucide-react/dist/esm/icons/code.js:
1756
+ lucide-react/dist/esm/icons/copy.js:
1757
+ lucide-react/dist/esm/icons/corner-left-up.js:
1758
+ lucide-react/dist/esm/icons/ellipsis-vertical.js:
1759
+ lucide-react/dist/esm/icons/expand.js:
1760
+ lucide-react/dist/esm/icons/globe.js:
1761
+ lucide-react/dist/esm/icons/hammer.js:
1762
+ lucide-react/dist/esm/icons/hash.js:
1763
+ lucide-react/dist/esm/icons/heading-1.js:
1764
+ lucide-react/dist/esm/icons/heading-2.js:
1765
+ lucide-react/dist/esm/icons/heading-3.js:
1766
+ lucide-react/dist/esm/icons/heading-4.js:
1767
+ lucide-react/dist/esm/icons/heading-5.js:
1768
+ lucide-react/dist/esm/icons/heading-6.js:
1769
+ lucide-react/dist/esm/icons/italic.js:
1770
+ lucide-react/dist/esm/icons/layers.js:
1771
+ lucide-react/dist/esm/icons/layout-grid.js:
1772
+ lucide-react/dist/esm/icons/link.js:
1773
+ lucide-react/dist/esm/icons/list-ordered.js:
1774
+ lucide-react/dist/esm/icons/lock-open.js:
1775
+ lucide-react/dist/esm/icons/lock.js:
1776
+ lucide-react/dist/esm/icons/maximize-2.js:
1777
+ lucide-react/dist/esm/icons/minimize-2.js:
1778
+ lucide-react/dist/esm/icons/minus.js:
1779
+ lucide-react/dist/esm/icons/monitor.js:
1780
+ lucide-react/dist/esm/icons/panel-left.js:
1781
+ lucide-react/dist/esm/icons/panel-right.js:
1782
+ lucide-react/dist/esm/icons/plus.js:
1783
+ lucide-react/dist/esm/icons/quote.js:
1784
+ lucide-react/dist/esm/icons/rectangle-ellipsis.js:
1785
+ lucide-react/dist/esm/icons/redo-2.js:
1786
+ lucide-react/dist/esm/icons/search.js:
1787
+ lucide-react/dist/esm/icons/sliders-horizontal.js:
1788
+ lucide-react/dist/esm/icons/smartphone.js:
1789
+ lucide-react/dist/esm/icons/square-code.js:
1790
+ lucide-react/dist/esm/icons/strikethrough.js:
1791
+ lucide-react/dist/esm/icons/tablet.js:
1792
+ lucide-react/dist/esm/icons/toy-brick.js:
1793
+ lucide-react/dist/esm/icons/trash.js:
1794
+ lucide-react/dist/esm/icons/type.js:
1795
+ lucide-react/dist/esm/icons/underline.js:
1796
+ lucide-react/dist/esm/icons/undo-2.js:
1797
+ lucide-react/dist/esm/icons/x.js:
1798
+ lucide-react/dist/esm/icons/zoom-in.js:
1799
+ lucide-react/dist/esm/icons/zoom-out.js:
1800
+ lucide-react/dist/esm/lucide-react.js:
1801
+ (**
1802
+ * @license lucide-react v0.468.0 - ISC
1803
+ *
1804
+ * This source code is licensed under the ISC license.
1805
+ * See the LICENSE file in the root directory of this source tree.
1806
+ *)
1807
+ */