@stonecrop/stonecrop 0.3.4 → 0.3.6

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/stonecrop.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var vr = Object.defineProperty;
2
2
  var yr = (e, t, n) => t in e ? vr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var x = (e, t, n) => yr(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { effectScope as _n, ref as se, markRaw as fe, toRaw as Ce, watch as Me, unref as de, hasInjectionContext as _r, inject as pe, getCurrentInstance as wt, reactive as En, isRef as Ae, isReactive as bt, toRef as Xe, nextTick as ct, computed as z, getCurrentScope as Er, onScopeDispose as wr, toRefs as jt, onBeforeMount as br, shallowRef as Sr, shallowReactive as Or, defineComponent as wn, h as bn, provide as Ze, watchEffect as Nr } from "vue";
4
+ import { effectScope as _n, ref as se, markRaw as fe, toRaw as Ce, watch as Me, unref as de, hasInjectionContext as _r, inject as pe, getCurrentInstance as bt, reactive as En, isRef as Ae, isReactive as wt, toRef as Xe, nextTick as ct, computed as z, getCurrentScope as Er, onScopeDispose as br, toRefs as jt, onBeforeMount as wr, shallowRef as Sr, shallowReactive as Or, defineComponent as bn, h as wn, provide as Ze, watchEffect as Nr } from "vue";
5
5
  function ut(e) {
6
6
  this.message = e || "";
7
7
  }
@@ -14,33 +14,33 @@ ut.prototype = Object.create(Error.prototype, {
14
14
  }
15
15
  }
16
16
  });
17
- const be = class be {
17
+ const we = class we {
18
18
  /**
19
- * @constructor
20
- * @param {Registry} registry - The immutable registry
21
- * @param {ReturnType<typeof useDataStore>} store - The mutable Pinia store
22
- * @param {Schema} [schema] - (optional) The Stonecrop schema
23
- * @param {ImmutableDoctype['workflow']} [workflow] - (optional) The Stonecrop workflow
24
- * @param {ImmutableDoctype['actions']} [actions] - (optional) The Stonecrop actions
25
- * @returns {Stonecrop} The Stonecrop instance
26
- * @description The Stonecrop constructor initializes a new Stonecrop instance with the given registry, store, schema, workflow, and actions. If a Stonecrop instance has already been created, it returns the existing instance instead of creating a new one.
19
+ * @param registry - The immutable registry
20
+ * @param store - The mutable Pinia store
21
+ * @param schema - The Stonecrop schema
22
+ * @param workflow - The Stonecrop workflow
23
+ * @param actions - The Stonecrop actions
24
+ * @returns The Stonecrop instance with the given registry, store, schema, workflow, and actions. If a Stonecrop instance has already been created, it returns the existing instance instead of creating a new one.
27
25
  * @example
26
+ * ```ts
28
27
  * const registry = new Registry()
29
28
  * const store = useDataStore()
30
- * const stonecrop = new Stonecrop(registry, store, schema, workflow, actions)
29
+ * const stonecrop = new Stonecrop(registry, store)
30
+ * ```
31
31
  */
32
32
  constructor(t, n, r, o, s) {
33
33
  /**
34
- * @property {string} name
35
- * @description The name of the Stonecrop instance
36
- * @example
37
- * 'Stonecrop'
34
+ * The name of the Stonecrop instance
35
+ * @readonly
36
+ *
37
+ * @defaultValue 'Stonecrop'
38
38
  */
39
39
  x(this, "name", "Stonecrop");
40
40
  /**
41
- * @property {Registry} registry
42
- * @description The registry is an immutable collection of doctypes
41
+ * The registry is an immutable collection of doctypes
43
42
  * @example
43
+ * ```ts
44
44
  * {
45
45
  * 'task': {
46
46
  * doctype: 'Task',
@@ -52,14 +52,15 @@ const be = class be {
52
52
  * },
53
53
  * ...
54
54
  * }
55
+ * ```
55
56
  * @see {@link Registry}
56
57
  * @see {@link DoctypeMeta}
57
58
  */
58
59
  x(this, "registry");
59
60
  /**
60
- * @property {Schema} schema - The Stonecrop schema
61
- * @description The schema is a subset of the registry
61
+ * schema - The Stonecrop schema; the schema is a subset of the registry
62
62
  * @example
63
+ * ```ts
63
64
  * {
64
65
  * doctype: 'Task',
65
66
  * schema: {
@@ -68,95 +69,96 @@ const be = class be {
68
69
  * ...
69
70
  * }
70
71
  * }
72
+ * ```
71
73
  * @see {@link Registry}
72
74
  * @see {@link DoctypeMeta}
73
75
  * @see {@link DoctypeMeta.schema}
74
76
  */
75
77
  x(this, "schema");
76
78
  /**
77
- * @property {ImmutableDoctype['workflow']} workflow
78
- * @description The workflow is a subset of the registry
79
+ * The workflow is a subset of the registry
79
80
  */
80
81
  x(this, "workflow");
81
82
  /**
82
- * @property {ImmutableDoctype['actions']} actions
83
- * @description The actions are a subset of the registry
83
+ * The actions are a subset of the registry
84
84
  */
85
85
  x(this, "actions");
86
86
  /**
87
- * @property {ReturnType<typeof useDataStore>} store
88
- * @description The Pinia store that manages the mutable records
87
+ * The Pinia store that manages the mutable records
89
88
  */
90
89
  x(this, "store");
91
- if (be._root)
92
- return be._root;
93
- be._root = this, this.registry = t, this.store = n, this.schema = r, this.workflow = o, this.actions = s;
90
+ if (we._root)
91
+ return we._root;
92
+ we._root = this, this.registry = t, this.store = n, this.schema = r, this.workflow = o, this.actions = s;
94
93
  }
95
94
  /**
96
- * @method setup
97
- * @param {DoctypeMeta} doctype - The doctype to setup
98
- * @returns {void}
99
- * @description Sets up the Stonecrop instance with the given doctype
95
+ * Sets up the Stonecrop instance with the given doctype
96
+ * @param doctype - The doctype to setup
100
97
  * @example
98
+ * ```ts
101
99
  * const doctype = await registry.getMeta('Task')
102
100
  * stonecrop.setup(doctype)
101
+ * ```
103
102
  */
104
103
  setup(t) {
105
104
  this.getMeta(t), this.getWorkflow(t), this.getActions(t);
106
105
  }
107
106
  /**
108
- * @method getMeta
109
- * @param {DoctypeMeta} doctype - The doctype to get meta for
110
- * @returns {DoctypeMeta}
111
- * @see {@link DoctypeMeta}
107
+ * Gets the meta for the given doctype
108
+ * @param doctype - The doctype to get meta for
109
+ * @returns The meta for the given doctype
112
110
  * @throws NotImplementedError
113
- * @description Gets the meta for the given doctype
114
111
  * @example
112
+ * ```ts
115
113
  * const doctype = await registry.getMeta('Task')
116
114
  * const meta = stonecrop.getMeta(doctype)
115
+ * ```
116
+ * @see {@link DoctypeMeta}
117
117
  */
118
118
  getMeta(t) {
119
119
  return this.registry.getMeta ? this.registry.getMeta(t.doctype) : new ut(t.doctype);
120
120
  }
121
121
  /**
122
- * @method getWorkflow
123
- * @param {DoctypeMeta} doctype - The doctype to get workflow for
124
- * @returns {void}
125
- * @description Gets the workflow for the given doctype
122
+ * Gets the workflow for the given doctype
123
+ * @param doctype - The doctype to get workflow for
126
124
  * @example
125
+ * ```ts
127
126
  * const doctype = await registry.getMeta('Task')
128
127
  * stonecrop.getWorkflow(doctype)
128
+ * ```
129
129
  */
130
130
  getWorkflow(t) {
131
131
  const n = this.registry.registry[t.slug];
132
132
  this.workflow = n.workflow;
133
133
  }
134
134
  /**
135
- * @method getActions
136
- * @param {DoctypeMeta} doctype - The doctype to get actions for
137
- * @returns {void}
138
- * @description Gets the actions for the given doctype
135
+ * Gets the actions for the given doctype
136
+ * @param doctype - The doctype to get actions for
139
137
  * @example
138
+ * ```ts
140
139
  * const doctype = await registry.getMeta('Task')
141
140
  * stonecrop.getActions(doctype)
141
+ * ```
142
142
  */
143
143
  getActions(t) {
144
144
  const n = this.registry.registry[t.slug];
145
145
  this.actions = n.actions;
146
146
  }
147
147
  /**
148
- * @method getRecords
149
- * @param {DoctypeMeta} doctype - The doctype to get records for
150
- * @param {RequestInit} [filters] - The filters to apply to the records
151
- * @returns {Promise<void>}
152
- * @description Gets the records for the given doctype
148
+ * Gets the records for the given doctype
149
+ * @param doctype - The doctype to get records for
150
+ * @param filters - The filters to apply to the records
153
151
  * @example
152
+ * ```ts
154
153
  * const doctype = await registry.getMeta('Task')
155
154
  * await stonecrop.getRecords(doctype)
155
+ * ```
156
156
  * @example
157
+ * ```ts
157
158
  * const doctype = await registry.getMeta('Task')
158
159
  * const filters = JSON.stringify({ status: 'Open' })
159
160
  * await stonecrop.getRecords(doctype, { body: filters })
161
+ * ```
160
162
  */
161
163
  async getRecords(t, n) {
162
164
  this.store.$patch({ records: [] });
@@ -164,14 +166,14 @@ const be = class be {
164
166
  this.store.$patch({ records: o });
165
167
  }
166
168
  /**
167
- * @method getRecord
168
- * @param {DoctypeMeta} doctype - The doctype to get record for
169
- * @param {string} id - The id of the record to get
170
- * @returns {Promise<void>}
171
- * @description Gets the record for the given doctype and id
169
+ * Gets the record for the given doctype and id
170
+ * @param doctype - The doctype to get record for
171
+ * @param id - The id of the record to get
172
172
  * @example
173
+ * ```ts
173
174
  * const doctype = await registry.getMeta('Task')
174
175
  * await stonecrop.getRecord(doctype, 'TASK-00001')
176
+ * ```
175
177
  */
176
178
  async getRecord(t, n) {
177
179
  this.store.$patch({ record: {} });
@@ -179,24 +181,30 @@ const be = class be {
179
181
  this.store.$patch({ record: o });
180
182
  }
181
183
  /**
182
- * @method runAction
183
- * @param {DoctypeMeta} doctype - The doctype to run action for
184
- * @param {string} action - The action to run
185
- * @param {string[]} [id] - The id(s) of the record(s) to run action on
186
- * @returns {void}
187
- * @description Runs the action for the given doctype and id
184
+ * Runs the action for the given doctype and id
185
+ * @param doctype - The doctype to run action for
186
+ * @param action - The action to run
187
+ * @param id - The id(s) of the record(s) to run action on
188
188
  * @example
189
+ * ```ts
189
190
  * const doctype = await registry.getMeta('Task')
190
191
  * stonecrop.runAction(doctype, 'CREATE')
192
+ * ```
191
193
  * @example
194
+ * ```ts
192
195
  * const doctype = await registry.getMeta('Task')
193
196
  * stonecrop.runAction(doctype, 'UPDATE', ['TASK-00001'])
197
+ * ```
194
198
  * @example
199
+ * ```ts
195
200
  * const doctype = await registry.getMeta('Task')
196
201
  * stonecrop.runAction(doctype, 'DELETE', ['TASK-00001'])
202
+ * ```
197
203
  * @example
204
+ * ```ts
198
205
  * const doctype = await registry.getMeta('Task')
199
206
  * stonecrop.runAction(doctype, 'TRANSITION', ['TASK-00001', 'TASK-00002'])
207
+ * ```
200
208
  */
201
209
  runAction(t, n, r) {
202
210
  const s = this.registry.registry[t.slug].actions.get(n), { initialState: i } = this.workflow;
@@ -206,11 +214,10 @@ const be = class be {
206
214
  }
207
215
  };
208
216
  /**
209
- * @property {Stonecrop} _root
210
- * @description The root Stonecrop instance
217
+ * The root Stonecrop instance
211
218
  */
212
- x(be, "_root");
213
- let lt = be;
219
+ x(we, "_root");
220
+ let lt = we;
214
221
  var Sn = !1;
215
222
  function je(e, t, n) {
216
223
  return Array.isArray(e) ? (e.length = Math.max(e.length, t), e.splice(t, 1, n), n) : (e[t] = n, n);
@@ -888,7 +895,7 @@ function Dn(e, t) {
888
895
  if (!(n in e))
889
896
  continue;
890
897
  const o = e[n];
891
- me(o) && me(r) && !Ae(r) && !bt(r) ? e[n] = Dn(o, r) : e[n] = r;
898
+ me(o) && me(r) && !Ae(r) && !wt(r) ? e[n] = Dn(o, r) : e[n] = r;
892
899
  }
893
900
  return e;
894
901
  }
@@ -900,7 +907,7 @@ function Ut(e, t, n, r = Mn) {
900
907
  const s = e.indexOf(t);
901
908
  s > -1 && (e.splice(s, 1), r());
902
909
  };
903
- return !n && Er() && wr(o), o;
910
+ return !n && Er() && br(o), o;
904
911
  }
905
912
  function _e(e, ...t) {
906
913
  e.slice().forEach((n) => {
@@ -914,7 +921,7 @@ function dt(e, t) {
914
921
  if (!t.hasOwnProperty(n))
915
922
  continue;
916
923
  const r = t[n], o = e[n];
917
- me(o) && me(r) && e.hasOwnProperty(n) && !Ae(r) && !bt(r) ? e[n] = dt(o, r) : e[n] = r;
924
+ me(o) && me(r) && e.hasOwnProperty(n) && !Ae(r) && !wt(r) ? e[n] = dt(o, r) : e[n] = r;
918
925
  }
919
926
  return e;
920
927
  }
@@ -953,11 +960,11 @@ function ht(e, t, n = {}, r, o, s) {
953
960
  throw new Error("Pinia destroyed");
954
961
  const c = { deep: !0 };
955
962
  process.env.NODE_ENV !== "production" && !Sn && (c.onTrigger = (y) => {
956
- l ? p = y : l == !1 && !b._hotUpdating && (Array.isArray(p) ? p.push(y) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
963
+ l ? p = y : l == !1 && !w._hotUpdating && (Array.isArray(p) ? p.push(y) : console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug."));
957
964
  });
958
965
  let l, f, u = [], d = [], p;
959
- const w = r.state.value[e];
960
- !s && !w && (process.env.NODE_ENV === "production" || !o) && (r.state.value[e] = {});
966
+ const b = r.state.value[e];
967
+ !s && !b && (process.env.NODE_ENV === "production" || !o) && (r.state.value[e] = {});
961
968
  const S = se({});
962
969
  let E;
963
970
  function R(y) {
@@ -1006,13 +1013,13 @@ function ht(e, t, n = {}, r, o, s) {
1006
1013
  _e(d, {
1007
1014
  args: V,
1008
1015
  name: A[tt],
1009
- store: b,
1016
+ store: w,
1010
1017
  after: Ve,
1011
1018
  onError: ge
1012
1019
  });
1013
1020
  let Q;
1014
1021
  try {
1015
- Q = y.apply(this && this.$id === e ? this : b, V);
1022
+ Q = y.apply(this && this.$id === e ? this : w, V);
1016
1023
  } catch (F) {
1017
1024
  throw _e(ce, F), F;
1018
1025
  }
@@ -1042,7 +1049,7 @@ function ht(e, t, n = {}, r, o, s) {
1042
1049
  return A;
1043
1050
  },
1044
1051
  $dispose: P
1045
- }, b = En(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && re ? G(
1052
+ }, w = En(process.env.NODE_ENV !== "production" || process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && re ? G(
1046
1053
  {
1047
1054
  _hmrPayload: B,
1048
1055
  _customProperties: fe(/* @__PURE__ */ new Set())
@@ -1052,12 +1059,12 @@ function ht(e, t, n = {}, r, o, s) {
1052
1059
  // must be added later
1053
1060
  // setupStore
1054
1061
  ) : q);
1055
- r._s.set(e, b);
1062
+ r._s.set(e, w);
1056
1063
  const W = (r._a && r._a.runWithContext || Yr)(() => r._e.run(() => (i = _n()).run(() => t({ action: M }))));
1057
1064
  for (const y in W) {
1058
1065
  const v = W[y];
1059
- if (Ae(v) && !Ht(v) || bt(v))
1060
- process.env.NODE_ENV !== "production" && o ? je(S.value, y, Xe(W, y)) : s || (w && Zr(v) && (Ae(v) ? v.value = w[y] : dt(v, w[y])), r.state.value[e][y] = v), process.env.NODE_ENV !== "production" && B.state.push(y);
1066
+ if (Ae(v) && !Ht(v) || wt(v))
1067
+ process.env.NODE_ENV !== "production" && o ? je(S.value, y, Xe(W, y)) : s || (b && Zr(v) && (Ae(v) ? v.value = b[y] : dt(v, b[y])), r.state.value[e][y] = v), process.env.NODE_ENV !== "production" && B.state.push(y);
1061
1068
  else if (typeof v == "function") {
1062
1069
  const A = process.env.NODE_ENV !== "production" && o ? v : M(v, y);
1063
1070
  W[y] = A, process.env.NODE_ENV !== "production" && (B.actions[y] = v), a.actions[y] = v;
@@ -1067,7 +1074,7 @@ function ht(e, t, n = {}, r, o, s) {
1067
1074
  ) : v, re && (W._getters || // @ts-expect-error: same
1068
1075
  (W._getters = fe([]))).push(y));
1069
1076
  }
1070
- if (G(b, W), G(Ce(b), W), Object.defineProperty(b, "$state", {
1077
+ if (G(w, W), G(Ce(w), W), Object.defineProperty(w, "$state", {
1071
1078
  get: () => process.env.NODE_ENV !== "production" && o ? S.value : r.state.value[e],
1072
1079
  set: (y) => {
1073
1080
  if (process.env.NODE_ENV !== "production" && o)
@@ -1076,34 +1083,34 @@ function ht(e, t, n = {}, r, o, s) {
1076
1083
  G(v, y);
1077
1084
  });
1078
1085
  }
1079
- }), process.env.NODE_ENV !== "production" && (b._hotUpdate = fe((y) => {
1080
- b._hotUpdating = !0, y._hmrPayload.state.forEach((v) => {
1081
- if (v in b.$state) {
1082
- const A = y.$state[v], V = b.$state[v];
1086
+ }), process.env.NODE_ENV !== "production" && (w._hotUpdate = fe((y) => {
1087
+ w._hotUpdating = !0, y._hmrPayload.state.forEach((v) => {
1088
+ if (v in w.$state) {
1089
+ const A = y.$state[v], V = w.$state[v];
1083
1090
  typeof A == "object" && me(A) && me(V) ? Dn(A, V) : y.$state[v] = V;
1084
1091
  }
1085
- je(b, v, Xe(y.$state, v));
1086
- }), Object.keys(b.$state).forEach((v) => {
1087
- v in y.$state || et(b, v);
1092
+ je(w, v, Xe(y.$state, v));
1093
+ }), Object.keys(w.$state).forEach((v) => {
1094
+ v in y.$state || et(w, v);
1088
1095
  }), l = !1, f = !1, r.state.value[e] = Xe(y._hmrPayload, "hotState"), f = !0, ct().then(() => {
1089
1096
  l = !0;
1090
1097
  });
1091
1098
  for (const v in y._hmrPayload.actions) {
1092
1099
  const A = y[v];
1093
- je(b, v, M(A, v));
1100
+ je(w, v, M(A, v));
1094
1101
  }
1095
1102
  for (const v in y._hmrPayload.getters) {
1096
1103
  const A = y._hmrPayload.getters[v], V = s ? (
1097
1104
  // special handling of options api
1098
- z(() => (Te(r), A.call(b, b)))
1105
+ z(() => (Te(r), A.call(w, w)))
1099
1106
  ) : A;
1100
- je(b, v, V);
1107
+ je(w, v, V);
1101
1108
  }
1102
- Object.keys(b._hmrPayload.getters).forEach((v) => {
1103
- v in y._hmrPayload.getters || et(b, v);
1104
- }), Object.keys(b._hmrPayload.actions).forEach((v) => {
1105
- v in y._hmrPayload.actions || et(b, v);
1106
- }), b._hmrPayload = y._hmrPayload, b._getters = y._getters, b._hotUpdating = !1;
1109
+ Object.keys(w._hmrPayload.getters).forEach((v) => {
1110
+ v in y._hmrPayload.getters || et(w, v);
1111
+ }), Object.keys(w._hmrPayload.actions).forEach((v) => {
1112
+ v in y._hmrPayload.actions || et(w, v);
1113
+ }), w._hmrPayload = y._hmrPayload, w._getters = y._getters, w._hotUpdating = !1;
1107
1114
  })), process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && re) {
1108
1115
  const y = {
1109
1116
  writable: !0,
@@ -1112,28 +1119,28 @@ function ht(e, t, n = {}, r, o, s) {
1112
1119
  enumerable: !1
1113
1120
  };
1114
1121
  ["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((v) => {
1115
- Object.defineProperty(b, v, G({ value: b[v] }, y));
1122
+ Object.defineProperty(w, v, G({ value: w[v] }, y));
1116
1123
  });
1117
1124
  }
1118
1125
  return r._p.forEach((y) => {
1119
1126
  if (process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && re) {
1120
1127
  const v = i.run(() => y({
1121
- store: b,
1128
+ store: w,
1122
1129
  app: r._a,
1123
1130
  pinia: r,
1124
1131
  options: a
1125
1132
  }));
1126
- Object.keys(v || {}).forEach((A) => b._customProperties.add(A)), G(b, v);
1133
+ Object.keys(v || {}).forEach((A) => w._customProperties.add(A)), G(w, v);
1127
1134
  } else
1128
- G(b, i.run(() => y({
1129
- store: b,
1135
+ G(w, i.run(() => y({
1136
+ store: w,
1130
1137
  app: r._a,
1131
1138
  pinia: r,
1132
1139
  options: a
1133
1140
  })));
1134
- }), process.env.NODE_ENV !== "production" && b.$state && typeof b.$state == "object" && typeof b.$state.constructor == "function" && !b.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be
1141
+ }), process.env.NODE_ENV !== "production" && w.$state && typeof w.$state == "object" && typeof w.$state.constructor == "function" && !w.$state.constructor.toString().includes("[native code]") && console.warn(`[🍍]: The "state" must be a plain object. It cannot be
1135
1142
  state: () => new MyClass()
1136
- Found in store "${b.$id}".`), w && s && n.hydrate && n.hydrate(b.$state, w), l = !0, f = !0, b;
1143
+ Found in store "${w.$id}".`), b && s && n.hydrate && n.hydrate(w.$state, b), l = !0, f = !0, w;
1137
1144
  }
1138
1145
  /*! #__NO_SIDE_EFFECTS__ */
1139
1146
  // @__NO_SIDE_EFFECTS__
@@ -1156,7 +1163,7 @@ This will fail in production.`);
1156
1163
  c._hotUpdate(d), delete a.state.value[u], a._s.delete(u);
1157
1164
  }
1158
1165
  if (process.env.NODE_ENV !== "production" && re) {
1159
- const u = wt();
1166
+ const u = bt();
1160
1167
  if (u && u.proxy && // avoid adding stores that are just built for hot module replacement
1161
1168
  !c) {
1162
1169
  const d = u.proxy, p = "_pStores" in d ? d._pStores : d._pStores = {};
@@ -1173,8 +1180,14 @@ const to = /* @__PURE__ */ eo("data", () => {
1173
1180
  });
1174
1181
  function Mi(e) {
1175
1182
  e || (e = pe("$registry"));
1176
- const t = to(), n = se(new lt(e, t)), r = se(!1);
1177
- return br(async () => {
1183
+ let t;
1184
+ try {
1185
+ t = to();
1186
+ } catch {
1187
+ throw new Error("Please enable the Stonecrop plugin before using the Stonecrop composable");
1188
+ }
1189
+ const n = se(new lt(e, t)), r = se(!1);
1190
+ return wr(async () => {
1178
1191
  var c, l;
1179
1192
  const o = e.router.currentRoute.value, s = (c = o.params.records) == null ? void 0 : c.toString().toLowerCase(), i = (l = o.params.record) == null ? void 0 : l.toString().toLowerCase();
1180
1193
  if (!s && !i)
@@ -1184,33 +1197,83 @@ function Mi(e) {
1184
1197
  }), { stonecrop: n, isReady: r };
1185
1198
  }
1186
1199
  class Vi {
1200
+ // TODO: allow different components for different views; probably
1201
+ // should be defined in the schema instead?
1187
1202
  constructor(t, n, r, o, s) {
1203
+ /**
1204
+ * The doctype name
1205
+ * @public
1206
+ * @readonly
1207
+ */
1188
1208
  x(this, "doctype");
1209
+ /**
1210
+ * The doctype schema
1211
+ * @public
1212
+ * @readonly
1213
+ */
1189
1214
  x(this, "schema");
1215
+ /**
1216
+ * The doctype workflow
1217
+ * @public
1218
+ * @readonly
1219
+ */
1190
1220
  x(this, "workflow");
1221
+ /**
1222
+ * The doctype actions
1223
+ * @public
1224
+ * @readonly
1225
+ */
1191
1226
  x(this, "actions");
1192
- // TODO: allow different components for different views; probably
1193
- // should be defined in the schema instead?
1227
+ /**
1228
+ * The doctype component
1229
+ * @public
1230
+ * @readonly
1231
+ */
1194
1232
  x(this, "component");
1195
1233
  this.doctype = t, this.schema = n, this.workflow = r, this.actions = o, this.component = s;
1196
1234
  }
1235
+ /**
1236
+ * Converts the registered doctype to a slug (kebab-case)
1237
+ * @returns The slugified doctype string
1238
+ * @public
1239
+ */
1197
1240
  get slug() {
1198
1241
  return this.doctype.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
1199
1242
  }
1200
- get __typename() {
1201
- return this.doctype;
1202
- }
1203
1243
  }
1204
1244
  const Se = class Se {
1205
1245
  constructor(t, n) {
1246
+ /**
1247
+ * The name of the Registry instance
1248
+ *
1249
+ * @defaultValue 'Registry'
1250
+ */
1206
1251
  x(this, "name");
1252
+ /**
1253
+ * The Vue router instance
1254
+ * @see {@link https://router.vuejs.org/}
1255
+ */
1207
1256
  x(this, "router");
1257
+ /**
1258
+ * The registry property contains a collection of doctypes
1259
+ * @see {@link DoctypeMeta}
1260
+ */
1208
1261
  x(this, "registry");
1262
+ /**
1263
+ * The getMeta function fetches doctype metadata from an API
1264
+ * @see {@link DoctypeMeta}
1265
+ */
1209
1266
  x(this, "getMeta");
1210
1267
  if (Se._root)
1211
1268
  return Se._root;
1212
1269
  Se._root = this, this.name = "Registry", this.router = t, this.registry = {}, this.getMeta = n;
1213
1270
  }
1271
+ /**
1272
+ * Get doctype metadata
1273
+ * @param doctype - The doctype to fetch metadata for
1274
+ * @returns The doctype metadata
1275
+ * @see {@link DoctypeMeta}
1276
+ */
1214
1277
  addDoctype(t) {
1215
1278
  t.doctype in Object.keys(this.registry) || (this.registry[t.slug] = t), this.router.hasRoute(t.doctype) || this.router.addRoute({
1216
1279
  path: `/${t.slug}`,
@@ -1219,6 +1282,9 @@ const Se = class Se {
1219
1282
  });
1220
1283
  }
1221
1284
  };
1285
+ /**
1286
+ * The root Registry instance
1287
+ */
1222
1288
  x(Se, "_root");
1223
1289
  let pt = Se;
1224
1290
  /*!
@@ -1282,7 +1348,7 @@ function rt(e, t, n = "/") {
1282
1348
  let r, o = {}, s = "", i = "";
1283
1349
  const a = t.indexOf("#");
1284
1350
  let c = t.indexOf("?");
1285
- return a < c && a >= 0 && (c = -1), c > -1 && (r = t.slice(0, c), s = t.slice(c + 1, a > -1 ? a : t.length), o = e(s)), a > -1 && (r = r || t.slice(0, a), i = t.slice(a, t.length)), r = wo(r ?? t, n), {
1351
+ return a < c && a >= 0 && (c = -1), c > -1 && (r = t.slice(0, c), s = t.slice(c + 1, a > -1 ? a : t.length), o = e(s)), a > -1 && (r = r || t.slice(0, a), i = t.slice(a, t.length)), r = bo(r ?? t, n), {
1286
1352
  fullPath: r + (s && "?") + s + i,
1287
1353
  path: r,
1288
1354
  query: o,
@@ -1317,7 +1383,7 @@ function Eo(e, t) {
1317
1383
  function qt(e, t) {
1318
1384
  return H(t) ? e.length === t.length && e.every((n, r) => n === t[r]) : e.length === 1 && e[0] === t;
1319
1385
  }
1320
- function wo(e, t) {
1386
+ function bo(e, t) {
1321
1387
  if (e.startsWith("/"))
1322
1388
  return e;
1323
1389
  if (process.env.NODE_ENV !== "production" && !t.startsWith("/"))
@@ -1355,7 +1421,7 @@ var Ie;
1355
1421
  (function(e) {
1356
1422
  e.back = "back", e.forward = "forward", e.unknown = "";
1357
1423
  })(Ie || (Ie = {}));
1358
- function bo(e) {
1424
+ function wo(e) {
1359
1425
  if (!e)
1360
1426
  if (Z) {
1361
1427
  const t = document.querySelector("base");
@@ -1428,10 +1494,10 @@ function Hn(e, t) {
1428
1494
  function Io(e, t, n, r) {
1429
1495
  let o = [], s = [], i = null;
1430
1496
  const a = ({ state: d }) => {
1431
- const p = Hn(e, location), w = n.value, S = t.value;
1497
+ const p = Hn(e, location), b = n.value, S = t.value;
1432
1498
  let E = 0;
1433
1499
  if (d) {
1434
- if (n.value = p, t.value = d, i && i === w) {
1500
+ if (n.value = p, t.value = d, i && i === b) {
1435
1501
  i = null;
1436
1502
  return;
1437
1503
  }
@@ -1439,7 +1505,7 @@ function Io(e, t, n, r) {
1439
1505
  } else
1440
1506
  r(p);
1441
1507
  o.forEach((R) => {
1442
- R(n.value, w, {
1508
+ R(n.value, b, {
1443
1509
  delta: E,
1444
1510
  type: De.pop,
1445
1511
  direction: E ? E > 0 ? Ie.forward : Ie.back : Ie.unknown
@@ -1452,8 +1518,8 @@ function Io(e, t, n, r) {
1452
1518
  function l(d) {
1453
1519
  o.push(d);
1454
1520
  const p = () => {
1455
- const w = o.indexOf(d);
1456
- w > -1 && o.splice(w, 1);
1521
+ const b = o.indexOf(d);
1522
+ b > -1 && o.splice(b, 1);
1457
1523
  };
1458
1524
  return s.push(p), p;
1459
1525
  }
@@ -1546,7 +1612,7 @@ You can find more information at https://router.vuejs.org/guide/migration/#Usage
1546
1612
  };
1547
1613
  }
1548
1614
  function Ao(e) {
1549
- e = bo(e);
1615
+ e = wo(e);
1550
1616
  const t = Co(e), n = Io(e, t.state, t.location, t.replace);
1551
1617
  function r(s, i = !0) {
1552
1618
  i || n.pauseListeners(), history.go(s);
@@ -1642,9 +1708,9 @@ function jo(e, t) {
1642
1708
  if (d.type === 0)
1643
1709
  u || (o += "/"), o += d.value.replace(xo, "\\$&"), p += 40;
1644
1710
  else if (d.type === 1) {
1645
- const { value: w, repeatable: S, optional: E, regexp: R } = d;
1711
+ const { value: b, repeatable: S, optional: E, regexp: R } = d;
1646
1712
  s.push({
1647
- name: w,
1713
+ name: b,
1648
1714
  repeatable: S,
1649
1715
  optional: E
1650
1716
  });
@@ -1654,7 +1720,7 @@ function jo(e, t) {
1654
1720
  try {
1655
1721
  new RegExp(`(${k})`);
1656
1722
  } catch (M) {
1657
- throw new Error(`Invalid custom RegExp for param "${w}" (${k}): ` + M.message);
1723
+ throw new Error(`Invalid custom RegExp for param "${b}" (${k}): ` + M.message);
1658
1724
  }
1659
1725
  }
1660
1726
  let P = S ? `((?:${k})(?:/(?:${k}))*)` : `(${k})`;
@@ -1677,8 +1743,8 @@ function jo(e, t) {
1677
1743
  if (!f)
1678
1744
  return null;
1679
1745
  for (let d = 1; d < f.length; d++) {
1680
- const p = f[d] || "", w = s[d - 1];
1681
- u[w.name] = p && w.repeatable ? p.split("/") : p;
1746
+ const p = f[d] || "", b = s[d - 1];
1747
+ u[b.name] = p && b.repeatable ? p.split("/") : p;
1682
1748
  }
1683
1749
  return u;
1684
1750
  }
@@ -1690,15 +1756,15 @@ function jo(e, t) {
1690
1756
  if (p.type === 0)
1691
1757
  f += p.value;
1692
1758
  else if (p.type === 1) {
1693
- const { value: w, repeatable: S, optional: E } = p, R = w in l ? l[w] : "";
1759
+ const { value: b, repeatable: S, optional: E } = p, R = b in l ? l[b] : "";
1694
1760
  if (H(R) && !S)
1695
- throw new Error(`Provided param "${w}" is an array but it is not repeatable (* or + modifiers)`);
1761
+ throw new Error(`Provided param "${b}" is an array but it is not repeatable (* or + modifiers)`);
1696
1762
  const k = H(R) ? R.join("/") : R;
1697
1763
  if (!k)
1698
1764
  if (E)
1699
1765
  d.length < 2 && (f.endsWith("/") ? f = f.slice(0, -1) : u = !0);
1700
1766
  else
1701
- throw new Error(`Missing required param "${w}"`);
1767
+ throw new Error(`Missing required param "${b}"`);
1702
1768
  f += k;
1703
1769
  }
1704
1770
  }
@@ -1830,7 +1896,7 @@ function Wo(e, t) {
1830
1896
  return r.get(u);
1831
1897
  }
1832
1898
  function s(u, d, p) {
1833
- const w = !p, S = en(u);
1899
+ const b = !p, S = en(u);
1834
1900
  process.env.NODE_ENV !== "production" && Jo(S, d), S.aliasOf = p && p.record;
1835
1901
  const E = nn(t, u), R = [S];
1836
1902
  if ("alias" in u) {
@@ -1855,16 +1921,16 @@ function Wo(e, t) {
1855
1921
  for (const M of R) {
1856
1922
  const { path: B } = M;
1857
1923
  if (d && B[0] !== "/") {
1858
- const q = d.record.path, b = q[q.length - 1] === "/" ? "" : "/";
1859
- M.path = d.record.path + (B && b + B);
1924
+ const q = d.record.path, w = q[q.length - 1] === "/" ? "" : "/";
1925
+ M.path = d.record.path + (B && w + B);
1860
1926
  }
1861
1927
  if (process.env.NODE_ENV !== "production" && M.path === "*")
1862
1928
  throw new Error(`Catch all routes ("*") must now be defined using a param with a custom regexp.
1863
1929
  See more at https://router.vuejs.org/guide/migration/#Removed-star-or-catch-all-routes.`);
1864
- if (k = Ho(M, d, E), process.env.NODE_ENV !== "production" && d && B[0] === "/" && Qo(k, d), p ? (p.alias.push(k), process.env.NODE_ENV !== "production" && qo(p, k)) : (P = P || k, P !== k && P.alias.push(k), w && u.name && !tn(k) && (process.env.NODE_ENV !== "production" && Ko(u, d), i(u.name))), zn(k) && c(k), S.children) {
1930
+ if (k = Ho(M, d, E), process.env.NODE_ENV !== "production" && d && B[0] === "/" && Qo(k, d), p ? (p.alias.push(k), process.env.NODE_ENV !== "production" && qo(p, k)) : (P = P || k, P !== k && P.alias.push(k), b && u.name && !tn(k) && (process.env.NODE_ENV !== "production" && Ko(u, d), i(u.name))), zn(k) && c(k), S.children) {
1865
1931
  const q = S.children;
1866
- for (let b = 0; b < q.length; b++)
1867
- s(q[b], k, p && p.children[b]);
1932
+ for (let w = 0; w < q.length; w++)
1933
+ s(q[w], k, p && p.children[w]);
1868
1934
  }
1869
1935
  p = p || k;
1870
1936
  }
@@ -1889,7 +1955,7 @@ See more at https://router.vuejs.org/guide/migration/#Removed-star-or-catch-all-
1889
1955
  n.splice(d, 0, u), u.record.name && !tn(u) && r.set(u.record.name, u);
1890
1956
  }
1891
1957
  function l(u, d) {
1892
- let p, w = {}, S, E;
1958
+ let p, b = {}, S, E;
1893
1959
  if ("name" in u && u.name) {
1894
1960
  if (p = r.get(u.name), !p)
1895
1961
  throw Ne(1, {
@@ -1899,7 +1965,7 @@ See more at https://router.vuejs.org/guide/migration/#Removed-star-or-catch-all-
1899
1965
  const P = Object.keys(u.params || {}).filter((M) => !p.keys.find((B) => B.name === M));
1900
1966
  P.length && O(`Discarded invalid param(s) "${P.join('", "')}" when navigating. See https://github.com/vuejs/router/blob/main/packages/router/CHANGELOG.md#414-2022-08-22 for more details.`);
1901
1967
  }
1902
- E = p.record.name, w = I(
1968
+ E = p.record.name, b = I(
1903
1969
  // paramsFromLocation is a new object
1904
1970
  Zt(
1905
1971
  d.params,
@@ -1910,16 +1976,16 @@ See more at https://router.vuejs.org/guide/migration/#Removed-star-or-catch-all-
1910
1976
  // discard any existing params in the current location that do not exist here
1911
1977
  // #1497 this ensures better active/exact matching
1912
1978
  u.params && Zt(u.params, p.keys.map((P) => P.name))
1913
- ), S = p.stringify(w);
1979
+ ), S = p.stringify(b);
1914
1980
  } else if (u.path != null)
1915
- S = u.path, process.env.NODE_ENV !== "production" && !S.startsWith("/") && O(`The Matcher cannot resolve relative paths but received "${S}". Unless you directly called \`matcher.resolve("${S}")\`, this is probably a bug in vue-router. Please open an issue at https://github.com/vuejs/router/issues/new/choose.`), p = n.find((P) => P.re.test(S)), p && (w = p.parse(S), E = p.record.name);
1981
+ S = u.path, process.env.NODE_ENV !== "production" && !S.startsWith("/") && O(`The Matcher cannot resolve relative paths but received "${S}". Unless you directly called \`matcher.resolve("${S}")\`, this is probably a bug in vue-router. Please open an issue at https://github.com/vuejs/router/issues/new/choose.`), p = n.find((P) => P.re.test(S)), p && (b = p.parse(S), E = p.record.name);
1916
1982
  else {
1917
1983
  if (p = d.name ? r.get(d.name) : n.find((P) => P.re.test(d.path)), !p)
1918
1984
  throw Ne(1, {
1919
1985
  location: u,
1920
1986
  currentLocation: d
1921
1987
  });
1922
- E = p.record.name, w = I({}, d.params, u.params), S = p.stringify(w);
1988
+ E = p.record.name, b = I({}, d.params, u.params), S = p.stringify(b);
1923
1989
  }
1924
1990
  const R = [];
1925
1991
  let k = p;
@@ -1928,7 +1994,7 @@ See more at https://router.vuejs.org/guide/migration/#Removed-star-or-catch-all-
1928
1994
  return {
1929
1995
  name: E,
1930
1996
  path: S,
1931
- params: w,
1997
+ params: b,
1932
1998
  matched: R,
1933
1999
  meta: zo(R)
1934
2000
  };
@@ -2182,9 +2248,9 @@ function sn(e) {
2182
2248
  const { matched: f } = s.value, { length: u } = f, d = f[u - 1], p = n.matched;
2183
2249
  if (!d || !p.length)
2184
2250
  return -1;
2185
- const w = p.findIndex(ie.bind(null, d));
2186
- if (w > -1)
2187
- return w;
2251
+ const b = p.findIndex(ie.bind(null, d));
2252
+ if (b > -1)
2253
+ return b;
2188
2254
  const S = an(f[u - 2]);
2189
2255
  return (
2190
2256
  // we are dealing with nested routes
@@ -2192,7 +2258,7 @@ function sn(e) {
2192
2258
  // referring to the empty child. Or we currently are on a different
2193
2259
  // child of the same parent
2194
2260
  an(d) === S && // avoid comparing the child with its parent
2195
- p[p.length - 1].path !== S ? p.findIndex(ie.bind(null, f[u - 2])) : w
2261
+ p[p.length - 1].path !== S ? p.findIndex(ie.bind(null, f[u - 2])) : b
2196
2262
  );
2197
2263
  }), a = z(() => i.value > -1 && as(n.params, s.value.params)), c = z(() => i.value > -1 && i.value === n.matched.length - 1 && Fn(n.params, s.value.params));
2198
2264
  function l(f = {}) {
@@ -2206,7 +2272,7 @@ function sn(e) {
2206
2272
  return Promise.resolve();
2207
2273
  }
2208
2274
  if (process.env.NODE_ENV !== "production" && Z) {
2209
- const f = wt();
2275
+ const f = bt();
2210
2276
  if (f) {
2211
2277
  const u = {
2212
2278
  route: s.value,
@@ -2230,7 +2296,7 @@ function sn(e) {
2230
2296
  function rs(e) {
2231
2297
  return e.length === 1 ? e[0] : e;
2232
2298
  }
2233
- const os = /* @__PURE__ */ wn({
2299
+ const os = /* @__PURE__ */ bn({
2234
2300
  name: "RouterLink",
2235
2301
  compatConfig: { MODE: 3 },
2236
2302
  props: {
@@ -2261,7 +2327,7 @@ const os = /* @__PURE__ */ wn({
2261
2327
  }));
2262
2328
  return () => {
2263
2329
  const s = t.default && rs(t.default(n));
2264
- return e.custom ? s : bn("a", {
2330
+ return e.custom ? s : wn("a", {
2265
2331
  "aria-current": n.isExactActive ? e.ariaCurrentValue : null,
2266
2332
  href: n.href,
2267
2333
  // this would override user added attrs but Vue will still add
@@ -2296,7 +2362,7 @@ function as(e, t) {
2296
2362
  function an(e) {
2297
2363
  return e ? e.aliasOf ? e.aliasOf.path : e.path : "";
2298
2364
  }
2299
- const cn = (e, t, n) => e ?? t ?? n, cs = /* @__PURE__ */ wn({
2365
+ const cn = (e, t, n) => e ?? t ?? n, cs = /* @__PURE__ */ bn({
2300
2366
  name: "RouterView",
2301
2367
  // #674 we manually inherit them
2302
2368
  inheritAttrs: !1,
@@ -2322,7 +2388,7 @@ const cn = (e, t, n) => e ?? t ?? n, cs = /* @__PURE__ */ wn({
2322
2388
  }), a = z(() => o.value.matched[i.value]);
2323
2389
  Ze(on, z(() => i.value + 1)), Ze(ts, a), Ze(_t, o);
2324
2390
  const c = se();
2325
- return Me(() => [c.value, a.value, e.name], ([l, f, u], [d, p, w]) => {
2391
+ return Me(() => [c.value, a.value, e.name], ([l, f, u], [d, p, b]) => {
2326
2392
  f && (f.instances[u] = l, p && p !== f && l && l === d && (f.leaveGuards.size || (f.leaveGuards = p.leaveGuards), f.updateGuards.size || (f.updateGuards = p.updateGuards))), l && f && // if there is no instance but to and from are the same this might be
2327
2393
  // the first visit
2328
2394
  (!p || !ie(f, p) || !d) && (f.enterCallbacks[u] || []).forEach((S) => S(l));
@@ -2330,7 +2396,7 @@ const cn = (e, t, n) => e ?? t ?? n, cs = /* @__PURE__ */ wn({
2330
2396
  const l = o.value, f = e.name, u = a.value, d = u && u.components[f];
2331
2397
  if (!d)
2332
2398
  return un(n.default, { Component: d, route: l });
2333
- const p = u.props[f], w = p ? p === !0 ? l.params : typeof p == "function" ? p(l) : p : null, E = bn(d, I({}, w, t, {
2399
+ const p = u.props[f], b = p ? p === !0 ? l.params : typeof p == "function" ? p(l) : p : null, E = wn(d, I({}, b, t, {
2334
2400
  onVnodeUnmounted: (R) => {
2335
2401
  R.component.isUnmounted && (u.instances[f] = null);
2336
2402
  },
@@ -2363,7 +2429,7 @@ function un(e, t) {
2363
2429
  }
2364
2430
  const us = cs;
2365
2431
  function ls() {
2366
- const e = wt(), t = e.parent && e.parent.type.name, n = e.parent && e.parent.subTree && e.parent.subTree.type;
2432
+ const e = bt(), t = e.parent && e.parent.type.name, n = e.parent && e.parent.subTree && e.parent.subTree.type;
2367
2433
  if (t && (t === "KeepAlive" || t.includes("Transition")) && typeof n == "object" && n.name === "RouterView") {
2368
2434
  const r = t === "KeepAlive" ? "keep-alive" : "transition";
2369
2435
  O(`<router-view> can no longer be used directly inside <transition> or <keep-alive>.
@@ -2379,7 +2445,7 @@ Use slot props instead:
2379
2445
  function Pe(e, t) {
2380
2446
  const n = I({}, e, {
2381
2447
  // remove variables that can contain vue instances
2382
- matched: e.matched.map((r) => ws(r, ["instances", "children", "aliasOf"]))
2448
+ matched: e.matched.map((r) => bs(r, ["instances", "children", "aliasOf"]))
2383
2449
  });
2384
2450
  return {
2385
2451
  _custom: {
@@ -2431,12 +2497,12 @@ function ds(e, t, n) {
2431
2497
  });
2432
2498
  }
2433
2499
  H(u.__vrl_devtools) && (u.__devtoolsApi = o, u.__vrl_devtools.forEach((d) => {
2434
- let p = d.route.path, w = Yn, S = "", E = 0;
2435
- d.error ? (p = d.error, w = vs, E = ys) : d.isExactActive ? (w = Qn, S = "This is exactly active") : d.isActive && (w = Kn, S = "This link is active"), f.tags.push({
2500
+ let p = d.route.path, b = Yn, S = "", E = 0;
2501
+ d.error ? (p = d.error, b = vs, E = ys) : d.isExactActive ? (b = Qn, S = "This is exactly active") : d.isActive && (b = Kn, S = "This link is active"), f.tags.push({
2436
2502
  label: p,
2437
2503
  textColor: E,
2438
2504
  tooltip: S,
2439
- backgroundColor: w
2505
+ backgroundColor: b
2440
2506
  });
2441
2507
  }));
2442
2508
  }), Me(t.currentRoute, () => {
@@ -2638,13 +2704,13 @@ function Et(e, t) {
2638
2704
  const o = e.record.path.toLowerCase(), s = Oe(o);
2639
2705
  return !t.startsWith("/") && (s.includes(t) || o.includes(t)) || s.startsWith(t) || o.startsWith(t) || e.record.name && String(e.record.name).includes(t) ? !0 : e.children.some((i) => Et(i, t));
2640
2706
  }
2641
- function ws(e, t) {
2707
+ function bs(e, t) {
2642
2708
  const n = {};
2643
2709
  for (const r in e)
2644
2710
  t.includes(r) || (n[r] = e[r]);
2645
2711
  return n;
2646
2712
  }
2647
- function bs(e) {
2713
+ function ws(e) {
2648
2714
  const t = Wo(e.routes, e), n = e.parseQuery || Zo, r = e.stringifyQuery || rn, o = e.history;
2649
2715
  if (process.env.NODE_ENV !== "production" && !o)
2650
2716
  throw new Error('Provide the "history" option when calling "createRouter()": https://router.vuejs.org/api/interfaces/RouterOptions.html#history');
@@ -2659,7 +2725,7 @@ function bs(e) {
2659
2725
  let m, _;
2660
2726
  return Wn(h) ? (m = t.getRecordMatcher(h), process.env.NODE_ENV !== "production" && !m && O(`Parent route "${String(h)}" not found when adding child route`, g), _ = g) : _ = h, t.addRoute(_, m);
2661
2727
  }
2662
- function w(h) {
2728
+ function b(h) {
2663
2729
  const g = t.getRecordMatcher(h);
2664
2730
  g ? t.removeRoute(g) : process.env.NODE_ENV !== "production" && O(`Cannot remove non-existent route "${String(h)}"`);
2665
2731
  }
@@ -2731,7 +2797,7 @@ function bs(e) {
2731
2797
  });
2732
2798
  }
2733
2799
  function M(h) {
2734
- return b(h);
2800
+ return w(h);
2735
2801
  }
2736
2802
  function B(h) {
2737
2803
  return M(I(k(h), { replace: !0 }));
@@ -2756,10 +2822,10 @@ ${JSON.stringify(_, null, 2)}
2756
2822
  }, _);
2757
2823
  }
2758
2824
  }
2759
- function b(h, g) {
2825
+ function w(h, g) {
2760
2826
  const m = l = R(h), _ = c.value, C = h.state, D = h.force, $ = h.replace === !0, N = q(m);
2761
2827
  if (N)
2762
- return b(
2828
+ return w(
2763
2829
  I(k(N), {
2764
2830
  state: typeof N == "object" ? I({}, C, N.state) : C,
2765
2831
  force: D,
@@ -2804,7 +2870,7 @@ ${JSON.stringify(_, null, 2)}
2804
2870
  // @ts-expect-error
2805
2871
  g._count + 1
2806
2872
  ) : 1) > 30 ? (O(`Detected a possibly infinite redirection in a navigation guard when going from "${_.fullPath}" to "${T.fullPath}". Aborting to avoid a Stack Overflow.
2807
- Are you always returning a new location within a navigation guard? That would lead to this error. Only return when redirecting or aborting, that should fix this. This might break in production if not fixed.`), Promise.reject(new Error("Infinite redirect in navigation guard"))) : b(
2873
+ Are you always returning a new location within a navigation guard? That would lead to this error. Only return when redirecting or aborting, that should fix this. This might break in production if not fixed.`), Promise.reject(new Error("Infinite redirect in navigation guard"))) : w(
2808
2874
  // keep options
2809
2875
  I({
2810
2876
  // preserve an existing replacement but allow the redirect to override it
@@ -2890,7 +2956,7 @@ ${JSON.stringify(_, null, 2)}
2890
2956
  return;
2891
2957
  const _ = R(h), C = q(_);
2892
2958
  if (C) {
2893
- b(I(C, { replace: !0, force: !0 }), _).catch(Re);
2959
+ w(I(C, { replace: !0, force: !0 }), _).catch(Re);
2894
2960
  return;
2895
2961
  }
2896
2962
  l = _;
@@ -2903,7 +2969,7 @@ ${JSON.stringify(_, null, 2)}
2903
2969
  $,
2904
2970
  2
2905
2971
  /* ErrorTypes.NAVIGATION_GUARD_REDIRECT */
2906
- ) ? (b(
2972
+ ) ? (w(
2907
2973
  I(k($.to), {
2908
2974
  force: !0
2909
2975
  }),
@@ -2962,7 +3028,7 @@ ${JSON.stringify(_, null, 2)}
2962
3028
  currentRoute: c,
2963
3029
  listening: !0,
2964
3030
  addRoute: p,
2965
- removeRoute: w,
3031
+ removeRoute: b,
2966
3032
  clearRoutes: t.clearRoutes,
2967
3033
  hasRoute: E,
2968
3034
  getRoutes: S,
@@ -3016,7 +3082,7 @@ function Ss(e, t) {
3016
3082
  }
3017
3083
  return [n, r, o];
3018
3084
  }
3019
- const Os = bs({
3085
+ const Os = ws({
3020
3086
  history: Ao(),
3021
3087
  routes: []
3022
3088
  });
@@ -3469,11 +3535,11 @@ function Ei(e) {
3469
3535
  return o.type;
3470
3536
  })));
3471
3537
  }
3472
- var lr = /* @__PURE__ */ new Set(), wi = 0, At = function(t, n) {
3473
- this.id = wi++, lr.add(this), this.name = t, dn && (n = dn), this.options = Rt(n), this.method = Ei(this.options), this._iL = !1, this._onML = null, this._addEL = {
3538
+ var lr = /* @__PURE__ */ new Set(), bi = 0, At = function(t, n) {
3539
+ this.id = bi++, lr.add(this), this.name = t, dn && (n = dn), this.options = Rt(n), this.method = Ei(this.options), this._iL = !1, this._onML = null, this._addEL = {
3474
3540
  message: [],
3475
3541
  internal: []
3476
- }, this._uMP = /* @__PURE__ */ new Set(), this._befC = [], this._prepP = null, bi(this);
3542
+ }, this._uMP = /* @__PURE__ */ new Set(), this._befC = [], this._prepP = null, wi(this);
3477
3543
  };
3478
3544
  At._pubkey = !0;
3479
3545
  var dn;
@@ -3547,7 +3613,7 @@ function hn(e, t, n) {
3547
3613
  }), i;
3548
3614
  });
3549
3615
  }
3550
- function bi(e) {
3616
+ function wi(e) {
3551
3617
  var t = e.method.create(e.name, e.options);
3552
3618
  Ns(t) ? (e._prepP = t, t.then(function(n) {
3553
3619
  e._state = n;
@@ -3633,7 +3699,7 @@ function $i(e) {
3633
3699
  return e < " " ? `\\u${e.charCodeAt(0).toString(16).padStart(4, "0")}` : "";
3634
3700
  }
3635
3701
  }
3636
- function we(e) {
3702
+ function be(e) {
3637
3703
  let t = "", n = 0;
3638
3704
  const r = e.length;
3639
3705
  for (let o = 0; o < r; o += 1) {
@@ -3740,9 +3806,9 @@ function yn(e, t) {
3740
3806
  const f = i++;
3741
3807
  r.set(l, f);
3742
3808
  for (const { key: d, fn: p } of o) {
3743
- const w = p(l);
3744
- if (w)
3745
- return n[f] = `["${d}",${a(w)}]`, f;
3809
+ const b = p(l);
3810
+ if (b)
3811
+ return n[f] = `["${d}",${a(b)}]`, f;
3746
3812
  }
3747
3813
  let u = "";
3748
3814
  if (gn(l))
@@ -3761,8 +3827,8 @@ function yn(e, t) {
3761
3827
  u = `["Date","${!isNaN(l.getDate()) ? l.toISOString() : ""}"]`;
3762
3828
  break;
3763
3829
  case "RegExp":
3764
- const { source: w, flags: S } = l;
3765
- u = S ? `["RegExp",${we(w)},"${S}"]` : `["RegExp",${we(w)}]`;
3830
+ const { source: b, flags: S } = l;
3831
+ u = S ? `["RegExp",${be(b)},"${S}"]` : `["RegExp",${be(b)}]`;
3766
3832
  break;
3767
3833
  case "Array":
3768
3834
  u = "[";
@@ -3798,13 +3864,13 @@ function yn(e, t) {
3798
3864
  if (Object.getPrototypeOf(l) === null) {
3799
3865
  u = '["null"';
3800
3866
  for (const E in l)
3801
- s.push(`.${E}`), u += `,${we(E)},${a(l[E])}`, s.pop();
3867
+ s.push(`.${E}`), u += `,${be(E)},${a(l[E])}`, s.pop();
3802
3868
  u += "]";
3803
3869
  } else {
3804
3870
  u = "{";
3805
3871
  let E = !1;
3806
3872
  for (const R in l)
3807
- E && (u += ","), E = !0, s.push(`.${R}`), u += `${we(R)}:${a(l[R])}`, s.pop();
3873
+ E && (u += ","), E = !0, s.push(`.${R}`), u += `${be(R)}:${a(l[R])}`, s.pop();
3808
3874
  u += "}";
3809
3875
  }
3810
3876
  }
@@ -3815,7 +3881,7 @@ function yn(e, t) {
3815
3881
  }
3816
3882
  function at(e) {
3817
3883
  const t = typeof e;
3818
- return t === "string" ? we(e) : e instanceof String ? we(e.toString()) : e === void 0 ? Tt.toString() : e === 0 && 1 / e < 0 ? Dt.toString() : t === "bigint" ? `["BigInt","${e}"]` : String(e);
3884
+ return t === "string" ? be(e) : e instanceof String ? be(e.toString()) : e === void 0 ? Tt.toString() : e === 0 && 1 / e < 0 ? Dt.toString() : t === "bigint" ? `["BigInt","${e}"]` : String(e);
3819
3885
  }
3820
3886
  function Ii(e, t, { initialize: n, type: r }) {
3821
3887
  let o = `${t.$id}-${e.toString()}`, s = new At(o, { type: r }), i = !1, a = 0;