@socotra/ec-react-utils 2.2.5-alpha.2 → 2.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,120 +1,120 @@
1
1
  const q = (t) => {
2
- const { data: e, scope: i, dataTypes: f, rootDisplayName: v, account: d, quote: $, element: m } = t, M = [];
3
- let k = {};
4
- const V = Object.fromEntries(
5
- Object.entries(e ?? {}).filter(([, p]) => {
6
- var T;
7
- const r = (T = p.scope) == null ? void 0 : T.split(",").map((Y) => Y.trim());
8
- return !!(!r || i === "P" && (r != null && r.includes("P")) || r != null && r.includes("Q") || i === "Q" && (r != null && r.includes("Q")));
9
- }).map(([p, r]) => {
10
- var H, z, u, a, n, c, s, o, l, g, D, x, O, S, Q, N, C;
11
- let T = !1, Y = !1, W = !1;
12
- const J = r.displayName ?? p, Z = (H = r.type) == null ? void 0 : H.slice(-1), A = r.maxLength, B = r.minLength, _ = r.max, j = r.min, F = r.regex;
13
- let h = r.type ?? "", L;
2
+ const { data: e, scope: a, dataTypes: f, rootDisplayName: b, account: d, quote: g, element: p } = t, M = [];
3
+ let P = {};
4
+ const C = Object.fromEntries(
5
+ Object.entries(e ?? {}).filter(([, h]) => {
6
+ var O;
7
+ const r = (O = h.scope) == null ? void 0 : O.split(",").map((Y) => Y.trim());
8
+ return !!(!r || a === "P" && (r != null && r.includes("P")) || r != null && r.includes("Q") || a === "Q" && (r != null && r.includes("Q")));
9
+ }).map(([h, r]) => {
10
+ var H, z, u, i, n, c, s, o, l, y, D, x, T, S, N, I, A;
11
+ let O = !1, Y = !1, W = !1;
12
+ const R = r.displayName ?? h, Z = (H = r.type) == null ? void 0 : H.slice(-1), V = r.maxLength, B = r.minLength, _ = r.max, j = r.min, F = r.regex;
13
+ let m = r.type ?? "", L;
14
14
  switch (Z) {
15
15
  case "*":
16
- Y = !0, T = !0, h = h == null ? void 0 : h.split("*")[0];
16
+ Y = !0, O = !0, m = m == null ? void 0 : m.split("*")[0];
17
17
  break;
18
18
  case "?":
19
- h = h == null ? void 0 : h.split("?")[0], T = !0;
19
+ m = m == null ? void 0 : m.split("?")[0], O = !0;
20
20
  break;
21
21
  case "+":
22
- Y = !0, h = h == null ? void 0 : h.split("+")[0];
22
+ Y = !0, m = m == null ? void 0 : m.split("+")[0];
23
23
  break;
24
24
  case "!":
25
- h = h == null ? void 0 : h.split("!")[0];
25
+ m = m == null ? void 0 : m.split("!")[0];
26
26
  break;
27
27
  }
28
- switch (h) {
28
+ switch (m) {
29
29
  case "string":
30
- h = "string";
30
+ m = "string";
31
31
  break;
32
32
  case "int":
33
33
  case "long":
34
- h = "integer";
34
+ m = "integer";
35
35
  break;
36
36
  case "decimal":
37
- h = "number";
37
+ m = "number";
38
38
  break;
39
39
  case "dateTime":
40
40
  case "datetime":
41
- h = "string", L = "date-time";
41
+ m = "string", L = "date-time";
42
42
  break;
43
43
  case "date":
44
- h = "string", L = "date";
44
+ m = "string", L = "date";
45
45
  break;
46
46
  case "boolean":
47
47
  case "bool":
48
- h = "boolean";
48
+ m = "boolean";
49
49
  break;
50
50
  default:
51
51
  W = !0;
52
52
  break;
53
53
  }
54
- if (!T && !W && !Y && M.push(p), W) {
55
- const P = f == null ? void 0 : f[h];
56
- if (P) {
54
+ if (!O && !W && !Y && M.push(h), W) {
55
+ const k = f == null ? void 0 : f[m];
56
+ if (k) {
57
57
  let w = Y ? [] : {};
58
- const I = q({
59
- data: P.data ?? {},
60
- scope: i,
58
+ const Q = q({
59
+ data: k.data ?? {},
60
+ scope: a,
61
61
  dataTypes: f,
62
- rootDisplayName: P.displayName ?? p
62
+ rootDisplayName: k.displayName ?? h
63
63
  });
64
- return $ && (u = (z = $.element) == null ? void 0 : z.data) != null && u[p] && (w = (n = (a = $.element) == null ? void 0 : a.data) == null ? void 0 : n[p]), m && (c = m == null ? void 0 : m.data) != null && c[p] && (w = (s = m == null ? void 0 : m.data) == null ? void 0 : s[p]), d && (o = d == null ? void 0 : d.data) != null && o[p] && (w = (l = d == null ? void 0 : d.data) == null ? void 0 : l[p]), k = {
65
- ...k,
66
- [`${h}`]: I
64
+ return g && (u = (z = g.element) == null ? void 0 : z.data) != null && u[h] && (w = (n = (i = g.element) == null ? void 0 : i.data) == null ? void 0 : n[h]), p && (c = p == null ? void 0 : p.data) != null && c[h] && (w = (s = p == null ? void 0 : p.data) == null ? void 0 : s[h]), d && (o = d == null ? void 0 : d.data) != null && o[h] && (w = (l = d == null ? void 0 : d.data) == null ? void 0 : l[h]), P = {
65
+ ...P,
66
+ [`${m}`]: Q
67
67
  }, Y ? [
68
- p,
68
+ h,
69
69
  {
70
- title: P.displayName ?? p,
70
+ title: k.displayName ?? h,
71
71
  type: "array",
72
72
  default: w,
73
73
  items: {
74
- $ref: `#/definitions/${h}`
74
+ $ref: `#/definitions/${m}`
75
75
  },
76
- ...!T && { minItems: 1 }
76
+ ...!O && { minItems: 1 }
77
77
  }
78
78
  ] : [
79
- p,
79
+ h,
80
80
  {
81
- title: P.displayName ?? p,
81
+ title: k.displayName ?? h,
82
82
  default: w,
83
- $ref: `#/definitions/${h}`
83
+ $ref: `#/definitions/${m}`
84
84
  }
85
85
  ];
86
86
  }
87
87
  }
88
- let b = "";
88
+ let v = "";
89
89
  if (d) {
90
- const P = (d == null ? void 0 : d.state) === "validated" ? p.charAt(0).toLowerCase() + p.slice(1) : p;
91
- b = (g = d == null ? void 0 : d.data) != null && g[P] ? (D = d == null ? void 0 : d.data) == null ? void 0 : D[P] : h === "boolean" ? !!r.defaultValue : r.defaultValue;
90
+ const k = (d == null ? void 0 : d.state) === "validated" ? h.charAt(0).toLowerCase() + h.slice(1) : h;
91
+ v = (y = d == null ? void 0 : d.data) != null && y[k] ? (D = d == null ? void 0 : d.data) == null ? void 0 : D[k] : m === "boolean" ? !!r.defaultValue : r.defaultValue;
92
92
  }
93
- return $ && (b = (O = (x = $.element) == null ? void 0 : x.data) != null && O[p] ? (Q = (S = $.element) == null ? void 0 : S.data) == null ? void 0 : Q[p] : h === "boolean" ? !!r.defaultValue : r.defaultValue), m && (b = (N = m == null ? void 0 : m.data) != null && N[p] ? (C = m == null ? void 0 : m.data) == null ? void 0 : C[p] : h === "boolean" ? !!r.defaultValue : r.defaultValue), Y ? [
94
- p,
93
+ return g && (v = (T = (x = g.element) == null ? void 0 : x.data) != null && T[h] ? (N = (S = g.element) == null ? void 0 : S.data) == null ? void 0 : N[h] : m === "boolean" ? !!r.defaultValue : r.defaultValue), p && (v = (I = p == null ? void 0 : p.data) != null && I[h] ? (A = p == null ? void 0 : p.data) == null ? void 0 : A[h] : m === "boolean" ? !!r.defaultValue : r.defaultValue), Y ? [
94
+ h,
95
95
  {
96
- title: J,
96
+ title: R,
97
97
  type: "array",
98
- default: b,
98
+ default: v,
99
99
  items: {
100
- type: h,
101
- ...A && { maxLength: A },
100
+ type: m,
101
+ ...V && { maxLength: V },
102
102
  ...B && { minLength: B },
103
103
  ...j && { min: j },
104
104
  ..._ && { max: _ },
105
105
  ...L && { format: L },
106
106
  ...F && { pattern: r.regex }
107
107
  },
108
- ...!T && { minItems: 1 }
108
+ ...!O && { minItems: 1 }
109
109
  }
110
110
  ] : [
111
- p,
111
+ h,
112
112
  {
113
- title: J,
114
- type: h,
115
- ...b && { default: b },
113
+ title: R,
114
+ type: m,
115
+ ...v && { default: v },
116
116
  ...B && { minLength: B },
117
- ...A && { maxLength: A },
117
+ ...V && { maxLength: V },
118
118
  ...j && { minimum: parseInt(j) },
119
119
  ..._ && { maximum: parseInt(_) },
120
120
  ...L && { format: L },
@@ -125,24 +125,13 @@ const q = (t) => {
125
125
  })
126
126
  );
127
127
  return {
128
- title: v,
128
+ title: b,
129
129
  type: "object",
130
- definitions: k,
130
+ definitions: P,
131
131
  required: M,
132
- properties: V
132
+ properties: C
133
133
  };
134
- }, oe = (t) => {
135
- const e = t.autoValidate, i = t.delinquencyPlanName, f = t.accountType, v = Object.keys(t).reduce(
136
- ($, m) => (m !== "accountType" && m !== "autoValidate" && m !== "delinquencyPlanName" && ($[m] = t[m]), $),
137
- {}
138
- );
139
- return {
140
- autoValidate: e,
141
- delinquencyPlanName: i,
142
- type: f,
143
- data: v
144
- };
145
- }, le = ({
134
+ }, oe = ({
146
135
  formData: t,
147
136
  locator: e
148
137
  }) => ({
@@ -157,335 +146,321 @@ function te(t) {
157
146
  }
158
147
  var K = { exports: {} };
159
148
  (function(t, e) {
160
- (function(i, f) {
149
+ (function(a, f) {
161
150
  t.exports = f();
162
151
  })(ee, function() {
163
- var i = 1e3, f = 6e4, v = 36e5, d = "millisecond", $ = "second", m = "minute", M = "hour", k = "day", V = "week", E = "month", p = "quarter", r = "year", T = "date", Y = "Invalid Date", W = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, J = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, Z = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(u) {
164
- var a = ["th", "st", "nd", "rd"], n = u % 100;
165
- return "[" + u + (a[(n - 20) % 10] || a[n] || a[0]) + "]";
166
- } }, A = function(u, a, n) {
152
+ var a = 1e3, f = 6e4, b = 36e5, d = "millisecond", g = "second", p = "minute", M = "hour", P = "day", C = "week", E = "month", h = "quarter", r = "year", O = "date", Y = "Invalid Date", W = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, R = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, Z = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(u) {
153
+ var i = ["th", "st", "nd", "rd"], n = u % 100;
154
+ return "[" + u + (i[(n - 20) % 10] || i[n] || i[0]) + "]";
155
+ } }, V = function(u, i, n) {
167
156
  var c = String(u);
168
- return !c || c.length >= a ? u : "" + Array(a + 1 - c.length).join(n) + u;
169
- }, B = { s: A, z: function(u) {
170
- var a = -u.utcOffset(), n = Math.abs(a), c = Math.floor(n / 60), s = n % 60;
171
- return (a <= 0 ? "+" : "-") + A(c, 2, "0") + ":" + A(s, 2, "0");
172
- }, m: function u(a, n) {
173
- if (a.date() < n.date())
174
- return -u(n, a);
175
- var c = 12 * (n.year() - a.year()) + (n.month() - a.month()), s = a.clone().add(c, E), o = n - s < 0, l = a.clone().add(c + (o ? -1 : 1), E);
157
+ return !c || c.length >= i ? u : "" + Array(i + 1 - c.length).join(n) + u;
158
+ }, B = { s: V, z: function(u) {
159
+ var i = -u.utcOffset(), n = Math.abs(i), c = Math.floor(n / 60), s = n % 60;
160
+ return (i <= 0 ? "+" : "-") + V(c, 2, "0") + ":" + V(s, 2, "0");
161
+ }, m: function u(i, n) {
162
+ if (i.date() < n.date()) return -u(n, i);
163
+ var c = 12 * (n.year() - i.year()) + (n.month() - i.month()), s = i.clone().add(c, E), o = n - s < 0, l = i.clone().add(c + (o ? -1 : 1), E);
176
164
  return +(-(c + (n - s) / (o ? s - l : l - s)) || 0);
177
165
  }, a: function(u) {
178
166
  return u < 0 ? Math.ceil(u) || 0 : Math.floor(u);
179
167
  }, p: function(u) {
180
- return { M: E, y: r, w: V, d: k, D: T, h: M, m, s: $, ms: d, Q: p }[u] || String(u || "").toLowerCase().replace(/s$/, "");
168
+ return { M: E, y: r, w: C, d: P, D: O, h: M, m: p, s: g, ms: d, Q: h }[u] || String(u || "").toLowerCase().replace(/s$/, "");
181
169
  }, u: function(u) {
182
170
  return u === void 0;
183
171
  } }, _ = "en", j = {};
184
172
  j[_] = Z;
185
- var F = "$isDayjsObject", h = function(u) {
173
+ var F = "$isDayjsObject", m = function(u) {
186
174
  return u instanceof H || !(!u || !u[F]);
187
- }, L = function u(a, n, c) {
175
+ }, L = function u(i, n, c) {
188
176
  var s;
189
- if (!a)
190
- return _;
191
- if (typeof a == "string") {
192
- var o = a.toLowerCase();
177
+ if (!i) return _;
178
+ if (typeof i == "string") {
179
+ var o = i.toLowerCase();
193
180
  j[o] && (s = o), n && (j[o] = n, s = o);
194
- var l = a.split("-");
195
- if (!s && l.length > 1)
196
- return u(l[0]);
181
+ var l = i.split("-");
182
+ if (!s && l.length > 1) return u(l[0]);
197
183
  } else {
198
- var g = a.name;
199
- j[g] = a, s = g;
184
+ var y = i.name;
185
+ j[y] = i, s = y;
200
186
  }
201
187
  return !c && s && (_ = s), s || !c && _;
202
- }, b = function(u, a) {
203
- if (h(u))
204
- return u.clone();
205
- var n = typeof a == "object" ? a : {};
188
+ }, v = function(u, i) {
189
+ if (m(u)) return u.clone();
190
+ var n = typeof i == "object" ? i : {};
206
191
  return n.date = u, n.args = arguments, new H(n);
207
- }, y = B;
208
- y.l = L, y.i = h, y.w = function(u, a) {
209
- return b(u, { locale: a.$L, utc: a.$u, x: a.$x, $offset: a.$offset });
192
+ }, $ = B;
193
+ $.l = L, $.i = m, $.w = function(u, i) {
194
+ return v(u, { locale: i.$L, utc: i.$u, x: i.$x, $offset: i.$offset });
210
195
  };
211
196
  var H = function() {
212
197
  function u(n) {
213
198
  this.$L = L(n.locale, null, !0), this.parse(n), this.$x = this.$x || n.x || {}, this[F] = !0;
214
199
  }
215
- var a = u.prototype;
216
- return a.parse = function(n) {
200
+ var i = u.prototype;
201
+ return i.parse = function(n) {
217
202
  this.$d = function(c) {
218
203
  var s = c.date, o = c.utc;
219
- if (s === null)
220
- return /* @__PURE__ */ new Date(NaN);
221
- if (y.u(s))
222
- return /* @__PURE__ */ new Date();
223
- if (s instanceof Date)
224
- return new Date(s);
204
+ if (s === null) return /* @__PURE__ */ new Date(NaN);
205
+ if ($.u(s)) return /* @__PURE__ */ new Date();
206
+ if (s instanceof Date) return new Date(s);
225
207
  if (typeof s == "string" && !/Z$/i.test(s)) {
226
208
  var l = s.match(W);
227
209
  if (l) {
228
- var g = l[2] - 1 || 0, D = (l[7] || "0").substring(0, 3);
229
- return o ? new Date(Date.UTC(l[1], g, l[3] || 1, l[4] || 0, l[5] || 0, l[6] || 0, D)) : new Date(l[1], g, l[3] || 1, l[4] || 0, l[5] || 0, l[6] || 0, D);
210
+ var y = l[2] - 1 || 0, D = (l[7] || "0").substring(0, 3);
211
+ return o ? new Date(Date.UTC(l[1], y, l[3] || 1, l[4] || 0, l[5] || 0, l[6] || 0, D)) : new Date(l[1], y, l[3] || 1, l[4] || 0, l[5] || 0, l[6] || 0, D);
230
212
  }
231
213
  }
232
214
  return new Date(s);
233
215
  }(n), this.init();
234
- }, a.init = function() {
216
+ }, i.init = function() {
235
217
  var n = this.$d;
236
218
  this.$y = n.getFullYear(), this.$M = n.getMonth(), this.$D = n.getDate(), this.$W = n.getDay(), this.$H = n.getHours(), this.$m = n.getMinutes(), this.$s = n.getSeconds(), this.$ms = n.getMilliseconds();
237
- }, a.$utils = function() {
238
- return y;
239
- }, a.isValid = function() {
219
+ }, i.$utils = function() {
220
+ return $;
221
+ }, i.isValid = function() {
240
222
  return this.$d.toString() !== Y;
241
- }, a.isSame = function(n, c) {
242
- var s = b(n);
223
+ }, i.isSame = function(n, c) {
224
+ var s = v(n);
243
225
  return this.startOf(c) <= s && s <= this.endOf(c);
244
- }, a.isAfter = function(n, c) {
245
- return b(n) < this.startOf(c);
246
- }, a.isBefore = function(n, c) {
247
- return this.endOf(c) < b(n);
248
- }, a.$g = function(n, c, s) {
249
- return y.u(n) ? this[c] : this.set(s, n);
250
- }, a.unix = function() {
226
+ }, i.isAfter = function(n, c) {
227
+ return v(n) < this.startOf(c);
228
+ }, i.isBefore = function(n, c) {
229
+ return this.endOf(c) < v(n);
230
+ }, i.$g = function(n, c, s) {
231
+ return $.u(n) ? this[c] : this.set(s, n);
232
+ }, i.unix = function() {
251
233
  return Math.floor(this.valueOf() / 1e3);
252
- }, a.valueOf = function() {
234
+ }, i.valueOf = function() {
253
235
  return this.$d.getTime();
254
- }, a.startOf = function(n, c) {
255
- var s = this, o = !!y.u(c) || c, l = y.p(n), g = function(P, w) {
256
- var I = y.w(s.$u ? Date.UTC(s.$y, w, P) : new Date(s.$y, w, P), s);
257
- return o ? I : I.endOf(k);
258
- }, D = function(P, w) {
259
- return y.w(s.toDate()[P].apply(s.toDate("s"), (o ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(w)), s);
260
- }, x = this.$W, O = this.$M, S = this.$D, Q = "set" + (this.$u ? "UTC" : "");
236
+ }, i.startOf = function(n, c) {
237
+ var s = this, o = !!$.u(c) || c, l = $.p(n), y = function(k, w) {
238
+ var Q = $.w(s.$u ? Date.UTC(s.$y, w, k) : new Date(s.$y, w, k), s);
239
+ return o ? Q : Q.endOf(P);
240
+ }, D = function(k, w) {
241
+ return $.w(s.toDate()[k].apply(s.toDate("s"), (o ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(w)), s);
242
+ }, x = this.$W, T = this.$M, S = this.$D, N = "set" + (this.$u ? "UTC" : "");
261
243
  switch (l) {
262
244
  case r:
263
- return o ? g(1, 0) : g(31, 11);
245
+ return o ? y(1, 0) : y(31, 11);
264
246
  case E:
265
- return o ? g(1, O) : g(0, O + 1);
266
- case V:
267
- var N = this.$locale().weekStart || 0, C = (x < N ? x + 7 : x) - N;
268
- return g(o ? S - C : S + (6 - C), O);
269
- case k:
270
- case T:
271
- return D(Q + "Hours", 0);
247
+ return o ? y(1, T) : y(0, T + 1);
248
+ case C:
249
+ var I = this.$locale().weekStart || 0, A = (x < I ? x + 7 : x) - I;
250
+ return y(o ? S - A : S + (6 - A), T);
251
+ case P:
252
+ case O:
253
+ return D(N + "Hours", 0);
272
254
  case M:
273
- return D(Q + "Minutes", 1);
274
- case m:
275
- return D(Q + "Seconds", 2);
276
- case $:
277
- return D(Q + "Milliseconds", 3);
255
+ return D(N + "Minutes", 1);
256
+ case p:
257
+ return D(N + "Seconds", 2);
258
+ case g:
259
+ return D(N + "Milliseconds", 3);
278
260
  default:
279
261
  return this.clone();
280
262
  }
281
- }, a.endOf = function(n) {
263
+ }, i.endOf = function(n) {
282
264
  return this.startOf(n, !1);
283
- }, a.$set = function(n, c) {
284
- var s, o = y.p(n), l = "set" + (this.$u ? "UTC" : ""), g = (s = {}, s[k] = l + "Date", s[T] = l + "Date", s[E] = l + "Month", s[r] = l + "FullYear", s[M] = l + "Hours", s[m] = l + "Minutes", s[$] = l + "Seconds", s[d] = l + "Milliseconds", s)[o], D = o === k ? this.$D + (c - this.$W) : c;
265
+ }, i.$set = function(n, c) {
266
+ var s, o = $.p(n), l = "set" + (this.$u ? "UTC" : ""), y = (s = {}, s[P] = l + "Date", s[O] = l + "Date", s[E] = l + "Month", s[r] = l + "FullYear", s[M] = l + "Hours", s[p] = l + "Minutes", s[g] = l + "Seconds", s[d] = l + "Milliseconds", s)[o], D = o === P ? this.$D + (c - this.$W) : c;
285
267
  if (o === E || o === r) {
286
- var x = this.clone().set(T, 1);
287
- x.$d[g](D), x.init(), this.$d = x.set(T, Math.min(this.$D, x.daysInMonth())).$d;
288
- } else
289
- g && this.$d[g](D);
268
+ var x = this.clone().set(O, 1);
269
+ x.$d[y](D), x.init(), this.$d = x.set(O, Math.min(this.$D, x.daysInMonth())).$d;
270
+ } else y && this.$d[y](D);
290
271
  return this.init(), this;
291
- }, a.set = function(n, c) {
272
+ }, i.set = function(n, c) {
292
273
  return this.clone().$set(n, c);
293
- }, a.get = function(n) {
294
- return this[y.p(n)]();
295
- }, a.add = function(n, c) {
274
+ }, i.get = function(n) {
275
+ return this[$.p(n)]();
276
+ }, i.add = function(n, c) {
296
277
  var s, o = this;
297
278
  n = Number(n);
298
- var l = y.p(c), g = function(O) {
299
- var S = b(o);
300
- return y.w(S.date(S.date() + Math.round(O * n)), o);
279
+ var l = $.p(c), y = function(T) {
280
+ var S = v(o);
281
+ return $.w(S.date(S.date() + Math.round(T * n)), o);
301
282
  };
302
- if (l === E)
303
- return this.set(E, this.$M + n);
304
- if (l === r)
305
- return this.set(r, this.$y + n);
306
- if (l === k)
307
- return g(1);
308
- if (l === V)
309
- return g(7);
310
- var D = (s = {}, s[m] = f, s[M] = v, s[$] = i, s)[l] || 1, x = this.$d.getTime() + n * D;
311
- return y.w(x, this);
312
- }, a.subtract = function(n, c) {
283
+ if (l === E) return this.set(E, this.$M + n);
284
+ if (l === r) return this.set(r, this.$y + n);
285
+ if (l === P) return y(1);
286
+ if (l === C) return y(7);
287
+ var D = (s = {}, s[p] = f, s[M] = b, s[g] = a, s)[l] || 1, x = this.$d.getTime() + n * D;
288
+ return $.w(x, this);
289
+ }, i.subtract = function(n, c) {
313
290
  return this.add(-1 * n, c);
314
- }, a.format = function(n) {
291
+ }, i.format = function(n) {
315
292
  var c = this, s = this.$locale();
316
- if (!this.isValid())
317
- return s.invalidDate || Y;
318
- var o = n || "YYYY-MM-DDTHH:mm:ssZ", l = y.z(this), g = this.$H, D = this.$m, x = this.$M, O = s.weekdays, S = s.months, Q = s.meridiem, N = function(w, I, R, U) {
319
- return w && (w[I] || w(c, o)) || R[I].slice(0, U);
320
- }, C = function(w) {
321
- return y.s(g % 12 || 12, w, "0");
322
- }, P = Q || function(w, I, R) {
293
+ if (!this.isValid()) return s.invalidDate || Y;
294
+ var o = n || "YYYY-MM-DDTHH:mm:ssZ", l = $.z(this), y = this.$H, D = this.$m, x = this.$M, T = s.weekdays, S = s.months, N = s.meridiem, I = function(w, Q, J, U) {
295
+ return w && (w[Q] || w(c, o)) || J[Q].slice(0, U);
296
+ }, A = function(w) {
297
+ return $.s(y % 12 || 12, w, "0");
298
+ }, k = N || function(w, Q, J) {
323
299
  var U = w < 12 ? "AM" : "PM";
324
- return R ? U.toLowerCase() : U;
300
+ return J ? U.toLowerCase() : U;
325
301
  };
326
- return o.replace(J, function(w, I) {
327
- return I || function(R) {
328
- switch (R) {
302
+ return o.replace(R, function(w, Q) {
303
+ return Q || function(J) {
304
+ switch (J) {
329
305
  case "YY":
330
306
  return String(c.$y).slice(-2);
331
307
  case "YYYY":
332
- return y.s(c.$y, 4, "0");
308
+ return $.s(c.$y, 4, "0");
333
309
  case "M":
334
310
  return x + 1;
335
311
  case "MM":
336
- return y.s(x + 1, 2, "0");
312
+ return $.s(x + 1, 2, "0");
337
313
  case "MMM":
338
- return N(s.monthsShort, x, S, 3);
314
+ return I(s.monthsShort, x, S, 3);
339
315
  case "MMMM":
340
- return N(S, x);
316
+ return I(S, x);
341
317
  case "D":
342
318
  return c.$D;
343
319
  case "DD":
344
- return y.s(c.$D, 2, "0");
320
+ return $.s(c.$D, 2, "0");
345
321
  case "d":
346
322
  return String(c.$W);
347
323
  case "dd":
348
- return N(s.weekdaysMin, c.$W, O, 2);
324
+ return I(s.weekdaysMin, c.$W, T, 2);
349
325
  case "ddd":
350
- return N(s.weekdaysShort, c.$W, O, 3);
326
+ return I(s.weekdaysShort, c.$W, T, 3);
351
327
  case "dddd":
352
- return O[c.$W];
328
+ return T[c.$W];
353
329
  case "H":
354
- return String(g);
330
+ return String(y);
355
331
  case "HH":
356
- return y.s(g, 2, "0");
332
+ return $.s(y, 2, "0");
357
333
  case "h":
358
- return C(1);
334
+ return A(1);
359
335
  case "hh":
360
- return C(2);
336
+ return A(2);
361
337
  case "a":
362
- return P(g, D, !0);
338
+ return k(y, D, !0);
363
339
  case "A":
364
- return P(g, D, !1);
340
+ return k(y, D, !1);
365
341
  case "m":
366
342
  return String(D);
367
343
  case "mm":
368
- return y.s(D, 2, "0");
344
+ return $.s(D, 2, "0");
369
345
  case "s":
370
346
  return String(c.$s);
371
347
  case "ss":
372
- return y.s(c.$s, 2, "0");
348
+ return $.s(c.$s, 2, "0");
373
349
  case "SSS":
374
- return y.s(c.$ms, 3, "0");
350
+ return $.s(c.$ms, 3, "0");
375
351
  case "Z":
376
352
  return l;
377
353
  }
378
354
  return null;
379
355
  }(w) || l.replace(":", "");
380
356
  });
381
- }, a.utcOffset = function() {
357
+ }, i.utcOffset = function() {
382
358
  return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
383
- }, a.diff = function(n, c, s) {
384
- var o, l = this, g = y.p(c), D = b(n), x = (D.utcOffset() - this.utcOffset()) * f, O = this - D, S = function() {
385
- return y.m(l, D);
359
+ }, i.diff = function(n, c, s) {
360
+ var o, l = this, y = $.p(c), D = v(n), x = (D.utcOffset() - this.utcOffset()) * f, T = this - D, S = function() {
361
+ return $.m(l, D);
386
362
  };
387
- switch (g) {
363
+ switch (y) {
388
364
  case r:
389
365
  o = S() / 12;
390
366
  break;
391
367
  case E:
392
368
  o = S();
393
369
  break;
394
- case p:
370
+ case h:
395
371
  o = S() / 3;
396
372
  break;
397
- case V:
398
- o = (O - x) / 6048e5;
373
+ case C:
374
+ o = (T - x) / 6048e5;
399
375
  break;
400
- case k:
401
- o = (O - x) / 864e5;
376
+ case P:
377
+ o = (T - x) / 864e5;
402
378
  break;
403
379
  case M:
404
- o = O / v;
380
+ o = T / b;
405
381
  break;
406
- case m:
407
- o = O / f;
382
+ case p:
383
+ o = T / f;
408
384
  break;
409
- case $:
410
- o = O / i;
385
+ case g:
386
+ o = T / a;
411
387
  break;
412
388
  default:
413
- o = O;
389
+ o = T;
414
390
  }
415
- return s ? o : y.a(o);
416
- }, a.daysInMonth = function() {
391
+ return s ? o : $.a(o);
392
+ }, i.daysInMonth = function() {
417
393
  return this.endOf(E).$D;
418
- }, a.$locale = function() {
394
+ }, i.$locale = function() {
419
395
  return j[this.$L];
420
- }, a.locale = function(n, c) {
421
- if (!n)
422
- return this.$L;
396
+ }, i.locale = function(n, c) {
397
+ if (!n) return this.$L;
423
398
  var s = this.clone(), o = L(n, c, !0);
424
399
  return o && (s.$L = o), s;
425
- }, a.clone = function() {
426
- return y.w(this.$d, this);
427
- }, a.toDate = function() {
400
+ }, i.clone = function() {
401
+ return $.w(this.$d, this);
402
+ }, i.toDate = function() {
428
403
  return new Date(this.valueOf());
429
- }, a.toJSON = function() {
404
+ }, i.toJSON = function() {
430
405
  return this.isValid() ? this.toISOString() : null;
431
- }, a.toISOString = function() {
406
+ }, i.toISOString = function() {
432
407
  return this.$d.toISOString();
433
- }, a.toString = function() {
408
+ }, i.toString = function() {
434
409
  return this.$d.toUTCString();
435
410
  }, u;
436
411
  }(), z = H.prototype;
437
- return b.prototype = z, [["$ms", d], ["$s", $], ["$m", m], ["$H", M], ["$W", k], ["$M", E], ["$y", r], ["$D", T]].forEach(function(u) {
438
- z[u[1]] = function(a) {
439
- return this.$g(a, u[0], u[1]);
412
+ return v.prototype = z, [["$ms", d], ["$s", g], ["$m", p], ["$H", M], ["$W", P], ["$M", E], ["$y", r], ["$D", O]].forEach(function(u) {
413
+ z[u[1]] = function(i) {
414
+ return this.$g(i, u[0], u[1]);
440
415
  };
441
- }), b.extend = function(u, a) {
442
- return u.$i || (u(a, H, b), u.$i = !0), b;
443
- }, b.locale = L, b.isDayjs = h, b.unix = function(u) {
444
- return b(1e3 * u);
445
- }, b.en = j[_], b.Ls = j, b.p = {}, b;
416
+ }), v.extend = function(u, i) {
417
+ return u.$i || (u(i, H, v), u.$i = !0), v;
418
+ }, v.locale = L, v.isDayjs = m, v.unix = function(u) {
419
+ return v(1e3 * u);
420
+ }, v.en = j[_], v.Ls = j, v.p = {}, v;
446
421
  });
447
422
  })(K);
448
423
  var ne = K.exports;
449
- const G = /* @__PURE__ */ te(ne), fe = ({ data: t }) => {
450
- const e = {}, i = { ...t };
451
- return i.default && (i.default.startTime && (e.startTime = G(i.default.startTime).format()), i.default.endTime && (e.endTime = G(i.default.endTime).format()), i.default.expirationTime && (e.expirationTime = G(i.default.expirationTime).format())), i.advanced && (i.advanced.currency && (e.currency = i.advanced.currency), i.advanced.timezone && (e.timezone = i.advanced.timezone), i.advanced.billingPlan && (e.billingPlan = i.advanced.billingPlan), i.advanced.defaultTermDuration && (e.defaultTermDuration = i.advanced.defaultTermDuration), i.advanced.installmentPlan && (e.installmentPlan = i.advanced.installmentPlan), i.advanced.durationBasis && (e.durationBasis = i.advanced.durationBasis), i.advanced.delinquencyPlanName && (e.delinquencyPlanName = i.advanced.delinquencyPlanName)), delete i.default, delete i.advanced, e.setData = i, e;
424
+ const G = /* @__PURE__ */ te(ne), le = ({ data: t }) => {
425
+ const e = {}, a = { ...t };
426
+ return a.default && (a.default.startTime && (e.startTime = G(a.default.startTime).format()), a.default.endTime && (e.endTime = G(a.default.endTime).format()), a.default.expirationTime && (e.expirationTime = G(a.default.expirationTime).format())), a.advanced && (a.advanced.currency && (e.currency = a.advanced.currency), a.advanced.timezone && (e.timezone = a.advanced.timezone), a.advanced.billingPlan && (e.billingPlan = a.advanced.billingPlan), a.advanced.defaultTermDuration && (e.defaultTermDuration = a.advanced.defaultTermDuration), a.advanced.installmentPlan && (e.installmentPlan = a.advanced.installmentPlan), a.advanced.durationBasis && (e.durationBasis = a.advanced.durationBasis), a.advanced.delinquencyPlanName && (e.delinquencyPlanName = a.advanced.delinquencyPlanName)), delete a.default, delete a.advanced, e.setData = a, e;
452
427
  }, se = (t) => {
453
- const e = /^(.*?)(Quote|QuickQuote|Policy)$/, i = t.match(e);
454
- return i && (i[2] === "Quote" || i[2] === "QuickQuote" || i[2] === "Policy") ? [i[1], i[2]] : [t, null];
428
+ const e = /^(.*?)(Quote|QuickQuote|Policy)$/, a = t.match(e);
429
+ return a && (a[2] === "Quote" || a[2] === "QuickQuote" || a[2] === "Policy") ? [a[1], a[2]] : [t, null];
455
430
  };
456
431
  function ie(t, e) {
457
432
  if (t.locator === e)
458
433
  return t;
459
434
  if (t.elements)
460
- for (const i of t.elements) {
461
- const f = ie(i, e);
435
+ for (const a of t.elements) {
436
+ const f = ie(a, e);
462
437
  if (f)
463
438
  return f;
464
439
  }
465
440
  }
466
- function de(t, e) {
467
- const [i] = se(
441
+ function fe(t, e) {
442
+ const [a] = se(
468
443
  t.type ?? ""
469
444
  );
470
445
  let f = {};
471
- return e.exposures && Object.keys(e.exposures).forEach((v) => {
472
- v === i && e.exposures && (f = e.exposures[v]);
473
- }), e.coverages && Object.keys(e.coverages).forEach((v) => {
474
- v === i && e.coverages && (f = e.coverages[v]);
475
- }), e.policyLines && Object.keys(e.policyLines).forEach((v) => {
476
- v === i && e.policyLines && (f = e.policyLines[v]);
477
- }), e.exposureGroups && Object.keys(e.exposureGroups).forEach((v) => {
478
- v === i && e.exposureGroups && (f = e.exposureGroups[v]);
446
+ return e.exposures && Object.keys(e.exposures).forEach((b) => {
447
+ b === a && e.exposures && (f = e.exposures[b]);
448
+ }), e.coverages && Object.keys(e.coverages).forEach((b) => {
449
+ b === a && e.coverages && (f = e.coverages[b]);
450
+ }), e.policyLines && Object.keys(e.policyLines).forEach((b) => {
451
+ b === a && e.policyLines && (f = e.policyLines[b]);
452
+ }), e.exposureGroups && Object.keys(e.exposureGroups).forEach((b) => {
453
+ b === a && e.exposureGroups && (f = e.exposureGroups[b]);
479
454
  }), f;
480
455
  }
481
- function me(t) {
456
+ function de(t) {
482
457
  return t == null ? void 0 : t.map((e) => (e.keyword === "pattern" && (e.message = `Invalid format, must match pattern ${e.params.pattern}`), e.keyword === "format" && (e.message = "Invalid format"), e.keyword === "required" && (e.message = "Required"), e.keyword === "minItems" && (e.message = `Must have at least ${e.params.limit} item${e.params.limit !== 1 ? "s" : ""}`), e.keyword === "maxItems" && (e.message = `Must have at most ${e.params.limit} item${e.params.limit !== 1 ? "s" : ""}`), e.keyword === "type" && (e.message = "Invalid format"), e.keyword === "maxLength" && (e.message = `Must be at most ${e.params.limit} character${e.params.limit !== 1 ? "s" : ""}`), e.keyword === "minLength" && (e.message = `Must be at least ${e.params.limit} character${e.params.limit !== 1 ? "s" : ""}`), e.keyword === "minimum" && (e.message = `Must be greater than or equal to ${e.params.limit}`), e.keyword === "maximum" && (e.message = `Must be less than or equal to ${e.params.limit}`), e.keyword === "enum" && (e.message = "Invalid value"), e));
483
458
  }
484
- const he = (t) => {
485
- var e, i, f, v, d, $;
459
+ const me = (t) => {
460
+ var e, a, f, b, d, g;
486
461
  return {
487
462
  ...((e = t == null ? void 0 : t.element) == null ? void 0 : e.data) && {
488
- ...(i = t == null ? void 0 : t.element) == null ? void 0 : i.data
463
+ ...(a = t == null ? void 0 : t.element) == null ? void 0 : a.data
489
464
  },
490
465
  default: {
491
466
  // set date to yyyy-MM-dd format if it exists
@@ -502,18 +477,21 @@ const he = (t) => {
502
477
  advanced: {
503
478
  currency: (t == null ? void 0 : t.currency) ?? void 0,
504
479
  timezone: (t == null ? void 0 : t.timezone) ?? void 0,
505
- billingPlan: ((v = (f = t == null ? void 0 : t.preferences) == null ? void 0 : f.billingPreferences) == null ? void 0 : v.billingPlanName) ?? void 0,
506
- installmentPlan: (($ = (d = t == null ? void 0 : t.preferences) == null ? void 0 : d.installmentPreferences) == null ? void 0 : $.installmentPlanName) ?? void 0,
480
+ billingPlan: ((b = (f = t == null ? void 0 : t.preferences) == null ? void 0 : f.billingPreferences) == null ? void 0 : b.billingPlanName) ?? void 0,
481
+ installmentPlan: ((g = (d = t == null ? void 0 : t.preferences) == null ? void 0 : d.installmentPreferences) == null ? void 0 : g.installmentPlanName) ?? void 0,
507
482
  durationBasis: (t == null ? void 0 : t.durationBasis) ?? void 0,
508
483
  delinquencyPlanName: (t == null ? void 0 : t.delinquencyPlanName) ?? void 0
509
484
  }
510
485
  };
511
- }, X = (t, e) => {
512
- for (const i of t) {
513
- if (i.locator === e)
514
- return i;
486
+ }, he = (t) => ({
487
+ ...t.data,
488
+ coverageTerms: t.coverageTerms ?? {}
489
+ }), X = (t, e) => {
490
+ for (const a of t) {
491
+ if (a.locator === e)
492
+ return a;
515
493
  const f = X(
516
- i.elements ?? [],
494
+ a.elements ?? [],
517
495
  e
518
496
  );
519
497
  if (f)
@@ -521,8 +499,8 @@ const he = (t) => {
521
499
  }
522
500
  return !1;
523
501
  }, ae = (t, e) => {
524
- var i, f;
525
- return ((i = t.element) == null ? void 0 : i.locator) === e ? t.element : X(
502
+ var a, f;
503
+ return ((a = t.element) == null ? void 0 : a.locator) === e ? t.element : X(
526
504
  ((f = t.element) == null ? void 0 : f.elements) ?? [],
527
505
  e
528
506
  );
@@ -532,67 +510,67 @@ const he = (t) => {
532
510
  }) => t.products[e] ?? {}, ce = (t) => {
533
511
  var f;
534
512
  t = t ?? "";
535
- const e = t.replace(/\?|\*|!|\+/g, ""), i = (f = t.match(/\?|\*|!|\+/g)) == null ? void 0 : f.pop();
513
+ const e = t.replace(/\?|\*|!|\+/g, ""), a = (f = t.match(/\?|\*|!|\+/g)) == null ? void 0 : f.pop();
536
514
  return {
537
515
  name: e,
538
- quantifier: i ?? ""
516
+ quantifier: a ?? ""
539
517
  };
540
518
  }, ue = ({
541
519
  dataModel: t,
542
520
  productDataModel: e
543
521
  }) => {
544
- const i = t.exposures ?? {}, f = t.coverages ?? {}, v = t.policyLines ?? {}, d = t.exposureGroups ?? {}, m = (e.contents ?? []).map((r) => {
545
- const { name: T } = ce(r);
546
- return T;
547
- }), M = Object.keys(i).filter(
548
- (r) => m.includes(r)
549
- ), k = Object.keys(f).filter(
550
- (r) => m.includes(r)
551
- ), V = Object.keys(v).filter(
552
- (r) => m.includes(r)
522
+ const a = t.exposures ?? {}, f = t.coverages ?? {}, b = t.policyLines ?? {}, d = t.exposureGroups ?? {}, p = (e.contents ?? []).map((r) => {
523
+ const { name: O } = ce(r);
524
+ return O;
525
+ }), M = Object.keys(a).filter(
526
+ (r) => p.includes(r)
527
+ ), P = Object.keys(f).filter(
528
+ (r) => p.includes(r)
529
+ ), C = Object.keys(b).filter(
530
+ (r) => p.includes(r)
553
531
  ), E = Object.keys(
554
532
  d
555
- ).filter((r) => m.includes(r)), p = {
533
+ ).filter((r) => p.includes(r)), h = {
556
534
  coverages: {},
557
535
  exposures: {},
558
536
  policyLines: {},
559
537
  exposureGroups: {}
560
538
  };
561
539
  for (const r of M)
562
- p.exposures[r] = i[r];
563
- for (const r of k)
564
- p.coverages[r] = f[r];
565
- for (const r of V)
566
- p.policyLines[r] = v[r];
540
+ h.exposures[r] = a[r];
541
+ for (const r of P)
542
+ h.coverages[r] = f[r];
543
+ for (const r of C)
544
+ h.policyLines[r] = b[r];
567
545
  for (const r of E)
568
- p.exposureGroups[r] = d[r];
569
- return p;
546
+ h.exposureGroups[r] = d[r];
547
+ return h;
570
548
  }, pe = ({
571
549
  dataModel: t,
572
550
  quote: e,
573
- elementLocator: i
551
+ elementLocator: a
574
552
  }) => {
575
- const f = ae(e, i);
553
+ const f = ae(e, a);
576
554
  if (!f)
577
555
  return {};
578
- const v = re({
556
+ const b = re({
579
557
  element: e,
580
558
  dataModel: t
581
559
  }), d = ue({
582
560
  dataModel: t,
583
- productDataModel: v
561
+ productDataModel: b
584
562
  });
585
- let $ = !1;
586
- const m = f.type.split("Quote")[0];
563
+ let g = !1;
564
+ const p = f.type.split("Quote")[0];
587
565
  return Object.keys(d.exposures).forEach((M) => {
588
- M === m && ($ = d.exposures[M]);
589
- }), $ || Object.keys(d.coverages).forEach((M) => {
590
- M === m && ($ = d.coverages[M]);
591
- }), $ || Object.keys(d.policyLines).forEach((M) => {
592
- M === m && ($ = d.policyLines[M]);
593
- }), $ || Object.keys(d.exposureGroups).forEach((M) => {
594
- M === m && ($ = d.exposureGroups[M]);
595
- }), $;
566
+ M === p && (g = d.exposures[M]);
567
+ }), g || Object.keys(d.coverages).forEach((M) => {
568
+ M === p && (g = d.coverages[M]);
569
+ }), g || Object.keys(d.policyLines).forEach((M) => {
570
+ M === p && (g = d.policyLines[M]);
571
+ }), g || Object.keys(d.exposureGroups).forEach((M) => {
572
+ M === p && (g = d.exposureGroups[M]);
573
+ }), g;
596
574
  };
597
575
  export {
598
576
  q as dataModelToJSONSchema,
@@ -600,14 +578,14 @@ export {
600
578
  ae as extractElementFromQuote,
601
579
  re as extractProductDataModel,
602
580
  ue as extractProductElements,
603
- oe as getAccountRequest,
604
- he as getDefaultValues,
605
- le as getQuoteElementRequest,
606
- fe as getQuoteRequest,
581
+ he as getDefaultElementValues,
582
+ me as getDefaultQuoteValues,
583
+ oe as getQuoteElementRequest,
584
+ le as getQuoteRequest,
607
585
  se as parseElementTypeAndScopeByElementType,
608
- de as retrieveDataModelFromElement,
586
+ fe as retrieveDataModelFromElement,
609
587
  ie as retrieveElementFromQuoteByLocator,
610
588
  ce as splitInputAndQuantifier,
611
- me as transformErrors
589
+ de as transformErrors
612
590
  };
613
591
  //# sourceMappingURL=index.es.js.map