@picked/client 0.0.45-next.1 → 0.0.45-next.3

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,90 +1,90 @@
1
1
  import { createDomain as x, createApi as j, createStore as N, createEffect as $, sample as k, attach as Z, combine as D, createEvent as V } from "effector";
2
2
  import { createFactory as b, invoke as I } from "@withease/factories";
3
- import { g as q, t as ee, c as te, i as re, e as E, a as se, b as ne, d as ie } from "../experience-instance-D0bQ9DzM.js";
4
- import { f as Bt } from "../experience-instance-D0bQ9DzM.js";
3
+ import { g as q, t as ee, c as te, i as re, e as E, a as ne, b as se, d as ie } from "../experience-instance-CU_pYPyd.js";
4
+ import { f as Bt } from "../experience-instance-CU_pYPyd.js";
5
5
  import { l as w } from "../logger-C9a75KZn.js";
6
- import { c as A, l as z, s as O } from "../storage-Co_LbKr_.js";
6
+ import { c as A, l as C, s as z } from "../storage-Co_LbKr_.js";
7
7
  import { a as $t } from "../storage-Co_LbKr_.js";
8
8
  import { g as oe } from "../id-BW-g3y32.js";
9
9
  import { i as ae } from "../object-JwZ58NOH.js";
10
10
  import { s as T, a as U, b as ce, c as ue, d as de } from "../supports-8YT4QKI7.js";
11
- import { e as zt, f as Ot, g as Mt, h as Dt, i as Vt, j as Nt, k as Tt } from "../supports-8YT4QKI7.js";
11
+ import { e as Ct, f as zt, g as Mt, h as Dt, i as Vt, j as Nt, k as Tt } from "../supports-8YT4QKI7.js";
12
12
  const K = x("experience"), le = b(
13
13
  ({ client: t, experience: e }) => {
14
- const r = K.store(e), s = j(r, {
15
- merge(f, h) {
14
+ const r = K.store(e), n = j(r, {
15
+ merge(p, h) {
16
16
  return {
17
- ...f,
17
+ ...p,
18
18
  ...h.experience
19
19
  };
20
20
  }
21
- }), i = r.map((f) => ({
22
- name: f.name,
23
- decisionLogic: f.condition ?? f.decide,
24
- targetSelectors: f.targets,
21
+ }), o = r.map((p) => ({
22
+ name: p.name,
23
+ decisionLogic: p.condition ?? p.decide,
24
+ targetSelectors: p.targets,
25
25
  initializeOpenLogic: e.initializeOpen
26
26
  })), d = t.components.listStore.map(
27
- (f) => f.find((h) => h.name === `experience:${e.id}`) || f.find((h) => h.name === "experience"),
27
+ (p) => p.find((h) => h.name === `experience:${e.id}`) || p.find((h) => h.name === "experience"),
28
28
  { skipVoid: !1 }
29
- ), o = r.map((f) => ({
30
- steps: f.steps,
31
- nodes: f.nodes,
32
- edges: f.edges,
33
- conditionals: f.conditionals
34
- })), n = r.map((f) => f.fields), l = e.actions ?? [];
29
+ ), i = r.map((p) => ({
30
+ steps: p.steps,
31
+ nodes: p.nodes,
32
+ edges: p.edges,
33
+ conditionals: p.conditionals
34
+ })), s = r.map((p) => p.fields), l = e.actions ?? [];
35
35
  return {
36
36
  id: e.id,
37
- configStore: i,
38
- treeStore: o,
39
- fieldsStore: n,
37
+ configStore: o,
38
+ treeStore: i,
39
+ fieldsStore: s,
40
40
  componentStore: d,
41
41
  actions: l,
42
- merge: s.merge
42
+ merge: n.merge
43
43
  };
44
44
  }
45
45
  );
46
- function fe(t) {
46
+ function pe(t) {
47
47
  return I(le, t);
48
48
  }
49
- const pe = b(({ client: t }) => {
49
+ const fe = b(({ client: t }) => {
50
50
  const e = K.store({}), r = j(e, {
51
- register(o, n) {
51
+ register(i, s) {
52
52
  return {
53
- ...o,
54
- [n.id]: n
53
+ ...i,
54
+ [s.id]: s
55
55
  };
56
56
  }
57
57
  });
58
- function s(o) {
59
- const n = e.getState()[o.id];
60
- if (n) {
61
- n.merge({ experience: o, strategy: "override" });
58
+ function n(i) {
59
+ const s = e.getState()[i.id];
60
+ if (s) {
61
+ s.merge({ experience: i, strategy: "override" });
62
62
  return;
63
63
  }
64
- const l = fe({ client: t, experience: o });
64
+ const l = pe({ client: t, experience: i });
65
65
  r.register(l);
66
66
  }
67
- const i = e.map((o) => Object.values(o));
68
- function d(o) {
69
- return e.map((n) => n[o], { skipVoid: !1 });
67
+ const o = e.map((i) => Object.values(i));
68
+ function d(i) {
69
+ return e.map((s) => s[i], { skipVoid: !1 });
70
70
  }
71
71
  return {
72
- register: s,
72
+ register: n,
73
73
  getById: d,
74
- listStore: i
74
+ listStore: o
75
75
  };
76
76
  });
77
77
  function ge(t) {
78
- return I(pe, t);
78
+ return I(fe, t);
79
79
  }
80
80
  const me = (t, e) => {
81
81
  e.register(t);
82
- }, W = (t, e) => {
83
- const { targetSelectors: r } = e.configStore.getState(), s = q(r, e.id);
84
- s.forEach(
85
- ({ elements: d }) => d.forEach((o) => ee(o, e.id))
86
- ), te(s, e.id).forEach((d) => {
87
- t.experienceInstances.spawn(e, d);
82
+ }, W = (t, e, r) => {
83
+ const { targetSelectors: n } = e.configStore.getState(), o = q(n, e.id);
84
+ o.forEach(
85
+ ({ elements: i }) => i.forEach((s) => ee(s, e.id))
86
+ ), te(o, e.id).forEach((i) => {
87
+ r ? t.experienceInstances.spawn(e, i, r) : t.experienceInstances.spawn(e, i);
88
88
  });
89
89
  }, _ = async (t) => {
90
90
  await Promise.all(
@@ -93,21 +93,21 @@ const me = (t, e) => {
93
93
  })
94
94
  );
95
95
  }, he = async (t, e) => {
96
- const { decisionLogic: r, targetSelectors: s } = e.configStore.getState();
97
- return q(s, e.id).length < 1 || s.length === 0 ? !1 : r && re(r) ? await E(t, r) === !0 : !0;
96
+ const { decisionLogic: r, targetSelectors: n } = e.configStore.getState();
97
+ return q(n, e.id).length < 1 || n.length === 0 ? !1 : r && re(r) ? await E(t, r) === !0 : !0;
98
98
  }, ye = (t, e, r) => {
99
- const s = e.name, i = e.setup(t);
100
- if (i) {
101
- const d = r[s] ?? {};
102
- r[s] = Object.freeze({ ...d, ...i });
99
+ const n = e.name, o = e.setup(t);
100
+ if (o) {
101
+ const d = r[n] ?? {};
102
+ r[n] = Object.freeze({ ...d, ...o });
103
103
  }
104
104
  }, Se = x("component"), ve = b(
105
105
  ({ client: t, component: e, name: r }) => {
106
- const s = t.frameworks.getByName(e.frameworkName);
106
+ const n = t.frameworks.getByName(e.frameworkName);
107
107
  return {
108
108
  name: r,
109
109
  component: e,
110
- frameworkStore: s
110
+ frameworkStore: n
111
111
  };
112
112
  }
113
113
  );
@@ -116,29 +116,29 @@ function ke(t) {
116
116
  }
117
117
  const we = b(({ client: t }) => {
118
118
  const e = Se.store({}), r = j(e, {
119
- register(o, n) {
119
+ register(i, s) {
120
120
  return {
121
- ...o,
122
- [n.name]: n
121
+ ...i,
122
+ [s.name]: s
123
123
  };
124
124
  }
125
125
  });
126
- function s(o, n) {
127
- e.getState()[o] && w(
126
+ function n(i, s) {
127
+ e.getState()[i] && w(
128
128
  "warn",
129
- `Component '${o}' already registered. Registering again will override the previous registration.`
129
+ `Component '${i}' already registered. Registering again will override the previous registration.`
130
130
  );
131
- const f = ke({ client: t, name: o, component: n });
132
- r.register(f);
131
+ const p = ke({ client: t, name: i, component: s });
132
+ r.register(p);
133
133
  }
134
- const i = e.map((o) => Object.values(o));
135
- function d(o) {
136
- return e.map((n) => n[o], { skipVoid: !1 });
134
+ const o = e.map((i) => Object.values(i));
135
+ function d(i) {
136
+ return e.map((s) => s[i], { skipVoid: !1 });
137
137
  }
138
138
  return {
139
- register: s,
139
+ register: n,
140
140
  getByName: d,
141
- listStore: i
141
+ listStore: o
142
142
  };
143
143
  });
144
144
  function be(t) {
@@ -148,27 +148,27 @@ const L = (t, e, r) => {
148
148
  r.register(t, e);
149
149
  }, Ie = x("framework"), Fe = b(({ client: t }) => {
150
150
  const e = Ie.store({}), r = j(e, {
151
- register(o, n) {
151
+ register(i, s) {
152
152
  return {
153
- ...o,
154
- [n.name]: n.framework
153
+ ...i,
154
+ [s.name]: s.framework
155
155
  };
156
156
  }
157
157
  });
158
- function s(o, n) {
159
- e.getState()[o] && w(
158
+ function n(i, s) {
159
+ e.getState()[i] && w(
160
160
  "warn",
161
- `Framework '${o}' already registered. Registering again will override the previous registration.`
162
- ), r.register({ name: o, framework: n });
161
+ `Framework '${i}' already registered. Registering again will override the previous registration.`
162
+ ), r.register({ name: i, framework: s });
163
163
  }
164
- const i = e.map((o) => Object.values(o));
165
- function d(o) {
166
- return e.map((n) => n[o], { skipVoid: !1 });
164
+ const o = e.map((i) => Object.values(i));
165
+ function d(i) {
166
+ return e.map((s) => s[i], { skipVoid: !1 });
167
167
  }
168
168
  return {
169
- register: s,
169
+ register: n,
170
170
  getByName: d,
171
- listStore: i
171
+ listStore: o
172
172
  };
173
173
  });
174
174
  function xe(t) {
@@ -178,21 +178,21 @@ const je = (t, e) => {
178
178
  e.register(t.name, t);
179
179
  }, Ee = 6e3, Pe = A("last_ping", "global"), Ae = (t) => `${t}/api/v1/ping`, Be = async (t) => {
180
180
  try {
181
- const e = Date.now(), r = z.get(Pe);
182
- let s = 0;
183
- if (r.isSet() && (s = r.json() ?? 0), s && e - s < Ee)
181
+ const e = Date.now(), r = C.get(Pe);
182
+ let n = 0;
183
+ if (r.isSet() && (n = r.json() ?? 0), n && e - n < Ee)
184
184
  return !0;
185
- const i = Ae(t.apiUrl), d = {
185
+ const o = Ae(t.apiUrl), d = {
186
186
  projectId: t.projectId,
187
187
  path: window.location.pathname
188
- }, o = JSON.stringify(d), n = {
188
+ }, i = JSON.stringify(d), s = {
189
189
  "Content-Type": "application/json"
190
- }, f = document.getElementById("picked_script")?.dataset.verceltoken;
191
- f && (n["x-vercel-protection-bypass"] = f);
192
- const v = (await fetch(i, {
190
+ }, p = document.getElementById("picked_script")?.dataset.verceltoken;
191
+ p && (s["x-vercel-protection-bypass"] = p);
192
+ const v = (await fetch(o, {
193
193
  method: "POST",
194
- headers: n,
195
- body: o
194
+ headers: s,
195
+ body: i
196
196
  })).ok;
197
197
  return v && r.set(e), v;
198
198
  } catch (e) {
@@ -213,9 +213,9 @@ function Y(t) {
213
213
  }
214
214
  const Re = x("predicate"), $e = b(({ client: t }) => {
215
215
  const e = Re.store({}), r = j(e, {
216
- register(n, l) {
216
+ register(s, l) {
217
217
  return {
218
- ...n,
218
+ ...s,
219
219
  [l.name]: {
220
220
  name: l.name,
221
221
  predicate: l.predicate
@@ -223,22 +223,22 @@ const Re = x("predicate"), $e = b(({ client: t }) => {
223
223
  };
224
224
  }
225
225
  });
226
- function s(n, l) {
227
- e.getState()[n] && w(
226
+ function n(s, l) {
227
+ e.getState()[s] && w(
228
228
  "warn",
229
- `Predicate '${n}' already registered. Registering again will override the previous registration.`
230
- ), r.register(Object.freeze({ name: n, predicate: l }));
229
+ `Predicate '${s}' already registered. Registering again will override the previous registration.`
230
+ ), r.register(Object.freeze({ name: s, predicate: l }));
231
231
  }
232
- const i = e.map((n) => Object.values(n));
233
- function d(n) {
234
- return e.map((l) => l[n]?.predicate, { skipVoid: !1 });
232
+ const o = e.map((s) => Object.values(s));
233
+ function d(s) {
234
+ return e.map((l) => l[s]?.predicate, { skipVoid: !1 });
235
235
  }
236
- function o(n) {
236
+ function i(s) {
237
237
  const l = N(() => {
238
238
  }, {
239
239
  skipVoid: !1
240
- }), f = $(async () => {
241
- const h = d(n).getState();
240
+ }), p = $(async () => {
241
+ const h = d(s).getState();
242
242
  if (!h)
243
243
  return;
244
244
  const v = Y(t);
@@ -246,27 +246,27 @@ const Re = x("predicate"), $e = b(({ client: t }) => {
246
246
  });
247
247
  return k({
248
248
  source: { responses: t.responses.listStore, fields: t.fields.listStore },
249
- target: f
249
+ target: p
250
250
  }), k({
251
- clock: f.doneData,
251
+ clock: p.doneData,
252
252
  filter: (h) => h !== void 0,
253
253
  target: l
254
- }), f(), l;
254
+ }), p(), l;
255
255
  }
256
256
  return {
257
- register: s,
257
+ register: n,
258
258
  getByName: d,
259
- listStore: i,
260
- getEvokablePredicate: o
259
+ listStore: o,
260
+ getEvokablePredicate: i
261
261
  };
262
262
  });
263
- function Ce(t) {
263
+ function Oe(t) {
264
264
  return I($e, t);
265
265
  }
266
- const ze = (t, e, r) => {
266
+ const Ce = (t, e, r) => {
267
267
  r.register(t, e);
268
- }, J = x("feature"), Oe = b(({ client: t }) => {
269
- const e = J.store({}), r = J.store([]), s = j(e, {
268
+ }, J = x("feature"), ze = b(({ client: t }) => {
269
+ const e = J.store({}), r = J.store([]), n = j(e, {
270
270
  register(a, c) {
271
271
  return {
272
272
  ...a,
@@ -274,7 +274,7 @@ const ze = (t, e, r) => {
274
274
  };
275
275
  }
276
276
  });
277
- function i(a, c) {
277
+ function o(a, c) {
278
278
  e.getState()[a] && w(
279
279
  "warn",
280
280
  `Feature '${a}' already registered. Registering again will override the previous registration.`
@@ -286,7 +286,7 @@ const ze = (t, e, r) => {
286
286
  id: a
287
287
  }
288
288
  };
289
- s.register(
289
+ n.register(
290
290
  Object.freeze({
291
291
  id: a,
292
292
  feature: u
@@ -297,73 +297,73 @@ const ze = (t, e, r) => {
297
297
  async ({
298
298
  id: a,
299
299
  key: c,
300
- storage: p = "local"
300
+ storage: f = "local"
301
301
  }) => {
302
- const u = A(`feature:${a}:${c}`, "global"), y = (p === "session" ? O : z).get(u).boolean();
303
- return y === null ? null : { id: a, key: c, bucket: y, storage: p };
302
+ const u = A(`feature:${a}:${c}`, "global"), y = (f === "session" ? z : C).get(u).boolean();
303
+ return y === null ? null : { id: a, key: c, bucket: y, storage: f };
304
304
  }
305
- ), o = $((a) => {
305
+ ), i = $((a) => {
306
306
  if (!a)
307
307
  return null;
308
308
  const c = A(`feature:${a.id}:${a.key}`, "global");
309
- (a.storage === "session" ? O : z).set(c, a.bucket);
310
- }), n = /* @__PURE__ */ new Map(), l = Z({
309
+ (a.storage === "session" ? z : C).set(c, a.bucket);
310
+ }), s = /* @__PURE__ */ new Map(), l = Z({
311
311
  source: { allFeaturesStore: e, resolvedFeaturesStore: r },
312
- effect: async ({ allFeaturesStore: a, resolvedFeaturesStore: c }, { id: p, decide: u, key: g }) => {
312
+ effect: async ({ allFeaturesStore: a, resolvedFeaturesStore: c }, { id: f, decide: u, key: g }) => {
313
313
  const y = c.find(
314
- (R) => R.id === p && R.key === g
314
+ (R) => R.id === f && R.key === g
315
315
  );
316
316
  if (y)
317
317
  return y;
318
- const F = a[p];
318
+ const F = a[f];
319
319
  if (!F)
320
- throw new Error(`Feature with id '${p}' not found`);
321
- const B = n.get(`${p}:${g}`);
320
+ throw new Error(`Feature with id '${f}' not found`);
321
+ const B = s.get(`${f}:${g}`);
322
322
  if (B !== void 0) {
323
323
  const R = await B;
324
324
  return { id: F.id, bucket: R, key: g, storage: F.feature.storage };
325
325
  }
326
326
  const S = u();
327
- n.set(`${p}:${g}`, S);
327
+ s.set(`${f}:${g}`, S);
328
328
  const X = await S;
329
329
  return { id: F.id, bucket: X, key: g, storage: F.feature.storage };
330
330
  }
331
331
  });
332
332
  k({
333
- clock: s.register,
333
+ clock: n.register,
334
334
  fn: (a) => {
335
- const { id: c, feature: p } = a;
336
- return { id: c, key: p.feature.key, storage: p.feature.storage };
335
+ const { id: c, feature: f } = a;
336
+ return { id: c, key: f.feature.key, storage: f.feature.storage };
337
337
  },
338
338
  target: d
339
339
  }), k({
340
340
  source: e,
341
341
  clock: l.doneData,
342
342
  fn: (a, c) => {
343
- const { id: p, bucket: u, storage: g } = c, y = a[p]?.feature.key;
344
- return y ? { key: y, id: p, bucket: u, storage: g } : null;
343
+ const { id: f, bucket: u, storage: g } = c, y = a[f]?.feature.key;
344
+ return y ? { key: y, id: f, bucket: u, storage: g } : null;
345
345
  },
346
- target: o
346
+ target: i
347
347
  });
348
- const f = D({ allFeaturesStore: e, resolvedFeaturesStore: r }).map(
348
+ const p = D({ allFeaturesStore: e, resolvedFeaturesStore: r }).map(
349
349
  ({
350
350
  allFeaturesStore: a,
351
351
  resolvedFeaturesStore: c
352
- }) => Object.values(a).map((p) => {
352
+ }) => Object.values(a).map((f) => {
353
353
  const u = c.find(
354
- (g) => g.id === p.id && g.key === p.feature.key
354
+ (g) => g.id === f.id && g.key === f.feature.key
355
355
  );
356
356
  return u ? {
357
- id: p.id,
358
- name: p.feature.name,
359
- key: p.feature.key,
360
- getBucket: () => ({ id: p.id, bucket: u.bucket }),
357
+ id: f.id,
358
+ name: f.feature.name,
359
+ key: f.feature.key,
360
+ getBucket: () => ({ id: f.id, bucket: u.bucket }),
361
361
  isResolved: !0
362
362
  } : {
363
- id: p.id,
364
- name: p.feature.name,
365
- key: p.feature.key,
366
- getBucket: async () => await l(p.feature),
363
+ id: f.id,
364
+ name: f.feature.name,
365
+ key: f.feature.key,
366
+ getBucket: async () => await l(f.feature),
367
367
  isResolved: !1
368
368
  };
369
369
  })
@@ -371,8 +371,8 @@ const ze = (t, e, r) => {
371
371
  k({
372
372
  clock: l.doneData,
373
373
  source: { resolvedFeatures: r },
374
- filter: ({ resolvedFeatures: a }, { id: c, key: p }) => !a.some(
375
- (g) => g.id === c && g.key === p
374
+ filter: ({ resolvedFeatures: a }, { id: c, key: f }) => !a.some(
375
+ (g) => g.id === c && g.key === f
376
376
  ),
377
377
  fn: (a, c) => c,
378
378
  target: t.eventBus.prepend((a) => ({
@@ -388,7 +388,7 @@ const ze = (t, e, r) => {
388
388
  target: r
389
389
  });
390
390
  function h(a) {
391
- return f.map((c) => c.find((p) => p.id === a));
391
+ return p.map((c) => c.find((f) => f.id === a));
392
392
  }
393
393
  function v(a) {
394
394
  return e.map((c) => c[a], { skipVoid: !1 });
@@ -398,7 +398,7 @@ const ze = (t, e, r) => {
398
398
  async () => {
399
399
  },
400
400
  { skipVoid: !1 }
401
- ), p = $(async () => {
401
+ ), f = $(async () => {
402
402
  const u = h(a).getState();
403
403
  if (u)
404
404
  return async () => (await u.getBucket()).bucket;
@@ -406,23 +406,23 @@ const ze = (t, e, r) => {
406
406
  return k({
407
407
  source: r,
408
408
  filter: (u) => u.some((g) => g.id === a),
409
- target: p
409
+ target: f
410
410
  }), k({
411
- clock: p.doneData,
411
+ clock: f.doneData,
412
412
  filter: (u) => u !== void 0,
413
413
  target: c
414
- }), p(), c;
414
+ }), f(), c;
415
415
  }
416
416
  return {
417
- register: i,
417
+ register: o,
418
418
  getById: h,
419
419
  getByName: v,
420
- listStore: f,
420
+ listStore: p,
421
421
  getEvokableFeature: m
422
422
  };
423
423
  });
424
424
  function Me(t) {
425
- return I(Oe, t);
425
+ return I(ze, t);
426
426
  }
427
427
  const De = (t, e, r) => {
428
428
  r.register(t, e);
@@ -437,41 +437,41 @@ function H(t, e) {
437
437
  };
438
438
  }
439
439
  const Ve = b(() => {
440
- const t = P.store({ entries: [] }), e = P.event(), r = P.event(), s = P.event(), i = P.event();
441
- t.on(e, (o, n) => ({
442
- entries: [...o.entries, H(n.experienceId, n.node)]
443
- })), t.on(r, (o, n) => ({
440
+ const t = P.store({ entries: [] }), e = P.event(), r = P.event(), n = P.event(), o = P.event();
441
+ t.on(e, (i, s) => ({
442
+ entries: [...i.entries, H(s.experienceId, s.node)]
443
+ })), t.on(r, (i, s) => ({
444
444
  entries: [
445
- ...o.entries.slice(0, -1),
446
- H(n.experienceId, n.node)
445
+ ...i.entries.slice(0, -1),
446
+ H(s.experienceId, s.node)
447
447
  ]
448
- })), t.on(i, (o, n) => n);
449
- function d(o, n) {
448
+ })), t.on(o, (i, s) => s);
449
+ function d(i, s) {
450
450
  const l = { lastStepIndex: -1, secondLastStepIndex: -1 };
451
- for (let f = o.length - 1; f >= 0; f--) {
452
- const h = o[f], v = h?.node;
453
- if (!(!v || !se(v)) && !(n && h?.experienceId !== n))
451
+ for (let p = i.length - 1; p >= 0; p--) {
452
+ const h = i[p], v = h?.node;
453
+ if (!(!v || !ne(v)) && !(s && h?.experienceId !== s))
454
454
  if (l.lastStepIndex === -1)
455
- l.lastStepIndex = f;
455
+ l.lastStepIndex = p;
456
456
  else {
457
- l.secondLastStepIndex = f;
457
+ l.secondLastStepIndex = p;
458
458
  break;
459
459
  }
460
460
  }
461
461
  return l;
462
462
  }
463
- return t.on(s, (o, n) => {
464
- const { secondLastStepIndex: l } = d(o.entries, n.experienceId), f = l !== -1 ? o.entries.slice(0, l + 1) : o.entries;
463
+ return t.on(n, (i, s) => {
464
+ const { secondLastStepIndex: l } = d(i.entries, s.experienceId), p = l !== -1 ? i.entries.slice(0, l + 1) : i.entries;
465
465
  return {
466
- ...o,
467
- entries: f
466
+ ...i,
467
+ entries: p
468
468
  };
469
469
  }), {
470
470
  push: e,
471
471
  replace: r,
472
- back: s,
473
- restore: i,
474
- entriesStore: t.map((o) => o.entries)
472
+ back: n,
473
+ restore: o,
474
+ entriesStore: t.map((i) => i.entries)
475
475
  };
476
476
  });
477
477
  function Ne() {
@@ -483,50 +483,50 @@ const Ue = (t) => {
483
483
  return k({
484
484
  clock: t,
485
485
  source: e,
486
- fn: (r, s) => [
486
+ fn: (r, n) => [
487
487
  ...r,
488
488
  {
489
489
  id: Te++,
490
490
  at: /* @__PURE__ */ new Date(),
491
- payload: s
491
+ payload: n
492
492
  }
493
493
  ],
494
494
  target: e
495
495
  }), e;
496
496
  }, _e = x("field"), Le = b(() => {
497
497
  const t = _e.store({}), e = j(t, {
498
- register(n, l) {
498
+ register(s, l) {
499
499
  return {
500
- ...n,
500
+ ...s,
501
501
  [l.field.id]: l.field
502
502
  };
503
503
  }
504
504
  });
505
- function r(n) {
506
- e.register({ field: n });
505
+ function r(s) {
506
+ e.register({ field: s });
507
507
  }
508
- function s(n, l) {
509
- const f = d(n).getState();
510
- if (!f)
508
+ function n(s, l) {
509
+ const p = d(s).getState();
510
+ if (!p)
511
511
  return;
512
- const h = Object.assign({}, f, {
512
+ const h = Object.assign({}, p, {
513
513
  ...l
514
514
  });
515
515
  e.register({ field: { ...h } });
516
516
  }
517
- const i = t.map((n) => Object.values(n));
518
- function d(n) {
519
- return t.map((l) => l[n] || null);
517
+ const o = t.map((s) => Object.values(s));
518
+ function d(s) {
519
+ return t.map((l) => l[s] || null);
520
520
  }
521
- function o(n) {
522
- return t.map((l) => Object.values(l).find((f) => f.name === n) || null);
521
+ function i(s) {
522
+ return t.map((l) => Object.values(l).find((p) => p.name === s) || null);
523
523
  }
524
524
  return {
525
525
  register: r,
526
- update: s,
526
+ update: n,
527
527
  getById: d,
528
- listStore: i,
529
- getByName: o
528
+ listStore: o,
529
+ getByName: i
530
530
  };
531
531
  });
532
532
  function Je() {
@@ -536,27 +536,27 @@ const He = (t, e) => {
536
536
  e.register(t);
537
537
  }, Ge = x("action"), qe = b(() => {
538
538
  const t = Ge.store({}), e = j(t, {
539
- register(o, n) {
539
+ register(i, s) {
540
540
  return {
541
- ...o,
542
- [n.name]: {
543
- name: n.name,
544
- action: n.action
541
+ ...i,
542
+ [s.name]: {
543
+ name: s.name,
544
+ action: s.action
545
545
  }
546
546
  };
547
547
  }
548
548
  });
549
- function r(o, n) {
550
- e.register({ name: o, action: n });
549
+ function r(i, s) {
550
+ e.register({ name: i, action: s });
551
551
  }
552
- const s = t.map((o) => Object.values(o));
553
- function i(o) {
554
- return t.map((n) => n[o], { skipVoid: !1 });
552
+ const n = t.map((i) => Object.values(i));
553
+ function o(i) {
554
+ return t.map((s) => s[i], { skipVoid: !1 });
555
555
  }
556
- function d(o) {
556
+ function d(i) {
557
557
  return t.map(
558
- (n) => {
559
- const l = n[o];
558
+ (s) => {
559
+ const l = s[i];
560
560
  return l ? l.action : void 0;
561
561
  },
562
562
  { skipVoid: !1 }
@@ -564,8 +564,8 @@ const He = (t, e) => {
564
564
  }
565
565
  return {
566
566
  register: r,
567
- getByName: i,
568
- listStore: s,
567
+ getByName: o,
568
+ listStore: n,
569
569
  getEvokableAction: d
570
570
  };
571
571
  });
@@ -589,7 +589,7 @@ function G(t) {
589
589
  }
590
590
  }
591
591
  const Qe = x("response"), Xe = b(({ client: t }) => {
592
- const e = Qe.store({}), r = V(), s = V(), i = j(e, {
592
+ const e = Qe.store({}), r = V(), n = V(), o = j(e, {
593
593
  register(m, a) {
594
594
  return {
595
595
  ...m,
@@ -603,8 +603,8 @@ const Qe = x("response"), Xe = b(({ client: t }) => {
603
603
  };
604
604
  },
605
605
  clear(m, a) {
606
- const { [a]: c, ...p } = m;
607
- return p;
606
+ const { [a]: c, ...f } = m;
607
+ return f;
608
608
  },
609
609
  clearAll() {
610
610
  return {};
@@ -614,15 +614,15 @@ const Qe = x("response"), Xe = b(({ client: t }) => {
614
614
  if (typeof m == "string") {
615
615
  if (a === void 0)
616
616
  throw new Error("Response is required when registering a single field");
617
- i.register({ fieldId: m, response: a });
617
+ o.register({ fieldId: m, response: a });
618
618
  } else
619
- i.registerBatch(m);
619
+ o.registerBatch(m);
620
620
  }
621
- async function o(m) {
621
+ async function i(m) {
622
622
  const a = [];
623
623
  return await Promise.allSettled(
624
- Object.entries(m).map(async ([c, p]) => {
625
- let u = p;
624
+ Object.entries(m).map(async ([c, f]) => {
625
+ let u = f;
626
626
  const g = t.fields.getById(c).getState();
627
627
  if (!g) {
628
628
  a.push({
@@ -757,38 +757,38 @@ const Qe = x("response"), Xe = b(({ client: t }) => {
757
757
  })
758
758
  ), { responsesToCommit: m, validationErrors: a };
759
759
  }
760
- async function n(m) {
761
- const { responsesToCommit: a, validationErrors: c } = await o(m);
762
- return c.length ? { errors: c } : (i.registerBatch(a), { errors: [] });
760
+ async function s(m) {
761
+ const { responsesToCommit: a, validationErrors: c } = await i(m);
762
+ return c.length ? { errors: c } : (o.registerBatch(a), { errors: [] });
763
763
  }
764
- const l = e.map((m) => m), f = e.map((m) => Object.keys(m).map((c) => ({
764
+ const l = e.map((m) => m), p = e.map((m) => Object.keys(m).map((c) => ({
765
765
  fieldId: c,
766
766
  value: m[c]
767
767
  })));
768
768
  function h(m) {
769
- const a = t.fields.getById(m), c = e.map((p) => p[m] || null);
770
- return D({ f: a, r: c }, ({ f: p, r: u }) => u || (p?.defaultValue ? p.defaultValue : null));
769
+ const a = t.fields.getById(m), c = e.map((f) => f[m] || null);
770
+ return D({ f: a, r: c }, ({ f, r: u }) => u || (f?.defaultValue ? f.defaultValue : null));
771
771
  }
772
772
  function v(m) {
773
773
  const a = t.fields.getByName(m);
774
- return D({ f: a, s: e }, ({ f: c, s: p }) => {
775
- const u = c && p[c.id] || null;
774
+ return D({ f: a, s: e }, ({ f: c, s: f }) => {
775
+ const u = c && f[c.id] || null;
776
776
  return u || (c?.defaultValue ? c.defaultValue : null);
777
777
  });
778
778
  }
779
779
  return k({
780
780
  clock: r,
781
- target: i.clearAll
781
+ target: o.clearAll
782
782
  }), k({
783
- clock: s,
784
- target: i.clear
783
+ clock: n,
784
+ target: o.clear
785
785
  }), {
786
786
  register: d,
787
787
  clearAll: r,
788
- clear: s,
789
- commit: n,
790
- getResponsesToCommit: o,
791
- listStore: f,
788
+ clear: n,
789
+ commit: s,
790
+ getResponsesToCommit: i,
791
+ listStore: p,
792
792
  getAllStore: l,
793
793
  getByFieldId: h,
794
794
  getByFieldName: v
@@ -797,7 +797,7 @@ const Qe = x("response"), Xe = b(({ client: t }) => {
797
797
  function Ze(t) {
798
798
  return I(Xe, t);
799
799
  }
800
- const et = () => "0.0.45-next.1";
800
+ const et = () => "0.0.45-next.3";
801
801
  function tt() {
802
802
  if (T()) {
803
803
  const t = [
@@ -817,53 +817,53 @@ function rt() {
817
817
  if (!U())
818
818
  return {};
819
819
  const t = new URLSearchParams(window.location.search), e = {}, r = /* @__PURE__ */ new Set();
820
- for (const [i] of t.entries())
821
- i.startsWith("picked-") && r.add(i);
822
- for (const i of r) {
823
- const d = i.replace("picked-", "");
824
- e[d] = t.getAll(i);
820
+ for (const [o] of t.entries())
821
+ o.startsWith("picked-") && r.add(o);
822
+ for (const o of r) {
823
+ const d = o.replace("picked-", "");
824
+ e[d] = t.getAll(o);
825
825
  }
826
- const s = A("s");
826
+ const n = A("s");
827
827
  if (r.size > 0)
828
- O.set(s, e);
828
+ z.set(n, e);
829
829
  else {
830
- const i = O.get(s);
831
- if (i)
832
- return i.json() || {};
830
+ const o = z.get(n);
831
+ if (o)
832
+ return o.json() || {};
833
833
  }
834
834
  return e;
835
835
  }
836
- function st() {
836
+ function nt() {
837
837
  if (ue())
838
838
  return crypto.randomUUID();
839
- const t = Date.now().toString(36), e = Math.random().toString(36).substring(2, 15), r = Math.random().toString(36).substring(2, 15), s = Math.random().toString(36).substring(2, 15);
840
- return `${t}-${e}-${r}-${s}`;
839
+ 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);
840
+ return `${t}-${e}-${r}-${n}`;
841
841
  }
842
- const nt = A("session", "global"), it = () => {
843
- const t = z.get(nt);
842
+ const st = A("session", "global"), it = () => {
843
+ const t = C.get(st);
844
844
  let e;
845
845
  t.isSet() && (e = t.json());
846
- const r = (i) => t.set({
847
- id: i.id,
848
- isUser: i.isUser,
849
- identifiers: i.identifiers
850
- }), s = {
851
- id: e?.id ?? st(),
846
+ const r = (o) => t.set({
847
+ id: o.id,
848
+ isUser: o.isUser,
849
+ identifiers: o.identifiers
850
+ }), n = {
851
+ id: e?.id ?? nt(),
852
852
  isUser: e?.isUser ?? void 0,
853
853
  identifiers: e?.identifiers ?? void 0,
854
- setIsUser(i) {
855
- this.isUser = i, r(this);
854
+ setIsUser(o) {
855
+ this.isUser = o, r(this);
856
856
  },
857
- setIdentifier(i, d) {
858
- this.identifiers = { ...this.identifiers, [i]: d }, r(this);
857
+ setIdentifier(o, d) {
858
+ this.identifiers = { ...this.identifiers, [o]: d }, r(this);
859
859
  },
860
- removeIdentifier(i) {
860
+ removeIdentifier(o) {
861
861
  this.identifiers && (this.identifiers = Object.fromEntries(
862
- Object.entries(this.identifiers).filter(([d]) => d !== i)
862
+ Object.entries(this.identifiers).filter(([d]) => d !== o)
863
863
  ), this.identifiers = Object.keys(this.identifiers).length ? this.identifiers : void 0, r(this));
864
864
  }
865
865
  };
866
- return r(s), s;
866
+ return r(n), n;
867
867
  }, ot = () => ce() ? it() : null;
868
868
  function at() {
869
869
  if (U())
@@ -889,12 +889,12 @@ function dt(t) {
889
889
  const { organizationId: e, projectId: r } = t;
890
890
  if (e && r)
891
891
  return { organizationId: e, projectId: r };
892
- const s = ct();
893
- if (s)
894
- return s;
895
- const i = ut();
896
- if (i)
897
- return i;
892
+ const n = ct();
893
+ if (n)
894
+ return n;
895
+ const o = ut();
896
+ if (o)
897
+ return o;
898
898
  throw new Error(
899
899
  `organizationId and projectId are required. You can provide them via one of:
900
900
  (1) createClient({ organizationId, projectId }) options;
@@ -902,13 +902,13 @@ function dt(t) {
902
902
  (3) a <script> tag with id 'picked_script', 'picked', or 'cvly' that includes data-organizationid/data-projectid (or organization-id/project-id) attributes.`
903
903
  );
904
904
  }
905
- function C(t) {
905
+ function O(t) {
906
906
  return t == null || t === "" || Number.isNaN(t);
907
907
  }
908
908
  const lt = {
909
- default: (t, e) => C(t) ? String(e ?? "") : String(t),
910
- append: (t, e) => e && !C(t) ? `${t} ${e}` : t,
911
- prepend: (t, e) => e && !C(t) ? `${e} ${t}` : t,
909
+ default: (t, e) => O(t) ? String(e ?? "") : String(t),
910
+ append: (t, e) => e && !O(t) ? `${t} ${e}` : t,
911
+ prepend: (t, e) => e && !O(t) ? `${e} ${t}` : t,
912
912
  upper: (t) => typeof t == "string" ? t.toUpperCase() : t,
913
913
  lower: (t) => typeof t == "string" ? t.toLowerCase() : t,
914
914
  capitalize: (t) => typeof t == "string" ? t.charAt(0).toUpperCase() + t.slice(1) : t,
@@ -919,49 +919,49 @@ const lt = {
919
919
  if (Array.isArray(t))
920
920
  return e.format(t.map(String));
921
921
  if (t instanceof Map) {
922
- const r = Array.from(t.entries()).map(([s, i]) => `${s}: ${i}`);
922
+ const r = Array.from(t.entries()).map(([n, o]) => `${n}: ${o}`);
923
923
  return e.format(r);
924
924
  }
925
925
  return t instanceof Set ? e.format(Array.from(t).map(String)) : t;
926
926
  }
927
927
  };
928
- function ft(t) {
928
+ function pt(t) {
929
929
  return typeof t == "object" && t !== null;
930
930
  }
931
- function pt(t, e) {
931
+ function ft(t, e) {
932
932
  let r = e;
933
- for (const s of t.split("."))
934
- if (ft(r) && s in r)
935
- r = r[s];
933
+ for (const n of t.split("."))
934
+ if (pt(r) && n in r)
935
+ r = r[n];
936
936
  else
937
937
  return;
938
938
  return typeof r == "function" ? r() : r;
939
939
  }
940
940
  function gt(t, e) {
941
- const r = t.split("|").map((d) => d.trim()), s = r.shift() ?? "";
942
- let i = pt(s, e);
941
+ const r = t.split("|").map((d) => d.trim()), n = r.shift() ?? "";
942
+ let o = ft(n, e);
943
943
  for (const d of r) {
944
- const [o, ...n] = d.split(":"), l = o?.trim() ?? "", f = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), h = lt[l];
945
- h && (i = h(i, f));
944
+ const [i, ...s] = d.split(":"), l = i?.trim() ?? "", p = s.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), h = lt[l];
945
+ h && (o = h(o, p));
946
946
  }
947
- return C(i) ? "" : typeof i == "object" ? JSON.stringify(i) : String(i);
947
+ return O(o) ? "" : typeof o == "object" ? JSON.stringify(o) : String(o);
948
948
  }
949
949
  function mt(t, e) {
950
- let r = "", s = 0;
951
- for (; s < t.length; )
952
- if (t[s] === "{" && t[s + 1] === "{") {
953
- s += 2;
954
- let i = "";
955
- for (; s < t.length; ) {
956
- if (t[s] === "}" && t[s + 1] === "}") {
957
- s += 2;
950
+ let r = "", n = 0;
951
+ for (; n < t.length; )
952
+ if (t[n] === "{" && t[n + 1] === "{") {
953
+ n += 2;
954
+ let o = "";
955
+ for (; n < t.length; ) {
956
+ if (t[n] === "}" && t[n + 1] === "}") {
957
+ n += 2;
958
958
  break;
959
959
  }
960
- i += t[s++];
960
+ o += t[n++];
961
961
  }
962
- r += gt(i.trim(), e);
962
+ r += gt(o.trim(), e);
963
963
  } else
964
- r += t[s++];
964
+ r += t[n++];
965
965
  return r;
966
966
  }
967
967
  class ht {
@@ -981,18 +981,18 @@ class ht {
981
981
  searchParams = rt();
982
982
  history = Ne();
983
983
  components = be({ client: this });
984
- experienceInstances = ne({ client: this });
984
+ experienceInstances = se({ client: this });
985
985
  experiences = ge({ client: this });
986
986
  frameworks = xe({ client: this });
987
- predicates = Ce({ client: this });
987
+ predicates = Oe({ client: this });
988
988
  features = Me({ client: this });
989
989
  responses = Ze({ client: this });
990
990
  fields = Je();
991
991
  actions = Ke();
992
992
  constructor(e) {
993
993
  w("info", "Picked client initializing."), this.events = Ue(this.eventBus);
994
- const { organizationId: r, projectId: s } = dt(e);
995
- this.organizationId = r, this.projectId = s, this.options = Object.freeze(e), this.apiUrl = e.apiUrl || tt(), this.session = ot(), this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.precondition = e.precondition, this.condition = e.condition, this.eventBus({ type: "load", version: et() }), w("info", "Picked client initialized.");
994
+ const { organizationId: r, projectId: n } = dt(e);
995
+ this.organizationId = r, this.projectId = n, this.options = Object.freeze(e), this.apiUrl = e.apiUrl || tt(), this.session = ot(), this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.precondition = e.precondition, this.condition = e.condition, this.eventBus({ type: "load", version: et() }), w("info", "Picked client initialized.");
996
996
  }
997
997
  start = () => {
998
998
  Be(this), (async () => {
@@ -1000,16 +1000,16 @@ class ht {
1000
1000
  return;
1001
1001
  let r;
1002
1002
  typeof this.precondition > "u" ? r = !0 : typeof this.precondition == "boolean" ? r = this.precondition : r = await E(this, this.precondition) === !0;
1003
- let s;
1004
- r && (this.condition === void 0 ? s = !0 : typeof this.condition == "boolean" ? s = this.condition : s = await E(this, this.condition) === !0);
1005
- const i = r && s === !0;
1006
- if (typeof s == "boolean" && this.session) {
1007
- const d = s;
1003
+ let n;
1004
+ r && (this.condition === void 0 ? n = !0 : typeof this.condition == "boolean" ? n = this.condition : n = await E(this, this.condition) === !0);
1005
+ const o = r && n === !0;
1006
+ if (typeof n == "boolean" && this.session) {
1007
+ const d = n;
1008
1008
  this.session.setIsUser(d), this.eventBus({ type: "user_decide", value: d });
1009
1009
  }
1010
- if (this.eventBus({ type: "initialize" }), document.body && i && _(this), await ie(), i && _(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session) {
1011
- const { id: d, isUser: o, identifiers: n } = this.session;
1012
- this.eventBus({ type: "session", id: d, isUser: o, identifiers: n });
1010
+ if (this.eventBus({ type: "initialize" }), document.body && o && _(this), await ie(), o && _(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session) {
1011
+ const { id: d, isUser: i, identifiers: s } = this.session;
1012
+ this.eventBus({ type: "session", id: d, isUser: i, identifiers: s });
1013
1013
  }
1014
1014
  })();
1015
1015
  };
@@ -1026,7 +1026,7 @@ class ht {
1026
1026
  De(e, r, this.features);
1027
1027
  };
1028
1028
  registerPredicate = (e, r) => {
1029
- ze(e, r, this.predicates);
1029
+ Ce(e, r, this.predicates);
1030
1030
  };
1031
1031
  registerField = (e) => {
1032
1032
  He(e, this.fields);
@@ -1038,13 +1038,21 @@ class ht {
1038
1038
  e.component && L(`experience:${e.id}`, e.component, this.components), me(e, this.experiences);
1039
1039
  };
1040
1040
  getStateSnapshot = () => Y(this);
1041
- launchExperienceById = async (e) => {
1042
- const r = this.experiences.getById(e).getState();
1043
- if (!r) {
1041
+ launchExperienceById = async (e, r) => {
1042
+ const n = this.experiences.getById(e).getState();
1043
+ if (!n) {
1044
1044
  w("warn", `Experience with id '${e}' not found.`);
1045
1045
  return;
1046
1046
  }
1047
- W(this, r);
1047
+ W(this, n, r);
1048
+ };
1049
+ openExperienceById = async (e) => {
1050
+ const r = this.experienceInstances.getByExperienceId(e).getState();
1051
+ if (r.length > 0)
1052
+ for (const n of r)
1053
+ n.toggleOpen();
1054
+ else
1055
+ return this.launchExperienceById(e, { initialiseOpen: !0 });
1048
1056
  };
1049
1057
  // private async fetchProject() {
1050
1058
  // if (this.project) {
@@ -1058,14 +1066,14 @@ class ht {
1058
1066
  setupPlugins() {
1059
1067
  this.options.plugins?.forEach((e) => {
1060
1068
  if (Array.isArray(e)) {
1061
- e.forEach((s) => {
1062
- this.registerPlugin(s);
1069
+ e.forEach((n) => {
1070
+ this.registerPlugin(n);
1063
1071
  });
1064
1072
  return;
1065
1073
  }
1066
1074
  const r = typeof e == "function" ? e() : e;
1067
1075
  if (Array.isArray(r)) {
1068
- r.forEach((s) => this.registerPlugin(s));
1076
+ r.forEach((n) => this.registerPlugin(n));
1069
1077
  return;
1070
1078
  }
1071
1079
  this.registerPlugin(r);
@@ -1073,19 +1081,19 @@ class ht {
1073
1081
  }
1074
1082
  setupFeatures() {
1075
1083
  const e = this.options.features;
1076
- e && (Object.entries(e).forEach(([r, s]) => {
1077
- const i = typeof s == "function" ? s() : s;
1078
- this.registerFeature(r, i);
1084
+ e && (Object.entries(e).forEach(([r, n]) => {
1085
+ const o = typeof n == "function" ? n() : n;
1086
+ this.registerFeature(r, o);
1079
1087
  }), this.searchParams.feature && this.searchParams.feature.forEach((r) => {
1080
1088
  try {
1081
- const [s, i] = r.split(":");
1082
- if (!s || !i)
1089
+ const [n, o] = r.split(":");
1090
+ if (!n || !o)
1083
1091
  return;
1084
- let d = i;
1085
- d === "true" && (d = !0), d === "false" && (d = !1), this.registerFeature(s, {
1092
+ let d = o;
1093
+ d === "true" && (d = !0), d === "false" && (d = !1), this.registerFeature(n, {
1086
1094
  key: `${d}`,
1087
1095
  // use the assigned bucket value as the key
1088
- name: s,
1096
+ name: n,
1089
1097
  // eslint-disable-next-line sonarjs/function-return-type
1090
1098
  decide: () => d,
1091
1099
  storage: "session"
@@ -1096,22 +1104,22 @@ class ht {
1096
1104
  }
1097
1105
  setupPredicates() {
1098
1106
  const e = this.options.predicates;
1099
- e && Object.entries(e).forEach(([r, s]) => {
1100
- if (typeof s != "function") {
1107
+ e && Object.entries(e).forEach(([r, n]) => {
1108
+ if (typeof n != "function") {
1101
1109
  w("warn", `Predicate "${r}" is not a function.`);
1102
1110
  return;
1103
1111
  }
1104
- this.registerPredicate(r, s);
1112
+ this.registerPredicate(r, n);
1105
1113
  });
1106
1114
  }
1107
1115
  setupActions() {
1108
1116
  const e = this.options.actions;
1109
- e && Object.entries(e).forEach(([r, s]) => {
1110
- if (typeof s != "function") {
1117
+ e && Object.entries(e).forEach(([r, n]) => {
1118
+ if (typeof n != "function") {
1111
1119
  w("warn", `Action "${r}" is not a function.`);
1112
1120
  return;
1113
1121
  }
1114
- this.registerAction(r, s);
1122
+ this.registerAction(r, n);
1115
1123
  });
1116
1124
  }
1117
1125
  getPluginConfig = (e) => this.plugins[e] ?? {};
@@ -1158,10 +1166,10 @@ class ht {
1158
1166
  * // => "Fruits: apple, banana, and cherry"
1159
1167
  */
1160
1168
  renderString = (e, r) => {
1161
- const s = this.responses.listStore.getState().reduce((i, d) => (i[d.fieldId] = d.value, i), {});
1169
+ const n = this.responses.listStore.getState().reduce((o, d) => (o[d.fieldId] = d.value, o), {});
1162
1170
  return mt(e, {
1163
1171
  ...r,
1164
- responses: s
1172
+ responses: n
1165
1173
  });
1166
1174
  };
1167
1175
  }
@@ -1173,17 +1181,17 @@ function yt(t) {
1173
1181
  }
1174
1182
  async function jt(t, e) {
1175
1183
  return e.length === 0 || !yt(e) ? e : (await Promise.all(
1176
- e.map(async (s) => {
1177
- if (!(s.condition ? await E(t, s.condition) : !0))
1184
+ e.map(async (n) => {
1185
+ if (!(n.condition ? await E(t, n.condition) : !0))
1178
1186
  return null;
1179
- if (!s.options || !Q(s))
1180
- return s;
1181
- const o = (await Promise.all(
1182
- s.options.map(async (l) => l.condition ? await E(t, l.condition) ? l : null : l)
1187
+ if (!n.options || !Q(n))
1188
+ return n;
1189
+ const i = (await Promise.all(
1190
+ n.options.map(async (l) => l.condition ? await E(t, l.condition) ? l : null : l)
1183
1191
  )).filter((l) => l !== null);
1184
- return o.length === s.options.length ? s : o.length === 0 ? null : { ...s, options: o };
1192
+ return i.length === n.options.length ? n : i.length === 0 ? null : { ...n, options: i };
1185
1193
  })
1186
- )).filter((s) => s !== null);
1194
+ )).filter((n) => n !== null);
1187
1195
  }
1188
1196
  const Et = (t) => {
1189
1197
  const e = new ht(t);
@@ -1197,13 +1205,13 @@ export {
1197
1205
  at as getPickedConfig,
1198
1206
  jt as getStepFields,
1199
1207
  Bt as isPickedRoot,
1200
- z as localStore,
1201
- O as sessionStore,
1208
+ C as localStore,
1209
+ z as sessionStore,
1202
1210
  $t as subscribe,
1203
- zt as supportsCookies,
1211
+ Ct as supportsCookies,
1204
1212
  ue as supportsCryptoRandomUUID,
1205
1213
  T as supportsDocument,
1206
- Ot as supportsHistory,
1214
+ zt as supportsHistory,
1207
1215
  Mt as supportsIntersectionObserver,
1208
1216
  ce as supportsLocalStorage,
1209
1217
  Dt as supportsLocation,