@wsxjs/wsx-router 0.0.18 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,475 +1,277 @@
1
- import { autoRegister as we, LightComponent as oe, jsx as ae, WebComponent as Re } from "@wsxjs/wsx-core";
2
- function Ge(t) {
3
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
1
+ import { autoRegister as ce, LightComponent as re, jsx as te, WebComponent as le } from "@wsxjs/wsx-core";
2
+ var We = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
3
+ function Ae(n) {
4
+ return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
4
5
  }
5
- var ue = { exports: {} };
6
- function Xe(t) {
7
- try {
8
- return JSON.stringify(t);
9
- } catch {
10
- return '"[Circular]"';
11
- }
12
- }
13
- var Ye = Ze;
14
- function Ze(t, e, n) {
15
- var r = n && n.stringify || Xe, s = 1;
16
- if (typeof t == "object" && t !== null) {
17
- var l = e.length + s;
18
- if (l === 1) return t;
19
- var m = new Array(l);
20
- m[0] = r(t);
21
- for (var g = 1; g < l; g++)
22
- m[g] = r(e[g]);
23
- return m.join(" ");
24
- }
25
- if (typeof t != "string")
26
- return t;
27
- var u = e.length;
28
- if (u === 0) return t;
29
- for (var i = "", p = 1 - s, v = -1, z = t && t.length || 0, x = 0; x < z; ) {
30
- if (t.charCodeAt(x) === 37 && x + 1 < z) {
31
- switch (v = v > -1 ? v : 0, t.charCodeAt(x + 1)) {
32
- case 100:
33
- // 'd'
34
- case 102:
35
- if (p >= u || e[p] == null) break;
36
- v < x && (i += t.slice(v, x)), i += Number(e[p]), v = x + 2, x++;
37
- break;
38
- case 105:
39
- if (p >= u || e[p] == null) break;
40
- v < x && (i += t.slice(v, x)), i += Math.floor(Number(e[p])), v = x + 2, x++;
41
- break;
42
- case 79:
43
- // 'O'
44
- case 111:
45
- // 'o'
46
- case 106:
47
- if (p >= u || e[p] === void 0) break;
48
- v < x && (i += t.slice(v, x));
49
- var o = typeof e[p];
50
- if (o === "string") {
51
- i += "'" + e[p] + "'", v = x + 2, x++;
52
- break;
53
- }
54
- if (o === "function") {
55
- i += e[p].name || "<anonymous>", v = x + 2, x++;
56
- break;
57
- }
58
- i += r(e[p]), v = x + 2, x++;
59
- break;
60
- case 115:
61
- if (p >= u)
62
- break;
63
- v < x && (i += t.slice(v, x)), i += String(e[p]), v = x + 2, x++;
64
- break;
65
- case 37:
66
- v < x && (i += t.slice(v, x)), i += "%", v = x + 2, x++, p--;
67
- break;
6
+ var ye = { exports: {} };
7
+ (function(n) {
8
+ (function(e, t) {
9
+ n.exports ? n.exports = t() : e.log = t();
10
+ })(We, function() {
11
+ var e = function() {
12
+ }, t = "undefined", r = typeof window !== t && typeof window.navigator !== t && /Trident\/|MSIE /.test(window.navigator.userAgent), g = [
13
+ "trace",
14
+ "debug",
15
+ "info",
16
+ "warn",
17
+ "error"
18
+ ], v = {}, f = null;
19
+ function _(o, c) {
20
+ var i = o[c];
21
+ if (typeof i.bind == "function")
22
+ return i.bind(o);
23
+ try {
24
+ return Function.prototype.bind.call(i, o);
25
+ } catch {
26
+ return function() {
27
+ return Function.prototype.apply.apply(i, [o, arguments]);
28
+ };
68
29
  }
69
- ++p;
70
30
  }
71
- ++x;
72
- }
73
- return v === -1 ? t : (v < z && (i += t.slice(v)), i);
74
- }
75
- const Le = Ye;
76
- ue.exports = K;
77
- const re = mt().console || {}, et = {
78
- mapHttpRequest: ie,
79
- mapHttpResponse: ie,
80
- wrapRequestSerializer: fe,
81
- wrapResponseSerializer: fe,
82
- wrapErrorSerializer: fe,
83
- req: ie,
84
- res: ie,
85
- err: _e,
86
- errWithCause: _e
87
- };
88
- function Y(t, e) {
89
- return t === "silent" ? 1 / 0 : e.levels.values[t];
90
- }
91
- const xe = Symbol("pino.logFuncs"), be = Symbol("pino.hierarchy"), tt = {
92
- error: "log",
93
- fatal: "error",
94
- warn: "error",
95
- info: "log",
96
- debug: "log",
97
- trace: "log"
98
- };
99
- function ke(t, e) {
100
- const n = {
101
- logger: e,
102
- parent: t[be]
103
- };
104
- e[be] = n;
105
- }
106
- function nt(t, e, n) {
107
- const r = {};
108
- e.forEach((s) => {
109
- r[s] = n[s] ? n[s] : re[s] || re[tt[s] || "log"] || ne;
110
- }), t[xe] = r;
111
- }
112
- function rt(t, e) {
113
- return Array.isArray(t) ? t.filter(function(r) {
114
- return r !== "!stdSerializers.err";
115
- }) : t === !0 ? Object.keys(e) : !1;
116
- }
117
- function K(t) {
118
- t = t || {}, t.browser = t.browser || {};
119
- const e = t.browser.transmit;
120
- if (e && typeof e.send != "function")
121
- throw Error("pino: transmit option must have a send function");
122
- const n = t.browser.write || re;
123
- t.browser.write && (t.browser.asObject = !0);
124
- const r = t.serializers || {}, s = rt(t.browser.serialize, r);
125
- let l = t.browser.serialize;
126
- Array.isArray(t.browser.serialize) && t.browser.serialize.indexOf("!stdSerializers.err") > -1 && (l = !1);
127
- const m = Object.keys(t.customLevels || {}), g = ["error", "fatal", "warn", "info", "debug", "trace"].concat(m);
128
- typeof n == "function" && g.forEach(function(c) {
129
- n[c] = n;
130
- }), (t.enabled === !1 || t.browser.disabled) && (t.level = "silent");
131
- const u = t.level || "info", i = Object.create(n);
132
- i.log || (i.log = ne), nt(i, g, n), ke({}, i), Object.defineProperty(i, "levelVal", {
133
- get: v
134
- }), Object.defineProperty(i, "level", {
135
- get: z,
136
- set: x
137
- });
138
- const p = {
139
- transmit: e,
140
- serialize: s,
141
- asObject: t.browser.asObject,
142
- asObjectBindingsOnly: t.browser.asObjectBindingsOnly,
143
- formatters: t.browser.formatters,
144
- levels: g,
145
- timestamp: ht(t),
146
- messageKey: t.messageKey || "msg",
147
- onChild: t.onChild || ne
148
- };
149
- i.levels = it(t), i.level = u, i.isLevelEnabled = function(c) {
150
- return this.levels.values[c] ? this.levels.values[c] >= this.levels.values[this.level] : !1;
151
- }, i.setMaxListeners = i.getMaxListeners = i.emit = i.addListener = i.on = i.prependListener = i.once = i.prependOnceListener = i.removeListener = i.removeAllListeners = i.listeners = i.listenerCount = i.eventNames = i.write = i.flush = ne, i.serializers = r, i._serialize = s, i._stdErrSerialize = l, i.child = function(...c) {
152
- return o.call(this, p, ...c);
153
- }, e && (i._logEvent = ye());
154
- function v() {
155
- return Y(this.level, this);
156
- }
157
- function z() {
158
- return this._level;
159
- }
160
- function x(c) {
161
- if (c !== "silent" && !this.levels.values[c])
162
- throw Error("unknown level " + c);
163
- this._level = c, Z(this, p, i, "error"), Z(this, p, i, "fatal"), Z(this, p, i, "warn"), Z(this, p, i, "info"), Z(this, p, i, "debug"), Z(this, p, i, "trace"), m.forEach((f) => {
164
- Z(this, p, i, f);
165
- });
166
- }
167
- function o(c, f, h) {
168
- if (!f)
169
- throw new Error("missing bindings for child Pino");
170
- h = h || {}, s && f.serializers && (h.serializers = f.serializers);
171
- const d = h.serializers;
172
- if (s && d) {
173
- var T = Object.assign({}, r, d), V = t.browser.serialize === !0 ? Object.keys(T) : s;
174
- delete f.serializers, Ee([f], V, T, this._stdErrSerialize);
31
+ function b() {
32
+ console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
175
33
  }
176
- function A(_) {
177
- this._childLevel = (_._childLevel | 0) + 1, this.bindings = f, T && (this.serializers = T, this._serialize = V), e && (this._logEvent = ye(
178
- [].concat(_._logEvent.bindings, f)
179
- ));
34
+ function T(o) {
35
+ return o === "debug" && (o = "log"), typeof console === t ? !1 : o === "trace" && r ? b : console[o] !== void 0 ? _(console, o) : console.log !== void 0 ? _(console, "log") : e;
180
36
  }
181
- A.prototype = this;
182
- const I = new A(this);
183
- return ke(this, I), I.child = function(..._) {
184
- return o.call(this, c, ..._);
185
- }, I.level = h.level || this.level, c.onChild(I), I;
186
- }
187
- return i;
188
- }
189
- function it(t) {
190
- const e = t.customLevels || {}, n = Object.assign({}, K.levels.values, e), r = Object.assign({}, K.levels.labels, st(e));
191
- return {
192
- values: n,
193
- labels: r
194
- };
195
- }
196
- function st(t) {
197
- const e = {};
198
- return Object.keys(t).forEach(function(n) {
199
- e[t[n]] = n;
200
- }), e;
201
- }
202
- K.levels = {
203
- values: {
204
- fatal: 60,
205
- error: 50,
206
- warn: 40,
207
- info: 30,
208
- debug: 20,
209
- trace: 10
210
- },
211
- labels: {
212
- 10: "trace",
213
- 20: "debug",
214
- 30: "info",
215
- 40: "warn",
216
- 50: "error",
217
- 60: "fatal"
218
- }
219
- };
220
- K.stdSerializers = et;
221
- K.stdTimeFunctions = Object.assign({}, { nullTime: De, epochTime: Me, unixTime: ft, isoTime: dt });
222
- function ot(t) {
223
- const e = [];
224
- t.bindings && e.push(t.bindings);
225
- let n = t[be];
226
- for (; n.parent; )
227
- n = n.parent, n.logger.bindings && e.push(n.logger.bindings);
228
- return e.reverse();
229
- }
230
- function Z(t, e, n, r) {
231
- if (Object.defineProperty(t, r, {
232
- value: Y(t.level, n) > Y(r, n) ? ne : n[xe][r],
233
- writable: !0,
234
- enumerable: !0,
235
- configurable: !0
236
- }), t[r] === ne) {
237
- if (!e.transmit) return;
238
- const l = e.transmit.level || t.level, m = Y(l, n);
239
- if (Y(r, n) < m) return;
240
- }
241
- t[r] = ct(t, e, n, r);
242
- const s = ot(t);
243
- s.length !== 0 && (t[r] = at(s, t[r]));
244
- }
245
- function at(t, e) {
246
- return function() {
247
- return e.apply(this, [...t, ...arguments]);
248
- };
249
- }
250
- function ct(t, e, n, r) {
251
- return /* @__PURE__ */ function(s) {
252
- return function() {
253
- const m = e.timestamp(), g = new Array(arguments.length), u = Object.getPrototypeOf && Object.getPrototypeOf(this) === re ? re : this;
254
- for (var i = 0; i < g.length; i++) g[i] = arguments[i];
255
- var p = !1;
256
- if (e.serialize && (Ee(g, this._serialize, this.serializers, this._stdErrSerialize), p = !0), e.asObject || e.formatters ? s.call(u, ...lt(this, r, g, m, e)) : s.apply(u, g), e.transmit) {
257
- const v = e.transmit.level || t._level, z = Y(v, n), x = Y(r, n);
258
- if (x < z) return;
259
- ut(this, {
260
- ts: m,
261
- methodLevel: r,
262
- methodValue: x,
263
- transmitValue: n.levels.values[e.transmit.level || t._level],
264
- send: e.transmit.send,
265
- val: Y(t._level, n)
266
- }, g, p);
37
+ function O() {
38
+ for (var o = this.getLevel(), c = 0; c < g.length; c++) {
39
+ var i = g[c];
40
+ this[i] = c < o ? e : this.methodFactory(i, o, this.name);
267
41
  }
42
+ if (this.log = this.debug, typeof console === t && o < this.levels.SILENT)
43
+ return "No console available for logging";
44
+ }
45
+ function V(o) {
46
+ return function() {
47
+ typeof console !== t && (O.call(this), this[o].apply(this, arguments));
48
+ };
49
+ }
50
+ function D(o, c, i) {
51
+ return T(o) || V.apply(this, arguments);
52
+ }
53
+ function H(o, c) {
54
+ var i = this, u, A, k, R = "loglevel";
55
+ typeof o == "string" ? R += ":" + o : typeof o == "symbol" && (R = void 0);
56
+ function P(h) {
57
+ var l = (g[h] || "silent").toUpperCase();
58
+ if (!(typeof window === t || !R)) {
59
+ try {
60
+ window.localStorage[R] = l;
61
+ return;
62
+ } catch {
63
+ }
64
+ try {
65
+ window.document.cookie = encodeURIComponent(R) + "=" + l + ";";
66
+ } catch {
67
+ }
68
+ }
69
+ }
70
+ function E() {
71
+ var h;
72
+ if (!(typeof window === t || !R)) {
73
+ try {
74
+ h = window.localStorage[R];
75
+ } catch {
76
+ }
77
+ if (typeof h === t)
78
+ try {
79
+ var l = window.document.cookie, x = encodeURIComponent(R), C = l.indexOf(x + "=");
80
+ C !== -1 && (h = /^([^;]+)/.exec(
81
+ l.slice(C + x.length + 1)
82
+ )[1]);
83
+ } catch {
84
+ }
85
+ return i.levels[h] === void 0 && (h = void 0), h;
86
+ }
87
+ }
88
+ function L() {
89
+ if (!(typeof window === t || !R)) {
90
+ try {
91
+ window.localStorage.removeItem(R);
92
+ } catch {
93
+ }
94
+ try {
95
+ window.document.cookie = encodeURIComponent(R) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
96
+ } catch {
97
+ }
98
+ }
99
+ }
100
+ function p(h) {
101
+ var l = h;
102
+ if (typeof l == "string" && i.levels[l.toUpperCase()] !== void 0 && (l = i.levels[l.toUpperCase()]), typeof l == "number" && l >= 0 && l <= i.levels.SILENT)
103
+ return l;
104
+ throw new TypeError("log.setLevel() called with invalid level: " + h);
105
+ }
106
+ i.name = o, i.levels = {
107
+ TRACE: 0,
108
+ DEBUG: 1,
109
+ INFO: 2,
110
+ WARN: 3,
111
+ ERROR: 4,
112
+ SILENT: 5
113
+ }, i.methodFactory = c || D, i.getLevel = function() {
114
+ return k ?? A ?? u;
115
+ }, i.setLevel = function(h, l) {
116
+ return k = p(h), l !== !1 && P(k), O.call(i);
117
+ }, i.setDefaultLevel = function(h) {
118
+ A = p(h), E() || i.setLevel(h, !1);
119
+ }, i.resetLevel = function() {
120
+ k = null, L(), O.call(i);
121
+ }, i.enableAll = function(h) {
122
+ i.setLevel(i.levels.TRACE, h);
123
+ }, i.disableAll = function(h) {
124
+ i.setLevel(i.levels.SILENT, h);
125
+ }, i.rebuild = function() {
126
+ if (f !== i && (u = p(f.getLevel())), O.call(i), f === i)
127
+ for (var h in v)
128
+ v[h].rebuild();
129
+ }, u = p(
130
+ f ? f.getLevel() : "WARN"
131
+ );
132
+ var m = E();
133
+ m != null && (k = p(m)), O.call(i);
134
+ }
135
+ f = new H(), f.getLogger = function(c) {
136
+ if (typeof c != "symbol" && typeof c != "string" || c === "")
137
+ throw new TypeError("You must supply a name when creating a logger.");
138
+ var i = v[c];
139
+ return i || (i = v[c] = new H(
140
+ c,
141
+ f.methodFactory
142
+ )), i;
268
143
  };
269
- }(t[xe][r]);
270
- }
271
- function lt(t, e, n, r, s) {
272
- const {
273
- level: l,
274
- log: m = (v) => v
275
- } = s.formatters || {}, g = n.slice();
276
- let u = g[0];
277
- const i = {};
278
- let p = (t._childLevel | 0) + 1;
279
- if (p < 1 && (p = 1), r && (i.time = r), l) {
280
- const v = l(e, t.levels.values[e]);
281
- Object.assign(i, v);
282
- } else
283
- i.level = t.levels.values[e];
284
- if (s.asObjectBindingsOnly) {
285
- if (u !== null && typeof u == "object")
286
- for (; p-- && typeof g[0] == "object"; )
287
- Object.assign(i, g.shift());
288
- return [m(i), ...g];
289
- } else {
290
- if (u !== null && typeof u == "object") {
291
- for (; p-- && typeof g[0] == "object"; )
292
- Object.assign(i, g.shift());
293
- u = g.length ? Le(g.shift(), g) : void 0;
294
- } else typeof u == "string" && (u = Le(g.shift(), g));
295
- return u !== void 0 && (i[s.messageKey] = u), [m(i)];
296
- }
297
- }
298
- function Ee(t, e, n, r) {
299
- for (const s in t)
300
- if (r && t[s] instanceof Error)
301
- t[s] = K.stdSerializers.err(t[s]);
302
- else if (typeof t[s] == "object" && !Array.isArray(t[s]) && e)
303
- for (const l in t[s])
304
- e.indexOf(l) > -1 && l in n && (t[s][l] = n[l](t[s][l]));
305
- }
306
- function ut(t, e, n, r = !1) {
307
- const s = e.send, l = e.ts, m = e.methodLevel, g = e.methodValue, u = e.val, i = t._logEvent.bindings;
308
- r || Ee(
309
- n,
310
- t._serialize || Object.keys(t.serializers),
311
- t.serializers,
312
- t._stdErrSerialize === void 0 ? !0 : t._stdErrSerialize
313
- ), t._logEvent.ts = l, t._logEvent.messages = n.filter(function(p) {
314
- return i.indexOf(p) === -1;
315
- }), t._logEvent.level.label = m, t._logEvent.level.value = g, s(m, t._logEvent, u), t._logEvent = ye(i);
316
- }
317
- function ye(t) {
318
- return {
319
- ts: 0,
320
- messages: [],
321
- bindings: t || [],
322
- level: { label: "", value: 0 }
323
- };
324
- }
325
- function _e(t) {
326
- const e = {
327
- type: t.constructor.name,
328
- msg: t.message,
329
- stack: t.stack
330
- };
331
- for (const n in t)
332
- e[n] === void 0 && (e[n] = t[n]);
333
- return e;
334
- }
335
- function ht(t) {
336
- return typeof t.timestamp == "function" ? t.timestamp : t.timestamp === !1 ? De : Me;
337
- }
338
- function ie() {
339
- return {};
340
- }
341
- function fe(t) {
342
- return t;
343
- }
344
- function ne() {
345
- }
346
- function De() {
347
- return !1;
348
- }
349
- function Me() {
350
- return Date.now();
351
- }
352
- function ft() {
353
- return Math.round(Date.now() / 1e3);
354
- }
355
- function dt() {
356
- return new Date(Date.now()).toISOString();
357
- }
358
- function mt() {
359
- function t(e) {
360
- return typeof e < "u" && e;
361
- }
144
+ var s = typeof window !== t ? window.log : void 0;
145
+ return f.noConflict = function() {
146
+ return typeof window !== t && window.log === f && (window.log = s), f;
147
+ }, f.getLoggers = function() {
148
+ return v;
149
+ }, f.default = f, f;
150
+ });
151
+ })(ye);
152
+ var Te = ye.exports;
153
+ const Oe = /* @__PURE__ */ Ae(Te), be = {
154
+ trace: "trace",
155
+ debug: "debug",
156
+ info: "info",
157
+ warn: "warn",
158
+ error: "error",
159
+ silent: "silent"
160
+ }, je = {
161
+ 0: "trace",
162
+ 1: "debug",
163
+ 2: "info",
164
+ 3: "warn",
165
+ 4: "error",
166
+ 5: "silent"
167
+ };
168
+ function ae() {
169
+ var n, e;
170
+ if (typeof process < "u")
171
+ return process.env.NODE_ENV === "production" || process.env.MODE === "production";
362
172
  try {
363
- return typeof globalThis < "u" || Object.defineProperty(Object.prototype, "globalThis", {
364
- get: function() {
365
- return delete Object.prototype.globalThis, this.globalThis = this;
366
- },
367
- configurable: !0
368
- }), globalThis;
173
+ const t = globalThis;
174
+ if ((e = (n = t.import) == null ? void 0 : n.meta) != null && e.env) {
175
+ const r = t.import.meta.env;
176
+ return r.MODE === "production" || r.PROD === !0;
177
+ }
369
178
  } catch {
370
- return t(self) || t(window) || t(this) || {};
371
179
  }
180
+ return !1;
372
181
  }
373
- ue.exports.default = K;
374
- ue.exports.pino = K;
375
- var gt = ue.exports;
376
- const se = /* @__PURE__ */ Ge(gt);
377
- function ce() {
378
- return typeof process < "u" && process.env.NODE_ENV === "production";
379
- }
380
- function pt() {
381
- var t;
382
- return typeof process < "u" && ((t = process.versions) == null ? void 0 : t.node) !== void 0;
383
- }
384
- function vt() {
385
- return typeof window < "u" && typeof document < "u";
386
- }
387
- const de = {
182
+ const ee = {
388
183
  name: "WSX",
389
- level: ce() ? "info" : "debug",
390
- pretty: !ce()
184
+ level: ae() ? "info" : "debug",
185
+ pretty: !ae()
391
186
  };
392
- function bt(t = {}) {
393
- const { name: e, level: n, pretty: r, pinoOptions: s } = { ...de, ...t }, l = {
394
- name: e || de.name,
395
- level: n || de.level,
396
- ...s
397
- };
398
- if (vt() && (l.browser = {
399
- asObject: !1,
400
- // Use console methods directly (default behavior)
401
- write: void 0,
402
- // Use default console write
403
- ...(s == null ? void 0 : s.browser) || {}
404
- // Allow override via pinoOptions
405
- }), r && pt() && !ce())
406
- try {
407
- return se(
408
- l,
409
- se.transport({
410
- target: "pino-pretty",
411
- options: {
412
- colorize: !0,
413
- translateTime: "HH:MM:ss.l",
414
- ignore: "pid,hostname",
415
- singleLine: !1
416
- }
417
- })
418
- );
419
- } catch {
420
- return console.warn("[wsx-logger] pino-pretty not available, using default formatter"), se(l);
421
- }
422
- return se(l);
187
+ function Me(n = {}) {
188
+ const { name: e, level: t } = { ...ee, ...n }, r = e || ee.name, g = Oe.getLogger(r), v = t || ee.level;
189
+ return g.setLevel(be[v]), g;
190
+ }
191
+ function X(n, e) {
192
+ return n ? `[${n}] ${e}` : e;
423
193
  }
424
- class Ne {
194
+ class we {
425
195
  constructor(e = {}) {
426
- this.isProd = ce(), this.pinoLogger = bt(e);
196
+ this.isProd = ae(), this.name = e.name || ee.name, this.currentLevel = e.level || ee.level, this.logInstance = Me(e);
427
197
  }
428
- debug(e, ...n) {
429
- this.isProd || (n.length > 0 ? this.pinoLogger.debug({ args: n }, e) : this.pinoLogger.debug(e));
198
+ debug(e, ...t) {
199
+ if (!this.isProd || this.shouldLog("debug")) {
200
+ const r = X(this.name, e);
201
+ t.length > 0 ? this.logInstance.debug(r, ...t) : this.logInstance.debug(r);
202
+ }
203
+ }
204
+ info(e, ...t) {
205
+ if (this.shouldLog("info")) {
206
+ const r = X(this.name, e);
207
+ t.length > 0 ? this.logInstance.info(r, ...t) : this.logInstance.info(r);
208
+ }
430
209
  }
431
- info(e, ...n) {
432
- this.isProd ? n.length > 0 ? this.pinoLogger.info({ args: n }, e) : this.pinoLogger.info(e) : n.length > 0 ? this.pinoLogger.info({ args: n }, e) : this.pinoLogger.info(e);
210
+ warn(e, ...t) {
211
+ const r = X(this.name, e);
212
+ t.length > 0 ? this.logInstance.warn(r, ...t) : this.logInstance.warn(r);
433
213
  }
434
- warn(e, ...n) {
435
- n.length > 0 ? this.pinoLogger.warn({ args: n }, e) : this.pinoLogger.warn(e);
214
+ error(e, ...t) {
215
+ const r = X(this.name, e);
216
+ t.length > 0 ? this.logInstance.error(r, ...t) : this.logInstance.error(r);
436
217
  }
437
- error(e, ...n) {
438
- n.length > 0 ? this.pinoLogger.error({ args: n }, e) : this.pinoLogger.error(e);
218
+ fatal(e, ...t) {
219
+ const r = X(this.name, e);
220
+ t.length > 0 ? this.logInstance.error(`[FATAL] ${r}`, ...t) : this.logInstance.error(`[FATAL] ${r}`);
439
221
  }
440
- fatal(e, ...n) {
441
- n.length > 0 ? this.pinoLogger.fatal({ args: n }, e) : this.pinoLogger.fatal(e);
222
+ trace(e, ...t) {
223
+ if (!this.isProd || this.shouldLog("trace")) {
224
+ const r = X(this.name, e);
225
+ t.length > 0 ? this.logInstance.trace(r, ...t) : this.logInstance.trace(r);
226
+ }
442
227
  }
443
- trace(e, ...n) {
444
- this.isProd || (n.length > 0 ? this.pinoLogger.trace({ args: n }, e) : this.pinoLogger.trace(e));
228
+ /**
229
+ * Check if a log level should be logged based on current level
230
+ */
231
+ shouldLog(e) {
232
+ const t = ["trace", "debug", "info", "warn", "error", "silent"], r = t.indexOf(this.currentLevel);
233
+ return t.indexOf(e) >= r;
445
234
  }
446
235
  /**
447
- * Get the underlying pino logger instance
236
+ * Get the underlying loglevel logger instance
448
237
  */
449
- getPinoLogger() {
450
- return this.pinoLogger;
238
+ getLoglevelLogger() {
239
+ return this.logInstance;
240
+ }
241
+ /**
242
+ * Set the log level dynamically
243
+ */
244
+ setLevel(e) {
245
+ this.currentLevel = e, this.logInstance.setLevel(be[e]);
246
+ }
247
+ /**
248
+ * Get the current log level
249
+ */
250
+ getLevel() {
251
+ const e = this.logInstance.getLevel();
252
+ return je[e] || this.currentLevel;
451
253
  }
452
254
  }
453
- new Ne();
454
- function he(t, e = {}) {
455
- return new Ne({
255
+ new we();
256
+ function ie(n, e = {}) {
257
+ return new we({
456
258
  ...e,
457
- name: e.name || `WSX:${t}`
259
+ name: e.name || `WSX:${n}`
458
260
  });
459
261
  }
460
- const yt = he("RouterUtils"), te = class te {
262
+ const De = ie("RouterUtils"), Y = class Y {
461
263
  /**
462
264
  * 设置当前路由信息(由 WsxRouter 内部调用)
463
265
  * @internal
464
266
  */
465
267
  static _setCurrentRoute(e) {
466
- te._currentRoute = e;
268
+ Y._currentRoute = e;
467
269
  }
468
270
  /**
469
271
  * 编程式导航
470
272
  */
471
- static navigate(e, n = !1) {
472
- n ? window.history.replaceState(null, "", e) : window.history.pushState(null, "", e), window.dispatchEvent(new PopStateEvent("popstate")), yt.debug(`Navigated to: ${e} (replace: ${n})`);
273
+ static navigate(e, t = !1) {
274
+ t ? window.history.replaceState(null, "", e) : window.history.pushState(null, "", e), window.dispatchEvent(new PopStateEvent("popstate")), De.debug(`Navigated to: ${e} (replace: ${t})`);
473
275
  }
474
276
  /**
475
277
  * 获取当前路由信息
@@ -477,8 +279,8 @@ const yt = he("RouterUtils"), te = class te {
477
279
  * 否则返回基础路由信息(参数为空对象)
478
280
  */
479
281
  static getCurrentRoute() {
480
- if (te._currentRoute)
481
- return te._currentRoute;
282
+ if (Y._currentRoute)
283
+ return Y._currentRoute;
482
284
  const e = new URL(window.location.href);
483
285
  return {
484
286
  path: e.pathname,
@@ -491,9 +293,9 @@ const yt = he("RouterUtils"), te = class te {
491
293
  /**
492
294
  * 解析路由路径,提取参数
493
295
  */
494
- static parseRoute(e, n) {
296
+ static parseRoute(e, t) {
495
297
  var r;
496
- if (e === n)
298
+ if (e === t)
497
299
  return {
498
300
  route: e,
499
301
  params: {},
@@ -506,21 +308,21 @@ const yt = he("RouterUtils"), te = class te {
506
308
  exact: !1
507
309
  };
508
310
  if (e.includes(":")) {
509
- const s = ((r = e.match(/:([^/]+)/g)) == null ? void 0 : r.map((u) => u.slice(1))) || [], l = e.replace(/:[^/]+/g, "([^/]+)"), m = new RegExp(`^${l}$`), g = n.match(m);
510
- if (g && s.length > 0) {
511
- const u = {};
512
- return s.forEach((i, p) => {
513
- u[i] = g[p + 1];
311
+ const g = ((r = e.match(/:([^/]+)/g)) == null ? void 0 : r.map((b) => b.slice(1))) || [], v = e.replace(/:[^/]+/g, "([^/]+)"), f = new RegExp(`^${v}$`), _ = t.match(f);
312
+ if (_ && g.length > 0) {
313
+ const b = {};
314
+ return g.forEach((T, O) => {
315
+ b[T] = _[O + 1];
514
316
  }), {
515
317
  route: e,
516
- params: u,
318
+ params: b,
517
319
  exact: !0
518
320
  };
519
321
  }
520
322
  }
521
323
  if (e.endsWith("/*")) {
522
- const s = e.slice(0, -2);
523
- if (n.startsWith(s))
324
+ const g = e.slice(0, -2);
325
+ if (t.startsWith(g))
524
326
  return {
525
327
  route: e,
526
328
  params: {},
@@ -532,37 +334,37 @@ const yt = he("RouterUtils"), te = class te {
532
334
  /**
533
335
  * 构建路由路径,替换参数
534
336
  */
535
- static buildPath(e, n = {}) {
337
+ static buildPath(e, t = {}) {
536
338
  let r = e;
537
- return Object.entries(n).forEach(([s, l]) => {
538
- r = r.replace(`:${s}`, encodeURIComponent(l));
339
+ return Object.entries(t).forEach(([g, v]) => {
340
+ r = r.replace(`:${g}`, encodeURIComponent(v));
539
341
  }), r;
540
342
  }
541
343
  /**
542
344
  * 检查路由是否匹配当前路径
543
345
  */
544
- static isRouteActive(e, n = !1) {
346
+ static isRouteActive(e, t = !1) {
545
347
  const r = window.location.pathname;
546
- return n ? r === e : e === "/" ? r === "/" : r.startsWith(e);
348
+ return t ? r === e : e === "/" ? r === "/" : r.startsWith(e);
547
349
  }
548
350
  /**
549
351
  * 获取路由层级
550
352
  */
551
353
  static getRouteDepth(e) {
552
- return e.split("/").filter((n) => n.length > 0).length;
354
+ return e.split("/").filter((t) => t.length > 0).length;
553
355
  }
554
356
  /**
555
357
  * 获取父级路由
556
358
  */
557
359
  static getParentRoute(e) {
558
- const n = e.split("/").filter((r) => r.length > 0);
559
- return n.length <= 1 ? "/" : (n.pop(), "/" + n.join("/"));
360
+ const t = e.split("/").filter((r) => r.length > 0);
361
+ return t.length <= 1 ? "/" : (t.pop(), "/" + t.join("/"));
560
362
  }
561
363
  /**
562
364
  * 合并路由路径
563
365
  */
564
366
  static joinPaths(...e) {
565
- return e.map((n) => n.replace(/^\/+|\/+$/g, "")).filter((n) => n.length > 0).join("/").replace(/^/, "/");
367
+ return e.map((t) => t.replace(/^\/+|\/+$/g, "")).filter((t) => t.length > 0).join("/").replace(/^/, "/");
566
368
  }
567
369
  /**
568
370
  * 检查是否为外部链接
@@ -579,20 +381,20 @@ const yt = he("RouterUtils"), te = class te {
579
381
  /**
580
382
  * 设置查询参数
581
383
  */
582
- static setQueryParam(e, n, r = !1) {
583
- const s = new URL(window.location.href);
584
- s.searchParams.set(e, n);
585
- const l = s.pathname + s.search + s.hash;
586
- this.navigate(l, r);
384
+ static setQueryParam(e, t, r = !1) {
385
+ const g = new URL(window.location.href);
386
+ g.searchParams.set(e, t);
387
+ const v = g.pathname + g.search + g.hash;
388
+ this.navigate(v, r);
587
389
  }
588
390
  /**
589
391
  * 删除查询参数
590
392
  */
591
- static removeQueryParam(e, n = !1) {
393
+ static removeQueryParam(e, t = !1) {
592
394
  const r = new URL(window.location.href);
593
395
  r.searchParams.delete(e);
594
- const s = r.pathname + r.search + r.hash;
595
- this.navigate(s, n);
396
+ const g = r.pathname + r.search + r.hash;
397
+ this.navigate(g, t);
596
398
  }
597
399
  /**
598
400
  * 返回上一页
@@ -630,151 +432,151 @@ const yt = he("RouterUtils"), te = class te {
630
432
  * @see RFC-0035: 路由导航竞态条件修复
631
433
  */
632
434
  static onRouteChange(e) {
633
- const n = () => {
435
+ const t = () => {
634
436
  const r = this.getCurrentRoute();
635
437
  e(r);
636
438
  };
637
- return document.addEventListener("route-changed", n), () => {
638
- document.removeEventListener("route-changed", n);
439
+ return document.addEventListener("route-changed", t), () => {
440
+ document.removeEventListener("route-changed", t);
639
441
  };
640
442
  }
641
443
  };
642
- te._currentRoute = null;
643
- let le = te;
644
- const $e = ":host{display:grid;width:100%}.router-outlet{width:100%}:host>wsx-view{grid-area:1 / 1}";
645
- var qe;
646
- let Fe, He;
647
- function U(t, e, n) {
648
- return (e = Ue(e)) in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
444
+ Y._currentRoute = null;
445
+ let ne = Y;
446
+ const ue = ":host{display:grid;width:100%}.router-outlet{width:100%}:host>wsx-view{grid-area:1 / 1}";
447
+ var Le;
448
+ let Re, xe;
449
+ function F(n, e, t) {
450
+ return (e = Ee(e)) in n ? Object.defineProperty(n, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : n[e] = t, n;
649
451
  }
650
- function wt(t, e, n, r, s, l) {
651
- function m(o, c, f) {
652
- return function(h, d) {
653
- return f && f(h), o[c].call(h, d);
452
+ function Pe(n, e, t, r, g, v) {
453
+ function f(s, o, c) {
454
+ return function(i, u) {
455
+ return c && c(i), s[o].call(i, u);
654
456
  };
655
457
  }
656
- function g(o, c) {
657
- for (var f = 0; f < o.length; f++) o[f].call(c);
658
- return c;
659
- }
660
- function u(o, c, f, h) {
661
- if (typeof o != "function" && (h || o !== void 0)) throw new TypeError(c + " must " + (f || "be") + " a function" + (h ? "" : " or undefined"));
458
+ function _(s, o) {
459
+ for (var c = 0; c < s.length; c++) s[c].call(o);
662
460
  return o;
663
461
  }
664
- function i(o, c, f, h, d, T, V, A, I, _, k, E, R) {
665
- function j(b) {
666
- if (!R(b)) throw new TypeError("Attempted to access private element on non-instance");
462
+ function b(s, o, c, i) {
463
+ if (typeof s != "function" && (i || s !== void 0)) throw new TypeError(o + " must " + (c || "be") + " a function" + (i ? "" : " or undefined"));
464
+ return s;
465
+ }
466
+ function T(s, o, c, i, u, A, k, R, P, E, L, p, m) {
467
+ function h(d) {
468
+ if (!m(d)) throw new TypeError("Attempted to access private element on non-instance");
667
469
  }
668
- var y, C = c[0], O = c[3], P = !A;
669
- if (!P) {
670
- f || Array.isArray(C) || (C = [C]);
671
- var a = {}, S = [], L = d === 3 ? "get" : d === 4 || E ? "set" : "value";
672
- _ ? (k || E ? a = { get: je(function() {
673
- return O(this);
674
- }, h, "get"), set: function(b) {
675
- c[4](this, b);
676
- } } : a[L] = O, k || je(a[L], h, d === 2 ? "" : L)) : k || (a = Object.getOwnPropertyDescriptor(o, h));
470
+ var l, x = o[0], C = o[3], W = !R;
471
+ if (!W) {
472
+ c || Array.isArray(x) || (x = [x]);
473
+ var a = {}, I = [], w = u === 3 ? "get" : u === 4 || p ? "set" : "value";
474
+ E ? (L || p ? a = { get: he(function() {
475
+ return C(this);
476
+ }, i, "get"), set: function(d) {
477
+ o[4](this, d);
478
+ } } : a[w] = C, L || he(a[w], i, u === 2 ? "" : w)) : L || (a = Object.getOwnPropertyDescriptor(s, i));
677
479
  }
678
- for (var w = o, q = C.length - 1; q >= 0; q -= f ? 2 : 1) {
679
- var J = C[q], Q = f ? C[q - 1] : void 0, G = {}, D = { kind: ["field", "accessor", "method", "getter", "setter", "class"][d], name: h, metadata: T, addInitializer: (function(b, W) {
680
- if (b.v) throw Error("attempted to call addInitializer after decoration was finished");
681
- u(W, "An initializer", "be", !0), V.push(W);
682
- }).bind(null, G) };
480
+ for (var y = s, U = x.length - 1; U >= 0; U -= c ? 2 : 1) {
481
+ var B = x[U], G = c ? x[U - 1] : void 0, K = {}, j = { kind: ["field", "accessor", "method", "getter", "setter", "class"][u], name: i, metadata: A, addInitializer: (function(d, S) {
482
+ if (d.v) throw Error("attempted to call addInitializer after decoration was finished");
483
+ b(S, "An initializer", "be", !0), k.push(S);
484
+ }).bind(null, K) };
683
485
  try {
684
- if (P) (y = u(J.call(Q, w, D), "class decorators", "return")) && (w = y);
486
+ if (W) (l = b(B.call(G, y, j), "class decorators", "return")) && (y = l);
685
487
  else {
686
- var M, F;
687
- D.static = I, D.private = _, _ ? d === 2 ? M = function(b) {
688
- return j(b), a.value;
689
- } : (d < 4 && (M = m(a, "get", j)), d !== 3 && (F = m(a, "set", j))) : (M = function(b) {
690
- return b[h];
691
- }, (d < 2 || d === 4) && (F = function(b, W) {
692
- b[h] = W;
488
+ var M, z;
489
+ j.static = P, j.private = E, E ? u === 2 ? M = function(d) {
490
+ return h(d), a.value;
491
+ } : (u < 4 && (M = f(a, "get", h)), u !== 3 && (z = f(a, "set", h))) : (M = function(d) {
492
+ return d[i];
493
+ }, (u < 2 || u === 4) && (z = function(d, S) {
494
+ d[i] = S;
693
495
  }));
694
- var X = D.access = { has: _ ? R.bind() : function(b) {
695
- return h in b;
496
+ var J = j.access = { has: E ? m.bind() : function(d) {
497
+ return i in d;
696
498
  } };
697
- if (M && (X.get = M), F && (X.set = F), w = J.call(Q, E ? { get: a.get, set: a.set } : a[L], D), E) {
698
- if (typeof w == "object" && w) (y = u(w.get, "accessor.get")) && (a.get = y), (y = u(w.set, "accessor.set")) && (a.set = y), (y = u(w.init, "accessor.init")) && S.push(y);
699
- else if (w !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
700
- } else u(w, (k ? "field" : "method") + " decorators", "return") && (k ? S.push(w) : a[L] = w);
499
+ if (M && (J.get = M), z && (J.set = z), y = B.call(G, p ? { get: a.get, set: a.set } : a[w], j), p) {
500
+ if (typeof y == "object" && y) (l = b(y.get, "accessor.get")) && (a.get = l), (l = b(y.set, "accessor.set")) && (a.set = l), (l = b(y.init, "accessor.init")) && I.push(l);
501
+ else if (y !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
502
+ } else b(y, (L ? "field" : "method") + " decorators", "return") && (L ? I.push(y) : a[w] = y);
701
503
  }
702
504
  } finally {
703
- G.v = !0;
505
+ K.v = !0;
704
506
  }
705
507
  }
706
- return (k || E) && A.push(function(b, W) {
707
- for (var H = S.length - 1; H >= 0; H--) W = S[H].call(b, W);
708
- return W;
709
- }), k || P || (_ ? E ? A.push(m(a, "get"), m(a, "set")) : A.push(d === 2 ? a[L] : m.call.bind(a[L])) : Object.defineProperty(o, h, a)), w;
710
- }
711
- function p(o, c) {
712
- return Object.defineProperty(o, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: c });
713
- }
714
- if (arguments.length >= 6) var v = l[Symbol.metadata || Symbol.for("Symbol.metadata")];
715
- var z = Object.create(v ?? null), x = function(o, c, f, h) {
716
- var d, T, V = [], A = function(L) {
717
- return Et(L) === o;
718
- }, I = /* @__PURE__ */ new Map();
719
- function _(L) {
720
- L && V.push(g.bind(null, L));
508
+ return (L || p) && R.push(function(d, S) {
509
+ for (var N = I.length - 1; N >= 0; N--) S = I[N].call(d, S);
510
+ return S;
511
+ }), L || W || (E ? p ? R.push(f(a, "get"), f(a, "set")) : R.push(u === 2 ? a[w] : f.call.bind(a[w])) : Object.defineProperty(s, i, a)), y;
512
+ }
513
+ function O(s, o) {
514
+ return Object.defineProperty(s, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: o });
515
+ }
516
+ if (arguments.length >= 6) var V = v[Symbol.metadata || Symbol.for("Symbol.metadata")];
517
+ var D = Object.create(V ?? null), H = function(s, o, c, i) {
518
+ var u, A, k = [], R = function(w) {
519
+ return Ue(w) === s;
520
+ }, P = /* @__PURE__ */ new Map();
521
+ function E(w) {
522
+ w && k.push(_.bind(null, w));
721
523
  }
722
- for (var k = 0; k < c.length; k++) {
723
- var E = c[k];
724
- if (Array.isArray(E)) {
725
- var R = E[1], j = E[2], y = E.length > 3, C = 16 & R, O = !!(8 & R), P = (R &= 7) == 0, a = j + "/" + O;
726
- if (!P && !y) {
727
- var S = I.get(a);
728
- if (S === !0 || S === 3 && R !== 4 || S === 4 && R !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + j);
729
- I.set(a, !(R > 2) || R);
524
+ for (var L = 0; L < o.length; L++) {
525
+ var p = o[L];
526
+ if (Array.isArray(p)) {
527
+ var m = p[1], h = p[2], l = p.length > 3, x = 16 & m, C = !!(8 & m), W = (m &= 7) == 0, a = h + "/" + C;
528
+ if (!W && !l) {
529
+ var I = P.get(a);
530
+ if (I === !0 || I === 3 && m !== 4 || I === 4 && m !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h);
531
+ P.set(a, !(m > 2) || m);
730
532
  }
731
- i(O ? o : o.prototype, E, C, y ? "#" + j : Ue(j), R, h, O ? T = T || [] : d = d || [], V, O, y, P, R === 1, O && y ? A : f);
533
+ T(C ? s : s.prototype, p, x, l ? "#" + h : Ee(h), m, i, C ? A = A || [] : u = u || [], k, C, l, W, m === 1, C && l ? R : c);
732
534
  }
733
535
  }
734
- return _(d), _(T), V;
735
- }(t, e, s, z);
736
- return n.length || p(t, z), { e: x, get c() {
737
- var o = [];
738
- return n.length && [p(i(t, [n], r, t.name, 5, z, o), z), g.bind(null, o, t)];
536
+ return E(u), E(A), k;
537
+ }(n, e, g, D);
538
+ return t.length || O(n, D), { e: H, get c() {
539
+ var s = [];
540
+ return t.length && [O(T(n, [t], r, n.name, 5, D, s), D), _.bind(null, s, n)];
739
541
  } };
740
542
  }
741
- function Ue(t) {
742
- var e = xt(t, "string");
543
+ function Ee(n) {
544
+ var e = Ve(n, "string");
743
545
  return typeof e == "symbol" ? e : e + "";
744
546
  }
745
- function xt(t, e) {
746
- if (typeof t != "object" || !t) return t;
747
- var n = t[Symbol.toPrimitive];
748
- if (n !== void 0) {
749
- var r = n.call(t, e);
547
+ function Ve(n, e) {
548
+ if (typeof n != "object" || !n) return n;
549
+ var t = n[Symbol.toPrimitive];
550
+ if (t !== void 0) {
551
+ var r = t.call(n, e);
750
552
  if (typeof r != "object") return r;
751
553
  throw new TypeError("@@toPrimitive must return a primitive value.");
752
554
  }
753
- return String(t);
555
+ return String(n);
754
556
  }
755
- function je(t, e, n) {
557
+ function he(n, e, t) {
756
558
  typeof e == "symbol" && (e = (e = e.description) ? "[" + e + "]" : "");
757
559
  try {
758
- Object.defineProperty(t, "name", { configurable: !0, value: n ? n + " " + e : e });
560
+ Object.defineProperty(n, "name", { configurable: !0, value: t ? t + " " + e : e });
759
561
  } catch {
760
562
  }
761
- return t;
563
+ return n;
762
564
  }
763
- function Et(t) {
764
- if (Object(t) !== t) throw TypeError("right-hand side of 'in' should be an object, got " + (t !== null ? typeof t : "null"));
765
- return t;
565
+ function Ue(n) {
566
+ if (Object(n) !== n) throw TypeError("right-hand side of 'in' should be an object, got " + (n !== null ? typeof n : "null"));
567
+ return n;
766
568
  }
767
- const $ = he("WsxRouter");
768
- He = [we({
569
+ const $ = ie("WsxRouter");
570
+ xe = [ce({
769
571
  tagName: "wsx-router"
770
572
  })];
771
- let Rt;
772
- class Lt extends oe {
573
+ let ze;
574
+ class Ne extends re {
773
575
  constructor() {
774
576
  super({
775
- styles: $e,
577
+ styles: ue,
776
578
  styleName: "wsx-router"
777
- }), U(this, "_autoStyles", $e), U(this, "views", /* @__PURE__ */ new Map()), U(this, "currentView", null), U(this, "currentPath", ""), U(this, "isHandlingRoute", !1), U(this, "compiledRoutes", /* @__PURE__ */ new Map()), U(this, "matchCache", /* @__PURE__ */ new Map()), U(this, "enableViewTransitions", !0), U(this, "scrollRestoration", "manual"), U(this, "handleRouteChange", () => {
579
+ }), F(this, "_autoStyles", ue), F(this, "views", /* @__PURE__ */ new Map()), F(this, "currentView", null), F(this, "currentPath", ""), F(this, "isHandlingRoute", !1), F(this, "compiledRoutes", /* @__PURE__ */ new Map()), F(this, "matchCache", /* @__PURE__ */ new Map()), F(this, "enableViewTransitions", !0), F(this, "scrollRestoration", "manual"), F(this, "handleRouteChange", () => {
778
580
  if (this.isHandlingRoute) {
779
581
  $.debug("Route change already in progress, skipping");
780
582
  return;
@@ -783,7 +585,7 @@ class Lt extends oe {
783
585
  try {
784
586
  const e = window.location.pathname;
785
587
  $.debug(`WsxRouter: Route changed to: ${e}`);
786
- const n = new CustomEvent("before-navigate", {
588
+ const t = new CustomEvent("before-navigate", {
787
589
  detail: {
788
590
  to: e,
789
591
  from: this.currentPath
@@ -791,7 +593,7 @@ class Lt extends oe {
791
593
  bubbles: !0,
792
594
  cancelable: !0
793
595
  });
794
- if (!this.dispatchEvent(n)) {
596
+ if (!this.dispatchEvent(t)) {
795
597
  $.debug(`Navigation to ${e} was cancelled`);
796
598
  return;
797
599
  }
@@ -801,15 +603,15 @@ class Lt extends oe {
801
603
  this.isHandlingRoute = !1;
802
604
  });
803
605
  }
804
- }), U(this, "interceptLinks", (e) => {
805
- const n = e.target.closest("a");
806
- if (!n) return;
807
- const r = n.getAttribute("href");
606
+ }), F(this, "interceptLinks", (e) => {
607
+ const t = e.target.closest("a");
608
+ if (!t) return;
609
+ const r = t.getAttribute("href");
808
610
  !r || r.startsWith("http") || r.startsWith("#") || (e.preventDefault(), this.navigate(r));
809
611
  });
810
612
  }
811
613
  render() {
812
- return /* @__PURE__ */ ae("div", { class: "router-outlet" });
614
+ return /* @__PURE__ */ te("div", { class: "router-outlet" });
813
615
  }
814
616
  onRendered() {
815
617
  this.views.size === 0 && (this.collectViews(), $.debug("WsxRouter collected views in onRendered:", this.views.size)), this.views.size > 0 && !this.currentView && requestAnimationFrame(() => {
@@ -827,61 +629,61 @@ class Lt extends oe {
827
629
  window.removeEventListener("popstate", this.handleRouteChange);
828
630
  }
829
631
  collectViews() {
830
- const e = Array.from(this.children).filter((n) => n.tagName.toLowerCase() === "wsx-view");
831
- $.debug(`WsxRouter found ${e.length} views`), this.views.clear(), this.compiledRoutes.clear(), this.matchCache.clear(), e.forEach((n) => {
832
- const r = n.getAttribute("route") || "/";
833
- if (this.views.set(r, n), $.debug(`WsxRouter registered route: ${r}`), r.includes(":")) {
834
- const s = r.replace(/:[^/]+/g, "([^/]+)"), l = new RegExp(`^${s}$`);
835
- this.compiledRoutes.set(r, l), $.debug(`WsxRouter compiled regex for route: ${r} -> ${l}`);
632
+ const e = Array.from(this.children).filter((t) => t.tagName.toLowerCase() === "wsx-view");
633
+ $.debug(`WsxRouter found ${e.length} views`), this.views.clear(), this.compiledRoutes.clear(), this.matchCache.clear(), e.forEach((t) => {
634
+ const r = t.getAttribute("route") || "/";
635
+ if (this.views.set(r, t), $.debug(`WsxRouter registered route: ${r}`), r.includes(":")) {
636
+ const g = r.replace(/:[^/]+/g, "([^/]+)"), v = new RegExp(`^${g}$`);
637
+ this.compiledRoutes.set(r, v), $.debug(`WsxRouter compiled regex for route: ${r} -> ${v}`);
836
638
  }
837
- n.style.display = "none";
639
+ t.style.display = "none";
838
640
  });
839
641
  }
840
642
  /**
841
643
  * RFC 0033: 执行导航(带 View Transitions 支持)
842
644
  */
843
645
  performNavigation(e) {
844
- const n = () => {
646
+ const t = () => {
845
647
  const r = this.matchRoute(e);
846
648
  if (r) {
847
649
  r.style.display = "block", r.style.visibility = "visible";
848
- const s = r.getAttribute("route") || "/";
849
- $.debug(`Showing view for route: ${s}`);
850
- for (const [p, v] of this.views)
851
- v !== r && (v.style.display = "none", v.style.visibility = "");
650
+ const g = r.getAttribute("route") || "/";
651
+ $.debug(`Showing view for route: ${g}`);
652
+ for (const [O, V] of this.views)
653
+ V !== r && (V.style.display = "none", V.style.visibility = "");
852
654
  this.currentView = r;
853
- const l = this.extractParams(s, e);
854
- $.debug(`Extracted params for route ${s} and path ${e}:`, l), l && requestAnimationFrame(() => {
855
- r.setAttribute("params", JSON.stringify(l)), $.debug(`Set params attribute on view: ${JSON.stringify(l)}`);
655
+ const v = this.extractParams(g, e);
656
+ $.debug(`Extracted params for route ${g} and path ${e}:`, v), v && requestAnimationFrame(() => {
657
+ r.setAttribute("params", JSON.stringify(v)), $.debug(`Set params attribute on view: ${JSON.stringify(v)}`);
856
658
  });
857
- const m = window.location.href || `${window.location.pathname}${window.location.search}${window.location.hash}`, g = new URL(m, window.location.origin || "http://localhost"), u = {
659
+ const f = window.location.href || `${window.location.pathname}${window.location.search}${window.location.hash}`, _ = new URL(f, window.location.origin || "http://localhost"), b = {
858
660
  path: e,
859
- params: l || {},
860
- query: Object.fromEntries(g.searchParams.entries()),
861
- hash: g.hash.slice(1)
661
+ params: v || {},
662
+ query: Object.fromEntries(_.searchParams.entries()),
663
+ hash: _.hash.slice(1)
862
664
  };
863
- le._setCurrentRoute(u), $.debug("Updated RouterUtils._currentRoute:", u);
864
- const i = new CustomEvent("route-changed", {
865
- detail: u,
665
+ ne._setCurrentRoute(b), $.debug("Updated RouterUtils._currentRoute:", b);
666
+ const T = new CustomEvent("route-changed", {
667
+ detail: b,
866
668
  bubbles: !0
867
669
  });
868
- document.dispatchEvent(i);
670
+ document.dispatchEvent(T);
869
671
  } else {
870
- for (const [u, i] of this.views)
871
- i.style.display = "none";
672
+ for (const [b, T] of this.views)
673
+ T.style.display = "none";
872
674
  this.currentView = null, $.warn(`No view found for path: ${e}`);
873
- const s = window.location.href || `${window.location.pathname}${window.location.search}${window.location.hash}`, l = new URL(s, window.location.origin || "http://localhost"), m = {
675
+ const g = window.location.href || `${window.location.pathname}${window.location.search}${window.location.hash}`, v = new URL(g, window.location.origin || "http://localhost"), f = {
874
676
  path: e,
875
677
  params: {},
876
- query: Object.fromEntries(l.searchParams.entries()),
877
- hash: l.hash.slice(1)
678
+ query: Object.fromEntries(v.searchParams.entries()),
679
+ hash: v.hash.slice(1)
878
680
  };
879
- le._setCurrentRoute(m);
880
- const g = new CustomEvent("route-changed", {
881
- detail: m,
681
+ ne._setCurrentRoute(f);
682
+ const _ = new CustomEvent("route-changed", {
683
+ detail: f,
882
684
  bubbles: !0
883
685
  });
884
- document.dispatchEvent(g);
686
+ document.dispatchEvent(_);
885
687
  }
886
688
  this.handleScrollRestoration(e), this.dispatchEvent(new CustomEvent("after-navigate", {
887
689
  detail: {
@@ -891,7 +693,7 @@ class Lt extends oe {
891
693
  bubbles: !0
892
694
  })), this.currentPath = e;
893
695
  };
894
- this.enableViewTransitions && "startViewTransition" in document ? document.startViewTransition(n) : n();
696
+ this.enableViewTransitions && "startViewTransition" in document ? document.startViewTransition(t) : t();
895
697
  }
896
698
  /**
897
699
  * RFC 0033: 滚动恢复处理
@@ -914,28 +716,28 @@ class Lt extends oe {
914
716
  if (this.views.has(e))
915
717
  return this.matchCache.set(e, e), $.warn(`matchRoute: exact match found for ${e}`), this.views.get(e);
916
718
  $.warn(`matchRoute: checking parameter routes, compiledRoutes count: ${this.compiledRoutes.size}`);
917
- for (const [r, s] of this.views)
719
+ for (const [r, g] of this.views)
918
720
  if (r.includes(":")) {
919
- const l = this.compiledRoutes.get(r);
920
- if (l) {
921
- const m = l.test(e);
922
- if ($.warn(`matchRoute: testing route ${r} against ${e}, matches: ${m}`), m)
923
- return this.matchCache.set(e, r), $.warn(`matchRoute: parameter match found, route: ${r}, path: ${e}`), s;
721
+ const v = this.compiledRoutes.get(r);
722
+ if (v) {
723
+ const f = v.test(e);
724
+ if ($.warn(`matchRoute: testing route ${r} against ${e}, matches: ${f}`), f)
725
+ return this.matchCache.set(e, r), $.warn(`matchRoute: parameter match found, route: ${r}, path: ${e}`), g;
924
726
  } else
925
727
  $.warn(`matchRoute: route ${r} has ':' but no compiled regex found`);
926
728
  }
927
- const n = this.views.get("*") || null;
928
- return n ? (this.matchCache.set(e, "*"), $.warn(`matchRoute: wildcard match found for ${e}`)) : $.warn(`matchRoute: no match found for ${e}, no wildcard view available`), n;
729
+ const t = this.views.get("*") || null;
730
+ return t ? (this.matchCache.set(e, "*"), $.warn(`matchRoute: wildcard match found for ${e}`)) : $.warn(`matchRoute: no match found for ${e}, no wildcard view available`), t;
929
731
  }
930
- extractParams(e, n) {
931
- var u;
732
+ extractParams(e, t) {
733
+ var b;
932
734
  if (!e.includes(":")) return null;
933
- const r = ((u = e.match(/:([^/]+)/g)) == null ? void 0 : u.map((i) => i.slice(1))) || [], s = e.replace(/:[^/]+/g, "([^/]+)"), l = new RegExp(`^${s}$`), m = n.match(l);
934
- if (!m || !r.length) return null;
935
- const g = {};
936
- return r.forEach((i, p) => {
937
- g[i] = m[p + 1];
938
- }), g;
735
+ const r = ((b = e.match(/:([^/]+)/g)) == null ? void 0 : b.map((T) => T.slice(1))) || [], g = e.replace(/:[^/]+/g, "([^/]+)"), v = new RegExp(`^${g}$`), f = t.match(v);
736
+ if (!f || !r.length) return null;
737
+ const _ = {};
738
+ return r.forEach((T, O) => {
739
+ _[T] = f[O + 1];
740
+ }), _;
939
741
  }
940
742
  /**
941
743
  * RFC 0032: 清除匹配缓存
@@ -963,404 +765,385 @@ class Lt extends oe {
963
765
  window.history.pushState(null, "", e), this.handleRouteChange();
964
766
  }
965
767
  }
966
- qe = Lt;
967
- [Rt, Fe] = wt(qe, [], He, 0, void 0, oe).c;
968
- Fe();
969
- const Ce = ":host{display:block;width:100%;height:100%}.route-view{width:100%;height:100%;position:relative}:host([loading]) .route-view{opacity:.5;transition:opacity .3s ease}:host([error]) .route-view{border:1px solid var(--error-color, #ff0000);padding:1rem}.route-view.entering{animation:fadeIn .3s ease-out}.route-view.leaving{animation:fadeOut .3s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}";
970
- var me, ge;
971
- let Oe, Be, Se;
972
- function ee(t, e, n) {
973
- return (e = Ke(e)) in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
768
+ Le = Ne;
769
+ [ze, Re] = Pe(Le, [], xe, 0, void 0, re).c;
770
+ Re();
771
+ const Fe = ":host{display:block;width:100%;height:100%}.route-view{width:100%;height:100%;position:relative}:host([loading]) .route-view{opacity:.5;transition:opacity .3s ease}:host([error]) .route-view{border:1px solid var(--error-color, #ff0000);padding:1rem}.route-view.entering{animation:fadeIn .3s ease-out}.route-view.leaving{animation:fadeOut .3s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}";
772
+ var Ce;
773
+ let $e, _e;
774
+ function Z(n, e, t) {
775
+ return (e = Ie(e)) in n ? Object.defineProperty(n, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : n[e] = t, n;
974
776
  }
975
- function kt(t, e, n, r, s, l) {
976
- function m(o, c, f) {
977
- return function(h, d) {
978
- return f && f(h), o[c].call(h, d);
777
+ function qe(n, e, t, r, g, v) {
778
+ function f(s, o, c) {
779
+ return function(i, u) {
780
+ return c && c(i), s[o].call(i, u);
979
781
  };
980
782
  }
981
- function g(o, c) {
982
- for (var f = 0; f < o.length; f++) o[f].call(c);
983
- return c;
984
- }
985
- function u(o, c, f, h) {
986
- if (typeof o != "function" && (h || o !== void 0)) throw new TypeError(c + " must " + (f || "be") + " a function" + (h ? "" : " or undefined"));
783
+ function _(s, o) {
784
+ for (var c = 0; c < s.length; c++) s[c].call(o);
987
785
  return o;
988
786
  }
989
- function i(o, c, f, h, d, T, V, A, I, _, k, E, R) {
990
- function j(b) {
991
- if (!R(b)) throw new TypeError("Attempted to access private element on non-instance");
787
+ function b(s, o, c, i) {
788
+ if (typeof s != "function" && (i || s !== void 0)) throw new TypeError(o + " must " + (c || "be") + " a function" + (i ? "" : " or undefined"));
789
+ return s;
790
+ }
791
+ function T(s, o, c, i, u, A, k, R, P, E, L, p, m) {
792
+ function h(d) {
793
+ if (!m(d)) throw new TypeError("Attempted to access private element on non-instance");
992
794
  }
993
- var y, C = c[0], O = c[3], P = !A;
994
- if (!P) {
995
- f || Array.isArray(C) || (C = [C]);
996
- var a = {}, S = [], L = d === 3 ? "get" : d === 4 || E ? "set" : "value";
997
- _ ? (k || E ? a = { get: We(function() {
998
- return O(this);
999
- }, h, "get"), set: function(b) {
1000
- c[4](this, b);
1001
- } } : a[L] = O, k || We(a[L], h, d === 2 ? "" : L)) : k || (a = Object.getOwnPropertyDescriptor(o, h));
795
+ var l, x = o[0], C = o[3], W = !R;
796
+ if (!W) {
797
+ c || Array.isArray(x) || (x = [x]);
798
+ var a = {}, I = [], w = u === 3 ? "get" : u === 4 || p ? "set" : "value";
799
+ E ? (L || p ? a = { get: fe(function() {
800
+ return C(this);
801
+ }, i, "get"), set: function(d) {
802
+ o[4](this, d);
803
+ } } : a[w] = C, L || fe(a[w], i, u === 2 ? "" : w)) : L || (a = Object.getOwnPropertyDescriptor(s, i));
1002
804
  }
1003
- for (var w = o, q = C.length - 1; q >= 0; q -= f ? 2 : 1) {
1004
- var J = C[q], Q = f ? C[q - 1] : void 0, G = {}, D = { kind: ["field", "accessor", "method", "getter", "setter", "class"][d], name: h, metadata: T, addInitializer: (function(b, W) {
1005
- if (b.v) throw Error("attempted to call addInitializer after decoration was finished");
1006
- u(W, "An initializer", "be", !0), V.push(W);
1007
- }).bind(null, G) };
805
+ for (var y = s, U = x.length - 1; U >= 0; U -= c ? 2 : 1) {
806
+ var B = x[U], G = c ? x[U - 1] : void 0, K = {}, j = { kind: ["field", "accessor", "method", "getter", "setter", "class"][u], name: i, metadata: A, addInitializer: (function(d, S) {
807
+ if (d.v) throw Error("attempted to call addInitializer after decoration was finished");
808
+ b(S, "An initializer", "be", !0), k.push(S);
809
+ }).bind(null, K) };
1008
810
  try {
1009
- if (P) (y = u(J.call(Q, w, D), "class decorators", "return")) && (w = y);
811
+ if (W) (l = b(B.call(G, y, j), "class decorators", "return")) && (y = l);
1010
812
  else {
1011
- var M, F;
1012
- D.static = I, D.private = _, _ ? d === 2 ? M = function(b) {
1013
- return j(b), a.value;
1014
- } : (d < 4 && (M = m(a, "get", j)), d !== 3 && (F = m(a, "set", j))) : (M = function(b) {
1015
- return b[h];
1016
- }, (d < 2 || d === 4) && (F = function(b, W) {
1017
- b[h] = W;
813
+ var M, z;
814
+ j.static = P, j.private = E, E ? u === 2 ? M = function(d) {
815
+ return h(d), a.value;
816
+ } : (u < 4 && (M = f(a, "get", h)), u !== 3 && (z = f(a, "set", h))) : (M = function(d) {
817
+ return d[i];
818
+ }, (u < 2 || u === 4) && (z = function(d, S) {
819
+ d[i] = S;
1018
820
  }));
1019
- var X = D.access = { has: _ ? R.bind() : function(b) {
1020
- return h in b;
821
+ var J = j.access = { has: E ? m.bind() : function(d) {
822
+ return i in d;
1021
823
  } };
1022
- if (M && (X.get = M), F && (X.set = F), w = J.call(Q, E ? { get: a.get, set: a.set } : a[L], D), E) {
1023
- if (typeof w == "object" && w) (y = u(w.get, "accessor.get")) && (a.get = y), (y = u(w.set, "accessor.set")) && (a.set = y), (y = u(w.init, "accessor.init")) && S.push(y);
1024
- else if (w !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
1025
- } else u(w, (k ? "field" : "method") + " decorators", "return") && (k ? S.push(w) : a[L] = w);
824
+ if (M && (J.get = M), z && (J.set = z), y = B.call(G, p ? { get: a.get, set: a.set } : a[w], j), p) {
825
+ if (typeof y == "object" && y) (l = b(y.get, "accessor.get")) && (a.get = l), (l = b(y.set, "accessor.set")) && (a.set = l), (l = b(y.init, "accessor.init")) && I.push(l);
826
+ else if (y !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
827
+ } else b(y, (L ? "field" : "method") + " decorators", "return") && (L ? I.push(y) : a[w] = y);
1026
828
  }
1027
829
  } finally {
1028
- G.v = !0;
830
+ K.v = !0;
1029
831
  }
1030
832
  }
1031
- return (k || E) && A.push(function(b, W) {
1032
- for (var H = S.length - 1; H >= 0; H--) W = S[H].call(b, W);
1033
- return W;
1034
- }), k || P || (_ ? E ? A.push(m(a, "get"), m(a, "set")) : A.push(d === 2 ? a[L] : m.call.bind(a[L])) : Object.defineProperty(o, h, a)), w;
1035
- }
1036
- function p(o, c) {
1037
- return Object.defineProperty(o, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: c });
1038
- }
1039
- if (arguments.length >= 6) var v = l[Symbol.metadata || Symbol.for("Symbol.metadata")];
1040
- var z = Object.create(v ?? null), x = function(o, c, f, h) {
1041
- var d, T, V = [], A = function(L) {
1042
- return $t(L) === o;
1043
- }, I = /* @__PURE__ */ new Map();
1044
- function _(L) {
1045
- L && V.push(g.bind(null, L));
833
+ return (L || p) && R.push(function(d, S) {
834
+ for (var N = I.length - 1; N >= 0; N--) S = I[N].call(d, S);
835
+ return S;
836
+ }), L || W || (E ? p ? R.push(f(a, "get"), f(a, "set")) : R.push(u === 2 ? a[w] : f.call.bind(a[w])) : Object.defineProperty(s, i, a)), y;
837
+ }
838
+ function O(s, o) {
839
+ return Object.defineProperty(s, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: o });
840
+ }
841
+ if (arguments.length >= 6) var V = v[Symbol.metadata || Symbol.for("Symbol.metadata")];
842
+ var D = Object.create(V ?? null), H = function(s, o, c, i) {
843
+ var u, A, k = [], R = function(w) {
844
+ return Be(w) === s;
845
+ }, P = /* @__PURE__ */ new Map();
846
+ function E(w) {
847
+ w && k.push(_.bind(null, w));
1046
848
  }
1047
- for (var k = 0; k < c.length; k++) {
1048
- var E = c[k];
1049
- if (Array.isArray(E)) {
1050
- var R = E[1], j = E[2], y = E.length > 3, C = 16 & R, O = !!(8 & R), P = (R &= 7) == 0, a = j + "/" + O;
1051
- if (!P && !y) {
1052
- var S = I.get(a);
1053
- if (S === !0 || S === 3 && R !== 4 || S === 4 && R !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + j);
1054
- I.set(a, !(R > 2) || R);
849
+ for (var L = 0; L < o.length; L++) {
850
+ var p = o[L];
851
+ if (Array.isArray(p)) {
852
+ var m = p[1], h = p[2], l = p.length > 3, x = 16 & m, C = !!(8 & m), W = (m &= 7) == 0, a = h + "/" + C;
853
+ if (!W && !l) {
854
+ var I = P.get(a);
855
+ if (I === !0 || I === 3 && m !== 4 || I === 4 && m !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h);
856
+ P.set(a, !(m > 2) || m);
1055
857
  }
1056
- i(O ? o : o.prototype, E, C, y ? "#" + j : Ke(j), R, h, O ? T = T || [] : d = d || [], V, O, y, P, R === 1, O && y ? A : f);
858
+ T(C ? s : s.prototype, p, x, l ? "#" + h : Ie(h), m, i, C ? A = A || [] : u = u || [], k, C, l, W, m === 1, C && l ? R : c);
1057
859
  }
1058
860
  }
1059
- return _(d), _(T), V;
1060
- }(t, e, s, z);
1061
- return n.length || p(t, z), { e: x, get c() {
1062
- var o = [];
1063
- return n.length && [p(i(t, [n], r, t.name, 5, z, o), z), g.bind(null, o, t)];
861
+ return E(u), E(A), k;
862
+ }(n, e, g, D);
863
+ return t.length || O(n, D), { e: H, get c() {
864
+ var s = [];
865
+ return t.length && [O(T(n, [t], r, n.name, 5, D, s), D), _.bind(null, s, n)];
1064
866
  } };
1065
867
  }
1066
- function Ke(t) {
1067
- var e = _t(t, "string");
868
+ function Ie(n) {
869
+ var e = He(n, "string");
1068
870
  return typeof e == "symbol" ? e : e + "";
1069
871
  }
1070
- function _t(t, e) {
1071
- if (typeof t != "object" || !t) return t;
1072
- var n = t[Symbol.toPrimitive];
1073
- if (n !== void 0) {
1074
- var r = n.call(t, e);
872
+ function He(n, e) {
873
+ if (typeof n != "object" || !n) return n;
874
+ var t = n[Symbol.toPrimitive];
875
+ if (t !== void 0) {
876
+ var r = t.call(n, e);
1075
877
  if (typeof r != "object") return r;
1076
878
  throw new TypeError("@@toPrimitive must return a primitive value.");
1077
879
  }
1078
- return (e === "string" ? String : Number)(t);
880
+ return String(n);
1079
881
  }
1080
- function We(t, e, n) {
882
+ function fe(n, e, t) {
1081
883
  typeof e == "symbol" && (e = (e = e.description) ? "[" + e + "]" : "");
1082
884
  try {
1083
- Object.defineProperty(t, "name", { configurable: !0, value: n ? n + " " + e : e });
885
+ Object.defineProperty(n, "name", { configurable: !0, value: t ? t + " " + e : e });
1084
886
  } catch {
1085
887
  }
1086
- return t;
1087
- }
1088
- function $t(t) {
1089
- if (Object(t) !== t) throw TypeError("right-hand side of 'in' should be an object, got " + (t !== null ? typeof t : "null"));
1090
- return t;
888
+ return n;
1091
889
  }
1092
- function jt(t) {
1093
- return t;
890
+ function Be(n) {
891
+ if (Object(n) !== n) throw TypeError("right-hand side of 'in' should be an object, got " + (n !== null ? typeof n : "null"));
892
+ return n;
1094
893
  }
1095
- const N = he("WsxView");
1096
- Be = [we({
894
+ const q = ie("WsxView");
895
+ _e = [ce({
1097
896
  tagName: "wsx-view"
1098
897
  })];
1099
- let ze;
1100
- new (Se = (ge = class extends oe {
1101
- // 防止重复加载的标志
898
+ let Ge;
899
+ class Ke extends re {
1102
900
  constructor() {
1103
- super({
1104
- styles: Ce,
1105
- styleName: "wsx-view"
1106
- }), ee(this, "_autoStyles", Ce), ee(this, "component", null), ee(this, "params", {}), ee(this, "componentInstance", null), ee(this, "isLoading", !1);
901
+ super(), Z(this, "_autoStyles", Fe), Z(this, "_component", ""), Z(this, "params", void 0), Z(this, "componentInstance", null), Z(this, "isLoading", !1);
902
+ let e = this.reactive({});
903
+ Object.defineProperty(this, "params", {
904
+ get: () => e,
905
+ set: (t) => {
906
+ e = t !== null && typeof t < "u" && (Array.isArray(t) || typeof t == "object") ? this.reactive(t) : t, this.scheduleRerender();
907
+ },
908
+ enumerable: !0,
909
+ configurable: !0
910
+ });
911
+ }
912
+ get component() {
913
+ return this._component;
1107
914
  }
915
+ set component(e) {
916
+ this._component = e || "", this._component && requestAnimationFrame(() => {
917
+ this.connected && !this.componentInstance && !this.isLoading && this.loadComponent(this._component || "");
918
+ });
919
+ }
920
+ // 防止重复加载的标志
1108
921
  render() {
1109
- return /* @__PURE__ */ ae("div", { class: "route-view" });
922
+ return /* @__PURE__ */ te("div", { class: "route-view" });
1110
923
  }
1111
924
  onConnected() {
1112
925
  requestAnimationFrame(() => {
1113
- if (!this.connected || this.isLoading || this.componentInstance)
1114
- return;
1115
- const e = this.getAttribute("component");
1116
- e && this.loadComponent(e);
926
+ !this.connected || this.isLoading || this.componentInstance || this.component && this.loadComponent(this.component);
1117
927
  });
1118
928
  }
1119
- onAttributeChanged(e, n, r) {
1120
- if (this.connected) {
1121
- if (e === "component" && r && !this.componentInstance && !this.isLoading)
1122
- requestAnimationFrame(() => {
1123
- this.connected && !this.componentInstance && !this.isLoading && this.loadComponent(r);
1124
- });
1125
- else if (e === "params" && this.componentInstance)
1126
- try {
1127
- this.params = JSON.parse(r), N.debug("WsxView: params attribute changed, setting on component:", this.params), Object.entries(this.params).forEach(([s, l]) => {
1128
- this.componentInstance.setAttribute(s, l);
1129
- }), N.debug(`WsxView: params set on component ${this.componentInstance.tagName}`);
1130
- } catch (s) {
1131
- N.warn("Failed to parse params:", s);
1132
- }
1133
- }
1134
- }
1135
929
  async loadComponent(e) {
1136
- if (!this.connected || this.isLoading || this.componentInstance) {
1137
- N.debug(`Skipping loadComponent for ${e}: connected=${this.connected}, isLoading=${this.isLoading}, hasInstance=${!!this.componentInstance}`);
1138
- return;
1139
- }
1140
- N.debug(`WsxView: Loading component ${e}`), this.isLoading = !0;
1141
- try {
1142
- const n = this.componentInstance;
1143
- if (n && (n.remove(), this.componentInstance = null), !customElements.get(e)) {
1144
- N.warn(`Component ${e} not found in customElements registry`), this.isLoading = !1;
1145
- return;
1146
- }
1147
- N.warn(`WsxView: Creating instance of ${e}`), this.componentInstance = document.createElement(e), Object.keys(this.params).length > 0 && (N.warn(`WsxView: Setting initial params on ${e}:`, this.params), Object.entries(this.params).forEach(([l, m]) => {
1148
- this.componentInstance.setAttribute(l, m);
1149
- }));
1150
- const s = this.querySelector(".route-view");
1151
- if (s) {
1152
- if (N.warn(`WsxView: Appending ${e} to container`), !customElements.get(e)) {
1153
- N.error(`WsxView: Component ${e} is not registered in customElements registry!`), this.isLoading = !1, this.componentInstance = null;
930
+ if (!(!this.connected || this.isLoading || this.componentInstance)) {
931
+ this.isLoading = !0;
932
+ try {
933
+ const t = this.componentInstance;
934
+ if (t && (t.remove(), this.componentInstance = null), !customElements.get(e)) {
935
+ q.warn(`Component ${e} not found in customElements registry`), this.isLoading = !1;
1154
936
  return;
1155
937
  }
1156
- s.appendChild(this.componentInstance), N.warn(`WsxView: Component ${e} appended successfully, waiting for connectedCallback...`), setTimeout(() => {
1157
- this.componentInstance && this.componentInstance.isConnected ? N.warn(`WsxView: Component ${e} is now connected to DOM`) : N.error(`WsxView: Component ${e} was not connected to DOM!`);
1158
- }, 0);
1159
- } else
1160
- N.error("WsxView: Route view container not found"), this.componentInstance = null;
1161
- } catch (n) {
1162
- N.warn(`Error loading component ${e}:`, n), this.componentInstance = null;
1163
- } finally {
1164
- this.isLoading = !1, N.warn(`WsxView: loadComponent for ${e} completed, isLoading=${this.isLoading}`);
938
+ q.warn(`WsxView: Creating instance of ${e}`), this.componentInstance = document.createElement(e), Object.keys(this.params).length > 0 && (q.warn(`WsxView: Setting initial params on ${e}:`, this.params), Object.entries(this.params).forEach(([v, f]) => {
939
+ this.componentInstance.setAttribute(v, f);
940
+ }));
941
+ const g = this.querySelector(".route-view");
942
+ if (g) {
943
+ if (q.warn(`WsxView: Appending ${e} to container`), !customElements.get(e)) {
944
+ q.error(`WsxView: Component ${e} is not registered in customElements registry!`), this.isLoading = !1, this.componentInstance = null;
945
+ return;
946
+ }
947
+ g.appendChild(this.componentInstance), q.warn(`WsxView: Component ${e} appended successfully, waiting for connectedCallback...`), setTimeout(() => {
948
+ this.componentInstance && this.componentInstance.isConnected ? q.warn(`WsxView: Component ${e} is now connected to DOM`) : q.error(`WsxView: Component ${e} was not connected to DOM!`);
949
+ }, 0);
950
+ } else
951
+ q.error("WsxView: Route view container not found"), this.componentInstance = null;
952
+ } catch (t) {
953
+ q.warn(`Error loading component ${e}:`, t), this.componentInstance = null;
954
+ } finally {
955
+ this.isLoading = !1, q.warn(`WsxView: loadComponent for ${e} completed, isLoading=${this.isLoading}`);
956
+ }
1165
957
  }
1166
958
  }
1167
959
  onDisconnected() {
1168
960
  this.componentInstance && (this.componentInstance.remove(), this.componentInstance = null);
1169
961
  }
1170
- }, [ze, Oe] = kt(ge, [], Be, 0, void 0, oe).c, ge), me = class extends jt {
1171
- constructor() {
1172
- super(ze), ee(this, "observedAttributes", ["route", "component", "params"]), Oe();
1173
- }
1174
- }, ee(me, Se, void 0), me)();
1175
- const Ct = ':host{display:inline-block;min-width:fit-content;min-height:fit-content;width:auto;height:auto}.wsx-link{color:var(--link-color, #007bff);text-decoration:var(--link-decoration, underline);cursor:pointer;transition:color .2s ease;display:inline-block;min-height:1.2em;line-height:1.2}.wsx-link:hover{color:var(--link-hover-color, #0056b3);text-decoration:var(--link-hover-decoration, underline)}.wsx-link:focus{outline:2px solid var(--link-focus-color, var(--focus-color, #dc2626));outline-offset:2px}.wsx-link.active{color:var(--link-active-color, #6c757d);font-weight:var(--link-active-weight, bold)}:host([disabled]) .wsx-link{color:var(--link-disabled-color, #6c757d);cursor:not-allowed;pointer-events:none}:host([external]) .wsx-link:after{content:"↗";font-size:.8em;margin-left:.2em;opacity:.7}:host([variant="button"]) .wsx-link{background-color:var(--button-bg, #007bff);color:var(--button-color, white);padding:.5rem 1rem;border-radius:.25rem;text-decoration:none;display:inline-block}:host([variant="button"]) .wsx-link:hover{background-color:var(--button-hover-bg, #0056b3);color:var(--button-hover-color, white)}:host([variant="tab"]) .wsx-link{padding:.5rem 1rem;border-bottom:2px solid transparent;text-decoration:none}:host([variant="tab"]) .wsx-link.active{border-bottom-color:var(--tab-active-border, #007bff)}';
1176
- var pe, ve;
1177
- let Ae, Je, Te;
1178
- function B(t, e, n) {
1179
- return (e = Qe(e)) in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
1180
962
  }
1181
- function Ot(t, e, n, r, s, l) {
1182
- function m(o, c, f) {
1183
- return function(h, d) {
1184
- return f && f(h), o[c].call(h, d);
963
+ Ce = Ke;
964
+ [Ge, $e] = qe(Ce, [], _e, 0, void 0, re).c;
965
+ $e();
966
+ const Je = ':host{display:inline-block;min-width:fit-content;min-height:fit-content;width:auto;height:auto}.wsx-link{color:var(--link-color, #007bff);text-decoration:var(--link-decoration, underline);cursor:pointer;transition:color .2s ease;display:inline-block;min-height:1.2em;line-height:1.2}.wsx-link:hover{color:var(--link-hover-color, #0056b3);text-decoration:var(--link-hover-decoration, underline)}.wsx-link:focus{outline:2px solid var(--link-focus-color, var(--focus-color, #dc2626));outline-offset:2px}.wsx-link.active{color:var(--link-active-color, #6c757d);font-weight:var(--link-active-weight, bold)}:host([disabled]) .wsx-link{color:var(--link-disabled-color, #6c757d);cursor:not-allowed;pointer-events:none}:host([external]) .wsx-link:after{content:"↗";font-size:.8em;margin-left:.2em;opacity:.7}:host([variant="button"]) .wsx-link{background-color:var(--button-bg, #007bff);color:var(--button-color, white);padding:.5rem 1rem;border-radius:.25rem;text-decoration:none;display:inline-block}:host([variant="button"]) .wsx-link:hover{background-color:var(--button-hover-bg, #0056b3);color:var(--button-hover-color, white)}:host([variant="tab"]) .wsx-link{padding:.5rem 1rem;border-bottom:2px solid transparent;text-decoration:none}:host([variant="tab"]) .wsx-link.active{border-bottom-color:var(--tab-active-border, #007bff)}';
967
+ var oe, se;
968
+ let de, Se, ge;
969
+ function Q(n, e, t) {
970
+ return (e = ke(e)) in n ? Object.defineProperty(n, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : n[e] = t, n;
971
+ }
972
+ function Qe(n, e, t, r, g, v) {
973
+ function f(s, o, c) {
974
+ return function(i, u) {
975
+ return c && c(i), s[o].call(i, u);
1185
976
  };
1186
977
  }
1187
- function g(o, c) {
1188
- for (var f = 0; f < o.length; f++) o[f].call(c);
1189
- return c;
1190
- }
1191
- function u(o, c, f, h) {
1192
- if (typeof o != "function" && (h || o !== void 0)) throw new TypeError(c + " must " + (f || "be") + " a function" + (h ? "" : " or undefined"));
978
+ function _(s, o) {
979
+ for (var c = 0; c < s.length; c++) s[c].call(o);
1193
980
  return o;
1194
981
  }
1195
- function i(o, c, f, h, d, T, V, A, I, _, k, E, R) {
1196
- function j(b) {
1197
- if (!R(b)) throw new TypeError("Attempted to access private element on non-instance");
982
+ function b(s, o, c, i) {
983
+ if (typeof s != "function" && (i || s !== void 0)) throw new TypeError(o + " must " + (c || "be") + " a function" + (i ? "" : " or undefined"));
984
+ return s;
985
+ }
986
+ function T(s, o, c, i, u, A, k, R, P, E, L, p, m) {
987
+ function h(d) {
988
+ if (!m(d)) throw new TypeError("Attempted to access private element on non-instance");
1198
989
  }
1199
- var y, C = c[0], O = c[3], P = !A;
1200
- if (!P) {
1201
- f || Array.isArray(C) || (C = [C]);
1202
- var a = {}, S = [], L = d === 3 ? "get" : d === 4 || E ? "set" : "value";
1203
- _ ? (k || E ? a = { get: Ve(function() {
1204
- return O(this);
1205
- }, h, "get"), set: function(b) {
1206
- c[4](this, b);
1207
- } } : a[L] = O, k || Ve(a[L], h, d === 2 ? "" : L)) : k || (a = Object.getOwnPropertyDescriptor(o, h));
990
+ var l, x = o[0], C = o[3], W = !R;
991
+ if (!W) {
992
+ c || Array.isArray(x) || (x = [x]);
993
+ var a = {}, I = [], w = u === 3 ? "get" : u === 4 || p ? "set" : "value";
994
+ E ? (L || p ? a = { get: pe(function() {
995
+ return C(this);
996
+ }, i, "get"), set: function(d) {
997
+ o[4](this, d);
998
+ } } : a[w] = C, L || pe(a[w], i, u === 2 ? "" : w)) : L || (a = Object.getOwnPropertyDescriptor(s, i));
1208
999
  }
1209
- for (var w = o, q = C.length - 1; q >= 0; q -= f ? 2 : 1) {
1210
- var J = C[q], Q = f ? C[q - 1] : void 0, G = {}, D = { kind: ["field", "accessor", "method", "getter", "setter", "class"][d], name: h, metadata: T, addInitializer: (function(b, W) {
1211
- if (b.v) throw Error("attempted to call addInitializer after decoration was finished");
1212
- u(W, "An initializer", "be", !0), V.push(W);
1213
- }).bind(null, G) };
1000
+ for (var y = s, U = x.length - 1; U >= 0; U -= c ? 2 : 1) {
1001
+ var B = x[U], G = c ? x[U - 1] : void 0, K = {}, j = { kind: ["field", "accessor", "method", "getter", "setter", "class"][u], name: i, metadata: A, addInitializer: (function(d, S) {
1002
+ if (d.v) throw Error("attempted to call addInitializer after decoration was finished");
1003
+ b(S, "An initializer", "be", !0), k.push(S);
1004
+ }).bind(null, K) };
1214
1005
  try {
1215
- if (P) (y = u(J.call(Q, w, D), "class decorators", "return")) && (w = y);
1006
+ if (W) (l = b(B.call(G, y, j), "class decorators", "return")) && (y = l);
1216
1007
  else {
1217
- var M, F;
1218
- D.static = I, D.private = _, _ ? d === 2 ? M = function(b) {
1219
- return j(b), a.value;
1220
- } : (d < 4 && (M = m(a, "get", j)), d !== 3 && (F = m(a, "set", j))) : (M = function(b) {
1221
- return b[h];
1222
- }, (d < 2 || d === 4) && (F = function(b, W) {
1223
- b[h] = W;
1008
+ var M, z;
1009
+ j.static = P, j.private = E, E ? u === 2 ? M = function(d) {
1010
+ return h(d), a.value;
1011
+ } : (u < 4 && (M = f(a, "get", h)), u !== 3 && (z = f(a, "set", h))) : (M = function(d) {
1012
+ return d[i];
1013
+ }, (u < 2 || u === 4) && (z = function(d, S) {
1014
+ d[i] = S;
1224
1015
  }));
1225
- var X = D.access = { has: _ ? R.bind() : function(b) {
1226
- return h in b;
1016
+ var J = j.access = { has: E ? m.bind() : function(d) {
1017
+ return i in d;
1227
1018
  } };
1228
- if (M && (X.get = M), F && (X.set = F), w = J.call(Q, E ? { get: a.get, set: a.set } : a[L], D), E) {
1229
- if (typeof w == "object" && w) (y = u(w.get, "accessor.get")) && (a.get = y), (y = u(w.set, "accessor.set")) && (a.set = y), (y = u(w.init, "accessor.init")) && S.push(y);
1230
- else if (w !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
1231
- } else u(w, (k ? "field" : "method") + " decorators", "return") && (k ? S.push(w) : a[L] = w);
1019
+ if (M && (J.get = M), z && (J.set = z), y = B.call(G, p ? { get: a.get, set: a.set } : a[w], j), p) {
1020
+ if (typeof y == "object" && y) (l = b(y.get, "accessor.get")) && (a.get = l), (l = b(y.set, "accessor.set")) && (a.set = l), (l = b(y.init, "accessor.init")) && I.push(l);
1021
+ else if (y !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
1022
+ } else b(y, (L ? "field" : "method") + " decorators", "return") && (L ? I.push(y) : a[w] = y);
1232
1023
  }
1233
1024
  } finally {
1234
- G.v = !0;
1025
+ K.v = !0;
1235
1026
  }
1236
1027
  }
1237
- return (k || E) && A.push(function(b, W) {
1238
- for (var H = S.length - 1; H >= 0; H--) W = S[H].call(b, W);
1239
- return W;
1240
- }), k || P || (_ ? E ? A.push(m(a, "get"), m(a, "set")) : A.push(d === 2 ? a[L] : m.call.bind(a[L])) : Object.defineProperty(o, h, a)), w;
1241
- }
1242
- function p(o, c) {
1243
- return Object.defineProperty(o, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: c });
1244
- }
1245
- if (arguments.length >= 6) var v = l[Symbol.metadata || Symbol.for("Symbol.metadata")];
1246
- var z = Object.create(v ?? null), x = function(o, c, f, h) {
1247
- var d, T, V = [], A = function(L) {
1248
- return Wt(L) === o;
1249
- }, I = /* @__PURE__ */ new Map();
1250
- function _(L) {
1251
- L && V.push(g.bind(null, L));
1028
+ return (L || p) && R.push(function(d, S) {
1029
+ for (var N = I.length - 1; N >= 0; N--) S = I[N].call(d, S);
1030
+ return S;
1031
+ }), L || W || (E ? p ? R.push(f(a, "get"), f(a, "set")) : R.push(u === 2 ? a[w] : f.call.bind(a[w])) : Object.defineProperty(s, i, a)), y;
1032
+ }
1033
+ function O(s, o) {
1034
+ return Object.defineProperty(s, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: o });
1035
+ }
1036
+ if (arguments.length >= 6) var V = v[Symbol.metadata || Symbol.for("Symbol.metadata")];
1037
+ var D = Object.create(V ?? null), H = function(s, o, c, i) {
1038
+ var u, A, k = [], R = function(w) {
1039
+ return Ye(w) === s;
1040
+ }, P = /* @__PURE__ */ new Map();
1041
+ function E(w) {
1042
+ w && k.push(_.bind(null, w));
1252
1043
  }
1253
- for (var k = 0; k < c.length; k++) {
1254
- var E = c[k];
1255
- if (Array.isArray(E)) {
1256
- var R = E[1], j = E[2], y = E.length > 3, C = 16 & R, O = !!(8 & R), P = (R &= 7) == 0, a = j + "/" + O;
1257
- if (!P && !y) {
1258
- var S = I.get(a);
1259
- if (S === !0 || S === 3 && R !== 4 || S === 4 && R !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + j);
1260
- I.set(a, !(R > 2) || R);
1044
+ for (var L = 0; L < o.length; L++) {
1045
+ var p = o[L];
1046
+ if (Array.isArray(p)) {
1047
+ var m = p[1], h = p[2], l = p.length > 3, x = 16 & m, C = !!(8 & m), W = (m &= 7) == 0, a = h + "/" + C;
1048
+ if (!W && !l) {
1049
+ var I = P.get(a);
1050
+ if (I === !0 || I === 3 && m !== 4 || I === 4 && m !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h);
1051
+ P.set(a, !(m > 2) || m);
1261
1052
  }
1262
- i(O ? o : o.prototype, E, C, y ? "#" + j : Qe(j), R, h, O ? T = T || [] : d = d || [], V, O, y, P, R === 1, O && y ? A : f);
1053
+ T(C ? s : s.prototype, p, x, l ? "#" + h : ke(h), m, i, C ? A = A || [] : u = u || [], k, C, l, W, m === 1, C && l ? R : c);
1263
1054
  }
1264
1055
  }
1265
- return _(d), _(T), V;
1266
- }(t, e, s, z);
1267
- return n.length || p(t, z), { e: x, get c() {
1268
- var o = [];
1269
- return n.length && [p(i(t, [n], r, t.name, 5, z, o), z), g.bind(null, o, t)];
1056
+ return E(u), E(A), k;
1057
+ }(n, e, g, D);
1058
+ return t.length || O(n, D), { e: H, get c() {
1059
+ var s = [];
1060
+ return t.length && [O(T(n, [t], r, n.name, 5, D, s), D), _.bind(null, s, n)];
1270
1061
  } };
1271
1062
  }
1272
- function Qe(t) {
1273
- var e = St(t, "string");
1063
+ function ke(n) {
1064
+ var e = Xe(n, "string");
1274
1065
  return typeof e == "symbol" ? e : e + "";
1275
1066
  }
1276
- function St(t, e) {
1277
- if (typeof t != "object" || !t) return t;
1278
- var n = t[Symbol.toPrimitive];
1279
- if (n !== void 0) {
1280
- var r = n.call(t, e);
1067
+ function Xe(n, e) {
1068
+ if (typeof n != "object" || !n) return n;
1069
+ var t = n[Symbol.toPrimitive];
1070
+ if (t !== void 0) {
1071
+ var r = t.call(n, e);
1281
1072
  if (typeof r != "object") return r;
1282
1073
  throw new TypeError("@@toPrimitive must return a primitive value.");
1283
1074
  }
1284
- return (e === "string" ? String : Number)(t);
1075
+ return (e === "string" ? String : Number)(n);
1285
1076
  }
1286
- function Ve(t, e, n) {
1077
+ function pe(n, e, t) {
1287
1078
  typeof e == "symbol" && (e = (e = e.description) ? "[" + e + "]" : "");
1288
1079
  try {
1289
- Object.defineProperty(t, "name", { configurable: !0, value: n ? n + " " + e : e });
1080
+ Object.defineProperty(n, "name", { configurable: !0, value: t ? t + " " + e : e });
1290
1081
  } catch {
1291
1082
  }
1292
- return t;
1083
+ return n;
1293
1084
  }
1294
- function Wt(t) {
1295
- if (Object(t) !== t) throw TypeError("right-hand side of 'in' should be an object, got " + (t !== null ? typeof t : "null"));
1296
- return t;
1085
+ function Ye(n) {
1086
+ if (Object(n) !== n) throw TypeError("right-hand side of 'in' should be an object, got " + (n !== null ? typeof n : "null"));
1087
+ return n;
1297
1088
  }
1298
- function zt(t) {
1299
- return t;
1089
+ function Ze(n) {
1090
+ return n;
1300
1091
  }
1301
- const Ie = he("WsxLink");
1302
- Je = [we({
1092
+ const ve = ie("WsxLink");
1093
+ Se = [ce({
1303
1094
  tagName: "wsx-link"
1304
1095
  })];
1305
- let Pe;
1306
- new (Te = (ve = class extends Re {
1096
+ let me;
1097
+ new (ge = (se = class extends le {
1307
1098
  constructor() {
1308
- super(), B(this, "_autoStyles", Ct), B(this, "to", void 0), B(this, "replace", void 0), B(this, "activeClass", void 0), B(this, "exact", void 0), B(this, "handleClick", (i) => {
1309
- if (i.preventDefault(), !this.to) {
1310
- Ie.warn("No 'to' attribute specified");
1099
+ super(), Q(this, "_autoStyles", Je), Q(this, "to", void 0), Q(this, "activeClass", void 0), Q(this, "handleClick", (v) => {
1100
+ if (v.preventDefault(), !this.to) {
1101
+ ve.warn("No 'to' attribute specified");
1311
1102
  return;
1312
1103
  }
1313
1104
  if (this.isExternalLink(this.to)) {
1314
1105
  window.open(this.to, "_blank");
1315
1106
  return;
1316
1107
  }
1317
- this.replace ? window.history.replaceState(null, "", this.to) : window.history.pushState(null, "", this.to), window.dispatchEvent(new PopStateEvent("popstate")), Ie.debug(`Navigated to: ${this.to}`);
1318
- }), B(this, "updateActiveState", () => {
1319
- var z;
1320
- const i = window.location.pathname, p = this.exact ? i === this.to : i.startsWith(this.to) && this.to !== "/", v = (z = this.shadowRoot) == null ? void 0 : z.querySelector("a");
1321
- v && (p ? (v.classList.add(this.activeClass), this.setAttribute("active", "")) : (v.classList.remove(this.activeClass), this.removeAttribute("active")));
1108
+ this.replace ? window.history.replaceState(null, "", this.to) : window.history.pushState(null, "", this.to), window.dispatchEvent(new PopStateEvent("popstate")), ve.debug(`Navigated to: ${this.to}`);
1109
+ }), Q(this, "updateActiveState", () => {
1110
+ var b;
1111
+ const v = window.location.pathname, f = this.exact ? v === this.to : v.startsWith(this.to) && this.to !== "/", _ = (b = this.shadowRoot) == null ? void 0 : b.querySelector("a");
1112
+ _ && (f ? (_.classList.add(this.activeClass), this.setAttribute("active", "")) : (_.classList.remove(this.activeClass), this.removeAttribute("active")));
1322
1113
  });
1323
- const [e, n] = this.useState("to", "");
1114
+ const [e, t] = this.useState("to", "");
1324
1115
  Object.defineProperty(this, "to", {
1325
1116
  get: e,
1326
- set: n,
1327
- enumerable: !0,
1328
- configurable: !0
1329
- });
1330
- const [r, s] = this.useState("replace", !1);
1331
- Object.defineProperty(this, "replace", {
1332
- get: r,
1333
- set: s,
1117
+ set: t,
1334
1118
  enumerable: !0,
1335
1119
  configurable: !0
1336
1120
  });
1337
- const [l, m] = this.useState("activeClass", "active");
1121
+ const [r, g] = this.useState("activeClass", "active");
1338
1122
  Object.defineProperty(this, "activeClass", {
1339
- get: l,
1340
- set: m,
1341
- enumerable: !0,
1342
- configurable: !0
1343
- });
1344
- const [g, u] = this.useState("exact", !1);
1345
- Object.defineProperty(this, "exact", {
1346
- get: g,
1347
- set: u,
1123
+ get: r,
1124
+ set: g,
1348
1125
  enumerable: !0,
1349
1126
  configurable: !0
1350
1127
  });
1351
1128
  }
1129
+ get replace() {
1130
+ return this.hasAttribute("replace");
1131
+ }
1132
+ get exact() {
1133
+ return this.hasAttribute("exact");
1134
+ }
1352
1135
  render() {
1353
- return /* @__PURE__ */ ae("a", { href: this.to, class: "wsx-link", onClick: this.handleClick, part: "link" }, /* @__PURE__ */ ae("slot", null));
1136
+ return /* @__PURE__ */ te("a", { href: this.to, class: "wsx-link", onClick: this.handleClick, part: "link" }, /* @__PURE__ */ te("slot", null));
1354
1137
  }
1355
1138
  onConnected() {
1356
- this.to = this.getAttribute("to") || "", this.replace = this.hasAttribute("replace"), this.activeClass = this.getAttribute("active-class") || "active", this.exact = this.hasAttribute("exact");
1139
+ this.to = this.to || "", this.activeClass = this.activeClass || "active";
1357
1140
  const e = this.shadowRoot.querySelector(".wsx-link");
1358
1141
  e && (e.href = this.to), window.addEventListener("popstate", this.updateActiveState), document.addEventListener("route-changed", this.updateActiveState), this.updateActiveState();
1359
1142
  }
1360
1143
  onDisconnected() {
1361
1144
  window.removeEventListener("popstate", this.updateActiveState), document.removeEventListener("route-changed", this.updateActiveState);
1362
1145
  }
1363
- onAttributeChanged(e, n, r) {
1146
+ onAttributeChanged(e, t, r) {
1364
1147
  switch (e) {
1365
1148
  case "to":
1366
1149
  this.to = r || "", this.updateActiveState();
@@ -1388,14 +1171,14 @@ new (Te = (ve = class extends Re {
1388
1171
  cancelable: !0
1389
1172
  }));
1390
1173
  }
1391
- }, [Pe, Ae] = Ot(ve, [], Je, 0, void 0, Re).c, ve), pe = class extends zt {
1174
+ }, [me, de] = Qe(se, [], Se, 0, void 0, le).c, se), oe = class extends Ze {
1392
1175
  constructor() {
1393
- super(Pe), B(this, "observedAttributes", ["to", "replace", "active-class", "exact"]), Ae();
1176
+ super(me), Q(this, "observedAttributes", ["to", "replace", "active-class", "exact"]), de();
1394
1177
  }
1395
- }, B(pe, Te, void 0), pe)();
1178
+ }, Q(oe, ge, void 0), oe)();
1396
1179
  export {
1397
- le as RouterUtils,
1398
- Pe as WsxLink,
1399
- Rt as WsxRouter,
1400
- ze as WsxView
1180
+ ne as RouterUtils,
1181
+ me as WsxLink,
1182
+ ze as WsxRouter,
1183
+ Ge as WsxView
1401
1184
  };