@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.
- package/dist/{api-BAOO2VZv.cjs → api-CP_eIRW2.cjs} +1 -1
- package/dist/{api-CiR56vZg.js → api-UYfzBUGT.js} +1 -1
- package/dist/cjs/form/index.js +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/plugins/dom-observer/index.js +1 -0
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/plugins/experience-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/responses-browser-storage/index.js +1 -1
- package/dist/cjs/plugins/responses-indexeddb/index.js +1 -1
- package/dist/cjs/plugins/single-page-app/index.js +1 -1
- package/dist/cjs/plugins/web-components/index.js +1 -1
- package/dist/cjs/plugins/window-object/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/form/index.js +1 -1
- package/dist/esm/index.js +178 -177
- package/dist/esm/plugins/create-experience/index.js +1 -1
- package/dist/esm/plugins/dom-observer/index.js +58 -0
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/plugins/experience-browser-storage/index.js +3 -3
- package/dist/esm/plugins/history-browser-storage/index.js +2 -2
- package/dist/esm/plugins/responses-browser-storage/index.js +2 -2
- package/dist/esm/plugins/responses-indexeddb/index.js +1 -1
- package/dist/esm/plugins/single-page-app/index.js +25 -93
- package/dist/esm/plugins/web-components/index.js +2 -2
- package/dist/esm/plugins/window-object/index.js +1 -1
- package/dist/esm/server/index.js +1 -1
- package/dist/{experience-DOWnsvA1.cjs → experience-BhteyYBl.cjs} +1 -1
- package/dist/{experience-CR19HpPg.js → experience-CoMdlvyn.js} +3 -3
- package/dist/{experience-instance-C2jZU8ho.cjs → experience-instance-CZDcicPj.cjs} +1 -1
- package/dist/{experience-instance-CGLdwg--.js → experience-instance-IkIw31Cg.js} +15 -28
- package/dist/{nodes-Bmzx3TP_.js → nodes-ChVU1VZO.js} +7 -7
- package/dist/{nodes-Dx9bxj35.cjs → nodes-DDDs-rC2.cjs} +1 -1
- package/dist/object-C82v79xc.js +25 -0
- package/dist/object-CUJOjanb.cjs +1 -0
- package/dist/rules-logic-BTIxfrJJ.js +240 -0
- package/dist/rules-logic-DNLOv90w.cjs +1 -0
- package/dist/{supports-DUJbucFW.js → supports-0XIfd4-R.js} +9 -18
- package/dist/supports-Dsjg-82e.cjs +1 -0
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/framework/framework.d.ts +0 -12
- package/dist/types/entities/framework/framework.d.ts.map +1 -1
- package/dist/types/plugins/dom-observer/index.d.ts +3 -0
- package/dist/types/plugins/dom-observer/index.d.ts.map +1 -0
- package/dist/types/plugins/dom-observer/plugin.d.ts +37 -0
- package/dist/types/plugins/dom-observer/plugin.d.ts.map +1 -0
- package/dist/types/plugins/single-page-app/index.d.ts +1 -2
- package/dist/types/plugins/single-page-app/index.d.ts.map +1 -1
- package/dist/types/plugins/single-page-app/plugin.d.ts +9 -92
- package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
- package/dist/types/utils/global-obj.d.ts +0 -5
- package/dist/types/utils/global-obj.d.ts.map +1 -1
- package/dist/types/utils/supports.d.ts +0 -113
- package/dist/types/utils/supports.d.ts.map +1 -1
- package/package.json +11 -1
- package/dist/rules-logic-CvILqbhz.js +0 -266
- package/dist/rules-logic-DV5SUr5M.cjs +0 -1
- package/dist/supports-DFDQ6eJO.cjs +0 -1
- /package/dist/{id-n2yrHvNo.js → id-B-N2zNbS.js} +0 -0
- /package/dist/{id-Cg7fVl1O.cjs → id-Bbodazn8.cjs} +0 -0
- /package/dist/{logger-C44jSdYl.js → logger-6z_gb4rA.js} +0 -0
- /package/dist/{logger-CJUj90QX.cjs → logger-fbvQC40v.cjs} +0 -0
- /package/dist/{storage-B6lQtc4-.cjs → storage-BXSlLTRa.cjs} +0 -0
- /package/dist/{storage-6Xk0uAxB.js → storage-hOHCCXvP.js} +0 -0
|
@@ -1,125 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reports whether `globalThis.location` is available in the current runtime.
|
|
3
|
-
*
|
|
4
|
-
* @returns {boolean} `true` when a usable `location` object is present.
|
|
5
|
-
* @example
|
|
6
|
-
* if (supportsLocation()) {
|
|
7
|
-
* console.log(globalThis.location.href)
|
|
8
|
-
* }
|
|
9
|
-
*/
|
|
10
1
|
export declare function supportsLocation(): boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Reports whether `globalThis.history` is available in the current runtime.
|
|
13
|
-
*
|
|
14
|
-
* @returns {boolean} `true` when a usable `history` object is present.
|
|
15
|
-
* @example
|
|
16
|
-
* if (supportsHistory()) {
|
|
17
|
-
* globalThis.history.pushState(null, '', '/next')
|
|
18
|
-
* }
|
|
19
|
-
*/
|
|
20
2
|
export declare function supportsHistory(): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Reports whether the modern Navigation API
|
|
23
|
-
* (`globalThis.navigation`) is available with a usable `addEventListener`
|
|
24
|
-
* method. Used by the SPA plugin to choose between the Navigation API and
|
|
25
|
-
* the history-instrumentation fallback.
|
|
26
|
-
*
|
|
27
|
-
* @returns {boolean} `true` when the Navigation API is available.
|
|
28
|
-
* @example
|
|
29
|
-
* if (supportsNavigation()) {
|
|
30
|
-
* globalThis.navigation?.addEventListener('navigatesuccess', onRouteChange)
|
|
31
|
-
* }
|
|
32
|
-
*/
|
|
33
|
-
export declare function supportsNavigation(): boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Reports whether `globalThis.localStorage` is available in the current runtime.
|
|
36
|
-
*
|
|
37
|
-
* @returns {boolean} `true` when a usable `localStorage` object is present.
|
|
38
|
-
* @example
|
|
39
|
-
* if (supportsLocalStorage()) {
|
|
40
|
-
* globalThis.localStorage.setItem('key', 'value')
|
|
41
|
-
* }
|
|
42
|
-
*/
|
|
43
3
|
export declare function supportsLocalStorage(): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Reports whether `globalThis.sessionStorage` is available in the current runtime.
|
|
46
|
-
*
|
|
47
|
-
* @returns {boolean} `true` when a usable `sessionStorage` object is present.
|
|
48
|
-
* @example
|
|
49
|
-
* if (supportsSessionStorage()) {
|
|
50
|
-
* globalThis.sessionStorage.setItem('key', 'value')
|
|
51
|
-
* }
|
|
52
|
-
*/
|
|
53
4
|
export declare function supportsSessionStorage(): boolean;
|
|
54
|
-
/**
|
|
55
|
-
* Reports whether `document.cookie` is available in the current runtime.
|
|
56
|
-
*
|
|
57
|
-
* @returns {boolean} `true` when document cookies can be read or written.
|
|
58
|
-
* @example
|
|
59
|
-
* if (supportsCookies()) {
|
|
60
|
-
* document.cookie = 'name=value'
|
|
61
|
-
* }
|
|
62
|
-
*/
|
|
63
5
|
export declare function supportsCookies(): boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Reports whether the Shadow DOM API (`Element.attachShadow`) is available in
|
|
66
|
-
* the current runtime.
|
|
67
|
-
*
|
|
68
|
-
* @returns {boolean} `true` when shadow roots can be attached.
|
|
69
|
-
* @example
|
|
70
|
-
* if (supportsShadowRoot()) {
|
|
71
|
-
* element.attachShadow({ mode: 'open' })
|
|
72
|
-
* }
|
|
73
|
-
*/
|
|
74
6
|
export declare function supportsShadowRoot(): boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Reports whether `globalThis.window` is available in the current runtime.
|
|
77
|
-
* Used as a coarse "we're in a browser" guard.
|
|
78
|
-
*
|
|
79
|
-
* @returns {boolean} `true` when a `window` global is present.
|
|
80
|
-
* @example
|
|
81
|
-
* if (!supportsWindow()) {
|
|
82
|
-
* return
|
|
83
|
-
* }
|
|
84
|
-
*/
|
|
85
7
|
export declare function supportsWindow(): boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Reports whether `globalThis.document` is available in the current runtime.
|
|
88
|
-
*
|
|
89
|
-
* @returns {boolean} `true` when a `document` global is present.
|
|
90
|
-
* @example
|
|
91
|
-
* if (supportsDocument()) {
|
|
92
|
-
* document.body.append(node)
|
|
93
|
-
* }
|
|
94
|
-
*/
|
|
95
8
|
export declare function supportsDocument(): boolean;
|
|
96
|
-
/**
|
|
97
|
-
* Reports whether `IntersectionObserver` is available in the current runtime.
|
|
98
|
-
*
|
|
99
|
-
* @returns {boolean} `true` when the IntersectionObserver constructor is exposed.
|
|
100
|
-
* @example
|
|
101
|
-
* if (supportsIntersectionObserver()) {
|
|
102
|
-
* new IntersectionObserver(callback).observe(element)
|
|
103
|
-
* }
|
|
104
|
-
*/
|
|
105
9
|
export declare function supportsIntersectionObserver(): boolean;
|
|
106
|
-
/**
|
|
107
|
-
* Reports whether the Custom Elements API (`globalThis.customElements`) is
|
|
108
|
-
* available in the current runtime.
|
|
109
|
-
*
|
|
110
|
-
* @returns {boolean} `true` when the customElements registry is exposed.
|
|
111
|
-
* @example
|
|
112
|
-
* if (supportsWebComponents()) {
|
|
113
|
-
* customElements.define('picked-widget', PickedWidget)
|
|
114
|
-
* }
|
|
115
|
-
*/
|
|
116
10
|
export declare function supportsWebComponents(): boolean;
|
|
117
|
-
/**
|
|
118
|
-
* Reports whether `crypto.randomUUID` is available in the current runtime.
|
|
119
|
-
*
|
|
120
|
-
* @returns {boolean} `true` when `crypto.randomUUID()` can be called.
|
|
121
|
-
* @example
|
|
122
|
-
* const id = supportsCryptoRandomUUID() ? crypto.randomUUID() : fallbackId()
|
|
123
|
-
*/
|
|
124
11
|
export declare function supportsCryptoRandomUUID(): boolean;
|
|
125
12
|
//# sourceMappingURL=supports.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supports.d.ts","sourceRoot":"","sources":["../../../src/utils/supports.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"supports.d.ts","sourceRoot":"","sources":["../../../src/utils/supports.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,IAAI,OAAO,CAM1C;AAED,wBAAgB,eAAe,IAAI,OAAO,CAMzC;AAED,wBAAgB,oBAAoB,IAAI,OAAO,CAM9C;AAED,wBAAgB,sBAAsB,IAAI,OAAO,CAMhD;AAED,wBAAgB,eAAe,IAAI,OAAO,CAMzC;AAED,wBAAgB,kBAAkB,IAAI,OAAO,CAU5C;AAED,wBAAgB,cAAc,IAAI,OAAO,CAMxC;AAED,wBAAgB,gBAAgB,IAAI,OAAO,CAM1C;AAED,wBAAgB,4BAA4B,IAAI,OAAO,CAMtD;AAED,wBAAgB,qBAAqB,IAAI,OAAO,CAM/C;AAED,wBAAgB,wBAAwB,IAAI,OAAO,CAMlD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/client",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.1777611471601",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@withease/factories": "^1.0.5"
|
|
6
6
|
},
|
|
@@ -89,6 +89,12 @@
|
|
|
89
89
|
"require": "./dist/cjs/plugins/dynamic-experiences/index.js",
|
|
90
90
|
"default": "./dist/esm/plugins/dynamic-experiences/index.js"
|
|
91
91
|
},
|
|
92
|
+
"./plugins/dom-observer": {
|
|
93
|
+
"types": "./dist/types/plugins/dom-observer/index.d.ts",
|
|
94
|
+
"import": "./dist/esm/plugins/dom-observer/index.js",
|
|
95
|
+
"require": "./dist/cjs/plugins/dom-observer/index.js",
|
|
96
|
+
"default": "./dist/esm/plugins/dom-observer/index.js"
|
|
97
|
+
},
|
|
92
98
|
"./form": {
|
|
93
99
|
"types": "./dist/types/form/index.d.ts",
|
|
94
100
|
"import": "./dist/esm/form/index.js",
|
|
@@ -198,6 +204,10 @@
|
|
|
198
204
|
"path": "dist/esm/plugins/web-components/index.js",
|
|
199
205
|
"limit": "10 kB"
|
|
200
206
|
},
|
|
207
|
+
{
|
|
208
|
+
"path": "dist/esm/plugins/dom-observer/index.js",
|
|
209
|
+
"limit": "5 kB"
|
|
210
|
+
},
|
|
201
211
|
{
|
|
202
212
|
"path": "dist/esm/form/index.js",
|
|
203
213
|
"limit": "5 kB"
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
//#region src/logic-engine.ts
|
|
2
|
-
function e(e) {
|
|
3
|
-
return typeof e == "number" && !isNaN(e);
|
|
4
|
-
}
|
|
5
|
-
function t(e) {
|
|
6
|
-
return typeof e == "string";
|
|
7
|
-
}
|
|
8
|
-
function n(e) {
|
|
9
|
-
return Array.isArray(e);
|
|
10
|
-
}
|
|
11
|
-
function r(e) {
|
|
12
|
-
return e instanceof Promise;
|
|
13
|
-
}
|
|
14
|
-
function i(e) {
|
|
15
|
-
return typeof e == "object" && !!e && !Array.isArray(e) && Object.keys(e).length === 1;
|
|
16
|
-
}
|
|
17
|
-
function a(t) {
|
|
18
|
-
if (e(t)) return t;
|
|
19
|
-
let n = parseFloat(`${t}`);
|
|
20
|
-
return isNaN(n) ? 0 : n;
|
|
21
|
-
}
|
|
22
|
-
function o(e) {
|
|
23
|
-
return `${e}`;
|
|
24
|
-
}
|
|
25
|
-
var s = {
|
|
26
|
-
"==": (e, t) => e == t,
|
|
27
|
-
"===": (e, t) => e === t,
|
|
28
|
-
"!=": (e, t) => e != t,
|
|
29
|
-
"!==": (e, t) => e !== t,
|
|
30
|
-
">": (e, t) => a(e) > a(t),
|
|
31
|
-
">=": (e, t) => a(e) >= a(t),
|
|
32
|
-
"<": (e, t, n) => {
|
|
33
|
-
let r = a(e), i = a(t);
|
|
34
|
-
if (n === void 0) return r < i;
|
|
35
|
-
let o = a(n);
|
|
36
|
-
return r < i && i < o;
|
|
37
|
-
},
|
|
38
|
-
"<=": (e, t, n) => {
|
|
39
|
-
let r = a(e), i = a(t);
|
|
40
|
-
if (n === void 0) return r <= i;
|
|
41
|
-
let o = a(n);
|
|
42
|
-
return r <= i && i <= o;
|
|
43
|
-
},
|
|
44
|
-
"!!": async (e) => await l(e),
|
|
45
|
-
"!": async (e) => !await l(e),
|
|
46
|
-
"%": (e, t) => a(e) % a(t),
|
|
47
|
-
log: (e) => (console.log(e), e),
|
|
48
|
-
in: (e, r) => r ? t(r) ? r.indexOf(o(e)) !== -1 : n(r) ? r.includes(e) : !1 : !1,
|
|
49
|
-
cat: (...e) => e.map(o).join(""),
|
|
50
|
-
substr: (e, t, n) => {
|
|
51
|
-
let r = o(e), i = a(t);
|
|
52
|
-
if (n === void 0) return r.substr(i);
|
|
53
|
-
let s = a(n);
|
|
54
|
-
if (s < 0) {
|
|
55
|
-
let e = r.substr(i);
|
|
56
|
-
return e.substr(0, e.length + s);
|
|
57
|
-
}
|
|
58
|
-
return r.substr(i, s);
|
|
59
|
-
},
|
|
60
|
-
"+": (...e) => e.reduce((e, t) => a(e) + a(t), 0),
|
|
61
|
-
"*": (...e) => e.reduce((e, t) => a(e) * a(t), 1),
|
|
62
|
-
"-": (e, t) => {
|
|
63
|
-
let n = a(e);
|
|
64
|
-
return t === void 0 ? -n : n - a(t);
|
|
65
|
-
},
|
|
66
|
-
"/": (e, t) => a(e) / a(t),
|
|
67
|
-
min: (...e) => Math.min(...e.map(a)),
|
|
68
|
-
max: (...e) => Math.max(...e.map(a)),
|
|
69
|
-
merge: (...e) => e.reduce((e, t) => n(t) ? e.concat(t) : e.concat([t]), []),
|
|
70
|
-
var(e, t) {
|
|
71
|
-
let n = arguments.length > 1 ? t : null;
|
|
72
|
-
if (e === "" || e === "." || e == null) return this;
|
|
73
|
-
if (typeof e == "number" && Array.isArray(this)) return e >= 0 && e < this.length ? this[e] : n;
|
|
74
|
-
let r = o(e);
|
|
75
|
-
if (r === "" || r === ".") return this;
|
|
76
|
-
let i = r.split("."), a = this;
|
|
77
|
-
for (let e of i) {
|
|
78
|
-
if (a == null) return n;
|
|
79
|
-
if (Array.isArray(a)) {
|
|
80
|
-
let t = parseInt(e, 10);
|
|
81
|
-
a = isNaN(t) ? a[e] : a[t];
|
|
82
|
-
} else a = a[e];
|
|
83
|
-
}
|
|
84
|
-
return a === void 0 ? n : a;
|
|
85
|
-
},
|
|
86
|
-
async missing(...e) {
|
|
87
|
-
let t = n(e[0]) ? e[0] : e, r = [];
|
|
88
|
-
for (let e of t) {
|
|
89
|
-
let t = await c({ var: e }, this);
|
|
90
|
-
(t === null || t === "") && r.push(`${e}`);
|
|
91
|
-
}
|
|
92
|
-
return r;
|
|
93
|
-
},
|
|
94
|
-
async missing_some(e, r) {
|
|
95
|
-
let i = await c({ missing: r }, this);
|
|
96
|
-
if (!n(i) || !n(r)) return [];
|
|
97
|
-
let o = i.filter(t);
|
|
98
|
-
return r.filter(t).length - o.length >= a(e) ? [] : o;
|
|
99
|
-
},
|
|
100
|
-
invoke(...e) {
|
|
101
|
-
let [t, ...n] = e;
|
|
102
|
-
return typeof t == "function" ? Reflect.apply(t, null, n) : null;
|
|
103
|
-
},
|
|
104
|
-
startsWith: (e, n) => t(e) && t(n) && e.startsWith(n),
|
|
105
|
-
endsWith: (e, n) => t(e) && t(n) && e.endsWith(n),
|
|
106
|
-
regexp_matches(e, r) {
|
|
107
|
-
let i = e, a = "";
|
|
108
|
-
if (n(e)) {
|
|
109
|
-
let [t, n] = e;
|
|
110
|
-
i = t, a = n;
|
|
111
|
-
}
|
|
112
|
-
return !t(i) || !t(a) ? !1 : new RegExp(i, a).test(o(r));
|
|
113
|
-
},
|
|
114
|
-
throw(e) {
|
|
115
|
-
throw Error(o(e));
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
async function c(e, t) {
|
|
119
|
-
if (!e) return e;
|
|
120
|
-
if (r(e)) return c(await e, t);
|
|
121
|
-
if (n(e)) return Promise.all(e.map((e) => c(e, t)));
|
|
122
|
-
if (!i(e)) return e;
|
|
123
|
-
let a = u(e), o = a ? e[a] ?? [] : [];
|
|
124
|
-
switch (n(o) || (o = [o]), a) {
|
|
125
|
-
case "if":
|
|
126
|
-
case "?:":
|
|
127
|
-
for (let e = 0; e < o.length - 1; e += 2) if (await l(await c(o[e], t))) return c(o[e + 1], t);
|
|
128
|
-
return o.length % 2 == 1 ? c(o[o.length - 1], t) : null;
|
|
129
|
-
case "and": {
|
|
130
|
-
let e = null;
|
|
131
|
-
for (let n of o) if (e = await c(n, t), !await l(e)) return e;
|
|
132
|
-
return e;
|
|
133
|
-
}
|
|
134
|
-
case "or": {
|
|
135
|
-
let e = null;
|
|
136
|
-
for (let n of o) if (e = await c(n, t), await l(e)) return e;
|
|
137
|
-
return e;
|
|
138
|
-
}
|
|
139
|
-
case "map": {
|
|
140
|
-
let e = await c(o[0], t);
|
|
141
|
-
return n(e) ? await Promise.all(e.map((e) => c(o[1], e))) : [];
|
|
142
|
-
}
|
|
143
|
-
case "filter": {
|
|
144
|
-
let e = await c(o[0], t);
|
|
145
|
-
return n(e) ? (await Promise.all(e.map(async (e) => ({
|
|
146
|
-
item: e,
|
|
147
|
-
shouldInclude: await l(await c(o[1], e))
|
|
148
|
-
})))).filter(({ shouldInclude: e }) => e).map(({ item: e }) => e) : [];
|
|
149
|
-
}
|
|
150
|
-
case "reduce": {
|
|
151
|
-
let e = await c(o[0], t);
|
|
152
|
-
if (!n(e)) return o.length > 2 ? await c(o[2], t) : null;
|
|
153
|
-
let r = o[1], i = o.length > 2 ? await c(o[2], t) : null;
|
|
154
|
-
for (let t of e) i = await c(r, {
|
|
155
|
-
current: t,
|
|
156
|
-
accumulator: i
|
|
157
|
-
});
|
|
158
|
-
return i;
|
|
159
|
-
}
|
|
160
|
-
case "all": {
|
|
161
|
-
let e = await c(o[0], t);
|
|
162
|
-
if (!n(e) || e.length === 0) return !1;
|
|
163
|
-
for (let t of e) if (!await l(await c(o[1], t))) return !1;
|
|
164
|
-
return !0;
|
|
165
|
-
}
|
|
166
|
-
case "some": {
|
|
167
|
-
let e = await c(o[0], t);
|
|
168
|
-
if (!n(e)) return !1;
|
|
169
|
-
for (let t of e) if (await l(await c(o[1], t))) return !0;
|
|
170
|
-
return !1;
|
|
171
|
-
}
|
|
172
|
-
case "none": {
|
|
173
|
-
let e = await c(o[0], t);
|
|
174
|
-
if (!n(e)) return !0;
|
|
175
|
-
for (let t of e) if (await l(await c(o[1], t))) return !1;
|
|
176
|
-
return !0;
|
|
177
|
-
}
|
|
178
|
-
case "catch": try {
|
|
179
|
-
return await c(o[0], t);
|
|
180
|
-
} catch (e) {
|
|
181
|
-
return i(e) ? await c(e, t) : o[1] ? await c(o[1], e) : e instanceof Error ? e.message : e;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
let d = await Promise.all(o.map((e) => c(e, t))), f = a ? s[a] : void 0;
|
|
185
|
-
if (!f) throw Error(`Unrecognized operation ${a}`);
|
|
186
|
-
return f.apply(t, d);
|
|
187
|
-
}
|
|
188
|
-
async function l(e) {
|
|
189
|
-
return r(e) ? l(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
|
|
190
|
-
}
|
|
191
|
-
function u(e) {
|
|
192
|
-
return Object.keys(e)[0];
|
|
193
|
-
}
|
|
194
|
-
//#endregion
|
|
195
|
-
//#region src/utils/object.ts
|
|
196
|
-
function d(e, t, n) {
|
|
197
|
-
if (!(t in e)) return;
|
|
198
|
-
let r = e[t];
|
|
199
|
-
if (typeof r != "function") throw Error(`Expected '${String(t)}' to be a function`);
|
|
200
|
-
let i = n(r);
|
|
201
|
-
p(i, r), e[t] = i;
|
|
202
|
-
}
|
|
203
|
-
function f(e, t, n) {
|
|
204
|
-
Object.defineProperty(e, t, {
|
|
205
|
-
enumerable: !1,
|
|
206
|
-
value: n,
|
|
207
|
-
writable: !0,
|
|
208
|
-
configurable: !0
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
function p(e, t) {
|
|
212
|
-
let n = t.prototype || {};
|
|
213
|
-
t.prototype = n, e.prototype = n, f(e, "__picked_original", t);
|
|
214
|
-
}
|
|
215
|
-
function m(e) {
|
|
216
|
-
return typeof e == "function" && "__picked_original" in e;
|
|
217
|
-
}
|
|
218
|
-
function h(e) {
|
|
219
|
-
return e === void 0 || typeof e == "object" && !!e && e.constructor === Object && Object.keys(e).length === 0;
|
|
220
|
-
}
|
|
221
|
-
//#endregion
|
|
222
|
-
//#region src/utils/rules-logic.ts
|
|
223
|
-
function g(e) {
|
|
224
|
-
return !h(e);
|
|
225
|
-
}
|
|
226
|
-
async function _(e, t, n) {
|
|
227
|
-
let r = e.getStateSnapshot(), i = e.predicates.listStore.getState().reduce((e, t) => ({
|
|
228
|
-
...e,
|
|
229
|
-
[t.name]: (...e) => t.predicate({
|
|
230
|
-
...r,
|
|
231
|
-
args: e
|
|
232
|
-
})
|
|
233
|
-
}), {}), a = e.actions.listStore.getState().reduce((e, t) => ({
|
|
234
|
-
...e,
|
|
235
|
-
[t.key]: (...e) => t.action({
|
|
236
|
-
...r,
|
|
237
|
-
args: e
|
|
238
|
-
}, null)
|
|
239
|
-
}), {}), o = e.features.listStore.getState().reduce((e, t) => ({
|
|
240
|
-
...e,
|
|
241
|
-
[t.id]: async () => {
|
|
242
|
-
let { bucket: e } = await t.getBucket();
|
|
243
|
-
return e;
|
|
244
|
-
}
|
|
245
|
-
}), {});
|
|
246
|
-
return await c(t, {
|
|
247
|
-
responses: e.responses.getAllStore.getState(),
|
|
248
|
-
location: typeof r.location == "object" ? {
|
|
249
|
-
hash: r.location.hash,
|
|
250
|
-
host: r.location.host,
|
|
251
|
-
hostname: r.location.hostname,
|
|
252
|
-
href: r.location.href,
|
|
253
|
-
origin: r.location.origin,
|
|
254
|
-
pathname: r.location.pathname,
|
|
255
|
-
port: r.location.port,
|
|
256
|
-
protocol: r.location.protocol,
|
|
257
|
-
search: r.location.search
|
|
258
|
-
} : void 0,
|
|
259
|
-
predicates: i,
|
|
260
|
-
actions: a,
|
|
261
|
-
features: o,
|
|
262
|
-
...n
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
//#endregion
|
|
266
|
-
export { d as a, m as i, g as n, h as r, _ as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e){return typeof e==`number`&&!isNaN(e)}function t(e){return typeof e==`string`}function n(e){return Array.isArray(e)}function r(e){return e instanceof Promise}function i(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).length===1}function a(t){if(e(t))return t;let n=parseFloat(`${t}`);return isNaN(n)?0:n}function o(e){return`${e}`}var s={"==":(e,t)=>e==t,"===":(e,t)=>e===t,"!=":(e,t)=>e!=t,"!==":(e,t)=>e!==t,">":(e,t)=>a(e)>a(t),">=":(e,t)=>a(e)>=a(t),"<":(e,t,n)=>{let r=a(e),i=a(t);if(n===void 0)return r<i;let o=a(n);return r<i&&i<o},"<=":(e,t,n)=>{let r=a(e),i=a(t);if(n===void 0)return r<=i;let o=a(n);return r<=i&&i<=o},"!!":async e=>await l(e),"!":async e=>!await l(e),"%":(e,t)=>a(e)%a(t),log:e=>(console.log(e),e),in:(e,r)=>r?t(r)?r.indexOf(o(e))!==-1:n(r)?r.includes(e):!1:!1,cat:(...e)=>e.map(o).join(``),substr:(e,t,n)=>{let r=o(e),i=a(t);if(n===void 0)return r.substr(i);let s=a(n);if(s<0){let e=r.substr(i);return e.substr(0,e.length+s)}return r.substr(i,s)},"+":(...e)=>e.reduce((e,t)=>a(e)+a(t),0),"*":(...e)=>e.reduce((e,t)=>a(e)*a(t),1),"-":(e,t)=>{let n=a(e);return t===void 0?-n:n-a(t)},"/":(e,t)=>a(e)/a(t),min:(...e)=>Math.min(...e.map(a)),max:(...e)=>Math.max(...e.map(a)),merge:(...e)=>e.reduce((e,t)=>n(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=o(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=n(e[0])?e[0]:e,r=[];for(let e of t){let t=await c({var:e},this);(t===null||t===``)&&r.push(`${e}`)}return r},async missing_some(e,r){let i=await c({missing:r},this);if(!n(i)||!n(r))return[];let o=i.filter(t);return r.filter(t).length-o.length>=a(e)?[]:o},invoke(...e){let[t,...n]=e;return typeof t==`function`?Reflect.apply(t,null,n):null},startsWith:(e,n)=>t(e)&&t(n)&&e.startsWith(n),endsWith:(e,n)=>t(e)&&t(n)&&e.endsWith(n),regexp_matches(e,r){let i=e,a=``;if(n(e)){let[t,n]=e;i=t,a=n}return!t(i)||!t(a)?!1:new RegExp(i,a).test(o(r))},throw(e){throw Error(o(e))}};async function c(e,t){if(!e)return e;if(r(e))return c(await e,t);if(n(e))return Promise.all(e.map(e=>c(e,t)));if(!i(e))return e;let a=u(e),o=a?e[a]??[]:[];switch(n(o)||(o=[o]),a){case`if`:case`?:`:for(let e=0;e<o.length-1;e+=2)if(await l(await c(o[e],t)))return c(o[e+1],t);return o.length%2==1?c(o[o.length-1],t):null;case`and`:{let e=null;for(let n of o)if(e=await c(n,t),!await l(e))return e;return e}case`or`:{let e=null;for(let n of o)if(e=await c(n,t),await l(e))return e;return e}case`map`:{let e=await c(o[0],t);return n(e)?await Promise.all(e.map(e=>c(o[1],e))):[]}case`filter`:{let e=await c(o[0],t);return n(e)?(await Promise.all(e.map(async e=>({item:e,shouldInclude:await l(await c(o[1],e))})))).filter(({shouldInclude:e})=>e).map(({item:e})=>e):[]}case`reduce`:{let e=await c(o[0],t);if(!n(e))return o.length>2?await c(o[2],t):null;let r=o[1],i=o.length>2?await c(o[2],t):null;for(let t of e)i=await c(r,{current:t,accumulator:i});return i}case`all`:{let e=await c(o[0],t);if(!n(e)||e.length===0)return!1;for(let t of e)if(!await l(await c(o[1],t)))return!1;return!0}case`some`:{let e=await c(o[0],t);if(!n(e))return!1;for(let t of e)if(await l(await c(o[1],t)))return!0;return!1}case`none`:{let e=await c(o[0],t);if(!n(e))return!0;for(let t of e)if(await l(await c(o[1],t)))return!1;return!0}case`catch`:try{return await c(o[0],t)}catch(e){return i(e)?await c(e,t):o[1]?await c(o[1],e):e instanceof Error?e.message:e}}let d=await Promise.all(o.map(e=>c(e,t))),f=a?s[a]:void 0;if(!f)throw Error(`Unrecognized operation ${a}`);return f.apply(t,d)}async function l(e){return r(e)?l(await e):!(Array.isArray(e)&&e.length===0)&&!!e}function u(e){return Object.keys(e)[0]}function d(e,t,n){if(!(t in e))return;let r=e[t];if(typeof r!=`function`)throw Error(`Expected '${String(t)}' to be a function`);let i=n(r);p(i,r),e[t]=i}function f(e,t,n){Object.defineProperty(e,t,{enumerable:!1,value:n,writable:!0,configurable:!0})}function p(e,t){let n=t.prototype||{};t.prototype=n,e.prototype=n,f(e,`__picked_original`,t)}function m(e){return typeof e==`function`&&`__picked_original`in e}function h(e){return e===void 0||typeof e==`object`&&!!e&&e.constructor===Object&&Object.keys(e).length===0}function g(e){return!h(e)}async function _(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 c(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,`a`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return _}});
|
|
@@ -1 +0,0 @@
|
|
|
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{if(!(`navigation`in t))return!1;let e=t.navigation;return!!e&&typeof e?.addEventListener==`function`}catch{return!1}}function o(){try{return`localStorage`in t&&!!t.localStorage}catch{return!1}}function s(){try{return`sessionStorage`in t&&!!t.sessionStorage}catch{return!1}}function c(){try{return`document`in t&&`cookie`in t.document}catch{return!1}}function l(){try{return`document`in t&&`createElement`in t.document&&`attachShadow`in t.document.createElement(`div`)}catch{return!1}}function u(){try{return`window`in t}catch{return!1}}function d(){try{return`document`in t}catch{return!1}}function f(){try{return`IntersectionObserver`in t}catch{return!1}}function p(){try{return`customElements`in t&&!!t.customElements}catch{return!1}}function m(){try{return`crypto`in t&&`randomUUID`in t.crypto}catch{return!1}}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return l}});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|