@stonecrop/desktop 0.9.1 → 0.10.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/desktop.js CHANGED
@@ -1,40 +1,40 @@
1
- import { defineComponent as Ee, ref as A, onMounted as Pe, openBlock as M, createElementBlock as F, normalizeClass as Ce, createElementVNode as T, Fragment as fe, renderList as be, toDisplayString as Y, createCommentVNode as de, withDirectives as Re, vShow as Ge, useTemplateRef as ht, computed as x, watch as H, nextTick as se, createBlock as Ye, Teleport as xt, createVNode as ae, Transition as Tt, withCtx as we, withModifiers as gt, vModelText as mt, renderSlot as Me, createTextVNode as Ae, toRaw as yt, isRef as ve, isReactive as Ve, toRef as re, hasInjectionContext as Je, inject as Se, getCurrentInstance as bt, reactive as wt, markRaw as ge, effectScope as Pt, getCurrentScope as et, onScopeDispose as tt, toRefs as at, provide as qe, shallowRef as _e, toValue as Q, readonly as je, customRef as ot, unref as De, useModel as Vt, watchEffect as $e, resolveComponent as St, resolveDynamicComponent as jt, mergeProps as Mt, mergeModels as rt, withKeys as he, normalizeStyle as Fe } from "vue";
2
- const Ft = { class: "action-menu-icon" }, Lt = ["disabled", "onClick"], Bt = { key: 1 }, Ht = ["onClick"], Wt = { class: "dropdown-container" }, Ut = { class: "dropdown" }, zt = ["onClick"], Kt = ["href"], Gt = { class: "dropdown-item" }, Jt = /* @__PURE__ */ Ee({
1
+ import { defineComponent as we, ref as C, onMounted as Ae, openBlock as P, createElementBlock as V, normalizeClass as Oe, createElementVNode as A, Fragment as de, renderList as me, toDisplayString as X, createCommentVNode as ue, withDirectives as Ne, vShow as Ue, useTemplateRef as ft, computed as I, watch as L, nextTick as ae, createBlock as Ze, Teleport as Rt, createVNode as ne, Transition as It, withCtx as ye, withModifiers as pt, vModelText as ht, renderSlot as Pe, createTextVNode as $e, toRaw as vt, isRef as fe, isReactive as xe, toRef as re, hasInjectionContext as ze, inject as be, getCurrentInstance as gt, reactive as mt, markRaw as he, effectScope as At, getCurrentScope as Qe, onScopeDispose as Xe, toRefs as tt, provide as Ge, shallowRef as Se, toValue as Q, readonly as Te, customRef as Ye, unref as De, useModel as xt, watchEffect as Tt, resolveComponent as yt, resolveDynamicComponent as Pt, mergeProps as Vt, mergeModels as ot, withKeys as pe, normalizeStyle as Ve } from "vue";
2
+ const jt = { class: "action-menu-icon" }, Mt = ["disabled", "onClick"], Ft = { key: 1 }, Lt = ["onClick"], Bt = { class: "dropdown-container" }, Wt = { class: "dropdown" }, Ht = ["onClick"], Ut = ["href"], zt = { class: "dropdown-item" }, Gt = /* @__PURE__ */ we({
3
3
  __name: "ActionSet",
4
4
  props: {
5
5
  elements: { default: () => [] }
6
6
  },
7
7
  emits: ["actionClick"],
8
8
  setup(t, { emit: e }) {
9
- const o = e, n = A({}), a = A(!1), i = A(-1), r = A(!1), c = A(!1);
10
- Pe(() => {
11
- s();
9
+ const o = e, n = C({}), r = C(!1), i = C(-1), a = C(!1), u = C(!1);
10
+ Ae(() => {
11
+ c();
12
12
  });
13
- const s = () => {
13
+ const c = () => {
14
14
  n.value = {};
15
- }, u = () => {
16
- r.value = !0, i.value = setTimeout(() => {
17
- r.value && (a.value = !0);
18
- }, 500);
19
15
  }, f = () => {
20
- r.value = !1, c.value = !1, clearTimeout(i.value), a.value = !1;
21
- }, h = (O) => {
22
- const $ = !n.value[O];
23
- s(), $ && (n.value[O] = !0);
24
- }, b = (O, $) => {
25
- o("actionClick", $, O);
16
+ a.value = !0, i.value = setTimeout(() => {
17
+ a.value && (r.value = !0);
18
+ }, 500);
19
+ }, p = () => {
20
+ a.value = !1, u.value = !1, clearTimeout(i.value), r.value = !1;
21
+ }, b = (_) => {
22
+ const m = !n.value[_];
23
+ c(), m && (n.value[_] = !0);
24
+ }, h = (_, m) => {
25
+ o("actionClick", m, _);
26
26
  };
27
- return (O, $) => (M(), F("div", {
28
- class: Ce([{ "open-set": a.value, "hovered-and-closed": c.value }, "action-set collapse"]),
29
- onMouseover: u,
30
- onMouseleave: f
27
+ return (_, m) => (P(), V("div", {
28
+ class: Oe([{ "open-set": r.value, "hovered-and-closed": u.value }, "action-set collapse"]),
29
+ onMouseover: f,
30
+ onMouseleave: p
31
31
  }, [
32
- T("div", Ft, [
33
- T("div", {
32
+ A("div", jt, [
33
+ A("div", {
34
34
  id: "chevron",
35
- onClick: $[0] || ($[0] = (D) => c.value = !c.value)
36
- }, [...$[1] || ($[1] = [
37
- T("svg", {
35
+ onClick: m[0] || (m[0] = (O) => u.value = !u.value)
36
+ }, [...m[1] || (m[1] = [
37
+ A("svg", {
38
38
  id: "Layer_1",
39
39
  class: "leftBar",
40
40
  version: "1.1",
@@ -47,9 +47,9 @@ const Ft = { class: "action-menu-icon" }, Lt = ["disabled", "onClick"], Bt = { k
47
47
  width: "50",
48
48
  height: "50"
49
49
  }, [
50
- T("polygon", { points: "54.2,33.4 29.2,58.8 25,54.6 50,29.2 " })
50
+ A("polygon", { points: "54.2,33.4 29.2,58.8 25,54.6 50,29.2 " })
51
51
  ], -1),
52
- T("svg", {
52
+ A("svg", {
53
53
  id: "Layer_1",
54
54
  class: "rightBar",
55
55
  version: "1.1",
@@ -62,62 +62,62 @@ const Ft = { class: "action-menu-icon" }, Lt = ["disabled", "onClick"], Bt = { k
62
62
  width: "50",
63
63
  height: "50"
64
64
  }, [
65
- T("polygon", { points: "70.8,58.8 45.8,33.4 50,29.2 75,54.6 " })
65
+ A("polygon", { points: "70.8,58.8 45.8,33.4 50,29.2 75,54.6 " })
66
66
  ], -1)
67
67
  ])])
68
68
  ]),
69
- $[2] || ($[2] = T("div", { style: { "margin-right": "30px" } }, null, -1)),
70
- (M(!0), F(fe, null, be(t.elements, (D, V) => (M(), F("div", {
71
- key: D.label,
69
+ m[2] || (m[2] = A("div", { style: { "margin-right": "30px" } }, null, -1)),
70
+ (P(!0), V(de, null, me(t.elements, (O, R) => (P(), V("div", {
71
+ key: O.label,
72
72
  class: "action-element"
73
73
  }, [
74
- D.type == "button" ? (M(), F("button", {
74
+ O.type == "button" ? (P(), V("button", {
75
75
  key: 0,
76
- disabled: D.disabled,
76
+ disabled: O.disabled,
77
77
  class: "button-default",
78
- onClick: (j) => b(D.action, D.label)
79
- }, Y(D.label), 9, Lt)) : de("", !0),
80
- D.type == "dropdown" ? (M(), F("div", Bt, [
81
- T("button", {
78
+ onClick: (x) => h(O.action, O.label)
79
+ }, X(O.label), 9, Mt)) : ue("", !0),
80
+ O.type == "dropdown" ? (P(), V("div", Ft, [
81
+ A("button", {
82
82
  class: "button-default",
83
- onClick: (j) => h(V)
84
- }, Y(D.label), 9, Ht),
85
- Re(T("div", Wt, [
86
- T("div", Ut, [
87
- (M(!0), F(fe, null, be(D.actions, (j, P) => (M(), F("div", {
88
- key: j.label
83
+ onClick: (x) => b(R)
84
+ }, X(O.label), 9, Lt),
85
+ Ne(A("div", Bt, [
86
+ A("div", Wt, [
87
+ (P(!0), V(de, null, me(O.actions, (x, H) => (P(), V("div", {
88
+ key: x.label
89
89
  }, [
90
- j.action != null ? (M(), F("button", {
90
+ x.action != null ? (P(), V("button", {
91
91
  key: 0,
92
92
  class: "dropdown-item",
93
- onClick: (U) => b(j.action, j.label)
94
- }, Y(j.label), 9, zt)) : j.link != null ? (M(), F("a", {
93
+ onClick: (U) => h(x.action, x.label)
94
+ }, X(x.label), 9, Ht)) : x.link != null ? (P(), V("a", {
95
95
  key: 1,
96
- href: j.link
96
+ href: x.link
97
97
  }, [
98
- T("button", Gt, Y(j.label), 1)
99
- ], 8, Kt)) : de("", !0)
98
+ A("button", zt, X(x.label), 1)
99
+ ], 8, Ut)) : ue("", !0)
100
100
  ]))), 128))
101
101
  ])
102
102
  ], 512), [
103
- [Ge, n.value[V]]
103
+ [Ue, n.value[R]]
104
104
  ])
105
- ])) : de("", !0)
105
+ ])) : ue("", !0)
106
106
  ]))), 128))
107
107
  ], 34));
108
108
  }
109
- }), Et = (t, e) => {
109
+ }), bt = (t, e) => {
110
110
  const o = t.__vccOpts || t;
111
- for (const [n, a] of e)
112
- o[n] = a;
111
+ for (const [n, r] of e)
112
+ o[n] = r;
113
113
  return o;
114
- }, _t = /* @__PURE__ */ Et(Jt, [["__scopeId", "data-v-eb01c863"]]), qt = { class: "command-palette-header" }, Zt = ["placeholder"], Qt = {
114
+ }, wt = /* @__PURE__ */ bt(Gt, [["__scopeId", "data-v-eb01c863"]]), Jt = { class: "command-palette-header" }, Kt = ["placeholder"], qt = {
115
115
  key: 0,
116
116
  class: "command-palette-results"
117
- }, Xt = ["onClick", "onMouseover"], Yt = { class: "result-title" }, eo = { class: "result-content" }, to = {
117
+ }, Zt = ["onClick", "onMouseover"], Qt = { class: "result-title" }, Xt = { class: "result-content" }, Yt = {
118
118
  key: 1,
119
119
  class: "command-palette-no-results"
120
- }, $t = /* @__PURE__ */ Ee({
120
+ }, St = /* @__PURE__ */ we({
121
121
  __name: "CommandPalette",
122
122
  props: {
123
123
  search: { type: Function },
@@ -127,515 +127,515 @@ const Ft = { class: "action-menu-icon" }, Lt = ["disabled", "onClick"], Bt = { k
127
127
  },
128
128
  emits: ["select", "close"],
129
129
  setup(t, { emit: e }) {
130
- const o = e, n = A(""), a = A(0), i = ht("input"), r = x(() => n.value ? t.search(n.value).slice(0, t.maxResults) : []);
131
- H(
130
+ const o = e, n = C(""), r = C(0), i = ft("input"), a = I(() => n.value ? t.search(n.value).slice(0, t.maxResults) : []);
131
+ L(
132
132
  () => t.isOpen,
133
- async (f) => {
134
- f && (n.value = "", a.value = 0, await se(), i.value?.focus());
133
+ async (p) => {
134
+ p && (n.value = "", r.value = 0, await ae(), i.value?.focus());
135
135
  }
136
- ), H(r, () => {
137
- a.value = 0;
136
+ ), L(a, () => {
137
+ r.value = 0;
138
138
  });
139
- const c = () => {
139
+ const u = () => {
140
140
  o("close");
141
- }, s = (f) => {
142
- switch (f.key) {
141
+ }, c = (p) => {
142
+ switch (p.key) {
143
143
  case "Escape":
144
- c();
144
+ u();
145
145
  break;
146
146
  case "ArrowDown":
147
- f.preventDefault(), r.value.length && (a.value = (a.value + 1) % r.value.length);
147
+ p.preventDefault(), a.value.length && (r.value = (r.value + 1) % a.value.length);
148
148
  break;
149
149
  case "ArrowUp":
150
- f.preventDefault(), r.value.length && (a.value = (a.value - 1 + r.value.length) % r.value.length);
150
+ p.preventDefault(), a.value.length && (r.value = (r.value - 1 + a.value.length) % a.value.length);
151
151
  break;
152
152
  case "Enter":
153
- r.value.length && a.value >= 0 && u(r.value[a.value]);
153
+ a.value.length && r.value >= 0 && f(a.value[r.value]);
154
154
  break;
155
155
  }
156
- }, u = (f) => {
157
- o("select", f), c();
156
+ }, f = (p) => {
157
+ o("select", p), u();
158
158
  };
159
- return (f, h) => (M(), Ye(xt, { to: "body" }, [
160
- ae(Tt, { name: "fade" }, {
161
- default: we(() => [
162
- t.isOpen ? (M(), F("div", {
159
+ return (p, b) => (P(), Ze(Rt, { to: "body" }, [
160
+ ne(It, { name: "fade" }, {
161
+ default: ye(() => [
162
+ t.isOpen ? (P(), V("div", {
163
163
  key: 0,
164
164
  class: "command-palette-overlay",
165
- onClick: c
165
+ onClick: u
166
166
  }, [
167
- T("div", {
167
+ A("div", {
168
168
  class: "command-palette",
169
- onClick: h[1] || (h[1] = gt(() => {
169
+ onClick: b[1] || (b[1] = pt(() => {
170
170
  }, ["stop"]))
171
171
  }, [
172
- T("div", qt, [
173
- Re(T("input", {
172
+ A("div", Jt, [
173
+ Ne(A("input", {
174
174
  ref: "input",
175
- "onUpdate:modelValue": h[0] || (h[0] = (b) => n.value = b),
175
+ "onUpdate:modelValue": b[0] || (b[0] = (h) => n.value = h),
176
176
  type: "text",
177
177
  class: "command-palette-input",
178
178
  placeholder: t.placeholder,
179
179
  autofocus: "",
180
- onKeydown: s
181
- }, null, 40, Zt), [
182
- [mt, n.value]
180
+ onKeydown: c
181
+ }, null, 40, Kt), [
182
+ [ht, n.value]
183
183
  ])
184
184
  ]),
185
- r.value.length ? (M(), F("div", Qt, [
186
- (M(!0), F(fe, null, be(r.value, (b, O) => (M(), F("div", {
187
- key: O,
188
- class: Ce(["command-palette-result", { selected: O === a.value }]),
189
- onClick: ($) => u(b),
190
- onMouseover: ($) => a.value = O
185
+ a.value.length ? (P(), V("div", qt, [
186
+ (P(!0), V(de, null, me(a.value, (h, _) => (P(), V("div", {
187
+ key: _,
188
+ class: Oe(["command-palette-result", { selected: _ === r.value }]),
189
+ onClick: (m) => f(h),
190
+ onMouseover: (m) => r.value = _
191
191
  }, [
192
- T("div", Yt, [
193
- Me(f.$slots, "title", { result: b })
192
+ A("div", Qt, [
193
+ Pe(p.$slots, "title", { result: h })
194
194
  ]),
195
- T("div", eo, [
196
- Me(f.$slots, "content", { result: b })
195
+ A("div", Xt, [
196
+ Pe(p.$slots, "content", { result: h })
197
197
  ])
198
- ], 42, Xt))), 128))
199
- ])) : n.value && !r.value.length ? (M(), F("div", to, [
200
- Me(f.$slots, "empty", {}, () => [
201
- Ae(' No results found for "' + Y(n.value) + '" ', 1)
198
+ ], 42, Zt))), 128))
199
+ ])) : n.value && !a.value.length ? (P(), V("div", Yt, [
200
+ Pe(p.$slots, "empty", {}, () => [
201
+ $e(' No results found for "' + X(n.value) + '" ', 1)
202
202
  ])
203
- ])) : de("", !0)
203
+ ])) : ue("", !0)
204
204
  ])
205
- ])) : de("", !0)
205
+ ])) : ue("", !0)
206
206
  ]),
207
207
  _: 3
208
208
  })
209
209
  ]));
210
210
  }
211
211
  });
212
- const ce = typeof window < "u";
213
- let ne;
214
- const Ie = (t) => ne = t;
212
+ const le = typeof window < "u";
213
+ let oe;
214
+ const Ce = (t) => oe = t;
215
215
  process.env.NODE_ENV;
216
- const Ze = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia") : (
216
+ const Je = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia") : (
217
217
  /* istanbul ignore next */
218
218
  /* @__PURE__ */ Symbol()
219
219
  );
220
- function ie(t) {
220
+ function se(t) {
221
221
  return t && typeof t == "object" && Object.prototype.toString.call(t) === "[object Object]" && typeof t.toJSON != "function";
222
222
  }
223
- var me;
223
+ var ve;
224
224
  (function(t) {
225
225
  t.direct = "direct", t.patchObject = "patch object", t.patchFunction = "patch function";
226
- })(me || (me = {}));
227
- function kt(t, e) {
226
+ })(ve || (ve = {}));
227
+ function Et(t, e) {
228
228
  for (const o in e) {
229
229
  const n = e[o];
230
230
  if (!(o in t))
231
231
  continue;
232
- const a = t[o];
233
- ie(a) && ie(n) && !ve(n) && !Ve(n) ? t[o] = kt(a, n) : t[o] = n;
232
+ const r = t[o];
233
+ se(r) && se(n) && !fe(n) && !xe(n) ? t[o] = Et(r, n) : t[o] = n;
234
234
  }
235
235
  return t;
236
236
  }
237
- const Nt = () => {
237
+ const _t = () => {
238
238
  };
239
- function st(t, e, o, n = Nt) {
239
+ function nt(t, e, o, n = _t) {
240
240
  t.add(e);
241
- const a = () => {
241
+ const r = () => {
242
242
  t.delete(e) && n();
243
243
  };
244
- return !o && et() && tt(a), a;
244
+ return !o && Qe() && Xe(r), r;
245
245
  }
246
- function le(t, ...e) {
246
+ function ie(t, ...e) {
247
247
  t.forEach((o) => {
248
248
  o(...e);
249
249
  });
250
250
  }
251
- const oo = (t) => t(), it = /* @__PURE__ */ Symbol(), Le = /* @__PURE__ */ Symbol();
252
- function Qe(t, e) {
251
+ const eo = (t) => t(), rt = /* @__PURE__ */ Symbol(), je = /* @__PURE__ */ Symbol();
252
+ function Ke(t, e) {
253
253
  t instanceof Map && e instanceof Map ? e.forEach((o, n) => t.set(n, o)) : t instanceof Set && e instanceof Set && e.forEach(t.add, t);
254
254
  for (const o in e) {
255
255
  if (!e.hasOwnProperty(o))
256
256
  continue;
257
- const n = e[o], a = t[o];
258
- ie(a) && ie(n) && t.hasOwnProperty(o) && !ve(n) && !Ve(n) ? t[o] = Qe(a, n) : t[o] = n;
257
+ const n = e[o], r = t[o];
258
+ se(r) && se(n) && t.hasOwnProperty(o) && !fe(n) && !xe(n) ? t[o] = Ke(r, n) : t[o] = n;
259
259
  }
260
260
  return t;
261
261
  }
262
- const no = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia:skipHydration") : (
262
+ const to = process.env.NODE_ENV !== "production" ? /* @__PURE__ */ Symbol("pinia:skipHydration") : (
263
263
  /* istanbul ignore next */
264
264
  /* @__PURE__ */ Symbol()
265
265
  );
266
- function ao(t) {
267
- return !ie(t) || !Object.prototype.hasOwnProperty.call(t, no);
266
+ function oo(t) {
267
+ return !se(t) || !Object.prototype.hasOwnProperty.call(t, to);
268
268
  }
269
269
  const { assign: Z } = Object;
270
- function lt(t) {
271
- return !!(ve(t) && t.effect);
270
+ function at(t) {
271
+ return !!(fe(t) && t.effect);
272
272
  }
273
- function ct(t, e, o, n) {
274
- const { state: a, actions: i, getters: r } = e, c = o.state.value[t];
275
- let s;
276
- function u() {
277
- !c && (process.env.NODE_ENV === "production" || !n) && (o.state.value[t] = a ? a() : {});
278
- const f = process.env.NODE_ENV !== "production" && n ? (
273
+ function st(t, e, o, n) {
274
+ const { state: r, actions: i, getters: a } = e, u = o.state.value[t];
275
+ let c;
276
+ function f() {
277
+ !u && (process.env.NODE_ENV === "production" || !n) && (o.state.value[t] = r ? r() : {});
278
+ const p = process.env.NODE_ENV !== "production" && n ? (
279
279
  // use ref() to unwrap refs inside state TODO: check if this is still necessary
280
- at(A(a ? a() : {}).value)
281
- ) : at(o.state.value[t]);
282
- return Z(f, i, Object.keys(r || {}).reduce((h, b) => (process.env.NODE_ENV !== "production" && b in f && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${b}" in store "${t}".`), h[b] = ge(x(() => {
283
- Ie(o);
284
- const O = o._s.get(t);
285
- return r[b].call(O, O);
286
- })), h), {}));
287
- }
288
- return s = Xe(t, u, e, o, n, !0), s;
280
+ tt(C(r ? r() : {}).value)
281
+ ) : tt(o.state.value[t]);
282
+ return Z(p, i, Object.keys(a || {}).reduce((b, h) => (process.env.NODE_ENV !== "production" && h in p && console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${h}" in store "${t}".`), b[h] = he(I(() => {
283
+ Ce(o);
284
+ const _ = o._s.get(t);
285
+ return a[h].call(_, _);
286
+ })), b), {}));
287
+ }
288
+ return c = qe(t, f, e, o, n, !0), c;
289
289
  }
290
- function Xe(t, e, o = {}, n, a, i) {
291
- let r;
292
- const c = Z({ actions: {} }, o);
290
+ function qe(t, e, o = {}, n, r, i) {
291
+ let a;
292
+ const u = Z({ actions: {} }, o);
293
293
  if (process.env.NODE_ENV !== "production" && !n._e.active)
294
294
  throw new Error("Pinia destroyed");
295
- const s = { deep: !0 };
296
- process.env.NODE_ENV !== "production" && (s.onTrigger = (g) => {
297
- u ? O = g : u == !1 && !_._hotUpdating && (Array.isArray(O) ? O.push(g) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
295
+ const c = { deep: !0 };
296
+ process.env.NODE_ENV !== "production" && (c.onTrigger = (v) => {
297
+ f ? _ = v : f == !1 && !E._hotUpdating && (Array.isArray(_) ? _.push(v) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
298
298
  });
299
- let u, f, h = /* @__PURE__ */ new Set(), b = /* @__PURE__ */ new Set(), O;
300
- const $ = n.state.value[t];
301
- !i && !$ && (process.env.NODE_ENV === "production" || !a) && (n.state.value[t] = {});
302
- const D = A({});
303
- let V;
304
- function j(g) {
305
- let m;
306
- u = f = !1, process.env.NODE_ENV !== "production" && (O = []), typeof g == "function" ? (g(n.state.value[t]), m = {
307
- type: me.patchFunction,
299
+ let f, p, b = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), _;
300
+ const m = n.state.value[t];
301
+ !i && !m && (process.env.NODE_ENV === "production" || !r) && (n.state.value[t] = {});
302
+ const O = C({});
303
+ let R;
304
+ function x(v) {
305
+ let g;
306
+ f = p = !1, process.env.NODE_ENV !== "production" && (_ = []), typeof v == "function" ? (v(n.state.value[t]), g = {
307
+ type: ve.patchFunction,
308
308
  storeId: t,
309
- events: O
310
- }) : (Qe(n.state.value[t], g), m = {
311
- type: me.patchObject,
312
- payload: g,
309
+ events: _
310
+ }) : (Ke(n.state.value[t], v), g = {
311
+ type: ve.patchObject,
312
+ payload: v,
313
313
  storeId: t,
314
- events: O
314
+ events: _
315
315
  });
316
- const C = V = /* @__PURE__ */ Symbol();
317
- se().then(() => {
318
- V === C && (u = !0);
319
- }), f = !0, le(h, m, n.state.value[t]);
320
- }
321
- const P = i ? function() {
322
- const { state: m } = o, C = m ? m() : {};
323
- this.$patch((B) => {
324
- Z(B, C);
316
+ const $ = R = /* @__PURE__ */ Symbol();
317
+ ae().then(() => {
318
+ R === $ && (f = !0);
319
+ }), p = !0, ie(b, g, n.state.value[t]);
320
+ }
321
+ const H = i ? function() {
322
+ const { state: g } = o, $ = g ? g() : {};
323
+ this.$patch((M) => {
324
+ Z(M, $);
325
325
  });
326
326
  } : (
327
327
  /* istanbul ignore next */
328
328
  process.env.NODE_ENV !== "production" ? () => {
329
329
  throw new Error(`🍍: Store "${t}" is built using the setup syntax and does not implement $reset().`);
330
- } : Nt
330
+ } : _t
331
331
  );
332
332
  function U() {
333
- r.stop(), h.clear(), b.clear(), n._s.delete(t);
334
- }
335
- const q = (g, m = "") => {
336
- if (it in g)
337
- return g[Le] = m, g;
338
- const C = function() {
339
- Ie(n);
340
- const B = Array.from(arguments), k = /* @__PURE__ */ new Set(), I = /* @__PURE__ */ new Set();
341
- function L(S) {
333
+ a.stop(), b.clear(), h.clear(), n._s.delete(t);
334
+ }
335
+ const K = (v, g = "") => {
336
+ if (rt in v)
337
+ return v[je] = g, v;
338
+ const $ = function() {
339
+ Ce(n);
340
+ const M = Array.from(arguments), k = /* @__PURE__ */ new Set(), T = /* @__PURE__ */ new Set();
341
+ function F(S) {
342
342
  k.add(S);
343
343
  }
344
- function E(S) {
345
- I.add(S);
344
+ function w(S) {
345
+ T.add(S);
346
346
  }
347
- le(b, {
348
- args: B,
349
- name: C[Le],
350
- store: _,
351
- after: L,
352
- onError: E
347
+ ie(h, {
348
+ args: M,
349
+ name: $[je],
350
+ store: E,
351
+ after: F,
352
+ onError: w
353
353
  });
354
- let N;
354
+ let D;
355
355
  try {
356
- N = g.apply(this && this.$id === t ? this : _, B);
356
+ D = v.apply(this && this.$id === t ? this : E, M);
357
357
  } catch (S) {
358
- throw le(I, S), S;
358
+ throw ie(T, S), S;
359
359
  }
360
- return N instanceof Promise ? N.then((S) => (le(k, S), S)).catch((S) => (le(I, S), Promise.reject(S))) : (le(k, N), N);
360
+ return D instanceof Promise ? D.then((S) => (ie(k, S), S)).catch((S) => (ie(T, S), Promise.reject(S))) : (ie(k, D), D);
361
361
  };
362
- return C[it] = !0, C[Le] = m, C;
363
- }, G = /* @__PURE__ */ ge({
362
+ return $[rt] = !0, $[je] = g, $;
363
+ }, G = /* @__PURE__ */ he({
364
364
  actions: {},
365
365
  getters: {},
366
366
  state: [],
367
- hotState: D
367
+ hotState: O
368
368
  }), z = {
369
369
  _p: n,
370
370
  // _s: scope,
371
371
  $id: t,
372
- $onAction: st.bind(null, b),
373
- $patch: j,
374
- $reset: P,
375
- $subscribe(g, m = {}) {
376
- const C = st(h, g, m.detached, () => B()), B = r.run(() => H(() => n.state.value[t], (k) => {
377
- (m.flush === "sync" ? f : u) && g({
372
+ $onAction: nt.bind(null, h),
373
+ $patch: x,
374
+ $reset: H,
375
+ $subscribe(v, g = {}) {
376
+ const $ = nt(b, v, g.detached, () => M()), M = a.run(() => L(() => n.state.value[t], (k) => {
377
+ (g.flush === "sync" ? p : f) && v({
378
378
  storeId: t,
379
- type: me.direct,
380
- events: O
379
+ type: ve.direct,
380
+ events: _
381
381
  }, k);
382
- }, Z({}, s, m)));
383
- return C;
382
+ }, Z({}, c, g)));
383
+ return $;
384
384
  },
385
385
  $dispose: U
386
- }, _ = wt(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && ce ? Z(
386
+ }, E = mt(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && le ? Z(
387
387
  {
388
388
  _hmrPayload: G,
389
- _customProperties: ge(/* @__PURE__ */ new Set())
389
+ _customProperties: he(/* @__PURE__ */ new Set())
390
390
  // devtools custom properties
391
391
  },
392
392
  z
393
393
  // must be added later
394
394
  // setupStore
395
395
  ) : z);
396
- n._s.set(t, _);
397
- const W = (n._a && n._a.runWithContext || oo)(() => n._e.run(() => (r = Pt()).run(() => e({ action: q }))));
398
- for (const g in W) {
399
- const m = W[g];
400
- if (ve(m) && !lt(m) || Ve(m))
401
- process.env.NODE_ENV !== "production" && a ? D.value[g] = re(W, g) : i || ($ && ao(m) && (ve(m) ? m.value = $[g] : Qe(m, $[g])), n.state.value[t][g] = m), process.env.NODE_ENV !== "production" && G.state.push(g);
402
- else if (typeof m == "function") {
403
- const C = process.env.NODE_ENV !== "production" && a ? m : q(m, g);
404
- W[g] = C, process.env.NODE_ENV !== "production" && (G.actions[g] = m), c.actions[g] = m;
405
- } else process.env.NODE_ENV !== "production" && lt(m) && (G.getters[g] = i ? (
396
+ n._s.set(t, E);
397
+ const B = (n._a && n._a.runWithContext || eo)(() => n._e.run(() => (a = At()).run(() => e({ action: K }))));
398
+ for (const v in B) {
399
+ const g = B[v];
400
+ if (fe(g) && !at(g) || xe(g))
401
+ process.env.NODE_ENV !== "production" && r ? O.value[v] = re(B, v) : i || (m && oo(g) && (fe(g) ? g.value = m[v] : Ke(g, m[v])), n.state.value[t][v] = g), process.env.NODE_ENV !== "production" && G.state.push(v);
402
+ else if (typeof g == "function") {
403
+ const $ = process.env.NODE_ENV !== "production" && r ? g : K(g, v);
404
+ B[v] = $, process.env.NODE_ENV !== "production" && (G.actions[v] = g), u.actions[v] = g;
405
+ } else process.env.NODE_ENV !== "production" && at(g) && (G.getters[v] = i ? (
406
406
  // @ts-expect-error
407
- o.getters[g]
408
- ) : m, ce && (W._getters || // @ts-expect-error: same
409
- (W._getters = ge([]))).push(g));
410
- }
411
- if (Z(_, W), Z(yt(_), W), Object.defineProperty(_, "$state", {
412
- get: () => process.env.NODE_ENV !== "production" && a ? D.value : n.state.value[t],
413
- set: (g) => {
414
- if (process.env.NODE_ENV !== "production" && a)
407
+ o.getters[v]
408
+ ) : g, le && (B._getters || // @ts-expect-error: same
409
+ (B._getters = he([]))).push(v));
410
+ }
411
+ if (Z(E, B), Z(vt(E), B), Object.defineProperty(E, "$state", {
412
+ get: () => process.env.NODE_ENV !== "production" && r ? O.value : n.state.value[t],
413
+ set: (v) => {
414
+ if (process.env.NODE_ENV !== "production" && r)
415
415
  throw new Error("cannot set hotState");
416
- j((m) => {
417
- Z(m, g);
416
+ x((g) => {
417
+ Z(g, v);
418
418
  });
419
419
  }
420
- }), process.env.NODE_ENV !== "production" && (_._hotUpdate = ge((g) => {
421
- _._hotUpdating = !0, g._hmrPayload.state.forEach((m) => {
422
- if (m in _.$state) {
423
- const C = g.$state[m], B = _.$state[m];
424
- typeof C == "object" && ie(C) && ie(B) ? kt(C, B) : g.$state[m] = B;
420
+ }), process.env.NODE_ENV !== "production" && (E._hotUpdate = he((v) => {
421
+ E._hotUpdating = !0, v._hmrPayload.state.forEach((g) => {
422
+ if (g in E.$state) {
423
+ const $ = v.$state[g], M = E.$state[g];
424
+ typeof $ == "object" && se($) && se(M) ? Et($, M) : v.$state[g] = M;
425
425
  }
426
- _[m] = re(g.$state, m);
427
- }), Object.keys(_.$state).forEach((m) => {
428
- m in g.$state || delete _[m];
429
- }), u = !1, f = !1, n.state.value[t] = re(g._hmrPayload, "hotState"), f = !0, se().then(() => {
430
- u = !0;
426
+ E[g] = re(v.$state, g);
427
+ }), Object.keys(E.$state).forEach((g) => {
428
+ g in v.$state || delete E[g];
429
+ }), f = !1, p = !1, n.state.value[t] = re(v._hmrPayload, "hotState"), p = !0, ae().then(() => {
430
+ f = !0;
431
431
  });
432
- for (const m in g._hmrPayload.actions) {
433
- const C = g[m];
434
- _[m] = //
435
- q(C, m);
432
+ for (const g in v._hmrPayload.actions) {
433
+ const $ = v[g];
434
+ E[g] = //
435
+ K($, g);
436
436
  }
437
- for (const m in g._hmrPayload.getters) {
438
- const C = g._hmrPayload.getters[m], B = i ? (
437
+ for (const g in v._hmrPayload.getters) {
438
+ const $ = v._hmrPayload.getters[g], M = i ? (
439
439
  // special handling of options api
440
- x(() => (Ie(n), C.call(_, _)))
441
- ) : C;
442
- _[m] = //
443
- B;
440
+ I(() => (Ce(n), $.call(E, E)))
441
+ ) : $;
442
+ E[g] = //
443
+ M;
444
444
  }
445
- Object.keys(_._hmrPayload.getters).forEach((m) => {
446
- m in g._hmrPayload.getters || delete _[m];
447
- }), Object.keys(_._hmrPayload.actions).forEach((m) => {
448
- m in g._hmrPayload.actions || delete _[m];
449
- }), _._hmrPayload = g._hmrPayload, _._getters = g._getters, _._hotUpdating = !1;
450
- })), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && ce) {
451
- const g = {
445
+ Object.keys(E._hmrPayload.getters).forEach((g) => {
446
+ g in v._hmrPayload.getters || delete E[g];
447
+ }), Object.keys(E._hmrPayload.actions).forEach((g) => {
448
+ g in v._hmrPayload.actions || delete E[g];
449
+ }), E._hmrPayload = v._hmrPayload, E._getters = v._getters, E._hotUpdating = !1;
450
+ })), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && le) {
451
+ const v = {
452
452
  writable: !0,
453
453
  configurable: !0,
454
454
  // avoid warning on devtools trying to display this property
455
455
  enumerable: !1
456
456
  };
457
- ["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((m) => {
458
- Object.defineProperty(_, m, Z({ value: _[m] }, g));
457
+ ["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((g) => {
458
+ Object.defineProperty(E, g, Z({ value: E[g] }, v));
459
459
  });
460
460
  }
461
- return n._p.forEach((g) => {
462
- if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && ce) {
463
- const m = r.run(() => g({
464
- store: _,
461
+ return n._p.forEach((v) => {
462
+ if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && le) {
463
+ const g = a.run(() => v({
464
+ store: E,
465
465
  app: n._a,
466
466
  pinia: n,
467
- options: c
467
+ options: u
468
468
  }));
469
- Object.keys(m || {}).forEach((C) => _._customProperties.add(C)), Z(_, m);
469
+ Object.keys(g || {}).forEach(($) => E._customProperties.add($)), Z(E, g);
470
470
  } else
471
- Z(_, r.run(() => g({
472
- store: _,
471
+ Z(E, a.run(() => v({
472
+ store: E,
473
473
  app: n._a,
474
474
  pinia: n,
475
- options: c
475
+ options: u
476
476
  })));
477
- }), process.env.NODE_ENV !== "production" && _.$state && typeof _.$state == "object" && typeof _.$state.constructor == "function" && !_.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be
477
+ }), process.env.NODE_ENV !== "production" && E.$state && typeof E.$state == "object" && typeof E.$state.constructor == "function" && !E.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be
478
478
  state: () => new MyClass()
479
- Found in store "${_.$id}".`), $ && i && o.hydrate && o.hydrate(_.$state, $), u = !0, f = !0, _;
479
+ Found in store "${E.$id}".`), m && i && o.hydrate && o.hydrate(E.$state, m), f = !0, p = !0, E;
480
480
  }
481
481
  // @__NO_SIDE_EFFECTS__
482
- function ro(t, e, o) {
482
+ function no(t, e, o) {
483
483
  let n;
484
- const a = typeof e == "function";
485
- n = a ? o : e;
486
- function i(r, c) {
487
- const s = Je();
488
- if (r = // in test mode, ignore the argument provided as we can always retrieve a
484
+ const r = typeof e == "function";
485
+ n = r ? o : e;
486
+ function i(a, u) {
487
+ const c = ze();
488
+ if (a = // in test mode, ignore the argument provided as we can always retrieve a
489
489
  // pinia instance with getActivePinia()
490
- (process.env.NODE_ENV === "test" && ne && ne._testing ? null : r) || (s ? Se(Ze, null) : null), r && Ie(r), process.env.NODE_ENV !== "production" && !ne)
490
+ (process.env.NODE_ENV === "test" && oe && oe._testing ? null : a) || (c ? be(Je, null) : null), a && Ce(a), process.env.NODE_ENV !== "production" && !oe)
491
491
  throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
492
492
  See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
493
493
  This will fail in production.`);
494
- r = ne, r._s.has(t) || (a ? Xe(t, e, n, r) : ct(t, n, r), process.env.NODE_ENV !== "production" && (i._pinia = r));
495
- const u = r._s.get(t);
496
- if (process.env.NODE_ENV !== "production" && c) {
497
- const f = "__hot:" + t, h = a ? Xe(f, e, n, r, !0) : ct(f, Z({}, n), r, !0);
498
- c._hotUpdate(h), delete r.state.value[f], r._s.delete(f);
494
+ a = oe, a._s.has(t) || (r ? qe(t, e, n, a) : st(t, n, a), process.env.NODE_ENV !== "production" && (i._pinia = a));
495
+ const f = a._s.get(t);
496
+ if (process.env.NODE_ENV !== "production" && u) {
497
+ const p = "__hot:" + t, b = r ? qe(p, e, n, a, !0) : st(p, Z({}, n), a, !0);
498
+ u._hotUpdate(b), delete a.state.value[p], a._s.delete(p);
499
499
  }
500
- if (process.env.NODE_ENV !== "production" && ce) {
501
- const f = bt();
502
- if (f && f.proxy && // avoid adding stores that are just built for hot module replacement
503
- !c) {
504
- const h = f.proxy, b = "_pStores" in h ? h._pStores : h._pStores = {};
505
- b[t] = u;
500
+ if (process.env.NODE_ENV !== "production" && le) {
501
+ const p = gt();
502
+ if (p && p.proxy && // avoid adding stores that are just built for hot module replacement
503
+ !u) {
504
+ const b = p.proxy, h = "_pStores" in b ? b._pStores : b._pStores = {};
505
+ h[t] = f;
506
506
  }
507
507
  }
508
- return u;
508
+ return f;
509
509
  }
510
510
  return i.$id = t, i;
511
511
  }
512
- function so(t) {
513
- const e = yt(t), o = {};
512
+ function ro(t) {
513
+ const e = vt(t), o = {};
514
514
  for (const n in e) {
515
- const a = e[n];
516
- a.effect ? o[n] = // ...
517
- x({
515
+ const r = e[n];
516
+ r.effect ? o[n] = // ...
517
+ I({
518
518
  get: () => t[n],
519
519
  set(i) {
520
520
  t[n] = i;
521
521
  }
522
- }) : (ve(a) || Ve(a)) && (o[n] = // ---
522
+ }) : (fe(r) || xe(r)) && (o[n] = // ---
523
523
  re(t, n));
524
524
  }
525
525
  return o;
526
526
  }
527
- const io = typeof window < "u" && typeof document < "u";
527
+ const ao = typeof window < "u" && typeof document < "u";
528
528
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
529
- const lo = Object.prototype.toString, co = (t) => lo.call(t) === "[object Object]", uo = () => {
529
+ const so = Object.prototype.toString, io = (t) => so.call(t) === "[object Object]", lo = () => {
530
530
  };
531
- function fo(...t) {
531
+ function co(...t) {
532
532
  if (t.length !== 1) return re(...t);
533
533
  const e = t[0];
534
- return typeof e == "function" ? je(ot(() => ({
534
+ return typeof e == "function" ? Te(Ye(() => ({
535
535
  get: e,
536
- set: uo
537
- }))) : A(e);
536
+ set: lo
537
+ }))) : C(e);
538
538
  }
539
- function vo(t, e) {
539
+ function uo(t, e) {
540
540
  function o(...n) {
541
- return new Promise((a, i) => {
541
+ return new Promise((r, i) => {
542
542
  Promise.resolve(t(() => e.apply(this, n), {
543
543
  fn: e,
544
544
  thisArg: this,
545
545
  args: n
546
- })).then(a).catch(i);
546
+ })).then(r).catch(i);
547
547
  });
548
548
  }
549
549
  return o;
550
550
  }
551
- const Ot = (t) => t();
552
- function po(t = Ot, e = {}) {
553
- const { initialState: o = "active" } = e, n = fo(o === "active");
554
- function a() {
551
+ const kt = (t) => t();
552
+ function fo(t = kt, e = {}) {
553
+ const { initialState: o = "active" } = e, n = co(o === "active");
554
+ function r() {
555
555
  n.value = !1;
556
556
  }
557
557
  function i() {
558
558
  n.value = !0;
559
559
  }
560
- const r = (...c) => {
561
- n.value && t(...c);
560
+ const a = (...u) => {
561
+ n.value && t(...u);
562
562
  };
563
563
  return {
564
- isActive: je(n),
565
- pause: a,
564
+ isActive: Te(n),
565
+ pause: r,
566
566
  resume: i,
567
- eventFilter: r
567
+ eventFilter: a
568
568
  };
569
569
  }
570
- function Be(t) {
570
+ function Me(t) {
571
571
  return Array.isArray(t) ? t : [t];
572
572
  }
573
- function ho(t) {
574
- return bt();
573
+ function po(t) {
574
+ return gt();
575
575
  }
576
- function go(t, e, o = {}) {
577
- const { eventFilter: n = Ot, ...a } = o;
578
- return H(t, vo(n, e), a);
576
+ function ho(t, e, o = {}) {
577
+ const { eventFilter: n = kt, ...r } = o;
578
+ return L(t, uo(n, e), r);
579
579
  }
580
- function mo(t, e, o = {}) {
581
- const { eventFilter: n, initialState: a = "active", ...i } = o, { eventFilter: r, pause: c, resume: s, isActive: u } = po(n, { initialState: a });
580
+ function vo(t, e, o = {}) {
581
+ const { eventFilter: n, initialState: r = "active", ...i } = o, { eventFilter: a, pause: u, resume: c, isActive: f } = fo(n, { initialState: r });
582
582
  return {
583
- stop: go(t, e, {
583
+ stop: ho(t, e, {
584
584
  ...i,
585
- eventFilter: r
585
+ eventFilter: a
586
586
  }),
587
- pause: c,
588
- resume: s,
589
- isActive: u
587
+ pause: u,
588
+ resume: c,
589
+ isActive: f
590
590
  };
591
591
  }
592
- function yo(t, e = !0, o) {
593
- ho() ? Pe(t, o) : e ? t() : se(t);
592
+ function go(t, e = !0, o) {
593
+ po() ? Ae(t, o) : e ? t() : ae(t);
594
594
  }
595
- function bo(t, e, o) {
596
- return H(t, e, {
595
+ function mo(t, e, o) {
596
+ return L(t, e, {
597
597
  ...o,
598
598
  immediate: !0
599
599
  });
600
600
  }
601
- const xe = io ? window : void 0;
602
- function wo(t) {
601
+ const Re = ao ? window : void 0;
602
+ function yo(t) {
603
603
  var e;
604
604
  const o = Q(t);
605
605
  return (e = o?.$el) !== null && e !== void 0 ? e : o;
606
606
  }
607
- function ut(...t) {
608
- const e = (n, a, i, r) => (n.addEventListener(a, i, r), () => n.removeEventListener(a, i, r)), o = x(() => {
609
- const n = Be(Q(t[0])).filter((a) => a != null);
610
- return n.every((a) => typeof a != "string") ? n : void 0;
607
+ function it(...t) {
608
+ const e = (n, r, i, a) => (n.addEventListener(r, i, a), () => n.removeEventListener(r, i, a)), o = I(() => {
609
+ const n = Me(Q(t[0])).filter((r) => r != null);
610
+ return n.every((r) => typeof r != "string") ? n : void 0;
611
611
  });
612
- return bo(() => {
613
- var n, a;
612
+ return mo(() => {
613
+ var n, r;
614
614
  return [
615
- (n = (a = o.value) === null || a === void 0 ? void 0 : a.map((i) => wo(i))) !== null && n !== void 0 ? n : [xe].filter((i) => i != null),
616
- Be(Q(o.value ? t[1] : t[0])),
617
- Be(De(o.value ? t[2] : t[1])),
615
+ (n = (r = o.value) === null || r === void 0 ? void 0 : r.map((i) => yo(i))) !== null && n !== void 0 ? n : [Re].filter((i) => i != null),
616
+ Me(Q(o.value ? t[1] : t[0])),
617
+ Me(De(o.value ? t[2] : t[1])),
618
618
  Q(o.value ? t[3] : t[2])
619
619
  ];
620
- }, ([n, a, i, r], c, s) => {
621
- if (!n?.length || !a?.length || !i?.length) return;
622
- const u = co(r) ? { ...r } : r, f = n.flatMap((h) => a.flatMap((b) => i.map((O) => e(h, b, O, u))));
623
- s(() => {
624
- f.forEach((h) => h());
620
+ }, ([n, r, i, a], u, c) => {
621
+ if (!n?.length || !r?.length || !i?.length) return;
622
+ const f = io(a) ? { ...a } : a, p = n.flatMap((b) => r.flatMap((h) => i.map((_) => e(b, h, _, f))));
623
+ c(() => {
624
+ p.forEach((b) => b());
625
625
  });
626
626
  }, { flush: "post" });
627
627
  }
628
- const ke = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Ne = "__vueuse_ssr_handlers__", So = /* @__PURE__ */ Eo();
629
- function Eo() {
630
- return Ne in ke || (ke[Ne] = ke[Ne] || {}), ke[Ne];
628
+ const Ee = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, _e = "__vueuse_ssr_handlers__", bo = /* @__PURE__ */ wo();
629
+ function wo() {
630
+ return _e in Ee || (Ee[_e] = Ee[_e] || {}), Ee[_e];
631
631
  }
632
- function _o(t, e) {
633
- return So[t] || e;
632
+ function So(t, e) {
633
+ return bo[t] || e;
634
634
  }
635
- function $o(t) {
635
+ function Eo(t) {
636
636
  return t == null ? "any" : t instanceof Set ? "set" : t instanceof Map ? "map" : t instanceof Date ? "date" : typeof t == "boolean" ? "boolean" : typeof t == "string" ? "string" : typeof t == "object" ? "object" : Number.isNaN(t) ? "any" : "number";
637
637
  }
638
- const ko = {
638
+ const _o = {
639
639
  boolean: {
640
640
  read: (t) => t === "true",
641
641
  write: (t) => String(t)
@@ -668,101 +668,101 @@ const ko = {
668
668
  read: (t) => new Date(t),
669
669
  write: (t) => t.toISOString()
670
670
  }
671
- }, dt = "vueuse-storage";
672
- function No(t, e, o, n = {}) {
673
- var a;
674
- const { flush: i = "pre", deep: r = !0, listenToStorageChanges: c = !0, writeDefaults: s = !0, mergeDefaults: u = !1, shallow: f, window: h = xe, eventFilter: b, onError: O = (k) => {
671
+ }, lt = "vueuse-storage";
672
+ function ko(t, e, o, n = {}) {
673
+ var r;
674
+ const { flush: i = "pre", deep: a = !0, listenToStorageChanges: u = !0, writeDefaults: c = !0, mergeDefaults: f = !1, shallow: p, window: b = Re, eventFilter: h, onError: _ = (k) => {
675
675
  console.error(k);
676
- }, initOnMounted: $ } = n, D = (f ? _e : A)(e), V = x(() => Q(t));
676
+ }, initOnMounted: m } = n, O = (p ? Se : C)(e), R = I(() => Q(t));
677
677
  if (!o) try {
678
- o = _o("getDefaultStorage", () => xe?.localStorage)();
678
+ o = So("getDefaultStorage", () => Re?.localStorage)();
679
679
  } catch (k) {
680
- O(k);
680
+ _(k);
681
681
  }
682
- if (!o) return D;
683
- const j = Q(e), P = $o(j), U = (a = n.serializer) !== null && a !== void 0 ? a : ko[P], { pause: q, resume: G } = mo(D, (k) => g(k), {
682
+ if (!o) return O;
683
+ const x = Q(e), H = Eo(x), U = (r = n.serializer) !== null && r !== void 0 ? r : _o[H], { pause: K, resume: G } = vo(O, (k) => v(k), {
684
684
  flush: i,
685
- deep: r,
686
- eventFilter: b
685
+ deep: a,
686
+ eventFilter: h
687
687
  });
688
- H(V, () => C(), { flush: i });
688
+ L(R, () => $(), { flush: i });
689
689
  let z = !1;
690
- const _ = (k) => {
691
- $ && !z || C(k);
692
- }, te = (k) => {
693
- $ && !z || B(k);
690
+ const E = (k) => {
691
+ m && !z || $(k);
692
+ }, Y = (k) => {
693
+ m && !z || M(k);
694
694
  };
695
- h && c && (o instanceof Storage ? ut(h, "storage", _, { passive: !0 }) : ut(h, dt, te)), $ ? yo(() => {
696
- z = !0, C();
697
- }) : C();
698
- function W(k, I) {
699
- if (h) {
700
- const L = {
701
- key: V.value,
695
+ b && u && (o instanceof Storage ? it(b, "storage", E, { passive: !0 }) : it(b, lt, Y)), m ? go(() => {
696
+ z = !0, $();
697
+ }) : $();
698
+ function B(k, T) {
699
+ if (b) {
700
+ const F = {
701
+ key: R.value,
702
702
  oldValue: k,
703
- newValue: I,
703
+ newValue: T,
704
704
  storageArea: o
705
705
  };
706
- h.dispatchEvent(o instanceof Storage ? new StorageEvent("storage", L) : new CustomEvent(dt, { detail: L }));
706
+ b.dispatchEvent(o instanceof Storage ? new StorageEvent("storage", F) : new CustomEvent(lt, { detail: F }));
707
707
  }
708
708
  }
709
- function g(k) {
709
+ function v(k) {
710
710
  try {
711
- const I = o.getItem(V.value);
711
+ const T = o.getItem(R.value);
712
712
  if (k == null)
713
- W(I, null), o.removeItem(V.value);
713
+ B(T, null), o.removeItem(R.value);
714
714
  else {
715
- const L = U.write(k);
716
- I !== L && (o.setItem(V.value, L), W(I, L));
715
+ const F = U.write(k);
716
+ T !== F && (o.setItem(R.value, F), B(T, F));
717
717
  }
718
- } catch (I) {
719
- O(I);
718
+ } catch (T) {
719
+ _(T);
720
720
  }
721
721
  }
722
- function m(k) {
723
- const I = k ? k.newValue : o.getItem(V.value);
724
- if (I == null)
725
- return s && j != null && o.setItem(V.value, U.write(j)), j;
726
- if (!k && u) {
727
- const L = U.read(I);
728
- return typeof u == "function" ? u(L, j) : P === "object" && !Array.isArray(L) ? {
729
- ...j,
730
- ...L
731
- } : L;
732
- } else return typeof I != "string" ? I : U.read(I);
733
- }
734
- function C(k) {
722
+ function g(k) {
723
+ const T = k ? k.newValue : o.getItem(R.value);
724
+ if (T == null)
725
+ return c && x != null && o.setItem(R.value, U.write(x)), x;
726
+ if (!k && f) {
727
+ const F = U.read(T);
728
+ return typeof f == "function" ? f(F, x) : H === "object" && !Array.isArray(F) ? {
729
+ ...x,
730
+ ...F
731
+ } : F;
732
+ } else return typeof T != "string" ? T : U.read(T);
733
+ }
734
+ function $(k) {
735
735
  if (!(k && k.storageArea !== o)) {
736
736
  if (k && k.key == null) {
737
- D.value = j;
737
+ O.value = x;
738
738
  return;
739
739
  }
740
- if (!(k && k.key !== V.value)) {
741
- q();
740
+ if (!(k && k.key !== R.value)) {
741
+ K();
742
742
  try {
743
- const I = U.write(D.value);
744
- (k === void 0 || k?.newValue !== I) && (D.value = m(k));
745
- } catch (I) {
746
- O(I);
743
+ const T = U.write(O.value);
744
+ (k === void 0 || k?.newValue !== T) && (O.value = g(k));
745
+ } catch (T) {
746
+ _(T);
747
747
  } finally {
748
- k ? se(G) : G();
748
+ k ? ae(G) : G();
749
749
  }
750
750
  }
751
751
  }
752
752
  }
753
- function B(k) {
754
- C(k.detail);
753
+ function M(k) {
754
+ $(k.detail);
755
755
  }
756
- return D;
756
+ return O;
757
757
  }
758
- function Oo(t, e, o = {}) {
759
- const { window: n = xe } = o;
760
- return No(t, e, n?.localStorage, o);
758
+ function Do(t, e, o = {}) {
759
+ const { window: n = Re } = o;
760
+ return ko(t, e, n?.localStorage, o);
761
761
  }
762
- function He() {
762
+ function Fe() {
763
763
  return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
764
764
  }
765
- function Oe(t) {
765
+ function ke(t) {
766
766
  const e = {
767
767
  type: t.type,
768
768
  clientId: t.clientId,
@@ -776,7 +776,7 @@ function Oe(t) {
776
776
  timestamp: o.timestamp.toISOString()
777
777
  }))), e;
778
778
  }
779
- function Do(t) {
779
+ function Oo(t) {
780
780
  const e = {
781
781
  type: t.type,
782
782
  clientId: t.clientId,
@@ -790,54 +790,54 @@ function Do(t) {
790
790
  timestamp: new Date(o.timestamp)
791
791
  }))), e;
792
792
  }
793
- const Dt = /* @__PURE__ */ ro("hst-operation-log", () => {
794
- const t = A({
793
+ const Dt = /* @__PURE__ */ no("hst-operation-log", () => {
794
+ const t = C({
795
795
  maxOperations: 100,
796
796
  enableCrossTabSync: !0,
797
797
  autoSyncInterval: 3e4,
798
798
  enablePersistence: !1,
799
799
  persistenceKeyPrefix: "stonecrop-ops"
800
- }), e = A([]), o = A(-1), n = A(He()), a = A(!1), i = A([]), r = A(null), c = x(() => o.value < 0 ? !1 : e.value[o.value]?.reversible ?? !1), s = x(() => o.value < e.value.length - 1), u = x(() => {
801
- let v = 0;
802
- for (let p = o.value; p >= 0 && e.value[p]?.reversible; p--)
803
- v++;
804
- return v;
805
- }), f = x(() => e.value.length - 1 - o.value), h = x(() => ({
806
- canUndo: c.value,
807
- canRedo: s.value,
808
- undoCount: u.value,
809
- redoCount: f.value,
800
+ }), e = C([]), o = C(-1), n = C(Fe()), r = C(!1), i = C([]), a = C(null), u = I(() => o.value < 0 ? !1 : e.value[o.value]?.reversible ?? !1), c = I(() => o.value < e.value.length - 1), f = I(() => {
801
+ let d = 0;
802
+ for (let s = o.value; s >= 0 && e.value[s]?.reversible; s--)
803
+ d++;
804
+ return d;
805
+ }), p = I(() => e.value.length - 1 - o.value), b = I(() => ({
806
+ canUndo: u.value,
807
+ canRedo: c.value,
808
+ undoCount: f.value,
809
+ redoCount: p.value,
810
810
  currentIndex: o.value
811
811
  }));
812
- function b(v) {
813
- t.value = { ...t.value, ...v }, t.value.enablePersistence && (E(), S()), t.value.enableCrossTabSync && m();
812
+ function h(d) {
813
+ t.value = { ...t.value, ...d }, t.value.enablePersistence && (w(), S()), t.value.enableCrossTabSync && g();
814
814
  }
815
- function O(v, p = "user") {
816
- const y = {
817
- ...v,
818
- id: He(),
815
+ function _(d, s = "user") {
816
+ const l = {
817
+ ...d,
818
+ id: Fe(),
819
819
  timestamp: /* @__PURE__ */ new Date(),
820
- source: p,
820
+ source: s,
821
821
  userId: t.value.userId
822
822
  };
823
- if (t.value.operationFilter && !t.value.operationFilter(y))
824
- return y.id;
825
- if (a.value)
826
- return i.value.push(y), y.id;
827
- if (o.value < e.value.length - 1 && (e.value = e.value.slice(0, o.value + 1)), e.value.push(y), o.value++, t.value.maxOperations && e.value.length > t.value.maxOperations) {
828
- const l = e.value.length - t.value.maxOperations;
829
- e.value = e.value.slice(l), o.value -= l;
823
+ if (t.value.operationFilter && !t.value.operationFilter(l))
824
+ return l.id;
825
+ if (r.value)
826
+ return i.value.push(l), l.id;
827
+ if (o.value < e.value.length - 1 && (e.value = e.value.slice(0, o.value + 1)), e.value.push(l), o.value++, t.value.maxOperations && e.value.length > t.value.maxOperations) {
828
+ const y = e.value.length - t.value.maxOperations;
829
+ e.value = e.value.slice(y), o.value -= y;
830
830
  }
831
- return t.value.enableCrossTabSync && C(y), y.id;
831
+ return t.value.enableCrossTabSync && $(l), l.id;
832
832
  }
833
- function $() {
834
- a.value = !0, i.value = [], r.value = He();
833
+ function m() {
834
+ r.value = !0, i.value = [], a.value = Fe();
835
835
  }
836
- function D(v) {
837
- if (!a.value || i.value.length === 0)
838
- return a.value = !1, i.value = [], r.value = null, null;
839
- const p = r.value, y = i.value.every((w) => w.reversible), l = {
840
- id: p,
836
+ function O(d) {
837
+ if (!r.value || i.value.length === 0)
838
+ return r.value = !1, i.value = [], a.value = null, null;
839
+ const s = a.value, l = i.value.every((j) => j.reversible), y = {
840
+ id: s,
841
841
  type: "batch",
842
842
  path: "",
843
843
  // Batch doesn't have a single path
@@ -847,192 +847,192 @@ const Dt = /* @__PURE__ */ ro("hst-operation-log", () => {
847
847
  doctype: i.value[0]?.doctype || "",
848
848
  timestamp: /* @__PURE__ */ new Date(),
849
849
  source: "user",
850
- reversible: y,
851
- irreversibleReason: y ? void 0 : "Contains irreversible operations",
852
- childOperationIds: i.value.map((w) => w.id),
853
- metadata: { description: v }
850
+ reversible: l,
851
+ irreversibleReason: l ? void 0 : "Contains irreversible operations",
852
+ childOperationIds: i.value.map((j) => j.id),
853
+ metadata: { description: d }
854
854
  };
855
- i.value.forEach((w) => {
856
- w.parentOperationId = p;
857
- }), e.value.push(...i.value, l), o.value = e.value.length - 1, t.value.enableCrossTabSync && B(i.value, l);
858
- const d = p;
859
- return a.value = !1, i.value = [], r.value = null, d;
860
- }
861
- function V() {
862
- a.value = !1, i.value = [], r.value = null;
863
- }
864
- function j(v) {
865
- if (!c.value) return !1;
866
- const p = e.value[o.value];
867
- if (!p.reversible)
868
- return typeof console < "u" && p.irreversibleReason && console.warn("Cannot undo irreversible operation:", p.irreversibleReason), !1;
855
+ i.value.forEach((j) => {
856
+ j.parentOperationId = s;
857
+ }), e.value.push(...i.value, y), o.value = e.value.length - 1, t.value.enableCrossTabSync && M(i.value, y);
858
+ const N = s;
859
+ return r.value = !1, i.value = [], a.value = null, N;
860
+ }
861
+ function R() {
862
+ r.value = !1, i.value = [], a.value = null;
863
+ }
864
+ function x(d) {
865
+ if (!u.value) return !1;
866
+ const s = e.value[o.value];
867
+ if (!s.reversible)
868
+ return typeof console < "u" && s.irreversibleReason && console.warn("Cannot undo irreversible operation:", s.irreversibleReason), !1;
869
869
  try {
870
- if (p.type === "batch" && p.childOperationIds)
871
- for (let y = p.childOperationIds.length - 1; y >= 0; y--) {
872
- const l = p.childOperationIds[y], d = e.value.find((w) => w.id === l);
873
- d && U(d, v);
870
+ if (s.type === "batch" && s.childOperationIds)
871
+ for (let l = s.childOperationIds.length - 1; l >= 0; l--) {
872
+ const y = s.childOperationIds[l], N = e.value.find((j) => j.id === y);
873
+ N && U(N, d);
874
874
  }
875
875
  else
876
- U(p, v);
877
- return o.value--, t.value.enableCrossTabSync && k(p), !0;
878
- } catch (y) {
879
- return typeof console < "u" && console.error("Undo failed:", y), !1;
876
+ U(s, d);
877
+ return o.value--, t.value.enableCrossTabSync && k(s), !0;
878
+ } catch (l) {
879
+ return typeof console < "u" && console.error("Undo failed:", l), !1;
880
880
  }
881
881
  }
882
- function P(v) {
883
- if (!s.value) return !1;
884
- const p = e.value[o.value + 1];
882
+ function H(d) {
883
+ if (!c.value) return !1;
884
+ const s = e.value[o.value + 1];
885
885
  try {
886
- if (p.type === "batch" && p.childOperationIds)
887
- for (const y of p.childOperationIds) {
888
- const l = e.value.find((d) => d.id === y);
889
- l && q(l, v);
886
+ if (s.type === "batch" && s.childOperationIds)
887
+ for (const l of s.childOperationIds) {
888
+ const y = e.value.find((N) => N.id === l);
889
+ y && K(y, d);
890
890
  }
891
891
  else
892
- q(p, v);
893
- return o.value++, t.value.enableCrossTabSync && I(p), !0;
894
- } catch (y) {
895
- return typeof console < "u" && console.error("Redo failed:", y), !1;
892
+ K(s, d);
893
+ return o.value++, t.value.enableCrossTabSync && T(s), !0;
894
+ } catch (l) {
895
+ return typeof console < "u" && console.error("Redo failed:", l), !1;
896
896
  }
897
897
  }
898
- function U(v, p) {
899
- (v.type === "set" || v.type === "delete") && p && typeof p.set == "function" && p.set(v.path, v.beforeValue, "undo");
898
+ function U(d, s) {
899
+ (d.type === "set" || d.type === "delete") && s && typeof s.set == "function" && s.set(d.path, d.beforeValue, "undo");
900
900
  }
901
- function q(v, p) {
902
- (v.type === "set" || v.type === "delete") && p && typeof p.set == "function" && p.set(v.path, v.afterValue, "redo");
901
+ function K(d, s) {
902
+ (d.type === "set" || d.type === "delete") && s && typeof s.set == "function" && s.set(d.path, d.afterValue, "redo");
903
903
  }
904
904
  function G() {
905
- const v = e.value.filter((y) => y.reversible).length, p = e.value.map((y) => y.timestamp);
905
+ const d = e.value.filter((l) => l.reversible).length, s = e.value.map((l) => l.timestamp);
906
906
  return {
907
907
  operations: [...e.value],
908
908
  currentIndex: o.value,
909
909
  totalOperations: e.value.length,
910
- reversibleOperations: v,
911
- irreversibleOperations: e.value.length - v,
912
- oldestOperation: p.length > 0 ? new Date(Math.min(...p.map((y) => y.getTime()))) : void 0,
913
- newestOperation: p.length > 0 ? new Date(Math.max(...p.map((y) => y.getTime()))) : void 0
910
+ reversibleOperations: d,
911
+ irreversibleOperations: e.value.length - d,
912
+ oldestOperation: s.length > 0 ? new Date(Math.min(...s.map((l) => l.getTime()))) : void 0,
913
+ newestOperation: s.length > 0 ? new Date(Math.max(...s.map((l) => l.getTime()))) : void 0
914
914
  };
915
915
  }
916
916
  function z() {
917
917
  e.value = [], o.value = -1;
918
918
  }
919
- function _(v, p) {
920
- return e.value.filter((y) => y.doctype === v && (p === void 0 || y.recordId === p));
919
+ function E(d, s) {
920
+ return e.value.filter((l) => l.doctype === d && (s === void 0 || l.recordId === s));
921
921
  }
922
- function te(v, p) {
923
- const y = e.value.find((l) => l.id === v);
924
- y && (y.reversible = !1, y.irreversibleReason = p);
922
+ function Y(d, s) {
923
+ const l = e.value.find((y) => y.id === d);
924
+ l && (l.reversible = !1, l.irreversibleReason = s);
925
925
  }
926
- function W(v, p, y, l = "success", d) {
927
- const w = {
926
+ function B(d, s, l, y = "success", N) {
927
+ const j = {
928
928
  type: "action",
929
- path: y && y.length > 0 ? `${v}.${y[0]}` : v,
929
+ path: l && l.length > 0 ? `${d}.${l[0]}` : d,
930
930
  fieldname: "",
931
931
  beforeValue: null,
932
932
  afterValue: null,
933
- doctype: v,
934
- recordId: y && y.length > 0 ? y[0] : void 0,
933
+ doctype: d,
934
+ recordId: l && l.length > 0 ? l[0] : void 0,
935
935
  reversible: !1,
936
936
  // Actions are typically not reversible
937
- actionName: p,
938
- actionRecordIds: y,
939
- actionResult: l,
940
- actionError: d
937
+ actionName: s,
938
+ actionRecordIds: l,
939
+ actionResult: y,
940
+ actionError: N
941
941
  };
942
- return O(w);
943
- }
944
- let g = null;
945
- function m() {
946
- typeof window > "u" || !window.BroadcastChannel || (g = new BroadcastChannel("stonecrop-operation-log"), g.addEventListener("message", (v) => {
947
- const p = v.data;
948
- if (!p || typeof p != "object") return;
949
- const y = Do(p);
950
- y.clientId !== n.value && (y.type === "operation" && y.operation ? (e.value.push({ ...y.operation, source: "sync" }), o.value = e.value.length - 1) : y.type === "operation" && y.operations && (e.value.push(...y.operations.map((l) => ({ ...l, source: "sync" }))), o.value = e.value.length - 1));
942
+ return _(j);
943
+ }
944
+ let v = null;
945
+ function g() {
946
+ typeof window > "u" || !window.BroadcastChannel || (v = new BroadcastChannel("stonecrop-operation-log"), v.addEventListener("message", (d) => {
947
+ const s = d.data;
948
+ if (!s || typeof s != "object") return;
949
+ const l = Oo(s);
950
+ l.clientId !== n.value && (l.type === "operation" && l.operation ? (e.value.push({ ...l.operation, source: "sync" }), o.value = e.value.length - 1) : l.type === "operation" && l.operations && (e.value.push(...l.operations.map((y) => ({ ...y, source: "sync" }))), o.value = e.value.length - 1));
951
951
  }));
952
952
  }
953
- function C(v) {
954
- if (!g) return;
955
- const p = {
953
+ function $(d) {
954
+ if (!v) return;
955
+ const s = {
956
956
  type: "operation",
957
- operation: v,
957
+ operation: d,
958
958
  clientId: n.value,
959
959
  timestamp: /* @__PURE__ */ new Date()
960
960
  };
961
- g.postMessage(Oe(p));
961
+ v.postMessage(ke(s));
962
962
  }
963
- function B(v, p) {
964
- if (!g) return;
965
- const y = {
963
+ function M(d, s) {
964
+ if (!v) return;
965
+ const l = {
966
966
  type: "operation",
967
- operations: [...v, p],
967
+ operations: [...d, s],
968
968
  clientId: n.value,
969
969
  timestamp: /* @__PURE__ */ new Date()
970
970
  };
971
- g.postMessage(Oe(y));
971
+ v.postMessage(ke(l));
972
972
  }
973
- function k(v) {
974
- if (!g) return;
975
- const p = {
973
+ function k(d) {
974
+ if (!v) return;
975
+ const s = {
976
976
  type: "undo",
977
- operation: v,
977
+ operation: d,
978
978
  clientId: n.value,
979
979
  timestamp: /* @__PURE__ */ new Date()
980
980
  };
981
- g.postMessage(Oe(p));
981
+ v.postMessage(ke(s));
982
982
  }
983
- function I(v) {
984
- if (!g) return;
985
- const p = {
983
+ function T(d) {
984
+ if (!v) return;
985
+ const s = {
986
986
  type: "redo",
987
- operation: v,
987
+ operation: d,
988
988
  clientId: n.value,
989
989
  timestamp: /* @__PURE__ */ new Date()
990
990
  };
991
- g.postMessage(Oe(p));
991
+ v.postMessage(ke(s));
992
992
  }
993
- const L = Oo("stonecrop-ops-operations", null, {
993
+ const F = Do("stonecrop-ops-operations", null, {
994
994
  serializer: {
995
- read: (v) => {
995
+ read: (d) => {
996
996
  try {
997
- return JSON.parse(v);
997
+ return JSON.parse(d);
998
998
  } catch {
999
999
  return null;
1000
1000
  }
1001
1001
  },
1002
- write: (v) => v ? JSON.stringify(v) : ""
1002
+ write: (d) => d ? JSON.stringify(d) : ""
1003
1003
  }
1004
1004
  });
1005
- function E() {
1005
+ function w() {
1006
1006
  if (!(typeof window > "u"))
1007
1007
  try {
1008
- const v = L.value;
1009
- v && Array.isArray(v.operations) && (e.value = v.operations.map((p) => ({
1010
- ...p,
1011
- timestamp: new Date(p.timestamp)
1012
- })), o.value = v.currentIndex ?? -1);
1013
- } catch (v) {
1014
- typeof console < "u" && console.error("Failed to load operations from persistence:", v);
1008
+ const d = F.value;
1009
+ d && Array.isArray(d.operations) && (e.value = d.operations.map((s) => ({
1010
+ ...s,
1011
+ timestamp: new Date(s.timestamp)
1012
+ })), o.value = d.currentIndex ?? -1);
1013
+ } catch (d) {
1014
+ typeof console < "u" && console.error("Failed to load operations from persistence:", d);
1015
1015
  }
1016
1016
  }
1017
- function N() {
1017
+ function D() {
1018
1018
  if (!(typeof window > "u"))
1019
1019
  try {
1020
- L.value = {
1021
- operations: e.value.map((v) => ({
1022
- ...v,
1023
- timestamp: v.timestamp.toISOString()
1020
+ F.value = {
1021
+ operations: e.value.map((d) => ({
1022
+ ...d,
1023
+ timestamp: d.timestamp.toISOString()
1024
1024
  })),
1025
1025
  currentIndex: o.value
1026
1026
  };
1027
- } catch (v) {
1028
- typeof console < "u" && console.error("Failed to save operations to persistence:", v);
1027
+ } catch (d) {
1028
+ typeof console < "u" && console.error("Failed to save operations to persistence:", d);
1029
1029
  }
1030
1030
  }
1031
1031
  function S() {
1032
- H(
1032
+ L(
1033
1033
  [e, o],
1034
1034
  () => {
1035
- t.value.enablePersistence && N();
1035
+ t.value.enablePersistence && D();
1036
1036
  },
1037
1037
  { deep: !0 }
1038
1038
  );
@@ -1043,28 +1043,28 @@ const Dt = /* @__PURE__ */ ro("hst-operation-log", () => {
1043
1043
  currentIndex: o,
1044
1044
  config: t,
1045
1045
  clientId: n,
1046
- undoRedoState: h,
1046
+ undoRedoState: b,
1047
1047
  // Computed
1048
- canUndo: c,
1049
- canRedo: s,
1050
- undoCount: u,
1051
- redoCount: f,
1048
+ canUndo: u,
1049
+ canRedo: c,
1050
+ undoCount: f,
1051
+ redoCount: p,
1052
1052
  // Methods
1053
- configure: b,
1054
- addOperation: O,
1055
- startBatch: $,
1056
- commitBatch: D,
1057
- cancelBatch: V,
1058
- undo: j,
1059
- redo: P,
1053
+ configure: h,
1054
+ addOperation: _,
1055
+ startBatch: m,
1056
+ commitBatch: O,
1057
+ cancelBatch: R,
1058
+ undo: x,
1059
+ redo: H,
1060
1060
  clear: z,
1061
- getOperationsFor: _,
1061
+ getOperationsFor: E,
1062
1062
  getSnapshot: G,
1063
- markIrreversible: te,
1064
- logAction: W
1063
+ markIrreversible: Y,
1064
+ logAction: B
1065
1065
  };
1066
1066
  });
1067
- class ye {
1067
+ class ge {
1068
1068
  /**
1069
1069
  * The root FieldTriggerEngine instance
1070
1070
  */
@@ -1085,9 +1085,9 @@ class ye {
1085
1085
  * @param options - Configuration options for the field trigger engine
1086
1086
  */
1087
1087
  constructor(e = {}) {
1088
- if (ye._root)
1089
- return ye._root;
1090
- ye._root = this, this.options = {
1088
+ if (ge._root)
1089
+ return ge._root;
1090
+ ge._root = this, this.options = {
1091
1091
  defaultTimeout: e.defaultTimeout ?? 5e3,
1092
1092
  debug: e.debug ?? !1,
1093
1093
  enableRollback: e.enableRollback ?? !0,
@@ -1133,25 +1133,25 @@ class ye {
1133
1133
  */
1134
1134
  registerDoctypeActions(e, o) {
1135
1135
  if (!o) return;
1136
- const n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
1136
+ const n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
1137
1137
  if (typeof o.entrySeq == "function")
1138
- o.entrySeq().forEach(([i, r]) => {
1139
- this.categorizeAction(i, r, n, a);
1138
+ o.entrySeq().forEach(([i, a]) => {
1139
+ this.categorizeAction(i, a, n, r);
1140
1140
  });
1141
1141
  else if (o instanceof Map)
1142
- for (const [i, r] of o)
1143
- this.categorizeAction(i, r, n, a);
1144
- else o && typeof o == "object" && Object.entries(o).forEach(([i, r]) => {
1145
- this.categorizeAction(i, r, n, a);
1142
+ for (const [i, a] of o)
1143
+ this.categorizeAction(i, a, n, r);
1144
+ else o && typeof o == "object" && Object.entries(o).forEach(([i, a]) => {
1145
+ this.categorizeAction(i, a, n, r);
1146
1146
  });
1147
- this.doctypeActions.set(e, n), this.doctypeTransitions.set(e, a);
1147
+ this.doctypeActions.set(e, n), this.doctypeTransitions.set(e, r);
1148
1148
  }
1149
1149
  /**
1150
1150
  * Categorize an action as either a field trigger or XState transition
1151
1151
  * Uses uppercase convention: UPPERCASE = transition, lowercase/mixed = field trigger
1152
1152
  */
1153
- categorizeAction(e, o, n, a) {
1154
- this.isTransitionKey(e) ? a.set(e, o) : n.set(e, o);
1153
+ categorizeAction(e, o, n, r) {
1154
+ this.isTransitionKey(e) ? r.set(e, o) : n.set(e, o);
1155
1155
  }
1156
1156
  /**
1157
1157
  * Determine if a key represents an XState transition
@@ -1166,7 +1166,7 @@ class ye {
1166
1166
  * @param options - Execution options (timeout and enableRollback)
1167
1167
  */
1168
1168
  async executeFieldTriggers(e, o = {}) {
1169
- const { doctype: n, fieldname: a } = e, i = this.findFieldTriggers(n, a);
1169
+ const { doctype: n, fieldname: r } = e, i = this.findFieldTriggers(n, r);
1170
1170
  if (i.length === 0)
1171
1171
  return {
1172
1172
  path: e.path,
@@ -1176,49 +1176,49 @@ class ye {
1176
1176
  stoppedOnError: !1,
1177
1177
  rolledBack: !1
1178
1178
  };
1179
- const r = performance.now(), c = [];
1180
- let s = !1, u = !1, f;
1181
- const h = this.getFieldRollback(n, a), b = o.enableRollback ?? h ?? this.options.enableRollback;
1182
- b && e.store && (f = this.captureSnapshot(e));
1183
- for (const D of i)
1179
+ const a = performance.now(), u = [];
1180
+ let c = !1, f = !1, p;
1181
+ const b = this.getFieldRollback(n, r), h = o.enableRollback ?? b ?? this.options.enableRollback;
1182
+ h && e.store && (p = this.captureSnapshot(e));
1183
+ for (const O of i)
1184
1184
  try {
1185
- const V = await this.executeAction(D, e, o.timeout);
1186
- if (c.push(V), !V.success) {
1187
- s = !0;
1185
+ const R = await this.executeAction(O, e, o.timeout);
1186
+ if (u.push(R), !R.success) {
1187
+ c = !0;
1188
1188
  break;
1189
1189
  }
1190
- } catch (V) {
1191
- const j = {
1190
+ } catch (R) {
1191
+ const x = {
1192
1192
  success: !1,
1193
- error: V instanceof Error ? V : new Error(String(V)),
1193
+ error: R instanceof Error ? R : new Error(String(R)),
1194
1194
  executionTime: 0,
1195
- action: D
1195
+ action: O
1196
1196
  };
1197
- c.push(j), s = !0;
1197
+ u.push(x), c = !0;
1198
1198
  break;
1199
1199
  }
1200
- if (b && s && f && e.store)
1200
+ if (h && c && p && e.store)
1201
1201
  try {
1202
- this.restoreSnapshot(e, f), u = !0;
1203
- } catch (D) {
1204
- console.error("[FieldTriggers] Rollback failed:", D);
1202
+ this.restoreSnapshot(e, p), f = !0;
1203
+ } catch (O) {
1204
+ console.error("[FieldTriggers] Rollback failed:", O);
1205
1205
  }
1206
- const O = performance.now() - r, $ = c.filter((D) => !D.success);
1207
- if ($.length > 0 && this.options.errorHandler)
1208
- for (const D of $)
1206
+ const _ = performance.now() - a, m = u.filter((O) => !O.success);
1207
+ if (m.length > 0 && this.options.errorHandler)
1208
+ for (const O of m)
1209
1209
  try {
1210
- this.options.errorHandler(D.error, e, D.action);
1211
- } catch (V) {
1212
- console.error("[FieldTriggers] Error in global error handler:", V);
1210
+ this.options.errorHandler(O.error, e, O.action);
1211
+ } catch (R) {
1212
+ console.error("[FieldTriggers] Error in global error handler:", R);
1213
1213
  }
1214
1214
  return {
1215
1215
  path: e.path,
1216
- actionResults: c,
1217
- totalExecutionTime: O,
1218
- allSucceeded: c.every((D) => D.success),
1219
- stoppedOnError: s,
1220
- rolledBack: u,
1221
- snapshot: this.options.debug && b ? f : void 0
1216
+ actionResults: u,
1217
+ totalExecutionTime: _,
1218
+ allSucceeded: u.every((O) => O.success),
1219
+ stoppedOnError: c,
1220
+ rolledBack: f,
1221
+ snapshot: this.options.debug && h ? p : void 0
1222
1222
  // Only include snapshot in debug mode if rollback is enabled
1223
1223
  };
1224
1224
  }
@@ -1229,35 +1229,35 @@ class ye {
1229
1229
  * @param options - Execution options (timeout)
1230
1230
  */
1231
1231
  async executeTransitionActions(e, o = {}) {
1232
- const { doctype: n, transition: a } = e, i = this.findTransitionActions(n, a);
1232
+ const { doctype: n, transition: r } = e, i = this.findTransitionActions(n, r);
1233
1233
  if (i.length === 0)
1234
1234
  return [];
1235
- const r = [];
1236
- for (const s of i)
1235
+ const a = [];
1236
+ for (const c of i)
1237
1237
  try {
1238
- const u = await this.executeTransitionAction(s, e, o.timeout);
1239
- if (r.push(u), !u.success)
1238
+ const f = await this.executeTransitionAction(c, e, o.timeout);
1239
+ if (a.push(f), !f.success)
1240
1240
  break;
1241
- } catch (u) {
1242
- const f = {
1241
+ } catch (f) {
1242
+ const p = {
1243
1243
  success: !1,
1244
- error: u instanceof Error ? u : new Error(String(u)),
1244
+ error: f instanceof Error ? f : new Error(String(f)),
1245
1245
  executionTime: 0,
1246
- action: s,
1247
- transition: a
1246
+ action: c,
1247
+ transition: r
1248
1248
  };
1249
- r.push(f);
1249
+ a.push(p);
1250
1250
  break;
1251
1251
  }
1252
- const c = r.filter((s) => !s.success);
1253
- if (c.length > 0 && this.options.errorHandler)
1254
- for (const s of c)
1252
+ const u = a.filter((c) => !c.success);
1253
+ if (u.length > 0 && this.options.errorHandler)
1254
+ for (const c of u)
1255
1255
  try {
1256
- this.options.errorHandler(s.error, e, s.action);
1257
- } catch (u) {
1258
- console.error("[FieldTriggers] Error in global error handler:", u);
1256
+ this.options.errorHandler(c.error, e, c.action);
1257
+ } catch (f) {
1258
+ console.error("[FieldTriggers] Error in global error handler:", f);
1259
1259
  }
1260
- return r;
1260
+ return a;
1261
1261
  }
1262
1262
  /**
1263
1263
  * Find transition actions for a specific doctype and transition
@@ -1270,27 +1270,27 @@ class ye {
1270
1270
  * Execute a single transition action by name
1271
1271
  */
1272
1272
  async executeTransitionAction(e, o, n) {
1273
- const a = performance.now(), i = n ?? this.options.defaultTimeout;
1273
+ const r = performance.now(), i = n ?? this.options.defaultTimeout;
1274
1274
  try {
1275
- let r = this.globalTransitionActions.get(e);
1276
- if (!r) {
1277
- const c = this.globalActions.get(e);
1278
- c && (r = c);
1275
+ let a = this.globalTransitionActions.get(e);
1276
+ if (!a) {
1277
+ const u = this.globalActions.get(e);
1278
+ u && (a = u);
1279
1279
  }
1280
- if (!r)
1280
+ if (!a)
1281
1281
  throw new Error(`Transition action "${e}" not found in registry`);
1282
- return await this.executeWithTimeout(r, o, i), {
1282
+ return await this.executeWithTimeout(a, o, i), {
1283
1283
  success: !0,
1284
- executionTime: performance.now() - a,
1284
+ executionTime: performance.now() - r,
1285
1285
  action: e,
1286
1286
  transition: o.transition
1287
1287
  };
1288
- } catch (r) {
1289
- const c = performance.now() - a;
1288
+ } catch (a) {
1289
+ const u = performance.now() - r;
1290
1290
  return {
1291
1291
  success: !1,
1292
- error: r instanceof Error ? r : new Error(String(r)),
1293
- executionTime: c,
1292
+ error: a instanceof Error ? a : new Error(String(a)),
1293
+ executionTime: u,
1294
1294
  action: e,
1295
1295
  transition: o.transition
1296
1296
  };
@@ -1303,10 +1303,10 @@ class ye {
1303
1303
  findFieldTriggers(e, o) {
1304
1304
  const n = this.doctypeActions.get(e);
1305
1305
  if (!n) return [];
1306
- const a = [];
1307
- for (const [i, r] of n)
1308
- this.isFieldTriggerKey(i, o) && a.push(...r);
1309
- return a;
1306
+ const r = [];
1307
+ for (const [i, a] of n)
1308
+ this.isFieldTriggerKey(i, o) && r.push(...a);
1309
+ return r;
1310
1310
  }
1311
1311
  /**
1312
1312
  * Determine if an action key represents a field trigger
@@ -1323,12 +1323,12 @@ class ye {
1323
1323
  * Supports wildcards (*) for dynamic segments
1324
1324
  */
1325
1325
  matchFieldPattern(e, o) {
1326
- const n = e.split("."), a = o.split(".");
1327
- if (n.length !== a.length)
1326
+ const n = e.split("."), r = o.split(".");
1327
+ if (n.length !== r.length)
1328
1328
  return !1;
1329
1329
  for (let i = 0; i < n.length; i++) {
1330
- const r = n[i], c = a[i];
1331
- if (r !== "*" && r !== c)
1330
+ const a = n[i], u = r[i];
1331
+ if (a !== "*" && a !== u)
1332
1332
  return !1;
1333
1333
  }
1334
1334
  return !0;
@@ -1337,22 +1337,22 @@ class ye {
1337
1337
  * Execute a single action by name
1338
1338
  */
1339
1339
  async executeAction(e, o, n) {
1340
- const a = performance.now(), i = n ?? this.options.defaultTimeout;
1340
+ const r = performance.now(), i = n ?? this.options.defaultTimeout;
1341
1341
  try {
1342
- const r = this.globalActions.get(e);
1343
- if (!r)
1342
+ const a = this.globalActions.get(e);
1343
+ if (!a)
1344
1344
  throw new Error(`Action "${e}" not found in registry`);
1345
- return await this.executeWithTimeout(r, o, i), {
1345
+ return await this.executeWithTimeout(a, o, i), {
1346
1346
  success: !0,
1347
- executionTime: performance.now() - a,
1347
+ executionTime: performance.now() - r,
1348
1348
  action: e
1349
1349
  };
1350
- } catch (r) {
1351
- const c = performance.now() - a;
1350
+ } catch (a) {
1351
+ const u = performance.now() - r;
1352
1352
  return {
1353
1353
  success: !1,
1354
- error: r instanceof Error ? r : new Error(String(r)),
1355
- executionTime: c,
1354
+ error: a instanceof Error ? a : new Error(String(a)),
1355
+ executionTime: u,
1356
1356
  action: e
1357
1357
  };
1358
1358
  }
@@ -1361,14 +1361,14 @@ class ye {
1361
1361
  * Execute a function with timeout
1362
1362
  */
1363
1363
  async executeWithTimeout(e, o, n) {
1364
- return new Promise((a, i) => {
1365
- const r = setTimeout(() => {
1364
+ return new Promise((r, i) => {
1365
+ const a = setTimeout(() => {
1366
1366
  i(new Error(`Action timeout after ${n}ms`));
1367
1367
  }, n);
1368
- Promise.resolve(e(o)).then((c) => {
1369
- clearTimeout(r), a(c);
1370
- }).catch((c) => {
1371
- clearTimeout(r), i(c);
1368
+ Promise.resolve(e(o)).then((u) => {
1369
+ clearTimeout(a), r(u);
1370
+ }).catch((u) => {
1371
+ clearTimeout(a), i(u);
1372
1372
  });
1373
1373
  });
1374
1374
  }
@@ -1400,24 +1400,24 @@ class ye {
1400
1400
  }
1401
1401
  }
1402
1402
  }
1403
- function ft(t) {
1404
- return new ye(t);
1403
+ function ct(t) {
1404
+ return new ge(t);
1405
1405
  }
1406
- function vt() {
1406
+ function ut() {
1407
1407
  try {
1408
1408
  return Dt();
1409
1409
  } catch {
1410
1410
  return null;
1411
1411
  }
1412
1412
  }
1413
- class ue {
1413
+ class ce {
1414
1414
  static instance;
1415
1415
  /**
1416
1416
  * Gets the singleton instance of HST
1417
1417
  * @returns The HST singleton instance
1418
1418
  */
1419
1419
  static getInstance() {
1420
- return ue.instance || (ue.instance = new ue()), ue.instance;
1420
+ return ce.instance || (ce.instance = new ce()), ce.instance;
1421
1421
  }
1422
1422
  /**
1423
1423
  * Gets the global registry instance
@@ -1451,23 +1451,23 @@ class ue {
1451
1451
  return o.registry[e];
1452
1452
  }
1453
1453
  }
1454
- class Te {
1454
+ class Ie {
1455
1455
  target;
1456
1456
  parentPath;
1457
1457
  rootNode;
1458
1458
  doctype;
1459
1459
  parentDoctype;
1460
1460
  hst;
1461
- constructor(e, o, n = "", a = null, i) {
1462
- return this.target = e, this.parentPath = n, this.rootNode = a || this, this.doctype = o, this.parentDoctype = i, this.hst = ue.getInstance(), new Proxy(this, {
1463
- get(r, c) {
1464
- if (c in r) return r[c];
1465
- const s = String(c);
1466
- return r.getNode(s);
1461
+ constructor(e, o, n = "", r = null, i) {
1462
+ return this.target = e, this.parentPath = n, this.rootNode = r || this, this.doctype = o, this.parentDoctype = i, this.hst = ce.getInstance(), new Proxy(this, {
1463
+ get(a, u) {
1464
+ if (u in a) return a[u];
1465
+ const c = String(u);
1466
+ return a.getNode(c);
1467
1467
  },
1468
- set(r, c, s) {
1469
- const u = String(c);
1470
- return r.set(u, s), !0;
1468
+ set(a, u, c) {
1469
+ const f = String(u);
1470
+ return a.set(f, c), !0;
1471
1471
  }
1472
1472
  });
1473
1473
  }
@@ -1476,25 +1476,25 @@ class Te {
1476
1476
  }
1477
1477
  // Method to get a tree-wrapped node for navigation
1478
1478
  getNode(e) {
1479
- const o = this.resolvePath(e), n = this.resolveValue(e), a = o.split(".");
1479
+ const o = this.resolvePath(e), n = this.resolveValue(e), r = o.split(".");
1480
1480
  let i = this.doctype;
1481
- return this.doctype === "StonecropStore" && a.length >= 1 && (i = a[0]), typeof n == "object" && n !== null && !this.isPrimitive(n) ? new Te(n, i, o, this.rootNode, this.parentDoctype) : new Te(n, i, o, this.rootNode, this.parentDoctype);
1481
+ return this.doctype === "StonecropStore" && r.length >= 1 && (i = r[0]), typeof n == "object" && n !== null && !this.isPrimitive(n) ? new Ie(n, i, o, this.rootNode, this.parentDoctype) : new Ie(n, i, o, this.rootNode, this.parentDoctype);
1482
1482
  }
1483
1483
  set(e, o, n = "user") {
1484
- const a = this.resolvePath(e), i = this.has(e) ? this.get(e) : void 0;
1484
+ const r = this.resolvePath(e), i = this.has(e) ? this.get(e) : void 0;
1485
1485
  if (n !== "undo" && n !== "redo") {
1486
- const r = vt();
1487
- if (r && typeof r.addOperation == "function") {
1488
- const c = a.split("."), s = this.doctype === "StonecropStore" && c.length >= 1 ? c[0] : this.doctype, u = c.length >= 2 ? c[1] : void 0, f = c.slice(2).join(".") || c[c.length - 1], h = o === void 0 && i !== void 0 ? "delete" : "set";
1489
- r.addOperation(
1486
+ const a = ut();
1487
+ if (a && typeof a.addOperation == "function") {
1488
+ const u = r.split("."), c = this.doctype === "StonecropStore" && u.length >= 1 ? u[0] : this.doctype, f = u.length >= 2 ? u[1] : void 0, p = u.slice(2).join(".") || u[u.length - 1], b = o === void 0 && i !== void 0 ? "delete" : "set";
1489
+ a.addOperation(
1490
1490
  {
1491
- type: h,
1492
- path: a,
1493
- fieldname: f,
1491
+ type: b,
1492
+ path: r,
1493
+ fieldname: p,
1494
1494
  beforeValue: i,
1495
1495
  afterValue: o,
1496
- doctype: s,
1497
- recordId: u,
1496
+ doctype: c,
1497
+ recordId: f,
1498
1498
  reversible: !0
1499
1499
  // Default to reversible, can be changed by field triggers
1500
1500
  },
@@ -1502,7 +1502,7 @@ class Te {
1502
1502
  );
1503
1503
  }
1504
1504
  }
1505
- this.updateValue(e, o), this.triggerFieldActions(a, i, o);
1505
+ this.updateValue(e, o), this.triggerFieldActions(r, i, o);
1506
1506
  }
1507
1507
  has(e) {
1508
1508
  try {
@@ -1510,11 +1510,11 @@ class Te {
1510
1510
  return !0;
1511
1511
  const o = this.parsePath(e);
1512
1512
  let n = this.target;
1513
- for (let a = 0; a < o.length; a++) {
1514
- const i = o[a];
1513
+ for (let r = 0; r < o.length; r++) {
1514
+ const i = o[r];
1515
1515
  if (n == null)
1516
1516
  return !1;
1517
- if (a === o.length - 1)
1517
+ if (r === o.length - 1)
1518
1518
  return this.isImmutable(n) ? n.has(i) : this.isPiniaStore(n) && n.$state && i in n.$state || i in n;
1519
1519
  n = this.getProperty(n, i);
1520
1520
  }
@@ -1545,10 +1545,10 @@ class Te {
1545
1545
  * Trigger an XState transition with optional context data
1546
1546
  */
1547
1547
  async triggerTransition(e, o) {
1548
- const n = ft(), a = this.parentPath.split(".");
1549
- let i = this.doctype, r;
1550
- this.doctype === "StonecropStore" && a.length >= 1 && (i = a[0]), a.length >= 2 && (r = a[1]);
1551
- const c = {
1548
+ const n = ct(), r = this.parentPath.split(".");
1549
+ let i = this.doctype, a;
1550
+ this.doctype === "StonecropStore" && r.length >= 1 && (i = r[0]), r.length >= 2 && (a = r[1]);
1551
+ const u = {
1552
1552
  path: this.parentPath,
1553
1553
  fieldname: "",
1554
1554
  // No specific field for transitions
@@ -1556,15 +1556,15 @@ class Te {
1556
1556
  afterValue: void 0,
1557
1557
  operation: "set",
1558
1558
  doctype: i,
1559
- recordId: r,
1559
+ recordId: a,
1560
1560
  timestamp: /* @__PURE__ */ new Date(),
1561
1561
  store: this.rootNode || void 0,
1562
1562
  transition: e,
1563
1563
  currentState: o?.currentState,
1564
1564
  targetState: o?.targetState,
1565
1565
  fsmContext: o?.fsmContext
1566
- }, s = vt();
1567
- return s && typeof s.addOperation == "function" && s.addOperation(
1566
+ }, c = ut();
1567
+ return c && typeof c.addOperation == "function" && c.addOperation(
1568
1568
  {
1569
1569
  type: "transition",
1570
1570
  path: this.parentPath,
@@ -1572,7 +1572,7 @@ class Te {
1572
1572
  beforeValue: o?.currentState,
1573
1573
  afterValue: o?.targetState,
1574
1574
  doctype: i,
1575
- recordId: r,
1575
+ recordId: a,
1576
1576
  reversible: !1,
1577
1577
  // FSM transitions are generally not reversible
1578
1578
  metadata: {
@@ -1583,7 +1583,7 @@ class Te {
1583
1583
  }
1584
1584
  },
1585
1585
  "user"
1586
- ), await n.executeTransitionActions(c);
1586
+ ), await n.executeTransitionActions(u);
1587
1587
  }
1588
1588
  // Private helper methods
1589
1589
  resolvePath(e) {
@@ -1594,22 +1594,22 @@ class Te {
1594
1594
  return this.target;
1595
1595
  const o = this.parsePath(e);
1596
1596
  let n = this.target;
1597
- for (const a of o) {
1597
+ for (const r of o) {
1598
1598
  if (n == null)
1599
1599
  return;
1600
- n = this.getProperty(n, a);
1600
+ n = this.getProperty(n, r);
1601
1601
  }
1602
1602
  return n;
1603
1603
  }
1604
1604
  updateValue(e, o) {
1605
1605
  if (e === "")
1606
1606
  throw new Error("Cannot set value on empty path");
1607
- const n = this.parsePath(e), a = n.pop();
1607
+ const n = this.parsePath(e), r = n.pop();
1608
1608
  let i = this.target;
1609
- for (const r of n)
1610
- if (i = this.getProperty(i, r), i == null)
1609
+ for (const a of n)
1610
+ if (i = this.getProperty(i, a), i == null)
1611
1611
  throw new Error(`Cannot set property on null/undefined path: ${e}`);
1612
- this.setProperty(i, a, o);
1612
+ this.setProperty(i, r, o);
1613
1613
  }
1614
1614
  getProperty(e, o) {
1615
1615
  return this.isImmutable(e) ? e.get(o) : this.isVueReactive(e) ? e[o] : this.isPiniaStore(e) ? e.$state?.[o] ?? e[o] : e[o];
@@ -1625,31 +1625,31 @@ class Te {
1625
1625
  }
1626
1626
  async triggerFieldActions(e, o, n) {
1627
1627
  try {
1628
- if (!e || typeof e != "string")
1628
+ if (!e || typeof e != "string" || Object.is(o, n))
1629
1629
  return;
1630
- const a = e.split(".");
1631
- if (a.length < 3)
1630
+ const r = e.split(".");
1631
+ if (r.length < 3)
1632
1632
  return;
1633
- const i = ft(), r = a.slice(2).join(".") || a[a.length - 1];
1634
- let c = this.doctype;
1635
- this.doctype === "StonecropStore" && a.length >= 1 && (c = a[0]);
1636
- let s;
1637
- a.length >= 2 && (s = a[1]);
1638
- const u = {
1633
+ const i = ct(), a = r.slice(2).join(".") || r[r.length - 1];
1634
+ let u = this.doctype;
1635
+ this.doctype === "StonecropStore" && r.length >= 1 && (u = r[0]);
1636
+ let c;
1637
+ r.length >= 2 && (c = r[1]);
1638
+ const f = {
1639
1639
  path: e,
1640
- fieldname: r,
1640
+ fieldname: a,
1641
1641
  beforeValue: o,
1642
1642
  afterValue: n,
1643
1643
  operation: "set",
1644
- doctype: c,
1645
- recordId: s,
1644
+ doctype: u,
1645
+ recordId: c,
1646
1646
  timestamp: /* @__PURE__ */ new Date(),
1647
1647
  store: this.rootNode || void 0
1648
1648
  // Pass the root store for snapshot/rollback capabilities
1649
1649
  };
1650
- await i.executeFieldTriggers(u);
1651
- } catch (a) {
1652
- a instanceof Error && console.warn("Field trigger error:", a.message);
1650
+ await i.executeFieldTriggers(f);
1651
+ } catch (r) {
1652
+ r instanceof Error && console.warn("Field trigger error:", r.message);
1653
1653
  }
1654
1654
  }
1655
1655
  isVueReactive(e) {
@@ -1661,19 +1661,19 @@ class Te {
1661
1661
  isImmutable(e) {
1662
1662
  if (!e || typeof e != "object")
1663
1663
  return !1;
1664
- const o = "get" in e && typeof e.get == "function", n = "set" in e && typeof e.set == "function", a = "has" in e && typeof e.has == "function", i = "__ownerID" in e || "_map" in e || "_list" in e || "_origin" in e || "_capacity" in e || "_defaultValues" in e || "_tail" in e || "_root" in e || "size" in e && o && n;
1665
- let r;
1664
+ const o = "get" in e && typeof e.get == "function", n = "set" in e && typeof e.set == "function", r = "has" in e && typeof e.has == "function", i = "__ownerID" in e || "_map" in e || "_list" in e || "_origin" in e || "_capacity" in e || "_defaultValues" in e || "_tail" in e || "_root" in e || "size" in e && o && n;
1665
+ let a;
1666
1666
  try {
1667
- const s = e;
1668
- if ("constructor" in s && s.constructor && typeof s.constructor == "object" && "name" in s.constructor) {
1669
- const u = s.constructor.name;
1670
- r = typeof u == "string" ? u : void 0;
1667
+ const c = e;
1668
+ if ("constructor" in c && c.constructor && typeof c.constructor == "object" && "name" in c.constructor) {
1669
+ const f = c.constructor.name;
1670
+ a = typeof f == "string" ? f : void 0;
1671
1671
  }
1672
1672
  } catch {
1673
- r = void 0;
1673
+ a = void 0;
1674
1674
  }
1675
- const c = r && (r.includes("Map") || r.includes("List") || r.includes("Set") || r.includes("Stack") || r.includes("Seq")) && (o || n);
1676
- return !!(o && n && a && i || o && n && c);
1675
+ const u = a && (a.includes("Map") || a.includes("List") || a.includes("Set") || a.includes("Stack") || a.includes("Seq")) && (o || n);
1676
+ return !!(o && n && r && i || o && n && u);
1677
1677
  }
1678
1678
  isPrimitive(e) {
1679
1679
  return e == null || typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "function" || typeof e == "symbol" || typeof e == "bigint";
@@ -1687,10 +1687,10 @@ class Te {
1687
1687
  return e ? e.replace(/\[(\d+)\]/g, ".$1").split(".").filter((o) => o.length > 0) : [];
1688
1688
  }
1689
1689
  }
1690
- function Co(t, e, o) {
1691
- return new Te(t, e, "", null, o);
1690
+ function No(t, e, o) {
1691
+ return new Ie(t, e, "", null, o);
1692
1692
  }
1693
- class Ro {
1693
+ class $o {
1694
1694
  hstStore;
1695
1695
  _operationLogStore;
1696
1696
  _operationLogConfig;
@@ -1718,7 +1718,7 @@ class Ro {
1718
1718
  const e = {};
1719
1719
  Object.keys(this.registry.registry).forEach((o) => {
1720
1720
  e[o] = {};
1721
- }), this.hstStore = Co(wt(e), "StonecropStore");
1721
+ }), this.hstStore = No(mt(e), "StonecropStore");
1722
1722
  }
1723
1723
  /**
1724
1724
  * Setup automatic sync with Registry when doctypes are added
@@ -1745,8 +1745,8 @@ class Ro {
1745
1745
  * @param recordData - The record data
1746
1746
  */
1747
1747
  addRecord(e, o, n) {
1748
- const a = typeof e == "string" ? e : e.slug;
1749
- this.ensureDoctypeExists(a), this.hstStore.set(`${a}.${o}`, n);
1748
+ const r = typeof e == "string" ? e : e.slug;
1749
+ this.ensureDoctypeExists(r), this.hstStore.set(`${r}.${o}`, n);
1750
1750
  }
1751
1751
  /**
1752
1752
  * Get a specific record
@@ -1777,7 +1777,7 @@ class Ro {
1777
1777
  const o = typeof e == "string" ? e : e.slug;
1778
1778
  this.ensureDoctypeExists(o);
1779
1779
  const n = this.hstStore.get(o);
1780
- return !n || typeof n != "object" ? [] : Object.keys(n).filter((a) => n[a] !== void 0);
1780
+ return !n || typeof n != "object" ? [] : Object.keys(n).filter((r) => n[r] !== void 0);
1781
1781
  }
1782
1782
  /**
1783
1783
  * Clear all records for a doctype
@@ -1804,19 +1804,19 @@ class Ro {
1804
1804
  * @param args - Action arguments (typically record IDs)
1805
1805
  */
1806
1806
  runAction(e, o, n) {
1807
- const a = this.registry.registry[e.slug]?.actions?.get(o), i = Array.isArray(n) ? n.filter((u) => typeof u == "string") : void 0, r = this.getOperationLogStore();
1808
- let c = "success", s;
1807
+ const r = this.registry.registry[e.slug]?.actions?.get(o), i = Array.isArray(n) ? n.filter((f) => typeof f == "string") : void 0, a = this.getOperationLogStore();
1808
+ let u = "success", c;
1809
1809
  try {
1810
- a && a.length > 0 && a.forEach((u) => {
1810
+ r && r.length > 0 && r.forEach((f) => {
1811
1811
  try {
1812
- new Function("args", u)(n);
1813
- } catch (f) {
1814
- throw c = "failure", s = f instanceof Error ? f.message : "Unknown error", f;
1812
+ new Function("args", f)(n);
1813
+ } catch (p) {
1814
+ throw u = "failure", c = p instanceof Error ? p.message : "Unknown error", p;
1815
1815
  }
1816
1816
  });
1817
1817
  } catch {
1818
1818
  } finally {
1819
- r.logAction(e.doctype, o, i, c, s);
1819
+ a.logAction(e.doctype, o, i, u, c);
1820
1820
  }
1821
1821
  }
1822
1822
  /**
@@ -1862,14 +1862,14 @@ class Ro {
1862
1862
  return this.hstStore;
1863
1863
  }
1864
1864
  }
1865
- function Ao(t) {
1865
+ function Co(t) {
1866
1866
  t || (t = {});
1867
- const e = t.registry || Se("$registry"), o = Se("$stonecrop"), n = A(), a = A(), i = A({}), r = A(), c = A(), s = A([]);
1867
+ const e = t.registry || be("$registry"), o = be("$stonecrop"), n = C(), r = C(), i = C({}), a = C(), u = C(), c = C([]);
1868
1868
  if (t.doctype && e) {
1869
- const E = t.doctype.schema ? Array.isArray(t.doctype.schema) ? t.doctype.schema : Array.from(t.doctype.schema) : [];
1870
- s.value = e.resolveSchema(E);
1869
+ const w = t.doctype.schema ? Array.isArray(t.doctype.schema) ? t.doctype.schema : Array.from(t.doctype.schema) : [];
1870
+ c.value = e.resolveSchema(w);
1871
1871
  }
1872
- const u = A([]), f = A(-1), h = x(() => n.value?.getOperationLogStore().canUndo ?? !1), b = x(() => n.value?.getOperationLogStore().canRedo ?? !1), O = x(() => n.value?.getOperationLogStore().undoCount ?? 0), $ = x(() => n.value?.getOperationLogStore().redoCount ?? 0), D = x(
1872
+ const f = C([]), p = C(-1), b = I(() => n.value?.getOperationLogStore().canUndo ?? !1), h = I(() => n.value?.getOperationLogStore().canRedo ?? !1), _ = I(() => n.value?.getOperationLogStore().undoCount ?? 0), m = I(() => n.value?.getOperationLogStore().redoCount ?? 0), O = I(
1873
1873
  () => n.value?.getOperationLogStore().undoRedoState ?? {
1874
1874
  canUndo: !1,
1875
1875
  canRedo: !1,
@@ -1877,202 +1877,202 @@ function Ao(t) {
1877
1877
  redoCount: 0,
1878
1878
  currentIndex: -1
1879
1879
  }
1880
- ), V = (E) => n.value?.getOperationLogStore().undo(E) ?? !1, j = (E) => n.value?.getOperationLogStore().redo(E) ?? !1, P = () => {
1880
+ ), R = (w) => n.value?.getOperationLogStore().undo(w) ?? !1, x = (w) => n.value?.getOperationLogStore().redo(w) ?? !1, H = () => {
1881
1881
  n.value?.getOperationLogStore().startBatch();
1882
- }, U = (E) => n.value?.getOperationLogStore().commitBatch(E) ?? null, q = () => {
1882
+ }, U = (w) => n.value?.getOperationLogStore().commitBatch(w) ?? null, K = () => {
1883
1883
  n.value?.getOperationLogStore().cancelBatch();
1884
1884
  }, G = () => {
1885
1885
  n.value?.getOperationLogStore().clear();
1886
- }, z = (E, N) => n.value?.getOperationLogStore().getOperationsFor(E, N) ?? [], _ = () => n.value?.getOperationLogStore().getSnapshot() ?? {
1886
+ }, z = (w, D) => n.value?.getOperationLogStore().getOperationsFor(w, D) ?? [], E = () => n.value?.getOperationLogStore().getSnapshot() ?? {
1887
1887
  operations: [],
1888
1888
  currentIndex: -1,
1889
1889
  totalOperations: 0,
1890
1890
  reversibleOperations: 0,
1891
1891
  irreversibleOperations: 0
1892
- }, te = (E, N) => {
1893
- n.value?.getOperationLogStore().markIrreversible(E, N);
1894
- }, W = (E, N, S, v = "success", p) => n.value?.getOperationLogStore().logAction(E, N, S, v, p) ?? "", g = (E) => {
1895
- n.value?.getOperationLogStore().configure(E);
1892
+ }, Y = (w, D) => {
1893
+ n.value?.getOperationLogStore().markIrreversible(w, D);
1894
+ }, B = (w, D, S, d = "success", s) => n.value?.getOperationLogStore().logAction(w, D, S, d, s) ?? "", v = (w) => {
1895
+ n.value?.getOperationLogStore().configure(w);
1896
1896
  };
1897
- Pe(async () => {
1897
+ Ae(async () => {
1898
1898
  if (e) {
1899
- n.value = o || new Ro(e);
1899
+ n.value = o || new $o(e);
1900
1900
  try {
1901
- const E = n.value.getOperationLogStore(), N = so(E);
1902
- u.value = N.operations.value, f.value = N.currentIndex.value, H(
1903
- () => N.operations.value,
1901
+ const w = n.value.getOperationLogStore(), D = ro(w);
1902
+ f.value = D.operations.value, p.value = D.currentIndex.value, L(
1903
+ () => D.operations.value,
1904
1904
  (S) => {
1905
- u.value = S;
1905
+ f.value = S;
1906
1906
  }
1907
- ), H(
1908
- () => N.currentIndex.value,
1907
+ ), L(
1908
+ () => D.currentIndex.value,
1909
1909
  (S) => {
1910
- f.value = S;
1910
+ p.value = S;
1911
1911
  }
1912
1912
  );
1913
1913
  } catch {
1914
1914
  }
1915
1915
  if (!t.doctype && e.router) {
1916
- const E = e.router.currentRoute.value;
1917
- if (!E.path) return;
1918
- const N = E.path.split("/").filter((v) => v.length > 0), S = N[1]?.toLowerCase();
1919
- if (N.length > 0) {
1920
- const v = {
1921
- path: E.path,
1922
- segments: N
1923
- }, p = await e.getMeta?.(v);
1924
- if (p) {
1925
- if (e.addDoctype(p), n.value.setup(p), r.value = p, c.value = S, a.value = n.value.getStore(), e) {
1926
- const y = p.schema ? Array.isArray(p.schema) ? p.schema : Array.from(p.schema) : [];
1927
- s.value = e.resolveSchema(y);
1916
+ const w = e.router.currentRoute.value;
1917
+ if (!w.path) return;
1918
+ const D = w.path.split("/").filter((d) => d.length > 0), S = D[1]?.toLowerCase();
1919
+ if (D.length > 0) {
1920
+ const d = {
1921
+ path: w.path,
1922
+ segments: D
1923
+ }, s = await e.getMeta?.(d);
1924
+ if (s) {
1925
+ if (e.addDoctype(s), n.value.setup(s), a.value = s, u.value = S, r.value = n.value.getStore(), e) {
1926
+ const l = s.schema ? Array.isArray(s.schema) ? s.schema : Array.from(s.schema) : [];
1927
+ c.value = e.resolveSchema(l);
1928
1928
  }
1929
1929
  if (S && S !== "new") {
1930
- const y = n.value.getRecordById(p, S);
1931
- if (y)
1932
- i.value = y.get("") || {};
1930
+ const l = n.value.getRecordById(s, S);
1931
+ if (l)
1932
+ i.value = l.get("") || {};
1933
1933
  else
1934
1934
  try {
1935
- await n.value.getRecord(p, S);
1936
- const l = n.value.getRecordById(p, S);
1937
- l && (i.value = l.get("") || {});
1935
+ await n.value.getRecord(s, S);
1936
+ const y = n.value.getRecordById(s, S);
1937
+ y && (i.value = y.get("") || {});
1938
1938
  } catch {
1939
- i.value = oe(p);
1939
+ i.value = ee(s);
1940
1940
  }
1941
1941
  } else
1942
- i.value = oe(p);
1943
- a.value && pt(p, S || "new", i, a.value), n.value.runAction(p, "load", S ? [S] : void 0);
1942
+ i.value = ee(s);
1943
+ r.value && dt(s, S || "new", i, r.value), n.value.runAction(s, "load", S ? [S] : void 0);
1944
1944
  }
1945
1945
  }
1946
1946
  }
1947
1947
  if (t.doctype) {
1948
- a.value = n.value.getStore();
1949
- const E = t.doctype, N = t.recordId;
1950
- if (N && N !== "new") {
1951
- const S = n.value.getRecordById(E, N);
1948
+ r.value = n.value.getStore();
1949
+ const w = t.doctype, D = t.recordId;
1950
+ if (D && D !== "new") {
1951
+ const S = n.value.getRecordById(w, D);
1952
1952
  if (S)
1953
1953
  i.value = S.get("") || {};
1954
1954
  else
1955
1955
  try {
1956
- await n.value.getRecord(E, N);
1957
- const v = n.value.getRecordById(E, N);
1958
- v && (i.value = v.get("") || {});
1956
+ await n.value.getRecord(w, D);
1957
+ const d = n.value.getRecordById(w, D);
1958
+ d && (i.value = d.get("") || {});
1959
1959
  } catch {
1960
- i.value = oe(E);
1960
+ i.value = ee(w);
1961
1961
  }
1962
1962
  } else
1963
- i.value = oe(E);
1964
- a.value && pt(E, N || "new", i, a.value);
1963
+ i.value = ee(w);
1964
+ r.value && dt(w, D || "new", i, r.value);
1965
1965
  }
1966
1966
  }
1967
1967
  });
1968
- const m = (E, N) => {
1969
- const S = t.doctype || r.value;
1968
+ const g = (w, D) => {
1969
+ const S = t.doctype || a.value;
1970
1970
  if (!S) return "";
1971
- const v = N || t.recordId || c.value || "new";
1972
- return `${S.slug}.${v}.${E}`;
1973
- }, C = (E) => {
1974
- const N = t.doctype || r.value;
1975
- if (!(!a.value || !n.value || !N))
1971
+ const d = D || t.recordId || u.value || "new";
1972
+ return `${S.slug}.${d}.${w}`;
1973
+ }, $ = (w) => {
1974
+ const D = t.doctype || a.value;
1975
+ if (!(!r.value || !n.value || !D))
1976
1976
  try {
1977
- const S = E.path.split(".");
1977
+ const S = w.path.split(".");
1978
1978
  if (S.length >= 2) {
1979
- const y = S[0], l = S[1];
1980
- if (a.value.has(`${y}.${l}`) || n.value.addRecord(N, l, { ...i.value }), S.length > 3) {
1981
- const d = `${y}.${l}`, w = S.slice(2);
1982
- let R = d;
1983
- for (let K = 0; K < w.length - 1; K++)
1984
- if (R += `.${w[K]}`, !a.value.has(R)) {
1985
- const ee = w[K + 1], J = !isNaN(Number(ee));
1986
- a.value.set(R, J ? [] : {});
1979
+ const l = S[0], y = S[1];
1980
+ if (r.value.has(`${l}.${y}`) || n.value.addRecord(D, y, { ...i.value }), S.length > 3) {
1981
+ const N = `${l}.${y}`, j = S.slice(2);
1982
+ let J = N;
1983
+ for (let W = 0; W < j.length - 1; W++)
1984
+ if (J += `.${j[W]}`, !r.value.has(J)) {
1985
+ const te = j[W + 1], q = !isNaN(Number(te));
1986
+ r.value.set(J, q ? [] : {});
1987
1987
  }
1988
1988
  }
1989
1989
  }
1990
- a.value.set(E.path, E.value);
1991
- const v = E.fieldname.split("."), p = { ...i.value };
1992
- v.length === 1 ? p[v[0]] = E.value : Io(p, v, E.value), i.value = p;
1990
+ r.value.set(w.path, w.value);
1991
+ const d = w.fieldname.split("."), s = { ...i.value };
1992
+ d.length === 1 ? s[d[0]] = w.value : Ro(s, d, w.value), i.value = s;
1993
1993
  } catch {
1994
1994
  }
1995
1995
  };
1996
- (t.doctype || e?.router) && (qe("hstPathProvider", m), qe("hstChangeHandler", C));
1997
- const B = (E, N, S) => {
1996
+ (t.doctype || e?.router) && (Ge("hstPathProvider", g), Ge("hstChangeHandler", $));
1997
+ const M = (w, D, S) => {
1998
1998
  if (!n.value)
1999
- return oe(N);
1999
+ return ee(D);
2000
2000
  if (S)
2001
2001
  try {
2002
- const v = a.value?.get(E);
2003
- return v && typeof v == "object" ? v : oe(N);
2002
+ const d = r.value?.get(w);
2003
+ return d && typeof d == "object" ? d : ee(D);
2004
2004
  } catch {
2005
- return oe(N);
2005
+ return ee(D);
2006
2006
  }
2007
- return oe(N);
2008
- }, k = async (E, N) => {
2009
- if (!a.value || !n.value)
2007
+ return ee(D);
2008
+ }, k = async (w, D) => {
2009
+ if (!r.value || !n.value)
2010
2010
  throw new Error("HST store not initialized");
2011
- const S = `${E.slug}.${N}`, v = { ...a.value.get(S) || {} }, p = E.schema ? Array.isArray(E.schema) ? E.schema : Array.from(E.schema) : [], y = (e ? e.resolveSchema(p) : p).filter(
2012
- (l) => "fieldtype" in l && l.fieldtype === "Doctype" && "schema" in l && Array.isArray(l.schema)
2011
+ const S = `${w.slug}.${D}`, d = { ...r.value.get(S) || {} }, s = w.schema ? Array.isArray(w.schema) ? w.schema : Array.from(w.schema) : [], l = (e ? e.resolveSchema(s) : s).filter(
2012
+ (y) => "fieldtype" in y && y.fieldtype === "Doctype" && "schema" in y && Array.isArray(y.schema)
2013
2013
  );
2014
- for (const l of y) {
2015
- const d = l, w = `${S}.${d.fieldname}`, R = Ct(d.schema, w, a.value);
2016
- v[d.fieldname] = R;
2014
+ for (const y of l) {
2015
+ const N = y, j = `${S}.${N.fieldname}`, J = Ot(N.schema, j, r.value);
2016
+ d[N.fieldname] = J;
2017
2017
  }
2018
- return v;
2019
- }, I = (E, N) => ({
2020
- provideHSTPath: (S) => `${E}.${S}`,
2018
+ return d;
2019
+ }, T = (w, D) => ({
2020
+ provideHSTPath: (S) => `${w}.${S}`,
2021
2021
  handleHSTChange: (S) => {
2022
- const v = S.path.startsWith(E) ? S.path : `${E}.${S.fieldname}`;
2023
- C({
2022
+ const d = S.path.startsWith(w) ? S.path : `${w}.${S.fieldname}`;
2023
+ $({
2024
2024
  ...S,
2025
- path: v
2025
+ path: d
2026
2026
  });
2027
2027
  }
2028
- }), L = {
2029
- operations: u,
2030
- currentIndex: f,
2031
- undoRedoState: D,
2032
- canUndo: h,
2033
- canRedo: b,
2034
- undoCount: O,
2035
- redoCount: $,
2036
- undo: V,
2037
- redo: j,
2038
- startBatch: P,
2028
+ }), F = {
2029
+ operations: f,
2030
+ currentIndex: p,
2031
+ undoRedoState: O,
2032
+ canUndo: b,
2033
+ canRedo: h,
2034
+ undoCount: _,
2035
+ redoCount: m,
2036
+ undo: R,
2037
+ redo: x,
2038
+ startBatch: H,
2039
2039
  commitBatch: U,
2040
- cancelBatch: q,
2040
+ cancelBatch: K,
2041
2041
  clear: G,
2042
2042
  getOperationsFor: z,
2043
- getSnapshot: _,
2044
- markIrreversible: te,
2045
- logAction: W,
2046
- configure: g
2043
+ getSnapshot: E,
2044
+ markIrreversible: Y,
2045
+ logAction: B,
2046
+ configure: v
2047
2047
  };
2048
2048
  return t.doctype ? {
2049
2049
  stonecrop: n,
2050
- operationLog: L,
2051
- provideHSTPath: m,
2052
- handleHSTChange: C,
2053
- hstStore: a,
2050
+ operationLog: F,
2051
+ provideHSTPath: g,
2052
+ handleHSTChange: $,
2053
+ hstStore: r,
2054
2054
  formData: i,
2055
- resolvedSchema: s,
2056
- loadNestedData: B,
2055
+ resolvedSchema: c,
2056
+ loadNestedData: M,
2057
2057
  saveRecursive: k,
2058
- createNestedContext: I
2058
+ createNestedContext: T
2059
2059
  } : !t.doctype && e?.router ? {
2060
2060
  stonecrop: n,
2061
- operationLog: L,
2062
- provideHSTPath: m,
2063
- handleHSTChange: C,
2064
- hstStore: a,
2061
+ operationLog: F,
2062
+ provideHSTPath: g,
2063
+ handleHSTChange: $,
2064
+ hstStore: r,
2065
2065
  formData: i,
2066
- resolvedSchema: s,
2067
- loadNestedData: B,
2066
+ resolvedSchema: c,
2067
+ loadNestedData: M,
2068
2068
  saveRecursive: k,
2069
- createNestedContext: I
2069
+ createNestedContext: T
2070
2070
  } : {
2071
2071
  stonecrop: n,
2072
- operationLog: L
2072
+ operationLog: F
2073
2073
  };
2074
2074
  }
2075
- function oe(t) {
2075
+ function ee(t) {
2076
2076
  const e = {};
2077
2077
  return t.schema && t.schema.forEach((o) => {
2078
2078
  switch ("fieldtype" in o ? o.fieldtype : "Data") {
@@ -2098,15 +2098,15 @@ function oe(t) {
2098
2098
  }
2099
2099
  }), e;
2100
2100
  }
2101
- function pt(t, e, o, n) {
2102
- H(
2101
+ function dt(t, e, o, n) {
2102
+ L(
2103
2103
  o,
2104
- (a) => {
2104
+ (r) => {
2105
2105
  const i = `${t.slug}.${e}`;
2106
- Object.keys(a).forEach((r) => {
2107
- const c = `${i}.${r}`;
2106
+ Object.keys(r).forEach((a) => {
2107
+ const u = `${i}.${a}`;
2108
2108
  try {
2109
- n.set(c, a[r]);
2109
+ n.set(u, r[a]);
2110
2110
  } catch {
2111
2111
  }
2112
2112
  });
@@ -2114,263 +2114,265 @@ function pt(t, e, o, n) {
2114
2114
  { deep: !0 }
2115
2115
  );
2116
2116
  }
2117
- function Io(t, e, o) {
2117
+ function Ro(t, e, o) {
2118
2118
  let n = t;
2119
2119
  for (let i = 0; i < e.length - 1; i++) {
2120
- const r = e[i];
2121
- (!(r in n) || typeof n[r] != "object") && (n[r] = isNaN(Number(e[i + 1])) ? {} : []), n = n[r];
2120
+ const a = e[i];
2121
+ (!(a in n) || typeof n[a] != "object") && (n[a] = isNaN(Number(e[i + 1])) ? {} : []), n = n[a];
2122
2122
  }
2123
- const a = e[e.length - 1];
2124
- n[a] = o;
2123
+ const r = e[e.length - 1];
2124
+ n[r] = o;
2125
2125
  }
2126
- function Ct(t, e, o) {
2127
- const n = { ...o.get(e) || {} }, a = t.filter(
2126
+ function Ot(t, e, o) {
2127
+ const n = { ...o.get(e) || {} }, r = t.filter(
2128
2128
  (i) => "fieldtype" in i && i.fieldtype === "Doctype" && "schema" in i && Array.isArray(i.schema)
2129
2129
  );
2130
- for (const i of a) {
2131
- const r = i, c = `${e}.${r.fieldname}`, s = Ct(r.schema, c, o);
2132
- n[r.fieldname] = s;
2130
+ for (const i of r) {
2131
+ const a = i, u = `${e}.${a.fieldname}`, c = Ot(a.schema, u, o);
2132
+ n[a.fieldname] = c;
2133
2133
  }
2134
2134
  return n;
2135
2135
  }
2136
2136
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
2137
- function xo(t, e) {
2138
- return et() ? (tt(t, e), !0) : !1;
2137
+ function Io(t, e) {
2138
+ return Qe() ? (Xe(t, e), !0) : !1;
2139
2139
  }
2140
2140
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
2141
- const To = () => {
2141
+ const Ao = () => {
2142
2142
  };
2143
- function Po(...t) {
2143
+ function xo(...t) {
2144
2144
  if (t.length !== 1) return re(...t);
2145
2145
  const e = t[0];
2146
- return typeof e == "function" ? je(ot(() => ({
2146
+ return typeof e == "function" ? Te(Ye(() => ({
2147
2147
  get: e,
2148
- set: To
2149
- }))) : A(e);
2148
+ set: Ao
2149
+ }))) : C(e);
2150
2150
  }
2151
- function We(t) {
2151
+ function Le(t) {
2152
2152
  return typeof Window < "u" && t instanceof Window ? t.document.documentElement : typeof Document < "u" && t instanceof Document ? t.documentElement : t;
2153
2153
  }
2154
- const Ue = /* @__PURE__ */ new WeakMap();
2155
- function Vo(t, e = !1) {
2156
- const o = _e(e);
2154
+ const Be = /* @__PURE__ */ new WeakMap();
2155
+ function To(t, e = !1) {
2156
+ const o = Se(e);
2157
2157
  let n = "";
2158
- H(Po(t), (r) => {
2159
- const c = We(Q(r));
2160
- if (c) {
2161
- const s = c;
2162
- if (Ue.get(s) || Ue.set(s, s.style.overflow), s.style.overflow !== "hidden" && (n = s.style.overflow), s.style.overflow === "hidden") return o.value = !0;
2163
- if (o.value) return s.style.overflow = "hidden";
2158
+ L(xo(t), (a) => {
2159
+ const u = Le(Q(a));
2160
+ if (u) {
2161
+ const c = u;
2162
+ if (Be.get(c) || Be.set(c, c.style.overflow), c.style.overflow !== "hidden" && (n = c.style.overflow), c.style.overflow === "hidden") return o.value = !0;
2163
+ if (o.value) return c.style.overflow = "hidden";
2164
2164
  }
2165
2165
  }, { immediate: !0 });
2166
- const a = () => {
2167
- const r = We(Q(t));
2168
- !r || o.value || (r.style.overflow = "hidden", o.value = !0);
2166
+ const r = () => {
2167
+ const a = Le(Q(t));
2168
+ !a || o.value || (a.style.overflow = "hidden", o.value = !0);
2169
2169
  }, i = () => {
2170
- const r = We(Q(t));
2171
- !r || !o.value || (r.style.overflow = n, Ue.delete(r), o.value = !1);
2170
+ const a = Le(Q(t));
2171
+ !a || !o.value || (a.style.overflow = n, Be.delete(a), o.value = !1);
2172
2172
  };
2173
- return xo(i), x({
2173
+ return Io(i), I({
2174
2174
  get() {
2175
2175
  return o.value;
2176
2176
  },
2177
- set(r) {
2178
- r ? a() : i();
2177
+ set(a) {
2178
+ a ? r() : i();
2179
2179
  }
2180
2180
  });
2181
2181
  }
2182
- function jo() {
2182
+ function Po() {
2183
2183
  let t = !1;
2184
- const e = _e(!1);
2184
+ const e = Se(!1);
2185
2185
  return (o, n) => {
2186
2186
  if (e.value = n.value, t) return;
2187
2187
  t = !0;
2188
- const a = Vo(o, n.value);
2189
- H(e, (i) => a.value = i);
2188
+ const r = To(o, n.value);
2189
+ L(e, (i) => r.value = i);
2190
2190
  };
2191
2191
  }
2192
- jo();
2193
- const Mo = (t, e) => {
2192
+ Po();
2193
+ const Vo = (t, e) => {
2194
2194
  const o = t.__vccOpts || t;
2195
- for (const [n, a] of e)
2196
- o[n] = a;
2195
+ for (const [n, r] of e)
2196
+ o[n] = r;
2197
2197
  return o;
2198
2198
  };
2199
- function Fo(t, e) {
2200
- return et() ? (tt(t, e), !0) : !1;
2199
+ function jo(t, e) {
2200
+ return Qe() ? (Xe(t, e), !0) : !1;
2201
2201
  }
2202
2202
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
2203
- const Lo = () => {
2203
+ const Mo = () => {
2204
2204
  };
2205
- function Bo(...t) {
2205
+ function Fo(...t) {
2206
2206
  if (t.length !== 1) return re(...t);
2207
2207
  const e = t[0];
2208
- return typeof e == "function" ? je(ot(() => ({
2208
+ return typeof e == "function" ? Te(Ye(() => ({
2209
2209
  get: e,
2210
- set: Lo
2211
- }))) : A(e);
2210
+ set: Mo
2211
+ }))) : C(e);
2212
2212
  }
2213
- function ze(t) {
2213
+ function We(t) {
2214
2214
  return typeof Window < "u" && t instanceof Window ? t.document.documentElement : typeof Document < "u" && t instanceof Document ? t.documentElement : t;
2215
2215
  }
2216
- const Ke = /* @__PURE__ */ new WeakMap();
2217
- function Ho(t, e = !1) {
2218
- const o = _e(e);
2216
+ const He = /* @__PURE__ */ new WeakMap();
2217
+ function Lo(t, e = !1) {
2218
+ const o = Se(e);
2219
2219
  let n = "";
2220
- H(Bo(t), (r) => {
2221
- const c = ze(Q(r));
2222
- if (c) {
2223
- const s = c;
2224
- if (Ke.get(s) || Ke.set(s, s.style.overflow), s.style.overflow !== "hidden" && (n = s.style.overflow), s.style.overflow === "hidden") return o.value = !0;
2225
- if (o.value) return s.style.overflow = "hidden";
2220
+ L(Fo(t), (a) => {
2221
+ const u = We(Q(a));
2222
+ if (u) {
2223
+ const c = u;
2224
+ if (He.get(c) || He.set(c, c.style.overflow), c.style.overflow !== "hidden" && (n = c.style.overflow), c.style.overflow === "hidden") return o.value = !0;
2225
+ if (o.value) return c.style.overflow = "hidden";
2226
2226
  }
2227
2227
  }, { immediate: !0 });
2228
- const a = () => {
2229
- const r = ze(Q(t));
2230
- !r || o.value || (r.style.overflow = "hidden", o.value = !0);
2228
+ const r = () => {
2229
+ const a = We(Q(t));
2230
+ !a || o.value || (a.style.overflow = "hidden", o.value = !0);
2231
2231
  }, i = () => {
2232
- const r = ze(Q(t));
2233
- !r || !o.value || (r.style.overflow = n, Ke.delete(r), o.value = !1);
2232
+ const a = We(Q(t));
2233
+ !a || !o.value || (a.style.overflow = n, He.delete(a), o.value = !1);
2234
2234
  };
2235
- return Fo(i), x({
2235
+ return jo(i), I({
2236
2236
  get() {
2237
2237
  return o.value;
2238
2238
  },
2239
- set(r) {
2240
- r ? a() : i();
2239
+ set(a) {
2240
+ a ? r() : i();
2241
2241
  }
2242
2242
  });
2243
2243
  }
2244
- function Wo() {
2244
+ function Bo() {
2245
2245
  let t = !1;
2246
- const e = _e(!1);
2246
+ const e = Se(!1);
2247
2247
  return (o, n) => {
2248
2248
  if (e.value = n.value, t) return;
2249
2249
  t = !0;
2250
- const a = Ho(o, n.value);
2251
- H(e, (i) => a.value = i);
2250
+ const r = Lo(o, n.value);
2251
+ L(e, (i) => r.value = i);
2252
2252
  };
2253
2253
  }
2254
- Wo();
2254
+ Bo();
2255
2255
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
2256
- const Uo = { class: "aform" }, zo = {
2256
+ const Wo = { class: "aform" }, Ho = {
2257
2257
  key: 0,
2258
2258
  class: "aform-nested-section"
2259
- }, Ko = {
2259
+ }, Uo = {
2260
2260
  key: 0,
2261
2261
  class: "aform-nested-label"
2262
- }, Go = /* @__PURE__ */ Ee({
2262
+ }, zo = /* @__PURE__ */ we({
2263
2263
  __name: "AForm",
2264
- props: /* @__PURE__ */ rt({
2264
+ props: /* @__PURE__ */ ot({
2265
2265
  schema: {},
2266
- readOnly: { type: Boolean }
2266
+ mode: { default: "edit" }
2267
2267
  }, {
2268
2268
  data: { required: !0 },
2269
2269
  dataModifiers: {}
2270
2270
  }),
2271
- emits: /* @__PURE__ */ rt(["update:schema", "update:data"], ["update:data"]),
2271
+ emits: /* @__PURE__ */ ot(["update:schema", "update:data"], ["update:data"]),
2272
2272
  setup(t, { emit: e }) {
2273
- const o = e, n = Vt(t, "data"), a = A({});
2274
- $e(() => {
2275
- !t.schema || !n.value || t.schema.forEach((s) => {
2276
- "schema" in s && Array.isArray(s.schema) && s.schema.length > 0 && (!a.value[s.fieldname] && n.value[s.fieldname] ? a.value[s.fieldname] = n.value[s.fieldname] : a.value[s.fieldname] || (a.value[s.fieldname] = {}));
2277
- });
2278
- }), $e(() => {
2279
- Object.keys(a.value).forEach((s) => {
2280
- n.value && a.value[s] !== n.value[s] && (n.value[s] = a.value[s], o("update:data", n.value));
2281
- });
2282
- }), $e(() => {
2283
- n.value && t.schema && t.schema.forEach((s) => {
2284
- s.fieldname && n.value[s.fieldname] !== void 0 && (s.value = n.value[s.fieldname]);
2285
- });
2286
- });
2287
- const i = (s) => {
2288
- const u = {};
2289
- for (const [f, h] of Object.entries(s))
2290
- ["component", "fieldtype"].includes(f) || (u[f] = h), f === "rows" && (!h || Array.isArray(h) && h.length === 0) && (u.rows = n.value[s.fieldname] || []);
2291
- return u;
2292
- }, r = A([]);
2293
- $e(() => {
2294
- t.schema && r.value.length !== t.schema.length && (r.value = t.schema.map((s, u) => x({
2273
+ const o = e, n = xt(t, "data"), r = C({});
2274
+ L(
2275
+ () => n.value,
2276
+ (b) => {
2277
+ !t.schema || !b || t.schema.forEach((h) => {
2278
+ "schema" in h && Array.isArray(h.schema) && h.schema.length > 0 && (r.value[h.fieldname] = b[h.fieldname] ?? {});
2279
+ });
2280
+ },
2281
+ { immediate: !0 }
2282
+ );
2283
+ const i = (b, h) => {
2284
+ r.value[b] = h, n.value && (n.value[b] = h, o("update:data", { ...n.value }));
2285
+ }, a = (b) => {
2286
+ const h = {};
2287
+ for (const [_, m] of Object.entries(b))
2288
+ ["component", "fieldtype", "mode"].includes(_) || (h[_] = m), _ === "rows" && (!m || Array.isArray(m) && m.length === 0) && (h.rows = n.value[b.fieldname] || []);
2289
+ return h;
2290
+ }, u = I(() => t.mode ?? "edit");
2291
+ function c(b) {
2292
+ return b.mode || u.value;
2293
+ }
2294
+ const f = C([]);
2295
+ Tt(() => {
2296
+ t.schema && f.value.length !== t.schema.length && (f.value = t.schema.map((b, h) => I({
2295
2297
  get() {
2296
- return s.value;
2298
+ return n.value?.[t.schema[h].fieldname];
2297
2299
  },
2298
- set: (f) => {
2299
- const h = t.schema[u].fieldname;
2300
- t.schema[u].value = f, h && n.value && (n.value[h] = f, o("update:data", n.value)), o("update:schema", t.schema);
2300
+ set: (_) => {
2301
+ const m = t.schema[h].fieldname;
2302
+ m && n.value && (n.value[m] = _, o("update:data", { ...n.value })), o("update:schema", t.schema);
2301
2303
  }
2302
2304
  })));
2303
2305
  });
2304
- const c = x(() => r.value);
2305
- return (s, u) => {
2306
- const f = St("AForm", !0);
2307
- return M(), F("form", Uo, [
2308
- (M(!0), F(fe, null, be(t.schema, (h, b) => (M(), F(fe, { key: b }, [
2309
- "schema" in h && Array.isArray(h.schema) && h.schema.length > 0 ? (M(), F("div", zo, [
2310
- h.label ? (M(), F("h4", Ko, Y(h.label), 1)) : de("", !0),
2311
- ae(f, {
2312
- data: a.value[h.fieldname],
2313
- "onUpdate:data": (O) => a.value[h.fieldname] = O,
2314
- schema: h.schema,
2315
- "read-only": t.readOnly || h.readOnly
2316
- }, null, 8, ["data", "onUpdate:data", "schema", "read-only"])
2317
- ])) : (M(), Ye(jt(h.component), Mt({
2306
+ const p = I(() => f.value);
2307
+ return (b, h) => {
2308
+ const _ = yt("AForm", !0);
2309
+ return P(), V("form", Wo, [
2310
+ (P(!0), V(de, null, me(t.schema, (m, O) => (P(), V(de, { key: O }, [
2311
+ "schema" in m && Array.isArray(m.schema) && m.schema.length > 0 ? (P(), V("div", Ho, [
2312
+ m.label ? (P(), V("h4", Uo, X(m.label), 1)) : ue("", !0),
2313
+ ne(_, {
2314
+ data: r.value[m.fieldname],
2315
+ mode: c(m),
2316
+ schema: m.schema,
2317
+ "onUpdate:data": (R) => i(m.fieldname, R)
2318
+ }, null, 8, ["data", "mode", "schema", "onUpdate:data"])
2319
+ ])) : (P(), Ze(Pt(m.component), Vt({
2318
2320
  key: 1,
2319
- modelValue: c.value[b].value,
2320
- "onUpdate:modelValue": (O) => c.value[b].value = O,
2321
- schema: h,
2322
- data: n.value[h.fieldname],
2323
- "read-only": t.readOnly
2324
- }, { ref_for: !0 }, i(h)), null, 16, ["modelValue", "onUpdate:modelValue", "schema", "data", "read-only"]))
2321
+ modelValue: p.value[O].value,
2322
+ "onUpdate:modelValue": (R) => p.value[O].value = R,
2323
+ schema: m,
2324
+ data: n.value[m.fieldname],
2325
+ mode: c(m)
2326
+ }, { ref_for: !0 }, a(m)), null, 16, ["modelValue", "onUpdate:modelValue", "schema", "data", "mode"]))
2325
2327
  ], 64))), 128))
2326
2328
  ]);
2327
2329
  };
2328
2330
  }
2329
- }), Jo = /* @__PURE__ */ Mo(Go, [["__scopeId", "data-v-06e17c5b"]]), qo = { class: "tabs" }, Zo = { tabindex: "0" }, Qo = { tabindex: "0" }, Xo = /* @__PURE__ */ Ee({
2331
+ }), Go = /* @__PURE__ */ Vo(zo, [["__scopeId", "data-v-5c01cea5"]]), Jo = { class: "tabs" }, Ko = { tabindex: "0" }, qo = { tabindex: "0" }, Zo = /* @__PURE__ */ we({
2330
2332
  __name: "SheetNav",
2331
2333
  props: {
2332
2334
  breadcrumbs: { default: () => [] }
2333
2335
  },
2334
2336
  setup(t) {
2335
- const e = A(!0), o = A(!1), n = A(""), a = ht("searchinput"), i = x(() => e.value ? "unrotated" : "rotated"), r = () => {
2337
+ const e = C(!0), o = C(!1), n = C(""), r = ft("searchinput"), i = I(() => e.value ? "unrotated" : "rotated"), a = () => {
2336
2338
  e.value = !e.value;
2337
- }, c = async () => {
2338
- o.value = !o.value, await se(() => {
2339
- a.value?.focus();
2339
+ }, u = async () => {
2340
+ o.value = !o.value, await ae(() => {
2341
+ r.value?.focus();
2340
2342
  });
2341
- }, s = (h) => {
2342
- h.preventDefault(), h.stopPropagation();
2343
- }, u = async (h) => {
2344
- h.preventDefault(), h.stopPropagation(), await c();
2345
- }, f = () => {
2343
+ }, c = (b) => {
2344
+ b.preventDefault(), b.stopPropagation();
2345
+ }, f = async (b) => {
2346
+ b.preventDefault(), b.stopPropagation(), await u();
2347
+ }, p = () => {
2346
2348
  };
2347
- return (h, b) => {
2348
- const O = St("router-link");
2349
- return M(), F("footer", null, [
2350
- T("ul", qo, [
2351
- T("li", {
2349
+ return (b, h) => {
2350
+ const _ = yt("router-link");
2351
+ return P(), V("footer", null, [
2352
+ A("ul", Jo, [
2353
+ A("li", {
2352
2354
  class: "hidebreadcrumbs",
2353
- onClick: r,
2354
- onKeydown: he(r, ["enter"])
2355
+ onClick: a,
2356
+ onKeydown: pe(a, ["enter"])
2355
2357
  }, [
2356
- T("a", Zo, [
2357
- T("div", {
2358
- class: Ce(i.value)
2358
+ A("a", Ko, [
2359
+ A("div", {
2360
+ class: Oe(i.value)
2359
2361
  }, "×", 2)
2360
2362
  ])
2361
2363
  ], 32),
2362
- T("li", {
2364
+ A("li", {
2363
2365
  class: "hometab",
2364
- style: Fe({ display: e.value ? "block" : "none" }),
2365
- onClick: f,
2366
- onKeydown: he(f, ["enter"])
2366
+ style: Ve({ display: e.value ? "block" : "none" }),
2367
+ onClick: p,
2368
+ onKeydown: pe(p, ["enter"])
2367
2369
  }, [
2368
- ae(O, {
2370
+ ne(_, {
2369
2371
  to: "/",
2370
2372
  tabindex: "0"
2371
2373
  }, {
2372
- default: we(() => [...b[5] || (b[5] = [
2373
- T("svg", {
2374
+ default: ye(() => [...h[5] || (h[5] = [
2375
+ A("svg", {
2374
2376
  class: "icon",
2375
2377
  "aria-label": "Home",
2376
2378
  viewBox: "0 0 24 24",
@@ -2378,19 +2380,19 @@ const Uo = { class: "aform" }, zo = {
2378
2380
  stroke: "currentColor",
2379
2381
  "stroke-width": "2"
2380
2382
  }, [
2381
- T("path", { d: "M3 12l9-9 9 9" }),
2382
- T("path", { d: "M9 21V12h6v9" })
2383
+ A("path", { d: "M3 12l9-9 9 9" }),
2384
+ A("path", { d: "M9 21V12h6v9" })
2383
2385
  ], -1)
2384
2386
  ])]),
2385
2387
  _: 1
2386
2388
  })
2387
2389
  ], 36),
2388
- T("li", {
2389
- class: Ce(["searchtab", { "search-active": o.value }]),
2390
- style: Fe({ display: e.value ? "block" : "none" })
2390
+ A("li", {
2391
+ class: Oe(["searchtab", { "search-active": o.value }]),
2392
+ style: Ve({ display: e.value ? "block" : "none" })
2391
2393
  }, [
2392
- T("a", Qo, [
2393
- Re((M(), F("svg", {
2394
+ A("a", qo, [
2395
+ Ne((P(), V("svg", {
2394
2396
  class: "icon search-icon",
2395
2397
  role: "button",
2396
2398
  "aria-label": "Search",
@@ -2398,47 +2400,47 @@ const Uo = { class: "aform" }, zo = {
2398
2400
  fill: "none",
2399
2401
  stroke: "currentColor",
2400
2402
  "stroke-width": "2",
2401
- onClick: c,
2402
- onKeydown: he(c, ["enter"])
2403
- }, [...b[6] || (b[6] = [
2404
- T("circle", {
2403
+ onClick: u,
2404
+ onKeydown: pe(u, ["enter"])
2405
+ }, [...h[6] || (h[6] = [
2406
+ A("circle", {
2405
2407
  cx: "11",
2406
2408
  cy: "11",
2407
2409
  r: "7"
2408
2410
  }, null, -1),
2409
- T("path", { d: "M21 21l-4.35-4.35" }, null, -1)
2411
+ A("path", { d: "M21 21l-4.35-4.35" }, null, -1)
2410
2412
  ])], 544)), [
2411
- [Ge, !o.value]
2413
+ [Ue, !o.value]
2412
2414
  ]),
2413
- Re(T("input", {
2415
+ Ne(A("input", {
2414
2416
  ref: "searchinput",
2415
- "onUpdate:modelValue": b[0] || (b[0] = ($) => n.value = $),
2417
+ "onUpdate:modelValue": h[0] || (h[0] = (m) => n.value = m),
2416
2418
  type: "text",
2417
2419
  placeholder: "Search...",
2418
- onClick: b[1] || (b[1] = gt(() => {
2420
+ onClick: h[1] || (h[1] = pt(() => {
2419
2421
  }, ["stop"])),
2420
- onInput: b[2] || (b[2] = ($) => s($)),
2421
- onBlur: b[3] || (b[3] = ($) => u($)),
2422
+ onInput: h[2] || (h[2] = (m) => c(m)),
2423
+ onBlur: h[3] || (h[3] = (m) => f(m)),
2422
2424
  onKeydown: [
2423
- b[4] || (b[4] = he(($) => u($), ["enter"])),
2424
- he(c, ["escape"])
2425
+ h[4] || (h[4] = pe((m) => f(m), ["enter"])),
2426
+ pe(u, ["escape"])
2425
2427
  ]
2426
2428
  }, null, 544), [
2427
- [Ge, o.value],
2428
- [mt, n.value]
2429
+ [Ue, o.value],
2430
+ [ht, n.value]
2429
2431
  ])
2430
2432
  ])
2431
2433
  ], 6),
2432
- (M(!0), F(fe, null, be(t.breadcrumbs, ($) => (M(), F("li", {
2433
- key: $.title,
2434
- style: Fe({ display: e.value ? "block" : "none" })
2434
+ (P(!0), V(de, null, me(t.breadcrumbs, (m) => (P(), V("li", {
2435
+ key: m.title,
2436
+ style: Ve({ display: e.value ? "block" : "none" })
2435
2437
  }, [
2436
- ae(O, {
2438
+ ne(_, {
2437
2439
  tabindex: "0",
2438
- to: $.to
2440
+ to: m.to
2439
2441
  }, {
2440
- default: we(() => [
2441
- Ae(Y($.title), 1)
2442
+ default: ye(() => [
2443
+ $e(X(m.title), 1)
2442
2444
  ]),
2443
2445
  _: 2
2444
2446
  }, 1032, ["to"])
@@ -2447,107 +2449,107 @@ const Uo = { class: "aform" }, zo = {
2447
2449
  ]);
2448
2450
  };
2449
2451
  }
2450
- }), Rt = /* @__PURE__ */ Et(Xo, [["__scopeId", "data-v-eb5bcbb6"]]), Yo = {
2452
+ }), Nt = /* @__PURE__ */ bt(Zo, [["__scopeId", "data-v-eb5bcbb6"]]), Qo = {
2451
2453
  key: 1,
2452
2454
  class: "loading"
2453
- }, en = {
2455
+ }, Xo = {
2454
2456
  key: 2,
2455
2457
  class: "loading"
2456
- }, tn = /* @__PURE__ */ Ee({
2458
+ }, Yo = /* @__PURE__ */ we({
2457
2459
  __name: "Desktop",
2458
2460
  props: {
2459
2461
  availableDoctypes: { default: () => [] }
2460
2462
  },
2461
2463
  setup(t) {
2462
- const { stonecrop: e } = Ao(), o = A(!1), n = A(!1), a = A(!1), i = x({
2464
+ const { stonecrop: e } = Co(), o = C(!1), n = C(!1), r = C(!1), i = I({
2463
2465
  get() {
2464
- if (!e.value || !s.value || !f.value)
2466
+ if (!e.value || !c.value || !p.value)
2465
2467
  return {};
2466
2468
  try {
2467
- return e.value.getRecordById(s.value, f.value)?.get("") || {};
2469
+ return { ...e.value.getRecordById(c.value, p.value)?.get("") || {} };
2468
2470
  } catch {
2469
2471
  return {};
2470
2472
  }
2471
2473
  },
2472
- set(l) {
2473
- if (!(!e.value || !s.value || !f.value))
2474
+ set(s) {
2475
+ if (!(!e.value || !c.value || !p.value))
2474
2476
  try {
2475
- const d = e.value.getStore();
2476
- for (const [w, R] of Object.entries(l)) {
2477
- const K = `${s.value}.${f.value}.${w}`;
2478
- d.set(K, R);
2477
+ const l = e.value.getStore();
2478
+ for (const [y, N] of Object.entries(s)) {
2479
+ const j = `${c.value}.${p.value}.${y}`;
2480
+ (l.has(j) ? l.get(j) : void 0) !== N && l.set(j, N);
2479
2481
  }
2480
- } catch (d) {
2481
- console.warn("HST update failed:", d);
2482
+ } catch (l) {
2483
+ console.warn("HST update failed:", l);
2482
2484
  }
2483
2485
  }
2484
- }), r = x(() => De(e.value?.registry.router?.currentRoute)), c = x(() => e.value?.registry.router), s = x(() => {
2485
- if (!r.value) return "";
2486
- if (r.value.meta?.actualDoctype)
2487
- return r.value.meta.actualDoctype;
2488
- if (r.value.params.doctype)
2489
- return r.value.params.doctype;
2490
- const l = r.value.params.pathMatch;
2491
- return l && l.length > 0 ? l[0] : "";
2492
- }), u = x(() => {
2493
- if (!r.value) return "";
2494
- if (r.value.meta?.doctype)
2495
- return r.value.meta.doctype;
2496
- if (r.value.params.doctype)
2497
- return r.value.params.doctype;
2498
- const l = r.value.params.pathMatch;
2499
- return l && l.length > 0 ? l[0] : "";
2500
- }), f = x(() => {
2501
- if (!r.value) return "";
2502
- if (r.value.params.recordId)
2503
- return r.value.params.recordId;
2504
- const l = r.value.params.pathMatch;
2505
- return l && l.length > 1 ? l[1] : "";
2506
- }), h = x(() => f.value?.startsWith("new-")), b = x(() => {
2507
- if (!r.value || r.value.name === "home" || r.value.path === "/")
2486
+ }), a = I(() => De(e.value?.registry.router?.currentRoute)), u = I(() => e.value?.registry.router), c = I(() => {
2487
+ if (!a.value) return "";
2488
+ if (a.value.meta?.actualDoctype)
2489
+ return a.value.meta.actualDoctype;
2490
+ if (a.value.params.doctype)
2491
+ return a.value.params.doctype;
2492
+ const s = a.value.params.pathMatch;
2493
+ return s && s.length > 0 ? s[0] : "";
2494
+ }), f = I(() => {
2495
+ if (!a.value) return "";
2496
+ if (a.value.meta?.doctype)
2497
+ return a.value.meta.doctype;
2498
+ if (a.value.params.doctype)
2499
+ return a.value.params.doctype;
2500
+ const s = a.value.params.pathMatch;
2501
+ return s && s.length > 0 ? s[0] : "";
2502
+ }), p = I(() => {
2503
+ if (!a.value) return "";
2504
+ if (a.value.params.recordId)
2505
+ return a.value.params.recordId;
2506
+ const s = a.value.params.pathMatch;
2507
+ return s && s.length > 1 ? s[1] : "";
2508
+ }), b = I(() => p.value?.startsWith("new-")), h = I(() => {
2509
+ if (!a.value || a.value.name === "home" || a.value.path === "/")
2508
2510
  return "doctypes";
2509
- if (r.value.name && r.value.name !== "catch-all") {
2510
- const d = r.value.name;
2511
- if (d.includes("form") || r.value.params.recordId)
2511
+ if (a.value.name && a.value.name !== "catch-all") {
2512
+ const l = a.value.name;
2513
+ if (l.includes("form") || a.value.params.recordId)
2512
2514
  return "record";
2513
- if (d.includes("list") || r.value.params.doctype)
2515
+ if (l.includes("list") || a.value.params.doctype)
2514
2516
  return "records";
2515
2517
  }
2516
- const l = r.value.params.pathMatch;
2517
- return l && l.length > 0 ? l.length === 1 ? "records" : "record" : "doctypes";
2518
- }), O = () => {
2519
- if (!e.value || !s.value || !f.value)
2518
+ const s = a.value.params.pathMatch;
2519
+ return s && s.length > 0 ? s.length === 1 ? "records" : "record" : "doctypes";
2520
+ }), _ = () => {
2521
+ if (!e.value || !c.value || !p.value)
2520
2522
  return [];
2521
2523
  try {
2522
- const d = e.value.registry.registry[s.value];
2523
- if (!d?.workflow?.states)
2524
+ const l = e.value.registry.registry[c.value];
2525
+ if (!l?.workflow?.states)
2524
2526
  return [];
2525
- const w = h.value ? "creating" : "editing", R = d.workflow.states[w];
2526
- return R?.on ? Object.keys(R.on).map((J) => {
2527
- const pe = R.on?.[J], X = typeof pe == "string" ? pe : "unknown", At = async () => {
2528
- const nt = e.value?.getRecordById(s.value, f.value);
2529
- if (nt) {
2530
- const It = i.value || {};
2531
- await nt.triggerTransition(J, {
2532
- currentState: w,
2533
- targetState: X,
2534
- fsmContext: It
2527
+ const y = b.value ? "creating" : "editing", N = l.workflow.states[y];
2528
+ return N?.on ? Object.keys(N.on).map((W) => {
2529
+ const te = N.on?.[W], q = typeof te == "string" ? te : "unknown", $t = async () => {
2530
+ const et = e.value?.getRecordById(c.value, p.value);
2531
+ if (et) {
2532
+ const Ct = i.value || {};
2533
+ await et.triggerTransition(W, {
2534
+ currentState: y,
2535
+ targetState: q,
2536
+ fsmContext: Ct
2535
2537
  });
2536
2538
  }
2537
2539
  };
2538
2540
  return {
2539
- label: `${J} (→ ${X})`,
2540
- action: At
2541
+ label: `${W} (→ ${q})`,
2542
+ action: $t
2541
2543
  };
2542
2544
  }) : [];
2543
- } catch (l) {
2544
- return console.warn("Error getting available transitions:", l), [];
2545
+ } catch (s) {
2546
+ return console.warn("Error getting available transitions:", s), [];
2545
2547
  }
2546
- }, $ = x(() => {
2547
- const l = [];
2548
- switch (b.value) {
2548
+ }, m = I(() => {
2549
+ const s = [];
2550
+ switch (h.value) {
2549
2551
  case "doctypes":
2550
- l.push({
2552
+ s.push({
2551
2553
  type: "button",
2552
2554
  label: "Refresh",
2553
2555
  action: () => {
@@ -2556,7 +2558,7 @@ const Uo = { class: "aform" }, zo = {
2556
2558
  });
2557
2559
  break;
2558
2560
  case "records":
2559
- l.push(
2561
+ s.push(
2560
2562
  {
2561
2563
  type: "button",
2562
2564
  label: "New Record",
@@ -2574,98 +2576,89 @@ const Uo = { class: "aform" }, zo = {
2574
2576
  );
2575
2577
  break;
2576
2578
  case "record": {
2577
- const d = O();
2578
- d.length > 0 && l.push({
2579
+ const l = _();
2580
+ l.length > 0 && s.push({
2579
2581
  type: "dropdown",
2580
2582
  label: "Actions",
2581
- actions: d
2583
+ actions: l
2582
2584
  });
2583
2585
  break;
2584
2586
  }
2585
2587
  }
2586
- return l;
2587
- }), D = x(() => {
2588
- const l = [];
2589
- return b.value === "records" && u.value ? l.push(
2588
+ return s;
2589
+ }), O = I(() => {
2590
+ const s = [];
2591
+ return h.value === "records" && f.value ? s.push(
2590
2592
  { title: "Home", to: "/" },
2591
- { title: P(u.value), to: `/${u.value}` }
2592
- ) : b.value === "record" && u.value && l.push(
2593
+ { title: H(f.value), to: `/${f.value}` }
2594
+ ) : h.value === "record" && f.value && s.push(
2593
2595
  { title: "Home", to: "/" },
2594
- { title: P(u.value), to: `/${u.value}` },
2595
- { title: h.value ? "New Record" : "Edit Record", to: r.value?.fullPath || "" }
2596
- ), l;
2597
- }), V = (l) => {
2598
- const d = [
2596
+ { title: H(f.value), to: `/${f.value}` },
2597
+ { title: b.value ? "New Record" : "Edit Record", to: a.value?.fullPath || "" }
2598
+ ), s;
2599
+ }), R = (s) => {
2600
+ const l = [
2599
2601
  {
2600
2602
  title: "Go Home",
2601
2603
  description: "Navigate to the home page",
2602
2604
  action: () => {
2603
- c.value?.push("/");
2605
+ u.value?.push("/");
2604
2606
  }
2605
2607
  },
2606
2608
  {
2607
2609
  title: "Toggle Command Palette",
2608
2610
  description: "Open/close the command palette",
2609
- action: () => a.value = !a.value
2611
+ action: () => r.value = !r.value
2610
2612
  }
2611
2613
  ];
2612
- return u.value && (d.push({
2613
- title: `View ${P(u.value)} Records`,
2614
- description: `Navigate to ${u.value} list`,
2614
+ return f.value && (l.push({
2615
+ title: `View ${H(f.value)} Records`,
2616
+ description: `Navigate to ${f.value} list`,
2615
2617
  action: () => {
2616
- c.value?.push(`/${u.value}`);
2618
+ u.value?.push(`/${f.value}`);
2617
2619
  }
2618
- }), d.push({
2619
- title: `Create New ${P(u.value)}`,
2620
- description: `Create a new ${u.value} record`,
2620
+ }), l.push({
2621
+ title: `Create New ${H(f.value)}`,
2622
+ description: `Create a new ${f.value} record`,
2621
2623
  action: () => {
2622
2624
  z();
2623
2625
  }
2624
- })), t.availableDoctypes.forEach((w) => {
2625
- d.push({
2626
- title: `View ${P(w)}`,
2627
- description: `Navigate to ${w} list`,
2626
+ })), t.availableDoctypes.forEach((y) => {
2627
+ l.push({
2628
+ title: `View ${H(y)}`,
2629
+ description: `Navigate to ${y} list`,
2628
2630
  action: () => {
2629
- c.value?.push(`/${w}`);
2631
+ u.value?.push(`/${y}`);
2630
2632
  }
2631
2633
  });
2632
- }), l ? d.filter(
2633
- (w) => w.title.toLowerCase().includes(l.toLowerCase()) || w.description.toLowerCase().includes(l.toLowerCase())
2634
- ) : d;
2635
- }, j = (l) => {
2636
- l.action(), a.value = !1;
2637
- }, P = (l) => l.split("-").map((d) => d.charAt(0).toUpperCase() + d.slice(1)).join(" "), U = (l) => e.value ? e.value.getRecordIds(l).length : 0, q = async (l) => {
2638
- await c.value?.push(`/${l}`);
2639
- }, G = async (l) => {
2640
- await c.value?.push(`/${u.value}/${l}`);
2634
+ }), s ? l.filter(
2635
+ (y) => y.title.toLowerCase().includes(s.toLowerCase()) || y.description.toLowerCase().includes(s.toLowerCase())
2636
+ ) : l;
2637
+ }, x = (s) => {
2638
+ s.action(), r.value = !1;
2639
+ }, H = (s) => s.split("-").map((l) => l.charAt(0).toUpperCase() + l.slice(1)).join(" "), U = (s) => e.value ? e.value.getRecordIds(s).length : 0, K = async (s) => {
2640
+ await u.value?.push(`/${s}`);
2641
+ }, G = async (s) => {
2642
+ await u.value?.push(`/${f.value}/${s}`);
2641
2643
  }, z = async () => {
2642
- const l = `new-${Date.now()}`;
2643
- await c.value?.push(`/${u.value}/${l}`);
2644
- }, _ = (l) => {
2644
+ const s = `new-${Date.now()}`;
2645
+ await u.value?.push(`/${f.value}/${s}`);
2646
+ }, E = (s) => {
2645
2647
  if (e.value)
2646
2648
  try {
2647
- e.value.records(l);
2649
+ e.value.records(s);
2648
2650
  } catch {
2649
2651
  }
2650
- }, te = () => {
2652
+ }, Y = () => {
2651
2653
  if (!t.availableDoctypes.length) return [];
2652
- const l = t.availableDoctypes.map((d) => ({
2653
- id: d,
2654
- doctype: d,
2655
- display_name: P(d),
2656
- record_count: U(d),
2654
+ const s = t.availableDoctypes.map((l) => ({
2655
+ id: l,
2656
+ doctype: l,
2657
+ display_name: H(l),
2658
+ record_count: U(l),
2657
2659
  actions: "View Records"
2658
2660
  }));
2659
2661
  return [
2660
- {
2661
- fieldname: "header",
2662
- component: "div",
2663
- value: `
2664
- <div class="view-header">
2665
- <h1>Available Doctypes</h1>
2666
- </div>
2667
- `
2668
- },
2669
2662
  {
2670
2663
  fieldname: "doctypes_table",
2671
2664
  component: "ATable",
@@ -2707,279 +2700,110 @@ const Uo = { class: "aform" }, zo = {
2707
2700
  view: "list",
2708
2701
  fullWidth: !0
2709
2702
  },
2710
- rows: l
2703
+ rows: s
2711
2704
  }
2712
2705
  ];
2713
- }, W = () => {
2714
- if (!s.value) return [];
2706
+ }, B = () => {
2707
+ if (!c.value) return [];
2715
2708
  if (!e.value) return [];
2716
- const l = m(), d = C();
2717
- if (d.length === 0)
2718
- return [
2719
- {
2720
- fieldname: "header",
2721
- component: "div",
2722
- value: `
2723
- <div class="view-header">
2724
- <nav class="breadcrumbs">
2725
- <a href="/">Home</a>
2726
- <span class="separator">/</span>
2727
- <span class="current">${P(u.value || s.value)}</span>
2728
- </nav>
2729
- <h1>${P(u.value || s.value)} Records</h1>
2730
- </div>
2731
- `
2732
- },
2733
- {
2734
- fieldname: "loading",
2735
- component: "div",
2736
- value: `
2737
- <div class="loading-state">
2738
- <p>Loading ${P(u.value || s.value)} schema...</p>
2739
- </div>
2740
- `
2741
- }
2742
- ];
2743
- const w = l.map((R) => ({
2744
- ...R,
2709
+ const s = g(), l = $();
2710
+ if (l.length === 0)
2711
+ return [];
2712
+ const y = s.map((N) => ({
2713
+ ...N,
2745
2714
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
2746
- id: R.id || "",
2715
+ id: N.id || "",
2747
2716
  actions: "Edit | Delete"
2748
2717
  }));
2749
2718
  return [
2750
2719
  {
2751
- fieldname: "header",
2752
- component: "div",
2753
- value: `
2754
- <div class="view-header">
2755
- <nav class="breadcrumbs">
2756
- <a href="/">Home</a>
2757
- <span class="separator">/</span>
2758
- <span class="current">${P(u.value || s.value)}</span>
2759
- </nav>
2760
- <h1>${P(u.value || s.value)} Records</h1>
2761
- </div>
2762
- `
2763
- },
2764
- {
2765
- fieldname: "actions",
2766
- component: "div",
2767
- value: `
2768
- <div class="view-actions">
2769
- <button class="btn-primary" data-action="create">
2770
- New ${P(u.value || s.value)}
2771
- </button>
2772
- </div>
2773
- `
2774
- },
2775
- ...l.length === 0 ? [
2776
- {
2777
- fieldname: "empty_state",
2778
- component: "div",
2779
- value: `
2780
- <div class="empty-state">
2781
- <p>No ${u.value || s.value} records found.</p>
2782
- <button class="btn-primary" data-action="create">
2783
- Create First Record
2784
- </button>
2785
- </div>
2786
- `
2787
- }
2788
- ] : [
2789
- {
2790
- fieldname: "records_table",
2791
- component: "ATable",
2792
- columns: [
2793
- ...d.map((R) => ({
2794
- label: R.label,
2795
- name: R.fieldname,
2796
- fieldtype: R.fieldtype,
2797
- align: "left",
2798
- edit: !1,
2799
- width: "20ch"
2800
- })),
2801
- {
2802
- label: "Actions",
2803
- name: "actions",
2804
- fieldtype: "Data",
2805
- align: "center",
2806
- edit: !1,
2807
- width: "20ch"
2808
- }
2809
- ],
2810
- config: {
2811
- view: "list",
2812
- fullWidth: !0
2813
- },
2814
- rows: w
2815
- }
2816
- ]
2817
- ];
2818
- }, g = () => {
2819
- if (!s.value) return [];
2820
- if (!e.value) return [];
2821
- try {
2822
- const d = e.value?.registry?.registry[s.value];
2823
- if (!d?.schema)
2824
- return [
2825
- {
2826
- fieldname: "header",
2827
- component: "div",
2828
- value: `
2829
- <div class="view-header">
2830
- <nav class="breadcrumbs">
2831
- <a href="/">Home</a>
2832
- <span class="separator">/</span>
2833
- <a href="/${u.value || s.value}">${P(
2834
- u.value || s.value
2835
- )}</a>
2836
- <span class="separator">/</span>
2837
- <span class="current">${h.value ? "New Record" : f.value}</span>
2838
- </nav>
2839
- <h1>${h.value ? `New ${P(u.value || s.value)}` : `Edit ${P(u.value || s.value)}`}</h1>
2840
- </div>
2841
- `
2842
- },
2720
+ fieldname: "records_table",
2721
+ component: "ATable",
2722
+ columns: [
2723
+ ...l.map((N) => ({
2724
+ label: N.label,
2725
+ name: N.fieldname,
2726
+ fieldtype: N.fieldtype,
2727
+ align: "left",
2728
+ edit: !1,
2729
+ width: "20ch"
2730
+ })),
2843
2731
  {
2844
- fieldname: "loading",
2845
- component: "div",
2846
- value: `
2847
- <div class="loading-state">
2848
- <p>Loading ${P(u.value || s.value)} form...</p>
2849
- </div>
2850
- `
2732
+ label: "Actions",
2733
+ name: "actions",
2734
+ fieldtype: "Data",
2735
+ align: "center",
2736
+ edit: !1,
2737
+ width: "20ch"
2851
2738
  }
2852
- ];
2853
- const w = "toArray" in d.schema ? d.schema.toArray() : d.schema, R = B();
2854
- return [
2855
- {
2856
- fieldname: "header",
2857
- component: "div",
2858
- value: `
2859
- <div class="view-header">
2860
- <nav class="breadcrumbs">
2861
- <a href="/">Home</a>
2862
- <span class="separator">/</span>
2863
- <a href="/${u.value || s.value}">${P(
2864
- u.value || s.value
2865
- )}</a>
2866
- <span class="separator">/</span>
2867
- <span class="current">${h.value ? "New Record" : f.value}</span>
2868
- </nav>
2869
- <h1>
2870
- ${h.value ? `New ${P(u.value || s.value)}` : `Edit ${P(u.value || s.value)}`}
2871
- </h1>
2872
- </div>
2873
- `
2874
- },
2875
- {
2876
- fieldname: "actions",
2877
- component: "div",
2878
- value: `
2879
- <div class="view-actions">
2880
- <button class="btn-primary" data-action="save" ${n.value ? "disabled" : ""}>
2881
- ${n.value ? "Saving..." : "Save"}
2882
- </button>
2883
- <button class="btn-secondary" data-action="cancel">Cancel</button>
2884
- ${h.value ? "" : '<button class="btn-danger" data-action="delete">Delete</button>'}
2885
- </div>
2886
- `
2739
+ ],
2740
+ config: {
2741
+ view: "list",
2742
+ fullWidth: !0
2887
2743
  },
2888
- ...w.map((K) => ({
2889
- ...K,
2890
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
2891
- value: R[K.fieldname] || ""
2892
- }))
2893
- ];
2744
+ rows: y
2745
+ }
2746
+ ];
2747
+ }, v = () => {
2748
+ if (!c.value) return [];
2749
+ if (!e.value) return [];
2750
+ try {
2751
+ const l = e.value?.registry?.registry[c.value];
2752
+ return l?.schema ? "toArray" in l.schema ? l.schema.toArray() : l.schema : [];
2894
2753
  } catch {
2895
- return [
2896
- {
2897
- fieldname: "error",
2898
- component: "div",
2899
- value: `
2900
- <div class="error-state">
2901
- <p>Unable to load form schema for ${P(u.value || s.value)}</p>
2902
- </div>
2903
- `
2904
- }
2905
- ];
2754
+ return [];
2906
2755
  }
2907
- }, m = () => {
2908
- if (!e.value || !s.value)
2756
+ }, g = () => {
2757
+ if (!e.value || !c.value)
2909
2758
  return [];
2910
- const d = e.value.records(s.value)?.get("");
2911
- return d && typeof d == "object" && !Array.isArray(d) ? Object.values(d) : [];
2912
- }, C = () => {
2913
- if (!e.value || !s.value) return [];
2759
+ const l = e.value.records(c.value)?.get("");
2760
+ return l && typeof l == "object" && !Array.isArray(l) ? Object.values(l) : [];
2761
+ }, $ = () => {
2762
+ if (!e.value || !c.value) return [];
2914
2763
  try {
2915
- const d = e.value.registry.registry[s.value];
2916
- if (d?.schema)
2917
- return ("toArray" in d.schema ? d.schema.toArray() : d.schema).map((R) => ({
2918
- fieldname: R.fieldname,
2919
- label: "label" in R && R.label || R.fieldname,
2920
- fieldtype: "fieldtype" in R && R.fieldtype || "Data"
2764
+ const l = e.value.registry.registry[c.value];
2765
+ if (l?.schema)
2766
+ return ("toArray" in l.schema ? l.schema.toArray() : l.schema).map((N) => ({
2767
+ fieldname: N.fieldname,
2768
+ label: "label" in N && N.label || N.fieldname,
2769
+ fieldtype: "fieldtype" in N && N.fieldtype || "Data"
2921
2770
  }));
2922
2771
  } catch {
2923
2772
  }
2924
2773
  return [];
2925
- }, B = () => !e.value || !s.value || h.value ? {} : e.value.getRecordById(s.value, f.value)?.get("") || {}, k = x(() => {
2926
- switch (b.value) {
2774
+ }, M = I(() => {
2775
+ switch (h.value) {
2927
2776
  case "doctypes":
2928
- return te();
2777
+ return Y();
2929
2778
  case "records":
2930
- return W();
2779
+ return B();
2931
2780
  case "record":
2932
- return g();
2781
+ return v();
2933
2782
  default:
2934
2783
  return [];
2935
2784
  }
2936
- }), I = A([]);
2937
- H(
2938
- k,
2939
- (l) => {
2940
- I.value = [...l];
2941
- },
2942
- { immediate: !0, deep: !0 }
2943
- ), H(
2944
- I,
2945
- (l) => {
2946
- if (!(!e.value || !s.value || !f.value || h.value))
2947
- try {
2948
- const d = e.value.getStore();
2949
- l.forEach((w) => {
2950
- if (w.fieldname && "value" in w && !["header", "actions", "loading", "error"].includes(w.fieldname)) {
2951
- const R = `${s.value}.${f.value}.${w.fieldname}`;
2952
- (d.has(R) ? d.get(R) : void 0) !== w.value && d.set(R, w.value);
2953
- }
2954
- });
2955
- } catch (d) {
2956
- console.warn("HST schema sync failed:", d);
2957
- }
2958
- },
2959
- { deep: !0 }
2960
- );
2961
- const L = async () => {
2785
+ }), k = async () => {
2962
2786
  if (e.value) {
2963
2787
  n.value = !0;
2964
2788
  try {
2965
- const l = i.value || {};
2966
- if (h.value) {
2967
- const d = `record-${Date.now()}`, w = { id: d, ...l };
2968
- e.value.addRecord(s.value, d, w);
2969
- const R = e.value.getRecordById(s.value, d);
2970
- R && await R.triggerTransition("SAVE", {
2789
+ const s = i.value || {};
2790
+ if (b.value) {
2791
+ const l = `record-${Date.now()}`, y = { id: l, ...s };
2792
+ e.value.addRecord(c.value, l, y);
2793
+ const N = e.value.getRecordById(c.value, l);
2794
+ N && await N.triggerTransition("SAVE", {
2971
2795
  currentState: "creating",
2972
2796
  targetState: "saved",
2973
- fsmContext: w
2974
- }), await c.value?.replace(`/${u.value}/${d}`);
2797
+ fsmContext: y
2798
+ }), await u.value?.replace(`/${f.value}/${l}`);
2975
2799
  } else {
2976
- const d = { id: f.value, ...l };
2977
- e.value.addRecord(s.value, f.value, d);
2978
- const w = e.value.getRecordById(s.value, f.value);
2979
- w && await w.triggerTransition("SAVE", {
2800
+ const l = { id: p.value, ...s };
2801
+ e.value.addRecord(c.value, p.value, l);
2802
+ const y = e.value.getRecordById(c.value, p.value);
2803
+ y && await y.triggerTransition("SAVE", {
2980
2804
  currentState: "editing",
2981
2805
  targetState: "saved",
2982
- fsmContext: d
2806
+ fsmContext: l
2983
2807
  });
2984
2808
  }
2985
2809
  } catch {
@@ -2987,165 +2811,165 @@ const Uo = { class: "aform" }, zo = {
2987
2811
  n.value = !1;
2988
2812
  }
2989
2813
  }
2990
- }, E = async () => {
2991
- if (h.value)
2992
- await c.value?.push(`/${u.value}`);
2814
+ }, T = async () => {
2815
+ if (b.value)
2816
+ await u.value?.push(`/${f.value}`);
2993
2817
  else {
2994
2818
  if (e.value) {
2995
- const l = e.value.getRecordById(s.value, f.value);
2996
- l && await l.triggerTransition("CANCEL", {
2819
+ const s = e.value.getRecordById(c.value, p.value);
2820
+ s && await s.triggerTransition("CANCEL", {
2997
2821
  currentState: "editing",
2998
2822
  targetState: "cancelled"
2999
2823
  });
3000
2824
  }
3001
- p();
2825
+ S();
3002
2826
  }
3003
- }, N = (l, d) => {
3004
- d && d();
3005
- }, S = async (l) => {
2827
+ }, F = (s, l) => {
2828
+ l && l();
2829
+ }, w = async (s) => {
3006
2830
  if (!e.value) return;
3007
- const d = l || f.value;
3008
- if (d && confirm("Are you sure you want to delete this record?")) {
3009
- const w = e.value.getRecordById(s.value, d);
3010
- w && await w.triggerTransition("DELETE", {
2831
+ const l = s || p.value;
2832
+ if (l && confirm("Are you sure you want to delete this record?")) {
2833
+ const y = e.value.getRecordById(c.value, l);
2834
+ y && await y.triggerTransition("DELETE", {
3011
2835
  currentState: "editing",
3012
2836
  targetState: "deleted"
3013
- }), e.value.removeRecord(s.value, d), b.value === "record" && await c.value?.push(`/${u.value}`);
2837
+ }), e.value.removeRecord(c.value, l), h.value === "record" && await u.value?.push(`/${f.value}`);
3014
2838
  }
3015
- }, v = async (l) => {
3016
- const d = l.target, w = d.getAttribute("data-action");
3017
- if (w)
3018
- switch (w) {
2839
+ }, D = async (s) => {
2840
+ const l = s.target, y = l.getAttribute("data-action");
2841
+ if (y)
2842
+ switch (y) {
3019
2843
  case "create":
3020
2844
  await z();
3021
2845
  break;
3022
2846
  case "save":
3023
- await L();
2847
+ await k();
3024
2848
  break;
3025
2849
  case "cancel":
3026
- await E();
2850
+ await T();
3027
2851
  break;
3028
2852
  case "delete":
3029
- await S();
2853
+ await w();
3030
2854
  break;
3031
2855
  }
3032
- const R = d.closest("td, th");
3033
- if (R) {
3034
- const K = R.textContent?.trim(), ee = R.closest("tr");
3035
- if (K === "View Records" && ee) {
3036
- const J = ee.querySelectorAll("td");
3037
- if (J.length > 0) {
3038
- const X = J[1].textContent?.trim();
3039
- X && await q(X);
2856
+ const N = l.closest("td, th");
2857
+ if (N) {
2858
+ const j = N.textContent?.trim(), J = N.closest("tr");
2859
+ if (j === "View Records" && J) {
2860
+ const W = J.querySelectorAll("td");
2861
+ if (W.length > 0) {
2862
+ const q = W[1].textContent?.trim();
2863
+ q && await K(q);
3040
2864
  }
3041
- } else if (K?.includes("Edit") && ee) {
3042
- const J = ee.querySelectorAll("td");
3043
- if (J.length > 0) {
3044
- const X = J[0].textContent?.trim();
3045
- X && await G(X);
2865
+ } else if (j?.includes("Edit") && J) {
2866
+ const W = J.querySelectorAll("td");
2867
+ if (W.length > 0) {
2868
+ const q = W[0].textContent?.trim();
2869
+ q && await G(q);
3046
2870
  }
3047
- } else if (K?.includes("Delete") && ee) {
3048
- const J = ee.querySelectorAll("td");
3049
- if (J.length > 0) {
3050
- const X = J[0].textContent?.trim();
3051
- X && await S(X);
2871
+ } else if (j?.includes("Delete") && J) {
2872
+ const W = J.querySelectorAll("td");
2873
+ if (W.length > 0) {
2874
+ const q = W[0].textContent?.trim();
2875
+ q && await w(q);
3052
2876
  }
3053
2877
  }
3054
2878
  }
3055
2879
  };
3056
- H(
3057
- [b, s, f],
2880
+ L(
2881
+ [h, c, p],
3058
2882
  () => {
3059
- b.value === "record" && p();
2883
+ h.value === "record" && S();
3060
2884
  },
3061
2885
  { immediate: !0 }
3062
- ), H(
2886
+ ), L(
3063
2887
  e,
3064
- (l) => {
2888
+ (s) => {
3065
2889
  },
3066
2890
  { immediate: !0 }
3067
- ), H(
3068
- [b, s, e],
3069
- ([l, d, w]) => {
3070
- l === "records" && d && w && _(d);
2891
+ ), L(
2892
+ [h, c, e],
2893
+ ([s, l, y]) => {
2894
+ s === "records" && l && y && E(l);
3071
2895
  },
3072
2896
  { immediate: !0 }
3073
2897
  );
3074
- const p = () => {
3075
- if (!(!e.value || !s.value)) {
2898
+ const S = () => {
2899
+ if (!(!e.value || !c.value)) {
3076
2900
  o.value = !0;
3077
2901
  try {
3078
- h.value || e.value.getRecordById(s.value, f.value);
3079
- } catch (l) {
3080
- console.warn("Error loading record data:", l);
2902
+ b.value || e.value.getRecordById(c.value, p.value);
2903
+ } catch (s) {
2904
+ console.warn("Error loading record data:", s);
3081
2905
  } finally {
3082
2906
  o.value = !1;
3083
2907
  }
3084
2908
  }
3085
2909
  };
3086
- return qe("desktopMethods", {
3087
- navigateToDoctype: q,
2910
+ return Ge("desktopMethods", {
2911
+ navigateToDoctype: K,
3088
2912
  openRecord: G,
3089
2913
  createNewRecord: z,
3090
- handleSave: L,
3091
- handleCancel: E,
3092
- handleDelete: S
3093
- }), Pe(() => {
3094
- se(() => {
3095
- b.value === "records" && s.value && e.value && _(s.value);
2914
+ handleSave: k,
2915
+ handleCancel: T,
2916
+ handleDelete: w
2917
+ }), Ae(() => {
2918
+ ae(() => {
2919
+ h.value === "records" && c.value && e.value && E(c.value);
3096
2920
  });
3097
- const l = (d) => {
3098
- (d.ctrlKey || d.metaKey) && d.key === "k" && (d.preventDefault(), a.value = !0), d.key === "Escape" && a.value && (a.value = !1);
2921
+ const s = (l) => {
2922
+ (l.ctrlKey || l.metaKey) && l.key === "k" && (l.preventDefault(), r.value = !0), l.key === "Escape" && r.value && (r.value = !1);
3099
2923
  };
3100
- return document.addEventListener("keydown", l), () => {
3101
- document.removeEventListener("keydown", l);
2924
+ return document.addEventListener("keydown", s), () => {
2925
+ document.removeEventListener("keydown", s);
3102
2926
  };
3103
- }), (l, d) => (M(), F("div", {
2927
+ }), (s, l) => (P(), V("div", {
3104
2928
  class: "desktop",
3105
- onClick: v
2929
+ onClick: D
3106
2930
  }, [
3107
- ae(_t, {
3108
- elements: $.value,
3109
- onActionClick: N
2931
+ ne(wt, {
2932
+ elements: m.value,
2933
+ onActionClick: F
3110
2934
  }, null, 8, ["elements"]),
3111
- I.value.length > 0 ? (M(), Ye(De(Jo), {
2935
+ M.value.length > 0 ? (P(), Ze(De(Go), {
3112
2936
  key: 0,
3113
- modelValue: I.value,
3114
- "onUpdate:modelValue": d[0] || (d[0] = (w) => I.value = w),
3115
- data: i.value
3116
- }, null, 8, ["modelValue", "data"])) : De(e) ? (M(), F("div", en, [
3117
- T("p", null, "Loading " + Y(b.value) + " data...", 1)
3118
- ])) : (M(), F("div", Yo, [...d[2] || (d[2] = [
3119
- T("p", null, "Initializing Stonecrop...", -1)
2937
+ data: i.value,
2938
+ "onUpdate:data": l[0] || (l[0] = (y) => i.value = y),
2939
+ schema: M.value
2940
+ }, null, 8, ["data", "schema"])) : De(e) ? (P(), V("div", Xo, [
2941
+ A("p", null, "Loading " + X(h.value) + " data...", 1)
2942
+ ])) : (P(), V("div", Qo, [...l[2] || (l[2] = [
2943
+ A("p", null, "Initializing Stonecrop...", -1)
3120
2944
  ])])),
3121
- ae(Rt, { breadcrumbs: D.value }, null, 8, ["breadcrumbs"]),
3122
- ae($t, {
3123
- "is-open": a.value,
3124
- search: V,
2945
+ ne(Nt, { breadcrumbs: O.value }, null, 8, ["breadcrumbs"]),
2946
+ ne(St, {
2947
+ "is-open": r.value,
2948
+ search: R,
3125
2949
  placeholder: "Type a command or search...",
3126
- onSelect: j,
3127
- onClose: d[1] || (d[1] = (w) => a.value = !1)
2950
+ onSelect: x,
2951
+ onClose: l[1] || (l[1] = (y) => r.value = !1)
3128
2952
  }, {
3129
- title: we(({ result: w }) => [
3130
- Ae(Y(w.title), 1)
2953
+ title: ye(({ result: y }) => [
2954
+ $e(X(y.title), 1)
3131
2955
  ]),
3132
- content: we(({ result: w }) => [
3133
- Ae(Y(w.description), 1)
2956
+ content: ye(({ result: y }) => [
2957
+ $e(X(y.description), 1)
3134
2958
  ]),
3135
2959
  _: 1
3136
2960
  }, 8, ["is-open"])
3137
2961
  ]));
3138
2962
  }
3139
- }), an = {
2963
+ }), on = {
3140
2964
  install: (t) => {
3141
- t.component("ActionSet", _t), t.component("CommandPalette", $t), t.component("Desktop", tn), t.component("SheetNav", Rt);
2965
+ t.component("ActionSet", wt), t.component("CommandPalette", St), t.component("Desktop", Yo), t.component("SheetNav", Nt);
3142
2966
  }
3143
2967
  };
3144
2968
  export {
3145
- _t as ActionSet,
3146
- $t as CommandPalette,
3147
- tn as Desktop,
3148
- Rt as SheetNav,
3149
- an as StonecropDesktop
2969
+ wt as ActionSet,
2970
+ St as CommandPalette,
2971
+ Yo as Desktop,
2972
+ Nt as SheetNav,
2973
+ on as StonecropDesktop
3150
2974
  };
3151
2975
  //# sourceMappingURL=desktop.js.map