purity-world 1.0.0
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/LICENSE +21 -0
- package/README.md +89 -0
- package/cursors/alias.svg +17 -0
- package/cursors/all-scroll.svg +12 -0
- package/cursors/bottom_left_corner.svg +16 -0
- package/cursors/bottom_right_corner.svg +16 -0
- package/cursors/bottom_side.svg +18 -0
- package/cursors/cell.svg +9 -0
- package/cursors/center_ptr.svg +9 -0
- package/cursors/col-resize.svg +9 -0
- package/cursors/color-picker.svg +10 -0
- package/cursors/context-menu.svg +10 -0
- package/cursors/copy.svg +17 -0
- package/cursors/crosshair.svg +20 -0
- package/cursors/default.svg +9 -0
- package/cursors/dnd-move.svg +9 -0
- package/cursors/dnd-no-drop.svg +16 -0
- package/cursors/down-arrow.svg +9 -0
- package/cursors/draft.svg +9 -0
- package/cursors/fleur.svg +10 -0
- package/cursors/help.svg +20 -0
- package/cursors/left-arrow.svg +9 -0
- package/cursors/left_side.svg +18 -0
- package/cursors/no-drop.svg +16 -0
- package/cursors/not-allowed.svg +9 -0
- package/cursors/openhand.svg +9 -0
- package/cursors/pencil.svg +9 -0
- package/cursors/pirate.svg +9 -0
- package/cursors/pointer.svg +9 -0
- package/cursors/progress-01.svg +15 -0
- package/cursors/progress-02.svg +15 -0
- package/cursors/progress-03.svg +15 -0
- package/cursors/progress-04.svg +15 -0
- package/cursors/progress-05.svg +15 -0
- package/cursors/progress-06.svg +15 -0
- package/cursors/progress-07.svg +15 -0
- package/cursors/progress-08.svg +15 -0
- package/cursors/progress-09.svg +15 -0
- package/cursors/progress-10.svg +15 -0
- package/cursors/progress-11.svg +15 -0
- package/cursors/progress-12.svg +15 -0
- package/cursors/progress-13.svg +15 -0
- package/cursors/progress-14.svg +15 -0
- package/cursors/progress-15.svg +15 -0
- package/cursors/progress-16.svg +15 -0
- package/cursors/progress-17.svg +15 -0
- package/cursors/progress-18.svg +15 -0
- package/cursors/progress-19.svg +15 -0
- package/cursors/progress-20.svg +15 -0
- package/cursors/progress-21.svg +15 -0
- package/cursors/progress-22.svg +15 -0
- package/cursors/progress-23.svg +15 -0
- package/cursors/right-arrow.svg +9 -0
- package/cursors/right_ptr.svg +9 -0
- package/cursors/right_side.svg +18 -0
- package/cursors/row-resize.svg +9 -0
- package/cursors/size_bdiag.svg +10 -0
- package/cursors/size_fdiag.svg +10 -0
- package/cursors/size_hor.svg +10 -0
- package/cursors/size_ver.svg +12 -0
- package/cursors/text.svg +9 -0
- package/cursors/top_left_corner.svg +16 -0
- package/cursors/top_right_corner.svg +16 -0
- package/cursors/top_side.svg +18 -0
- package/cursors/up-arrow.svg +9 -0
- package/cursors/vertical-text.svg +9 -0
- package/cursors/wait-01.svg +14 -0
- package/cursors/wait-02.svg +14 -0
- package/cursors/wait-03.svg +14 -0
- package/cursors/wait-04.svg +14 -0
- package/cursors/wait-05.svg +14 -0
- package/cursors/wait-06.svg +14 -0
- package/cursors/wait-07.svg +14 -0
- package/cursors/wait-08.svg +14 -0
- package/cursors/wait-09.svg +14 -0
- package/cursors/wait-10.svg +14 -0
- package/cursors/wait-11.svg +14 -0
- package/cursors/wait-12.svg +14 -0
- package/cursors/wait-13.svg +14 -0
- package/cursors/wait-14.svg +14 -0
- package/cursors/wait-15.svg +14 -0
- package/cursors/wait-16.svg +14 -0
- package/cursors/wait-17.svg +14 -0
- package/cursors/wait-18.svg +14 -0
- package/cursors/wait-19.svg +14 -0
- package/cursors/wait-20.svg +14 -0
- package/cursors/wait-21.svg +14 -0
- package/cursors/wait-22.svg +14 -0
- package/cursors/wait-23.svg +14 -0
- package/cursors/wayland-cursor.svg +10 -0
- package/cursors/x-cursor.svg +11 -0
- package/cursors/zoom-in.svg +13 -0
- package/cursors/zoom-out.svg +13 -0
- package/index.cjs +1 -0
- package/index.d.ts +1 -0
- package/index.js +1972 -0
- package/package.json +60 -0
- package/style.css +1 -0
- package/styles/_base.scss +525 -0
- package/styles/_mixins.scss +57 -0
- package/styles/_theme-dark.scss +103 -0
- package/styles/_theme-light.scss +103 -0
- package/styles/_themes.scss +34 -0
- package/styles/_variables.scss +72 -0
- package/styles/index.scss +7 -0
- package/types/bootstrap.d.ts +42 -0
- package/types/bootstrap.d.ts.map +1 -0
- package/types/common.d.ts +9 -0
- package/types/common.d.ts.map +1 -0
- package/types/component.d.ts +57 -0
- package/types/component.d.ts.map +1 -0
- package/types/core.d.ts +46 -0
- package/types/core.d.ts.map +1 -0
- package/types/di.d.ts +53 -0
- package/types/di.d.ts.map +1 -0
- package/types/directive.d.ts +47 -0
- package/types/directive.d.ts.map +1 -0
- package/types/http.d.ts +211 -0
- package/types/http.d.ts.map +1 -0
- package/types/pipe.d.ts +34 -0
- package/types/pipe.d.ts.map +1 -0
- package/types/router.d.ts +145 -0
- package/types/router.d.ts.map +1 -0
- package/types/seo.d.ts +134 -0
- package/types/seo.d.ts.map +1 -0
- package/types/validator.d.ts +73 -0
- package/types/validator.d.ts.map +1 -0
- package/types/virtual-for.d.ts +36 -0
- package/types/virtual-for.d.ts.map +1 -0
- package/types/vite-plugin.d.ts +18 -0
- package/types/vite-plugin.d.ts.map +1 -0
- package/vite.cjs +4 -0
- package/vite.d.ts +1 -0
- package/vite.js +51 -0
package/index.js
ADDED
|
@@ -0,0 +1,1972 @@
|
|
|
1
|
+
//#region src/framework/directive.ts
|
|
2
|
+
var e = /* @__PURE__ */ new Map();
|
|
3
|
+
function t(e) {
|
|
4
|
+
return e.replace(/^\[|\]$/g, "").trim().toLowerCase();
|
|
5
|
+
}
|
|
6
|
+
function n(n, r) {
|
|
7
|
+
if (typeof n == "function") {
|
|
8
|
+
let i = n, a = t((r && typeof r.name == "string" ? r.name : i.name).replace(/directive$/i, ""));
|
|
9
|
+
return e.set(a, i), i;
|
|
10
|
+
}
|
|
11
|
+
let i = t(typeof n == "string" ? n : n.selector);
|
|
12
|
+
return function(t, n) {
|
|
13
|
+
return e.set(i, t), t;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
var r = class {
|
|
17
|
+
element;
|
|
18
|
+
value;
|
|
19
|
+
context;
|
|
20
|
+
constructor(e, t, n) {
|
|
21
|
+
e && (this.element = e), t !== void 0 && (this.value = t), n !== void 0 && (this.context = n);
|
|
22
|
+
}
|
|
23
|
+
destroy() {
|
|
24
|
+
this.onDestroy?.();
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
function i(t, n = t) {
|
|
28
|
+
let r = [], i = [t, ...Array.from(t.querySelectorAll("*"))];
|
|
29
|
+
for (let a of i) if (a instanceof HTMLElement && !(a !== t && D(a, t))) for (let [t, i] of e.entries()) {
|
|
30
|
+
let e = null;
|
|
31
|
+
if (a.hasAttribute(t) ? e = t : a.hasAttribute(`[${t}]`) ? e = `[${t}]` : a.tagName.toLowerCase() === t.toLowerCase() && (e = t), e !== null) {
|
|
32
|
+
let o = new i();
|
|
33
|
+
o.element = a, o.context = n;
|
|
34
|
+
let s = new MutationObserver((t) => {
|
|
35
|
+
for (let n of t) {
|
|
36
|
+
if (n.type === "attributes" && (n.attributeName === e || n.attributeName === `[${e}]` || n.attributeName === "label" || n.attributeName === "value")) {
|
|
37
|
+
let e = a.getAttribute(n.attributeName);
|
|
38
|
+
if (e !== null && e !== o.value) {
|
|
39
|
+
let t = o.value;
|
|
40
|
+
o.value = e, o.onChanges?.(e, t);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
o.onDOMChange?.(n);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
s.observe(a, {
|
|
47
|
+
attributes: !0,
|
|
48
|
+
childList: !0,
|
|
49
|
+
characterData: !0,
|
|
50
|
+
subtree: !1,
|
|
51
|
+
attributeOldValue: !0
|
|
52
|
+
});
|
|
53
|
+
let c = (e) => {
|
|
54
|
+
o.onDOMChange?.(e);
|
|
55
|
+
};
|
|
56
|
+
a.addEventListener("input", c), a.addEventListener("change", c);
|
|
57
|
+
let l = a.getAttribute(e) ?? a.getAttribute("label") ?? a.getAttribute("value") ?? "";
|
|
58
|
+
if (l.includes("{{")) {
|
|
59
|
+
let e;
|
|
60
|
+
Q(() => {
|
|
61
|
+
try {
|
|
62
|
+
let t = l.replace(/\{\{\s*([\s\S]*?)\s*\}\}/g, (e, t) => {
|
|
63
|
+
let r = Function(`with (this) { return ${t.trim()}; }`).call(n);
|
|
64
|
+
return r == null ? "" : String(r);
|
|
65
|
+
});
|
|
66
|
+
o.value = t, o.onChanges?.(t, e), e = t;
|
|
67
|
+
} catch (e) {
|
|
68
|
+
console.warn(`[Purity Directive] Error in directive ${t} reactive binding:`, e);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
} else o.value = l, o.onChanges?.(l, void 0);
|
|
72
|
+
o.onInit?.(), r.push({ destroy: () => {
|
|
73
|
+
s.disconnect(), a.removeEventListener("input", c), a.removeEventListener("change", c), o.onDestroy?.();
|
|
74
|
+
} });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return r;
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/framework/validator.ts
|
|
81
|
+
var a = class {
|
|
82
|
+
form = null;
|
|
83
|
+
fields = /* @__PURE__ */ new Map();
|
|
84
|
+
submitButtons = [];
|
|
85
|
+
isValid = !1;
|
|
86
|
+
validateAll() {
|
|
87
|
+
return this.isValid;
|
|
88
|
+
}
|
|
89
|
+
updateFormState(e) {
|
|
90
|
+
this.isValid = e;
|
|
91
|
+
}
|
|
92
|
+
}, o = /* @__PURE__ */ new Map();
|
|
93
|
+
function s(e) {
|
|
94
|
+
return function(t, n) {
|
|
95
|
+
return o.set(e.form, {
|
|
96
|
+
constructor: t,
|
|
97
|
+
options: e
|
|
98
|
+
}), t;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function c(e, t) {
|
|
102
|
+
let n = [
|
|
103
|
+
`validate${t.charAt(0).toUpperCase() + t.slice(1)}`,
|
|
104
|
+
`validate_${t}`,
|
|
105
|
+
`validate${t.toLowerCase()}`,
|
|
106
|
+
"validateField",
|
|
107
|
+
t
|
|
108
|
+
];
|
|
109
|
+
for (let r of n) if (typeof e[r] == "function") return r === "validateField" ? (n, r) => e.validateField(t, n, r) : (t, n) => e[r](t, n);
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
function l(e, t = e) {
|
|
113
|
+
let n = [];
|
|
114
|
+
for (let [t, { constructor: r, options: i }] of o.entries()) {
|
|
115
|
+
let a = [];
|
|
116
|
+
e.matches(t) && a.push(e), a.push(...Array.from(e.querySelectorAll(t)).filter((t) => !D(t, e)));
|
|
117
|
+
for (let e of a) {
|
|
118
|
+
let t = new r();
|
|
119
|
+
t.form = e, t.fields = /* @__PURE__ */ new Map();
|
|
120
|
+
let a = Array.from(e.querySelectorAll("button[type=\"submit\"], input[type=\"submit\"], button:not([type]), .form-submit-btn")).filter((e) => e.tagName === "BUTTON" || e instanceof HTMLInputElement && e.type === "submit" || e.type === "submit");
|
|
121
|
+
t.submitButtons = a;
|
|
122
|
+
let o = i.validClass || "is-valid", s = i.invalidClass || "is-invalid", l = i.events || [
|
|
123
|
+
"input",
|
|
124
|
+
"change",
|
|
125
|
+
"blur"
|
|
126
|
+
], u = [], d = /* @__PURE__ */ new Map(), f = (n) => {
|
|
127
|
+
t.isValid = n;
|
|
128
|
+
for (let e of a) "disabled" in e && (e.disabled = !n), n ? e.classList.remove("disabled") : e.classList.add("disabled");
|
|
129
|
+
n ? (e.classList.remove(s), e.classList.add(o)) : (e.classList.remove(o), e.classList.add(s)), t.onStateChange?.(n, t);
|
|
130
|
+
};
|
|
131
|
+
t.updateFormState = f;
|
|
132
|
+
let p = (e, n, r) => {
|
|
133
|
+
let i = "value" in n ? String(n.value ?? "") : n.textContent || "", a = typeof r == "object" && r.validate || c(t, e);
|
|
134
|
+
return a ? !!a.call(t, i, n) : i.trim().length > 0;
|
|
135
|
+
}, m = (e, n, r) => {
|
|
136
|
+
let a = typeof r == "object" && r.validClass || o, c = typeof r == "object" && r.invalidClass || s, l = "value" in n ? String(n.value ?? "") : n.textContent || "", u = p(e, n, r);
|
|
137
|
+
u ? (n.classList.remove(c), n.classList.add(a)) : (n.classList.remove(a), n.classList.add(c)), d.set(e, u), t.onFieldChange?.(e, l, u, n);
|
|
138
|
+
let m = d.size === Object.keys(i.fields).length && Array.from(d.values()).every(Boolean);
|
|
139
|
+
return f(m), u;
|
|
140
|
+
};
|
|
141
|
+
for (let [n, r] of Object.entries(i.fields)) {
|
|
142
|
+
let i = typeof r == "string" ? r : r.selector, a = e.querySelector(i);
|
|
143
|
+
if (a) {
|
|
144
|
+
t.fields.set(n, a);
|
|
145
|
+
let e = p(n, a, r);
|
|
146
|
+
d.set(n, e);
|
|
147
|
+
let i = () => {
|
|
148
|
+
m(n, a, r);
|
|
149
|
+
};
|
|
150
|
+
for (let e of l) a.addEventListener(e, i), u.push(() => a.removeEventListener(e, i));
|
|
151
|
+
} else d.set(n, !1);
|
|
152
|
+
}
|
|
153
|
+
f(d.size === Object.keys(i.fields).length && Array.from(d.values()).every(Boolean)), t.validateAll = () => {
|
|
154
|
+
let e = !0;
|
|
155
|
+
for (let [n, r] of Object.entries(i.fields)) {
|
|
156
|
+
let i = t.fields.get(n);
|
|
157
|
+
i && m(n, i, r) || (e = !1);
|
|
158
|
+
}
|
|
159
|
+
return f(e), e;
|
|
160
|
+
};
|
|
161
|
+
let h = (e) => {
|
|
162
|
+
(t.validateAll?.() ?? !1) || e.preventDefault();
|
|
163
|
+
};
|
|
164
|
+
e.addEventListener("submit", h), u.push(() => e.removeEventListener("submit", h)), t.onInit?.(), n.push({ destroy: () => {
|
|
165
|
+
u.forEach((e) => e()), t.onDestroy?.();
|
|
166
|
+
} });
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return n;
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/framework/pipe.ts
|
|
173
|
+
var u = class {}, d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
|
|
174
|
+
function p(e) {
|
|
175
|
+
let t = typeof e == "string" ? e : e.name;
|
|
176
|
+
return function(e, n) {
|
|
177
|
+
let r = t || (n?.name ? String(n.name) : e.name);
|
|
178
|
+
return d.set(r, e), f.delete(r), e;
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function m(e, t) {
|
|
182
|
+
d.set(e, t), f.delete(e);
|
|
183
|
+
}
|
|
184
|
+
function h(e) {
|
|
185
|
+
if (f.has(e)) return f.get(e);
|
|
186
|
+
let t = d.get(e);
|
|
187
|
+
if (!t) return null;
|
|
188
|
+
try {
|
|
189
|
+
let n = new t();
|
|
190
|
+
return f.set(e, n), n;
|
|
191
|
+
} catch (t) {
|
|
192
|
+
return console.error(`Failed to instantiate pipe "${e}":`, t), null;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
function g(e, t, ...n) {
|
|
196
|
+
let r = h(e);
|
|
197
|
+
if (!r || typeof r.transform != "function") return console.warn(`Pipe "${e}" not found or does not implement transform(). Returning original value.`), t;
|
|
198
|
+
try {
|
|
199
|
+
return r.transform(t, ...n);
|
|
200
|
+
} catch (n) {
|
|
201
|
+
return console.error(`Error executing pipe "${e}":`, n), t;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/framework/virtual-for.ts
|
|
206
|
+
var _ = [
|
|
207
|
+
"virtual-for",
|
|
208
|
+
"*virtual-for",
|
|
209
|
+
"p-virtual-for",
|
|
210
|
+
"pVirtualFor",
|
|
211
|
+
"p-virtualfor",
|
|
212
|
+
"virtualFor",
|
|
213
|
+
"virtualfor"
|
|
214
|
+
];
|
|
215
|
+
function v(e) {
|
|
216
|
+
for (let t of _) {
|
|
217
|
+
let n = e.getAttribute(t);
|
|
218
|
+
if (n !== null) return n;
|
|
219
|
+
}
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
function y(e) {
|
|
223
|
+
return v(e) !== null;
|
|
224
|
+
}
|
|
225
|
+
function ee(e) {
|
|
226
|
+
for (let t of _) e.hasAttribute(t) && e.removeAttribute(t);
|
|
227
|
+
}
|
|
228
|
+
function te(e) {
|
|
229
|
+
let t = e.split(";").map((e) => e.trim()).filter(Boolean), n = t[0], r = n.match(/^(?:let\s+)?(?:\(?\s*([a-zA-Z0-9_$]+)(?:\s*,\s*([a-zA-Z0-9_$]+))?\s*\)?)\s+of\s+([\s\S]+)$/), i = r ? r[1] : "item", a = r && r[2] ? r[2] : "index", o = r ? r[3].trim() : n.trim(), s = {
|
|
230
|
+
itemHeight: 48,
|
|
231
|
+
buffer: 6,
|
|
232
|
+
scrollAlign: "center"
|
|
233
|
+
};
|
|
234
|
+
for (let e = 1; e < t.length; e++) {
|
|
235
|
+
let [n, r] = t[e].split(":").map((e) => e.trim());
|
|
236
|
+
if (!(!n || !r)) {
|
|
237
|
+
if (n === "itemHeight" || n === "item-height") {
|
|
238
|
+
let e = parseFloat(r);
|
|
239
|
+
!isNaN(e) && e > 0 && (s.itemHeight = e);
|
|
240
|
+
} else if (n === "buffer" || n === "overscan") {
|
|
241
|
+
let e = parseInt(r, 10);
|
|
242
|
+
!isNaN(e) && e >= 0 && (s.buffer = e);
|
|
243
|
+
} else if (n === "height") s.height = r;
|
|
244
|
+
else if (n === "scrollIndex" || n === "scroll-index" || n === "jumpIndex" || n === "jump-index" || n === "scrollTo" || n === "scroll-to") s.scrollIndexExpr = r;
|
|
245
|
+
else if (n === "scrollAlign" || n === "scroll-align" || n === "align") {
|
|
246
|
+
let e = r.replace(/['"]/g, "").toLowerCase();
|
|
247
|
+
(e === "start" || e === "center" || e === "end") && (s.scrollAlign = e);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return {
|
|
252
|
+
itemVar: i,
|
|
253
|
+
indexVar: a,
|
|
254
|
+
arrayExpr: o,
|
|
255
|
+
options: s
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
function b(e, t, n, r, i, a) {
|
|
259
|
+
let o = (y(e) ? [e, ...Array.from(e.querySelectorAll("*"))] : Array.from(e.querySelectorAll("*"))).filter((e) => e instanceof HTMLElement && y(e)).filter((t) => {
|
|
260
|
+
if (a(t, e)) return !1;
|
|
261
|
+
let n = t.parentElement;
|
|
262
|
+
for (; n && n !== e;) {
|
|
263
|
+
if (y(n)) return !1;
|
|
264
|
+
n = n.parentElement;
|
|
265
|
+
}
|
|
266
|
+
return !0;
|
|
267
|
+
});
|
|
268
|
+
for (let e of o) {
|
|
269
|
+
if (e.closest("[data-no-bind]")) continue;
|
|
270
|
+
let a = v(e);
|
|
271
|
+
if (!a) continue;
|
|
272
|
+
let o = te(a), s = e.getAttribute("item-height") || e.getAttribute("itemHeight");
|
|
273
|
+
if (s) {
|
|
274
|
+
let e = parseFloat(s);
|
|
275
|
+
!isNaN(e) && e > 0 && (o.options.itemHeight = e);
|
|
276
|
+
}
|
|
277
|
+
let c = e.getAttribute("buffer") || e.getAttribute("overscan");
|
|
278
|
+
if (c) {
|
|
279
|
+
let e = parseInt(c, 10);
|
|
280
|
+
!isNaN(e) && e >= 0 && (o.options.buffer = e);
|
|
281
|
+
}
|
|
282
|
+
let l = e.getAttribute("height") || e.getAttribute("viewport-height");
|
|
283
|
+
l && (o.options.height = l);
|
|
284
|
+
let u = e.getAttribute("scroll-index") || e.getAttribute("scrollIndex") || e.getAttribute("[scroll-index]") || e.getAttribute("[scrollIndex]") || e.getAttribute("jump-index") || e.getAttribute("jumpIndex");
|
|
285
|
+
u && (o.options.scrollIndexExpr = u);
|
|
286
|
+
let d = e.getAttribute("scroll-align") || e.getAttribute("scrollAlign") || e.getAttribute("align");
|
|
287
|
+
if (d) {
|
|
288
|
+
let e = d.toLowerCase();
|
|
289
|
+
(e === "start" || e === "center" || e === "end") && (o.options.scrollAlign = e);
|
|
290
|
+
}
|
|
291
|
+
let f = e.parentElement;
|
|
292
|
+
if (!f) continue;
|
|
293
|
+
let p = document.createElement("div");
|
|
294
|
+
p.className = "p-virtual-scroll-container", p.style.position = "relative", p.style.overflowY = "auto", p.style.overflowX = "hidden", p.style.webkitOverflowScrolling = "touch", p.style.contain = "strict", p.style.boxSizing = "border-box", p.style.minHeight = "120px", o.options.height ? p.style.height = o.options.height.endsWith("px") || o.options.height.endsWith("%") || o.options.height.endsWith("vh") || o.options.height.endsWith("em") || o.options.height.endsWith("rem") ? o.options.height : `${o.options.height}px` : e.style.height ? p.style.height = e.style.height : p.style.height = "420px", (e.classList.contains("virtual-viewport") || e.classList.contains("window")) && (p.className += " " + e.className.replace(/p-virtual-scroll-container/g, ""));
|
|
295
|
+
let m = document.createElement("div");
|
|
296
|
+
m.className = "p-virtual-spacer", m.style.position = "absolute", m.style.top = "0", m.style.left = "0", m.style.width = "1px", m.style.pointerEvents = "none", m.style.opacity = "0";
|
|
297
|
+
let h = document.createElement("div");
|
|
298
|
+
h.className = "p-virtual-content", h.style.position = "absolute", h.style.top = "0", h.style.left = "0", h.style.right = "0", h.style.width = "100%", h.style.boxSizing = "border-box", p.appendChild(m), p.appendChild(h);
|
|
299
|
+
let g = e.cloneNode(!0);
|
|
300
|
+
ee(g), g.style.position = "absolute", g.style.left = "0", g.style.right = "0", g.style.width = "100%", g.style.boxSizing = "border-box", f.insertBefore(p, e), f.removeChild(e);
|
|
301
|
+
let _ = /* @__PURE__ */ new Map(), y = [], b = o.options.itemHeight, x = o.options.buffer, S = !1, C = () => {
|
|
302
|
+
if (S = !1, !p.isConnected) return;
|
|
303
|
+
let e = y.length, i = e * b;
|
|
304
|
+
m.style.height = `${i}px`;
|
|
305
|
+
let a = p.scrollTop, s = p.clientHeight || 420, c = Math.max(0, Math.floor(a / b) - x), l = Math.min(e, Math.ceil((a + s) / b) + x);
|
|
306
|
+
for (let [e, t] of _.entries()) (e < c || e >= l) && (t.parentNode && t.parentNode.removeChild(t), _.delete(e));
|
|
307
|
+
let u = document.createDocumentFragment(), d = !1;
|
|
308
|
+
for (let i = c; i < l; i++) {
|
|
309
|
+
if (_.has(i)) {
|
|
310
|
+
let e = _.get(i);
|
|
311
|
+
e.style.top = `${i * b}px`, e.style.height = `${b}px`;
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
let a = y[i], s = g.cloneNode(!0);
|
|
315
|
+
s.removeAttribute("data-purity-mounted");
|
|
316
|
+
for (let e of Array.from(s.querySelectorAll("[data-purity-mounted]"))) e.removeAttribute("data-purity-mounted");
|
|
317
|
+
s.style.position = "absolute", s.style.top = `${i * b}px`, s.style.height = `${b}px`, s.style.left = "0", s.style.right = "0", s.style.boxSizing = "border-box", s.setAttribute("data-virtual-index", String(i));
|
|
318
|
+
let c = Object.assign(Object.create(t), {
|
|
319
|
+
[o.itemVar]: a,
|
|
320
|
+
[o.indexVar]: i,
|
|
321
|
+
index: i,
|
|
322
|
+
$index: i,
|
|
323
|
+
$first: i === 0,
|
|
324
|
+
$last: i === e - 1,
|
|
325
|
+
$even: i % 2 == 0,
|
|
326
|
+
$odd: i % 2 != 0,
|
|
327
|
+
__host: n || (t instanceof Element ? t : t?.__host)
|
|
328
|
+
});
|
|
329
|
+
s.__parentContext = c, r(s, c, n), u.appendChild(s), _.set(i, s), d = !0;
|
|
330
|
+
}
|
|
331
|
+
d && h.appendChild(u);
|
|
332
|
+
}, w = () => {
|
|
333
|
+
S || (S = !0, requestAnimationFrame(C));
|
|
334
|
+
};
|
|
335
|
+
p.addEventListener("scroll", w, { passive: !0 });
|
|
336
|
+
let T = null;
|
|
337
|
+
if (typeof ResizeObserver < "u" && (T = new ResizeObserver(() => w()), T.observe(p)), p.scrollToIndex = (e, t = "start", n = "auto") => {
|
|
338
|
+
let r = y.length, i = Math.max(0, Math.min(r - 1, e)), a = p.clientHeight || 380, o = i * b;
|
|
339
|
+
t === "center" ? o = Math.max(0, o - a / 2 + b / 2) : t === "end" && (o = Math.max(0, o - a + b)), p.scrollTo({
|
|
340
|
+
top: o,
|
|
341
|
+
behavior: n
|
|
342
|
+
}), C();
|
|
343
|
+
}, p.getVirtualMetrics = () => {
|
|
344
|
+
let e = p.scrollTop, t = p.clientHeight || 420, n = y.length, r = Math.max(0, Math.floor(e / b) - x), i = Math.min(n, Math.ceil((e + t) / b) + x);
|
|
345
|
+
return {
|
|
346
|
+
totalItems: n,
|
|
347
|
+
renderedCount: _.size,
|
|
348
|
+
startIndex: r,
|
|
349
|
+
endIndex: i,
|
|
350
|
+
scrollTop: e,
|
|
351
|
+
totalHeight: n * b,
|
|
352
|
+
itemHeight: b
|
|
353
|
+
};
|
|
354
|
+
}, Q(() => {
|
|
355
|
+
let e = i(o.arrayExpr, t);
|
|
356
|
+
y = Array.isArray(e) ? e : [];
|
|
357
|
+
for (let e of _.values()) e.parentNode && e.parentNode.removeChild(e);
|
|
358
|
+
_.clear(), C();
|
|
359
|
+
}), o.options.scrollIndexExpr) {
|
|
360
|
+
let e = null;
|
|
361
|
+
Q(() => {
|
|
362
|
+
let n = i(o.options.scrollIndexExpr, t), r = typeof n == "number" ? n : parseInt(String(n), 10);
|
|
363
|
+
!isNaN(r) && r >= 0 && r !== e && (e = r, p.scrollToIndex(r, o.options.scrollAlign || "center"));
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
//#endregion
|
|
369
|
+
//#region src/framework/component.ts
|
|
370
|
+
var x = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map();
|
|
371
|
+
function w(e) {
|
|
372
|
+
let t = e.trim();
|
|
373
|
+
if (!t.includes("|")) return t;
|
|
374
|
+
let n = [], r = "", i = null, a = 0;
|
|
375
|
+
for (let e = 0; e < t.length; e++) {
|
|
376
|
+
let o = t[e], s = e + 1 < t.length ? t[e + 1] : "";
|
|
377
|
+
if (i) {
|
|
378
|
+
r += o, o === i && t[e - 1] !== "\\" && (i = null);
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
if (o === "'" || o === "\"" || o === "`") {
|
|
382
|
+
i = o, r += o;
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
if (o === "(" || o === "[" || o === "{") {
|
|
386
|
+
a++, r += o;
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
if (o === ")" || o === "]" || o === "}") {
|
|
390
|
+
a > 0 && a--, r += o;
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
if (o === "|" && s === "|") {
|
|
394
|
+
r += "||", e++;
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
if (o === "|" && a === 0) {
|
|
398
|
+
n.push(r.trim()), r = "";
|
|
399
|
+
continue;
|
|
400
|
+
}
|
|
401
|
+
r += o;
|
|
402
|
+
}
|
|
403
|
+
if (r.trim().length > 0 && n.push(r.trim()), n.length <= 1) return t;
|
|
404
|
+
let o = `(${n[0]})`;
|
|
405
|
+
for (let e = 1; e < n.length; e++) {
|
|
406
|
+
let t = n[e], r = [], i = "", a = null, s = 0;
|
|
407
|
+
for (let e = 0; e < t.length; e++) {
|
|
408
|
+
let n = t[e];
|
|
409
|
+
if (a) {
|
|
410
|
+
i += n, n === a && t[e - 1] !== "\\" && (a = null);
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
413
|
+
if (n === "'" || n === "\"" || n === "`") {
|
|
414
|
+
a = n, i += n;
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
if (n === "(" || n === "[" || n === "{") {
|
|
418
|
+
s++, i += n;
|
|
419
|
+
continue;
|
|
420
|
+
}
|
|
421
|
+
if (n === ")" || n === "]" || n === "}") {
|
|
422
|
+
s > 0 && s--, i += n;
|
|
423
|
+
continue;
|
|
424
|
+
}
|
|
425
|
+
if (n === ":" && s === 0) {
|
|
426
|
+
r.push(i.trim()), i = "";
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
i += n;
|
|
430
|
+
}
|
|
431
|
+
i.trim().length > 0 && r.push(i.trim());
|
|
432
|
+
let c = r[0], l = r.slice(1), u = l.length > 0 ? ", " + l.join(", ") : "";
|
|
433
|
+
o = `__pipe('${c}', ${o}${u})`;
|
|
434
|
+
}
|
|
435
|
+
return o;
|
|
436
|
+
}
|
|
437
|
+
function T(e, t) {
|
|
438
|
+
let n = w(e), r = S.get(n);
|
|
439
|
+
if (!r) try {
|
|
440
|
+
r = Function("__pipe", `with (this) { return ${n}; }`), S.set(n, r);
|
|
441
|
+
} catch {
|
|
442
|
+
r = () => null, S.set(n, r);
|
|
443
|
+
}
|
|
444
|
+
try {
|
|
445
|
+
let e = r.call(t, g);
|
|
446
|
+
if (typeof e == "function" && !Array.isArray(e)) try {
|
|
447
|
+
e = e();
|
|
448
|
+
} catch {}
|
|
449
|
+
return e;
|
|
450
|
+
} catch {
|
|
451
|
+
return null;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
function ne(e, t) {
|
|
455
|
+
let n = T(e, t);
|
|
456
|
+
return n == null ? "" : String(n);
|
|
457
|
+
}
|
|
458
|
+
function E(e) {
|
|
459
|
+
return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
460
|
+
}
|
|
461
|
+
function D(e, t) {
|
|
462
|
+
let n = (e.nodeType, Node.TEXT_NODE, e.parentElement);
|
|
463
|
+
for (; n && n !== t;) {
|
|
464
|
+
if (n.tagName && (n.tagName.includes("-") || C.has(n.tagName.toLowerCase()))) return !0;
|
|
465
|
+
n = n.parentElement;
|
|
466
|
+
}
|
|
467
|
+
return !1;
|
|
468
|
+
}
|
|
469
|
+
var re = [
|
|
470
|
+
"if",
|
|
471
|
+
"*if",
|
|
472
|
+
"p-if",
|
|
473
|
+
"pif",
|
|
474
|
+
"pIf",
|
|
475
|
+
"else-if",
|
|
476
|
+
"elseif",
|
|
477
|
+
"*else-if",
|
|
478
|
+
"*elseif",
|
|
479
|
+
"p-else-if",
|
|
480
|
+
"pElseIf",
|
|
481
|
+
"p-elseif",
|
|
482
|
+
"pElseif",
|
|
483
|
+
"else",
|
|
484
|
+
"*else",
|
|
485
|
+
"p-else",
|
|
486
|
+
"pElse",
|
|
487
|
+
"pelse"
|
|
488
|
+
];
|
|
489
|
+
function O(e) {
|
|
490
|
+
return e.getAttribute("if") ?? e.getAttribute("*if") ?? e.getAttribute("p-if") ?? e.getAttribute("pif") ?? e.getAttribute("pIf");
|
|
491
|
+
}
|
|
492
|
+
function k(e) {
|
|
493
|
+
return e.getAttribute("else-if") ?? e.getAttribute("elseif") ?? e.getAttribute("*else-if") ?? e.getAttribute("*elseif") ?? e.getAttribute("p-else-if") ?? e.getAttribute("pElseIf") ?? e.getAttribute("p-elseif") ?? e.getAttribute("pElseif");
|
|
494
|
+
}
|
|
495
|
+
function A(e) {
|
|
496
|
+
return e.hasAttribute("else") || e.hasAttribute("*else") || e.hasAttribute("p-else") || e.hasAttribute("pElse") || e.hasAttribute("pelse");
|
|
497
|
+
}
|
|
498
|
+
function j(e) {
|
|
499
|
+
return O(e) !== null || k(e) !== null || A(e);
|
|
500
|
+
}
|
|
501
|
+
var ie = [
|
|
502
|
+
"for",
|
|
503
|
+
"*for",
|
|
504
|
+
"p-for",
|
|
505
|
+
"pfor",
|
|
506
|
+
"pFor"
|
|
507
|
+
];
|
|
508
|
+
function M(e) {
|
|
509
|
+
return e.getAttribute("for") ?? e.getAttribute("*for") ?? e.getAttribute("p-for") ?? e.getAttribute("pfor") ?? e.getAttribute("pFor");
|
|
510
|
+
}
|
|
511
|
+
function N(e) {
|
|
512
|
+
return M(e) !== null;
|
|
513
|
+
}
|
|
514
|
+
function ae(e) {
|
|
515
|
+
for (let t of ie) e.hasAttribute(t) && e.removeAttribute(t);
|
|
516
|
+
}
|
|
517
|
+
function oe(e) {
|
|
518
|
+
for (let t of re) e.hasAttribute(t) && e.removeAttribute(t);
|
|
519
|
+
}
|
|
520
|
+
function se(e, t) {
|
|
521
|
+
if (e.initialized) return;
|
|
522
|
+
let n = t.__target || t;
|
|
523
|
+
if (typeof n == "function") {
|
|
524
|
+
let t = new n(), r = /* @__PURE__ */ new Set([
|
|
525
|
+
"render",
|
|
526
|
+
"connectedCallback",
|
|
527
|
+
"disconnectedCallback",
|
|
528
|
+
"loadTemplate",
|
|
529
|
+
"bindTemplate"
|
|
530
|
+
]), i = [...Object.getOwnPropertyNames(t), ...Object.getOwnPropertySymbols(t)];
|
|
531
|
+
for (let n of i) {
|
|
532
|
+
let i = Object.getOwnPropertyDescriptor(t, n);
|
|
533
|
+
if (i) {
|
|
534
|
+
if (typeof n == "string" && r.has(n) && i.value === void 0 && !i.get && !i.set) continue;
|
|
535
|
+
Object.defineProperty(e, n, i);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
let r = Object.getOwnPropertyDescriptors(t.prototype);
|
|
540
|
+
for (let [t, n] of Object.entries(r)) t !== "constructor" && !(t in e) && Object.defineProperty(e, t, n);
|
|
541
|
+
typeof e.connectedCallback == "function" && e.connectedCallback();
|
|
542
|
+
}
|
|
543
|
+
function ce(e, t) {
|
|
544
|
+
return t ? new Proxy(e, {
|
|
545
|
+
get(e, n, r) {
|
|
546
|
+
if (n in e) {
|
|
547
|
+
let t = Reflect.get(e, n, r);
|
|
548
|
+
return typeof t == "function" ? t.bind(e) : t;
|
|
549
|
+
}
|
|
550
|
+
if (t && n in t) {
|
|
551
|
+
let e = Reflect.get(t, n, t);
|
|
552
|
+
return typeof e == "function" ? e.bind(t) : e;
|
|
553
|
+
}
|
|
554
|
+
return Reflect.get(e, n, r);
|
|
555
|
+
},
|
|
556
|
+
has(e, n) {
|
|
557
|
+
return n in e || t && n in t;
|
|
558
|
+
},
|
|
559
|
+
set(e, n, r, i) {
|
|
560
|
+
return n in e ? Reflect.set(e, n, r, i) : t && n in t ? Reflect.set(t, n, r, t) : Reflect.set(e, n, r, i);
|
|
561
|
+
}
|
|
562
|
+
}) : e;
|
|
563
|
+
}
|
|
564
|
+
function le(e) {
|
|
565
|
+
return e.replace(/-([a-z0-9])/g, (e, t) => t.toUpperCase());
|
|
566
|
+
}
|
|
567
|
+
function ue(e, t, n, r) {
|
|
568
|
+
let i = le(t), a = /* @__PURE__ */ new Set([t, i]);
|
|
569
|
+
(t === "checked" || t === "is-on" || t === "ison") && (a.add("isOn"), a.add("checked")), (t === "expanded" || t === "is-expanded" || t === "isexpanded") && (a.add("isExpanded"), a.add("expanded")), (t === "value" || t === "selected-date" || t === "selecteddate") && (a.add("selectedDate"), a.add("value")), (t === "loading" || t === "is-loading" || t === "isloading") && (a.add("isLoading"), a.add("loading")), (t === "target" || t === "target-for" || t === "targetfor") && (a.add("targetFor"), a.add("target")), (t === "open" || t === "is-open" || t === "isopen") && (a.add("isOpen"), a.add("open"));
|
|
570
|
+
for (let t of a) {
|
|
571
|
+
if (!(t in e)) continue;
|
|
572
|
+
let i = e[t];
|
|
573
|
+
if (typeof i == "function" && typeof i.set == "function") {
|
|
574
|
+
try {
|
|
575
|
+
let e = $(() => i());
|
|
576
|
+
if (typeof e == "boolean") i.set(r);
|
|
577
|
+
else if (typeof e == "number") {
|
|
578
|
+
let e = parseFloat(n);
|
|
579
|
+
isNaN(e) || i.set(e);
|
|
580
|
+
} else if (e instanceof Date || t.toLowerCase().includes("date")) {
|
|
581
|
+
let e = new Date(n);
|
|
582
|
+
isNaN(e.getTime()) || i.set(e);
|
|
583
|
+
} else i.set(n);
|
|
584
|
+
} catch {}
|
|
585
|
+
continue;
|
|
586
|
+
}
|
|
587
|
+
try {
|
|
588
|
+
let a = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e), t), o = Object.getOwnPropertyDescriptor(e, t), s = a || o;
|
|
589
|
+
s && s.set ? typeof e[t] == "boolean" ? s.set.call(e, r) : s.set.call(e, n) : s && s.writable && (e[t] = typeof i == "boolean" ? r : n);
|
|
590
|
+
} catch {}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
function de(e, t, n) {
|
|
594
|
+
let r = n.trim(), i = r !== "" && r !== "false" && r !== "null" && r !== "undefined" && r !== "0";
|
|
595
|
+
if (t === "class") {
|
|
596
|
+
e.className = n.trim();
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
[
|
|
600
|
+
"disabled",
|
|
601
|
+
"checked",
|
|
602
|
+
"readonly",
|
|
603
|
+
"required",
|
|
604
|
+
"hidden",
|
|
605
|
+
"selected",
|
|
606
|
+
"open"
|
|
607
|
+
].includes(t) ? i ? e.setAttribute(t, r || t) : e.removeAttribute(t) : ((e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement) && t === "value" && (e.value = n), e.setAttribute(t, n)), ue(e, t, n, i);
|
|
608
|
+
}
|
|
609
|
+
function fe(e, t) {
|
|
610
|
+
for (let [n, r] of C.entries()) {
|
|
611
|
+
let i = [];
|
|
612
|
+
e.tagName && e.tagName.toLowerCase() === n && i.push(e), i.push(...Array.from(e.querySelectorAll(n)));
|
|
613
|
+
for (let n of i) {
|
|
614
|
+
if (n.closest("[data-no-bind]") || n !== e && D(n, e) || N(n) || y(n) || j(n)) continue;
|
|
615
|
+
let i = n.parentElement, a = !1;
|
|
616
|
+
for (; i && i !== e;) {
|
|
617
|
+
if (j(i) || N(i) || y(i)) {
|
|
618
|
+
a = !0;
|
|
619
|
+
break;
|
|
620
|
+
}
|
|
621
|
+
i = i.parentElement;
|
|
622
|
+
}
|
|
623
|
+
a || n.hasAttribute("data-purity-mounted") || (n.setAttribute("data-purity-mounted", "true"), n.__parentContext = t, n.initialized || se(n, r));
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
let n = Array.from(e.querySelectorAll("*")).filter((t) => {
|
|
627
|
+
if (t === e || t.closest("[data-no-bind]")) return !1;
|
|
628
|
+
let n = t.tagName.toLowerCase();
|
|
629
|
+
return n.includes("-") || C.has(n);
|
|
630
|
+
});
|
|
631
|
+
for (let r of n) r !== e && D(r, e) || (r.__parentContext ||= t);
|
|
632
|
+
}
|
|
633
|
+
function P(e, t, n) {
|
|
634
|
+
if (!e) return;
|
|
635
|
+
let r = Array.from(e.querySelectorAll("*")).filter((t) => {
|
|
636
|
+
if (!(t instanceof HTMLElement) || O(t) === null || t.closest("[data-no-bind]") || D(t, e)) return !1;
|
|
637
|
+
let n = t.parentElement;
|
|
638
|
+
for (; n && n !== e;) {
|
|
639
|
+
if (j(n) || N(n) || y(n)) return !1;
|
|
640
|
+
n = n.parentElement;
|
|
641
|
+
}
|
|
642
|
+
return !0;
|
|
643
|
+
}), a = /* @__PURE__ */ new Set();
|
|
644
|
+
for (let i of r) {
|
|
645
|
+
if (a.has(i) || !i.parentNode) continue;
|
|
646
|
+
let r = i.parentNode, o = O(i), s = [], c = i.cloneNode(!0);
|
|
647
|
+
oe(c), s.push({
|
|
648
|
+
type: "if",
|
|
649
|
+
expr: o,
|
|
650
|
+
templateEl: c
|
|
651
|
+
}), a.add(i);
|
|
652
|
+
let l = [i], u = i.nextElementSibling;
|
|
653
|
+
for (; u && u instanceof HTMLElement && !D(u, e);) {
|
|
654
|
+
let e = k(u);
|
|
655
|
+
if (e !== null) {
|
|
656
|
+
let t = u.cloneNode(!0);
|
|
657
|
+
oe(t), s.push({
|
|
658
|
+
type: "else-if",
|
|
659
|
+
expr: e,
|
|
660
|
+
templateEl: t
|
|
661
|
+
}), a.add(u), l.push(u), u = u.nextElementSibling;
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
664
|
+
if (A(u)) {
|
|
665
|
+
let e = u.cloneNode(!0);
|
|
666
|
+
oe(e), s.push({
|
|
667
|
+
type: "else",
|
|
668
|
+
expr: "true",
|
|
669
|
+
templateEl: e
|
|
670
|
+
}), a.add(u), l.push(u);
|
|
671
|
+
break;
|
|
672
|
+
}
|
|
673
|
+
break;
|
|
674
|
+
}
|
|
675
|
+
let d = document.createComment("conditional-block");
|
|
676
|
+
r.insertBefore(d, i);
|
|
677
|
+
for (let e of l) e.parentNode && e.parentNode.removeChild(e);
|
|
678
|
+
let f = null, p = -1;
|
|
679
|
+
Q(() => {
|
|
680
|
+
let e = -1;
|
|
681
|
+
for (let n = 0; n < s.length; n++) {
|
|
682
|
+
let r = s[n];
|
|
683
|
+
if (r.type === "else") {
|
|
684
|
+
e = n;
|
|
685
|
+
break;
|
|
686
|
+
}
|
|
687
|
+
let i = T(r.expr, t);
|
|
688
|
+
if (i !== !1 && i != null && i !== "" && i !== 0) {
|
|
689
|
+
e = n;
|
|
690
|
+
break;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
if (e === p && f || (f && f.parentNode && (f.parentNode.removeChild(f), f = null), p = e, e === -1)) return;
|
|
694
|
+
let r = s[e].templateEl.cloneNode(!0);
|
|
695
|
+
r.removeAttribute("data-purity-mounted");
|
|
696
|
+
for (let e of Array.from(r.querySelectorAll("[data-purity-mounted]"))) e.removeAttribute("data-purity-mounted");
|
|
697
|
+
r.__parentContext = t, P(r, t, n), d.parentNode && (d.parentNode.insertBefore(r, d), f = r);
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
b(e, t, n, P, T, D);
|
|
701
|
+
let o = Array.from(e.querySelectorAll("*")).filter((t) => {
|
|
702
|
+
if (!(t instanceof HTMLElement) || M(t) === null || t.closest("[data-no-bind]") || D(t, e)) return !1;
|
|
703
|
+
let n = t.parentElement;
|
|
704
|
+
for (; n && n !== e;) {
|
|
705
|
+
if (j(n) || N(n) || y(n)) return !1;
|
|
706
|
+
n = n.parentElement;
|
|
707
|
+
}
|
|
708
|
+
return !0;
|
|
709
|
+
});
|
|
710
|
+
for (let e of o) {
|
|
711
|
+
let r = M(e), i = r.match(/^(?:let\s+)?(?:\(?\s*([a-zA-Z0-9_$]+)(?:\s*,\s*([a-zA-Z0-9_$]+))?\s*\)?)\s+of\s+([\s\S]+)$/);
|
|
712
|
+
if (!i) continue;
|
|
713
|
+
let a = i[1], o = i[2] || "index", s = i[3].trim(), c = e.parentNode;
|
|
714
|
+
if (!c) continue;
|
|
715
|
+
let l = document.createComment(`for: ${r}`);
|
|
716
|
+
c.insertBefore(l, e);
|
|
717
|
+
let u = e.cloneNode(!0);
|
|
718
|
+
ae(u), c.removeChild(e);
|
|
719
|
+
let d = [];
|
|
720
|
+
Q(() => {
|
|
721
|
+
for (let e of d) e.parentNode && e.parentNode.removeChild(e);
|
|
722
|
+
d = [];
|
|
723
|
+
let e = T(s, t), r = Array.isArray(e) ? e : [];
|
|
724
|
+
if (!l.parentNode) return;
|
|
725
|
+
let i = document.createDocumentFragment();
|
|
726
|
+
r.forEach((e, s) => {
|
|
727
|
+
let c = u.cloneNode(!0);
|
|
728
|
+
c.removeAttribute("data-purity-mounted");
|
|
729
|
+
for (let e of Array.from(c.querySelectorAll("[data-purity-mounted]"))) e.removeAttribute("data-purity-mounted");
|
|
730
|
+
let l = Object.assign(Object.create(t), {
|
|
731
|
+
[a]: e,
|
|
732
|
+
[o]: s,
|
|
733
|
+
index: s,
|
|
734
|
+
$index: s,
|
|
735
|
+
$first: s === 0,
|
|
736
|
+
$last: s === r.length - 1,
|
|
737
|
+
__host: n || (t instanceof Element ? t : t?.__host)
|
|
738
|
+
});
|
|
739
|
+
c.__parentContext = l, P(c, l, n), i.appendChild(c), d.push(c);
|
|
740
|
+
}), l.parentNode?.insertBefore(i, l);
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
fe(e, t);
|
|
744
|
+
let s = document.createTreeWalker(e, NodeFilter.SHOW_TEXT), c = [], u;
|
|
745
|
+
for (; u = s.nextNode();) if (u.nodeValue && u.nodeValue.includes("{{")) {
|
|
746
|
+
if (u.parentElement?.closest("[data-no-bind]") || D(u, e)) continue;
|
|
747
|
+
c.push(u);
|
|
748
|
+
}
|
|
749
|
+
let d = /\{\{\s*([\s\S]*?)\s*\}\}/g;
|
|
750
|
+
for (let e of c) {
|
|
751
|
+
let n = e.nodeValue;
|
|
752
|
+
if (!n) continue;
|
|
753
|
+
let r = e.parentNode;
|
|
754
|
+
if (!r) continue;
|
|
755
|
+
let i = 0, a, o = [], s = !1;
|
|
756
|
+
for (d.lastIndex = 0; (a = d.exec(n)) !== null;) {
|
|
757
|
+
s = !0;
|
|
758
|
+
let e = n.slice(i, a.index);
|
|
759
|
+
e && o.push(document.createTextNode(e));
|
|
760
|
+
let r = a[1].trim(), c = document.createTextNode("");
|
|
761
|
+
o.push(c), Q(() => {
|
|
762
|
+
c.nodeValue = ne(r, t);
|
|
763
|
+
}), i = a.index + a[0].length;
|
|
764
|
+
}
|
|
765
|
+
if (s) {
|
|
766
|
+
let t = n.slice(i);
|
|
767
|
+
t && o.push(document.createTextNode(t));
|
|
768
|
+
for (let t of o) r.insertBefore(t, e);
|
|
769
|
+
r.removeChild(e);
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
let f = [e, ...Array.from(e.querySelectorAll("*"))];
|
|
773
|
+
for (let n of f) if (n instanceof HTMLElement && !n.closest("[data-no-bind]") && !(n !== e && D(n, e))) for (let e of Array.from(n.attributes)) {
|
|
774
|
+
let r = e.name, i = e.value;
|
|
775
|
+
if (r === "data-purity-val" && (r = "value", n.removeAttribute("data-purity-val")), r.startsWith("on")) {
|
|
776
|
+
try {
|
|
777
|
+
let e = r.slice(2).toLowerCase(), a = i.replace(/\{\{\s*([\s\S]*?)\s*\}\}/g, "$1"), o = Function("$event", "__context", "__pipe", `with (__context) { return (function(event) { ${a} }).call(this, $event); }`);
|
|
778
|
+
n.addEventListener(e, function(e) {
|
|
779
|
+
return o.call(this, e, t, g);
|
|
780
|
+
}), n.removeAttribute(r);
|
|
781
|
+
} catch (e) {
|
|
782
|
+
console.error(`[Purity] Failed to compile event handler ${r}="${i}":`, e);
|
|
783
|
+
}
|
|
784
|
+
continue;
|
|
785
|
+
}
|
|
786
|
+
i.includes("{{") && Q(() => {
|
|
787
|
+
let e = i.replace(/\{\{\s*([\s\S]*?)\s*\}\}/g, (e, n) => ne(n.trim(), t));
|
|
788
|
+
$(() => {
|
|
789
|
+
de(n, r, e);
|
|
790
|
+
});
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
if (n) {
|
|
794
|
+
let t = i(e, n);
|
|
795
|
+
n.activeDirectives && n.activeDirectives.push(...t);
|
|
796
|
+
let r = l(e, n);
|
|
797
|
+
n.activeValidators && n.activeValidators.push(...r);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
function F(e, t) {
|
|
801
|
+
if (t && t.trim().length > 0) return [t.trim()];
|
|
802
|
+
let n = E(e), r = /* @__PURE__ */ new Set();
|
|
803
|
+
if (r.add(n), r.add("#" + n), n.endsWith("-component")) {
|
|
804
|
+
let e = n.slice(0, -10);
|
|
805
|
+
r.add(e), r.add("#" + e);
|
|
806
|
+
} else r.add(n + "-component"), r.add("#" + n + "-component");
|
|
807
|
+
return r.add("#" + e), Array.from(r);
|
|
808
|
+
}
|
|
809
|
+
function I(e, t) {
|
|
810
|
+
if (typeof document > "u") return null;
|
|
811
|
+
let n = Array.isArray(t) ? t : [t];
|
|
812
|
+
for (let t of n) if (t) {
|
|
813
|
+
if (e && e.__host) try {
|
|
814
|
+
let n = e.__host.querySelector?.(t);
|
|
815
|
+
if (n) return n;
|
|
816
|
+
} catch {}
|
|
817
|
+
if (e) try {
|
|
818
|
+
let n = e.querySelector?.(t);
|
|
819
|
+
if (n) return n;
|
|
820
|
+
} catch {}
|
|
821
|
+
try {
|
|
822
|
+
let e = document.querySelector?.(t);
|
|
823
|
+
if (e) return e;
|
|
824
|
+
} catch {}
|
|
825
|
+
}
|
|
826
|
+
return null;
|
|
827
|
+
}
|
|
828
|
+
function pe(e) {
|
|
829
|
+
return e.replace(/<input\b([^>]*?)>/gi, (e, t) => /\btype=["'](?:number|range|date|time|month|week|datetime-local)["']/i.test(t) && /\bvalue=["']\{\{[\s\S]*?\}\}["']/i.test(t) ? `<input${t.replace(/\bvalue=(["']\{\{[\s\S]*?\}\}["'])/i, "data-purity-val=$1")}>` : e);
|
|
830
|
+
}
|
|
831
|
+
function L(e, t) {
|
|
832
|
+
e.loadTemplate = async function() {
|
|
833
|
+
let e = this.templateUrl || t.templateUrl;
|
|
834
|
+
if (e) {
|
|
835
|
+
if (x.has(e)) this.innerHTML = x.get(e);
|
|
836
|
+
else try {
|
|
837
|
+
let t = await (await fetch(e)).text();
|
|
838
|
+
x.set(e, t), this.innerHTML = t;
|
|
839
|
+
} catch (t) {
|
|
840
|
+
console.error(`Failed to load template from ${e}`, t);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
}, e.connectedCallback = async function() {
|
|
844
|
+
if (N(this) || y(this) || j(this)) return;
|
|
845
|
+
let e = this.parentElement;
|
|
846
|
+
for (; e;) {
|
|
847
|
+
if (N(e) || y(e) || j(e)) return;
|
|
848
|
+
e = e.parentElement;
|
|
849
|
+
}
|
|
850
|
+
if (this.initialized) return;
|
|
851
|
+
this.initialized = !0;
|
|
852
|
+
let n = this.template || t.template, r = this.templateUrl || t.templateUrl, i = this.innerHTML, a = n;
|
|
853
|
+
if (!a && r) {
|
|
854
|
+
if (x.has(r)) a = x.get(r);
|
|
855
|
+
else try {
|
|
856
|
+
a = await (await fetch(r)).text(), x.set(r, a);
|
|
857
|
+
} catch (e) {
|
|
858
|
+
console.error(`Failed to load template from ${r}`, e);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
if (a && (a.includes("<slot") && (a = a.replace(/<slot\s*>\s*([\s\S]*?)\s*<\/slot>|<slot\s*\/>/gi, (e, t) => i && i.trim().length > 0 ? i : t || "")), this.innerHTML = pe(a)), this.__childViews) for (let { propertyKey: e, selector: t, candidates: n } of this.__childViews) {
|
|
862
|
+
let r = n || (t ? [t] : F(e));
|
|
863
|
+
Object.defineProperty(this, e, {
|
|
864
|
+
get() {
|
|
865
|
+
return I(this, r);
|
|
866
|
+
},
|
|
867
|
+
enumerable: !0,
|
|
868
|
+
configurable: !0
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
this.bindTemplate?.(), this.onInit?.();
|
|
872
|
+
}, e.disconnectedCallback = function() {
|
|
873
|
+
this.activeDirectives &&= (this.activeDirectives.forEach((e) => e.destroy()), []), this.activeValidators &&= (this.activeValidators.forEach((e) => e.destroy()), []), this.onDestroy?.();
|
|
874
|
+
}, e.render = function(e) {
|
|
875
|
+
e != null && (this.innerHTML = pe(e), this.bindTemplate?.());
|
|
876
|
+
}, e.bindTemplate = function(e) {
|
|
877
|
+
let t = e || this;
|
|
878
|
+
this.activeDirectives ||= [], this.activeValidators ||= [], P(t, ce(this, this.__parentContext), this);
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
function me(e) {
|
|
882
|
+
let t = typeof e == "string" ? { selector: e } : e ?? {};
|
|
883
|
+
return function(e, n) {
|
|
884
|
+
let r = t.selector ?? (n && typeof n.name == "string" ? E(n.name.replace(/Component$/, "")) : E(e.name.replace(/Component$/, "")));
|
|
885
|
+
if (typeof customElements < "u" && r && customElements.get(r)) {
|
|
886
|
+
let n = customElements.get(r);
|
|
887
|
+
n.__target = e, n.__options = t, n.selector = r, e.selector = r, t.template && (n.prototype.template = t.template), t.templateUrl && (n.prototype.templateUrl = t.templateUrl);
|
|
888
|
+
let i = Object.getOwnPropertyDescriptors(e.prototype);
|
|
889
|
+
for (let [e, t] of Object.entries(i)) e !== "constructor" && Object.defineProperty(n.prototype, e, t);
|
|
890
|
+
return L(n.prototype, t), n;
|
|
891
|
+
}
|
|
892
|
+
let i, a = typeof HTMLElement < "u";
|
|
893
|
+
if (a && e.prototype instanceof HTMLElement) i = e, t.templateUrl && !i.prototype.templateUrl && (i.prototype.templateUrl = t.templateUrl), t.template && !i.prototype.template && (i.prototype.template = t.template), L(i.prototype, t);
|
|
894
|
+
else {
|
|
895
|
+
let n = a ? HTMLElement : class {};
|
|
896
|
+
class o extends n {
|
|
897
|
+
initialized = !1;
|
|
898
|
+
activeDirectives = [];
|
|
899
|
+
constructor() {
|
|
900
|
+
super();
|
|
901
|
+
let t = new (this.constructor.__target || e)(), n = /* @__PURE__ */ new Set([
|
|
902
|
+
"render",
|
|
903
|
+
"connectedCallback",
|
|
904
|
+
"disconnectedCallback",
|
|
905
|
+
"loadTemplate",
|
|
906
|
+
"bindTemplate"
|
|
907
|
+
]), r = [...Object.getOwnPropertyNames(t), ...Object.getOwnPropertySymbols(t)];
|
|
908
|
+
for (let i of r) {
|
|
909
|
+
let r = Object.getOwnPropertyDescriptor(t, i);
|
|
910
|
+
if (r) {
|
|
911
|
+
if (typeof i == "string" && n.has(i) && r.value === void 0 && !r.get && !r.set) continue;
|
|
912
|
+
let t = Object.getOwnPropertyDescriptor(e.prototype, i);
|
|
913
|
+
if (t && t.get && r.value === void 0 && !r.get && !r.set) continue;
|
|
914
|
+
Object.defineProperty(this, i, r);
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
let s = Object.getOwnPropertyDescriptors(e.prototype);
|
|
920
|
+
for (let [e, t] of Object.entries(s)) e !== "constructor" && Object.defineProperty(o.prototype, e, t);
|
|
921
|
+
t.templateUrl && !o.prototype.templateUrl && (o.prototype.templateUrl = t.templateUrl), t.template && !o.prototype.template && (o.prototype.template = t.template), o.__target = e, o.__options = t, o.selector = r, e.selector = r, L(o.prototype, t), i = o;
|
|
922
|
+
}
|
|
923
|
+
return i.selector = r, e.selector = r, r && ve(r, i), i;
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
function he(e, t) {
|
|
927
|
+
if (typeof e == "object" && e && typeof t == "string") {
|
|
928
|
+
ge(e, t, void 0);
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
let n = typeof e == "string" ? e : void 0;
|
|
932
|
+
return function(e, t) {
|
|
933
|
+
if (typeof t == "object" && t && "name" in t) {
|
|
934
|
+
let e = t.name, r = F(e, n);
|
|
935
|
+
return typeof t.addInitializer == "function" && t.addInitializer(function() {
|
|
936
|
+
Object.defineProperty(this, e, {
|
|
937
|
+
get() {
|
|
938
|
+
return I(this, r);
|
|
939
|
+
},
|
|
940
|
+
enumerable: !0,
|
|
941
|
+
configurable: !0
|
|
942
|
+
});
|
|
943
|
+
}), function(t) {
|
|
944
|
+
return Object.defineProperty(this, e, {
|
|
945
|
+
get() {
|
|
946
|
+
return I(this, r);
|
|
947
|
+
},
|
|
948
|
+
enumerable: !0,
|
|
949
|
+
configurable: !0
|
|
950
|
+
}), t;
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
ge(e, t, n);
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
function ge(e, t, n) {
|
|
957
|
+
e.__childViews ||= [];
|
|
958
|
+
let r = F(t, n);
|
|
959
|
+
e.__childViews.push({
|
|
960
|
+
propertyKey: t,
|
|
961
|
+
selector: n,
|
|
962
|
+
candidates: r
|
|
963
|
+
}), Object.defineProperty(e, t, {
|
|
964
|
+
get() {
|
|
965
|
+
return I(this, r);
|
|
966
|
+
},
|
|
967
|
+
set(e) {},
|
|
968
|
+
enumerable: !0,
|
|
969
|
+
configurable: !0
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
var _e = he, ve = (e, t) => {
|
|
973
|
+
if (typeof customElements > "u") return;
|
|
974
|
+
let n = e.toLowerCase();
|
|
975
|
+
C.set(n, t);
|
|
976
|
+
let r = e.includes("-") ? e : `${e}-component`;
|
|
977
|
+
if (e.includes("-") || C.set(r.toLowerCase(), t), customElements.get(r)) console.error(`Component ${r} is already defined`);
|
|
978
|
+
else try {
|
|
979
|
+
customElements.define(r, t);
|
|
980
|
+
} catch (e) {
|
|
981
|
+
console.error(`Failed to define custom element ${r}:`, e);
|
|
982
|
+
}
|
|
983
|
+
}, R = new class {
|
|
984
|
+
registry = /* @__PURE__ */ new Map();
|
|
985
|
+
instances = /* @__PURE__ */ new Map();
|
|
986
|
+
register(e, t, n = { singleton: !0 }) {
|
|
987
|
+
this.registry.set(e, {
|
|
988
|
+
target: t,
|
|
989
|
+
options: {
|
|
990
|
+
singleton: n.singleton ?? !0,
|
|
991
|
+
...n
|
|
992
|
+
}
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
registerValue(e, t) {
|
|
996
|
+
this.instances.set(e, t);
|
|
997
|
+
}
|
|
998
|
+
resolve(e) {
|
|
999
|
+
if (this.instances.has(e)) return this.instances.get(e);
|
|
1000
|
+
let t = this.registry.get(e);
|
|
1001
|
+
if (!t) {
|
|
1002
|
+
if (typeof e == "function") {
|
|
1003
|
+
let t = new e();
|
|
1004
|
+
return this.instances.set(e, t), t;
|
|
1005
|
+
}
|
|
1006
|
+
let t = typeof e == "symbol" ? e.toString() : String(e);
|
|
1007
|
+
throw Error(`[Purity DI] No service registered with token: "${t}".`);
|
|
1008
|
+
}
|
|
1009
|
+
let { target: n, options: r } = t, i = new n();
|
|
1010
|
+
return r.singleton !== !1 && (this.instances.set(e, i), this.instances.set(n, i), r.name && this.instances.set(r.name, i)), i;
|
|
1011
|
+
}
|
|
1012
|
+
clear() {
|
|
1013
|
+
this.registry.clear(), this.instances.clear();
|
|
1014
|
+
}
|
|
1015
|
+
}();
|
|
1016
|
+
function z(e, t) {
|
|
1017
|
+
if (typeof e == "function") {
|
|
1018
|
+
let n = e, r = t && typeof t.name == "string" ? t.name : n.name;
|
|
1019
|
+
return r && R.register(r, n, { singleton: !0 }), R.register(n, n, { singleton: !0 }), n;
|
|
1020
|
+
}
|
|
1021
|
+
let n = typeof e == "string" ? { name: e } : e ?? {};
|
|
1022
|
+
return function(e, t) {
|
|
1023
|
+
let r = n.name ?? (t && typeof t.name == "string" ? t.name : e.name);
|
|
1024
|
+
return r && R.register(r, e, n), R.register(e, e, n), e;
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
var ye = z;
|
|
1028
|
+
function be(e) {
|
|
1029
|
+
return R.resolve(e);
|
|
1030
|
+
}
|
|
1031
|
+
function xe(e, t) {
|
|
1032
|
+
R.registerValue(e, t);
|
|
1033
|
+
}
|
|
1034
|
+
//#endregion
|
|
1035
|
+
//#region src/framework/http.ts
|
|
1036
|
+
var B = class e {
|
|
1037
|
+
map = /* @__PURE__ */ new Map();
|
|
1038
|
+
displayNames = /* @__PURE__ */ new Map();
|
|
1039
|
+
constructor(t) {
|
|
1040
|
+
t && (t instanceof e ? (t.map.forEach((e, t) => {
|
|
1041
|
+
this.map.set(t, [...e]);
|
|
1042
|
+
}), t.displayNames.forEach((e, t) => {
|
|
1043
|
+
this.displayNames.set(t, e);
|
|
1044
|
+
})) : typeof Headers < "u" && t instanceof Headers ? t.forEach((e, t) => {
|
|
1045
|
+
this.append(t, e);
|
|
1046
|
+
}) : Array.isArray(t) ? t.forEach(([e, t]) => {
|
|
1047
|
+
this.append(e, t);
|
|
1048
|
+
}) : typeof t == "object" && Object.entries(t).forEach(([e, t]) => {
|
|
1049
|
+
this.set(e, t);
|
|
1050
|
+
}));
|
|
1051
|
+
}
|
|
1052
|
+
clone() {
|
|
1053
|
+
let t = new e();
|
|
1054
|
+
return this.map.forEach((e, n) => {
|
|
1055
|
+
t.map.set(n, [...e]);
|
|
1056
|
+
}), this.displayNames.forEach((e, n) => {
|
|
1057
|
+
t.displayNames.set(n, e);
|
|
1058
|
+
}), t;
|
|
1059
|
+
}
|
|
1060
|
+
has(e) {
|
|
1061
|
+
return this.map.has(e.toLowerCase());
|
|
1062
|
+
}
|
|
1063
|
+
get(e) {
|
|
1064
|
+
let t = this.map.get(e.toLowerCase());
|
|
1065
|
+
return t && t.length > 0 ? t.join(", ") : null;
|
|
1066
|
+
}
|
|
1067
|
+
getAll(e) {
|
|
1068
|
+
let t = this.map.get(e.toLowerCase());
|
|
1069
|
+
return t ? [...t] : null;
|
|
1070
|
+
}
|
|
1071
|
+
keys() {
|
|
1072
|
+
return Array.from(this.displayNames.values());
|
|
1073
|
+
}
|
|
1074
|
+
set(e, t) {
|
|
1075
|
+
let n = this.clone(), r = e.toLowerCase(), i = Array.isArray(t) ? t.map(String) : [String(t)];
|
|
1076
|
+
return n.map.set(r, i), n.displayNames.set(r, e), n;
|
|
1077
|
+
}
|
|
1078
|
+
append(e, t) {
|
|
1079
|
+
let n = this.clone(), r = e.toLowerCase(), i = Array.isArray(t) ? t.map(String) : [String(t)], a = n.map.get(r) || [];
|
|
1080
|
+
return n.map.set(r, [...a, ...i]), n.displayNames.has(r) || n.displayNames.set(r, e), n;
|
|
1081
|
+
}
|
|
1082
|
+
delete(e) {
|
|
1083
|
+
let t = this.clone(), n = e.toLowerCase();
|
|
1084
|
+
return t.map.delete(n), t.displayNames.delete(n), t;
|
|
1085
|
+
}
|
|
1086
|
+
forEach(e) {
|
|
1087
|
+
this.displayNames.forEach((t, n) => {
|
|
1088
|
+
let r = this.get(n);
|
|
1089
|
+
r !== null && e(r, t, this);
|
|
1090
|
+
});
|
|
1091
|
+
}
|
|
1092
|
+
toRecord() {
|
|
1093
|
+
let e = {};
|
|
1094
|
+
return this.displayNames.forEach((t, n) => {
|
|
1095
|
+
let r = this.get(n);
|
|
1096
|
+
r !== null && (e[t] = r);
|
|
1097
|
+
}), e;
|
|
1098
|
+
}
|
|
1099
|
+
toHeaders() {
|
|
1100
|
+
let e = new Headers();
|
|
1101
|
+
return this.displayNames.forEach((t, n) => {
|
|
1102
|
+
let r = this.map.get(n);
|
|
1103
|
+
r && r.forEach((n) => e.append(t, n));
|
|
1104
|
+
}), e;
|
|
1105
|
+
}
|
|
1106
|
+
}, V = class e {
|
|
1107
|
+
map = /* @__PURE__ */ new Map();
|
|
1108
|
+
constructor(t) {
|
|
1109
|
+
if (t) {
|
|
1110
|
+
if (t instanceof e) t.map.forEach((e, t) => {
|
|
1111
|
+
this.map.set(t, [...e]);
|
|
1112
|
+
});
|
|
1113
|
+
else if (typeof URLSearchParams < "u" && t instanceof URLSearchParams) t.forEach((e, t) => {
|
|
1114
|
+
this.append(t, e);
|
|
1115
|
+
});
|
|
1116
|
+
else if (typeof t == "string") {
|
|
1117
|
+
let e = t.startsWith("?") ? t.slice(1) : t;
|
|
1118
|
+
new URLSearchParams(e).forEach((e, t) => {
|
|
1119
|
+
this.append(t, e);
|
|
1120
|
+
});
|
|
1121
|
+
} else typeof t == "object" && Object.entries(t).forEach(([e, t]) => {
|
|
1122
|
+
Array.isArray(t) ? this.set(e, t) : t != null && this.set(e, String(t));
|
|
1123
|
+
});
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
clone() {
|
|
1127
|
+
let t = new e();
|
|
1128
|
+
return this.map.forEach((e, n) => {
|
|
1129
|
+
t.map.set(n, [...e]);
|
|
1130
|
+
}), t;
|
|
1131
|
+
}
|
|
1132
|
+
has(e) {
|
|
1133
|
+
return this.map.has(e);
|
|
1134
|
+
}
|
|
1135
|
+
get(e) {
|
|
1136
|
+
let t = this.map.get(e);
|
|
1137
|
+
return t && t.length > 0 ? t[0] : null;
|
|
1138
|
+
}
|
|
1139
|
+
getAll(e) {
|
|
1140
|
+
let t = this.map.get(e);
|
|
1141
|
+
return t ? [...t] : null;
|
|
1142
|
+
}
|
|
1143
|
+
keys() {
|
|
1144
|
+
return Array.from(this.map.keys());
|
|
1145
|
+
}
|
|
1146
|
+
set(e, t) {
|
|
1147
|
+
let n = this.clone(), r = Array.isArray(t) ? t.map(String) : [String(t)];
|
|
1148
|
+
return n.map.set(e, r), n;
|
|
1149
|
+
}
|
|
1150
|
+
append(e, t) {
|
|
1151
|
+
let n = this.clone(), r = Array.isArray(t) ? t.map(String) : [String(t)], i = n.map.get(e) || [];
|
|
1152
|
+
return n.map.set(e, [...i, ...r]), n;
|
|
1153
|
+
}
|
|
1154
|
+
delete(e) {
|
|
1155
|
+
let t = this.clone();
|
|
1156
|
+
return t.map.delete(e), t;
|
|
1157
|
+
}
|
|
1158
|
+
toString() {
|
|
1159
|
+
let e = new URLSearchParams();
|
|
1160
|
+
return this.map.forEach((t, n) => {
|
|
1161
|
+
t.forEach((t) => e.append(n, t));
|
|
1162
|
+
}), e.toString();
|
|
1163
|
+
}
|
|
1164
|
+
}, Se = class e {
|
|
1165
|
+
method;
|
|
1166
|
+
url;
|
|
1167
|
+
headers;
|
|
1168
|
+
params;
|
|
1169
|
+
body;
|
|
1170
|
+
responseType;
|
|
1171
|
+
timeout;
|
|
1172
|
+
signal;
|
|
1173
|
+
withCredentials;
|
|
1174
|
+
context;
|
|
1175
|
+
constructor(e, t, n = {}) {
|
|
1176
|
+
this.method = e.toUpperCase() || "GET", this.url = t, this.headers = n.headers instanceof B ? n.headers : new B(n.headers), this.params = n.params instanceof V ? n.params : new V(n.params), this.body = n.body === void 0 ? null : n.body, this.responseType = n.responseType || "json", this.timeout = n.timeout, this.signal = n.signal, this.withCredentials = n.withCredentials, this.context = /* @__PURE__ */ new Map(), n.context && (n.context instanceof Map ? n.context.forEach((e, t) => this.context.set(t, e)) : Object.entries(n.context).forEach(([e, t]) => this.context.set(e, t)));
|
|
1177
|
+
}
|
|
1178
|
+
clone(t = {}) {
|
|
1179
|
+
return new e(t.method || this.method, t.url || this.url, {
|
|
1180
|
+
headers: t.headers === void 0 ? this.headers : t.headers,
|
|
1181
|
+
params: t.params === void 0 ? this.params : t.params,
|
|
1182
|
+
body: t.body === void 0 ? this.body : t.body,
|
|
1183
|
+
responseType: t.responseType || this.responseType,
|
|
1184
|
+
timeout: t.timeout === void 0 ? this.timeout : t.timeout,
|
|
1185
|
+
signal: t.signal || this.signal,
|
|
1186
|
+
withCredentials: t.withCredentials === void 0 ? this.withCredentials : t.withCredentials,
|
|
1187
|
+
context: t.context || this.context
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
getUrlWithParams() {
|
|
1191
|
+
let e = this.params.toString();
|
|
1192
|
+
if (!e) return this.url;
|
|
1193
|
+
let t = this.url.includes("?") ? "&" : "?";
|
|
1194
|
+
return `${this.url}${t}${e}`;
|
|
1195
|
+
}
|
|
1196
|
+
}, Ce = class {
|
|
1197
|
+
data;
|
|
1198
|
+
status;
|
|
1199
|
+
statusText;
|
|
1200
|
+
headers;
|
|
1201
|
+
url;
|
|
1202
|
+
ok;
|
|
1203
|
+
request;
|
|
1204
|
+
constructor(e) {
|
|
1205
|
+
this.data = e.data, this.status = e.status, this.statusText = e.statusText, this.headers = e.headers, this.url = e.url, this.ok = e.status >= 200 && e.status < 300, this.request = e.request;
|
|
1206
|
+
}
|
|
1207
|
+
}, H = class e extends Error {
|
|
1208
|
+
error;
|
|
1209
|
+
status;
|
|
1210
|
+
statusText;
|
|
1211
|
+
url;
|
|
1212
|
+
headers;
|
|
1213
|
+
request;
|
|
1214
|
+
constructor(t) {
|
|
1215
|
+
super(t.message || `Http failure response for ${t.url}: ${t.status} ${t.statusText}`), this.name = "HttpErrorResponse", this.error = t.error, this.status = t.status, this.statusText = t.statusText, this.url = t.url, this.headers = t.headers, this.request = t.request, Object.setPrototypeOf(this, e.prototype);
|
|
1216
|
+
}
|
|
1217
|
+
}, U = "HTTP_INTERCEPTORS";
|
|
1218
|
+
function we(...e) {
|
|
1219
|
+
return {
|
|
1220
|
+
provide: U,
|
|
1221
|
+
useValue: e.map((e) => typeof e == "function" && e.prototype && typeof e.prototype.intercept == "function" ? new e() : e)
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
var Te = class {
|
|
1225
|
+
async handle(e) {
|
|
1226
|
+
let t = e.getUrlWithParams(), n = e.headers, r = null;
|
|
1227
|
+
e.body !== null && e.body !== void 0 && (typeof Blob < "u" && e.body instanceof Blob || typeof ArrayBuffer < "u" && e.body instanceof ArrayBuffer || typeof FormData < "u" && e.body instanceof FormData || typeof URLSearchParams < "u" && e.body instanceof URLSearchParams || typeof e.body == "string" ? r = e.body : (r = JSON.stringify(e.body), n.has("Content-Type") || (n = n.set("Content-Type", "application/json")))), n.has("Accept") || (e.responseType === "json" ? n = n.set("Accept", "application/json, text/plain, */*") : e.responseType === "text" && (n = n.set("Accept", "text/plain, */*")));
|
|
1228
|
+
let i, a = new AbortController(), o = a.signal;
|
|
1229
|
+
e.signal && (e.signal.aborted ? a.abort() : e.signal.addEventListener("abort", () => a.abort())), e.timeout && e.timeout > 0 && (i = setTimeout(() => {
|
|
1230
|
+
a.abort();
|
|
1231
|
+
}, e.timeout));
|
|
1232
|
+
let s = {
|
|
1233
|
+
method: e.method,
|
|
1234
|
+
headers: n.toRecord(),
|
|
1235
|
+
body: ["GET", "HEAD"].includes(e.method) ? void 0 : r,
|
|
1236
|
+
signal: o,
|
|
1237
|
+
credentials: e.withCredentials ? "include" : "same-origin"
|
|
1238
|
+
};
|
|
1239
|
+
try {
|
|
1240
|
+
let n = await fetch(t, s);
|
|
1241
|
+
i && clearTimeout(i);
|
|
1242
|
+
let r = new B(n.headers), a = null;
|
|
1243
|
+
if (n.status !== 204 && e.method !== "HEAD") switch (e.responseType) {
|
|
1244
|
+
case "json":
|
|
1245
|
+
try {
|
|
1246
|
+
let e = await n.text();
|
|
1247
|
+
a = e ? JSON.parse(e) : null;
|
|
1248
|
+
} catch {
|
|
1249
|
+
a = null;
|
|
1250
|
+
}
|
|
1251
|
+
break;
|
|
1252
|
+
case "text":
|
|
1253
|
+
a = await n.text();
|
|
1254
|
+
break;
|
|
1255
|
+
case "blob":
|
|
1256
|
+
a = await n.blob();
|
|
1257
|
+
break;
|
|
1258
|
+
case "arraybuffer":
|
|
1259
|
+
a = await n.arrayBuffer();
|
|
1260
|
+
break;
|
|
1261
|
+
case "stream":
|
|
1262
|
+
a = n.body;
|
|
1263
|
+
break;
|
|
1264
|
+
default: a = await n.text();
|
|
1265
|
+
}
|
|
1266
|
+
let o = new Ce({
|
|
1267
|
+
data: a,
|
|
1268
|
+
status: n.status,
|
|
1269
|
+
statusText: n.statusText,
|
|
1270
|
+
headers: r,
|
|
1271
|
+
url: n.url || t,
|
|
1272
|
+
request: e
|
|
1273
|
+
});
|
|
1274
|
+
if (!n.ok) throw new H({
|
|
1275
|
+
error: a,
|
|
1276
|
+
status: n.status,
|
|
1277
|
+
statusText: n.statusText,
|
|
1278
|
+
url: n.url || t,
|
|
1279
|
+
headers: r,
|
|
1280
|
+
request: e
|
|
1281
|
+
});
|
|
1282
|
+
return o;
|
|
1283
|
+
} catch (n) {
|
|
1284
|
+
throw i && clearTimeout(i), n instanceof H ? n : new H({
|
|
1285
|
+
error: n,
|
|
1286
|
+
status: 0,
|
|
1287
|
+
statusText: n.name === "AbortError" || a.signal.aborted ? "Request Timeout / Aborted" : "Network Failure",
|
|
1288
|
+
url: t,
|
|
1289
|
+
headers: new B(),
|
|
1290
|
+
request: e,
|
|
1291
|
+
message: n.message || "Network request failed"
|
|
1292
|
+
});
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
}, Ee = Array.from({ length: 23 }, (e, t) => `url('/cursors/progress-${String(t + 1).padStart(2, "0")}.svg') 4 4, progress`), W = null, G = 0, K = 0;
|
|
1296
|
+
function De() {
|
|
1297
|
+
typeof document > "u" || (K++, document.documentElement.classList.add("http-loading"), document.body?.classList.add("http-loading"), W ||= (G = 0, setInterval(() => {
|
|
1298
|
+
G = (G + 1) % Ee.length, document.documentElement.style.setProperty("--cursor-progress", Ee[G]);
|
|
1299
|
+
}, 45)));
|
|
1300
|
+
}
|
|
1301
|
+
function Oe() {
|
|
1302
|
+
typeof document > "u" || (K = Math.max(0, K - 1), K === 0 && (document.documentElement.classList.remove("http-loading"), document.body?.classList.remove("http-loading"), W &&= (clearInterval(W), null), document.documentElement.style.removeProperty("--cursor-progress")));
|
|
1303
|
+
}
|
|
1304
|
+
var q = class {
|
|
1305
|
+
backend = new Te();
|
|
1306
|
+
interceptors = [];
|
|
1307
|
+
activeRequests = Z(0);
|
|
1308
|
+
isLoading = Z(!1);
|
|
1309
|
+
constructor() {
|
|
1310
|
+
try {
|
|
1311
|
+
let e = R.resolve(U);
|
|
1312
|
+
Array.isArray(e) && this.interceptors.push(...e);
|
|
1313
|
+
} catch {}
|
|
1314
|
+
}
|
|
1315
|
+
addInterceptor(e) {
|
|
1316
|
+
return this.interceptors.push(e), () => {
|
|
1317
|
+
let t = this.interceptors.indexOf(e);
|
|
1318
|
+
t >= 0 && this.interceptors.splice(t, 1);
|
|
1319
|
+
};
|
|
1320
|
+
}
|
|
1321
|
+
use(e) {
|
|
1322
|
+
return this.addInterceptor(e), this;
|
|
1323
|
+
}
|
|
1324
|
+
async request(e, t, n) {
|
|
1325
|
+
let r = new Se(e, t, n);
|
|
1326
|
+
this.activeRequests.update((e) => e + 1), this.isLoading.set(!0), De();
|
|
1327
|
+
let i = this.interceptors.map((e) => typeof e == "function" ? e : (t, n) => e.intercept(t, n)), a = (e) => this.backend.handle(e), o = -1, s = (e, t) => {
|
|
1328
|
+
if (e <= o) return Promise.reject(/* @__PURE__ */ Error("[HttpClient] next() called multiple times in interceptor"));
|
|
1329
|
+
o = e;
|
|
1330
|
+
let n = i[e];
|
|
1331
|
+
return n ? n(t, (t) => s(e + 1, t)) : a(t);
|
|
1332
|
+
};
|
|
1333
|
+
try {
|
|
1334
|
+
return await s(0, r);
|
|
1335
|
+
} finally {
|
|
1336
|
+
this.activeRequests.update((e) => Math.max(0, e - 1));
|
|
1337
|
+
let e = this.activeRequests() > 0;
|
|
1338
|
+
this.isLoading.set(e), Oe();
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
get(e, t) {
|
|
1342
|
+
return this.request("GET", e, t);
|
|
1343
|
+
}
|
|
1344
|
+
post(e, t, n) {
|
|
1345
|
+
return this.request("POST", e, {
|
|
1346
|
+
...n,
|
|
1347
|
+
body: t
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
put(e, t, n) {
|
|
1351
|
+
return this.request("PUT", e, {
|
|
1352
|
+
...n,
|
|
1353
|
+
body: t
|
|
1354
|
+
});
|
|
1355
|
+
}
|
|
1356
|
+
patch(e, t, n) {
|
|
1357
|
+
return this.request("PATCH", e, {
|
|
1358
|
+
...n,
|
|
1359
|
+
body: t
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
delete(e, t) {
|
|
1363
|
+
return this.request("DELETE", e, t);
|
|
1364
|
+
}
|
|
1365
|
+
head(e, t) {
|
|
1366
|
+
return this.request("HEAD", e, t);
|
|
1367
|
+
}
|
|
1368
|
+
options(e, t) {
|
|
1369
|
+
return this.request("OPTIONS", e, t);
|
|
1370
|
+
}
|
|
1371
|
+
createResource(e, t = !0) {
|
|
1372
|
+
let n = Z(null), r = Z(!1), i = Z(null), a = Z(null), o = async () => {
|
|
1373
|
+
r.set(!0), i.set(null);
|
|
1374
|
+
try {
|
|
1375
|
+
let t = await e();
|
|
1376
|
+
return n.set(t.data), a.set(t.status), t;
|
|
1377
|
+
} catch (e) {
|
|
1378
|
+
return i.set(e), e instanceof H ? a.set(e.status) : a.set(0), null;
|
|
1379
|
+
} finally {
|
|
1380
|
+
r.set(!1);
|
|
1381
|
+
}
|
|
1382
|
+
};
|
|
1383
|
+
return t && o(), {
|
|
1384
|
+
data: n,
|
|
1385
|
+
loading: r,
|
|
1386
|
+
error: i,
|
|
1387
|
+
status: a,
|
|
1388
|
+
refetch: o
|
|
1389
|
+
};
|
|
1390
|
+
}
|
|
1391
|
+
};
|
|
1392
|
+
z("HttpClient")(q);
|
|
1393
|
+
//#endregion
|
|
1394
|
+
//#region src/framework/router.ts
|
|
1395
|
+
function J(e) {
|
|
1396
|
+
if (!e || e === "/") return "/";
|
|
1397
|
+
let t = e.trim();
|
|
1398
|
+
return t.startsWith("/") || (t = "/" + t), t.length > 1 && t.endsWith("/") && (t = t.slice(0, -1)), t;
|
|
1399
|
+
}
|
|
1400
|
+
function ke(e) {
|
|
1401
|
+
let t = {};
|
|
1402
|
+
if (!e) return t;
|
|
1403
|
+
let n = e.startsWith("?") ? e.slice(1) : e;
|
|
1404
|
+
if (!n) return t;
|
|
1405
|
+
let r = n.split("&");
|
|
1406
|
+
for (let e of r) {
|
|
1407
|
+
if (!e) continue;
|
|
1408
|
+
let [n, r] = e.split("=");
|
|
1409
|
+
n && (t[decodeURIComponent(n)] = r === void 0 ? "" : decodeURIComponent(r));
|
|
1410
|
+
}
|
|
1411
|
+
return t;
|
|
1412
|
+
}
|
|
1413
|
+
function Ae(e) {
|
|
1414
|
+
let t = Object.keys(e);
|
|
1415
|
+
return t.length === 0 ? "" : `?${t.map((t) => `${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`).join("&")}`;
|
|
1416
|
+
}
|
|
1417
|
+
function je(e, t) {
|
|
1418
|
+
let n = J(e), r = J(t);
|
|
1419
|
+
if (n === "/**" || e === "**") return {
|
|
1420
|
+
matched: !0,
|
|
1421
|
+
params: { wildcard: r }
|
|
1422
|
+
};
|
|
1423
|
+
if (n === "/" && r === "/") return {
|
|
1424
|
+
matched: !0,
|
|
1425
|
+
params: {}
|
|
1426
|
+
};
|
|
1427
|
+
let i = n.split("/").filter(Boolean), a = r.split("/").filter(Boolean);
|
|
1428
|
+
if (i.length !== a.length) {
|
|
1429
|
+
if (i.length > 0 && i[i.length - 1] === "*" && a.length >= i.length - 1) {
|
|
1430
|
+
let e = {};
|
|
1431
|
+
for (let t = 0; t < i.length - 1; t++) {
|
|
1432
|
+
let n = i[t], r = a[t];
|
|
1433
|
+
if (n.startsWith(":")) e[n.slice(1)] = decodeURIComponent(r);
|
|
1434
|
+
else if (n !== r) return null;
|
|
1435
|
+
}
|
|
1436
|
+
return {
|
|
1437
|
+
matched: !0,
|
|
1438
|
+
params: e
|
|
1439
|
+
};
|
|
1440
|
+
}
|
|
1441
|
+
return null;
|
|
1442
|
+
}
|
|
1443
|
+
let o = {};
|
|
1444
|
+
for (let e = 0; e < i.length; e++) {
|
|
1445
|
+
let t = i[e], n = a[e];
|
|
1446
|
+
if (t.startsWith(":")) o[t.slice(1)] = decodeURIComponent(n);
|
|
1447
|
+
else if (t === "*") continue;
|
|
1448
|
+
else if (t !== n) return null;
|
|
1449
|
+
}
|
|
1450
|
+
return {
|
|
1451
|
+
matched: !0,
|
|
1452
|
+
params: o
|
|
1453
|
+
};
|
|
1454
|
+
}
|
|
1455
|
+
var Me = class {
|
|
1456
|
+
routes = [];
|
|
1457
|
+
options = {
|
|
1458
|
+
mode: "history",
|
|
1459
|
+
scrollRestoration: !1
|
|
1460
|
+
};
|
|
1461
|
+
isListening = !1;
|
|
1462
|
+
url = Z("/");
|
|
1463
|
+
path = Z("/");
|
|
1464
|
+
params = Z({});
|
|
1465
|
+
queryParams = Z({});
|
|
1466
|
+
data = Z({});
|
|
1467
|
+
activeRoute = Z(null);
|
|
1468
|
+
constructor() {
|
|
1469
|
+
typeof window < "u" && this.startListening();
|
|
1470
|
+
}
|
|
1471
|
+
configureRoutes(e, t) {
|
|
1472
|
+
this.routes = [...e], t && (this.options = {
|
|
1473
|
+
...this.options,
|
|
1474
|
+
...t
|
|
1475
|
+
});
|
|
1476
|
+
let n = this.options.initialUrl || this.getCurrentLocationUrl();
|
|
1477
|
+
this.navigateByUrl(n, { replaceUrl: !0 }), this.startListening();
|
|
1478
|
+
}
|
|
1479
|
+
getRoutes() {
|
|
1480
|
+
return [...this.routes];
|
|
1481
|
+
}
|
|
1482
|
+
startListening() {
|
|
1483
|
+
if (this.isListening || typeof window > "u") return;
|
|
1484
|
+
this.isListening = !0;
|
|
1485
|
+
let e = () => {
|
|
1486
|
+
this.options.mode !== "memory" && this.navigateByUrl(this.getCurrentLocationUrl(), { skipLocationChange: !0 });
|
|
1487
|
+
};
|
|
1488
|
+
window.addEventListener("popstate", e), window.addEventListener("hashchange", e);
|
|
1489
|
+
}
|
|
1490
|
+
getCurrentLocationUrl() {
|
|
1491
|
+
if (typeof window > "u") return "/";
|
|
1492
|
+
if (this.options.mode === "hash") {
|
|
1493
|
+
let e = window.location.hash.slice(1);
|
|
1494
|
+
return e.startsWith("/") ? e : "/" + e;
|
|
1495
|
+
}
|
|
1496
|
+
let e = window.location.pathname;
|
|
1497
|
+
return e && e !== "/" && !e.endsWith("index.html") ? e + window.location.search : window.location.hash && window.location.hash.startsWith("#/") ? window.location.hash.slice(1) : e || "/";
|
|
1498
|
+
}
|
|
1499
|
+
async navigate(e, t) {
|
|
1500
|
+
let n = e;
|
|
1501
|
+
if (t?.queryParams) {
|
|
1502
|
+
let e = Ae(t.queryParams), r = n.includes("?") ? "&" : "";
|
|
1503
|
+
n = n + r + (e.startsWith("?") ? e.slice(1) : e);
|
|
1504
|
+
}
|
|
1505
|
+
return this.navigateByUrl(n, t);
|
|
1506
|
+
}
|
|
1507
|
+
async navigateByUrl(e, t) {
|
|
1508
|
+
let [n, r] = e.split("?"), i = J(n || "/"), a = ke(r || ""), o = this.findMatchingRoute(i);
|
|
1509
|
+
if (!o) return console.warn(`[Purity Router] No matching route found for path "${i}"`), !1;
|
|
1510
|
+
let { route: s, params: c } = o;
|
|
1511
|
+
if (s.redirectTo) return this.navigate(s.redirectTo, t);
|
|
1512
|
+
if (s.canActivate && s.canActivate.length > 0) {
|
|
1513
|
+
let t = {
|
|
1514
|
+
url: e,
|
|
1515
|
+
path: i,
|
|
1516
|
+
params: c,
|
|
1517
|
+
queryParams: a,
|
|
1518
|
+
data: s.data || {}
|
|
1519
|
+
};
|
|
1520
|
+
for (let e of s.canActivate) {
|
|
1521
|
+
let n = !0;
|
|
1522
|
+
if (typeof e == "function") {
|
|
1523
|
+
if (e.prototype && typeof e.prototype.canActivate == "function") {
|
|
1524
|
+
let r = e, i;
|
|
1525
|
+
try {
|
|
1526
|
+
i = R.resolve(r);
|
|
1527
|
+
} catch {
|
|
1528
|
+
i = new r();
|
|
1529
|
+
}
|
|
1530
|
+
n = await i.canActivate(s, t);
|
|
1531
|
+
} else n = await e(s, t);
|
|
1532
|
+
} else if (typeof e == "string") try {
|
|
1533
|
+
let r = R.resolve(e);
|
|
1534
|
+
r && typeof r.canActivate == "function" && (n = await r.canActivate(s, t));
|
|
1535
|
+
} catch (t) {
|
|
1536
|
+
return console.error(`[Purity Router] Failed to resolve guard token "${e}"`, t), !1;
|
|
1537
|
+
}
|
|
1538
|
+
if (!n) return !1;
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
if (this.path.set(i), this.params.set(c), this.queryParams.set(a), this.data.set(s.data || {}), this.activeRoute.set(s), this.url.set(e), typeof window < "u" && !t?.skipLocationChange && this.options.mode !== "memory") {
|
|
1542
|
+
let n = this.options.mode === "hash" ? `#${e}` : e;
|
|
1543
|
+
t?.replaceUrl ? window.history.replaceState(t?.state || {}, "", n) : window.history.pushState(t?.state || {}, "", n);
|
|
1544
|
+
}
|
|
1545
|
+
if (typeof document < "u") {
|
|
1546
|
+
let e = null;
|
|
1547
|
+
try {
|
|
1548
|
+
e = R.resolve("SeoService");
|
|
1549
|
+
} catch {}
|
|
1550
|
+
let t = s.seo || s.data?.seo;
|
|
1551
|
+
if (t) {
|
|
1552
|
+
let n = typeof t == "function" ? t(c, s.data || {}) : t;
|
|
1553
|
+
e ? e.setSeo(n) : n.title && (document.title = n.title);
|
|
1554
|
+
} else if (s.title) {
|
|
1555
|
+
let t = typeof s.title == "function" ? s.title(c) : s.title;
|
|
1556
|
+
e ? e.setTitle(t) : document.title = t;
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
return this.options.scrollRestoration && typeof window < "u" && !t?.skipLocationChange && window.scrollTo({
|
|
1560
|
+
top: 0,
|
|
1561
|
+
left: 0,
|
|
1562
|
+
behavior: "instant"
|
|
1563
|
+
}), !0;
|
|
1564
|
+
}
|
|
1565
|
+
findMatchingRoute(e) {
|
|
1566
|
+
let t = null;
|
|
1567
|
+
for (let n of this.routes) {
|
|
1568
|
+
if (n.path === "**" || n.path === "/**") {
|
|
1569
|
+
t = n;
|
|
1570
|
+
continue;
|
|
1571
|
+
}
|
|
1572
|
+
let r = je(n.path, e);
|
|
1573
|
+
if (r) return {
|
|
1574
|
+
route: n,
|
|
1575
|
+
params: r.params
|
|
1576
|
+
};
|
|
1577
|
+
}
|
|
1578
|
+
return t ? {
|
|
1579
|
+
route: t,
|
|
1580
|
+
params: { wildcard: e }
|
|
1581
|
+
} : null;
|
|
1582
|
+
}
|
|
1583
|
+
back() {
|
|
1584
|
+
typeof window < "u" && window.history.back();
|
|
1585
|
+
}
|
|
1586
|
+
forward() {
|
|
1587
|
+
typeof window < "u" && window.history.forward();
|
|
1588
|
+
}
|
|
1589
|
+
getOptions() {
|
|
1590
|
+
return { ...this.options };
|
|
1591
|
+
}
|
|
1592
|
+
isActive(e, t = !1) {
|
|
1593
|
+
let n = this.path(), r = J(e);
|
|
1594
|
+
return t || r === "/" ? n === r : n.startsWith(r);
|
|
1595
|
+
}
|
|
1596
|
+
}, Ne = class {
|
|
1597
|
+
router = R.resolve("Router");
|
|
1598
|
+
currentRenderedComponent = null;
|
|
1599
|
+
currentMountedElement = null;
|
|
1600
|
+
onInit() {
|
|
1601
|
+
this.classList.add("purity-router-layout"), Q(() => {
|
|
1602
|
+
let e = this.router.activeRoute();
|
|
1603
|
+
this.renderRouteComponent(e);
|
|
1604
|
+
});
|
|
1605
|
+
}
|
|
1606
|
+
onDestroy() {
|
|
1607
|
+
this.teardownCurrentComponent();
|
|
1608
|
+
}
|
|
1609
|
+
teardownCurrentComponent() {
|
|
1610
|
+
if (this.currentRenderedComponent && typeof this.currentRenderedComponent.onDestroy == "function") try {
|
|
1611
|
+
this.currentRenderedComponent.onDestroy();
|
|
1612
|
+
} catch (e) {
|
|
1613
|
+
console.error("[Purity Router] Error in component onDestroy:", e);
|
|
1614
|
+
}
|
|
1615
|
+
this.currentMountedElement && this.currentMountedElement.parentNode && this.currentMountedElement.parentNode.removeChild(this.currentMountedElement), this.currentRenderedComponent = null, this.currentMountedElement = null;
|
|
1616
|
+
}
|
|
1617
|
+
renderRouteComponent(e) {
|
|
1618
|
+
let t = this;
|
|
1619
|
+
if (this.teardownCurrentComponent(), t.innerHTML = "", !e || !e.component) return;
|
|
1620
|
+
let n = null;
|
|
1621
|
+
if (typeof e.component == "string") n = document.createElement(e.component), this.currentMountedElement = n, this.currentRenderedComponent = n;
|
|
1622
|
+
else if (typeof e.component == "function") {
|
|
1623
|
+
let t = e.component, r = t.selector || t.__options?.selector;
|
|
1624
|
+
if (!r && typeof t.name == "string" && (r = t.name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase().replace(/-component$/, "")), r) n = document.createElement(r), this.currentMountedElement = n, this.currentRenderedComponent = n;
|
|
1625
|
+
else try {
|
|
1626
|
+
let e = new t();
|
|
1627
|
+
this.currentRenderedComponent = e, e instanceof HTMLElement && (n = e, this.currentMountedElement = n);
|
|
1628
|
+
} catch (e) {
|
|
1629
|
+
console.error("[Purity Router] Failed to instantiate route component", e);
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
n && (this.currentRenderedComponent && ("routeParams" in this.currentRenderedComponent && (this.currentRenderedComponent.routeParams = this.router.params), "queryParams" in this.currentRenderedComponent && (this.currentRenderedComponent.queryParams = this.router.queryParams), "routeData" in this.currentRenderedComponent && (this.currentRenderedComponent.routeData = this.router.data)), t.appendChild(n));
|
|
1633
|
+
}
|
|
1634
|
+
}, Pe = class extends r {
|
|
1635
|
+
router = R.resolve("Router");
|
|
1636
|
+
clickHandler;
|
|
1637
|
+
onInit() {
|
|
1638
|
+
this.clickHandler = (e) => {
|
|
1639
|
+
if (e.button !== 0 || e.ctrlKey || e.metaKey || e.shiftKey) return;
|
|
1640
|
+
e.preventDefault();
|
|
1641
|
+
let t = this.value || this.element.getAttribute("routerLink") || this.element.getAttribute("href") || "/";
|
|
1642
|
+
this.router.navigate(t);
|
|
1643
|
+
}, this.element.addEventListener("click", this.clickHandler), Q(() => {
|
|
1644
|
+
let e = this.value || this.element.getAttribute("routerLink") || this.element.getAttribute("href") || "/", t = this.router.isActive(e, e === "/");
|
|
1645
|
+
if (this.element.tagName === "A") {
|
|
1646
|
+
let t = this.router.getOptions().mode === "hash";
|
|
1647
|
+
this.element.setAttribute("href", t ? `#${e}` : e);
|
|
1648
|
+
}
|
|
1649
|
+
this.element.classList.toggle("active-link", t), this.element.classList.toggle("active-route", t), this.element.setAttribute("aria-current", t ? "page" : "false");
|
|
1650
|
+
});
|
|
1651
|
+
}
|
|
1652
|
+
onChanges(e) {
|
|
1653
|
+
this.value = e;
|
|
1654
|
+
}
|
|
1655
|
+
onDestroy() {
|
|
1656
|
+
this.clickHandler && this.element.removeEventListener("click", this.clickHandler);
|
|
1657
|
+
}
|
|
1658
|
+
};
|
|
1659
|
+
z("Router")(Me), me({ selector: "router-layout" })(Ne), n("routerLink")(Pe);
|
|
1660
|
+
//#endregion
|
|
1661
|
+
//#region src/framework/bootstrap.ts
|
|
1662
|
+
var Fe = "ENVIRONMENT", Ie = null;
|
|
1663
|
+
function Le() {
|
|
1664
|
+
return Ie;
|
|
1665
|
+
}
|
|
1666
|
+
async function Re(e, t = {}) {
|
|
1667
|
+
let n = t.environment || { production: !1 };
|
|
1668
|
+
if (R.registerValue(Fe, n), R.registerValue("ENVIRONMENT", n), t.providers && Array.isArray(t.providers)) for (let e of t.providers) typeof e == "function" ? R.register(e, e) : e && typeof e == "object" && ("useValue" in e ? R.registerValue(e.provide, e.useValue) : "useClass" in e && R.register(e.provide, e.useClass));
|
|
1669
|
+
if (t.interceptors && Array.isArray(t.interceptors)) {
|
|
1670
|
+
let e = R.resolve(q);
|
|
1671
|
+
for (let n of t.interceptors) typeof n == "function" ? n.prototype && typeof n.prototype.intercept == "function" ? e.use(new n()) : e.use(n) : n && typeof n.intercept == "function" && e.use(n);
|
|
1672
|
+
}
|
|
1673
|
+
try {
|
|
1674
|
+
R.resolve("ThemeService");
|
|
1675
|
+
} catch {
|
|
1676
|
+
if (typeof document < "u") {
|
|
1677
|
+
let e = (typeof localStorage < "u" ? localStorage.getItem("purity-theme") : null) === "light" ? "light" : "dark";
|
|
1678
|
+
document.documentElement.setAttribute("data-theme", e), document.body?.setAttribute("data-theme", e);
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
t.routes && Array.isArray(t.routes) && R.resolve(Me).configureRoutes(t.routes, t.routerOptions);
|
|
1682
|
+
let r = t.rootSelector || (e.selector ? e.selector : null), i = null;
|
|
1683
|
+
r && typeof document < "u" && (i = document.querySelector(r));
|
|
1684
|
+
let a = {
|
|
1685
|
+
rootComponent: e,
|
|
1686
|
+
rootElement: i,
|
|
1687
|
+
environment: n,
|
|
1688
|
+
destroy: () => {
|
|
1689
|
+
i && typeof i.disconnectedCallback == "function" && i.disconnectedCallback(), i && i.parentNode && i.parentNode.removeChild(i), Ie = null, typeof window < "u" && delete window.__PURITY_APP__;
|
|
1690
|
+
}
|
|
1691
|
+
};
|
|
1692
|
+
return Ie = a, typeof window < "u" && (window.__PURITY_APP__ = a, n.enableDebugTools !== !1 && !n.production && console.log(`%c[Purity] 🚀 ${n.appName || "Application"} bootstrapped successfully (v${n.version || "1.0.0"}) [Dev Mode]`, "color: #3584e4; font-weight: bold; font-size: 11px;")), a;
|
|
1693
|
+
}
|
|
1694
|
+
//#endregion
|
|
1695
|
+
//#region src/framework/seo.ts
|
|
1696
|
+
var Y = class {
|
|
1697
|
+
defaultSiteName = "Purity";
|
|
1698
|
+
currentConfig = {};
|
|
1699
|
+
setTitle(e, t) {
|
|
1700
|
+
if (typeof document > "u") return;
|
|
1701
|
+
let n = t?.separator || " - ", r = e;
|
|
1702
|
+
t?.prefix && (r = `${t.prefix}${n}${r}`), t?.suffix && (r = `${r}${n}${t.suffix}`), document.title = r, this.updateTag({
|
|
1703
|
+
name: "title",
|
|
1704
|
+
content: r
|
|
1705
|
+
}), this.updateTag({
|
|
1706
|
+
property: "og:title",
|
|
1707
|
+
content: r
|
|
1708
|
+
}), this.updateTag({
|
|
1709
|
+
name: "twitter:title",
|
|
1710
|
+
content: r
|
|
1711
|
+
}), this.currentConfig.title = r;
|
|
1712
|
+
}
|
|
1713
|
+
getTitle() {
|
|
1714
|
+
return typeof document < "u" ? document.title : "";
|
|
1715
|
+
}
|
|
1716
|
+
setDescription(e) {
|
|
1717
|
+
this.updateTag({
|
|
1718
|
+
name: "description",
|
|
1719
|
+
content: e
|
|
1720
|
+
}), this.updateTag({
|
|
1721
|
+
property: "og:description",
|
|
1722
|
+
content: e
|
|
1723
|
+
}), this.updateTag({
|
|
1724
|
+
name: "twitter:description",
|
|
1725
|
+
content: e
|
|
1726
|
+
}), this.currentConfig.description = e;
|
|
1727
|
+
}
|
|
1728
|
+
setKeywords(e) {
|
|
1729
|
+
let t = Array.isArray(e) ? e.join(", ") : e;
|
|
1730
|
+
this.updateTag({
|
|
1731
|
+
name: "keywords",
|
|
1732
|
+
content: t
|
|
1733
|
+
}), this.currentConfig.keywords = t;
|
|
1734
|
+
}
|
|
1735
|
+
setCanonicalUrl(e) {
|
|
1736
|
+
if (typeof document > "u") return;
|
|
1737
|
+
let t = document.querySelector("link[rel=\"canonical\"]");
|
|
1738
|
+
t || (t = document.createElement("link"), t.setAttribute("rel", "canonical"), document.head.appendChild(t)), t.setAttribute("href", e), this.updateTag({
|
|
1739
|
+
property: "og:url",
|
|
1740
|
+
content: e
|
|
1741
|
+
}), this.updateTag({
|
|
1742
|
+
name: "twitter:url",
|
|
1743
|
+
content: e
|
|
1744
|
+
}), this.currentConfig.canonical = e;
|
|
1745
|
+
}
|
|
1746
|
+
setRobots(e) {
|
|
1747
|
+
if (typeof e == "string") {
|
|
1748
|
+
this.updateTag({
|
|
1749
|
+
name: "robots",
|
|
1750
|
+
content: e
|
|
1751
|
+
}), this.currentConfig.robots = e;
|
|
1752
|
+
return;
|
|
1753
|
+
}
|
|
1754
|
+
let t = [];
|
|
1755
|
+
t.push(e.index === !1 ? "noindex" : "index"), t.push(e.follow === !1 ? "nofollow" : "follow"), e.noarchive && t.push("noarchive"), e.nosnippet && t.push("nosnippet"), e.maxSnippet !== void 0 && t.push(`max-snippet:${e.maxSnippet}`), e.maxImagePreview && t.push(`max-image-preview:${e.maxImagePreview}`), e.maxVideoPreview !== void 0 && t.push(`max-video-preview:${e.maxVideoPreview}`);
|
|
1756
|
+
let n = t.join(", ");
|
|
1757
|
+
this.updateTag({
|
|
1758
|
+
name: "robots",
|
|
1759
|
+
content: n
|
|
1760
|
+
}), this.currentConfig.robots = e;
|
|
1761
|
+
}
|
|
1762
|
+
setOpenGraph(e) {
|
|
1763
|
+
e.title && this.updateTag({
|
|
1764
|
+
property: "og:title",
|
|
1765
|
+
content: e.title
|
|
1766
|
+
}), e.description && this.updateTag({
|
|
1767
|
+
property: "og:description",
|
|
1768
|
+
content: e.description
|
|
1769
|
+
}), e.url && this.updateTag({
|
|
1770
|
+
property: "og:url",
|
|
1771
|
+
content: e.url
|
|
1772
|
+
}), e.type && this.updateTag({
|
|
1773
|
+
property: "og:type",
|
|
1774
|
+
content: e.type || "website"
|
|
1775
|
+
}), e.siteName && this.updateTag({
|
|
1776
|
+
property: "og:site_name",
|
|
1777
|
+
content: e.siteName || this.defaultSiteName
|
|
1778
|
+
}), e.locale && this.updateTag({
|
|
1779
|
+
property: "og:locale",
|
|
1780
|
+
content: e.locale || "en_US"
|
|
1781
|
+
}), e.image && (this.updateTag({
|
|
1782
|
+
property: "og:image",
|
|
1783
|
+
content: e.image
|
|
1784
|
+
}), (e.imageSecureUrl || e.image.startsWith("https://")) && this.updateTag({
|
|
1785
|
+
property: "og:image:secure_url",
|
|
1786
|
+
content: e.imageSecureUrl || e.image
|
|
1787
|
+
}), e.imageType && this.updateTag({
|
|
1788
|
+
property: "og:image:type",
|
|
1789
|
+
content: e.imageType
|
|
1790
|
+
}), e.imageWidth && this.updateTag({
|
|
1791
|
+
property: "og:image:width",
|
|
1792
|
+
content: String(e.imageWidth)
|
|
1793
|
+
}), e.imageHeight && this.updateTag({
|
|
1794
|
+
property: "og:image:height",
|
|
1795
|
+
content: String(e.imageHeight)
|
|
1796
|
+
}), e.imageAlt && this.updateTag({
|
|
1797
|
+
property: "og:image:alt",
|
|
1798
|
+
content: e.imageAlt
|
|
1799
|
+
}));
|
|
1800
|
+
for (let [t, n] of Object.entries(e)) if (![
|
|
1801
|
+
"title",
|
|
1802
|
+
"description",
|
|
1803
|
+
"url",
|
|
1804
|
+
"type",
|
|
1805
|
+
"siteName",
|
|
1806
|
+
"locale",
|
|
1807
|
+
"image",
|
|
1808
|
+
"imageSecureUrl",
|
|
1809
|
+
"imageType",
|
|
1810
|
+
"imageWidth",
|
|
1811
|
+
"imageHeight",
|
|
1812
|
+
"imageAlt"
|
|
1813
|
+
].includes(t) && n !== void 0) {
|
|
1814
|
+
let e = t.startsWith("og:") ? t : `og:${t}`;
|
|
1815
|
+
this.updateTag({
|
|
1816
|
+
property: e,
|
|
1817
|
+
content: String(n)
|
|
1818
|
+
});
|
|
1819
|
+
}
|
|
1820
|
+
this.currentConfig.og = {
|
|
1821
|
+
...this.currentConfig.og,
|
|
1822
|
+
...e
|
|
1823
|
+
};
|
|
1824
|
+
}
|
|
1825
|
+
setTwitterCard(e) {
|
|
1826
|
+
this.updateTag({
|
|
1827
|
+
name: "twitter:card",
|
|
1828
|
+
content: e.card || "summary"
|
|
1829
|
+
}), e.site && this.updateTag({
|
|
1830
|
+
name: "twitter:site",
|
|
1831
|
+
content: e.site
|
|
1832
|
+
}), e.creator && this.updateTag({
|
|
1833
|
+
name: "twitter:creator",
|
|
1834
|
+
content: e.creator
|
|
1835
|
+
}), e.title && this.updateTag({
|
|
1836
|
+
name: "twitter:title",
|
|
1837
|
+
content: e.title
|
|
1838
|
+
}), e.description && this.updateTag({
|
|
1839
|
+
name: "twitter:description",
|
|
1840
|
+
content: e.description
|
|
1841
|
+
}), e.image && this.updateTag({
|
|
1842
|
+
name: "twitter:image",
|
|
1843
|
+
content: e.image
|
|
1844
|
+
}), e.imageAlt && this.updateTag({
|
|
1845
|
+
name: "twitter:image:alt",
|
|
1846
|
+
content: e.imageAlt
|
|
1847
|
+
});
|
|
1848
|
+
for (let [t, n] of Object.entries(e)) if (![
|
|
1849
|
+
"card",
|
|
1850
|
+
"site",
|
|
1851
|
+
"creator",
|
|
1852
|
+
"title",
|
|
1853
|
+
"description",
|
|
1854
|
+
"image",
|
|
1855
|
+
"imageAlt"
|
|
1856
|
+
].includes(t) && n !== void 0) {
|
|
1857
|
+
let e = t.startsWith("twitter:") ? t : `twitter:${t}`;
|
|
1858
|
+
this.updateTag({
|
|
1859
|
+
name: e,
|
|
1860
|
+
content: String(n)
|
|
1861
|
+
});
|
|
1862
|
+
}
|
|
1863
|
+
this.currentConfig.twitter = {
|
|
1864
|
+
...this.currentConfig.twitter,
|
|
1865
|
+
...e
|
|
1866
|
+
};
|
|
1867
|
+
}
|
|
1868
|
+
setJsonLd(e, t = "purity-jsonld-schema") {
|
|
1869
|
+
if (typeof document > "u") return;
|
|
1870
|
+
let n = document.getElementById(t);
|
|
1871
|
+
n || (n = document.createElement("script"), n.type = "application/ld+json", n.id = t, document.head.appendChild(n)), n.textContent = JSON.stringify(e, null, 2), this.currentConfig.jsonLd = e;
|
|
1872
|
+
}
|
|
1873
|
+
updateTag(e) {
|
|
1874
|
+
if (typeof document > "u") return null;
|
|
1875
|
+
let t = this.buildTagSelector(e), n = t ? document.querySelector(t) : null;
|
|
1876
|
+
n || (n = document.createElement("meta"), document.head.appendChild(n));
|
|
1877
|
+
for (let [t, r] of Object.entries(e)) r != null && n.setAttribute(t, String(r));
|
|
1878
|
+
return n;
|
|
1879
|
+
}
|
|
1880
|
+
getTag(e) {
|
|
1881
|
+
if (typeof document > "u") return null;
|
|
1882
|
+
let t = e.startsWith("meta[") ? e : `meta[${e}]`;
|
|
1883
|
+
return document.querySelector(t);
|
|
1884
|
+
}
|
|
1885
|
+
removeTag(e) {
|
|
1886
|
+
if (typeof document > "u") return;
|
|
1887
|
+
let t = e.startsWith("meta[") ? e : `meta[${e}]`, n = document.querySelector(t);
|
|
1888
|
+
n && n.parentNode && n.parentNode.removeChild(n);
|
|
1889
|
+
}
|
|
1890
|
+
setSeo(e) {
|
|
1891
|
+
if (e.title && this.setTitle(e.title, {
|
|
1892
|
+
prefix: e.titlePrefix,
|
|
1893
|
+
suffix: e.titleSuffix
|
|
1894
|
+
}), e.description && this.setDescription(e.description), e.keywords && this.setKeywords(e.keywords), e.author && this.updateTag({
|
|
1895
|
+
name: "author",
|
|
1896
|
+
content: e.author
|
|
1897
|
+
}), e.canonical && this.setCanonicalUrl(e.canonical), e.robots && this.setRobots(e.robots), e.og && this.setOpenGraph(e.og), e.twitter && this.setTwitterCard(e.twitter), e.jsonLd && this.setJsonLd(e.jsonLd), e.metaTags && Array.isArray(e.metaTags)) for (let t of e.metaTags) this.updateTag(t);
|
|
1898
|
+
}
|
|
1899
|
+
getSeo() {
|
|
1900
|
+
return { ...this.currentConfig };
|
|
1901
|
+
}
|
|
1902
|
+
buildTagSelector(e) {
|
|
1903
|
+
return e.name ? `meta[name="${e.name}"]` : e.property ? `meta[property="${e.property}"]` : e.httpEquiv ? `meta[http-equiv="${e.httpEquiv}"]` : null;
|
|
1904
|
+
}
|
|
1905
|
+
}, ze = class extends Y {};
|
|
1906
|
+
z("SeoService")(Y), z("MetaService")(ze);
|
|
1907
|
+
//#endregion
|
|
1908
|
+
//#region src/framework/core.ts
|
|
1909
|
+
var X = [], Z = (e) => {
|
|
1910
|
+
let t = e, n = /* @__PURE__ */ new Set(), r = (() => {
|
|
1911
|
+
let e = X[X.length - 1];
|
|
1912
|
+
return e && n.add(e), t;
|
|
1913
|
+
});
|
|
1914
|
+
return r.set = (e) => {
|
|
1915
|
+
Object.is(t, e) || (t = e, n.forEach((e) => e()));
|
|
1916
|
+
}, r.update = (e) => {
|
|
1917
|
+
r.set(e(t));
|
|
1918
|
+
}, r;
|
|
1919
|
+
}, Q = (e) => {
|
|
1920
|
+
let t = !0, n = () => {
|
|
1921
|
+
if (t) {
|
|
1922
|
+
X.push(n);
|
|
1923
|
+
try {
|
|
1924
|
+
e();
|
|
1925
|
+
} finally {
|
|
1926
|
+
X.pop();
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
};
|
|
1930
|
+
return n(), () => {
|
|
1931
|
+
t = !1;
|
|
1932
|
+
};
|
|
1933
|
+
}, $ = (e) => {
|
|
1934
|
+
let t = [...X];
|
|
1935
|
+
X.length = 0;
|
|
1936
|
+
try {
|
|
1937
|
+
return e();
|
|
1938
|
+
} finally {
|
|
1939
|
+
for (let e of t) X.push(e);
|
|
1940
|
+
}
|
|
1941
|
+
}, Be = (e) => {
|
|
1942
|
+
let t = Z(void 0);
|
|
1943
|
+
return Q(() => {
|
|
1944
|
+
t.set(e());
|
|
1945
|
+
}), (() => t());
|
|
1946
|
+
}, Ve = (e, t, n = "") => {
|
|
1947
|
+
e && e.forEach((e) => {
|
|
1948
|
+
e.innerHTML = t ?? n;
|
|
1949
|
+
});
|
|
1950
|
+
}, He = (e, t) => {
|
|
1951
|
+
e && e.forEach((e) => {
|
|
1952
|
+
e.className = t;
|
|
1953
|
+
});
|
|
1954
|
+
}, Ue = (e, t, n = "") => {
|
|
1955
|
+
e && e.forEach((e) => {
|
|
1956
|
+
e.value = t ?? n;
|
|
1957
|
+
});
|
|
1958
|
+
}, We = (e, t, n) => (e && e.forEach((e) => {
|
|
1959
|
+
e.addEventListener(t, n);
|
|
1960
|
+
}), { dispose: () => {
|
|
1961
|
+
e && e.forEach((e) => {
|
|
1962
|
+
e.removeEventListener(t, n);
|
|
1963
|
+
});
|
|
1964
|
+
} }), Ge = (e, t) => (t || document).querySelector(e), Ke = (e, t) => {
|
|
1965
|
+
let n = /* @__PURE__ */ new Map(), r = t || document;
|
|
1966
|
+
return Object.entries(e).forEach(([e, t]) => {
|
|
1967
|
+
let i = r.querySelector(t);
|
|
1968
|
+
i && n.set(e, i);
|
|
1969
|
+
}), n;
|
|
1970
|
+
};
|
|
1971
|
+
//#endregion
|
|
1972
|
+
export { r as BaseDirective, u as BasePipe, a as BaseValidator, _e as ChildView, me as Component, n as Directive, Fe as ENVIRONMENT_TOKEN, U as HTTP_INTERCEPTORS, q as HttpClient, H as HttpErrorResponse, Te as HttpFetchBackend, B as HttpHeaders, V as HttpParams, Se as HttpRequest, Ce as HttpResponse, z as Injectable, ze as MetaService, p as Pipe, Me as Router, Ne as RouterLayoutComponent, Pe as RouterLinkDirective, Y as SeoService, ye as Service, s as Validator, he as ViewChild, i as bindDirectives, l as bindValidators, b as bindVirtualFor, Re as bootstrapApplication, C as componentRegistry, Be as computed, R as container, ce as createComponentContext, ve as defineComponent, e as directiveRegistry, Q as effect, We as eventListener, g as executePipe, Le as getApplicationRef, Ge as getElement, Ke as getElements, k as getElseIfAttribute, M as getForAttribute, O as getIfAttribute, h as getPipe, v as getVirtualForAttribute, A as hasElseAttribute, N as hasForAttribute, y as hasVirtualForAttribute, be as inject, D as isInsideNestedComponent, j as isStructuralConditional, je as matchRoutePattern, se as mountComponentOnElement, t as normalizeDirectiveSelector, J as normalizePath, ke as parseQueryString, te as parseVirtualForExpression, we as provideHttpInterceptors, m as registerPipe, xe as registerValue, ee as removeVirtualForAttributes, Ae as serializeQueryParams, Z as signal, De as startLoadingCursor, Oe as stopLoadingCursor, w as transformPipeExpression, $ as untrack, He as updateStyles, Ve as updateTargets, Ue as updateValues, o as validatorRegistry };
|