@picked/client 0.0.1-dev.1777601813342 → 0.0.1-dev.1777611471601

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.
Files changed (65) hide show
  1. package/dist/{api-BAOO2VZv.cjs → api-CP_eIRW2.cjs} +1 -1
  2. package/dist/{api-CiR56vZg.js → api-UYfzBUGT.js} +1 -1
  3. package/dist/cjs/form/index.js +1 -1
  4. package/dist/cjs/index.js +2 -2
  5. package/dist/cjs/plugins/create-experience/index.js +1 -1
  6. package/dist/cjs/plugins/dom-observer/index.js +1 -0
  7. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  8. package/dist/cjs/plugins/experience-browser-storage/index.js +1 -1
  9. package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
  10. package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
  11. package/dist/cjs/plugins/responses-indexeddb/index.js +1 -1
  12. package/dist/cjs/plugins/single-page-app/index.js +1 -1
  13. package/dist/cjs/plugins/web-components/index.js +1 -1
  14. package/dist/cjs/plugins/window-object/index.js +1 -1
  15. package/dist/cjs/server/index.js +1 -1
  16. package/dist/esm/form/index.js +1 -1
  17. package/dist/esm/index.js +178 -177
  18. package/dist/esm/plugins/create-experience/index.js +1 -1
  19. package/dist/esm/plugins/dom-observer/index.js +58 -0
  20. package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
  21. package/dist/esm/plugins/experience-browser-storage/index.js +3 -3
  22. package/dist/esm/plugins/history-browser-storage/index.js +2 -2
  23. package/dist/esm/plugins/responses-browser-storage/index.js +2 -2
  24. package/dist/esm/plugins/responses-indexeddb/index.js +1 -1
  25. package/dist/esm/plugins/single-page-app/index.js +25 -93
  26. package/dist/esm/plugins/web-components/index.js +2 -2
  27. package/dist/esm/plugins/window-object/index.js +1 -1
  28. package/dist/esm/server/index.js +1 -1
  29. package/dist/{experience-DOWnsvA1.cjs → experience-BhteyYBl.cjs} +1 -1
  30. package/dist/{experience-CR19HpPg.js → experience-CoMdlvyn.js} +3 -3
  31. package/dist/{experience-instance-C2jZU8ho.cjs → experience-instance-CZDcicPj.cjs} +1 -1
  32. package/dist/{experience-instance-CGLdwg--.js → experience-instance-IkIw31Cg.js} +15 -28
  33. package/dist/{nodes-Bmzx3TP_.js → nodes-ChVU1VZO.js} +7 -7
  34. package/dist/{nodes-Dx9bxj35.cjs → nodes-DDDs-rC2.cjs} +1 -1
  35. package/dist/object-C82v79xc.js +25 -0
  36. package/dist/object-CUJOjanb.cjs +1 -0
  37. package/dist/rules-logic-BTIxfrJJ.js +240 -0
  38. package/dist/rules-logic-DNLOv90w.cjs +1 -0
  39. package/dist/{supports-DUJbucFW.js → supports-0XIfd4-R.js} +9 -18
  40. package/dist/supports-Dsjg-82e.cjs +1 -0
  41. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  42. package/dist/types/entities/framework/framework.d.ts +0 -12
  43. package/dist/types/entities/framework/framework.d.ts.map +1 -1
  44. package/dist/types/plugins/dom-observer/index.d.ts +3 -0
  45. package/dist/types/plugins/dom-observer/index.d.ts.map +1 -0
  46. package/dist/types/plugins/dom-observer/plugin.d.ts +37 -0
  47. package/dist/types/plugins/dom-observer/plugin.d.ts.map +1 -0
  48. package/dist/types/plugins/single-page-app/index.d.ts +1 -2
  49. package/dist/types/plugins/single-page-app/index.d.ts.map +1 -1
  50. package/dist/types/plugins/single-page-app/plugin.d.ts +9 -92
  51. package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
  52. package/dist/types/utils/global-obj.d.ts +0 -5
  53. package/dist/types/utils/global-obj.d.ts.map +1 -1
  54. package/dist/types/utils/supports.d.ts +0 -113
  55. package/dist/types/utils/supports.d.ts.map +1 -1
  56. package/package.json +11 -1
  57. package/dist/rules-logic-CvILqbhz.js +0 -266
  58. package/dist/rules-logic-DV5SUr5M.cjs +0 -1
  59. package/dist/supports-DFDQ6eJO.cjs +0 -1
  60. /package/dist/{id-n2yrHvNo.js → id-B-N2zNbS.js} +0 -0
  61. /package/dist/{id-Cg7fVl1O.cjs → id-Bbodazn8.cjs} +0 -0
  62. /package/dist/{logger-C44jSdYl.js → logger-6z_gb4rA.js} +0 -0
  63. /package/dist/{logger-CJUj90QX.cjs → logger-fbvQC40v.cjs} +0 -0
  64. /package/dist/{storage-B6lQtc4-.cjs → storage-BXSlLTRa.cjs} +0 -0
  65. /package/dist/{storage-6Xk0uAxB.js → storage-hOHCCXvP.js} +0 -0
@@ -0,0 +1,240 @@
1
+ import { t as e } from "./object-C82v79xc.js";
2
+ //#region src/logic-engine.ts
3
+ function t(e) {
4
+ return typeof e == "number" && !isNaN(e);
5
+ }
6
+ function n(e) {
7
+ return typeof e == "string";
8
+ }
9
+ function r(e) {
10
+ return Array.isArray(e);
11
+ }
12
+ function i(e) {
13
+ return e instanceof Promise;
14
+ }
15
+ function a(e) {
16
+ return typeof e == "object" && !!e && !Array.isArray(e) && Object.keys(e).length === 1;
17
+ }
18
+ function o(e) {
19
+ if (t(e)) return e;
20
+ let n = parseFloat(`${e}`);
21
+ return isNaN(n) ? 0 : n;
22
+ }
23
+ function s(e) {
24
+ return `${e}`;
25
+ }
26
+ var c = {
27
+ "==": (e, t) => e == t,
28
+ "===": (e, t) => e === t,
29
+ "!=": (e, t) => e != t,
30
+ "!==": (e, t) => e !== t,
31
+ ">": (e, t) => o(e) > o(t),
32
+ ">=": (e, t) => o(e) >= o(t),
33
+ "<": (e, t, n) => {
34
+ let r = o(e), i = o(t);
35
+ if (n === void 0) return r < i;
36
+ let a = o(n);
37
+ return r < i && i < a;
38
+ },
39
+ "<=": (e, t, n) => {
40
+ let r = o(e), i = o(t);
41
+ if (n === void 0) return r <= i;
42
+ let a = o(n);
43
+ return r <= i && i <= a;
44
+ },
45
+ "!!": async (e) => await u(e),
46
+ "!": async (e) => !await u(e),
47
+ "%": (e, t) => o(e) % o(t),
48
+ log: (e) => (console.log(e), e),
49
+ in: (e, t) => t ? n(t) ? t.indexOf(s(e)) !== -1 : r(t) ? t.includes(e) : !1 : !1,
50
+ cat: (...e) => e.map(s).join(""),
51
+ substr: (e, t, n) => {
52
+ let r = s(e), i = o(t);
53
+ if (n === void 0) return r.substr(i);
54
+ let a = o(n);
55
+ if (a < 0) {
56
+ let e = r.substr(i);
57
+ return e.substr(0, e.length + a);
58
+ }
59
+ return r.substr(i, a);
60
+ },
61
+ "+": (...e) => e.reduce((e, t) => o(e) + o(t), 0),
62
+ "*": (...e) => e.reduce((e, t) => o(e) * o(t), 1),
63
+ "-": (e, t) => {
64
+ let n = o(e);
65
+ return t === void 0 ? -n : n - o(t);
66
+ },
67
+ "/": (e, t) => o(e) / o(t),
68
+ min: (...e) => Math.min(...e.map(o)),
69
+ max: (...e) => Math.max(...e.map(o)),
70
+ merge: (...e) => e.reduce((e, t) => r(t) ? e.concat(t) : e.concat([t]), []),
71
+ var(e, t) {
72
+ let n = arguments.length > 1 ? t : null;
73
+ if (e === "" || e === "." || e == null) return this;
74
+ if (typeof e == "number" && Array.isArray(this)) return e >= 0 && e < this.length ? this[e] : n;
75
+ let r = s(e);
76
+ if (r === "" || r === ".") return this;
77
+ let i = r.split("."), a = this;
78
+ for (let e of i) {
79
+ if (a == null) return n;
80
+ if (Array.isArray(a)) {
81
+ let t = parseInt(e, 10);
82
+ a = isNaN(t) ? a[e] : a[t];
83
+ } else a = a[e];
84
+ }
85
+ return a === void 0 ? n : a;
86
+ },
87
+ async missing(...e) {
88
+ let t = r(e[0]) ? e[0] : e, n = [];
89
+ for (let e of t) {
90
+ let t = await l({ var: e }, this);
91
+ (t === null || t === "") && n.push(`${e}`);
92
+ }
93
+ return n;
94
+ },
95
+ async missing_some(e, t) {
96
+ let i = await l({ missing: t }, this);
97
+ if (!r(i) || !r(t)) return [];
98
+ let a = i.filter(n);
99
+ return t.filter(n).length - a.length >= o(e) ? [] : a;
100
+ },
101
+ invoke(...e) {
102
+ let [t, ...n] = e;
103
+ return typeof t == "function" ? Reflect.apply(t, null, n) : null;
104
+ },
105
+ startsWith: (e, t) => n(e) && n(t) && e.startsWith(t),
106
+ endsWith: (e, t) => n(e) && n(t) && e.endsWith(t),
107
+ regexp_matches(e, t) {
108
+ let i = e, a = "";
109
+ if (r(e)) {
110
+ let [t, n] = e;
111
+ i = t, a = n;
112
+ }
113
+ return !n(i) || !n(a) ? !1 : new RegExp(i, a).test(s(t));
114
+ },
115
+ throw(e) {
116
+ throw Error(s(e));
117
+ }
118
+ };
119
+ async function l(e, t) {
120
+ if (!e) return e;
121
+ if (i(e)) return l(await e, t);
122
+ if (r(e)) return Promise.all(e.map((e) => l(e, t)));
123
+ if (!a(e)) return e;
124
+ let n = d(e), o = n ? e[n] ?? [] : [];
125
+ switch (r(o) || (o = [o]), n) {
126
+ case "if":
127
+ case "?:":
128
+ for (let e = 0; e < o.length - 1; e += 2) if (await u(await l(o[e], t))) return l(o[e + 1], t);
129
+ return o.length % 2 == 1 ? l(o[o.length - 1], t) : null;
130
+ case "and": {
131
+ let e = null;
132
+ for (let n of o) if (e = await l(n, t), !await u(e)) return e;
133
+ return e;
134
+ }
135
+ case "or": {
136
+ let e = null;
137
+ for (let n of o) if (e = await l(n, t), await u(e)) return e;
138
+ return e;
139
+ }
140
+ case "map": {
141
+ let e = await l(o[0], t);
142
+ return r(e) ? await Promise.all(e.map((e) => l(o[1], e))) : [];
143
+ }
144
+ case "filter": {
145
+ let e = await l(o[0], t);
146
+ return r(e) ? (await Promise.all(e.map(async (e) => ({
147
+ item: e,
148
+ shouldInclude: await u(await l(o[1], e))
149
+ })))).filter(({ shouldInclude: e }) => e).map(({ item: e }) => e) : [];
150
+ }
151
+ case "reduce": {
152
+ let e = await l(o[0], t);
153
+ if (!r(e)) return o.length > 2 ? await l(o[2], t) : null;
154
+ let n = o[1], i = o.length > 2 ? await l(o[2], t) : null;
155
+ for (let t of e) i = await l(n, {
156
+ current: t,
157
+ accumulator: i
158
+ });
159
+ return i;
160
+ }
161
+ case "all": {
162
+ let e = await l(o[0], t);
163
+ if (!r(e) || e.length === 0) return !1;
164
+ for (let t of e) if (!await u(await l(o[1], t))) return !1;
165
+ return !0;
166
+ }
167
+ case "some": {
168
+ let e = await l(o[0], t);
169
+ if (!r(e)) return !1;
170
+ for (let t of e) if (await u(await l(o[1], t))) return !0;
171
+ return !1;
172
+ }
173
+ case "none": {
174
+ let e = await l(o[0], t);
175
+ if (!r(e)) return !0;
176
+ for (let t of e) if (await u(await l(o[1], t))) return !1;
177
+ return !0;
178
+ }
179
+ case "catch": try {
180
+ return await l(o[0], t);
181
+ } catch (e) {
182
+ return a(e) ? await l(e, t) : o[1] ? await l(o[1], e) : e instanceof Error ? e.message : e;
183
+ }
184
+ }
185
+ let s = await Promise.all(o.map((e) => l(e, t))), f = n ? c[n] : void 0;
186
+ if (!f) throw Error(`Unrecognized operation ${n}`);
187
+ return f.apply(t, s);
188
+ }
189
+ async function u(e) {
190
+ return i(e) ? u(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
191
+ }
192
+ function d(e) {
193
+ return Object.keys(e)[0];
194
+ }
195
+ //#endregion
196
+ //#region src/utils/rules-logic.ts
197
+ function f(t) {
198
+ return !e(t);
199
+ }
200
+ async function p(e, t, n) {
201
+ let r = e.getStateSnapshot(), i = e.predicates.listStore.getState().reduce((e, t) => ({
202
+ ...e,
203
+ [t.name]: (...e) => t.predicate({
204
+ ...r,
205
+ args: e
206
+ })
207
+ }), {}), a = e.actions.listStore.getState().reduce((e, t) => ({
208
+ ...e,
209
+ [t.key]: (...e) => t.action({
210
+ ...r,
211
+ args: e
212
+ }, null)
213
+ }), {}), o = e.features.listStore.getState().reduce((e, t) => ({
214
+ ...e,
215
+ [t.id]: async () => {
216
+ let { bucket: e } = await t.getBucket();
217
+ return e;
218
+ }
219
+ }), {});
220
+ return await l(t, {
221
+ responses: e.responses.getAllStore.getState(),
222
+ location: typeof r.location == "object" ? {
223
+ hash: r.location.hash,
224
+ host: r.location.host,
225
+ hostname: r.location.hostname,
226
+ href: r.location.href,
227
+ origin: r.location.origin,
228
+ pathname: r.location.pathname,
229
+ port: r.location.port,
230
+ protocol: r.location.protocol,
231
+ search: r.location.search
232
+ } : void 0,
233
+ predicates: i,
234
+ actions: a,
235
+ features: o,
236
+ ...n
237
+ });
238
+ }
239
+ //#endregion
240
+ export { f as n, p as t };
@@ -0,0 +1 @@
1
+ const e=require(`./object-CUJOjanb.cjs`);function t(e){return typeof e==`number`&&!isNaN(e)}function n(e){return typeof e==`string`}function r(e){return Array.isArray(e)}function i(e){return e instanceof Promise}function a(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).length===1}function o(e){if(t(e))return e;let n=parseFloat(`${e}`);return isNaN(n)?0:n}function s(e){return`${e}`}var c={"==":(e,t)=>e==t,"===":(e,t)=>e===t,"!=":(e,t)=>e!=t,"!==":(e,t)=>e!==t,">":(e,t)=>o(e)>o(t),">=":(e,t)=>o(e)>=o(t),"<":(e,t,n)=>{let r=o(e),i=o(t);if(n===void 0)return r<i;let a=o(n);return r<i&&i<a},"<=":(e,t,n)=>{let r=o(e),i=o(t);if(n===void 0)return r<=i;let a=o(n);return r<=i&&i<=a},"!!":async e=>await u(e),"!":async e=>!await u(e),"%":(e,t)=>o(e)%o(t),log:e=>(console.log(e),e),in:(e,t)=>t?n(t)?t.indexOf(s(e))!==-1:r(t)?t.includes(e):!1:!1,cat:(...e)=>e.map(s).join(``),substr:(e,t,n)=>{let r=s(e),i=o(t);if(n===void 0)return r.substr(i);let a=o(n);if(a<0){let e=r.substr(i);return e.substr(0,e.length+a)}return r.substr(i,a)},"+":(...e)=>e.reduce((e,t)=>o(e)+o(t),0),"*":(...e)=>e.reduce((e,t)=>o(e)*o(t),1),"-":(e,t)=>{let n=o(e);return t===void 0?-n:n-o(t)},"/":(e,t)=>o(e)/o(t),min:(...e)=>Math.min(...e.map(o)),max:(...e)=>Math.max(...e.map(o)),merge:(...e)=>e.reduce((e,t)=>r(t)?e.concat(t):e.concat([t]),[]),var(e,t){let n=arguments.length>1?t:null;if(e===``||e===`.`||e==null)return this;if(typeof e==`number`&&Array.isArray(this))return e>=0&&e<this.length?this[e]:n;let r=s(e);if(r===``||r===`.`)return this;let i=r.split(`.`),a=this;for(let e of i){if(a==null)return n;if(Array.isArray(a)){let t=parseInt(e,10);a=isNaN(t)?a[e]:a[t]}else a=a[e]}return a===void 0?n:a},async missing(...e){let t=r(e[0])?e[0]:e,n=[];for(let e of t){let t=await l({var:e},this);(t===null||t===``)&&n.push(`${e}`)}return n},async missing_some(e,t){let i=await l({missing:t},this);if(!r(i)||!r(t))return[];let a=i.filter(n);return t.filter(n).length-a.length>=o(e)?[]:a},invoke(...e){let[t,...n]=e;return typeof t==`function`?Reflect.apply(t,null,n):null},startsWith:(e,t)=>n(e)&&n(t)&&e.startsWith(t),endsWith:(e,t)=>n(e)&&n(t)&&e.endsWith(t),regexp_matches(e,t){let i=e,a=``;if(r(e)){let[t,n]=e;i=t,a=n}return!n(i)||!n(a)?!1:new RegExp(i,a).test(s(t))},throw(e){throw Error(s(e))}};async function l(e,t){if(!e)return e;if(i(e))return l(await e,t);if(r(e))return Promise.all(e.map(e=>l(e,t)));if(!a(e))return e;let n=d(e),o=n?e[n]??[]:[];switch(r(o)||(o=[o]),n){case`if`:case`?:`:for(let e=0;e<o.length-1;e+=2)if(await u(await l(o[e],t)))return l(o[e+1],t);return o.length%2==1?l(o[o.length-1],t):null;case`and`:{let e=null;for(let n of o)if(e=await l(n,t),!await u(e))return e;return e}case`or`:{let e=null;for(let n of o)if(e=await l(n,t),await u(e))return e;return e}case`map`:{let e=await l(o[0],t);return r(e)?await Promise.all(e.map(e=>l(o[1],e))):[]}case`filter`:{let e=await l(o[0],t);return r(e)?(await Promise.all(e.map(async e=>({item:e,shouldInclude:await u(await l(o[1],e))})))).filter(({shouldInclude:e})=>e).map(({item:e})=>e):[]}case`reduce`:{let e=await l(o[0],t);if(!r(e))return o.length>2?await l(o[2],t):null;let n=o[1],i=o.length>2?await l(o[2],t):null;for(let t of e)i=await l(n,{current:t,accumulator:i});return i}case`all`:{let e=await l(o[0],t);if(!r(e)||e.length===0)return!1;for(let t of e)if(!await u(await l(o[1],t)))return!1;return!0}case`some`:{let e=await l(o[0],t);if(!r(e))return!1;for(let t of e)if(await u(await l(o[1],t)))return!0;return!1}case`none`:{let e=await l(o[0],t);if(!r(e))return!0;for(let t of e)if(await u(await l(o[1],t)))return!1;return!0}case`catch`:try{return await l(o[0],t)}catch(e){return a(e)?await l(e,t):o[1]?await l(o[1],e):e instanceof Error?e.message:e}}let s=await Promise.all(o.map(e=>l(e,t))),f=n?c[n]:void 0;if(!f)throw Error(`Unrecognized operation ${n}`);return f.apply(t,s)}async function u(e){return i(e)?u(await e):!(Array.isArray(e)&&e.length===0)&&!!e}function d(e){return Object.keys(e)[0]}function f(t){return!e.t(t)}async function p(e,t,n){let r=e.getStateSnapshot(),i=e.predicates.listStore.getState().reduce((e,t)=>({...e,[t.name]:(...e)=>t.predicate({...r,args:e})}),{}),a=e.actions.listStore.getState().reduce((e,t)=>({...e,[t.key]:(...e)=>t.action({...r,args:e},null)}),{}),o=e.features.listStore.getState().reduce((e,t)=>({...e,[t.id]:async()=>{let{bucket:e}=await t.getBucket();return e}}),{});return await l(t,{responses:e.responses.getAllStore.getState(),location:typeof r.location==`object`?{hash:r.location.hash,host:r.location.host,hostname:r.location.hostname,href:r.location.href,origin:r.location.origin,pathname:r.location.pathname,port:r.location.port,protocol:r.location.protocol,search:r.location.search}:void 0,predicates:i,actions:a,features:o,...n})}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return p}});
@@ -19,71 +19,62 @@ function i() {
19
19
  }
20
20
  }
21
21
  function a() {
22
- try {
23
- if (!("navigation" in t)) return !1;
24
- let e = t.navigation;
25
- return !!e && typeof e?.addEventListener == "function";
26
- } catch {
27
- return !1;
28
- }
29
- }
30
- function o() {
31
22
  try {
32
23
  return "localStorage" in t && !!t.localStorage;
33
24
  } catch {
34
25
  return !1;
35
26
  }
36
27
  }
37
- function s() {
28
+ function o() {
38
29
  try {
39
30
  return "sessionStorage" in t && !!t.sessionStorage;
40
31
  } catch {
41
32
  return !1;
42
33
  }
43
34
  }
44
- function c() {
35
+ function s() {
45
36
  try {
46
37
  return "document" in t && "cookie" in t.document;
47
38
  } catch {
48
39
  return !1;
49
40
  }
50
41
  }
51
- function l() {
42
+ function c() {
52
43
  try {
53
44
  return "document" in t && "createElement" in t.document && "attachShadow" in t.document.createElement("div");
54
45
  } catch {
55
46
  return !1;
56
47
  }
57
48
  }
58
- function u() {
49
+ function l() {
59
50
  try {
60
51
  return "window" in t;
61
52
  } catch {
62
53
  return !1;
63
54
  }
64
55
  }
65
- function d() {
56
+ function u() {
66
57
  try {
67
58
  return "document" in t;
68
59
  } catch {
69
60
  return !1;
70
61
  }
71
62
  }
72
- function f() {
63
+ function d() {
73
64
  try {
74
65
  return "IntersectionObserver" in t;
75
66
  } catch {
76
67
  return !1;
77
68
  }
78
69
  }
79
- function p() {
70
+ function f() {
80
71
  try {
81
72
  return "customElements" in t && !!t.customElements;
82
73
  } catch {
83
74
  return !1;
84
75
  }
85
76
  }
86
- function m() {
77
+ function p() {
87
78
  try {
88
79
  return "crypto" in t && "randomUUID" in t.crypto;
89
80
  } catch {
@@ -91,4 +82,4 @@ function m() {
91
82
  }
92
83
  }
93
84
  //#endregion
94
- export { f as a, a as c, p as d, u as f, i, s as l, n as m, m as n, o, t as p, d as r, r as s, c as t, l as u };
85
+ export { d as a, o as c, l as d, t as f, i, c as l, p as n, a as o, n as p, u as r, r as s, s as t, f as u };
@@ -0,0 +1 @@
1
+ var e=Symbol(`Picked`),t=globalThis,n=n=>{t[e]=n};function r(){try{return`location`in t&&!!t.location}catch{return!1}}function i(){try{return`history`in t&&!!t.history}catch{return!1}}function a(){try{return`localStorage`in t&&!!t.localStorage}catch{return!1}}function o(){try{return`sessionStorage`in t&&!!t.sessionStorage}catch{return!1}}function s(){try{return`document`in t&&`cookie`in t.document}catch{return!1}}function c(){try{return`document`in t&&`createElement`in t.document&&`attachShadow`in t.document.createElement(`div`)}catch{return!1}}function l(){try{return`window`in t}catch{return!1}}function u(){try{return`document`in t}catch{return!1}}function d(){try{return`IntersectionObserver`in t}catch{return!1}}function f(){try{return`customElements`in t&&!!t.customElements}catch{return!1}}function p(){try{return`crypto`in t&&`randomUUID`in t.crypto}catch{return!1}}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return f}});
@@ -1 +1 @@
1
- {"version":3,"file":"experience-instance.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience-instance/experience-instance.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAOL,KAAK,aAAa,EAGlB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAiB1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB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,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAA;AACtF,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,WAAW,EAAE,CAAA;IACvB,SAAS,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAA;CACzC;AAED,QAAA,MAAM,+BAA+B,6CAMhC;IACD,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,eAAe,CAAA;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,OAAO,CAAC,EAAE,uBAAuB,CAAA;CAClC,iCAgdF,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,CAAC,SAAS,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAAC,CAAC,CAAC,EAC/D,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAE/D;AAED,QAAA,MAAM,oCAAoC,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;wBA2L1E,eAAe,UACnB,WAAW,YACT,uBAAuB;8BAmBF,UAAU,CAAC,KAAK,CAAC;4BAiBnB,UAAU,CAAC,IAAI,CAAC;;CAU/C,CAAA;AAEF;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAC3C,CAAC,SAAS,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAAC,CAAC,CAAC,EACpE,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAEpE"}
1
+ {"version":3,"file":"experience-instance.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience-instance/experience-instance.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAOL,KAAK,aAAa,EAGlB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAA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CAAC,IAAI,CAAC,CAAA;IACrC,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IACnC,iBAAiB,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC,CAAA;CACzC;AAED,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAA;AACtF,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,WAAW,EAAE,CAAA;IACvB,SAAS,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAA;CACzC;AAED,QAAA,MAAM,+BAA+B,6CAMhC;IACD,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,eAAe,CAAA;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,OAAO,CAAC,EAAE,uBAAuB,CAAA;CAClC,iCAgdF,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,CAAC,SAAS,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAAC,CAAC,CAAC,EAC/D,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAE/D;AAED,QAAA,MAAM,oCAAoC,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;wBA0J1E,eAAe,UACnB,WAAW,YACT,uBAAuB;8BAmBF,UAAU,CAAC,KAAK,CAAC;4BAiBnB,UAAU,CAAC,IAAI,CAAC;;CAU/C,CAAA;AAEF;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAC3C,CAAC,SAAS,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAAC,CAAC,CAAC,EACpE,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAEpE"}
@@ -5,7 +5,6 @@ export type FrameworksStore = ReturnType<typeof createFrameworkIndex>;
5
5
  export interface Framework {
6
6
  name: string;
7
7
  render: FrameworkRender;
8
- unRender: FrameworkUnRender;
9
8
  }
10
9
  declare const createFrameworkIndexFactory: ({ client }: {
11
10
  client: Picked;
@@ -14,19 +13,8 @@ declare const createFrameworkIndexFactory: ({ client }: {
14
13
  getByName: (name: string) => import('effector').Store<Framework | undefined>;
15
14
  listStore: import('effector').Store<Framework[]>;
16
15
  };
17
- /**
18
- * Creates the framework registry store and its register/getByName API for the
19
- * given Picked client.
20
- *
21
- * @template T
22
- * @param {T} params - Factory parameters; carries the parent Picked client.
23
- * @returns {ReturnType<typeof createFrameworkIndexFactory>} The framework index store and its API.
24
- * @example
25
- * const frameworks = createFrameworkIndex({ client })
26
- */
27
16
  export declare function createFrameworkIndex<T extends Parameters<typeof createFrameworkIndexFactory>[0]>(params: T): ReturnType<typeof createFrameworkIndexFactory>;
28
17
  export type FrameworkRender = (shadowRoot: ShadowRoot, component: AdaptedComponent, client: Picked, experience: ExperienceInstance) => void;
29
- export type FrameworkUnRender = (shadowRoot: ShadowRoot) => void | Promise<void>;
30
18
  export declare const setupFramework: (framework: Framework, frameworks: FrameworksStore) => void;
31
19
  export {};
32
20
  //# sourceMappingURL=framework.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"framework.d.ts","sourceRoot":"","sources":["../../../../src/entities/framework/framework.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAA;AAEpF,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAIrE,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,eAAe,CAAA;IACvB,QAAQ,EAAE,iBAAiB,CAAA;CAC5B;AAGD,QAAA,MAAM,2BAA2B,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;qBAuBvD,MAAM,aAAa,SAAS,KAAG,IAAI;sBA0BlC,MAAM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CAAC,CAEhD;AAED,MAAM,MAAM,eAAe,GAAG,CAC5B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,kBAAkB,KAC3B,IAAI,CAAA;AAET,eAAO,MAAM,cAAc,GAAI,WAAW,SAAS,EAAE,YAAY,eAAe,KAAG,IAElF,CAAA"}
@@ -0,0 +1,3 @@
1
+ /** @file Public entrypoint for the dom-observer plugin. */
2
+ export { domObserverPlugin } from './plugin';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dom-observer/index.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA"}
@@ -0,0 +1,37 @@
1
+ import { Plugin } from '../../entities/plugin/plugin';
2
+ /**
3
+ * Watches the document for added nodes that match an experience target
4
+ * selector, and re-runs `initialiseExperiences` when one appears. Decouples
5
+ * DOM-driven reconciliation from route detection: any DOM addition that
6
+ * brings a target into existence — SPA navigations, lazy mounts, framework
7
+ * hydration, modal opens, infinite scroll — will spawn the experience
8
+ * without the consumer wiring a router-specific hook.
9
+ *
10
+ * Behaviour:
11
+ * - Installs a single `MutationObserver` on `document.body` with
12
+ * `{ childList: true, subtree: true }`.
13
+ * - On each batch, walks added nodes and short-circuits on the first one
14
+ * that matches (or contains a descendant matching) any registered
15
+ * experience's target selector.
16
+ * - When a match is found, schedules a single coalesced
17
+ * `initialiseExperiences` call on the next animation frame; further
18
+ * mutations during that frame collapse into the same call.
19
+ * - Single-flight: a trailing call is scheduled if mutations arrive while
20
+ * reconciliation is in flight.
21
+ * - Selector set is rebuilt whenever `client.experiences.listStore`
22
+ * changes, so newly registered experiences extend the watch list
23
+ * without restarting the observer.
24
+ *
25
+ * No-ops outside browser environments and on partial-DOM runtimes that
26
+ * lack `MutationObserver`, `requestAnimationFrame`, or `document.body`.
27
+ *
28
+ * @returns {Plugin} The plugin.
29
+ * @example
30
+ * ```typescript
31
+ * createClient({
32
+ * plugins: [domObserverPlugin()]
33
+ * })
34
+ * ```
35
+ */
36
+ export declare const domObserverPlugin: () => Plugin;
37
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dom-observer/plugin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAK1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,iBAAiB,QAAO,MAiBpC,CAAA"}
@@ -1,4 +1,3 @@
1
- /** @file Public entrypoint for the single-page-app plugin and its `notifyNavigation` escape hatch. */
2
- export { singlePageAppPlugin, notifyNavigation } from './plugin';
1
+ export { singlePageAppPlugin } from './plugin';
3
2
  export type * from './plugin';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/single-page-app/index.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAChE,mBAAmB,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/single-page-app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAC9C,mBAAmB,UAAU,CAAA"}
@@ -1,50 +1,20 @@
1
1
  import { Plugin } from '../../entities/plugin/plugin';
2
- import { Picked } from '../../picked';
3
2
  interface SinglePageAppPluginOptions {
4
3
  /**
5
- * When `true`, the plugin falls back to wrapping `pushState`, `replaceState`, and
6
- * `popstate` on platforms without the Navigation API. Set to `false` to skip the
7
- * fallback and rely on {@link notifyNavigation} from the host router instead.
8
- *
9
- * @default true
4
+ * Enables monitoring of browser history events (pushState, replaceState, popstate)
5
+ * to automatically restart the client when navigating in single-page applications.
6
+ * Only `true` is supported at this time.
10
7
  */
11
- instrumentHistory?: boolean;
12
- /**
13
- * Hard upper bound (ms) on how long a reconcile window observes DOM mutations.
14
- * Increase for SSR-hydrating apps whose target tree takes longer than the default
15
- * to settle.
16
- *
17
- * @default 1000
18
- */
19
- maxWindowMs?: number;
20
- /**
21
- * Idle threshold (ms) — when no DOM mutation arrives for this long, the
22
- * reconcile window disconnects early. Smaller values cut work sooner on
23
- * quiet pages.
24
- *
25
- * @default 150
26
- */
27
- idleDebounceMs?: number;
8
+ instrumentHistory: true;
28
9
  }
29
10
  /**
30
11
  * Enables compatibility with Single Page Applications (SPAs).
31
- * This plugin subscribes to browser route changes and reconciles experiences with
32
- * the new route's DOM: after a route change it re-runs the per-experience spawn
33
- * pass (`initialiseExperiences`) immediately and again on each DOM mutation batch
34
- * until the DOM settles, so widgets re-appear when their target elements are
35
- * (re)rendered by the host framework. Prefers the Navigation API
36
- * (`window.navigation.addEventListener('navigatesuccess', …)`) when available
37
- * and falls back to instrumenting `pushState` / `replaceState` / `popstate`
38
- * otherwise.
39
- *
40
- * Note: route changes drive `initialiseExperiences` only — the broader side
41
- * effects of `client.start()` (precondition/condition gate re-evaluation,
42
- * `runPluginStartHooks`, `ping`, and `initialize`/`ready`/`session` events)
43
- * are intentionally not re-run per navigation. Consumers that need per-route
44
- * gate re-evaluation should call `client.start()` from their router themselves.
12
+ * This plugin monitors browser history events and automatically triggers client re-rendering
13
+ * when navigation occurs within the SPA.
45
14
  *
46
- * @param {SinglePageAppPluginOptions} options - Configuration options for the SPA plugin.
15
+ * @param {SinglePageAppPluginOptions} options - Configuration options for the SPA plugin
47
16
  * @returns {Plugin} The plugin.
17
+ *
48
18
  * @example
49
19
  * ```typescript
50
20
  * createClient({
@@ -56,60 +26,7 @@ interface SinglePageAppPluginOptions {
56
26
  * })
57
27
  * ```
58
28
  */
59
- export declare const singlePageAppPlugin: (options?: SinglePageAppPluginOptions) => Plugin;
60
- /**
61
- * Triggers experience reconciliation for the next ~1 second of DOM mutations.
62
- * Use from a router lifecycle hook when the SPA plugin's history instrumentation
63
- * is unable to detect navigations — for example when another script has wrapped
64
- * `pushState` after Picked's setup, or when the host router doesn't go through
65
- * `pushState` at all.
66
- *
67
- * Safe to call any number of times — successive calls cancel and replace the
68
- * prior reconcile window for the given client. No-ops outside browser
69
- * environments and on partial-DOM runtimes that lack `MutationObserver`,
70
- * `requestAnimationFrame`, or `document.body`.
71
- *
72
- * @param {Picked} client - The Picked client instance to reconcile.
73
- * @example
74
- * // React Router
75
- * useEffect(() => { notifyNavigation(picked) }, [location.pathname])
76
- *
77
- * // SvelteKit
78
- * afterNavigate(() => notifyNavigation(picked))
79
- */
80
- export declare function notifyNavigation(client: Picked): void;
81
- interface SubscribeOptions {
82
- fallbackToHistory: boolean;
83
- }
84
- /**
85
- * Subscribes to browser route changes and invokes `callback` once per URL
86
- * change. Prefers the Navigation API
87
- * (`window.navigation.addEventListener('navigatesuccess', …)`) when available
88
- * because it captures every same-document navigation regardless of the host
89
- * router's mechanism and survives third-party scripts that wrap
90
- * `pushState` / `replaceState`. Falls back to {@link instrumentHistory} on
91
- * platforms without the Navigation API.
92
- *
93
- * @param {() => void} callback - Invoked once per URL change.
94
- * @param {SubscribeOptions} [options] - Whether to fall back to history instrumentation when the Navigation API is unavailable.
95
- * @example
96
- * subscribeToRouteChanges(() => reconcile())
97
- */
98
- export declare function subscribeToRouteChanges(callback: () => void, options?: SubscribeOptions): void;
99
- /**
100
- * Instruments browser history so the callback fires whenever the navigation
101
- * URL changes via `popstate`, `pushState`, or `replaceState`. Same-URL events
102
- * are ignored so repeated replaces of the current location don't re-trigger.
103
- * Used as the fallback for environments without the Navigation API.
104
- *
105
- * Idempotent: if `pushState`/`replaceState` are already wrapped (i.e. Carry
106
- * the `__picked_original` marker), the wrap is skipped so HMR or repeat client
107
- * setup does not stack listeners..
108
- *
109
- * @param {() => void} callback - Invoked once per URL change.
110
- * @example
111
- * instrumentHistory(() => console.log('route changed'))
112
- */
29
+ export declare const singlePageAppPlugin: (_options: SinglePageAppPluginOptions) => Plugin;
113
30
  export declare function instrumentHistory(callback: () => void): void;
114
31
  export {};
115
32
  //# sourceMappingURL=plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/single-page-app/plugin.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAa1C,UAAU,0BAA0B;IAClC;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAOD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,mBAAmB,GAAI,UAAS,0BAA+B,KAAG,MAoB9E,CAAA;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CASrD;AA+LD,UAAU,gBAAgB;IACxB,iBAAiB,EAAE,OAAO,CAAA;CAC3B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,IAAI,EACpB,OAAO,GAAE,gBAA8C,GACtD,IAAI,CAuBN;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CA0D5D"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/single-page-app/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAM1D,UAAU,0BAA0B;IAClC;;;;OAIG;IACH,iBAAiB,EAAE,IAAI,CAAA;CACxB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB,GAAI,UAAU,0BAA0B,KAAG,MAa1E,CAAA;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAwC5D"}
@@ -3,11 +3,6 @@ declare const globalObjKey: unique symbol;
3
3
  interface InternalGlobal {
4
4
  [globalObjKey]?: Picked;
5
5
  Picked?: Picked;
6
- navigation?: NavigationEventTarget;
7
- }
8
- interface NavigationEventTarget {
9
- addEventListener: (type: 'navigatesuccess', listener: () => void, options?: AddEventListenerOptions) => void;
10
- removeEventListener: (type: 'navigatesuccess', listener: () => void, options?: EventListenerOptions) => void;
11
6
  }
12
7
  export declare const GLOBAL_OBJ: typeof globalThis & InternalGlobal;
13
8
  export declare const bindClient: (client: Picked) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"global-obj.d.ts","sourceRoot":"","sources":["../../../src/utils/global-obj.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAEvC,QAAA,MAAM,YAAY,eAAmB,CAAA;AAErC,UAAU,cAAc;IACtB,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,qBAAqB,CAAA;CACnC;AAED,UAAU,qBAAqB;IAC7B,gBAAgB,EAAE,CAChB,IAAI,EAAE,iBAAiB,EACvB,QAAQ,EAAE,MAAM,IAAI,EACpB,OAAO,CAAC,EAAE,uBAAuB,KAC9B,IAAI,CAAA;IACT,mBAAmB,EAAE,CACnB,IAAI,EAAE,iBAAiB,EACvB,QAAQ,EAAE,MAAM,IAAI,EACpB,OAAO,CAAC,EAAE,oBAAoB,KAC3B,IAAI,CAAA;CACV;AAGD,eAAO,MAAM,UAAU,EAAiB,OAAO,UAAU,GAAG,cAAc,CAAA;AAE1E,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,SAExC,CAAA"}
1
+ {"version":3,"file":"global-obj.d.ts","sourceRoot":"","sources":["../../../src/utils/global-obj.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAEvC,QAAA,MAAM,YAAY,eAAmB,CAAA;AAErC,UAAU,cAAc;IACtB,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAGD,eAAO,MAAM,UAAU,EAAiB,OAAO,UAAU,GAAG,cAAc,CAAA;AAE1E,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,SAExC,CAAA"}