@picked/client 0.0.1-dev.1764739911676 → 0.0.1-dev.1764789407645

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/esm/index.js CHANGED
@@ -1,55 +1,55 @@
1
- var X = Object.defineProperty;
2
- var Z = (t, e, r) => e in t ? X(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
- var m = (t, e, r) => Z(t, typeof e != "symbol" ? e + "" : e, r);
4
- import { createDomain as F, createApi as I, createStore as L, createEffect as j, sample as b, attach as ee, combine as C, createEvent as O } from "effector";
1
+ var Y = Object.defineProperty;
2
+ var J = (t, e, r) => e in t ? Y(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var m = (t, e, r) => J(t, typeof e != "symbol" ? e + "" : e, r);
4
+ import { createDomain as F, createApi as b, createEffect as U, attach as Q, sample as x, combine as O, createEvent as C } from "effector";
5
5
  import { createFactory as k, invoke as w } from "@withease/factories";
6
- import { g as H, t as te, c as re, i as se, e as P, a as ne, b as ie, d as oe } from "../experience-instance-C4INDX6a.js";
7
- import { f as kt } from "../experience-instance-C4INDX6a.js";
8
- import { l as S } from "../logger-C9a75KZn.js";
9
- import { c as B, s as D, l as U } from "../storage-Cb_71y48.js";
10
- import { a as bt } from "../storage-Cb_71y48.js";
11
- import { g as ae } from "../id-BW-g3y32.js";
12
- import { i as ce } from "../object-JwZ58NOH.js";
13
- import { s as q, a as ue, b as le, c as de, d as pe } from "../supports-BjhuLJ8z.js";
14
- import { h as It, f as xt, j as Et, e as Pt, g as Rt, i as Bt, k as At } from "../supports-BjhuLJ8z.js";
15
- const K = F("experience"), ge = k(
6
+ import { g as L, t as X, c as Z, i as ee, e as E, a as te, b as re, d as se } from "../experience-instance-C4INDX6a.js";
7
+ import { f as St } from "../experience-instance-C4INDX6a.js";
8
+ import { l as v } from "../logger-C9a75KZn.js";
9
+ import { c as B, s as j, l as D } from "../storage-Cb_71y48.js";
10
+ import { a as kt } from "../storage-Cb_71y48.js";
11
+ import { g as ne } from "../id-BW-g3y32.js";
12
+ import { i as ie } from "../object-JwZ58NOH.js";
13
+ import { s as H, a as oe, b as ae, c as ce, d as ue } from "../supports-BjhuLJ8z.js";
14
+ import { h as It, f as Ft, j as bt, e as xt, g as Et, i as Pt, k as Rt } from "../supports-BjhuLJ8z.js";
15
+ const K = F("experience"), le = k(
16
16
  ({ client: t, experience: e }) => {
17
- const r = K.store(e), n = I(r, {
18
- merge(c, f) {
17
+ const r = K.store(e), n = b(r, {
18
+ merge(u, h) {
19
19
  return {
20
- ...c,
21
- ...f.experience
20
+ ...u,
21
+ ...h.experience
22
22
  };
23
23
  }
24
- }), u = r.map((c) => ({
25
- name: c.name,
26
- decisionLogic: c.condition ?? c.decide,
27
- targetSelectors: c.targets,
24
+ }), o = r.map((u) => ({
25
+ name: u.name,
26
+ decisionLogic: u.condition ?? u.decide,
27
+ targetSelectors: u.targets,
28
28
  initializeOpenLogic: e.initializeOpen
29
- })), p = t.components.listStore.map(
30
- (c) => c.find((f) => f.name === `experience:${e.id}`) || c.find((f) => f.name === "experience"),
29
+ })), l = t.components.listStore.map(
30
+ (u) => u.find((h) => h.name === `experience:${e.id}`) || u.find((h) => h.name === "experience"),
31
31
  { skipVoid: !1 }
32
- ), s = r.map((c) => ({
33
- steps: c.steps,
34
- nodes: c.nodes,
35
- edges: c.edges,
36
- conditionals: c.conditionals
32
+ ), s = r.map((u) => ({
33
+ steps: u.steps,
34
+ nodes: u.nodes,
35
+ edges: u.edges,
36
+ conditionals: u.conditionals
37
37
  })), i = e.actions ?? [];
38
38
  return {
39
39
  id: e.id,
40
- configStore: u,
40
+ configStore: o,
41
41
  treeStore: s,
42
- componentStore: p,
42
+ componentStore: l,
43
43
  actions: i,
44
44
  merge: n.merge
45
45
  };
46
46
  }
47
47
  );
48
- function fe(t) {
49
- return w(ge, t);
48
+ function de(t) {
49
+ return w(le, t);
50
50
  }
51
- const me = k(({ client: t }) => {
52
- const e = K.store({}), r = I(e, {
51
+ const pe = k(({ client: t }) => {
52
+ const e = K.store({}), r = b(e, {
53
53
  register(s, i) {
54
54
  return {
55
55
  ...s,
@@ -63,47 +63,47 @@ const me = k(({ client: t }) => {
63
63
  i.merge({ experience: s, strategy: "override" });
64
64
  return;
65
65
  }
66
- const c = fe({ client: t, experience: s });
67
- r.register(c);
66
+ const u = de({ client: t, experience: s });
67
+ r.register(u);
68
68
  }
69
- const u = e.map((s) => Object.values(s));
70
- function p(s) {
69
+ const o = e.map((s) => Object.values(s));
70
+ function l(s) {
71
71
  return e.map((i) => i[s], { skipVoid: !1 });
72
72
  }
73
73
  return {
74
74
  register: n,
75
- getById: p,
76
- listStore: u
75
+ getById: l,
76
+ listStore: o
77
77
  };
78
78
  });
79
- function he(t) {
80
- return w(me, t);
79
+ function ge(t) {
80
+ return w(pe, t);
81
81
  }
82
- const ye = (t, e) => {
82
+ const fe = (t, e) => {
83
83
  e.register(t);
84
- }, G = (t, e) => {
85
- const { targetSelectors: r } = e.configStore.getState(), n = H(r, e.id);
84
+ }, q = (t, e) => {
85
+ const { targetSelectors: r } = e.configStore.getState(), n = L(r, e.id);
86
86
  n.forEach(
87
- ({ elements: p }) => p.forEach((s) => te(s, e.id))
88
- ), re(n, e.id).forEach((p) => {
89
- t.experienceInstances.spawn(e, p);
87
+ ({ elements: l }) => l.forEach((s) => X(s, e.id))
88
+ ), Z(n, e.id).forEach((l) => {
89
+ t.experienceInstances.spawn(e, l);
90
90
  });
91
- }, V = async (t) => {
91
+ }, M = async (t) => {
92
92
  await Promise.all(
93
93
  t.experiences.listStore.getState().map(async (e) => {
94
- await ve(t, e) && G(t, e);
94
+ await me(t, e) && q(t, e);
95
95
  })
96
96
  );
97
- }, ve = async (t, e) => {
97
+ }, me = async (t, e) => {
98
98
  const { decisionLogic: r, targetSelectors: n } = e.configStore.getState();
99
- return H(n, e.id).length < 1 || n.length === 0 ? !1 : r && se(r) ? await P(t, r) === !0 : !0;
100
- }, Se = (t, e, r) => {
101
- const n = e.name, u = e.setup(t);
102
- if (u) {
103
- const p = r[n] ?? {};
104
- r[n] = Object.freeze({ ...p, ...u });
105
- }
106
- }, ke = F("component"), we = k(
99
+ return L(n, e.id).length < 1 || n.length === 0 ? !1 : r && ee(r) ? await E(t, r) === !0 : !0;
100
+ }, he = (t, e, r) => {
101
+ const n = e.name, o = e.setup(t);
102
+ if (o) {
103
+ const l = r[n] ?? {};
104
+ r[n] = Object.freeze({ ...l, ...o });
105
+ }
106
+ }, ye = F("component"), Se = k(
107
107
  ({ client: t, component: e, name: r }) => {
108
108
  const n = t.frameworks.getByName(e.frameworkName);
109
109
  return {
@@ -113,11 +113,11 @@ const ye = (t, e) => {
113
113
  };
114
114
  }
115
115
  );
116
- function be(t) {
117
- return w(we, t);
116
+ function ve(t) {
117
+ return w(Se, t);
118
118
  }
119
- const Fe = k(({ client: t }) => {
120
- const e = ke.store({}), r = I(e, {
119
+ const ke = k(({ client: t }) => {
120
+ const e = ye.store({}), r = b(e, {
121
121
  register(s, i) {
122
122
  return {
123
123
  ...s,
@@ -126,30 +126,30 @@ const Fe = k(({ client: t }) => {
126
126
  }
127
127
  });
128
128
  function n(s, i) {
129
- e.getState()[s] && S(
129
+ e.getState()[s] && v(
130
130
  "warn",
131
131
  `Component '${s}' already registered. Registering again will override the previous registration.`
132
132
  );
133
- const f = be({ client: t, name: s, component: i });
134
- r.register(f);
133
+ const h = ve({ client: t, name: s, component: i });
134
+ r.register(h);
135
135
  }
136
- const u = e.map((s) => Object.values(s));
137
- function p(s) {
136
+ const o = e.map((s) => Object.values(s));
137
+ function l(s) {
138
138
  return e.map((i) => i[s], { skipVoid: !1 });
139
139
  }
140
140
  return {
141
141
  register: n,
142
- getByName: p,
143
- listStore: u
142
+ getByName: l,
143
+ listStore: o
144
144
  };
145
145
  });
146
- function Ie(t) {
147
- return w(Fe, t);
146
+ function we(t) {
147
+ return w(ke, t);
148
148
  }
149
- const M = (t, e, r) => {
149
+ const V = (t, e, r) => {
150
150
  r.register(t, e);
151
- }, xe = F("framework"), Ee = k(({ client: t }) => {
152
- const e = xe.store({}), r = I(e, {
151
+ }, Ie = F("framework"), Fe = k(({ client: t }) => {
152
+ const e = Ie.store({}), r = b(e, {
153
153
  register(s, i) {
154
154
  return {
155
155
  ...s,
@@ -158,49 +158,49 @@ const M = (t, e, r) => {
158
158
  }
159
159
  });
160
160
  function n(s, i) {
161
- e.getState()[s] && S(
161
+ e.getState()[s] && v(
162
162
  "warn",
163
163
  `Framework '${s}' already registered. Registering again will override the previous registration.`
164
164
  ), r.register({ name: s, framework: i });
165
165
  }
166
- const u = e.map((s) => Object.values(s));
167
- function p(s) {
166
+ const o = e.map((s) => Object.values(s));
167
+ function l(s) {
168
168
  return e.map((i) => i[s], { skipVoid: !1 });
169
169
  }
170
170
  return {
171
171
  register: n,
172
- getByName: p,
173
- listStore: u
172
+ getByName: l,
173
+ listStore: o
174
174
  };
175
175
  });
176
- function Pe(t) {
177
- return w(Ee, t);
176
+ function be(t) {
177
+ return w(Fe, t);
178
178
  }
179
- const Re = (t, e) => {
179
+ const xe = (t, e) => {
180
180
  e.register(t.name, t);
181
- }, Be = 6e3, T = B("last_ping", "global"), Ae = (t) => `${t}/api/v1/ping`, $e = async (t) => {
181
+ }, Ee = 6e3, T = B("last_ping", "global"), Pe = (t) => `${t}/api/v1/ping`, Re = async (t) => {
182
182
  try {
183
183
  const e = Date.now(), r = localStorage.getItem(T);
184
- if (r && e - parseInt(r) < Be)
184
+ if (r && e - parseInt(r) < Ee)
185
185
  return !0;
186
- const n = Ae(t.apiUrl), u = {
186
+ const n = Pe(t.apiUrl), o = {
187
187
  projectId: t.projectId,
188
188
  path: window.location.pathname
189
- }, p = JSON.stringify(u), s = {
189
+ }, l = JSON.stringify(o), s = {
190
190
  "Content-Type": "application/json"
191
- }, i = document.getElementById("picked_script"), c = i == null ? void 0 : i.dataset.verceltoken;
192
- c && (s["x-vercel-protection-bypass"] = c);
193
- const h = (await fetch(n, {
191
+ }, i = document.getElementById("picked_script"), u = i == null ? void 0 : i.dataset.verceltoken;
192
+ u && (s["x-vercel-protection-bypass"] = u);
193
+ const S = (await fetch(n, {
194
194
  method: "POST",
195
195
  headers: s,
196
- body: p
196
+ body: l
197
197
  })).ok;
198
- return h && localStorage.setItem(T, e.toString()), h;
198
+ return S && localStorage.setItem(T, e.toString()), S;
199
199
  } catch (e) {
200
- return S("error", e), !1;
200
+ return v("error", e), !1;
201
201
  }
202
202
  };
203
- function W(t) {
203
+ function Be(t) {
204
204
  const e = typeof window < "u", r = {
205
205
  client: t,
206
206
  responses: t.responses.listStore.getState(),
@@ -212,274 +212,229 @@ function W(t) {
212
212
  };
213
213
  return Object.freeze(r);
214
214
  }
215
- const je = F("predicate"), De = k(({ client: t }) => {
216
- const e = je.store({}), r = I(e, {
217
- register(i, c) {
215
+ const Ae = F("predicate"), $e = k(({ client: t }) => {
216
+ const e = Ae.store({}), r = b(e, {
217
+ register(s, i) {
218
218
  return {
219
- ...i,
220
- [c.name]: {
221
- name: c.name,
222
- predicate: c.predicate
219
+ ...s,
220
+ [i.name]: {
221
+ name: i.name,
222
+ predicate: i.predicate
223
223
  }
224
224
  };
225
225
  }
226
226
  });
227
- function n(i, c) {
228
- e.getState()[i] && S(
227
+ function n(s, i) {
228
+ e.getState()[s] && v(
229
229
  "warn",
230
- `Predicate '${i}' already registered. Registering again will override the previous registration.`
231
- ), r.register(Object.freeze({ name: i, predicate: c }));
232
- }
233
- const u = e.map((i) => Object.values(i));
234
- function p(i) {
235
- return e.map((c) => {
236
- var f;
237
- return (f = c[i]) == null ? void 0 : f.predicate;
238
- }, { skipVoid: !1 });
239
- }
240
- function s(i) {
241
- const c = L(() => {
242
- }, {
243
- skipVoid: !1
244
- }), f = j(async () => {
245
- const h = p(i).getState();
246
- if (!h)
247
- return;
248
- const x = W(t);
249
- return () => h(x);
250
- });
251
- return b({
252
- source: { responses: t.responses.listStore, fields: t.fields.listStore },
253
- target: f
254
- }), b({
255
- clock: f.doneData,
256
- filter: (h) => h !== void 0,
257
- target: c
258
- }), f(), c;
230
+ `Predicate '${s}' already registered. Registering again will override the previous registration.`
231
+ ), r.register(Object.freeze({ name: s, predicate: i }));
232
+ }
233
+ const o = e.map((s) => Object.values(s));
234
+ function l(s) {
235
+ return e.map((i) => i[s], { skipVoid: !1 });
259
236
  }
260
237
  return {
261
238
  register: n,
262
- getByName: p,
263
- listStore: u,
264
- getEvokablePredicate: s
239
+ getByName: l,
240
+ listStore: o
265
241
  };
266
242
  });
267
- function Ce(t) {
268
- return w(De, t);
243
+ function je(t) {
244
+ return w($e, t);
269
245
  }
270
246
  const Oe = (t, e, r) => {
271
247
  r.register(t, e);
272
- }, z = F("feature"), Ue = k(({ client: t }) => {
273
- const e = z.store({}), r = z.store([]), n = I(e, {
274
- register(o, l) {
248
+ }, N = F("feature"), Ce = k(({ client: t }) => {
249
+ const e = N.store({}), r = N.store([]), n = b(e, {
250
+ register(d, c) {
275
251
  return {
276
- ...o,
277
- [l.id]: l.feature
252
+ ...d,
253
+ [c.id]: c.feature
278
254
  };
279
255
  }
280
256
  });
281
- function u(o, l) {
282
- e.getState()[o] && S(
257
+ function o(d, c) {
258
+ e.getState()[d] && v(
283
259
  "warn",
284
- `Feature '${o}' already registered. Registering again will override the previous registration.`
260
+ `Feature '${d}' already registered. Registering again will override the previous registration.`
285
261
  );
286
- const g = {
287
- id: o,
262
+ const p = {
263
+ id: d,
288
264
  feature: {
289
- ...l,
290
- id: o
265
+ ...c,
266
+ id: d
291
267
  }
292
268
  };
293
269
  n.register(
294
270
  Object.freeze({
295
- id: o,
296
- feature: g
271
+ id: d,
272
+ feature: p
297
273
  })
298
274
  );
299
275
  }
300
- const p = j(
276
+ const l = U(
301
277
  async ({
302
- id: o,
303
- key: l,
278
+ id: d,
279
+ key: c,
304
280
  storage: a = "local"
305
281
  }) => {
306
- const g = B(`feature:${o}:${l}`, "global"), y = (a === "session" ? D : U).get(g).boolean();
307
- return y === null ? null : { id: o, key: l, bucket: y, storage: a };
282
+ const p = B(`feature:${d}:${c}`, "global"), g = (a === "session" ? j : D).get(p).boolean();
283
+ return g === null ? null : { id: d, key: c, bucket: g, storage: a };
308
284
  }
309
- ), s = j((o) => {
310
- if (!o)
285
+ ), s = U((d) => {
286
+ if (!d)
311
287
  return null;
312
- const l = B(`feature:${o.id}:${o.key}`, "global");
313
- (o.storage === "session" ? D : U).set(l, o.bucket);
314
- }), i = /* @__PURE__ */ new Map(), c = ee({
288
+ const c = B(`feature:${d.id}:${d.key}`, "global");
289
+ (d.storage === "session" ? j : D).set(c, d.bucket);
290
+ }), i = /* @__PURE__ */ new Map(), u = Q({
315
291
  source: { allFeaturesStore: e, resolvedFeaturesStore: r },
316
- effect: async ({ allFeaturesStore: o, resolvedFeaturesStore: l }, { id: a, decide: g, key: d }) => {
317
- const y = l.find(
318
- ($) => $.id === a && $.key === d
292
+ effect: async ({ allFeaturesStore: d, resolvedFeaturesStore: c }, { id: a, decide: p, key: f }) => {
293
+ const g = c.find(
294
+ ($) => $.id === a && $.key === f
319
295
  );
320
- if (y)
321
- return y;
322
- const v = o[a];
323
- if (!v)
296
+ if (g)
297
+ return g;
298
+ const y = d[a];
299
+ if (!y)
324
300
  throw new Error(`Feature with id '${a}' not found`);
325
- const A = i.get(`${a}:${d}`);
326
- if (A !== void 0) {
327
- const $ = await A;
328
- return { id: v.id, bucket: $, key: d, storage: v.feature.storage };
301
+ const I = i.get(`${a}:${f}`);
302
+ if (I !== void 0) {
303
+ const $ = await I;
304
+ return { id: y.id, bucket: $, key: f, storage: y.feature.storage };
329
305
  }
330
- const E = g();
331
- i.set(`${a}:${d}`, E);
332
- const Q = await E;
333
- return { id: v.id, bucket: Q, key: d, storage: v.feature.storage };
306
+ const A = p();
307
+ i.set(`${a}:${f}`, A);
308
+ const P = await A;
309
+ return { id: y.id, bucket: P, key: f, storage: y.feature.storage };
334
310
  }
335
311
  });
336
- b({
312
+ x({
337
313
  clock: n.register,
338
- fn: (o) => {
339
- const { id: l, feature: a } = o;
340
- return { id: l, key: a.feature.key, storage: a.feature.storage };
314
+ fn: (d) => {
315
+ const { id: c, feature: a } = d;
316
+ return { id: c, key: a.feature.key, storage: a.feature.storage };
341
317
  },
342
- target: p
343
- }), b({
318
+ target: l
319
+ }), x({
344
320
  source: e,
345
- clock: c.doneData,
346
- fn: (o, l) => {
347
- var v;
348
- const { id: a, bucket: g, storage: d } = l, y = (v = o[a]) == null ? void 0 : v.feature.key;
349
- return y ? { key: y, id: a, bucket: g, storage: d } : null;
321
+ clock: u.doneData,
322
+ fn: (d, c) => {
323
+ var y;
324
+ const { id: a, bucket: p, storage: f } = c, g = (y = d[a]) == null ? void 0 : y.feature.key;
325
+ return g ? { key: g, id: a, bucket: p, storage: f } : null;
350
326
  },
351
327
  target: s
352
328
  });
353
- const f = C({ allFeaturesStore: e, resolvedFeaturesStore: r }).map(
329
+ const h = O({ allFeaturesStore: e, resolvedFeaturesStore: r }).map(
354
330
  ({
355
- allFeaturesStore: o,
356
- resolvedFeaturesStore: l
357
- }) => Object.values(o).map((a) => {
358
- const g = l.find(
359
- (d) => d.id === a.id && d.key === a.feature.key
331
+ allFeaturesStore: d,
332
+ resolvedFeaturesStore: c
333
+ }) => Object.values(d).map((a) => {
334
+ const p = c.find(
335
+ (f) => f.id === a.id && f.key === a.feature.key
360
336
  );
361
- return g ? {
337
+ return p ? {
362
338
  id: a.id,
363
339
  name: a.feature.name,
364
340
  key: a.feature.key,
365
- getBucket: () => ({ id: a.id, bucket: g.bucket }),
341
+ getBucket: () => ({ id: a.id, bucket: p.bucket }),
366
342
  isResolved: !0
367
343
  } : {
368
344
  id: a.id,
369
345
  name: a.feature.name,
370
346
  key: a.feature.key,
371
- getBucket: async () => await c(a.feature),
347
+ getBucket: async () => await u(a.feature),
372
348
  isResolved: !1
373
349
  };
374
350
  })
375
351
  );
376
- b({
377
- clock: c.doneData,
352
+ x({
353
+ clock: u.doneData,
378
354
  source: { resolvedFeatures: r },
379
- filter: ({ resolvedFeatures: o }, { id: l, key: a }) => !o.some(
380
- (d) => d.id === l && d.key === a
355
+ filter: ({ resolvedFeatures: d }, { id: c, key: a }) => !d.some(
356
+ (f) => f.id === c && f.key === a
381
357
  ),
382
- fn: (o, l) => l,
383
- target: t.eventBus.prepend((o) => ({
358
+ fn: (d, c) => c,
359
+ target: t.eventBus.prepend((d) => ({
384
360
  type: "feature_decide",
385
- feature: o
361
+ feature: d
386
362
  }))
387
- }), b({
388
- clock: [p.doneData, c.doneData],
363
+ }), x({
364
+ clock: [l.doneData, u.doneData],
389
365
  source: r,
390
- fn: (o, l) => !l || o.some(
391
- (g) => g.id === l.id && g.key === l.key
392
- ) ? o : [...o, l],
366
+ fn: (d, c) => !c || d.some(
367
+ (p) => p.id === c.id && p.key === c.key
368
+ ) ? d : [...d, c],
393
369
  target: r
394
370
  });
395
- function h(o) {
396
- return f.map((l) => l.find((a) => a.id === o));
397
- }
398
- function x(o) {
399
- const l = L(
400
- async () => {
401
- },
402
- { skipVoid: !1 }
403
- ), a = j(async () => {
404
- const g = h(o).getState();
405
- if (g)
406
- return async () => (await g.getBucket()).bucket;
407
- });
408
- return b({
409
- source: r,
410
- filter: (g) => g.some((d) => d.id === o),
411
- target: a
412
- }), b({
413
- clock: a.doneData,
414
- filter: (g) => g !== void 0,
415
- target: l
416
- }), a(), l;
371
+ function S(d) {
372
+ return e.map((c) => c[d], { skipVoid: !1 });
417
373
  }
418
374
  return {
419
- register: u,
420
- getById: h,
421
- listStore: f,
422
- getEvokableFeature: x
375
+ register: o,
376
+ getByName: S,
377
+ listStore: h
423
378
  };
424
379
  });
425
- function Ve(t) {
426
- return w(Ue, t);
380
+ function De(t) {
381
+ return w(Ce, t);
427
382
  }
428
- const Me = (t, e, r) => {
383
+ const Ue = (t, e, r) => {
429
384
  r.register(t, e);
430
385
  }, R = F("history");
431
- function N(t, e) {
386
+ function z(t, e) {
432
387
  return {
433
388
  // eslint-disable-next-line sonarjs/pseudo-random
434
- id: ae(`history-entry-${Date.now()}-${Math.random()}}`),
389
+ id: ne(`history-entry-${Date.now()}-${Math.random()}}`),
435
390
  node: e,
436
391
  at: Date.now(),
437
392
  experienceId: t
438
393
  };
439
394
  }
440
- const Te = k(() => {
441
- const t = R.store({ entries: [] }), e = R.event(), r = R.event(), n = R.event(), u = R.event();
395
+ const Me = k(() => {
396
+ const t = R.store({ entries: [] }), e = R.event(), r = R.event(), n = R.event(), o = R.event();
442
397
  t.on(e, (s, i) => ({
443
- entries: [...s.entries, N(i.experienceId, i.node)]
398
+ entries: [...s.entries, z(i.experienceId, i.node)]
444
399
  })), t.on(r, (s, i) => ({
445
400
  entries: [
446
401
  ...s.entries.slice(0, -1),
447
- N(i.experienceId, i.node)
402
+ z(i.experienceId, i.node)
448
403
  ]
449
- })), t.on(u, (s, i) => i);
450
- function p(s, i) {
451
- const c = { lastStepIndex: -1, secondLastStepIndex: -1 };
452
- for (let f = s.length - 1; f >= 0; f--) {
453
- const h = s[f], x = h == null ? void 0 : h.node;
454
- if (!(!x || !ne(x)) && !(i && (h == null ? void 0 : h.experienceId) !== i))
455
- if (c.lastStepIndex === -1)
456
- c.lastStepIndex = f;
404
+ })), t.on(o, (s, i) => i);
405
+ function l(s, i) {
406
+ const u = { lastStepIndex: -1, secondLastStepIndex: -1 };
407
+ for (let h = s.length - 1; h >= 0; h--) {
408
+ const S = s[h], d = S == null ? void 0 : S.node;
409
+ if (!(!d || !te(d)) && !(i && (S == null ? void 0 : S.experienceId) !== i))
410
+ if (u.lastStepIndex === -1)
411
+ u.lastStepIndex = h;
457
412
  else {
458
- c.secondLastStepIndex = f;
413
+ u.secondLastStepIndex = h;
459
414
  break;
460
415
  }
461
416
  }
462
- return c;
417
+ return u;
463
418
  }
464
419
  return t.on(n, (s, i) => {
465
- const { secondLastStepIndex: c } = p(s.entries, i.experienceId), f = c !== -1 ? s.entries.slice(0, c + 1) : s.entries;
420
+ const { secondLastStepIndex: u } = l(s.entries, i.experienceId), h = u !== -1 ? s.entries.slice(0, u + 1) : s.entries;
466
421
  return {
467
422
  ...s,
468
- entries: f
423
+ entries: h
469
424
  };
470
425
  }), {
471
426
  push: e,
472
427
  replace: r,
473
428
  back: n,
474
- restore: u,
429
+ restore: o,
475
430
  entriesStore: t.map((s) => s.entries)
476
431
  };
477
432
  });
478
- function ze() {
479
- return w(Te);
433
+ function Ve() {
434
+ return w(Me);
480
435
  }
481
- const Ne = () => O(), _e = F("field"), Le = k(() => {
482
- const t = _e.store({}), e = I(t, {
436
+ const Te = () => C(), Ne = F("field"), ze = k(() => {
437
+ const t = Ne.store({}), e = b(t, {
483
438
  register(s, i) {
484
439
  return {
485
440
  ...s,
@@ -491,209 +446,194 @@ const Ne = () => O(), _e = F("field"), Le = k(() => {
491
446
  e.register({ field: s });
492
447
  }
493
448
  const n = t.map((s) => Object.values(s));
494
- function u(s) {
449
+ function o(s) {
495
450
  return t.map((i) => i[s] || null);
496
451
  }
497
- function p(s) {
498
- return t.map((i) => Object.values(i).find((c) => c.name === s) || null);
452
+ function l(s) {
453
+ return t.map((i) => Object.values(i).find((u) => u.name === s) || null);
499
454
  }
500
455
  return {
501
456
  register: r,
502
- getById: u,
457
+ getById: o,
503
458
  listStore: n,
504
- getByName: p
459
+ getByName: l
505
460
  };
506
461
  });
507
- function He() {
508
- return w(Le);
462
+ function _e() {
463
+ return w(ze);
509
464
  }
510
- const qe = (t, e) => {
465
+ const Le = (t, e) => {
511
466
  e.register(t);
512
- }, Ke = F("action"), Ge = k(() => {
513
- const t = Ke.store({}), e = I(t, {
514
- register(s, i) {
467
+ }, He = F("action"), Ke = k(() => {
468
+ const t = He.store({}), e = b(t, {
469
+ register(l, s) {
515
470
  return {
516
- ...s,
517
- [i.name]: {
518
- name: i.name,
519
- action: i.action
471
+ ...l,
472
+ [s.name]: {
473
+ name: s.name,
474
+ action: s.action
520
475
  }
521
476
  };
522
477
  }
523
478
  });
524
- function r(s, i) {
525
- e.register({ name: s, action: i });
479
+ function r(l, s) {
480
+ e.register({ name: l, action: s });
526
481
  }
527
- const n = t.map((s) => Object.values(s));
528
- function u(s) {
529
- return t.map((i) => i[s], { skipVoid: !1 });
530
- }
531
- function p(s) {
532
- return t.map(
533
- (i) => {
534
- const c = i[s];
535
- return c ? c.action : void 0;
536
- },
537
- { skipVoid: !1 }
538
- );
482
+ const n = t.map((l) => Object.values(l));
483
+ function o(l) {
484
+ return t.map((s) => s[l], { skipVoid: !1 });
539
485
  }
540
486
  return {
541
487
  register: r,
542
- getByName: u,
543
- listStore: n,
544
- getEvokableAction: p
488
+ getByName: o,
489
+ listStore: n
545
490
  };
546
491
  });
547
- function We() {
548
- return w(Ge);
492
+ function qe() {
493
+ return w(Ke);
549
494
  }
550
- const Ye = (t, e, r) => {
495
+ const Ge = (t, e, r) => {
551
496
  r.register(t, e);
552
497
  };
553
498
  function _(t) {
554
499
  return typeof t > "u" || t === null || t === "" || Array.isArray(t) && !t.length;
555
500
  }
556
- const Je = F("response"), Qe = k(({ client: t }) => {
557
- const e = Je.store({}), r = O(), n = O(), u = I(e, {
558
- register(o, l) {
501
+ const We = F("response"), Ye = k(({ client: t }) => {
502
+ const e = We.store({}), r = C(), n = C(), o = b(e, {
503
+ register(c, a) {
559
504
  return {
560
- ...o,
561
- [l.fieldId]: l.response
505
+ ...c,
506
+ [a.fieldId]: a.response
562
507
  };
563
508
  },
564
- registerBatch(o, l) {
509
+ registerBatch(c, a) {
565
510
  return {
566
- ...o,
567
- ...l
511
+ ...c,
512
+ ...a
568
513
  };
569
514
  },
570
- clear(o, l) {
571
- const { [l]: a, ...g } = o;
572
- return g;
515
+ clear(c, a) {
516
+ const { [a]: p, ...f } = c;
517
+ return f;
573
518
  },
574
519
  clearAll() {
575
520
  return {};
576
521
  }
577
522
  });
578
- function p(o, l) {
579
- if (typeof o == "string") {
580
- if (l === void 0)
581
- throw new Error("Response is required when registering a single field");
582
- u.register({ fieldId: o, response: l });
583
- } else
584
- u.registerBatch(o);
585
- }
586
- async function s(o) {
587
- const l = [];
523
+ function l(c, a) {
524
+ o.register({ fieldId: c, response: a });
525
+ }
526
+ async function s(c) {
527
+ const a = [];
588
528
  return await Promise.allSettled(
589
- Object.entries(o).map(async ([a, g]) => {
590
- let d = g;
591
- const y = t.fields.getById(a).getState();
529
+ Object.entries(c).map(async ([p, f]) => {
530
+ let g = f;
531
+ const y = t.fields.getById(p).getState();
592
532
  if (!y) {
593
- l.push({
594
- fieldId: a,
595
- userMessage: `Field '${a}' not found`,
596
- systemMessage: `No field with ID '${a}' exists. Available field IDs are: ${Object.keys(t.fields.listStore.getState()).join(",")}.`,
597
- value: d
533
+ a.push({
534
+ fieldId: p,
535
+ userMessage: `Field '${p}' not found`,
536
+ systemMessage: `No field with ID '${p}' exists. Available field IDs are: ${Object.keys(t.fields.listStore.getState()).join(",")}.`,
537
+ value: g
598
538
  });
599
539
  return;
600
540
  }
601
- if (y.multiple && (typeof d == "string" || typeof d == "number" || typeof d == "boolean") && (d = [d]), y.validation && !ce(y.validation) && !_(d)) {
602
- const v = await P(t, y.validation, {
603
- $input: d
541
+ if (y.multiple && (typeof g == "string" || typeof g == "number" || typeof g == "boolean") && (g = [g]), y.validation && !ie(y.validation) && !_(g)) {
542
+ const I = await E(t, y.validation, {
543
+ $input: g
604
544
  });
605
- if (typeof v == "string") {
606
- l.push({
607
- fieldId: a,
608
- userMessage: v,
609
- systemMessage: `Field validation resulted in an error: ${v}.`,
610
- value: d
545
+ if (typeof I == "string") {
546
+ a.push({
547
+ fieldId: p,
548
+ userMessage: I,
549
+ systemMessage: `Field validation resulted in an error: ${I}.`,
550
+ value: g
611
551
  });
612
552
  return;
613
553
  }
614
- if (v === !1) {
615
- l.push({
616
- fieldId: a,
554
+ if (I === !1) {
555
+ a.push({
556
+ fieldId: p,
617
557
  userMessage: "This field is invalid",
618
558
  systemMessage: "Field validation resulted in an unspecified error.",
619
- value: d
559
+ value: g
620
560
  });
621
561
  return;
622
562
  }
623
563
  }
624
- if (y.required && _(d)) {
625
- l.push({
626
- fieldId: a,
564
+ if (y.required && _(g)) {
565
+ a.push({
566
+ fieldId: p,
627
567
  userMessage: "This field is required",
628
568
  systemMessage: "Field is required.",
629
- value: d
569
+ value: g
630
570
  });
631
571
  return;
632
572
  }
633
- if (!y.multiple && Array.isArray(d) && d.length > 1) {
634
- l.push({
635
- fieldId: a,
573
+ if (!y.multiple && Array.isArray(g) && g.length > 1) {
574
+ a.push({
575
+ fieldId: p,
636
576
  userMessage: "This field expects a single response",
637
577
  systemMessage: "Field expects a single response.",
638
- value: d
578
+ value: g
639
579
  });
640
580
  return;
641
581
  }
642
582
  if (y.options) {
643
- const v = y.options.map((E) => E.value), A = Array.isArray(d) ? d : [d];
644
- Array.isArray(d) && (A.every((E) => v.includes(E)) || l.push({
645
- fieldId: a,
583
+ const I = y.options.map((P) => P.value), A = Array.isArray(g) ? g : [g];
584
+ Array.isArray(g) && (A.every((P) => I.includes(P)) || a.push({
585
+ fieldId: p,
646
586
  userMessage: "This field expects a valid option",
647
- systemMessage: `Field expects a valid option. Valid options are: ${v.join(", ")}`,
648
- value: d
587
+ systemMessage: `Field expects a valid option. Valid options are: ${I.join(", ")}`,
588
+ value: g
649
589
  }));
650
590
  }
651
591
  })
652
- ), { responsesToCommit: o, validationErrors: l };
592
+ ), { responsesToCommit: c, validationErrors: a };
653
593
  }
654
- async function i(o) {
655
- const { responsesToCommit: l, validationErrors: a } = await s(o);
656
- return a.length ? { errors: a } : (u.registerBatch(l), { errors: [] });
594
+ async function i(c) {
595
+ const { responsesToCommit: a, validationErrors: p } = await s(c);
596
+ return p.length ? { errors: p } : (o.registerBatch(a), { errors: [] });
657
597
  }
658
- const c = e.map((o) => o), f = e.map((o) => Object.keys(o).map((a) => ({
659
- fieldId: a,
660
- value: o[a]
598
+ const u = e.map((c) => c), h = e.map((c) => Object.keys(c).map((p) => ({
599
+ fieldId: p,
600
+ value: c[p]
661
601
  })));
662
- function h(o) {
663
- const l = t.fields.getById(o), a = e.map((g) => g[o] || null);
664
- return C({ f: l, r: a }, ({ f: g, r: d }) => d || (g != null && g.defaultValue ? g.defaultValue : null));
665
- }
666
- function x(o) {
667
- const l = t.fields.getByName(o);
668
- return C({ f: l, s: e }, ({ f: a, s: g }) => {
669
- const d = a && g[a.id] || null;
670
- return d || (a != null && a.defaultValue ? a.defaultValue : null);
602
+ function S(c) {
603
+ const a = t.fields.getById(c), p = e.map((f) => f[c] || null);
604
+ return O({ f: a, r: p }, ({ f, r: g }) => g || (f != null && f.defaultValue ? f.defaultValue : null));
605
+ }
606
+ function d(c) {
607
+ const a = t.fields.getByName(c);
608
+ return O({ f: a, s: e }, ({ f: p, s: f }) => {
609
+ const g = p && f[p.id] || null;
610
+ return g || (p != null && p.defaultValue ? p.defaultValue : null);
671
611
  });
672
612
  }
673
- return b({
613
+ return x({
674
614
  clock: r,
675
- target: u.clearAll
676
- }), b({
615
+ target: o.clearAll
616
+ }), x({
677
617
  clock: n,
678
- target: u.clear
618
+ target: o.clear
679
619
  }), {
680
- register: p,
620
+ register: l,
681
621
  clearAll: r,
682
622
  clear: n,
683
623
  commit: i,
684
624
  getResponsesToCommit: s,
685
- listStore: f,
686
- getAllStore: c,
687
- getByFieldId: h,
688
- getByFieldName: x
625
+ listStore: h,
626
+ getAllStore: u,
627
+ getByFieldId: S,
628
+ getByFieldName: d
689
629
  };
690
630
  });
691
- function Xe(t) {
692
- return w(Qe, t);
631
+ function Je(t) {
632
+ return w(Ye, t);
693
633
  }
694
- const Ze = () => "0.0.1-dev.1764739911676";
695
- function et() {
696
- if (q()) {
634
+ const Qe = () => "0.0.1-dev.1764789407645";
635
+ function Xe() {
636
+ if (H()) {
697
637
  const t = [
698
638
  document.currentScript,
699
639
  document.getElementById("picked_script"),
@@ -707,113 +647,113 @@ function et() {
707
647
  }
708
648
  return "https://api.picked.app";
709
649
  }
710
- function tt() {
711
- if (!ue())
650
+ function Ze() {
651
+ if (!oe())
712
652
  return {};
713
653
  const t = new URLSearchParams(window.location.search), e = {}, r = /* @__PURE__ */ new Set();
714
- for (const [u] of t.entries())
715
- u.startsWith("picked-") && r.add(u);
716
- for (const u of r) {
717
- const p = u.replace("picked-", "");
718
- e[p] = t.getAll(u);
654
+ for (const [o] of t.entries())
655
+ o.startsWith("picked-") && r.add(o);
656
+ for (const o of r) {
657
+ const l = o.replace("picked-", "");
658
+ e[l] = t.getAll(o);
719
659
  }
720
660
  const n = B("s");
721
661
  if (r.size > 0)
722
- D.set(n, e);
662
+ j.set(n, e);
723
663
  else {
724
- const u = D.get(n);
725
- if (u)
726
- return u.json() || {};
664
+ const o = j.get(n);
665
+ if (o)
666
+ return o.json() || {};
727
667
  }
728
668
  return e;
729
669
  }
730
- function rt() {
731
- if (de())
670
+ function et() {
671
+ if (ce())
732
672
  return crypto.randomUUID();
733
673
  const t = Date.now().toString(36), e = Math.random().toString(36).substring(2, 15), r = Math.random().toString(36).substring(2, 15), n = Math.random().toString(36).substring(2, 15);
734
674
  return `${t}-${e}-${r}-${n}`;
735
675
  }
736
- const st = B("session", "global"), nt = () => {
737
- const t = U.get(st);
676
+ const tt = B("session", "global"), rt = () => {
677
+ const t = D.get(tt);
738
678
  let e;
739
679
  t.isSet() && (e = t.json());
740
- const r = (u) => t.set({ id: u.id, isUser: u.isUser }), n = {
741
- id: (e == null ? void 0 : e.id) ?? rt(),
680
+ const r = (o) => t.set({ id: o.id, isUser: o.isUser }), n = {
681
+ id: (e == null ? void 0 : e.id) ?? et(),
742
682
  isUser: (e == null ? void 0 : e.isUser) ?? void 0,
743
- setIsUser(u) {
744
- this.isUser = u, r(this);
683
+ setIsUser(o) {
684
+ this.isUser = o, r(this);
745
685
  }
746
686
  };
747
687
  return r(n), n;
748
- }, it = () => le() ? nt() : null;
749
- class Y {
688
+ }, st = () => ae() ? rt() : null;
689
+ class G {
750
690
  constructor(e) {
751
691
  m(this, "options");
752
692
  m(this, "isReady", !1);
753
693
  m(this, "project");
754
694
  m(this, "plugins", {});
755
- m(this, "eventBus", Ne());
695
+ m(this, "eventBus", Te());
756
696
  m(this, "organizationId");
757
697
  m(this, "projectId");
758
698
  m(this, "apiUrl");
759
699
  m(this, "session");
760
700
  m(this, "precondition");
761
701
  m(this, "condition");
762
- m(this, "searchParams", tt());
763
- m(this, "history", ze());
764
- m(this, "components", Ie({ client: this }));
765
- m(this, "experienceInstances", ie({ client: this }));
766
- m(this, "experiences", he({ client: this }));
767
- m(this, "frameworks", Pe({ client: this }));
768
- m(this, "predicates", Ce({ client: this }));
769
- m(this, "features", Ve({ client: this }));
770
- m(this, "responses", Xe({ client: this }));
771
- m(this, "fields", He());
772
- m(this, "actions", We());
773
- S("info", "Picked client initializing."), this.organizationId = e.organizationId, this.projectId = e.projectId, this.options = Object.freeze(e), this.apiUrl = e.apiUrl || et(), this.session = it(), this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.precondition = e.precondition, this.condition = e.condition, this.eventBus({ type: "load", version: Ze() }), S("info", "Picked client initialized.");
702
+ m(this, "searchParams", Ze());
703
+ m(this, "history", Ve());
704
+ m(this, "components", we({ client: this }));
705
+ m(this, "experienceInstances", re({ client: this }));
706
+ m(this, "experiences", ge({ client: this }));
707
+ m(this, "frameworks", be({ client: this }));
708
+ m(this, "predicates", je({ client: this }));
709
+ m(this, "features", De({ client: this }));
710
+ m(this, "responses", Je({ client: this }));
711
+ m(this, "fields", _e());
712
+ m(this, "actions", qe());
713
+ v("info", "Picked client initializing."), this.organizationId = e.organizationId, this.projectId = e.projectId, this.options = Object.freeze(e), this.apiUrl = e.apiUrl || Xe(), this.session = st(), this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.precondition = e.precondition, this.condition = e.condition, this.eventBus({ type: "load", version: Qe() }), v("info", "Picked client initialized.");
774
714
  }
775
715
  start() {
776
- $e(this), (async () => {
777
- if (!q())
716
+ Re(this), (async () => {
717
+ if (!H())
778
718
  return;
779
719
  let r = !0, n;
780
- this.precondition !== void 0 && await P(this, this.precondition) === !1 && (n = !1, r = !1), this.condition !== void 0 && n !== !1 && await P(this, this.condition) === !1 && (r = !1), this.session && this.session.setIsUser(r), this.eventBus({ type: "initialize" }), this.eventBus({ type: "user_decide", value: r }), document.body && r && V(this), await oe(), r && V(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session && this.eventBus({ type: "session", ...this.session });
720
+ this.precondition !== void 0 && await E(this, this.precondition) === !1 && (n = !1, r = !1), this.condition !== void 0 && n !== !1 && await E(this, this.condition) === !1 && (r = !1), this.session && this.session.setIsUser(r), this.eventBus({ type: "initialize" }), this.eventBus({ type: "user_decide", value: r }), document.body && r && M(this), await se(), r && M(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session && this.eventBus({ type: "session", ...this.session });
781
721
  })();
782
722
  }
783
723
  registerFramework(e) {
784
- Re(e, this.frameworks);
724
+ xe(e, this.frameworks);
785
725
  }
786
726
  registerComponent(e, r) {
787
- M(e, r, this.components);
727
+ V(e, r, this.components);
788
728
  }
789
729
  registerPlugin(e) {
790
- Se(this, e, this.plugins);
730
+ he(this, e, this.plugins);
791
731
  }
792
732
  registerFeature(e, r) {
793
- Me(e, r, this.features);
733
+ Ue(e, r, this.features);
794
734
  }
795
735
  registerPredicate(e, r) {
796
736
  Oe(e, r, this.predicates);
797
737
  }
798
738
  registerField(e) {
799
- qe(e, this.fields);
739
+ Le(e, this.fields);
800
740
  }
801
741
  registerAction(e, r) {
802
- Ye(e, r, this.actions);
742
+ Ge(e, r, this.actions);
803
743
  }
804
744
  registerExperience(e) {
805
- e.component && M(`experience:${e.id}`, e.component, this.components), ye(e, this.experiences);
745
+ e.component && V(`experience:${e.id}`, e.component, this.components), fe(e, this.experiences);
806
746
  }
807
747
  getStateSnapshot() {
808
- return W(this);
748
+ return Be(this);
809
749
  }
810
750
  async launchExperienceById(e) {
811
751
  const r = this.experiences.getById(e).getState();
812
752
  if (!r) {
813
- S("warn", `Experience with id '${e}' not found.`);
753
+ v("warn", `Experience with id '${e}' not found.`);
814
754
  return;
815
755
  }
816
- G(this, r);
756
+ q(this, r);
817
757
  }
818
758
  // private async fetchProject() {
819
759
  // if (this.project) {
@@ -828,14 +768,14 @@ class Y {
828
768
  var e;
829
769
  (e = this.options.plugins) == null || e.forEach((r) => {
830
770
  if (Array.isArray(r)) {
831
- r.forEach((u) => {
832
- this.registerPlugin(u);
771
+ r.forEach((o) => {
772
+ this.registerPlugin(o);
833
773
  });
834
774
  return;
835
775
  }
836
776
  const n = typeof r == "function" ? r() : r;
837
777
  if (Array.isArray(n)) {
838
- n.forEach((u) => this.registerPlugin(u));
778
+ n.forEach((o) => this.registerPlugin(o));
839
779
  return;
840
780
  }
841
781
  this.registerPlugin(n);
@@ -844,20 +784,20 @@ class Y {
844
784
  setupFeatures() {
845
785
  const e = this.options.features;
846
786
  e && (Object.entries(e).forEach(([r, n]) => {
847
- const u = typeof n == "function" ? n() : n;
848
- this.registerFeature(r, u);
787
+ const o = typeof n == "function" ? n() : n;
788
+ this.registerFeature(r, o);
849
789
  }), this.searchParams.feature && this.searchParams.feature.forEach((r) => {
850
790
  try {
851
- const [n, u] = r.split(":");
852
- if (!n || !u)
791
+ const [n, o] = r.split(":");
792
+ if (!n || !o)
853
793
  return;
854
- let p = u;
855
- p === "true" && (p = !0), p === "false" && (p = !1), this.registerFeature(n, {
856
- key: `${p}`,
794
+ let l = o;
795
+ l === "true" && (l = !0), l === "false" && (l = !1), this.registerFeature(n, {
796
+ key: `${l}`,
857
797
  // use the assigned bucket value as the key
858
798
  name: n,
859
799
  // eslint-disable-next-line sonarjs/function-return-type
860
- decide: () => p,
800
+ decide: () => l,
861
801
  storage: "session"
862
802
  });
863
803
  } catch {
@@ -868,7 +808,7 @@ class Y {
868
808
  const e = this.options.predicates;
869
809
  e && Object.entries(e).forEach(([r, n]) => {
870
810
  if (typeof n != "function") {
871
- S("warn", `Predicate "${r}" is not a function.`);
811
+ v("warn", `Predicate "${r}" is not a function.`);
872
812
  return;
873
813
  }
874
814
  this.registerPredicate(r, n);
@@ -878,7 +818,7 @@ class Y {
878
818
  const e = this.options.actions;
879
819
  e && Object.entries(e).forEach(([r, n]) => {
880
820
  if (typeof n != "function") {
881
- S("warn", `Action "${r}" is not a function.`);
821
+ v("warn", `Action "${r}" is not a function.`);
882
822
  return;
883
823
  }
884
824
  this.registerAction(r, n);
@@ -888,51 +828,51 @@ class Y {
888
828
  return this.plugins[e] ?? {};
889
829
  }
890
830
  }
891
- m(Y, "logger", S);
892
- function J(t) {
831
+ m(G, "logger", v);
832
+ function W(t) {
893
833
  var e;
894
834
  return ((e = t.options) == null ? void 0 : e.some((r) => "condition" in r)) ?? !1;
895
835
  }
896
- function ot(t) {
897
- return t.some((e) => e.condition || J(e));
836
+ function nt(t) {
837
+ return t.some((e) => e.condition || W(e));
898
838
  }
899
- async function ht(t, e) {
900
- return e.length === 0 || !ot(e) ? e : (await Promise.all(
839
+ async function ft(t, e) {
840
+ return e.length === 0 || !nt(e) ? e : (await Promise.all(
901
841
  e.map(async (n) => {
902
- if (!(n.condition ? await P(t, n.condition) : !0))
842
+ if (!(n.condition ? await E(t, n.condition) : !0))
903
843
  return null;
904
- if (!n.options || !J(n))
844
+ if (!n.options || !W(n))
905
845
  return n;
906
846
  const s = (await Promise.all(
907
- n.options.map(async (c) => c.condition ? await P(t, c.condition) ? c : null : c)
908
- )).filter((c) => c !== null);
847
+ n.options.map(async (u) => u.condition ? await E(t, u.condition) ? u : null : u)
848
+ )).filter((u) => u !== null);
909
849
  return s.length === n.options.length ? n : s.length === 0 ? null : { ...n, options: s };
910
850
  })
911
851
  )).filter((n) => n !== null);
912
852
  }
913
- const yt = (t) => {
914
- const e = new Y(t);
915
- return pe(e), e;
853
+ const mt = (t) => {
854
+ const e = new G(t);
855
+ return ue(e), e;
916
856
  };
917
857
  export {
918
- Y as Picked,
919
- yt as createClient,
858
+ G as Picked,
859
+ mt as createClient,
920
860
  B as createStorageKey,
921
- P as evaluateRuleLogic,
922
- ht as getStepFields,
923
- kt as isPickedRoot,
924
- U as localStore,
925
- D as sessionStore,
926
- bt as subscribe,
861
+ E as evaluateRuleLogic,
862
+ ft as getStepFields,
863
+ St as isPickedRoot,
864
+ D as localStore,
865
+ j as sessionStore,
866
+ kt as subscribe,
927
867
  It as supportsCookies,
928
- de as supportsCryptoRandomUUID,
929
- q as supportsDocument,
930
- xt as supportsHistory,
931
- Et as supportsIntersectionObserver,
932
- le as supportsLocalStorage,
933
- Pt as supportsLocation,
934
- Rt as supportsSessionStorage,
935
- Bt as supportsShadowRoot,
936
- At as supportsWebComponents,
937
- ue as supportsWindow
868
+ ce as supportsCryptoRandomUUID,
869
+ H as supportsDocument,
870
+ Ft as supportsHistory,
871
+ bt as supportsIntersectionObserver,
872
+ ae as supportsLocalStorage,
873
+ xt as supportsLocation,
874
+ Et as supportsSessionStorage,
875
+ Pt as supportsShadowRoot,
876
+ Rt as supportsWebComponents,
877
+ oe as supportsWindow
938
878
  };