@superdoc-dev/template-builder 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,359 +1,57 @@
1
- import Ae, { useState as Y, useEffect as pe, useMemo as ve, useCallback as C, forwardRef as Ie, useRef as te, useImperativeHandle as Me } from "react";
2
- var de = { exports: {} }, ae = {};
3
- /**
4
- * @license React
5
- * react-jsx-runtime.production.js
6
- *
7
- * Copyright (c) Meta Platforms, Inc. and affiliates.
8
- *
9
- * This source code is licensed under the MIT license found in the
10
- * LICENSE file in the root directory of this source tree.
11
- */
12
- var Ee;
13
- function De() {
14
- if (Ee) return ae;
15
- Ee = 1;
16
- var i = Symbol.for("react.transitional.element"), b = Symbol.for("react.fragment");
17
- function h(d, r, l) {
18
- var S = null;
19
- if (l !== void 0 && (S = "" + l), r.key !== void 0 && (S = "" + r.key), "key" in r) {
20
- l = {};
21
- for (var N in r)
22
- N !== "key" && (l[N] = r[N]);
23
- } else l = r;
24
- return r = l.ref, {
25
- $$typeof: i,
26
- type: d,
27
- key: S,
28
- ref: r !== void 0 ? r : null,
29
- props: l
30
- };
31
- }
32
- return ae.Fragment = b, ae.jsx = h, ae.jsxs = h, ae;
33
- }
34
- var ie = {};
35
- /**
36
- * @license React
37
- * react-jsx-runtime.development.js
38
- *
39
- * Copyright (c) Meta Platforms, Inc. and affiliates.
40
- *
41
- * This source code is licensed under the MIT license found in the
42
- * LICENSE file in the root directory of this source tree.
43
- */
44
- var Re;
45
- function Le() {
46
- return Re || (Re = 1, process.env.NODE_ENV !== "production" && (function() {
47
- function i(e) {
48
- if (e == null) return null;
49
- if (typeof e == "function")
50
- return e.$$typeof === W ? null : e.displayName || e.name || null;
51
- if (typeof e == "string") return e;
52
- switch (e) {
53
- case U:
54
- return "Fragment";
55
- case p:
56
- return "Profiler";
57
- case q:
58
- return "StrictMode";
59
- case z:
60
- return "Suspense";
61
- case a:
62
- return "SuspenseList";
63
- case T:
64
- return "Activity";
65
- }
66
- if (typeof e == "object")
67
- switch (typeof e.tag == "number" && console.error(
68
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
69
- ), e.$$typeof) {
70
- case re:
71
- return "Portal";
72
- case M:
73
- return e.displayName || "Context";
74
- case $:
75
- return (e._context.displayName || "Context") + ".Consumer";
76
- case X:
77
- var s = e.render;
78
- return e = e.displayName, e || (e = s.displayName || s.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
79
- case v:
80
- return s = e.displayName || null, s !== null ? s : i(e.type) || "Memo";
81
- case R:
82
- s = e._payload, e = e._init;
83
- try {
84
- return i(e(s));
85
- } catch {
86
- }
87
- }
88
- return null;
89
- }
90
- function b(e) {
91
- return "" + e;
92
- }
93
- function h(e) {
94
- try {
95
- b(e);
96
- var s = !1;
97
- } catch {
98
- s = !0;
99
- }
100
- if (s) {
101
- s = console;
102
- var f = s.error, u = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
103
- return f.call(
104
- s,
105
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
106
- u
107
- ), b(e);
108
- }
109
- }
110
- function d(e) {
111
- if (e === U) return "<>";
112
- if (typeof e == "object" && e !== null && e.$$typeof === R)
113
- return "<...>";
114
- try {
115
- var s = i(e);
116
- return s ? "<" + s + ">" : "<...>";
117
- } catch {
118
- return "<...>";
119
- }
120
- }
121
- function r() {
122
- var e = P.A;
123
- return e === null ? null : e.getOwner();
124
- }
125
- function l() {
126
- return Error("react-stack-top-frame");
127
- }
128
- function S(e) {
129
- if (le.call(e, "key")) {
130
- var s = Object.getOwnPropertyDescriptor(e, "key").get;
131
- if (s && s.isReactWarning) return !1;
132
- }
133
- return e.key !== void 0;
134
- }
135
- function N(e, s) {
136
- function f() {
137
- D || (D = !0, console.error(
138
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
139
- s
140
- ));
141
- }
142
- f.isReactWarning = !0, Object.defineProperty(e, "key", {
143
- get: f,
144
- configurable: !0
145
- });
146
- }
147
- function G() {
148
- var e = i(this.type);
149
- return oe[e] || (oe[e] = !0, console.error(
150
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
151
- )), e = this.props.ref, e !== void 0 ? e : null;
152
- }
153
- function J(e, s, f, u, B, Z) {
154
- var y = f.ref;
155
- return e = {
156
- $$typeof: k,
157
- type: e,
158
- key: s,
159
- props: f,
160
- _owner: u
161
- }, (y !== void 0 ? y : null) !== null ? Object.defineProperty(e, "ref", {
162
- enumerable: !1,
163
- get: G
164
- }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
165
- configurable: !1,
166
- enumerable: !1,
167
- writable: !0,
168
- value: 0
169
- }), Object.defineProperty(e, "_debugInfo", {
170
- configurable: !1,
171
- enumerable: !1,
172
- writable: !0,
173
- value: null
174
- }), Object.defineProperty(e, "_debugStack", {
175
- configurable: !1,
176
- enumerable: !1,
177
- writable: !0,
178
- value: B
179
- }), Object.defineProperty(e, "_debugTask", {
180
- configurable: !1,
181
- enumerable: !1,
182
- writable: !0,
183
- value: Z
184
- }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
185
- }
186
- function A(e, s, f, u, B, Z) {
187
- var y = s.children;
188
- if (y !== void 0)
189
- if (u)
190
- if (ne(y)) {
191
- for (u = 0; u < y.length; u++)
192
- O(y[u]);
193
- Object.freeze && Object.freeze(y);
194
- } else
195
- console.error(
196
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
197
- );
198
- else O(y);
199
- if (le.call(s, "key")) {
200
- y = i(e);
201
- var _ = Object.keys(s).filter(function(fe) {
202
- return fe !== "key";
203
- });
204
- u = 0 < _.length ? "{key: someKey, " + _.join(": ..., ") + ": ...}" : "{key: someKey}", Q[y + u] || (_ = 0 < _.length ? "{" + _.join(": ..., ") + ": ...}" : "{}", console.error(
205
- `A props object containing a "key" prop is being spread into JSX:
206
- let props = %s;
207
- <%s {...props} />
208
- React keys must be passed directly to JSX without using spread:
209
- let props = %s;
210
- <%s key={someKey} {...props} />`,
211
- u,
212
- y,
213
- _,
214
- y
215
- ), Q[y + u] = !0);
216
- }
217
- if (y = null, f !== void 0 && (h(f), y = "" + f), S(s) && (h(s.key), y = "" + s.key), "key" in s) {
218
- f = {};
219
- for (var K in s)
220
- K !== "key" && (f[K] = s[K]);
221
- } else f = s;
222
- return y && N(
223
- f,
224
- typeof e == "function" ? e.displayName || e.name || "Unknown" : e
225
- ), J(
226
- e,
227
- y,
228
- f,
229
- r(),
230
- B,
231
- Z
232
- );
233
- }
234
- function O(e) {
235
- E(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === R && (e._payload.status === "fulfilled" ? E(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
236
- }
237
- function E(e) {
238
- return typeof e == "object" && e !== null && e.$$typeof === k;
239
- }
240
- var I = Ae, k = Symbol.for("react.transitional.element"), re = Symbol.for("react.portal"), U = Symbol.for("react.fragment"), q = Symbol.for("react.strict_mode"), p = Symbol.for("react.profiler"), $ = Symbol.for("react.consumer"), M = Symbol.for("react.context"), X = Symbol.for("react.forward_ref"), z = Symbol.for("react.suspense"), a = Symbol.for("react.suspense_list"), v = Symbol.for("react.memo"), R = Symbol.for("react.lazy"), T = Symbol.for("react.activity"), W = Symbol.for("react.client.reference"), P = I.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, le = Object.prototype.hasOwnProperty, ne = Array.isArray, j = console.createTask ? console.createTask : function() {
241
- return null;
242
- };
243
- I = {
244
- react_stack_bottom_frame: function(e) {
245
- return e();
246
- }
247
- };
248
- var D, oe = {}, L = I.react_stack_bottom_frame.bind(
249
- I,
250
- l
251
- )(), se = j(d(l)), Q = {};
252
- ie.Fragment = U, ie.jsx = function(e, s, f) {
253
- var u = 1e4 > P.recentlyCreatedOwnerStacks++;
254
- return A(
255
- e,
256
- s,
257
- f,
258
- !1,
259
- u ? Error("react-stack-top-frame") : L,
260
- u ? j(d(e)) : se
261
- );
262
- }, ie.jsxs = function(e, s, f) {
263
- var u = 1e4 > P.recentlyCreatedOwnerStacks++;
264
- return A(
265
- e,
266
- s,
267
- f,
268
- !0,
269
- u ? Error("react-stack-top-frame") : L,
270
- u ? j(d(e)) : se
271
- );
272
- };
273
- })()), ie;
274
- }
275
- var Te;
276
- function We() {
277
- return Te || (Te = 1, process.env.NODE_ENV === "production" ? de.exports = De() : de.exports = Le()), de.exports;
278
- }
279
- var n = We();
280
- const Be = ({
281
- isVisible: i,
282
- position: b,
283
- availableFields: h,
284
- filteredFields: d,
285
- filterQuery: r,
286
- allowCreate: l,
287
- onSelect: S,
288
- onClose: N,
289
- onCreateField: G
1
+ import { jsxs as o, jsx as r } from "react/jsx-runtime";
2
+ import { useState as I, useEffect as oe, useMemo as Fe, forwardRef as ze, useRef as J, useCallback as S, useImperativeHandle as Be } from "react";
3
+ const We = ({
4
+ isVisible: n,
5
+ position: d,
6
+ availableFields: g,
7
+ filteredFields: l,
8
+ filterQuery: u,
9
+ allowCreate: a,
10
+ onSelect: N,
11
+ onClose: P,
12
+ onCreateField: G,
13
+ existingFields: f = [],
14
+ onSelectExisting: T
290
15
  }) => {
291
- const [J, A] = Y(!1), [O, E] = Y(""), [I, k] = Y("inline");
292
- pe(() => {
293
- i || (A(!1), E(""), k("inline"));
294
- }, [i]);
295
- const re = ve(() => ({
16
+ const [m, y] = I(!1), [w, R] = I(""), [q, A] = I("inline"), [X, ie] = I(!0), [p, z] = I(!0);
17
+ oe(() => {
18
+ n || (y(!1), R(""), A("inline"));
19
+ }, [n]);
20
+ const V = Fe(() => ({
296
21
  position: "absolute",
297
- left: b?.left,
298
- top: b?.top,
22
+ left: d?.left,
23
+ top: d?.top,
299
24
  zIndex: 1e3,
300
25
  background: "white",
301
26
  border: "1px solid #ddd",
302
27
  borderRadius: "4px",
303
28
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
304
29
  padding: "8px 0",
305
- minWidth: "200px"
306
- }), [b]), U = d ?? h, q = !!r, p = ve(() => {
307
- const a = [], v = /* @__PURE__ */ new Map();
308
- return U.forEach((R) => {
309
- const T = R.category?.trim() || "Uncategorized", W = v.get(T);
310
- if (W !== void 0) {
311
- a[W].fields.push(R);
312
- return;
313
- }
314
- v.set(T, a.length), a.push({ category: T, fields: [R] });
315
- }), a;
316
- }, [U]), [$, M] = Y({});
317
- pe(() => {
318
- M((a) => {
319
- if (p.length === 0)
320
- return Object.keys(a).length === 0 ? a : {};
321
- const v = {};
322
- let R = Object.keys(a).length !== p.length;
323
- return p.forEach(({ category: T }, W) => {
324
- const P = q ? !0 : a[T] ?? W === 0;
325
- v[T] = P, !R && a[T] !== P && (R = !0);
326
- }), R ? v : a;
327
- });
328
- }, [p, q]);
329
- const X = C((a) => {
330
- M((v) => ({
331
- ...v,
332
- [a]: !v[a]
333
- }));
334
- }, []);
335
- if (!i) return null;
336
- const z = async () => {
337
- const a = O.trim();
338
- if (!a) return;
339
- const v = {
30
+ width: "280px"
31
+ }), [d]), O = l ?? g, j = !!u;
32
+ if (oe(() => {
33
+ j && z(!0);
34
+ }, [j]), !n) return null;
35
+ const D = async () => {
36
+ const x = w.trim();
37
+ if (!x) return;
38
+ const B = {
340
39
  id: `custom_${Date.now()}`,
341
- label: a,
342
- category: "Custom",
343
- metadata: { mode: I }
40
+ label: x,
41
+ metadata: { mode: q }
344
42
  };
345
43
  try {
346
44
  if (G) {
347
- const R = await G(v);
348
- S(R || v);
45
+ const h = await G(B);
46
+ N(h || B);
349
47
  } else
350
- S(v);
48
+ N(B);
351
49
  } finally {
352
- A(!1), E(""), k("inline");
50
+ y(!1), R(""), A("inline");
353
51
  }
354
52
  };
355
- return /* @__PURE__ */ n.jsxs("div", { className: "superdoc-field-menu", style: re, children: [
356
- q && /* @__PURE__ */ n.jsx(
53
+ return /* @__PURE__ */ o("div", { className: "superdoc-field-menu", style: V, children: [
54
+ j && /* @__PURE__ */ r(
357
55
  "div",
358
56
  {
359
57
  style: {
@@ -361,23 +59,17 @@ const Be = ({
361
59
  borderBottom: "1px solid #f0f0f0",
362
60
  marginBottom: "4px"
363
61
  },
364
- children: /* @__PURE__ */ n.jsxs("div", { style: { fontSize: "12px", color: "#6b7280" }, children: [
62
+ children: /* @__PURE__ */ o("div", { style: { fontSize: "12px", color: "#6b7280" }, children: [
365
63
  "Filtering results for",
366
- /* @__PURE__ */ n.jsx(
367
- "span",
368
- {
369
- style: { fontWeight: 600, color: "#111827", marginLeft: "4px" },
370
- children: r
371
- }
372
- )
64
+ /* @__PURE__ */ r("span", { style: { fontWeight: 600, color: "#111827", marginLeft: "4px" }, children: u })
373
65
  ] })
374
66
  }
375
67
  ),
376
- l && !J && /* @__PURE__ */ n.jsx(
68
+ a && !m && /* @__PURE__ */ r(
377
69
  "div",
378
70
  {
379
71
  className: "field-menu-item",
380
- onClick: () => A(!0),
72
+ onClick: () => y(!0),
381
73
  style: {
382
74
  padding: "8px 16px",
383
75
  cursor: "pointer",
@@ -387,16 +79,16 @@ const Be = ({
387
79
  children: "+ Create New Field"
388
80
  }
389
81
  ),
390
- l && J && /* @__PURE__ */ n.jsxs("div", { style: { padding: "8px 16px" }, children: [
391
- /* @__PURE__ */ n.jsx(
82
+ a && m && /* @__PURE__ */ o("div", { style: { padding: "8px 16px" }, children: [
83
+ /* @__PURE__ */ r(
392
84
  "input",
393
85
  {
394
86
  type: "text",
395
- value: O,
87
+ value: w,
396
88
  placeholder: "Field name...",
397
- onChange: (a) => E(a.target.value),
398
- onKeyDown: (a) => {
399
- a.key === "Enter" && z(), a.key === "Escape" && (A(!1), E(""), k("inline"));
89
+ onChange: (x) => R(x.target.value),
90
+ onKeyDown: (x) => {
91
+ x.key === "Enter" && D(), x.key === "Escape" && (y(!1), R(""), A("inline"));
400
92
  },
401
93
  autoFocus: !0,
402
94
  style: {
@@ -407,7 +99,7 @@ const Be = ({
407
99
  }
408
100
  }
409
101
  ),
410
- /* @__PURE__ */ n.jsxs(
102
+ /* @__PURE__ */ o(
411
103
  "div",
412
104
  {
413
105
  style: {
@@ -417,7 +109,7 @@ const Be = ({
417
109
  fontSize: "13px"
418
110
  },
419
111
  children: [
420
- /* @__PURE__ */ n.jsxs(
112
+ /* @__PURE__ */ o(
421
113
  "label",
422
114
  {
423
115
  style: {
@@ -427,20 +119,20 @@ const Be = ({
427
119
  cursor: "pointer"
428
120
  },
429
121
  children: [
430
- /* @__PURE__ */ n.jsx(
122
+ /* @__PURE__ */ r(
431
123
  "input",
432
124
  {
433
125
  type: "radio",
434
126
  value: "inline",
435
- checked: I === "inline",
436
- onChange: () => k("inline")
127
+ checked: q === "inline",
128
+ onChange: () => A("inline")
437
129
  }
438
130
  ),
439
131
  "Inline"
440
132
  ]
441
133
  }
442
134
  ),
443
- /* @__PURE__ */ n.jsxs(
135
+ /* @__PURE__ */ o(
444
136
  "label",
445
137
  {
446
138
  style: {
@@ -450,13 +142,13 @@ const Be = ({
450
142
  cursor: "pointer"
451
143
  },
452
144
  children: [
453
- /* @__PURE__ */ n.jsx(
145
+ /* @__PURE__ */ r(
454
146
  "input",
455
147
  {
456
148
  type: "radio",
457
149
  value: "block",
458
- checked: I === "block",
459
- onChange: () => k("block")
150
+ checked: q === "block",
151
+ onChange: () => A("block")
460
152
  }
461
153
  ),
462
154
  "Block"
@@ -466,7 +158,7 @@ const Be = ({
466
158
  ]
467
159
  }
468
160
  ),
469
- /* @__PURE__ */ n.jsxs(
161
+ /* @__PURE__ */ o(
470
162
  "div",
471
163
  {
472
164
  style: {
@@ -475,27 +167,27 @@ const Be = ({
475
167
  gap: "8px"
476
168
  },
477
169
  children: [
478
- /* @__PURE__ */ n.jsx(
170
+ /* @__PURE__ */ r(
479
171
  "button",
480
172
  {
481
- onClick: z,
482
- disabled: !O.trim(),
173
+ onClick: D,
174
+ disabled: !w.trim(),
483
175
  style: {
484
176
  padding: "4px 12px",
485
- background: O.trim() ? "#0066cc" : "#ccc",
177
+ background: w.trim() ? "#0066cc" : "#ccc",
486
178
  color: "white",
487
179
  border: "none",
488
180
  borderRadius: "3px",
489
- cursor: O.trim() ? "pointer" : "not-allowed"
181
+ cursor: w.trim() ? "pointer" : "not-allowed"
490
182
  },
491
183
  children: "Create"
492
184
  }
493
185
  ),
494
- /* @__PURE__ */ n.jsx(
186
+ /* @__PURE__ */ r(
495
187
  "button",
496
188
  {
497
189
  onClick: () => {
498
- A(!1), E(""), k("inline");
190
+ y(!1), R(""), A("inline");
499
191
  },
500
192
  style: {
501
193
  padding: "4px 12px",
@@ -511,7 +203,7 @@ const Be = ({
511
203
  }
512
204
  )
513
205
  ] }),
514
- l && h.length > 0 && /* @__PURE__ */ n.jsx(
206
+ a && g.length > 0 && /* @__PURE__ */ r(
515
207
  "div",
516
208
  {
517
209
  style: {
@@ -520,7 +212,110 @@ const Be = ({
520
212
  }
521
213
  }
522
214
  ),
523
- p.length === 0 ? /* @__PURE__ */ n.jsx(
215
+ f.length > 0 && (() => {
216
+ const x = /* @__PURE__ */ new Map();
217
+ f.forEach((h) => {
218
+ const Y = h.group || `individual-${h.id}`, ee = x.get(Y) || [];
219
+ ee.push(h), x.set(Y, ee);
220
+ });
221
+ const B = Array.from(x.values()).map((h) => ({
222
+ ...h[0],
223
+ count: h.length
224
+ }));
225
+ return /* @__PURE__ */ o("div", { style: { borderBottom: "1px solid #f0f0f0" }, children: [
226
+ /* @__PURE__ */ o(
227
+ "button",
228
+ {
229
+ type: "button",
230
+ onClick: () => ie(!X),
231
+ style: {
232
+ width: "100%",
233
+ display: "flex",
234
+ alignItems: "center",
235
+ justifyContent: "space-between",
236
+ padding: "8px 16px",
237
+ background: "transparent",
238
+ border: "none",
239
+ cursor: "pointer",
240
+ fontWeight: 500,
241
+ fontSize: "13px",
242
+ color: "#374151",
243
+ textAlign: "left"
244
+ },
245
+ children: [
246
+ /* @__PURE__ */ o("span", { children: [
247
+ "Existing Fields (",
248
+ B.length,
249
+ ")"
250
+ ] }),
251
+ /* @__PURE__ */ r(
252
+ "span",
253
+ {
254
+ "aria-hidden": !0,
255
+ style: {
256
+ display: "inline-block",
257
+ width: "8px",
258
+ height: "8px",
259
+ borderRight: "2px solid #666",
260
+ borderBottom: "2px solid #666",
261
+ transform: X ? "rotate(45deg)" : "rotate(-45deg)",
262
+ transition: "transform 0.2s ease"
263
+ }
264
+ }
265
+ )
266
+ ]
267
+ }
268
+ ),
269
+ X && /* @__PURE__ */ r("div", { style: { maxHeight: "300px", overflowY: "auto" }, children: B.map((h) => /* @__PURE__ */ o(
270
+ "div",
271
+ {
272
+ className: "field-menu-item",
273
+ onClick: () => T?.(h),
274
+ style: {
275
+ padding: "8px 16px",
276
+ cursor: "pointer",
277
+ display: "flex",
278
+ alignItems: "flex-start",
279
+ justifyContent: "space-between",
280
+ gap: "8px"
281
+ },
282
+ children: [
283
+ /* @__PURE__ */ o("div", { style: { flex: 1, minWidth: 0 }, children: [
284
+ /* @__PURE__ */ r("div", { style: { fontWeight: 500, fontSize: "13px" }, children: h.alias || h.id }),
285
+ /* @__PURE__ */ r(
286
+ "div",
287
+ {
288
+ style: {
289
+ fontSize: "11px",
290
+ color: "#9ca3af",
291
+ marginTop: "2px"
292
+ },
293
+ children: h.group ? `group (${h.count} fields)` : `ID: ${h.id}`
294
+ }
295
+ )
296
+ ] }),
297
+ /* @__PURE__ */ r(
298
+ "span",
299
+ {
300
+ style: {
301
+ fontSize: "11px",
302
+ color: "#6b7280",
303
+ padding: "2px 6px",
304
+ background: "#f3f4f6",
305
+ borderRadius: "3px",
306
+ textTransform: "capitalize",
307
+ flexShrink: 0
308
+ },
309
+ children: h.mode || "inline"
310
+ }
311
+ )
312
+ ]
313
+ },
314
+ h.group || h.id
315
+ )) })
316
+ ] });
317
+ })(),
318
+ O.length === 0 ? /* @__PURE__ */ r(
524
319
  "div",
525
320
  {
526
321
  style: {
@@ -531,104 +326,112 @@ const Be = ({
531
326
  },
532
327
  children: "No matching fields"
533
328
  }
534
- ) : p.map(({ category: a, fields: v }, R) => {
535
- const T = !!$[a], W = `${Math.max(v.length * 40, 0)}px`;
536
- return /* @__PURE__ */ n.jsxs(
537
- "div",
329
+ ) : /* @__PURE__ */ o("div", { style: { borderBottom: "1px solid #f0f0f0" }, children: [
330
+ /* @__PURE__ */ o(
331
+ "button",
538
332
  {
333
+ type: "button",
334
+ onClick: () => z(!p),
539
335
  style: {
540
- borderTop: R === 0 && l ? void 0 : "1px solid #f0f0f0"
336
+ width: "100%",
337
+ display: "flex",
338
+ alignItems: "center",
339
+ justifyContent: "space-between",
340
+ padding: "8px 16px",
341
+ background: "transparent",
342
+ border: "none",
343
+ cursor: "pointer",
344
+ fontWeight: 500,
345
+ fontSize: "13px",
346
+ color: "#374151",
347
+ textAlign: "left"
541
348
  },
542
349
  children: [
543
- /* @__PURE__ */ n.jsxs(
544
- "button",
350
+ /* @__PURE__ */ o("span", { children: [
351
+ "Available Fields (",
352
+ O.length,
353
+ ")"
354
+ ] }),
355
+ /* @__PURE__ */ r(
356
+ "span",
545
357
  {
546
- type: "button",
547
- onClick: () => X(a),
358
+ "aria-hidden": !0,
548
359
  style: {
549
- width: "100%",
550
- display: "flex",
551
- alignItems: "center",
552
- justifyContent: "space-between",
553
- padding: "8px 16px",
554
- background: "transparent",
555
- border: "none",
556
- cursor: "pointer",
557
- fontWeight: 500,
558
- textAlign: "left"
559
- },
560
- children: [
561
- /* @__PURE__ */ n.jsxs("span", { children: [
562
- a,
563
- " (",
564
- v.length,
565
- ")"
566
- ] }),
567
- /* @__PURE__ */ n.jsx(
568
- "span",
569
- {
570
- "aria-hidden": !0,
571
- style: {
572
- display: "inline-block",
573
- width: "8px",
574
- height: "8px",
575
- borderRight: "2px solid #666",
576
- borderBottom: "2px solid #666",
577
- transform: T ? "rotate(45deg)" : "rotate(-45deg)",
578
- transition: "transform 0.2s ease",
579
- marginLeft: "12px"
580
- }
581
- }
582
- )
583
- ]
360
+ display: "inline-block",
361
+ width: "8px",
362
+ height: "8px",
363
+ borderRight: "2px solid #666",
364
+ borderBottom: "2px solid #666",
365
+ transform: p ? "rotate(45deg)" : "rotate(-45deg)",
366
+ transition: "transform 0.2s ease"
367
+ }
584
368
  }
585
- ),
586
- /* @__PURE__ */ n.jsx(
587
- "div",
369
+ )
370
+ ]
371
+ }
372
+ ),
373
+ p && /* @__PURE__ */ r("div", { style: { maxHeight: "300px", overflowY: "auto" }, children: O.map((x) => /* @__PURE__ */ o(
374
+ "div",
375
+ {
376
+ className: "field-menu-item",
377
+ onClick: () => N(x),
378
+ style: {
379
+ padding: "8px 16px",
380
+ cursor: "pointer",
381
+ display: "flex",
382
+ alignItems: "flex-start",
383
+ justifyContent: "space-between",
384
+ gap: "8px"
385
+ },
386
+ children: [
387
+ /* @__PURE__ */ o("div", { style: { flex: 1, minWidth: 0 }, children: [
388
+ /* @__PURE__ */ r("div", { style: { fontWeight: 500, fontSize: "13px" }, children: x.label || x.id }),
389
+ /* @__PURE__ */ o(
390
+ "div",
391
+ {
392
+ style: {
393
+ fontSize: "11px",
394
+ color: "#9ca3af",
395
+ marginTop: "2px"
396
+ },
397
+ children: [
398
+ "ID: ",
399
+ x.id
400
+ ]
401
+ }
402
+ )
403
+ ] }),
404
+ /* @__PURE__ */ r(
405
+ "span",
588
406
  {
589
- "data-category": a,
590
- "aria-hidden": !T,
591
407
  style: {
592
- overflow: "hidden",
593
- maxHeight: T ? W : "0px",
594
- opacity: T ? 1 : 0,
595
- transition: "max-height 0.2s ease, opacity 0.2s ease",
596
- pointerEvents: T ? "auto" : "none"
408
+ fontSize: "11px",
409
+ color: "#6b7280",
410
+ padding: "2px 6px",
411
+ background: "#f3f4f6",
412
+ borderRadius: "3px",
413
+ textTransform: "capitalize",
414
+ flexShrink: 0
597
415
  },
598
- children: /* @__PURE__ */ n.jsx("div", { style: { padding: T ? "4px 0" : 0 }, children: v.map((P) => /* @__PURE__ */ n.jsx(
599
- "div",
600
- {
601
- className: "field-menu-item",
602
- onClick: () => S(P),
603
- style: {
604
- padding: "8px 16px",
605
- cursor: "pointer",
606
- display: "flex",
607
- alignItems: "center",
608
- justifyContent: "space-between"
609
- },
610
- children: /* @__PURE__ */ n.jsx("span", { style: { fontWeight: 500 }, children: P.label })
611
- },
612
- P.id
613
- )) })
416
+ children: x.metadata?.mode || "inline"
614
417
  }
615
418
  )
616
419
  ]
617
420
  },
618
- a
619
- );
620
- }),
621
- /* @__PURE__ */ n.jsx(
421
+ x.id
422
+ )) })
423
+ ] }),
424
+ /* @__PURE__ */ r(
622
425
  "div",
623
426
  {
624
427
  style: {
625
428
  borderTop: "1px solid #eee",
626
429
  marginTop: "4px"
627
430
  },
628
- children: /* @__PURE__ */ n.jsx(
431
+ children: /* @__PURE__ */ r(
629
432
  "button",
630
433
  {
631
- onClick: N,
434
+ onClick: P,
632
435
  style: {
633
436
  width: "100%",
634
437
  padding: "6px 16px",
@@ -643,566 +446,667 @@ const Be = ({
643
446
  }
644
447
  )
645
448
  ] });
646
- }, Ve = ({
647
- fields: i,
648
- onSelect: b,
649
- onDelete: h,
650
- selectedFieldId: d
651
- }) => /* @__PURE__ */ n.jsxs(
449
+ }, He = (n) => {
450
+ const d = n.split("-");
451
+ return d.length > 2 ? d[d.length - 1].substring(0, 6) : n.substring(0, 6);
452
+ }, ye = ({ field: n, onSelect: d, onDelete: g, isSelected: l, isGrouped: u = !1 }) => /* @__PURE__ */ o(
652
453
  "div",
653
454
  {
654
- className: "superdoc-field-list",
455
+ onClick: () => d(n),
655
456
  style: {
656
- width: "250px",
657
- background: "white",
658
- border: "1px solid #e5e7eb",
659
- borderRadius: "8px",
660
- padding: "16px"
457
+ position: "relative",
458
+ padding: "10px 12px",
459
+ background: l ? "#eff6ff" : "#f9fafb",
460
+ border: l ? "1px solid #3b82f6" : "1px solid #e5e7eb",
461
+ borderRadius: "6px",
462
+ cursor: "pointer",
463
+ transition: "all 0.2s",
464
+ fontSize: u ? "13px" : "14px"
465
+ },
466
+ onMouseEnter: (a) => {
467
+ l || (a.currentTarget.style.background = "#f3f4f6");
661
468
  },
469
+ onMouseLeave: (a) => {
470
+ l || (a.currentTarget.style.background = "#f9fafb");
471
+ },
472
+ title: n.alias,
662
473
  children: [
663
- /* @__PURE__ */ n.jsxs("h3", { style: { margin: "0 0 16px 0", fontSize: "16px", fontWeight: "600" }, children: [
664
- "Template Fields (",
665
- i.length,
666
- ")"
667
- ] }),
668
- i.length === 0 ? /* @__PURE__ */ n.jsxs(
669
- "div",
474
+ /* @__PURE__ */ r(
475
+ "button",
670
476
  {
671
- style: {
672
- color: "#9ca3af",
673
- fontSize: "14px",
674
- textAlign: "center",
675
- padding: "20px 0"
477
+ onClick: (a) => {
478
+ a.stopPropagation(), g(n.id);
676
479
  },
677
- children: [
678
- "No fields yet. Type ",
679
- "{{",
680
- " to add a field."
681
- ]
682
- }
683
- ) : /* @__PURE__ */ n.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: i.map((r) => /* @__PURE__ */ n.jsxs(
684
- "div",
685
- {
686
- onClick: () => b(r),
687
480
  style: {
688
- position: "relative",
689
- padding: "12px",
690
- background: d === r.id ? "#eff6ff" : "#f9fafb",
691
- border: d === r.id ? "1px solid #3b82f6" : "1px solid #e5e7eb",
692
- borderRadius: "6px",
481
+ position: "absolute",
482
+ top: "6px",
483
+ right: "6px",
484
+ padding: "4px",
485
+ background: "transparent",
486
+ border: "none",
693
487
  cursor: "pointer",
694
- transition: "all 0.2s"
488
+ color: "#9ca3af",
489
+ transition: "color 0.2s",
490
+ display: "flex",
491
+ alignItems: "center",
492
+ justifyContent: "center"
695
493
  },
696
- onMouseEnter: (l) => {
697
- d !== r.id && (l.currentTarget.style.background = "#f3f4f6");
494
+ onMouseEnter: (a) => {
495
+ a.currentTarget.style.color = "#ef4444";
698
496
  },
699
- onMouseLeave: (l) => {
700
- d !== r.id && (l.currentTarget.style.background = "#f9fafb");
497
+ onMouseLeave: (a) => {
498
+ a.currentTarget.style.color = "#9ca3af";
701
499
  },
702
- title: r.alias,
703
- children: [
704
- /* @__PURE__ */ n.jsx(
705
- "button",
706
- {
707
- onClick: (l) => {
708
- l.stopPropagation(), h(r.id);
709
- },
710
- style: {
711
- position: "absolute",
712
- top: "8px",
713
- right: "8px",
714
- padding: "4px",
715
- background: "transparent",
716
- border: "none",
717
- cursor: "pointer",
718
- color: "#9ca3af",
719
- transition: "color 0.2s",
720
- display: "flex",
721
- alignItems: "center",
722
- justifyContent: "center"
723
- },
724
- onMouseEnter: (l) => {
725
- l.currentTarget.style.color = "#ef4444";
726
- },
727
- onMouseLeave: (l) => {
728
- l.currentTarget.style.color = "#9ca3af";
729
- },
730
- title: "Delete field",
731
- children: /* @__PURE__ */ n.jsx(
732
- "svg",
733
- {
734
- width: "16",
735
- height: "16",
736
- viewBox: "0 0 16 16",
737
- fill: "none",
738
- xmlns: "http://www.w3.org/2000/svg",
739
- children: /* @__PURE__ */ n.jsx(
740
- "path",
741
- {
742
- d: "M6 2V1.5C6 1.22386 6.22386 1 6.5 1H9.5C9.77614 1 10 1.22386 10 1.5V2M2 4H14M12.6667 4L12.1991 11.0129C12.129 12.065 12.0939 12.5911 11.8667 12.99C11.6666 13.3412 11.3648 13.6235 11.0011 13.7998C10.588 14 10.0607 14 9.00623 14H6.99377C5.93927 14 5.41202 14 4.99889 13.7998C4.63517 13.6235 4.33339 13.3412 4.13332 12.99C3.90607 12.5911 3.871 12.065 3.80086 11.0129L3.33333 4",
743
- stroke: "currentColor",
744
- strokeWidth: "1.5",
745
- strokeLinecap: "round",
746
- strokeLinejoin: "round"
747
- }
748
- )
749
- }
750
- )
751
- }
752
- ),
753
- /* @__PURE__ */ n.jsxs("div", { style: { paddingRight: "24px" }, children: [
754
- /* @__PURE__ */ n.jsx(
500
+ title: "Delete field",
501
+ children: /* @__PURE__ */ r(
502
+ "svg",
503
+ {
504
+ width: "14",
505
+ height: "14",
506
+ viewBox: "0 0 16 16",
507
+ fill: "none",
508
+ xmlns: "http://www.w3.org/2000/svg",
509
+ children: /* @__PURE__ */ r(
510
+ "path",
511
+ {
512
+ d: "M6 2V1.5C6 1.22386 6.22386 1 6.5 1H9.5C9.77614 1 10 1.22386 10 1.5V2M2 4H14M12.6667 4L12.1991 11.0129C12.129 12.065 12.0939 12.5911 11.8667 12.99C11.6666 13.3412 11.3648 13.6235 11.0011 13.7998C10.588 14 10.0607 14 9.00623 14H6.99377C5.93927 14 5.41202 14 4.99889 13.7998C4.63517 13.6235 4.33339 13.3412 4.13332 12.99C3.90607 12.5911 3.871 12.065 3.80086 11.0129L3.33333 4",
513
+ stroke: "currentColor",
514
+ strokeWidth: "1.5",
515
+ strokeLinecap: "round",
516
+ strokeLinejoin: "round"
517
+ }
518
+ )
519
+ }
520
+ )
521
+ }
522
+ ),
523
+ /* @__PURE__ */ o("div", { style: { paddingRight: "24px" }, children: [
524
+ /* @__PURE__ */ r(
525
+ "div",
526
+ {
527
+ style: {
528
+ fontWeight: "500",
529
+ fontSize: u ? "12px" : "14px",
530
+ color: u ? "#6b7280" : "#111827"
531
+ },
532
+ children: n.alias || n.id
533
+ }
534
+ ),
535
+ /* @__PURE__ */ o(
536
+ "div",
537
+ {
538
+ style: {
539
+ display: "flex",
540
+ alignItems: "center",
541
+ gap: "6px",
542
+ fontSize: "11px",
543
+ color: "#9ca3af",
544
+ marginTop: "2px"
545
+ },
546
+ children: [
547
+ /* @__PURE__ */ o("span", { children: [
548
+ "ID: ",
549
+ n.id
550
+ ] }),
551
+ n.mode && /* @__PURE__ */ r(
552
+ "span",
553
+ {
554
+ style: {
555
+ fontSize: "9px",
556
+ padding: "2px 5px",
557
+ borderRadius: "3px",
558
+ background: n.mode === "block" ? "#dbeafe" : "#f3f4f6",
559
+ color: n.mode === "block" ? "#1e40af" : "#4b5563",
560
+ fontWeight: "500"
561
+ },
562
+ children: n.mode
563
+ }
564
+ )
565
+ ]
566
+ }
567
+ )
568
+ ] })
569
+ ]
570
+ }
571
+ ), Le = ({
572
+ fields: n,
573
+ onSelect: d,
574
+ onDelete: g,
575
+ selectedFieldId: l
576
+ }) => {
577
+ const [u, a] = I(/* @__PURE__ */ new Set()), { groupedFields: N, ungroupedFields: P } = Fe(() => {
578
+ const f = {}, T = [];
579
+ return n.forEach((m) => {
580
+ m.group ? (f[m.group] || (f[m.group] = []), f[m.group].push(m)) : T.push(m);
581
+ }), { groupedFields: f, ungroupedFields: T };
582
+ }, [n]), G = (f) => {
583
+ a((T) => {
584
+ const m = new Set(T);
585
+ return m.has(f) ? m.delete(f) : m.add(f), m;
586
+ });
587
+ };
588
+ return /* @__PURE__ */ o(
589
+ "div",
590
+ {
591
+ className: "superdoc-field-list",
592
+ style: {
593
+ width: "250px",
594
+ background: "white",
595
+ border: "1px solid #e5e7eb",
596
+ borderRadius: "8px",
597
+ padding: "16px"
598
+ },
599
+ children: [
600
+ /* @__PURE__ */ o("h3", { style: { margin: "0 0 16px 0", fontSize: "16px", fontWeight: "600" }, children: [
601
+ "Template Fields (",
602
+ n.length,
603
+ ")"
604
+ ] }),
605
+ n.length === 0 ? /* @__PURE__ */ o(
606
+ "div",
607
+ {
608
+ style: {
609
+ color: "#9ca3af",
610
+ fontSize: "14px",
611
+ textAlign: "center",
612
+ padding: "20px 0"
613
+ },
614
+ children: [
615
+ "No fields yet. Type ",
616
+ "{{",
617
+ " to add a field."
618
+ ]
619
+ }
620
+ ) : /* @__PURE__ */ o("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
621
+ P.map((f) => /* @__PURE__ */ r(
622
+ ye,
623
+ {
624
+ field: f,
625
+ onSelect: d,
626
+ onDelete: g,
627
+ isSelected: l === f.id
628
+ },
629
+ f.id
630
+ )),
631
+ Object.entries(N).map(([f, T]) => {
632
+ const m = u.has(f), y = T[0];
633
+ return /* @__PURE__ */ o("div", { children: [
634
+ /* @__PURE__ */ r(
755
635
  "div",
756
636
  {
757
637
  style: {
758
- fontWeight: "500",
759
- fontSize: "14px",
760
- marginBottom: r.alias && r.alias !== r.id ? "4px" : "0"
638
+ position: "relative",
639
+ padding: "12px",
640
+ background: "#f9fafb",
641
+ border: "1px solid #e5e7eb",
642
+ borderRadius: "6px",
643
+ cursor: "pointer",
644
+ transition: "all 0.2s"
761
645
  },
762
- children: r.id
646
+ onClick: () => G(f),
647
+ onMouseEnter: (w) => {
648
+ w.currentTarget.style.background = "#f3f4f6";
649
+ },
650
+ onMouseLeave: (w) => {
651
+ w.currentTarget.style.background = "#f9fafb";
652
+ },
653
+ children: /* @__PURE__ */ o("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
654
+ /* @__PURE__ */ r("span", { style: { fontSize: "12px", color: "#6b7280" }, children: m ? "▼" : "▶" }),
655
+ /* @__PURE__ */ o("div", { style: { flex: 1 }, children: [
656
+ /* @__PURE__ */ r("div", { style: { fontWeight: "500", fontSize: "14px" }, children: y.alias }),
657
+ /* @__PURE__ */ o(
658
+ "div",
659
+ {
660
+ style: {
661
+ fontSize: "11px",
662
+ color: "#9ca3af",
663
+ marginTop: "2px"
664
+ },
665
+ children: [
666
+ "group: ",
667
+ He(f),
668
+ " (",
669
+ T.length,
670
+ " fields)"
671
+ ]
672
+ }
673
+ )
674
+ ] })
675
+ ] })
763
676
  }
764
677
  ),
765
- /* @__PURE__ */ n.jsxs(
678
+ m && /* @__PURE__ */ r(
766
679
  "div",
767
680
  {
768
681
  style: {
682
+ marginLeft: "16px",
683
+ marginTop: "4px",
769
684
  display: "flex",
770
- alignItems: "center",
771
- gap: "6px",
772
- fontSize: "12px",
773
- color: "#4b5563"
685
+ flexDirection: "column",
686
+ gap: "4px"
774
687
  },
775
- children: [
776
- r.alias && r.alias !== r.id && /* @__PURE__ */ n.jsx("span", { children: r.alias }),
777
- r.mode && /* @__PURE__ */ n.jsx(
778
- "span",
779
- {
780
- style: {
781
- fontSize: "10px",
782
- padding: "2px 6px",
783
- borderRadius: "4px",
784
- background: r.mode === "block" ? "#dbeafe" : "#f3f4f6",
785
- color: r.mode === "block" ? "#1e40af" : "#4b5563",
786
- fontWeight: "500"
787
- },
788
- children: r.mode
789
- }
790
- )
791
- ]
688
+ children: T.map((w) => /* @__PURE__ */ r(
689
+ ye,
690
+ {
691
+ field: w,
692
+ onSelect: d,
693
+ onDelete: g,
694
+ isSelected: l === w.id,
695
+ isGrouped: !0
696
+ },
697
+ w.id
698
+ ))
792
699
  }
793
700
  )
794
- ] })
795
- ]
796
- },
797
- r.id
798
- )) })
799
- ]
800
- }
801
- ), xe = (i) => {
802
- const b = i.helpers?.structuredContentCommands;
803
- return b?.getStructuredContentTags ? (b.getStructuredContentTags(i.state) || []).map((d) => {
804
- const r = d?.node ?? d, l = r?.attrs ?? {}, N = (r?.type?.name || "").includes("Block") ? "block" : "inline";
701
+ ] }, f);
702
+ })
703
+ ] })
704
+ ]
705
+ }
706
+ );
707
+ }, Q = (n) => {
708
+ const d = n.helpers?.structuredContentCommands;
709
+ return d?.getStructuredContentTags ? (d.getStructuredContentTags(n.state) || []).map((l) => {
710
+ const u = l?.node ?? l, a = u?.attrs ?? {}, P = (u?.type?.name || "").includes("Block") ? "block" : "inline";
805
711
  return {
806
- id: l.id,
807
- alias: l.alias || l.label || "",
808
- tag: l.tag,
809
- mode: N
712
+ id: a.id,
713
+ alias: a.alias || a.label || "",
714
+ tag: a.tag,
715
+ mode: P,
716
+ group: d.getGroup?.(a.tag) ?? void 0
810
717
  };
811
718
  }) : [];
812
- }, je = (i, b) => {
813
- if (i === b) return !0;
814
- if (i.length !== b.length) return !1;
815
- for (let h = 0; h < i.length; h += 1) {
816
- const d = i[h], r = b[h];
817
- if (!r || d.id !== r.id || d.alias !== r.alias || d.tag !== r.tag || d.position !== r.position || d.mode !== r.mode)
719
+ }, ve = (n, d) => {
720
+ if (n === d) return !0;
721
+ if (n.length !== d.length) return !1;
722
+ for (let g = 0; g < n.length; g += 1) {
723
+ const l = n[g], u = d[g];
724
+ if (!u || l.id !== u.id || l.alias !== u.alias || l.tag !== u.tag || l.position !== u.position || l.mode !== u.mode || l.group !== u.group)
818
725
  return !1;
819
726
  }
820
727
  return !0;
821
- }, Ye = (i) => {
822
- if (!i) return null;
823
- if (i === !0)
728
+ }, Pe = (n) => {
729
+ if (!n) return null;
730
+ if (n === !0)
824
731
  return {
825
732
  selector: "#superdoc-toolbar",
826
733
  config: {},
827
734
  renderDefaultContainer: !0
828
735
  };
829
- if (typeof i == "string")
736
+ if (typeof n == "string")
830
737
  return {
831
- selector: i,
738
+ selector: n,
832
739
  config: {},
833
740
  renderDefaultContainer: !1
834
741
  };
835
- const { selector: b, ...h } = i;
742
+ const { selector: d, ...g } = n;
836
743
  return {
837
- selector: b || "#superdoc-toolbar",
838
- config: h,
839
- renderDefaultContainer: b === void 0
744
+ selector: d || "#superdoc-toolbar",
745
+ config: g,
746
+ renderDefaultContainer: d === void 0
840
747
  };
841
- }, ue = 10, $e = 250, ze = 300, we = (i) => {
842
- const b = window.innerWidth - $e - ue, h = window.innerHeight - ze - ue, d = Math.min(i.left, b), r = Math.min(i.top, h);
748
+ }, re = 10, Ae = 250, Ve = 300, Ce = (n) => {
749
+ const d = window.innerWidth - Ae - re, g = window.innerHeight - Ve - re, l = Math.min(n.left, d), u = Math.min(n.top, g);
843
750
  return new DOMRect(
844
- Math.max(d, ue),
845
- Math.max(r, ue),
846
- i.width,
847
- i.height
751
+ Math.max(l, re),
752
+ Math.max(u, re),
753
+ n.width,
754
+ n.height
848
755
  );
849
- }, Ue = Ie((i, b) => {
756
+ }, je = ze((n, d) => {
850
757
  const {
851
- document: h,
852
- fields: d = {},
853
- menu: r = {},
854
- list: l = {},
855
- toolbar: S,
856
- onReady: N,
758
+ document: g,
759
+ fields: l = {},
760
+ menu: u = {},
761
+ list: a = {},
762
+ toolbar: N,
763
+ onReady: P,
857
764
  onTrigger: G,
858
- onFieldInsert: J,
859
- onFieldUpdate: A,
860
- onFieldDelete: O,
861
- onFieldsChange: E,
862
- onFieldSelect: I,
863
- onFieldCreate: k,
864
- className: re,
865
- style: U,
866
- documentHeight: q = "600px"
867
- } = i, [p, $] = Y(
868
- d.initial || []
869
- ), [M, X] = Y(null), [z, a] = Y(!1), [v, R] = Y(), [T, W] = Y(""), [P, le] = Y(() => d.available || []), ne = te(null), j = te(null), D = te(null), oe = te(d);
870
- oe.current = d;
871
- const L = te(null), se = te(z);
872
- pe(() => {
873
- se.current = z;
874
- }, [z]);
875
- const Q = r.trigger || "{{", e = oe.current.available || [], s = C(
876
- (t) => {
877
- const o = t.trim().toLowerCase();
878
- return o ? e.filter((c) => {
879
- const m = c.label.toLowerCase(), F = c.category?.toLowerCase() || "";
880
- return m.includes(o) || F.includes(o);
881
- }) : e;
765
+ onFieldInsert: f,
766
+ onFieldUpdate: T,
767
+ onFieldDelete: m,
768
+ onFieldsChange: y,
769
+ onFieldSelect: w,
770
+ onFieldCreate: R,
771
+ onExport: q,
772
+ className: A,
773
+ style: X,
774
+ documentHeight: ie = "600px"
775
+ } = n, [p, z] = I(l.initial || []), [V, O] = I(null), [j, D] = I(!1), [x, B] = I(), [h, Y] = I(""), [ee, we] = I(
776
+ () => l.available || []
777
+ ), se = J(null), F = J(null), M = J(null), pe = J(l);
778
+ pe.current = l;
779
+ const W = J(null), fe = J(j);
780
+ oe(() => {
781
+ fe.current = j;
782
+ }, [j]);
783
+ const te = u.trigger || "{{", le = pe.current.available || [], ge = S(
784
+ (e) => {
785
+ const t = e.trim().toLowerCase();
786
+ return t ? le.filter((i) => i.label.toLowerCase().includes(t)) : le;
882
787
  },
883
- [e]
884
- ), f = C(
885
- (t) => {
886
- W(t), le(s(t));
788
+ [le]
789
+ ), de = S(
790
+ (e) => {
791
+ Y(e), we(ge(e));
887
792
  },
888
- [s]
889
- ), u = C(() => {
890
- f("");
891
- }, [f]), B = C(
892
- (t, o) => {
893
- if (!j.current?.activeEditor) return !1;
894
- const c = j.current.activeEditor, m = p, F = t === "inline" ? c.commands.insertStructuredContentInline?.({
793
+ [ge]
794
+ ), H = S(() => {
795
+ de("");
796
+ }, [de]), K = S(
797
+ (e, t) => {
798
+ if (!F.current?.activeEditor) return !1;
799
+ const i = F.current.activeEditor, v = p, b = e === "inline" ? i.commands.insertStructuredContentInline?.({
895
800
  attrs: {
896
- alias: o.alias,
897
- tag: o.metadata ? JSON.stringify(o.metadata) : o.category
801
+ alias: t.alias,
802
+ tag: t.metadata ? JSON.stringify(t.metadata) : void 0
898
803
  },
899
- text: o.defaultValue || o.alias
900
- }) : c.commands.insertStructuredContentBlock?.({
804
+ text: t.defaultValue || t.alias
805
+ }) : i.commands.insertStructuredContentBlock?.({
901
806
  attrs: {
902
- alias: o.alias,
903
- tag: o.metadata ? JSON.stringify(o.metadata) : o.category
807
+ alias: t.alias,
808
+ tag: t.metadata ? JSON.stringify(t.metadata) : void 0
904
809
  },
905
- text: o.defaultValue || o.alias
810
+ text: t.defaultValue || t.alias
906
811
  });
907
- if (F) {
908
- const w = xe(c);
909
- $(w), E?.(w);
910
- const x = w.find(
911
- (g) => !m.some((H) => H.id === g.id)
812
+ if (b) {
813
+ const c = Q(i);
814
+ z(c), y?.(c);
815
+ const E = c.find(
816
+ (C) => !v.some((s) => s.id === C.id)
912
817
  );
913
- x && J?.(x);
818
+ E && f?.(E);
914
819
  }
915
- return F;
820
+ return b;
916
821
  },
917
- [J, E, p]
918
- ), Z = C(
919
- (t, o) => {
920
- if (!j.current?.activeEditor) return !1;
921
- const m = j.current.activeEditor.commands.updateStructuredContentById?.(t, {
922
- attrs: o
822
+ [f, y, p]
823
+ ), Z = S(
824
+ (e, t) => {
825
+ if (!F.current?.activeEditor) return !1;
826
+ const v = F.current.activeEditor.commands.updateStructuredContentById?.(e, {
827
+ attrs: t
923
828
  });
924
- return m && $((F) => {
925
- const w = F.map(
926
- (g) => g.id === t ? { ...g, ...o } : g
927
- );
928
- E?.(w);
929
- const x = w.find((g) => g.id === t);
930
- return x && A?.(x), w;
931
- }), m;
829
+ return v && z((b) => {
830
+ const c = b.map((C) => C.id === e ? { ...C, ...t } : C);
831
+ y?.(c);
832
+ const E = c.find((C) => C.id === e);
833
+ return E && T?.(E), c;
834
+ }), v;
932
835
  },
933
- [A, E]
934
- ), y = C(
935
- (t) => {
936
- const o = j.current?.activeEditor;
937
- if (!o) {
938
- console.warn(
939
- "[SuperDocTemplateBuilder] deleteField called without active editor"
940
- );
941
- let x = !1;
942
- return $((g) => {
943
- if (!g.some((V) => V.id === t)) return g;
944
- const H = g.filter((V) => V.id !== t);
945
- return x = !0, E?.(H), H;
946
- }), x && (O?.(t), X((g) => g === t ? null : g)), x;
836
+ [T, y]
837
+ ), ae = S(
838
+ (e) => {
839
+ const t = F.current?.activeEditor;
840
+ if (!t) {
841
+ let s = !1;
842
+ return z((k) => {
843
+ if (!k.some((L) => L.id === e)) return k;
844
+ const U = k.filter((L) => L.id !== e);
845
+ return s = !0, y?.(U), U;
846
+ }), s && (m?.(e), O((k) => k === e ? null : k)), s;
947
847
  }
948
- let c = !1;
848
+ const v = p.find((s) => s.id === e)?.group;
849
+ let b = !1;
949
850
  try {
950
- c = o.commands.deleteStructuredContentById?.(t) ?? !1;
951
- } catch (x) {
952
- console.error(
953
- "[SuperDocTemplateBuilder] Delete command failed:",
954
- x
955
- );
851
+ b = t.commands.deleteStructuredContentById?.(e) ?? !1;
852
+ } catch {
853
+ b = !1;
956
854
  }
957
- let m = xe(o);
958
- const F = m.some((x) => x.id === t);
959
- !c && F && (m = m.filter((x) => x.id !== t));
960
- let w = !1;
961
- return $((x) => {
962
- if (je(x, m))
963
- return x;
964
- const g = x.some((V) => V.id === t), H = m.some((V) => V.id === t);
965
- return g && !H && (w = !0), E?.(m), m;
966
- }), w && (O?.(t), X((x) => x === t ? null : x)), c || w;
855
+ let c = Q(t);
856
+ const E = c.some((s) => s.id === e);
857
+ if (!b && E && (c = c.filter((s) => s.id !== e)), v) {
858
+ const s = c.filter((k) => k.group === v);
859
+ if (s.length === 1) {
860
+ const k = s[0];
861
+ t.commands.updateStructuredContentById?.(k.id, {
862
+ attrs: { tag: void 0 }
863
+ }), c = Q(t);
864
+ }
865
+ }
866
+ let C = !1;
867
+ return z((s) => {
868
+ if (ve(s, c))
869
+ return s;
870
+ const k = s.some((L) => L.id === e), U = c.some((L) => L.id === e);
871
+ return k && !U && (C = !0), y?.(c), c;
872
+ }), C && (m?.(e), O((s) => s === e ? null : s)), b || C;
967
873
  },
968
- [O, E]
969
- ), _ = C(
970
- (t) => {
971
- if (!j.current?.activeEditor) return;
972
- j.current.activeEditor.commands.selectStructuredContentById?.(t), X(t);
973
- const c = p.find((m) => m.id === t);
974
- c && I?.(c);
874
+ [m, y, p]
875
+ ), _ = S(
876
+ (e) => {
877
+ if (!F.current?.activeEditor) return;
878
+ F.current.activeEditor.commands.selectStructuredContentById?.(e), O(e);
879
+ const i = p.find((v) => v.id === e);
880
+ i && w?.(i);
975
881
  },
976
- [p, I]
977
- ), K = C(
978
- (t) => {
979
- if (!t) return;
980
- const o = xe(t);
981
- $((c) => je(c, o) ? c : (E?.(o), o));
882
+ [p, w]
883
+ ), ce = S(
884
+ (e) => {
885
+ if (!e) return;
886
+ const t = Q(e);
887
+ z((i) => ve(i, t) ? i : (y?.(t), t));
982
888
  },
983
- [E]
889
+ [y]
984
890
  );
985
- pe(() => ne.current ? ((async () => {
986
- const { SuperDoc: o } = await import("superdoc"), c = {
987
- selector: ne.current,
988
- document: h?.source,
989
- documentMode: h?.mode || "editing",
990
- onReady: () => {
991
- if (m.activeEditor) {
992
- const F = m.activeEditor;
993
- F.on("update", ({ editor: w }) => {
994
- const { state: x } = w, { from: g } = x.selection;
995
- if (g >= Q.length) {
996
- const me = g - Q.length;
997
- if (x.doc.textBetween(me, g) === Q) {
998
- const he = w.view.coordsAtPos(g), be = we(
999
- new DOMRect(he.left, he.top, 0, 0)
1000
- ), ye = () => {
1001
- const ce = j.current?.activeEditor;
1002
- if (!ce) return;
1003
- const Oe = ce.state.selection.from, Pe = ce.state.tr.delete(me, Oe);
1004
- ce.view.dispatch(Pe);
1005
- };
1006
- D.current = ye, L.current = g, R(be), a(!0), u(), G?.({
1007
- position: { from: me, to: g },
1008
- bounds: be,
1009
- cleanup: ye
1010
- });
1011
- return;
1012
- }
1013
- }
1014
- if (!se.current)
1015
- return;
1016
- if (L.current == null) {
1017
- a(!1), u();
1018
- return;
1019
- }
1020
- if (g < L.current) {
1021
- a(!1), L.current = null, u();
1022
- return;
1023
- }
1024
- const H = x.doc.textBetween(
1025
- L.current,
1026
- g
1027
- );
1028
- f(H);
1029
- const V = w.view.coordsAtPos(g), Ne = we(
1030
- new DOMRect(V.left, V.top, 0, 0)
1031
- );
1032
- R(Ne);
1033
- }), F.on("update", () => {
1034
- K(F);
1035
- }), K(F);
891
+ oe(() => se.current ? ((async () => {
892
+ const { SuperDoc: t } = await import("superdoc"), i = {
893
+ comments: !1,
894
+ ...$ && {
895
+ toolbar: {
896
+ selector: $.selector,
897
+ toolbarGroups: $.config.toolbarGroups || ["center"],
898
+ excludeItems: $.config.excludeItems || [],
899
+ ...$.config
1036
900
  }
1037
- N?.();
1038
901
  }
1039
- }, m = new o({
1040
- ...c,
1041
- ...ee && {
1042
- toolbar: ee.selector,
1043
- modules: {
1044
- toolbar: {
1045
- selector: ee.selector,
1046
- toolbarGroups: ee.config.toolbarGroups || ["center"],
1047
- excludeItems: ee.config.excludeItems || [],
1048
- ...ee.config
902
+ }, v = () => {
903
+ if (b.activeEditor) {
904
+ const c = b.activeEditor;
905
+ c.on("update", ({ editor: E }) => {
906
+ const { state: C } = E, { from: s } = C.selection;
907
+ if (s >= te.length) {
908
+ const ue = s - te.length;
909
+ if (C.doc.textBetween(ue, s) === te) {
910
+ const xe = E.view.coordsAtPos(s), he = Ce(new DOMRect(xe.left, xe.top, 0, 0)), be = () => {
911
+ const ne = F.current?.activeEditor;
912
+ if (!ne) return;
913
+ const De = ne.state.selection.from, Ne = ne.state.tr.delete(ue, De);
914
+ ne.view.dispatch(Ne);
915
+ };
916
+ M.current = be, W.current = s, B(he), D(!0), H(), G?.({
917
+ position: { from: ue, to: s },
918
+ bounds: he,
919
+ cleanup: be
920
+ });
921
+ return;
922
+ }
1049
923
  }
1050
- }
924
+ if (!fe.current)
925
+ return;
926
+ if (W.current == null) {
927
+ D(!1), H();
928
+ return;
929
+ }
930
+ if (s < W.current) {
931
+ D(!1), W.current = null, H();
932
+ return;
933
+ }
934
+ const k = C.doc.textBetween(W.current, s);
935
+ de(k);
936
+ const U = E.view.coordsAtPos(s), L = Ce(new DOMRect(U.left, U.top, 0, 0));
937
+ B(L);
938
+ }), c.on("update", () => {
939
+ ce(c);
940
+ }), ce(c);
1051
941
  }
942
+ P?.();
943
+ }, b = new t({
944
+ selector: se.current,
945
+ document: g?.source,
946
+ documentMode: g?.mode || "editing",
947
+ modules: i,
948
+ toolbar: $?.selector,
949
+ onReady: v
1052
950
  });
1053
- j.current = m;
951
+ F.current = b;
1054
952
  })(), () => {
1055
- D.current = null, L.current = null;
1056
- const o = j.current;
1057
- o && typeof o.destroy == "function" && o.destroy(), j.current = null;
1058
- }) : void 0, [
1059
- h?.source,
1060
- h?.mode,
1061
- Q,
1062
- K,
1063
- N,
1064
- G,
1065
- S
1066
- ]);
1067
- const fe = C(
1068
- async (t) => {
1069
- D.current && (D.current(), D.current = null), L.current = null, u();
1070
- const o = t.metadata?.mode || "inline";
1071
- if (t.id.startsWith("custom_") && k)
1072
- try {
1073
- const c = await k(t);
1074
- if (c) {
1075
- const m = c.metadata?.mode || o;
1076
- B(m, {
1077
- alias: c.label,
1078
- category: c.category,
1079
- metadata: c.metadata,
1080
- defaultValue: c.defaultValue
1081
- }), a(!1);
1082
- return;
1083
- }
1084
- } catch (c) {
1085
- console.error("Field creation failed:", c);
953
+ M.current = null, W.current = null;
954
+ const t = F.current;
955
+ t && typeof t.destroy == "function" && t.destroy(), F.current = null;
956
+ }) : void 0, [g?.source, g?.mode, te, ce, P, G, N]);
957
+ const ke = S(
958
+ async (e) => {
959
+ M.current && (M.current(), M.current = null), W.current = null, H();
960
+ const t = e.metadata?.mode || "inline";
961
+ if (e.id.startsWith("custom_") && R) {
962
+ const i = await R(e);
963
+ if (i) {
964
+ const v = i.metadata?.mode || t;
965
+ K(v, {
966
+ alias: i.label,
967
+ metadata: i.metadata,
968
+ defaultValue: i.defaultValue
969
+ }), D(!1);
970
+ return;
1086
971
  }
1087
- B(o, {
1088
- alias: t.label,
1089
- category: t.category,
1090
- metadata: t.metadata,
1091
- defaultValue: t.defaultValue
1092
- }), a(!1);
972
+ }
973
+ K(t, {
974
+ alias: e.label,
975
+ metadata: e.metadata,
976
+ defaultValue: e.defaultValue
977
+ }), D(!1);
1093
978
  },
1094
- [B, k, u]
1095
- ), ke = C(() => {
1096
- a(!1), L.current = null, u(), D.current && (D.current(), D.current = null);
1097
- }, [u]), _e = C(() => {
1098
- if (!j.current?.activeEditor || p.length === 0)
1099
- return;
1100
- const t = p.findIndex(
1101
- (c) => c.id === M
1102
- ), o = t >= 0 ? (t + 1) % p.length : 0;
1103
- _(p[o].id);
1104
- }, [p, M, _]), Ce = C(() => {
1105
- if (!j.current?.activeEditor || p.length === 0)
1106
- return;
1107
- const t = p.findIndex(
1108
- (c) => c.id === M
1109
- ), o = t > 0 ? t - 1 : p.length - 1;
1110
- _(p[o].id);
1111
- }, [p, M, _]), Se = C(
1112
- async (t) => {
1113
- const { fileName: o = "document", triggerDownload: c = !0 } = t || {};
1114
- try {
1115
- return await j.current?.export({
1116
- exportType: ["docx"],
1117
- exportedName: o,
1118
- triggerDownload: c
1119
- });
1120
- } catch (m) {
1121
- throw console.error("Failed to export DOCX", m), m;
979
+ [K, R, H]
980
+ ), Se = S(
981
+ (e) => {
982
+ M.current && (M.current(), M.current = null), W.current = null, H();
983
+ const t = F.current?.activeEditor;
984
+ if (!t) return;
985
+ const i = t.helpers?.structuredContentCommands;
986
+ if (!i) return;
987
+ const v = e.group || `group-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`, b = i.createTagObject?.({
988
+ group: v
989
+ });
990
+ if ((e.mode || "inline") === "inline" ? t.commands.insertStructuredContentInline?.({
991
+ attrs: {
992
+ alias: e.alias,
993
+ tag: b
994
+ },
995
+ text: e.alias
996
+ }) : t.commands.insertStructuredContentBlock?.({
997
+ attrs: {
998
+ alias: e.alias,
999
+ tag: b
1000
+ },
1001
+ text: e.alias
1002
+ })) {
1003
+ e.group || Z(e.id, { tag: b }), D(!1);
1004
+ const C = Q(t);
1005
+ z(C), y?.(C);
1122
1006
  }
1123
1007
  },
1124
- []
1008
+ [Z, H, y]
1009
+ ), Te = S(() => {
1010
+ D(!1), W.current = null, H(), M.current && (M.current(), M.current = null);
1011
+ }, [H]), Ee = S(() => {
1012
+ if (!F.current?.activeEditor || p.length === 0) return;
1013
+ const e = p.findIndex((i) => i.id === V), t = e >= 0 ? (e + 1) % p.length : 0;
1014
+ _(p[t].id);
1015
+ }, [p, V, _]), Ie = S(() => {
1016
+ if (!F.current?.activeEditor || p.length === 0) return;
1017
+ const e = p.findIndex((i) => i.id === V), t = e > 0 ? e - 1 : p.length - 1;
1018
+ _(p[t].id);
1019
+ }, [p, V, _]), Me = S(
1020
+ async (e) => {
1021
+ const { fileName: t = "document", triggerDownload: i = !0 } = e || {}, v = await F.current?.export({
1022
+ exportType: ["docx"],
1023
+ exportedName: t,
1024
+ triggerDownload: i
1025
+ }), b = F.current?.activeEditor;
1026
+ if (b) {
1027
+ const c = Q(b);
1028
+ q?.({ fields: c, blob: i ? void 0 : v, fileName: t });
1029
+ }
1030
+ return v;
1031
+ },
1032
+ [q]
1125
1033
  );
1126
- Me(b, () => ({
1127
- insertField: (t) => B("inline", t),
1128
- insertBlockField: (t) => B("block", t),
1034
+ Be(d, () => ({
1035
+ insertField: (e) => K("inline", e),
1036
+ insertBlockField: (e) => K("block", e),
1129
1037
  updateField: Z,
1130
- deleteField: y,
1038
+ deleteField: ae,
1131
1039
  selectField: _,
1132
- nextField: _e,
1133
- previousField: Ce,
1040
+ nextField: Ee,
1041
+ previousField: Ie,
1134
1042
  getFields: () => p,
1135
- exportTemplate: Se
1043
+ exportTemplate: Me,
1044
+ getSuperDoc: () => F.current
1136
1045
  }));
1137
- const Fe = r.component || Be, ge = l.component || Ve, ee = Ye(S);
1138
- return /* @__PURE__ */ n.jsxs(
1139
- "div",
1140
- {
1141
- className: `superdoc-template-builder ${re || ""}`,
1142
- style: U,
1143
- children: [
1144
- /* @__PURE__ */ n.jsxs("div", { style: { display: "flex", gap: "20px" }, children: [
1145
- l.position === "left" && /* @__PURE__ */ n.jsx("div", { className: "superdoc-template-builder-sidebar", children: /* @__PURE__ */ n.jsx(
1146
- ge,
1147
- {
1148
- fields: p,
1149
- onSelect: (t) => _(t.id),
1150
- onDelete: y,
1151
- onUpdate: (t) => Z(t.id, t),
1152
- selectedFieldId: M || void 0
1153
- }
1154
- ) }),
1155
- /* @__PURE__ */ n.jsxs("div", { className: "superdoc-template-builder-document", style: { flex: 1 }, children: [
1156
- ee?.renderDefaultContainer && /* @__PURE__ */ n.jsx(
1157
- "div",
1158
- {
1159
- id: "superdoc-toolbar",
1160
- className: "superdoc-template-builder-toolbar",
1161
- "data-testid": "template-builder-toolbar"
1162
- }
1163
- ),
1164
- /* @__PURE__ */ n.jsx(
1165
- "div",
1166
- {
1167
- ref: ne,
1168
- className: "superdoc-template-builder-editor",
1169
- style: { height: q },
1170
- "data-testid": "template-builder-editor"
1171
- }
1172
- )
1173
- ] }),
1174
- l.position === "right" && /* @__PURE__ */ n.jsx("div", { className: "superdoc-template-builder-sidebar", children: /* @__PURE__ */ n.jsx(
1175
- ge,
1176
- {
1177
- fields: p,
1178
- onSelect: (t) => _(t.id),
1179
- onDelete: y,
1180
- onUpdate: (t) => Z(t.id, t),
1181
- selectedFieldId: M || void 0
1182
- }
1183
- ) })
1184
- ] }),
1185
- /* @__PURE__ */ n.jsx(
1186
- Fe,
1046
+ const Re = u.component || We, me = a.component || Le, $ = Pe(N);
1047
+ return /* @__PURE__ */ o("div", { className: `superdoc-template-builder ${A || ""}`, style: X, children: [
1048
+ /* @__PURE__ */ o("div", { style: { display: "flex", gap: "20px" }, children: [
1049
+ a.position === "left" && /* @__PURE__ */ r("div", { className: "superdoc-template-builder-sidebar", children: /* @__PURE__ */ r(
1050
+ me,
1051
+ {
1052
+ fields: p,
1053
+ onSelect: (e) => _(e.id),
1054
+ onDelete: ae,
1055
+ onUpdate: (e) => Z(e.id, e),
1056
+ selectedFieldId: V || void 0
1057
+ }
1058
+ ) }),
1059
+ /* @__PURE__ */ o("div", { className: "superdoc-template-builder-document", style: { flex: 1 }, children: [
1060
+ $?.renderDefaultContainer && /* @__PURE__ */ r(
1061
+ "div",
1062
+ {
1063
+ id: "superdoc-toolbar",
1064
+ className: "superdoc-template-builder-toolbar",
1065
+ "data-testid": "template-builder-toolbar"
1066
+ }
1067
+ ),
1068
+ /* @__PURE__ */ r(
1069
+ "div",
1187
1070
  {
1188
- isVisible: z,
1189
- position: v,
1190
- availableFields: d.available || [],
1191
- filteredFields: P,
1192
- filterQuery: T,
1193
- allowCreate: d.allowCreate || !1,
1194
- onSelect: fe,
1195
- onClose: ke,
1196
- onCreateField: k
1071
+ ref: se,
1072
+ className: "superdoc-template-builder-editor",
1073
+ style: { height: ie },
1074
+ "data-testid": "template-builder-editor"
1197
1075
  }
1198
1076
  )
1199
- ]
1200
- }
1201
- );
1077
+ ] }),
1078
+ a.position === "right" && /* @__PURE__ */ r("div", { className: "superdoc-template-builder-sidebar", children: /* @__PURE__ */ r(
1079
+ me,
1080
+ {
1081
+ fields: p,
1082
+ onSelect: (e) => _(e.id),
1083
+ onDelete: ae,
1084
+ onUpdate: (e) => Z(e.id, e),
1085
+ selectedFieldId: V || void 0
1086
+ }
1087
+ ) })
1088
+ ] }),
1089
+ /* @__PURE__ */ r(
1090
+ Re,
1091
+ {
1092
+ isVisible: j,
1093
+ position: x,
1094
+ availableFields: l.available || [],
1095
+ filteredFields: ee,
1096
+ filterQuery: h,
1097
+ allowCreate: l.allowCreate || !1,
1098
+ onSelect: ke,
1099
+ onClose: Te,
1100
+ onCreateField: R,
1101
+ existingFields: p,
1102
+ onSelectExisting: Se
1103
+ }
1104
+ )
1105
+ ] });
1202
1106
  });
1203
- Ue.displayName = "SuperDocTemplateBuilder";
1107
+ je.displayName = "SuperDocTemplateBuilder";
1204
1108
  export {
1205
- Ve as FieldList,
1206
- Be as FieldMenu,
1207
- Ue as default
1109
+ Le as FieldList,
1110
+ We as FieldMenu,
1111
+ je as default
1208
1112
  };