bt-core-app 2.2.18 → 2.2.20

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.
@@ -1,9 +1,9 @@
1
1
  import { useAuth as Z } from "./auth.mjs";
2
- import { appendUrl as A, isNullOrEmpty as q, isLengthyArray as C } from "./helpers.mjs";
3
- import { ref as P, computed as k } from "vue";
2
+ import { appendUrl as A, isNullOrEmpty as q, isLengthyArray as I } from "./helpers.mjs";
3
+ import { ref as P, computed as T } from "vue";
4
4
  import "../bt-core/core/node_modules/@datasert/cronjs-matcher/dist/index.mjs";
5
5
  import { __exports as B } from "../_virtual/index.mjs";
6
- const w = [
6
+ const b = [
7
7
  { text: "12:00 AM", value: "0.0" },
8
8
  { text: "12:15 AM", value: "0.15" },
9
9
  { text: "12:30 AM", value: "0.30" },
@@ -134,64 +134,70 @@ const w = [
134
134
  { text: "Custom", value: "Custom" }
135
135
  ];
136
136
  function ee() {
137
- const { timeZone: i } = Z();
138
- function I(s) {
137
+ const { timeZone: r } = Z();
138
+ function D(s) {
139
139
  if (s.cron == null)
140
140
  return [];
141
- const L = s.cron.split(/\s+/).slice(0, 5).join(" ");
142
- return B.getFutureMatches(L, { matchCount: s.futureCount, formatInTimezone: !1, timezone: i.value });
141
+ const k = s.cron.split(/\s+/).slice(0, 5).join(" ");
142
+ return B.getFutureMatches(k, { matchCount: s.futureCount, formatInTimezone: !1, timezone: r.value });
143
143
  }
144
144
  return {
145
- predictFuture: I
145
+ predictFuture: D
146
146
  };
147
147
  }
148
- function te(i) {
149
- function I() {
148
+ function te(r) {
149
+ if (r == null)
150
+ return 0;
151
+ const D = r.split(/\s+/);
152
+ return D.length > 5 ? Number.parseInt(D[5].split("-")[0]) : 0;
153
+ }
154
+ function le(r) {
155
+ function D() {
150
156
  let e = "0 0 * * 1";
151
- return i.useLeadTimeLeft && (i.useLeadTimeRight ? e = A(e, `${R.value.toString()}-${O.value.toString()}`, " ") : e = A(e, R.value.toString(), " ")), e;
157
+ return r.useLeadTimeLeft && (r.useLeadTimeRight ? e = A(e, `${R.value.toString()}-${E.value.toString()}`, " ") : e = A(e, R.value.toString(), " ")), e;
152
158
  }
153
159
  const s = P();
154
- let L = "";
155
- const E = k({
160
+ let k = "";
161
+ const N = T({
156
162
  get() {
157
163
  return s.value;
158
164
  },
159
165
  set(e) {
160
- L = e;
166
+ k = e;
161
167
  }
162
- }), p = P(0), D = P(0), h = P("Custom"), f = k({
168
+ }), p = P(0), S = P(0), h = P("Custom"), f = T({
163
169
  get() {
164
170
  return h.value;
165
171
  },
166
172
  set(e) {
167
173
  h.value !== e && (h.value = e, W(e));
168
174
  }
169
- }), N = k(() => i.useLeadTimeInHours ? p.value : p.value / 60), R = k(() => i.useLeadTimeInHours ? p.value * 60 : p.value), O = k(() => i.useLeadTimeInHours ? D.value * 60 : D.value), c = P(), m = P(), d = P(), M = P();
170
- function b() {
171
- T(L ?? E.value);
175
+ }), w = T(() => r.useLeadTimeInHours ? p.value : p.value / 60), R = T(() => r.useLeadTimeInHours ? p.value * 60 : p.value), E = T(() => r.useLeadTimeInHours ? S.value * 60 : S.value), c = P(), m = P(), d = P(), M = P();
176
+ function O() {
177
+ C(k ?? N.value);
172
178
  }
173
179
  function W(e) {
174
180
  e == "Daily" ? (m.value = ["*"], d.value = ["*"], M.value = ["*"]) : e == "Weekly" ? (console.log("weeklying"), m.value = ["*"], d.value = ["*"], M.value = ["0"]) : e == "Monthly" && (m.value = ["*"], d.value = [_[0].value], M.value = [g[0].value]);
175
181
  }
176
182
  function j(e, u) {
177
- var n, l;
183
+ var i, l;
178
184
  e ?? (e = "0");
179
185
  const t = g.findIndex((x) => x.value == e || x.text == e);
180
186
  u ?? (u = 0);
181
- const a = (t + u) % 7, r = Math.ceil(u / 7);
182
- return r > 1 ? `${r} ${(n = g[a]) == null ? void 0 : n.text} Later` : (l = g[a]) == null ? void 0 : l.text;
187
+ const a = (t + u) % 7, n = Math.ceil(u / 7);
188
+ return n > 1 ? `${n} ${(i = g[a]) == null ? void 0 : i.text} Later` : (l = g[a]) == null ? void 0 : l.text;
183
189
  }
184
190
  function F(e) {
185
191
  if (c.value != null) {
186
- var u = w.find((r) => r.value == c.value);
192
+ var u = b.find((n) => n.value == c.value);
187
193
  if (u != null) {
188
- var t = Number.parseFloat(u.value) + N.value, a = Math.floor(t / 24);
194
+ var t = Number.parseFloat(u.value) + w.value, a = Math.floor(t / 24);
189
195
  return a == 0 ? "Same Day" : e == null ? `${a} Day${a == 1 ? "" : "s"} Later` : j(e, a);
190
196
  }
191
197
  }
192
198
  }
193
199
  function U() {
194
- var r, n;
200
+ var n, i;
195
201
  var e = {
196
202
  regularity: f.value,
197
203
  orderDays: [],
@@ -199,18 +205,18 @@ function te(i) {
199
205
  };
200
206
  if (f.value == "Daily") {
201
207
  if (c.value != null) {
202
- var u = w.find((l) => l.value == c.value);
208
+ var u = b.find((l) => l.value == c.value);
203
209
  if (u != null) {
204
210
  f.value == "Daily" && e.orderDays.push(u.text);
205
- var t = Number.parseFloat(u.value) + N.value, a = Math.floor(t / 24);
211
+ var t = Number.parseFloat(u.value) + w.value, a = Math.floor(t / 24);
206
212
  a == 0 ? e.deliveryDays.push("Same Day") : e.deliveryDays.push(`${a} Day${a == 1 ? "" : "s"} Later`);
207
213
  }
208
214
  }
209
215
  } else
210
- f.value == "Weekly" ? (r = M.value) == null || r.forEach((l) => {
216
+ f.value == "Weekly" ? (n = M.value) == null || n.forEach((l) => {
211
217
  var x = g.find((y) => y.value == l);
212
218
  x != null && (e.orderDays.push(x.text), e.deliveryDays.push(F(l) ?? ""));
213
- }) : f.value == "Monthly" && ((n = m.value) == null || n.forEach((l) => {
219
+ }) : f.value == "Monthly" && ((i = m.value) == null || i.forEach((l) => {
214
220
  var x = H.find((y) => y.value == l);
215
221
  x != null && (e.orderDays.push(x.text), e.deliveryDays.push(F(void 0) ?? ""));
216
222
  }));
@@ -220,17 +226,17 @@ function te(i) {
220
226
  var e;
221
227
  return (e = s.value) == null ? void 0 : e.split(/\s+/);
222
228
  }
223
- function T(e) {
229
+ function C(e) {
224
230
  if (s.value != e) {
225
231
  s.value = e;
226
- let t = !1, a = !1, r = !1, n = !1;
227
- if (q(s.value) || !C(J(), 4))
232
+ let t = !1, a = !1, n = !1, i = !1;
233
+ if (q(s.value) || !I(J(), 4))
228
234
  t = !0;
229
235
  else {
230
236
  const l = J();
231
237
  t = !1;
232
238
  var u = `${l[1]}.${l[0]}`;
233
- u.includes(",") || u.includes("-") || u.includes("/") ? t = !0 : w.some((v) => v.value == u) ? c.value = u : t = !0;
239
+ u.includes(",") || u.includes("-") || u.includes("/") ? t = !0 : b.some((v) => v.value == u) ? c.value = u : t = !0;
234
240
  const x = l[2];
235
241
  if (x.includes("/"))
236
242
  t = !0;
@@ -239,87 +245,88 @@ function te(i) {
239
245
  else {
240
246
  a = !1;
241
247
  const v = x.split(",");
242
- v.some((o) => !_.some((S) => S.value == o)) ? t = !0 : d.value = v;
248
+ v.some((o) => !_.some((L) => L.value == o)) ? t = !0 : d.value = v;
243
249
  }
244
250
  const y = l[3];
245
251
  if (y.includes("-") || y.includes("/"))
246
252
  t = !0;
247
253
  else if (y == "*")
248
- n = !0;
254
+ i = !0;
249
255
  else {
250
- n = !1;
256
+ i = !1;
251
257
  const v = y.split(",");
252
- v.some((o) => !H.some((S) => S.value == o)) ? t = !0 : m.value = v;
258
+ v.some((o) => !H.some((L) => L.value == o)) ? t = !0 : m.value = v;
253
259
  }
254
260
  const $ = l[4];
255
261
  if ($.includes("-") || $.includes("/"))
256
262
  t = !0;
257
263
  else if ($ == "*")
258
- r = !0, M.value = g.map((v) => v.value);
264
+ n = !0, M.value = g.map((v) => v.value);
259
265
  else {
260
- r = !1;
266
+ n = !1;
261
267
  const v = $.split(",");
262
- v.some((o) => !g.some((S) => S.value == o)) ? t = !0 : M.value = v;
268
+ v.some((o) => !g.some((L) => L.value == o)) ? t = !0 : M.value = v;
263
269
  }
264
- if (C(l, 5) && i.useLeadTimeLeft) {
270
+ if (I(l, 5) && r.useLeadTimeLeft) {
265
271
  const v = l[5].split("-");
266
- if (i.useLeadTimeRight && v.length > 1) {
272
+ if (r.useLeadTimeRight && v.length > 1) {
267
273
  const o = Number.parseInt(v[1]);
268
- D.value = i.useLeadTimeInHours ? Math.round(o / 60) : o;
274
+ S.value = r.useLeadTimeInHours ? Math.round(o / 60) : o;
269
275
  }
270
276
  if (v.length > 0) {
271
277
  const o = Number.parseInt(v[0]);
272
- p.value = i.useLeadTimeInHours ? Math.round(o / 60) : o;
278
+ p.value = r.useLeadTimeInHours ? Math.round(o / 60) : o;
273
279
  }
274
280
  }
275
281
  }
276
- t ? f.value = "Custom" : n && a && r ? h.value = "Daily" : n && a ? h.value = "Weekly" : n ? h.value = "Monthly" : h.value = "Custom";
282
+ t ? f.value = "Custom" : i && a && n ? h.value = "Daily" : i && a ? h.value = "Weekly" : i ? h.value = "Monthly" : h.value = "Custom";
277
283
  }
278
284
  return {
279
- applyRawExpression: b,
285
+ applyRawExpression: O,
280
286
  applyRegularity: W,
281
287
  cronExpression: s,
282
288
  hour: c,
283
289
  leadTimeLeft: p,
284
- leadTimeRight: D,
290
+ leadTimeRight: S,
285
291
  months: m,
286
292
  pack: z,
287
- rawExpression: E,
293
+ rawExpression: N,
288
294
  regularity: f,
289
- unpack: T,
295
+ unpack: C,
290
296
  weekdays: M,
291
297
  weeks: d
292
298
  };
293
299
  }
294
300
  function z() {
295
- var u, t, a, r, n, l;
301
+ var u, t, a, n, i, l;
296
302
  if (f.value == "Custom")
297
303
  return s.value;
298
304
  let e = `${(u = c.value) == null ? void 0 : u.split(".")[1]} ${(t = c.value) == null ? void 0 : t.split(".")[0]}`;
299
- return C(d.value) ? e = A(e, (a = d.value) == null ? void 0 : a.toString(), " ") : e = A(e, "*", " "), C(m.value) ? e = A(e, (r = m.value) == null ? void 0 : r.toString(), " ") : e = A(e, "*", " "), ((n = M.value) == null ? void 0 : n.length) == 7 ? e = A(e, "*", " ") : e = A(e, (l = M.value) == null ? void 0 : l.toString(), " "), e = A(e, `${R.value}-${O.value}`, " "), s.value = e, s.value;
305
+ return I(d.value) ? e = A(e, (a = d.value) == null ? void 0 : a.toString(), " ") : e = A(e, "*", " "), I(m.value) ? e = A(e, (n = m.value) == null ? void 0 : n.toString(), " ") : e = A(e, "*", " "), ((i = M.value) == null ? void 0 : i.length) == 7 ? e = A(e, "*", " ") : e = A(e, (l = M.value) == null ? void 0 : l.toString(), " "), e = A(e, `${R.value}-${E.value}`, " "), s.value = e, s.value;
300
306
  }
301
- return T(i.value ?? i.defaultExpression ?? I()), {
302
- applyRawExpression: b,
307
+ return C(r.value ?? r.defaultExpression ?? D()), {
308
+ applyRawExpression: O,
303
309
  applyRegularity: W,
304
310
  cronExpression: s,
305
311
  getRegularityAndOrderAndDeliveryDays: U,
306
312
  hour: c,
307
313
  leadTimeLeft: p,
308
- leadTimeRight: D,
314
+ leadTimeRight: S,
309
315
  months: m,
310
316
  pack: z,
311
- rawExpression: E,
317
+ rawExpression: N,
312
318
  regularity: f,
313
- unpack: T,
319
+ unpack: C,
314
320
  weekdays: M,
315
321
  weeks: d
316
322
  };
317
323
  }
318
324
  export {
319
- w as hourOptions,
325
+ te as getLeadTime,
326
+ b as hourOptions,
320
327
  H as monthOptions,
321
328
  Y as regularityOptions,
322
- te as useCron,
329
+ le as useCron,
323
330
  ee as useCronPredictor,
324
331
  _ as weekOptions,
325
332
  g as weekdayOptions