@manyducks.co/dolla 2.0.0-alpha.30 → 2.0.0-alpha.31

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,29 +1,430 @@
1
- var it = Object.defineProperty;
2
- var qe = (o) => {
1
+ var ue = Object.defineProperty;
2
+ var Gt = (o) => {
3
3
  throw TypeError(o);
4
4
  };
5
- var at = (o, e, t) => e in o ? it(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
6
- var d = (o, e, t) => at(o, typeof e != "symbol" ? e + "" : e, t), De = (o, e, t) => e.has(o) || qe("Cannot " + t);
7
- var i = (o, e, t) => (De(o, e, "read from private field"), t ? t.call(o) : e.get(o)), l = (o, e, t) => e.has(o) ? qe("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, t), m = (o, e, t, s) => (De(o, e, "write to private field"), s ? s.call(o, t) : e.set(o, t), t), u = (o, e, t) => (De(o, e, "access private method"), t);
8
- var ee = (o, e, t, s) => ({
5
+ var fe = (o, t, e) => t in o ? ue(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
6
+ var d = (o, t, e) => fe(o, typeof t != "symbol" ? t + "" : t, e), Pt = (o, t, e) => t.has(o) || Gt("Cannot " + e);
7
+ var i = (o, t, e) => (Pt(o, t, "read from private field"), e ? e.call(o) : t.get(o)), l = (o, t, e) => t.has(o) ? Gt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(o) : t.set(o, e), m = (o, t, e, s) => (Pt(o, t, "write to private field"), s ? s.call(o, e) : t.set(o, e), e), f = (o, t, e) => (Pt(o, t, "access private method"), e);
8
+ var et = (o, t, e, s) => ({
9
9
  set _(n) {
10
- m(o, e, n, t);
10
+ m(o, t, n, e);
11
11
  },
12
12
  get _() {
13
- return i(o, e, s);
13
+ return i(o, t, s);
14
14
  }
15
15
  });
16
- import { i as Z, c as Ie, d as x, a as E, b as ot, e as re, t as We, f as Je, g as lt, s as Ae, h as Ge, P as Xe, j as He, k as ht, l as Be, p as ct, m as ze, S as ut, n as ft, o as dt, q as mt, r as wt, u as pt, C as gt, v as yt, w as Fe, x as bt, y as Ke, z as $t, A as $e, B as ve, V as vt, D as Et, E as kt } from "./passthrough-d2lcM0cd.js";
17
- import { F as Zt, J as es, H as ts, I as ss, G as rs } from "./passthrough-d2lcM0cd.js";
18
- var I, Se, Re, ne, R, _;
19
- class St {
20
- constructor(e) {
21
- l(this, R);
22
- l(this, I, []);
23
- l(this, Se, Rt());
24
- l(this, Re);
25
- l(this, ne);
26
- m(this, Re, e), m(this, ne, e.createLogger("Dolla.http"));
16
+ import { a as Zt, b as de, i as nt, I as te, c as me, d as At, e as x, s as Ht, f as v, g as tt, P as ee, h as we, t as Bt, j as zt, k as pe, l as Kt, p as ge, m as Qt, S as ye, n as be, o as $e, q as Ee, r as ve, u as ke, C as Re, v as Se, w as Tt, x as _e, y as Jt, z as Le, A as vt, B as kt, V as Me, D as xe, E as Fe } from "./markup-D1i09ddt.js";
17
+ import { F as hs, K as cs, H as us, J as fs, G as ds } from "./markup-D1i09ddt.js";
18
+ function rt(o) {
19
+ return Zt(o, "Expected `path` to be a string. Got type: %t, value: %v"), o.split("/").map((t) => t.trim()).filter((t) => t !== "");
20
+ }
21
+ function z(o) {
22
+ var e;
23
+ de(
24
+ (s) => nt(s == null ? void 0 : s.toString),
25
+ o,
26
+ "Expected `parts` to be an array of objects with a .toString() method. Got type: %t, value: %v"
27
+ ), o = o.filter((s) => s).flatMap(String);
28
+ let t = (e = o.shift()) == null ? void 0 : e.toString();
29
+ if (t) {
30
+ for (const s of o.map((n) => n.toString()))
31
+ s.startsWith(".") ? t = Rt(t, s) : t[t.length - 1] !== "/" ? s[0] !== "/" ? t += "/" + s : t += s : s[0] === "/" ? t += s.slice(1) : t += s;
32
+ t && t !== "/" && t.endsWith("/") && (t = t.slice(0, t.length - 1));
33
+ }
34
+ return t ?? "";
35
+ }
36
+ function Rt(o, t) {
37
+ if (Zt(o, "Expected `base` to be a string. Got type: %t, value: %v"), t == null && (t = o, o = ""), t.startsWith("/"))
38
+ return t;
39
+ let e = o;
40
+ for (; ; )
41
+ if (t.startsWith("..")) {
42
+ for (let s = e.length; s > 0; --s)
43
+ if (e[s] === "/" || s === 0) {
44
+ e = e.slice(0, s), t = t.replace(/^\.\.\/?/, "");
45
+ break;
46
+ }
47
+ } else if (t.startsWith("."))
48
+ t = t.replace(/^\.\/?/, "");
49
+ else
50
+ break;
51
+ return z([e, t]);
52
+ }
53
+ function De(o) {
54
+ if (!o) return {};
55
+ o.startsWith("?") && (o = o.slice(1));
56
+ const t = o.split("&").filter((e) => e.trim() !== "").map((e) => {
57
+ const [s, n] = e.split("=").map((r) => r.trim());
58
+ return n.toLowerCase() === "true" ? [s, !0] : n.toLowerCase() === "false" ? [s, !1] : isNaN(Number(n)) ? [s, n] : [s, Number(n)];
59
+ });
60
+ return Object.fromEntries(t);
61
+ }
62
+ function se(o, t, e = {}) {
63
+ var a;
64
+ const [s, n] = t.split("?"), r = rt(s);
65
+ t: for (const c of o) {
66
+ const { fragments: h } = c;
67
+ if (!(((a = h[h.length - 1]) == null ? void 0 : a.type) === 3) && h.length !== r.length || e.willMatch && !e.willMatch(c))
68
+ continue t;
69
+ const E = [];
70
+ e: for (let u = 0; u < h.length; u++) {
71
+ const D = r[u], R = h[u];
72
+ if (D == null && R.type !== 3)
73
+ continue t;
74
+ switch (R.type) {
75
+ case 1:
76
+ if (R.name.toLowerCase() === D.toLowerCase()) {
77
+ E.push(R);
78
+ break;
79
+ } else
80
+ continue t;
81
+ case 2:
82
+ E.push({ ...R, value: D });
83
+ break;
84
+ case 3:
85
+ E.push({ ...R, value: r.slice(u).join("/") });
86
+ break e;
87
+ case 4:
88
+ if (isNaN(Number(D)))
89
+ continue t;
90
+ E.push({ ...R, value: Number(D) });
91
+ break;
92
+ default:
93
+ throw new Error(`Unknown fragment type: ${R.type}`);
94
+ }
95
+ }
96
+ const k = {};
97
+ for (const u of E)
98
+ u.type === 2 && (k[u.name] = decodeURIComponent(u.value)), u.type === 4 && (k[u.name] = u.value), u.type === 3 && (k.wildcard = "/" + decodeURIComponent(u.value));
99
+ return {
100
+ path: "/" + E.map((u) => u.value).join("/"),
101
+ pattern: "/" + h.map((u) => u.type === 2 ? `{${u.name}}` : u.type === 4 ? `{#${u.name}}` : u.name).join("/"),
102
+ params: k,
103
+ query: De(n),
104
+ meta: c.meta
105
+ };
106
+ }
107
+ }
108
+ function Pe(o) {
109
+ const t = [], e = [], s = [], n = [];
110
+ for (const a of o) {
111
+ const { fragments: c } = a;
112
+ c.some(
113
+ (h) => h.type === 3
114
+ /* Wildcard */
115
+ ) ? n.push(a) : c.some(
116
+ (h) => h.type === 4
117
+ /* NumericParam */
118
+ ) ? e.push(a) : c.some(
119
+ (h) => h.type === 2
120
+ /* Param */
121
+ ) ? s.push(a) : t.push(a);
122
+ }
123
+ const r = (a, c) => a.fragments.length > c.fragments.length ? -1 : 1;
124
+ return t.sort(r), e.sort(r), s.sort(r), n.sort(r), [...t, ...e, ...s, ...n];
125
+ }
126
+ function Te(o) {
127
+ const t = rt(o), e = [];
128
+ for (let s = 0; s < t.length; s++) {
129
+ const n = t[s];
130
+ if (n === "*") {
131
+ if (s !== t.length - 1)
132
+ throw new Error(`Wildcard must be at the end of a pattern. Received: ${o}`);
133
+ e.push({
134
+ type: 3,
135
+ name: "*",
136
+ value: null
137
+ });
138
+ } else n.at(0) === "{" && n.at(-1) === "}" ? e.push({
139
+ type: n[1] === "#" ? 4 : 2,
140
+ name: n[1] === "#" ? n.slice(2, -1) : n.slice(1, -1),
141
+ value: null
142
+ }) : e.push({
143
+ type: 1,
144
+ name: n,
145
+ value: n
146
+ });
147
+ }
148
+ return e;
149
+ }
150
+ function rs(o) {
151
+ return new Ue(o);
152
+ }
153
+ const re = Symbol.for("DollaRouterMountMethod"), ne = Symbol.for("DollaRouterUnmountMethod");
154
+ function Ot(o) {
155
+ return (o == null ? void 0 : o[te]) === !0;
156
+ }
157
+ async function Oe(o, t) {
158
+ return o[re](t);
159
+ }
160
+ async function Ne(o) {
161
+ return o[ne]();
162
+ }
163
+ var Yt, K, L, _t, P, Q, it, I, q, T, at, p, Nt, ie, ae, st, Ut, oe, Ct;
164
+ class Ue {
165
+ constructor(t) {
166
+ l(this, p);
167
+ d(this, Yt, !0);
168
+ l(this, K);
169
+ l(this, L);
170
+ l(this, _t, 0);
171
+ l(this, P, []);
172
+ l(this, Q, []);
173
+ l(this, it, !1);
174
+ /**
175
+ * Use hash routing when true. Configured in router options.
176
+ */
177
+ l(this, I, !1);
178
+ // Callbacks that need to be called on unmount.
179
+ l(this, q, []);
180
+ /**
181
+ * The current match object.
182
+ */
183
+ l(this, T);
184
+ l(this, at);
185
+ /**
186
+ * The currently matched route pattern, if any.
187
+ */
188
+ d(this, "$pattern");
189
+ /**
190
+ * The current URL path.
191
+ */
192
+ d(this, "$path");
193
+ /**
194
+ * The current named path params.
195
+ */
196
+ d(this, "$params");
197
+ /**
198
+ * The current query params. Changes to this object will be reflected in the URL.
199
+ */
200
+ d(this, "$query");
201
+ me(t, "Options must be an object. Got: %t"), [et(this, T)._, et(this, at)._] = At(), this.$pattern = x([i(this, T)], (e) => e == null ? void 0 : e.pattern), this.$path = x([i(this, T)], (e) => (e == null ? void 0 : e.path) ?? window.location.pathname), this.$params = x([i(this, T)], (e) => (e == null ? void 0 : e.params) ?? {}, { equals: Ht }), this.$query = x([i(this, T)], (e) => (e == null ? void 0 : e.query) ?? {}, { equals: Ht }), t.hash && m(this, I, !0), m(this, Q, Pe(
202
+ t.routes.flatMap((e) => f(this, p, Ct).call(this, e)).map((e) => ({
203
+ pattern: e.pattern,
204
+ meta: e.meta,
205
+ fragments: Te(e.pattern)
206
+ }))
207
+ )), qe(i(this, Q));
208
+ }
209
+ async [(Yt = te, re)](t) {
210
+ m(this, K, t), m(this, L, t.createLogger("Dolla.router"));
211
+ const e = () => {
212
+ f(this, p, st).call(this);
213
+ };
214
+ window.addEventListener("popstate", e), i(this, q).push(() => window.removeEventListener("popstate", e));
215
+ const s = t.getRootElement();
216
+ i(this, q).push(
217
+ Ve(s, (n) => {
218
+ let r = n.getAttribute("href");
219
+ i(this, L).info("intercepted click on <a> tag", n), /^https?:\/\/|^\//.test(r) || (r = z([window.location.pathname, r])), f(this, p, Nt).call(this, r);
220
+ })
221
+ ), i(this, L).info("will intercept clicks on <a> tags within root element", s), m(this, it, !0), await f(this, p, st).call(this);
222
+ }
223
+ async [ne]() {
224
+ for (const t of i(this, q))
225
+ t();
226
+ m(this, q, []);
227
+ }
228
+ /**
229
+ * Navigate backward. Pass a number of steps to hit the back button that many times.
230
+ */
231
+ back(t = 1) {
232
+ window.history.go(-t);
233
+ }
234
+ /**
235
+ * Navigate forward. Pass a number of steps to hit the forward button that many times.
236
+ */
237
+ forward(t = 1) {
238
+ window.history.go(t);
239
+ }
240
+ /**
241
+ * Navigates to another route.
242
+ *
243
+ * @example
244
+ * Dolla.router.go("/login"); // navigate to `/login`
245
+ * Dolla.router.go["/users", 215], { replace: true }); // replace current history entry with `/users/215`
246
+ */
247
+ go(t, e = {}) {
248
+ if (i(this, K) == null)
249
+ throw new Error("Routa methods won't work until you register it: Dolla.use(Routa, { /* ...options */ })");
250
+ let s;
251
+ Array.isArray(t) ? s = z(t) : s = t.toString(), s = Rt(window.location.pathname, s), e.preserveQuery && (s += window.location.search), e.replace ? f(this, p, ie).call(this, s) : f(this, p, Nt).call(this, s);
252
+ }
253
+ }
254
+ K = new WeakMap(), L = new WeakMap(), _t = new WeakMap(), P = new WeakMap(), Q = new WeakMap(), it = new WeakMap(), I = new WeakMap(), q = new WeakMap(), T = new WeakMap(), at = new WeakMap(), p = new WeakSet(), Nt = function(t, e) {
255
+ var s;
256
+ (s = i(this, L)) == null || s.info("(push)", t), window.history.pushState(e, "", i(this, I) ? "/#" + t : t), f(this, p, st).call(this, t);
257
+ }, ie = function(t, e) {
258
+ var s;
259
+ (s = i(this, L)) == null || s.info("(replace)", t), window.history.replaceState(e, "", i(this, I) ? "/#" + t : t), f(this, p, st).call(this, t);
260
+ }, ae = function() {
261
+ return i(this, I) ? new URL(window.location.hash.slice(1), window.location.origin) : new URL(window.location.pathname, window.location.origin);
262
+ }, st = async function(t) {
263
+ var c;
264
+ const e = i(this, L), s = (c = i(this, K)) == null ? void 0 : c.getRootView(), n = t ? new URL(t, window.location.origin) : f(this, p, ae).call(this), { match: r, journey: a } = await f(this, p, Ut).call(this, n);
265
+ for (const h of a)
266
+ switch (h.kind) {
267
+ case "match":
268
+ e == null || e.info(`📍 ${h.message}`);
269
+ break;
270
+ case "redirect":
271
+ e == null || e.info(`↩️ ${h.message}`);
272
+ break;
273
+ case "miss":
274
+ e == null || e.info(`💀 ${h.message}`);
275
+ break;
276
+ }
277
+ if (r) {
278
+ const h = this.$pattern.get();
279
+ i(this, at).call(this, r), s && r.pattern !== h && f(this, p, oe).call(this, s, r);
280
+ } else
281
+ i(this, it) && e.crash(new We(`Failed to match route '${n.pathname}'`));
282
+ return { match: r, journey: a };
283
+ }, Ut = async function(t, e = []) {
284
+ const s = se(i(this, Q), t.pathname);
285
+ if (!s)
286
+ return {
287
+ match: null,
288
+ journey: [...e, { kind: "miss", message: `no match for '${t.pathname}'` }]
289
+ };
290
+ let n = s.meta.redirect;
291
+ if (s.meta.beforeMatch && await s.meta.beforeMatch({
292
+ // TODO: Allow setting context variables from here? Would apply to the context of the matched view.
293
+ redirect: (r) => {
294
+ n = r;
295
+ }
296
+ }), n != null) {
297
+ let r;
298
+ if (v(n))
299
+ r = Ie(n, s.params);
300
+ else if (nt(n)) {
301
+ const a = {
302
+ path: s.path,
303
+ pattern: s.pattern,
304
+ params: s.params,
305
+ query: s.query
306
+ };
307
+ if (r = await n(a), !v(r))
308
+ throw new Error("Redirect function must return a path to redirect to.");
309
+ r.startsWith("/") || (r = Rt(s.path, r));
310
+ } else
311
+ throw new TypeError("Redirect must either be a path string or a function.");
312
+ return f(this, p, Ut).call(this, new URL(r, window.location.origin), [
313
+ ...e,
314
+ { kind: "redirect", message: `redirecting '${s.path}' -> '${r}'` }
315
+ ]);
316
+ } else
317
+ return { match: s, journey: [...e, { kind: "match", message: `matched route '${s.path}'` }] };
318
+ }, /**
319
+ * Takes a matched route and mounts it.
320
+ */
321
+ oe = function(t, e) {
322
+ const s = e.meta.layers;
323
+ for (let n = 0; n < s.length; n++) {
324
+ const r = s[n], a = i(this, P)[n];
325
+ if ((a == null ? void 0 : a.id) !== r.id) {
326
+ m(this, P, i(this, P).slice(0, n)), a == null || a.view.unmount();
327
+ const c = i(this, P).at(-1), w = ((c == null ? void 0 : c.view) ?? t).setChildView(r.view);
328
+ i(this, P).push({ id: r.id, view: w });
329
+ }
330
+ }
331
+ }, /**
332
+ * Parses a route definition object into a set of matchable routes.
333
+ *
334
+ * @param route - Route config object.
335
+ * @param layers - Array of parent layers. Passed when this function calls itself on nested routes.
336
+ */
337
+ Ct = function(t, e = [], s = []) {
338
+ if (!tt(t) || !v(t.path))
339
+ throw new TypeError(`Route configs must be objects with a 'path' string property. Got: ${t}`);
340
+ if (t.redirect && t.routes)
341
+ throw new Error("Route cannot have both a 'redirect' and nested 'routes'.");
342
+ if (t.redirect && t.view)
343
+ throw new Error("Route cannot have both a 'redirect' and a 'view'.");
344
+ if (!t.view && !t.routes && !t.redirect)
345
+ throw new Error("Route must have a 'view', a 'redirect', or a set of nested 'routes'.");
346
+ let n = [];
347
+ for (const h of e)
348
+ n.push(...rt(h.path));
349
+ n.push(...rt(t.path)), n[n.length - 1] === "*" && n.pop();
350
+ const r = [];
351
+ if (t.redirect) {
352
+ let h = t.redirect;
353
+ return v(h) && (h = Rt(z(n), h), h.startsWith("/") || (h = "/" + h)), r.push({
354
+ pattern: "/" + z([...n, ...rt(t.path)]),
355
+ meta: {
356
+ redirect: h
357
+ }
358
+ }), r;
359
+ }
360
+ let a = ee;
361
+ if (nt(t.view))
362
+ a = t.view;
363
+ else if (t.view)
364
+ throw new TypeError(`Route '${t.path}' expected a view function or undefined. Got: ${t.view}`);
365
+ const c = { id: et(this, _t)._++, view: a };
366
+ if (t.routes)
367
+ for (const h of t.routes)
368
+ r.push(...f(this, p, Ct).call(this, h, [...e, t], [...s, c]));
369
+ else
370
+ r.push({
371
+ pattern: parent ? z([...e.map((h) => h.path), t.path]) : t.path,
372
+ meta: {
373
+ pattern: t.path,
374
+ layers: [...s, c],
375
+ beforeMatch: t.beforeMatch
376
+ }
377
+ });
378
+ return r;
379
+ };
380
+ const Ce = /(noopener|noreferrer) (noopener|noreferrer)/, je = /^[\w-_]+:/;
381
+ function Ve(o, t, e = window) {
382
+ function s(r) {
383
+ return !r || r === o ? null : r.localName !== "a" || r.href === void 0 ? s(r.parentNode) : r;
384
+ }
385
+ function n(r) {
386
+ if (r.button && r.button !== 0 || r.ctrlKey || r.metaKey || r.altKey || r.shiftKey || r.defaultPrevented)
387
+ return;
388
+ const a = s(r.target);
389
+ a && (e.location.protocol !== a.protocol || e.location.hostname !== a.hostname || e.location.port !== a.port || a.hasAttribute("data-router-ignore") || a.hasAttribute("download") || a.getAttribute("target") === "_blank" && Ce.test(a.getAttribute("rel")) || je.test(a.getAttribute("href")) || (r.preventDefault(), t(a)));
390
+ }
391
+ return o.addEventListener("click", n), function() {
392
+ o.removeEventListener("click", n);
393
+ };
394
+ }
395
+ function Ie(o, t) {
396
+ for (const e in t) {
397
+ const s = t[e].toString();
398
+ o = o.replace(`{${e}}`, s).replace(`{#${e}}`, s);
399
+ }
400
+ return o;
401
+ }
402
+ function qe(o) {
403
+ for (const t of o)
404
+ if (t.meta.redirect) {
405
+ let e;
406
+ if (!nt(t.meta.redirect)) if (v(t.meta.redirect)) {
407
+ if (e = t.meta.redirect, !se(o, e, {
408
+ willMatch(n) {
409
+ return n !== t;
410
+ }
411
+ }))
412
+ throw new Error(`Found a redirect to an undefined URL. From '${t.pattern}' to '${t.meta.redirect}'`);
413
+ } else
414
+ throw new TypeError(`Expected a string or redirect function. Got: ${t.meta.redirect}`);
415
+ }
416
+ }
417
+ class We extends Error {
418
+ }
419
+ var W, Lt, Mt, ot, S, _;
420
+ class Ae {
421
+ constructor(t) {
422
+ l(this, S);
423
+ l(this, W, []);
424
+ l(this, Lt, Ge());
425
+ l(this, Mt);
426
+ l(this, ot);
427
+ m(this, Mt, t), m(this, ot, t.createLogger("Dolla.http"));
27
428
  }
28
429
  /**
29
430
  * Adds a new middleware that will apply to subsequent requests.
@@ -31,136 +432,136 @@ class St {
31
432
  *
32
433
  * @param middleware - A middleware function that will intercept requests.
33
434
  */
34
- use(e) {
35
- return i(this, I).push(e), () => {
36
- i(this, I).splice(i(this, I).indexOf(e), 1);
435
+ use(t) {
436
+ return i(this, W).push(t), () => {
437
+ i(this, W).splice(i(this, W).indexOf(t), 1);
37
438
  };
38
439
  }
39
- async get(e, t) {
40
- return u(this, R, _).call(this, "get", e, t);
440
+ async get(t, e) {
441
+ return f(this, S, _).call(this, "get", t, e);
41
442
  }
42
- async put(e, t) {
43
- return u(this, R, _).call(this, "put", e, t);
443
+ async put(t, e) {
444
+ return f(this, S, _).call(this, "put", t, e);
44
445
  }
45
- async patch(e, t) {
46
- return u(this, R, _).call(this, "patch", e, t);
446
+ async patch(t, e) {
447
+ return f(this, S, _).call(this, "patch", t, e);
47
448
  }
48
- async post(e, t) {
49
- return u(this, R, _).call(this, "post", e, t);
449
+ async post(t, e) {
450
+ return f(this, S, _).call(this, "post", t, e);
50
451
  }
51
- async delete(e, t) {
52
- return u(this, R, _).call(this, "delete", e, t);
452
+ async delete(t, e) {
453
+ return f(this, S, _).call(this, "delete", t, e);
53
454
  }
54
- async head(e, t) {
55
- return u(this, R, _).call(this, "head", e, t);
455
+ async head(t, e) {
456
+ return f(this, S, _).call(this, "head", t, e);
56
457
  }
57
- async options(e, t) {
58
- return u(this, R, _).call(this, "options", e, t);
458
+ async options(t, e) {
459
+ return f(this, S, _).call(this, "options", t, e);
59
460
  }
60
- async trace(e, t) {
61
- return u(this, R, _).call(this, "trace", e, t);
461
+ async trace(t, e) {
462
+ return f(this, S, _).call(this, "trace", t, e);
62
463
  }
63
464
  }
64
- I = new WeakMap(), Se = new WeakMap(), Re = new WeakMap(), ne = new WeakMap(), R = new WeakSet(), _ = async function(e, t, s) {
65
- return new Mt({
465
+ W = new WeakMap(), Lt = new WeakMap(), Mt = new WeakMap(), ot = new WeakMap(), S = new WeakSet(), _ = async function(t, e, s) {
466
+ return new ze({
66
467
  ...s,
67
- method: e,
68
- uri: t,
69
- middleware: i(this, I),
70
- fetch: i(this, Se),
71
- logger: i(this, ne)
468
+ method: t,
469
+ uri: e,
470
+ middleware: i(this, W),
471
+ fetch: i(this, Lt),
472
+ logger: i(this, ot)
72
473
  }).fetch();
73
474
  };
74
- function Rt() {
475
+ function Ge() {
75
476
  if (typeof window < "u" && window.fetch)
76
477
  return window.fetch.bind(window);
77
478
  if (typeof global < "u" && global.fetch)
78
479
  return global.fetch.bind(global);
79
480
  throw new Error("Running in neither browser nor node. Please run this app in one of the supported environments.");
80
481
  }
81
- class _t extends Error {
82
- constructor(t) {
83
- const { status: s, statusText: n, method: r, url: a } = t, f = `${s} ${n}: Request failed (${r.toUpperCase()} ${a.toString()})`;
84
- super(f);
482
+ class He extends Error {
483
+ constructor(e) {
484
+ const { status: s, statusText: n, method: r, url: a } = e, c = `${s} ${n}: Request failed (${r.toUpperCase()} ${a.toString()})`;
485
+ super(c);
85
486
  d(this, "response");
86
- this.response = t;
487
+ this.response = e;
87
488
  }
88
489
  }
89
- class Lt {
90
- constructor(e) {
490
+ class Be {
491
+ constructor(t) {
91
492
  d(this, "method");
92
493
  d(this, "url");
93
494
  d(this, "headers", new Headers());
94
495
  d(this, "body");
95
- this.method = e.method, this.body = e.body, e.uri.startsWith("http") ? this.url = new URL(e.uri) : this.url = new URL(e.uri, window.location.origin), this._applyHeaders(e.headers), this._applyQueryParams(e.query);
496
+ this.method = t.method, this.body = t.body, t.uri.startsWith("http") ? this.url = new URL(t.uri) : this.url = new URL(t.uri, window.location.origin), this._applyHeaders(t.headers), this._applyQueryParams(t.query);
96
497
  }
97
498
  get isSameOrigin() {
98
499
  return this.url.origin === window.location.origin;
99
500
  }
100
- _applyHeaders(e) {
101
- if (e != null)
102
- if (e instanceof Map || e instanceof Headers)
103
- e.forEach((t, s) => {
104
- this.headers.set(s, t);
501
+ _applyHeaders(t) {
502
+ if (t != null)
503
+ if (t instanceof Map || t instanceof Headers)
504
+ t.forEach((e, s) => {
505
+ this.headers.set(s, e);
105
506
  });
106
- else if (Z(e))
107
- for (const t in e) {
108
- const s = e[t];
109
- s instanceof Date ? this.headers.set(t, s.toISOString()) : s != null && this.headers.set(t, String(s));
507
+ else if (tt(t))
508
+ for (const e in t) {
509
+ const s = t[e];
510
+ s instanceof Date ? this.headers.set(e, s.toISOString()) : s != null && this.headers.set(e, String(s));
110
511
  }
111
512
  else
112
- throw new TypeError(`Unknown headers type. Got: ${e}`);
513
+ throw new TypeError(`Unknown headers type. Got: ${t}`);
113
514
  }
114
- _applyQueryParams(e) {
115
- if (e != null)
116
- if (e instanceof Map || e instanceof URLSearchParams)
117
- e.forEach((t, s) => {
118
- this.url.searchParams.set(s, t);
515
+ _applyQueryParams(t) {
516
+ if (t != null)
517
+ if (t instanceof Map || t instanceof URLSearchParams)
518
+ t.forEach((e, s) => {
519
+ this.url.searchParams.set(s, e);
119
520
  });
120
- else if (Z(e))
121
- for (const t in e) {
122
- const s = e[t];
123
- s instanceof Date ? this.url.searchParams.set(t, s.toISOString()) : s != null && this.url.searchParams.set(t, String(s));
521
+ else if (tt(t))
522
+ for (const e in t) {
523
+ const s = t[e];
524
+ s instanceof Date ? this.url.searchParams.set(e, s.toISOString()) : s != null && this.url.searchParams.set(e, String(s));
124
525
  }
125
526
  else
126
- throw new TypeError(`Unknown query params type. Got: ${e}`);
527
+ throw new TypeError(`Unknown query params type. Got: ${t}`);
127
528
  }
128
529
  }
129
- class Mt {
130
- constructor(e) {
530
+ class ze {
531
+ constructor(t) {
131
532
  d(this, "_middleware");
132
533
  d(this, "_fetch");
133
534
  d(this, "_request");
134
535
  d(this, "_response");
135
- this._middleware = e.middleware, this._fetch = e.fetch, this._request = new Lt(e);
536
+ this._middleware = t.middleware, this._fetch = t.fetch, this._request = new Be(t);
136
537
  }
137
538
  async fetch() {
138
539
  if (this._middleware.length > 0) {
139
- const e = (t = 0) => {
140
- const s = this._middleware[t], n = this._middleware[t + 1] ? e(t + 1) : this._handler.bind(this);
540
+ const t = (e = 0) => {
541
+ const s = this._middleware[e], n = this._middleware[e + 1] ? t(e + 1) : this._handler.bind(this);
141
542
  return async () => s(this._request, async () => (await n(), this._response));
142
543
  };
143
- await e()();
544
+ await t()();
144
545
  } else
145
546
  await this._handler();
146
547
  if (this._response.status < 200 || this._response.status >= 400)
147
- throw new _t(this._response);
548
+ throw new He(this._response);
148
549
  return this._response;
149
550
  }
150
551
  // This is the function that performs the actual request after the final middleware.
151
552
  async _handler() {
152
- let e;
153
- const t = this._request;
154
- !t.headers.has("content-type") && Z(t.body) ? (t.headers.set("content-type", "application/json"), e = JSON.stringify(t.body)) : e = t.body;
155
- const s = await this._fetch(t.url.toString(), {
156
- method: t.method,
157
- headers: t.headers,
158
- body: e
553
+ let t;
554
+ const e = this._request;
555
+ !e.headers.has("content-type") && tt(e.body) ? (e.headers.set("content-type", "application/json"), t = JSON.stringify(e.body)) : t = e.body;
556
+ const s = await this._fetch(e.url.toString(), {
557
+ method: e.method,
558
+ headers: e.headers,
559
+ body: t
159
560
  }), n = s.headers.get("content-type");
160
561
  let r;
161
562
  n != null && n.includes("application/json") ? r = await s.json() : n != null && n.includes("application/x-www-form-urlencoded") ? r = await s.formData() : r = await s.text(), this._response = {
162
- method: t.method,
163
- url: t.url,
563
+ method: e.method,
564
+ url: e.url,
164
565
  status: s.status,
165
566
  statusText: s.statusText,
166
567
  headers: s.headers,
@@ -168,28 +569,28 @@ class Mt {
168
569
  };
169
570
  }
170
571
  }
171
- var _e, Q, z, Pe, Ye;
172
- class xt {
173
- constructor(e, t) {
174
- l(this, z);
572
+ var xt, J, B, jt, le;
573
+ class Ke {
574
+ constructor(t, e) {
575
+ l(this, B);
175
576
  d(this, "dolla");
176
577
  d(this, "config");
177
- l(this, _e, !1);
178
- l(this, Q, /* @__PURE__ */ new Map());
179
- this.config = e, this.dolla = t;
578
+ l(this, xt, !1);
579
+ l(this, J, /* @__PURE__ */ new Map());
580
+ this.config = t, this.dolla = e;
180
581
  }
181
582
  async load() {
182
- let e;
183
- if (!i(this, _e)) {
184
- if (re(this.config.fetch)) {
185
- if (e = await this.config.fetch(), !Z(e))
186
- throw new Error(`Fetch function did not return an object of language strings: ${e}`);
187
- } else if (E(this.config.path)) {
188
- const t = await fetch(this.config.path);
189
- if (t.ok) {
190
- const s = await t.json();
191
- if (Z(s))
192
- e = s;
583
+ let t;
584
+ if (!i(this, xt)) {
585
+ if (nt(this.config.fetch)) {
586
+ if (t = await this.config.fetch(), !tt(t))
587
+ throw new Error(`Fetch function did not return an object of language strings: ${t}`);
588
+ } else if (v(this.config.path)) {
589
+ const e = await fetch(this.config.path);
590
+ if (e.ok) {
591
+ const s = await e.json();
592
+ if (tt(s))
593
+ t = s;
193
594
  else
194
595
  throw new Error(
195
596
  `Language path '${this.config.path}' did not return an object of language strings: ${s}`
@@ -198,49 +599,49 @@ class xt {
198
599
  throw new Error("HTTP request failed.");
199
600
  }
200
601
  }
201
- if (e) {
202
- const t = u(this, z, Pe).call(this, e);
203
- for (const s of t)
204
- i(this, Q).set(s[0], s[1]);
602
+ if (t) {
603
+ const e = f(this, B, jt).call(this, t);
604
+ for (const s of e)
605
+ i(this, J).set(s[0], s[1]);
205
606
  } else
206
607
  throw new Error("Language could not be loaded.");
207
608
  }
208
- getTemplate(e) {
209
- return i(this, Q).get(e) ?? {
210
- segments: [{ type: 0, text: `[MISSING: ${e}]` }]
609
+ getTemplate(t) {
610
+ return i(this, J).get(t) ?? {
611
+ segments: [{ type: 0, text: `[MISSING: ${t}]` }]
211
612
  };
212
613
  }
213
- hasTemplate(e) {
214
- return i(this, Q).has(e);
614
+ hasTemplate(t) {
615
+ return i(this, J).has(t);
215
616
  }
216
617
  }
217
- _e = new WeakMap(), Q = new WeakMap(), z = new WeakSet(), Pe = function(e, t = []) {
618
+ xt = new WeakMap(), J = new WeakMap(), B = new WeakSet(), jt = function(t, e = []) {
218
619
  const s = [];
219
- for (const n in e)
220
- switch (We(e[n])) {
620
+ for (const n in t)
621
+ switch (Bt(t[n])) {
221
622
  case "string":
222
- s.push([[...t, n].join("."), u(this, z, Ye).call(this, e[n])]);
623
+ s.push([[...e, n].join("."), f(this, B, le).call(this, t[n])]);
223
624
  break;
224
625
  case "object":
225
- s.push(...u(this, z, Pe).call(this, e[n], [...t, n]));
626
+ s.push(...f(this, B, jt).call(this, t[n], [...e, n]));
226
627
  break;
227
628
  default:
228
629
  throw new Error(
229
- `Expected to find a string or object at ${[...t, n].join(".")}. Got: ${We(e[n])}`
630
+ `Expected to find a string or object at ${[...e, n].join(".")}. Got: ${Bt(t[n])}`
230
631
  );
231
632
  }
232
633
  return s;
233
- }, Ye = function(e) {
234
- let t;
235
- ((c) => {
236
- c[c.Static = 0] = "Static", c[c.ValueName = 1] = "ValueName", c[c.FormatName = 2] = "FormatName", c[c.FormatOptionName = 3] = "FormatOptionName", c[c.FormatOptionValue = 4] = "FormatOptionValue", c[c.FormatOptionEnd = 5] = "FormatOptionEnd";
237
- })(t || (t = {}));
634
+ }, le = function(t) {
635
+ let e;
636
+ ((u) => {
637
+ u[u.Static = 0] = "Static", u[u.ValueName = 1] = "ValueName", u[u.FormatName = 2] = "FormatName", u[u.FormatOptionName = 3] = "FormatOptionName", u[u.FormatOptionValue = 4] = "FormatOptionValue", u[u.FormatOptionEnd = 5] = "FormatOptionEnd";
638
+ })(e || (e = {}));
238
639
  const s = {
239
640
  segments: []
240
641
  };
241
- let n = "", r = 0, a = 0, f, h, w;
242
- const v = () => {
243
- f = {
642
+ let n = "", r = 0, a = 0, c, h, w;
643
+ const E = () => {
644
+ c = {
244
645
  type: 1,
245
646
  name: "",
246
647
  formats: []
@@ -251,91 +652,91 @@ _e = new WeakMap(), Q = new WeakMap(), z = new WeakSet(), Pe = function(e, t = [
251
652
  options: {}
252
653
  };
253
654
  };
254
- for (; r < e.length; ) {
255
- if (a !== 0 && e[r] === " ") {
655
+ for (; r < t.length; ) {
656
+ if (a !== 0 && t[r] === " ") {
256
657
  r++;
257
658
  continue;
258
659
  }
259
660
  switch (a) {
260
661
  case 0:
261
- e[r] === "{" && e[r + 1] === "{" ? (a = 1, r += 2, n.length > 0 && (s.segments.push({ type: 0, text: n }), n = ""), v()) : (n += e[r], r++);
662
+ t[r] === "{" && t[r + 1] === "{" ? (a = 1, r += 2, n.length > 0 && (s.segments.push({ type: 0, text: n }), n = ""), E()) : (n += t[r], r++);
262
663
  break;
263
664
  case 1:
264
- e[r] === "|" ? (a = 2, r += 1, f.name = n, n = "", k()) : e[r] === "}" && e[r + 1] === "}" ? (a = 0, r += 2, f.name = n, n = "", s.segments.push(f)) : (n += e[r], r++);
665
+ t[r] === "|" ? (a = 2, r += 1, c.name = n, n = "", k()) : t[r] === "}" && t[r + 1] === "}" ? (a = 0, r += 2, c.name = n, n = "", s.segments.push(c)) : (n += t[r], r++);
265
666
  break;
266
667
  case 2:
267
- e[r] === "(" ? (a = 3, r += 1, h.name = n, n = "") : e[r] === "}" && e[r + 1] === "}" ? (a = 0, r += 2, f.formats.push(h), s.segments.push(f)) : (n += e[r], r++);
668
+ t[r] === "(" ? (a = 3, r += 1, h.name = n, n = "") : t[r] === "}" && t[r + 1] === "}" ? (a = 0, r += 2, c.formats.push(h), s.segments.push(c)) : (n += t[r], r++);
268
669
  break;
269
670
  case 3:
270
- e[r] === ")" || (e[r] === ":" ? (a = 4, r += 1, w = n, n = "") : e[r] === "}" && e[r + 1] === "}" || (n += e[r], r++));
671
+ t[r] === ")" || (t[r] === ":" ? (a = 4, r += 1, w = n, n = "") : t[r] === "}" && t[r + 1] === "}" || (n += t[r], r++));
271
672
  break;
272
673
  case 4:
273
- e[r] === ")" ? (a = 5, r += 1, h.options[w] = n, n = "", f.formats.push(h)) : e[r] === "," ? (a = 3, r += 1, h.options[w] = n, n = "") : e[r] === "}" && e[r + 1] === "}" || (n += e[r], r++);
674
+ t[r] === ")" ? (a = 5, r += 1, h.options[w] = n, n = "", c.formats.push(h)) : t[r] === "," ? (a = 3, r += 1, h.options[w] = n, n = "") : t[r] === "}" && t[r + 1] === "}" || (n += t[r], r++);
274
675
  break;
275
676
  case 5:
276
- e[r] === "|" ? (a = 2, r += 1, k()) : e[r] === "}" && e[r + 1] === "}" && (a = 0, r += 2, s.segments.push(f));
677
+ t[r] === "|" ? (a = 2, r += 1, k()) : t[r] === "}" && t[r + 1] === "}" && (a = 0, r += 2, s.segments.push(c));
277
678
  break;
278
679
  }
279
680
  }
280
681
  return a === 0 && n.length > 0 && s.segments.push({ type: 0, text: n }), s;
281
682
  };
282
- var ie, P, b, ae, oe, le, he, $, Ze, Te, Ce, Ne, et;
283
- class Dt {
284
- constructor(e) {
683
+ var lt, O, b, ht, ct, ut, ft, $, he, Vt, It, qt, ce;
684
+ class Qe {
685
+ constructor(t) {
285
686
  l(this, $);
286
- l(this, ie);
287
- l(this, P);
687
+ l(this, lt);
688
+ l(this, O);
288
689
  l(this, b, /* @__PURE__ */ new Map());
289
- l(this, ae, []);
290
- l(this, oe, /* @__PURE__ */ new Map());
291
- l(this, le, "auto");
690
+ l(this, ht, []);
691
+ l(this, ct, /* @__PURE__ */ new Map());
692
+ l(this, ut, "auto");
292
693
  d(this, "$locale");
293
- l(this, he);
294
- m(this, ie, e), m(this, P, e.createLogger("Dolla.i18n"));
295
- const [t, s] = Ie();
296
- this.$locale = t, m(this, he, s), this.addFormat("number", (n, r, a) => u(this, $, Te).call(this, Number(r), a)), this.addFormat("datetime", (n, r, a) => u(this, $, Ce).call(this, r, a)), this.addFormat("list", (n, r, a) => u(this, $, Ne).call(this, r, a)), e.beforeMount(async () => {
297
- i(this, b).size > 0 && await this.setLocale(i(this, le));
694
+ l(this, ft);
695
+ m(this, lt, t), m(this, O, t.createLogger("Dolla.i18n"));
696
+ const [e, s] = At();
697
+ this.$locale = e, m(this, ft, s), this.addFormat("number", (n, r, a) => f(this, $, Vt).call(this, Number(r), a)), this.addFormat("datetime", (n, r, a) => f(this, $, It).call(this, r, a)), this.addFormat("list", (n, r, a) => f(this, $, qt).call(this, r, a)), t.beforeMount(async () => {
698
+ i(this, b).size > 0 && await this.setLocale(i(this, ut));
298
699
  });
299
700
  }
300
701
  get locales() {
301
702
  return [...i(this, b).keys()];
302
703
  }
303
- setup(e) {
304
- if (e.translations.forEach((t) => {
305
- i(this, b).set(t.locale, new xt(t, i(this, ie)));
306
- }), e.locale && e.locale !== "auto") {
307
- if (!e.translations.some((s) => s.locale === e.locale))
308
- throw new Error(`Initial locale '${e.locale}' is not registered in the locales array.`);
309
- m(this, le, e.locale);
704
+ setup(t) {
705
+ if (t.translations.forEach((e) => {
706
+ i(this, b).set(e.locale, new Ke(e, i(this, lt)));
707
+ }), t.locale && t.locale !== "auto") {
708
+ if (!t.translations.some((s) => s.locale === t.locale))
709
+ throw new Error(`Initial locale '${t.locale}' is not registered in the locales array.`);
710
+ m(this, ut, t.locale);
310
711
  }
311
- i(this, P).info(
712
+ i(this, O).info(
312
713
  `${i(this, b).size} language${i(this, b).size === 1 ? "" : "s"} supported: '${[...i(this, b).keys()].join("', '")}'`
313
714
  );
314
715
  }
315
- async setLocale(e) {
716
+ async setLocale(t) {
316
717
  var n;
317
- let t;
318
- if (e === "auto") {
718
+ let e;
719
+ if (t === "auto") {
319
720
  let r = [];
320
721
  if (typeof navigator < "u") {
321
722
  const a = navigator;
322
723
  ((n = a.languages) == null ? void 0 : n.length) > 0 ? r.push(...a.languages) : a.language ? r.push(a.language) : a.browserLanguage ? r.push(a.browserLanguage) : a.userLanguage && r.push(a.userLanguage);
323
724
  }
324
725
  for (const a of r)
325
- i(this, b).has(a) && (t = a);
726
+ i(this, b).has(a) && (e = a);
326
727
  } else
327
- i(this, b).has(e) && (t = e);
328
- if (t == null) {
728
+ i(this, b).has(t) && (e = t);
729
+ if (e == null) {
329
730
  const r = i(this, b).keys().next().value;
330
- r && (t = r);
731
+ r && (e = r);
331
732
  }
332
- if (!t || !i(this, b).has(t))
333
- throw new Error(`Locale '${e}' has no translation.`);
334
- const s = i(this, b).get(t);
733
+ if (!e || !i(this, b).has(e))
734
+ throw new Error(`Locale '${t}' has no translation.`);
735
+ const s = i(this, b).get(e);
335
736
  try {
336
- await s.load(), m(this, ae, []), i(this, he).call(this, t), i(this, P).info("set language to " + t);
737
+ await s.load(), m(this, ht, []), i(this, ft).call(this, e), i(this, O).info("set language to " + e);
337
738
  } catch (r) {
338
- r instanceof Error && i(this, P).crash(r);
739
+ r instanceof Error && i(this, O).crash(r);
339
740
  }
340
741
  }
341
742
  /**
@@ -347,21 +748,21 @@ class Dt {
347
748
  * @example
348
749
  * const $value = t("your.key.here", { count: 5 });
349
750
  */
350
- t(e, t) {
751
+ t(t, e) {
351
752
  if (this === void 0)
352
753
  throw new Error(
353
754
  `The 't' function cannot be destructured. If you need a standalone version you can import it like so: 'import { t } from "@manyducks.co/dolla"'`
354
755
  );
355
756
  let s = [], n = [];
356
- for (const r in t)
357
- s.push(r), n.push(t[r]);
757
+ for (const r in e)
758
+ s.push(r), n.push(e[r]);
358
759
  return x([this.$locale, ...n], (r, ...a) => {
359
760
  if (r == null)
360
761
  return "[NO LOCALE SET]";
361
- const f = {};
762
+ const c = {};
362
763
  for (let h = 0; h < a.length; h++)
363
- f[s[h]] = a[h];
364
- return u(this, $, Ze).call(this, r, e, f);
764
+ c[s[h]] = a[h];
765
+ return f(this, $, he).call(this, r, t, c);
365
766
  });
366
767
  }
367
768
  /**
@@ -378,8 +779,8 @@ class Dt {
378
779
  *
379
780
  * t("greeting", {name: "world"}); // State<"Hello, WORLD!">
380
781
  */
381
- addFormat(e, t) {
382
- i(this, oe).set(e, t);
782
+ addFormat(t, e) {
783
+ i(this, ct).set(t, e);
383
784
  }
384
785
  /**
385
786
  * Creates an `Intl.Collator` configured for the current locale.
@@ -387,16 +788,16 @@ class Dt {
387
788
  *
388
789
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator#options
389
790
  */
390
- collator(e) {
391
- return new Intl.Collator(this.$locale.get(), e);
791
+ collator(t) {
792
+ return new Intl.Collator(this.$locale.get(), t);
392
793
  }
393
794
  /**
394
795
  * Returns a State containing the number formatted for the current locale. Uses `Intl.NumberFormat` under the hood.
395
796
  *
396
797
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
397
798
  */
398
- number(e, t) {
399
- return x([this.$locale, e], (s, n) => u(this, $, Te).call(this, n, t));
799
+ number(t, e) {
800
+ return x([this.$locale, t], (s, n) => f(this, $, Vt).call(this, n, e));
400
801
  }
401
802
  /**
402
803
  * Returns a State containing the date formatted for the current locale. Uses `Intl.DateTimeFormat` under the hood.
@@ -407,8 +808,8 @@ class Dt {
407
808
  * const date = new Date();
408
809
  * const $formatted = Dolla.i18n.dateTime(date, { dateFormat: "short" });
409
810
  */
410
- dateTime(e, t) {
411
- return x([this.$locale, e], (s, n) => u(this, $, Ce).call(this, n, t));
811
+ dateTime(t, e) {
812
+ return x([this.$locale, t], (s, n) => f(this, $, It).call(this, n, e));
412
813
  }
413
814
  /**
414
815
  * Returns a State containing the date formatted for the current locale. Uses `Intl.DateTimeFormat` under the hood.
@@ -419,455 +820,69 @@ class Dt {
419
820
  * const list = new Date();
420
821
  * const $formatted = Dolla.i18n.list(list, { });
421
822
  */
422
- list(e, t) {
423
- return x([this.$locale, e], (s, n) => u(this, $, Ne).call(this, n, t));
823
+ list(t, e) {
824
+ return x([this.$locale, t], (s, n) => f(this, $, qt).call(this, n, e));
424
825
  }
425
826
  }
426
- ie = new WeakMap(), P = new WeakMap(), b = new WeakMap(), ae = new WeakMap(), oe = new WeakMap(), le = new WeakMap(), he = new WeakMap(), $ = new WeakSet(), Ze = function(e, t, s) {
827
+ lt = new WeakMap(), O = new WeakMap(), b = new WeakMap(), ht = new WeakMap(), ct = new WeakMap(), ut = new WeakMap(), ft = new WeakMap(), $ = new WeakSet(), he = function(t, e, s) {
427
828
  var h;
428
- const n = u(this, $, et).call(this, t, s);
829
+ const n = f(this, $, ce).call(this, e, s);
429
830
  if (n) return n;
430
- const r = i(this, b).get(e);
431
- if (s.context != null && (t += "_" + s.context), s.count != null)
831
+ const r = i(this, b).get(t);
832
+ if (s.context != null && (e += "_" + s.context), s.count != null)
432
833
  if (s.ordinal) {
433
- const w = `${t}_ordinal_(=${s.count})`;
434
- r.hasTemplate(w) ? t = w : t += "_ordinal_" + new Intl.PluralRules(e, { type: "ordinal" }).select(s.count);
834
+ const w = `${e}_ordinal_(=${s.count})`;
835
+ r.hasTemplate(w) ? e = w : e += "_ordinal_" + new Intl.PluralRules(t, { type: "ordinal" }).select(s.count);
435
836
  } else {
436
- const w = `${t}_(=${s.count})`;
437
- r.hasTemplate(w) ? t = w : t += "_" + new Intl.PluralRules(e).select(s.count);
837
+ const w = `${e}_(=${s.count})`;
838
+ r.hasTemplate(w) ? e = w : e += "_" + new Intl.PluralRules(t).select(s.count);
438
839
  }
439
- const a = r.getTemplate(t);
440
- let f = "";
840
+ const a = r.getTemplate(e);
841
+ let c = "";
441
842
  for (const w of a.segments)
442
843
  if (w.type === 0)
443
- f += w.text;
844
+ c += w.text;
444
845
  else if (w.type === 1) {
445
- let v = Ft(s, w.name);
846
+ let E = Je(s, w.name);
446
847
  const k = ((h = s.formatOverrides) == null ? void 0 : h[w.name]) ?? [...w.formats];
447
848
  w.name === "count" && k.length === 0 && k.push({ name: "number", options: {} });
448
- for (const c of k) {
449
- const F = i(this, oe).get(c.name);
450
- if (F == null) {
451
- const S = new Error(
452
- `Failed to load format '${c.name}' when processing '${t}', template: ${a}`
849
+ for (const u of k) {
850
+ const D = i(this, ct).get(u.name);
851
+ if (D == null) {
852
+ const R = new Error(
853
+ `Failed to load format '${u.name}' when processing '${e}', template: ${a}`
453
854
  );
454
- throw i(this, P).crash(S), S;
855
+ throw i(this, O).crash(R), R;
455
856
  }
456
- v = F(e, v, c.options);
857
+ E = D(t, E, u.options);
457
858
  }
458
- f += v;
859
+ c += E;
459
860
  }
460
- return f;
461
- }, Te = function(e, t) {
462
- return new Intl.NumberFormat(this.$locale.get(), t).format(e);
463
- }, Ce = function(e, t) {
464
- return new Intl.DateTimeFormat(this.$locale.get(), t).format(E(e) ? new Date(e) : e);
465
- }, Ne = function(e, t) {
466
- return new Intl.ListFormat(this.$locale.get(), t).format(e);
861
+ return c;
862
+ }, Vt = function(t, e) {
863
+ return new Intl.NumberFormat(this.$locale.get(), e).format(t);
864
+ }, It = function(t, e) {
865
+ return new Intl.DateTimeFormat(this.$locale.get(), e).format(v(t) ? new Date(t) : t);
866
+ }, qt = function(t, e) {
867
+ return new Intl.ListFormat(this.$locale.get(), e).format(t);
467
868
  }, // relativeTime(): State<string> {
468
869
  // }
469
- et = function(e, t) {
470
- for (const s of i(this, ae))
471
- if (s[0] === e && ot(s[1], t))
870
+ ce = function(t, e) {
871
+ for (const s of i(this, ht))
872
+ if (s[0] === t && we(s[1], e))
472
873
  return s[2];
473
874
  };
474
- function Ft(o, e) {
475
- const t = String(e).split(/[\.\[\]]/).filter((n) => n.trim() !== "");
875
+ function Je(o, t) {
876
+ const e = String(t).split(/[\.\[\]]/).filter((n) => n.trim() !== "");
476
877
  let s = o;
477
- for (; t.length > 0; ) {
478
- const n = t.shift();
878
+ for (; e.length > 0; ) {
879
+ const n = e.shift();
479
880
  s != null ? s = s[n] : s = void 0;
480
881
  }
481
882
  return s;
482
883
  }
483
- function se(o) {
484
- return Je(o, "Expected `path` to be a string. Got type: %t, value: %v"), o.split("/").map((e) => e.trim()).filter((e) => e !== "");
485
- }
486
- function K(o) {
487
- var t;
488
- lt(
489
- (s) => re(s == null ? void 0 : s.toString),
490
- o,
491
- "Expected `parts` to be an array of objects with a .toString() method. Got type: %t, value: %v"
492
- ), o = o.filter((s) => s).flatMap(String);
493
- let e = (t = o.shift()) == null ? void 0 : t.toString();
494
- if (e) {
495
- for (const s of o.map((n) => n.toString()))
496
- s.startsWith(".") ? e = Ee(e, s) : e[e.length - 1] !== "/" ? s[0] !== "/" ? e += "/" + s : e += s : s[0] === "/" ? e += s.slice(1) : e += s;
497
- e && e !== "/" && e.endsWith("/") && (e = e.slice(0, e.length - 1));
498
- }
499
- return e ?? "";
500
- }
501
- function Ee(o, e) {
502
- if (Je(o, "Expected `base` to be a string. Got type: %t, value: %v"), e == null && (e = o, o = ""), e.startsWith("/"))
503
- return e;
504
- let t = o;
505
- for (; ; )
506
- if (e.startsWith("..")) {
507
- for (let s = t.length; s > 0; --s)
508
- if (t[s] === "/" || s === 0) {
509
- t = t.slice(0, s), e = e.replace(/^\.\.\/?/, "");
510
- break;
511
- }
512
- } else if (e.startsWith("."))
513
- e = e.replace(/^\.\/?/, "");
514
- else
515
- break;
516
- return K([t, e]);
517
- }
518
- function Pt(o) {
519
- if (!o) return {};
520
- o.startsWith("?") && (o = o.slice(1));
521
- const e = o.split("&").filter((t) => t.trim() !== "").map((t) => {
522
- const [s, n] = t.split("=").map((r) => r.trim());
523
- return n.toLowerCase() === "true" ? [s, !0] : n.toLowerCase() === "false" ? [s, !1] : isNaN(Number(n)) ? [s, n] : [s, Number(n)];
524
- });
525
- return Object.fromEntries(e);
526
- }
527
- function tt(o, e, t = {}) {
528
- var a;
529
- const [s, n] = e.split("?"), r = se(s);
530
- e: for (const f of o) {
531
- const { fragments: h } = f;
532
- if (!(((a = h[h.length - 1]) == null ? void 0 : a.type) === 3) && h.length !== r.length || t.willMatch && !t.willMatch(f))
533
- continue e;
534
- const v = [];
535
- t: for (let c = 0; c < h.length; c++) {
536
- const F = r[c], S = h[c];
537
- if (F == null && S.type !== 3)
538
- continue e;
539
- switch (S.type) {
540
- case 1:
541
- if (S.name.toLowerCase() === F.toLowerCase()) {
542
- v.push(S);
543
- break;
544
- } else
545
- continue e;
546
- case 2:
547
- v.push({ ...S, value: F });
548
- break;
549
- case 3:
550
- v.push({ ...S, value: r.slice(c).join("/") });
551
- break t;
552
- case 4:
553
- if (isNaN(Number(F)))
554
- continue e;
555
- v.push({ ...S, value: Number(F) });
556
- break;
557
- default:
558
- throw new Error(`Unknown fragment type: ${S.type}`);
559
- }
560
- }
561
- const k = {};
562
- for (const c of v)
563
- c.type === 2 && (k[c.name] = decodeURIComponent(c.value)), c.type === 4 && (k[c.name] = c.value), c.type === 3 && (k.wildcard = "/" + decodeURIComponent(c.value));
564
- return {
565
- path: "/" + v.map((c) => c.value).join("/"),
566
- pattern: "/" + h.map((c) => c.type === 2 ? `{${c.name}}` : c.type === 4 ? `{#${c.name}}` : c.name).join("/"),
567
- params: k,
568
- query: Pt(n),
569
- meta: f.meta
570
- };
571
- }
572
- }
573
- function Tt(o) {
574
- const e = [], t = [], s = [], n = [];
575
- for (const a of o) {
576
- const { fragments: f } = a;
577
- f.some(
578
- (h) => h.type === 3
579
- /* Wildcard */
580
- ) ? n.push(a) : f.some(
581
- (h) => h.type === 4
582
- /* NumericParam */
583
- ) ? t.push(a) : f.some(
584
- (h) => h.type === 2
585
- /* Param */
586
- ) ? s.push(a) : e.push(a);
587
- }
588
- const r = (a, f) => a.fragments.length > f.fragments.length ? -1 : 1;
589
- return e.sort(r), t.sort(r), s.sort(r), n.sort(r), [...e, ...t, ...s, ...n];
590
- }
591
- function Ct(o) {
592
- const e = se(o), t = [];
593
- for (let s = 0; s < e.length; s++) {
594
- const n = e[s];
595
- if (n === "*") {
596
- if (s !== e.length - 1)
597
- throw new Error(`Wildcard must be at the end of a pattern. Received: ${o}`);
598
- t.push({
599
- type: 3,
600
- name: "*",
601
- value: null
602
- });
603
- } else n.at(0) === "{" && n.at(-1) === "}" ? t.push({
604
- type: n[1] === "#" ? 4 : 2,
605
- name: n[1] === "#" ? n.slice(2, -1) : n.slice(1, -1),
606
- value: null
607
- }) : t.push({
608
- type: 1,
609
- name: n,
610
- value: n
611
- });
612
- }
613
- return t;
614
- }
615
- var q, L, Le, T, J, W, A, C, ce, p, Oe, st, rt, te, je, nt, Ve;
616
- class Nt {
617
- constructor(e) {
618
- l(this, p);
619
- l(this, q);
620
- l(this, L);
621
- l(this, Le, 0);
622
- l(this, T, []);
623
- l(this, J, []);
624
- /**
625
- * Use hash routing when true. Configured in router options.
626
- */
627
- l(this, W, !1);
628
- // Callbacks that need to be called on unmount.
629
- l(this, A, []);
630
- /**
631
- * The current match object.
632
- */
633
- l(this, C);
634
- l(this, ce);
635
- /**
636
- * The currently matched route pattern, if any.
637
- */
638
- d(this, "$pattern");
639
- /**
640
- * The current URL path.
641
- */
642
- d(this, "$path");
643
- /**
644
- * The current named path params.
645
- */
646
- d(this, "$params");
647
- /**
648
- * The current query params. Changes to this object will be reflected in the URL.
649
- */
650
- d(this, "$query");
651
- m(this, q, e), m(this, L, e.createLogger("Dolla.router")), [ee(this, C)._, ee(this, ce)._] = Ie(), this.$pattern = x([i(this, C)], (t) => t == null ? void 0 : t.pattern), this.$path = x([i(this, C)], (t) => (t == null ? void 0 : t.path) ?? window.location.pathname), this.$params = x([i(this, C)], (t) => (t == null ? void 0 : t.params) ?? {}, { equals: Ae }), this.$query = x([i(this, C)], (t) => (t == null ? void 0 : t.query) ?? {}, { equals: Ae }), e.beforeMount(async () => {
652
- const t = () => {
653
- u(this, p, te).call(this);
654
- };
655
- window.addEventListener("popstate", t), i(this, A).push(() => window.removeEventListener("popstate", t));
656
- const s = e.getRootElement();
657
- i(this, A).push(
658
- Vt(s, (n) => {
659
- let r = n.getAttribute("href");
660
- i(this, L).info("intercepted click on <a> tag", n), /^https?:\/\/|^\//.test(r) || (r = K([window.location.pathname, r])), u(this, p, Oe).call(this, r);
661
- })
662
- ), i(this, L).info("will intercept clicks on <a> tags within root element", s), await u(this, p, te).call(this);
663
- }), e.onUnmount(() => {
664
- for (const t of i(this, A))
665
- t();
666
- m(this, A, []);
667
- });
668
- }
669
- async setup(e) {
670
- Ge(e != null, "Options object must not be null. Got: %t"), Ge(
671
- !i(this, q).isMounted,
672
- "Dolla is already mounted. Dolla.router.setup() must be called before Dolla.mount()."
673
- ), e.hash && m(this, W, !0), m(this, J, Tt(
674
- e.routes.flatMap((t) => u(this, p, Ve).call(this, t)).map((t) => ({
675
- pattern: t.pattern,
676
- meta: t.meta,
677
- fragments: Ct(t.pattern)
678
- }))
679
- )), It(i(this, J));
680
- }
681
- /**
682
- * Navigate backward. Pass a number of steps to hit the back button that many times.
683
- */
684
- back(e = 1) {
685
- window.history.go(-e);
686
- }
687
- /**
688
- * Navigate forward. Pass a number of steps to hit the forward button that many times.
689
- */
690
- forward(e = 1) {
691
- window.history.go(e);
692
- }
693
- /**
694
- * Navigates to another route.
695
- *
696
- * @example
697
- * Dolla.router.go("/login"); // navigate to `/login`
698
- * Dolla.router.go["/users", 215], { replace: true }); // replace current history entry with `/users/215`
699
- */
700
- go(e, t = {}) {
701
- if (i(this, q) == null)
702
- throw new Error("Routa methods won't work until you register it: Dolla.use(Routa, { /* ...options */ })");
703
- let s;
704
- Array.isArray(e) ? s = K(e) : s = e.toString(), s = Ee(window.location.pathname, s), t.preserveQuery && (s += window.location.search), t.replace ? u(this, p, st).call(this, s) : u(this, p, Oe).call(this, s);
705
- }
706
- }
707
- q = new WeakMap(), L = new WeakMap(), Le = new WeakMap(), T = new WeakMap(), J = new WeakMap(), W = new WeakMap(), A = new WeakMap(), C = new WeakMap(), ce = new WeakMap(), p = new WeakSet(), Oe = function(e, t) {
708
- i(this, L).info("(push)", e), window.history.pushState(t, "", i(this, W) ? "/#" + e : e), u(this, p, te).call(this, e);
709
- }, st = function(e, t) {
710
- i(this, L).info("(replace)", e), window.history.replaceState(t, "", i(this, W) ? "/#" + e : e), u(this, p, te).call(this, e);
711
- }, rt = function() {
712
- return i(this, W) ? new URL(window.location.hash.slice(1), window.location.origin) : new URL(window.location.pathname, window.location.origin);
713
- }, te = async function(e) {
714
- const t = i(this, L), s = e ? new URL(e, window.location.origin) : u(this, p, rt).call(this), { match: n, journey: r } = await u(this, p, je).call(this, s);
715
- for (const a of r)
716
- switch (a.kind) {
717
- case "match":
718
- t.info(`📍 ${a.message}`);
719
- break;
720
- case "redirect":
721
- t.info(`↩️ ${a.message}`);
722
- break;
723
- case "miss":
724
- t.info(`💀 ${a.message}`);
725
- break;
726
- }
727
- if (n) {
728
- const a = this.$pattern.get();
729
- i(this, ce).call(this, n), n.pattern !== a && u(this, p, nt).call(this, n);
730
- } else
731
- t.crash(new qt(`Failed to match route '${s.pathname}'`));
732
- return { match: n, journey: r };
733
- }, je = async function(e, t = []) {
734
- const s = tt(i(this, J), e.pathname);
735
- if (!s)
736
- return {
737
- match: null,
738
- journey: [...t, { kind: "miss", message: `no match for '${e.pathname}'` }]
739
- };
740
- let n = s.meta.redirect;
741
- if (s.meta.beforeMatch && await s.meta.beforeMatch({
742
- // TODO: Allow setting context variables from here? Would apply to the context of the matched view.
743
- redirect: (r) => {
744
- n = r;
745
- }
746
- }), n != null) {
747
- let r;
748
- if (E(n))
749
- r = Ut(n, s.params);
750
- else if (re(n)) {
751
- const a = {
752
- path: s.path,
753
- pattern: s.pattern,
754
- params: s.params,
755
- query: s.query
756
- };
757
- if (r = await n(a), !E(r))
758
- throw new Error("Redirect function must return a path to redirect to.");
759
- r.startsWith("/") || (r = Ee(s.path, r));
760
- } else
761
- throw new TypeError("Redirect must either be a path string or a function.");
762
- return u(this, p, je).call(this, new URL(r, window.location.origin), [
763
- ...t,
764
- { kind: "redirect", message: `redirecting '${s.path}' -> '${r}'` }
765
- ]);
766
- } else
767
- return { match: s, journey: [...t, { kind: "match", message: `matched route '${s.path}'` }] };
768
- }, /**
769
- * Takes a matched route and mounts it.
770
- */
771
- nt = function(e) {
772
- const t = e.meta.layers;
773
- for (let s = 0; s < t.length; s++) {
774
- const n = t[s], r = i(this, T)[s];
775
- if ((r == null ? void 0 : r.id) !== n.id) {
776
- m(this, T, i(this, T).slice(0, s)), r == null || r.view.unmount();
777
- const a = i(this, T).at(-1), h = ((a == null ? void 0 : a.view) ?? i(this, q).getRootView()).setChildView(n.view);
778
- i(this, T).push({ id: n.id, view: h });
779
- }
780
- }
781
- }, /**
782
- * Parses a route definition object into a set of matchable routes.
783
- *
784
- * @param route - Route config object.
785
- * @param layers - Array of parent layers. Passed when this function calls itself on nested routes.
786
- */
787
- Ve = function(e, t = [], s = []) {
788
- if (!Z(e) || !E(e.path))
789
- throw new TypeError(`Route configs must be objects with a 'path' string property. Got: ${e}`);
790
- if (e.redirect && e.routes)
791
- throw new Error("Route cannot have both a 'redirect' and nested 'routes'.");
792
- if (e.redirect && e.view)
793
- throw new Error("Route cannot have both a 'redirect' and a 'view'.");
794
- if (!e.view && !e.routes && !e.redirect)
795
- throw new Error("Route must have a 'view', a 'redirect', or a set of nested 'routes'.");
796
- let n = [];
797
- for (const h of t)
798
- n.push(...se(h.path));
799
- n.push(...se(e.path)), n[n.length - 1] === "*" && n.pop();
800
- const r = [];
801
- if (e.redirect) {
802
- let h = e.redirect;
803
- return E(h) && (h = Ee(K(n), h), h.startsWith("/") || (h = "/" + h)), r.push({
804
- pattern: "/" + K([...n, ...se(e.path)]),
805
- meta: {
806
- redirect: h
807
- }
808
- }), r;
809
- }
810
- let a = Xe;
811
- if (re(e.view))
812
- a = e.view;
813
- else if (e.view)
814
- throw new TypeError(`Route '${e.path}' expected a view function or undefined. Got: ${e.view}`);
815
- const f = { id: ee(this, Le)._++, view: a };
816
- if (e.routes)
817
- for (const h of e.routes)
818
- r.push(...u(this, p, Ve).call(this, h, [...t, e], [...s, f]));
819
- else
820
- r.push({
821
- pattern: parent ? K([...t.map((h) => h.path), e.path]) : e.path,
822
- meta: {
823
- pattern: e.path,
824
- layers: [...s, f],
825
- beforeMatch: e.beforeMatch
826
- }
827
- });
828
- return r;
829
- };
830
- const Ot = /(noopener|noreferrer) (noopener|noreferrer)/, jt = /^[\w-_]+:/;
831
- function Vt(o, e, t = window) {
832
- function s(r) {
833
- return !r || r === o ? null : r.localName !== "a" || r.href === void 0 ? s(r.parentNode) : r;
834
- }
835
- function n(r) {
836
- if (r.button && r.button !== 0 || r.ctrlKey || r.metaKey || r.altKey || r.shiftKey || r.defaultPrevented)
837
- return;
838
- const a = s(r.target);
839
- a && (t.location.protocol !== a.protocol || t.location.hostname !== a.hostname || t.location.port !== a.port || a.hasAttribute("data-router-ignore") || a.hasAttribute("download") || a.getAttribute("target") === "_blank" && Ot.test(a.getAttribute("rel")) || jt.test(a.getAttribute("href")) || (r.preventDefault(), e(a)));
840
- }
841
- return o.addEventListener("click", n), function() {
842
- o.removeEventListener("click", n);
843
- };
844
- }
845
- function Ut(o, e) {
846
- for (const t in e) {
847
- const s = e[t].toString();
848
- o = o.replace(`{${t}}`, s).replace(`{#${t}}`, s);
849
- }
850
- return o;
851
- }
852
- function It(o) {
853
- for (const e of o)
854
- if (e.meta.redirect) {
855
- let t;
856
- if (!re(e.meta.redirect)) if (E(e.meta.redirect)) {
857
- if (t = e.meta.redirect, !tt(o, t, {
858
- willMatch(n) {
859
- return n !== e;
860
- }
861
- }))
862
- throw new Error(`Found a redirect to an undefined URL. From '${e.pattern}' to '${e.meta.redirect}'`);
863
- } else
864
- throw new TypeError(`Expected a string or redirect function. Got: ${e.meta.redirect}`);
865
- }
866
- }
867
- class qt extends Error {
868
- }
869
- function Wt(o) {
870
- return He`
884
+ function Xe(o) {
885
+ return zt`
871
886
  <div
872
887
  style=${{
873
888
  backgroundColor: "#880000",
@@ -881,7 +896,7 @@ function Wt(o) {
881
896
  <h1 style=${{ marginBottom: "0.5rem" }}>The app has crashed</h1>
882
897
  <p style=${{ marginBottom: "0.25rem" }}>
883
898
  <span style=${{ fontFamily: "monospace" }}>${o.loggerName}</span>
884
- ${ht(o.uid, He`<span style=${{ fontFamily: "monospace", opacity: 0.5 }}> [uid: ${o.uid}]</span>`)}
899
+ ${pe(o.uid, zt`<span style=${{ fontFamily: "monospace", opacity: 0.5 }}> [uid: ${o.uid}]</span>`)}
885
900
  ${" "}says:
886
901
  </p>
887
902
  <blockquote
@@ -913,103 +928,103 @@ function Wt(o) {
913
928
  </div>
914
929
  `;
915
930
  }
916
- var ue, X, N, G, H, Y, Me, M, fe, D, Ue, ke;
917
- class At {
918
- constructor(e) {
919
- l(this, D);
920
- l(this, ue);
931
+ var dt, X, N, A, G, Y, Ft, M, mt, F, Wt, St;
932
+ class Ye {
933
+ constructor(t) {
934
+ l(this, F);
935
+ l(this, dt);
921
936
  l(this, X);
922
937
  // Keys ensure only the most recent callback queued with a certain key
923
938
  // will be called, keeping DOM operations to a minimum.
924
939
  l(this, N, /* @__PURE__ */ new Map());
925
940
  // All unkeyed writes are run on every batch.
926
- l(this, G, []);
941
+ l(this, A, []);
927
942
  // All read callbacks are run before updates on every batch.
928
- l(this, H, []);
943
+ l(this, G, []);
929
944
  l(this, Y, !1);
930
945
  // When true, batches that would exceed 16ms will be split and deferred to a rAF.
931
946
  // This may not be desirable, because while it does prevent hitching it sometimes leaves
932
947
  // the state partially rendered for a brief second and certain elements can be seen to update after the fact.
933
948
  // But the tradeoff here is snappier navigation with possibly slightly out of date DOM updates on heavy pages.
934
- l(this, Me, !0);
949
+ l(this, Ft, !0);
935
950
  l(this, M, 0);
936
- l(this, fe, new Intl.NumberFormat("en-US", {
951
+ l(this, mt, new Intl.NumberFormat("en-US", {
937
952
  maximumFractionDigits: 2,
938
953
  minimumFractionDigits: 0,
939
954
  style: "unit",
940
955
  unit: "millisecond",
941
956
  unitDisplay: "short"
942
957
  }));
943
- m(this, ue, e), m(this, X, e.createLogger("Dolla.batch"));
958
+ m(this, dt, t), m(this, X, t.createLogger("Dolla.batch"));
944
959
  }
945
960
  /**
946
961
  * Queues a callback that runs before the next batch of writes.
947
962
  */
948
- read(e) {
949
- i(this, H).push(e), u(this, D, Ue).call(this);
963
+ read(t) {
964
+ i(this, G).push(t), f(this, F, Wt).call(this);
950
965
  }
951
966
  /**
952
967
  * Queues a callback to run in the next render batch.
953
968
  * Always put DOM mutations in a write callback when possible to help Dolla batch them efficiently.
954
969
  */
955
- write(e, t) {
956
- t ? i(this, N).set(t, e) : i(this, G).push(e), u(this, D, Ue).call(this);
970
+ write(t, e) {
971
+ e ? i(this, N).set(e, t) : i(this, A).push(t), f(this, F, Wt).call(this);
957
972
  }
958
973
  }
959
- ue = new WeakMap(), X = new WeakMap(), N = new WeakMap(), G = new WeakMap(), H = new WeakMap(), Y = new WeakMap(), Me = new WeakMap(), M = new WeakMap(), fe = new WeakMap(), D = new WeakSet(), Ue = function() {
974
+ dt = new WeakMap(), X = new WeakMap(), N = new WeakMap(), A = new WeakMap(), G = new WeakMap(), Y = new WeakMap(), Ft = new WeakMap(), M = new WeakMap(), mt = new WeakMap(), F = new WeakSet(), Wt = function() {
960
975
  if (!i(this, Y)) {
961
976
  m(this, Y, !0);
962
- const e = i(this, ue).getEnv() === "development";
977
+ const t = i(this, dt).getEnv() === "development";
963
978
  queueMicrotask(() => {
964
- u(this, D, ke).call(this, e);
979
+ f(this, F, St).call(this, t);
965
980
  });
966
981
  }
967
- }, ke = function(e = !1) {
968
- const t = performance.now();
982
+ }, St = function(t = !1) {
983
+ const e = performance.now();
969
984
  let s = 0;
970
- const n = i(this, H).length + i(this, N).size + i(this, G).length;
985
+ const n = i(this, G).length + i(this, N).size + i(this, A).length;
971
986
  let r = 0;
972
- const a = () => (r++, s = performance.now() - t, i(this, Me) && s > 12 && r < n ? (ee(this, M)._++, e && i(this, X).warn(
973
- `⚠️ Deferring batch to next frame. Performed ${r} of ${n} batched operation${r === 1 ? "" : "s"} in ${i(this, fe).format(s)} (deferral ${i(this, M)}).`
987
+ const a = () => (r++, s = performance.now() - e, i(this, Ft) && s > 12 && r < n ? (et(this, M)._++, t && i(this, X).warn(
988
+ `⚠️ Deferring batch to next frame. Performed ${r} of ${n} batched operation${r === 1 ? "" : "s"} in ${i(this, mt).format(s)} (deferral ${i(this, M)}).`
974
989
  ), requestAnimationFrame(() => {
975
- u(this, D, ke).call(this, e);
976
- }), !0) : !1), f = [...i(this, N).entries()];
990
+ f(this, F, St).call(this, t);
991
+ }), !0) : !1), c = [...i(this, N).entries()];
977
992
  let h, w;
978
- for (; w = i(this, H).shift(); )
993
+ for (; w = i(this, G).shift(); )
979
994
  if (w(), a()) return;
980
- for ([h, w] of f)
995
+ for ([h, w] of c)
981
996
  if (w(), i(this, N).delete(h), a()) return;
982
- for (; w = i(this, G).shift(); )
997
+ for (; w = i(this, A).shift(); )
983
998
  if (w(), a()) return;
984
- e && i(this, X)[s > 16 ? "warn" : "info"](
985
- `${s > 16 ? "⚠️ (>=16ms) " : ""}Executed ${r} operation${r === 1 ? "" : "s"} in ${i(this, fe).format(s)}${i(this, M) > 0 ? ` (after ${i(this, M)} deferral${i(this, M) === 1 ? "" : "s"})` : ""}.`
986
- ), m(this, M, 0), i(this, H).length || i(this, N).size || i(this, G).length ? queueMicrotask(() => {
987
- u(this, D, ke).call(this, e);
999
+ t && i(this, X)[s > 16 ? "warn" : "info"](
1000
+ `${s > 16 ? "⚠️ (>=16ms) " : ""}Executed ${r} operation${r === 1 ? "" : "s"} in ${i(this, mt).format(s)}${i(this, M) > 0 ? ` (after ${i(this, M)} deferral${i(this, M) === 1 ? "" : "s"})` : ""}.`
1001
+ ), m(this, M, 0), i(this, G).length || i(this, N).size || i(this, A).length ? queueMicrotask(() => {
1002
+ f(this, F, St).call(this, t);
988
1003
  }) : m(this, Y, !1);
989
1004
  };
990
- var O, de, j, B, me, we, pe, ge, ye, be, g, y, V, U, xe;
991
- class Gt {
1005
+ var U, wt, C, H, pt, gt, Z, yt, bt, $t, Et, g, y, j, V, Dt;
1006
+ class Ze {
992
1007
  constructor() {
993
1008
  d(this, "batch");
994
1009
  // Remove `private` when there are public methods to call.
995
1010
  d(this, "stats");
996
1011
  d(this, "http");
997
1012
  d(this, "i18n");
998
- d(this, "router");
999
- l(this, O, !1);
1000
- l(this, de, "production");
1001
- l(this, j);
1002
- l(this, B);
1003
- l(this, me, Wt);
1004
- l(this, we, Be());
1005
- l(this, pe, []);
1006
- l(this, ge, []);
1007
- l(this, ye, []);
1008
- l(this, be, []);
1013
+ l(this, U, !1);
1014
+ l(this, wt, "production");
1015
+ l(this, C);
1016
+ l(this, H);
1017
+ l(this, pt, Xe);
1018
+ l(this, gt, Kt());
1019
+ l(this, Z);
1020
+ l(this, yt, []);
1021
+ l(this, bt, []);
1022
+ l(this, $t, []);
1023
+ l(this, Et, []);
1009
1024
  l(this, g, {
1010
1025
  root: this,
1011
1026
  data: {},
1012
- emitter: new ct(),
1027
+ emitter: new ge(),
1013
1028
  stores: /* @__PURE__ */ new Map(),
1014
1029
  viewName: "Dolla"
1015
1030
  });
@@ -1019,72 +1034,72 @@ class Gt {
1019
1034
  warn: "development",
1020
1035
  error: !0
1021
1036
  });
1022
- l(this, V, ze("*,-Dolla.*"));
1023
- l(this, U, /* @__PURE__ */ new Map());
1037
+ l(this, j, Qt("*,-Dolla.*"));
1038
+ l(this, V, /* @__PURE__ */ new Map());
1024
1039
  // Registration functions for modules.
1025
1040
  // All modules will be registered before mount.
1026
- l(this, xe, []);
1027
- d(this, "watch", i(this, we).watch);
1028
- d(this, "createState", Ie);
1029
- d(this, "toState", ft);
1030
- d(this, "toValue", dt);
1031
- d(this, "isState", mt);
1041
+ l(this, Dt, []);
1042
+ d(this, "watch", i(this, gt).watch);
1043
+ d(this, "createState", At);
1044
+ d(this, "toState", be);
1045
+ d(this, "toValue", $e);
1046
+ d(this, "isState", Ee);
1032
1047
  d(this, "derive", x);
1033
- d(this, "createWatcher", Be);
1034
- d(this, "createRef", wt);
1035
- d(this, "isRef", pt);
1036
- this.batch = new At(this), this.stats = new ut(this), this.http = new St(this), this.i18n = new Dt(this), this.router = new Nt(this);
1048
+ d(this, "createWatcher", Kt);
1049
+ d(this, "createRef", ve);
1050
+ d(this, "isRef", ke);
1051
+ this.batch = new Ye(this), this.stats = new ye(this), this.http = new Ae(this), this.i18n = new Qe(this);
1037
1052
  }
1038
1053
  /**
1039
1054
  * True when the app is connected to a DOM node and displayed to the user.
1040
1055
  */
1041
1056
  get isMounted() {
1042
- return i(this, O);
1057
+ return i(this, U);
1043
1058
  }
1044
1059
  /**
1045
1060
  * Get the current environment that this app is running in.
1046
1061
  * Environment affects which log messages will print and how much debugging info is included in the DOM.
1047
1062
  */
1048
1063
  getEnv() {
1049
- return i(this, de);
1064
+ return i(this, wt);
1050
1065
  }
1051
1066
  /**
1052
1067
  * Sets the environment that this app is running in.
1053
1068
  * Environment affects which log messages will print and how much debugging info is included in the DOM.
1054
1069
  */
1055
- setEnv(e) {
1056
- m(this, de, e);
1070
+ setEnv(t) {
1071
+ m(this, wt, t);
1057
1072
  }
1058
1073
  /**
1059
1074
  * Sets the view that will be shown when the `crash` method is called on any logger.
1060
1075
  * When a crash is reported the app will be unmounted and replaced with this crash page.
1061
1076
  */
1062
- setCrashView(e) {
1063
- m(this, me, e);
1077
+ setCrashView(t) {
1078
+ m(this, pt, t);
1064
1079
  }
1065
1080
  /**
1066
1081
  * Returns the HTMLElement Dolla is mounted to. This will return undefined until Dolla.mount() is called.
1067
1082
  */
1068
1083
  getRootElement() {
1069
- return i(this, j);
1084
+ return i(this, C);
1070
1085
  }
1071
1086
  /**
1072
1087
  * Returns the top level view Dolla is rendering inside the root element. This will return undefined until Dolla.mount() is called.
1073
1088
  */
1074
1089
  getRootView() {
1075
- return i(this, B);
1090
+ return i(this, H);
1076
1091
  }
1077
1092
  /**
1078
1093
  * Sets a context variable and returns its value. Context variables are accessible on the app and in child views.
1079
1094
  */
1080
- set(e, t) {
1081
- return i(this, g).data[e] = t, t;
1095
+ set(t, e) {
1096
+ return i(this, g).data[t] = e, e;
1082
1097
  }
1083
1098
  /**
1084
1099
  * Gets the value of a context variable. Returns null if the variable is not set.
1085
1100
  */
1086
- get(e) {
1087
- return i(this, g).data[e] ?? null;
1101
+ get(t) {
1102
+ return i(this, g).data[t] ?? null;
1088
1103
  }
1089
1104
  /**
1090
1105
  * Returns an object of all context variables stored at the app level.
@@ -1095,142 +1110,143 @@ class Gt {
1095
1110
  /**
1096
1111
  * Adds a listener to be called when `eventName` is emitted.
1097
1112
  */
1098
- on(e, t) {
1099
- if (e === "*") {
1113
+ on(t, e) {
1114
+ if (t === "*") {
1100
1115
  const s = (n, r) => {
1101
- t(r);
1116
+ e(r);
1102
1117
  };
1103
- i(this, g).emitter.on(e, s), i(this, U).set(t, s);
1118
+ i(this, g).emitter.on(t, s), i(this, V).set(e, s);
1104
1119
  } else
1105
- i(this, g).emitter.on(e, t);
1120
+ i(this, g).emitter.on(t, e);
1106
1121
  }
1107
1122
  /**
1108
1123
  * Removes a listener from the list to be called when `eventName` is emitted.
1109
1124
  */
1110
- off(e, t) {
1111
- if (e === "*") {
1112
- const s = i(this, U).get(t);
1113
- s && (i(this, g).emitter.off(e, s), i(this, U).delete(t));
1125
+ off(t, e) {
1126
+ if (t === "*") {
1127
+ const s = i(this, V).get(e);
1128
+ s && (i(this, g).emitter.off(t, s), i(this, V).delete(e));
1114
1129
  } else
1115
- i(this, g).emitter.off(e, t);
1130
+ i(this, g).emitter.off(t, e);
1116
1131
  }
1117
1132
  /**
1118
1133
  * Adds a listener to be called when `eventName` is emitted. The listener is immediately removed after being called once.
1119
1134
  */
1120
- once(e, t) {
1121
- if (e === "*") {
1135
+ once(t, e) {
1136
+ if (t === "*") {
1122
1137
  const s = (n, r) => {
1123
- i(this, U).delete(t), t(r);
1138
+ i(this, V).delete(e), e(r);
1124
1139
  };
1125
- i(this, g).emitter.once(e, s), i(this, U).set(t, s);
1140
+ i(this, g).emitter.once(t, s), i(this, V).set(e, s);
1126
1141
  } else
1127
- i(this, g).emitter.once(e, t);
1142
+ i(this, g).emitter.once(t, e);
1128
1143
  }
1129
1144
  /**
1130
1145
  * Emits a new event to all listeners.
1131
1146
  */
1132
- emit(e, t) {
1133
- return i(this, g).emitter.emit(e, new gt(e, t));
1147
+ emit(t, e) {
1148
+ return i(this, g).emitter.emit(t, new Re(t, e));
1134
1149
  }
1135
1150
  /**
1136
1151
  * Attaches a new store to this context.
1137
1152
  */
1138
- attachStore(e) {
1139
- if (!e.attach(i(this, g))) {
1140
- let s = e.name ? `'${e.name}'` : "this store";
1153
+ attachStore(t) {
1154
+ if (!t.attach(i(this, g))) {
1155
+ let s = t.name ? `'${t.name}'` : "this store";
1141
1156
  console.warn(`An instance of ${s} was already attached to this context.`);
1142
1157
  }
1143
1158
  }
1144
1159
  /**
1145
1160
  * Gets the nearest instance of a store. Throws an error if the store isn't provided higher in the tree.
1146
1161
  */
1147
- useStore(e) {
1148
- if (yt(e)) {
1149
- const t = e.key, s = i(this, g).stores.get(t);
1162
+ useStore(t) {
1163
+ if (Se(t)) {
1164
+ const e = t.key, s = i(this, g).stores.get(e);
1150
1165
  if (s == null)
1151
- throw new Fe("Store not found on this context.");
1166
+ throw new Tt("Store not found on this context.");
1152
1167
  return s.value;
1153
- } else throw bt(e) ? new Fe(
1168
+ } else throw _e(t) ? new Tt(
1154
1169
  "Received a Store instance. Please pass the Store factory function to useStore without calling it."
1155
- ) : new Fe("Invalid store.");
1170
+ ) : new Tt("Invalid store.");
1156
1171
  }
1157
- async mount(e, t) {
1158
- if (i(this, O))
1172
+ async mount(t, e) {
1173
+ if (i(this, U))
1159
1174
  throw new Error("Dolla is already mounted.");
1160
- if (E(e)) {
1161
- const n = document.querySelector(e);
1162
- Ke(HTMLElement, n, `Selector '${e}' did not match any element.`), m(this, j, n);
1175
+ if (v(t)) {
1176
+ const r = document.querySelector(t);
1177
+ Jt(HTMLElement, r, `Selector '${t}' did not match any element.`), m(this, C, r);
1163
1178
  } else
1164
- Ke(HTMLElement, e, "Expected an HTML element or a selector string. Got type: %t, value: %v"), m(this, j, e);
1165
- const s = $t(t ?? Xe);
1166
- m(this, B, this.constructView(s.type, s.props)), await Promise.all(i(this, xe).map((n) => n())), await Promise.all(i(this, pe).map((n) => n())), i(this, B).mount(i(this, j)), m(this, O, !0);
1167
- for (const n of i(this, g).stores.values())
1168
- n.handleMount();
1169
- for (const n of i(this, ge))
1170
- n();
1179
+ Jt(HTMLElement, t, "Expected an HTML element or a selector string. Got type: %t, value: %v"), m(this, C, t);
1180
+ Ot(e) && m(this, Z, e);
1181
+ const s = Ot(e) ? ee : e, n = Le(s);
1182
+ m(this, H, this.constructView(n.type, n.props)), await Promise.all(i(this, Dt).map((r) => r())), Ot(e) && await Oe(e, this), await Promise.all(i(this, yt).map((r) => r())), i(this, H).mount(i(this, C)), m(this, U, !0);
1183
+ for (const r of i(this, g).stores.values())
1184
+ r.handleMount();
1185
+ for (const r of i(this, bt))
1186
+ r();
1171
1187
  }
1172
1188
  async unmount() {
1173
- var e;
1174
- if (i(this, O)) {
1175
- await Promise.all(i(this, ye).map((t) => t())), (e = i(this, B)) == null || e.unmount(!1), i(this, we).stopAll(), m(this, O, !1);
1176
- for (const t of i(this, be))
1177
- t();
1189
+ var t;
1190
+ if (i(this, U)) {
1191
+ await Promise.all(i(this, $t).map((e) => e())), (t = i(this, H)) == null || t.unmount(!1), i(this, gt).stopAll(), i(this, Z) && await Ne(i(this, Z)), m(this, U, !1);
1192
+ for (const e of i(this, Et))
1193
+ e();
1178
1194
  }
1179
1195
  }
1180
1196
  /**
1181
1197
  * Registers a `callback` to run after `Dolla.mount` is called, before the app is mounted. If `callback` returns a Promise,
1182
1198
  * it will be awaited before mounting finishes. Use this to perform initial setup before the app is displayed to the user.
1183
1199
  */
1184
- beforeMount(e) {
1185
- i(this, pe).push(e);
1200
+ beforeMount(t) {
1201
+ i(this, yt).push(t);
1186
1202
  }
1187
1203
  /**
1188
1204
  * Registers a `callback` to run after the app is mounted.
1189
1205
  */
1190
- onMount(e) {
1191
- i(this, ge).push(e);
1206
+ onMount(t) {
1207
+ i(this, bt).push(t);
1192
1208
  }
1193
1209
  /**
1194
1210
  * Registers a `callback` to run after `Dolla.unmount` is called, before the app is unmounted. If `callback` returns a Promise,
1195
1211
  * it will be awaited before unmounting finishes. Use this to perform cleanup.
1196
1212
  */
1197
- beforeUnmount(e) {
1198
- i(this, ye).push(e);
1213
+ beforeUnmount(t) {
1214
+ i(this, $t).push(t);
1199
1215
  }
1200
1216
  /**
1201
1217
  * Registers a `callback` to run after the app is unmounted.
1202
1218
  */
1203
- onUnmount(e) {
1204
- i(this, be).push(e);
1219
+ onUnmount(t) {
1220
+ i(this, Et).push(t);
1205
1221
  }
1206
1222
  /**
1207
1223
  * Update log type toggles. Values that are not passed will remain unchanged.
1208
1224
  */
1209
- setLoggles(e) {
1210
- for (const t in e) {
1211
- const s = e[t];
1212
- s && (i(this, y)[t] = s);
1225
+ setLoggles(t) {
1226
+ for (const e in t) {
1227
+ const s = t[e];
1228
+ s && (i(this, y)[e] = s);
1213
1229
  }
1214
1230
  }
1215
- setLogFilter(e) {
1216
- m(this, V, ze(e));
1231
+ setLogFilter(t) {
1232
+ m(this, j, Qt(t));
1217
1233
  }
1218
- createLogger(e, t) {
1219
- const s = (t == null ? void 0 : t.console) ?? Ht(), n = this;
1234
+ createLogger(t, e) {
1235
+ const s = (e == null ? void 0 : e.console) ?? ts(), n = this;
1220
1236
  return {
1221
1237
  setName(r) {
1222
- return e = r, this;
1238
+ return t = r, this;
1223
1239
  },
1224
1240
  get info() {
1225
1241
  var r;
1226
- if (i(n, y).info === !1 || E(i(n, y).info) && i(n, y).info !== n.getEnv() || !i(r = n, V).call(r, e))
1227
- return $e;
1242
+ if (i(n, y).info === !1 || v(i(n, y).info) && i(n, y).info !== n.getEnv() || !i(r = n, j).call(r, t))
1243
+ return vt;
1228
1244
  {
1229
- let a = `%c${e}`;
1230
- return t != null && t.uid ? a += ` %c[uid: %c${t.uid}%c]` : a += "%c%c%c", s.info.bind(
1245
+ let a = `%c${t}`;
1246
+ return e != null && e.uid ? a += ` %c[uid: %c${e.uid}%c]` : a += "%c%c%c", s.info.bind(
1231
1247
  s,
1232
1248
  a,
1233
- `color:${ve(a)};font-weight:bold`,
1249
+ `color:${kt(a)};font-weight:bold`,
1234
1250
  "color:#777",
1235
1251
  "color:#aaa",
1236
1252
  "color:#777"
@@ -1239,14 +1255,14 @@ class Gt {
1239
1255
  },
1240
1256
  get log() {
1241
1257
  var r;
1242
- if (i(n, y).log === !1 || E(i(n, y).log) && i(n, y).log !== n.getEnv() || !i(r = n, V).call(r, e))
1243
- return $e;
1258
+ if (i(n, y).log === !1 || v(i(n, y).log) && i(n, y).log !== n.getEnv() || !i(r = n, j).call(r, t))
1259
+ return vt;
1244
1260
  {
1245
- let a = `%c${e}`;
1246
- return t != null && t.uid ? a += ` %c[uid: %c${t.uid}%c]` : a += "%c%c%c", s.log.bind(
1261
+ let a = `%c${t}`;
1262
+ return e != null && e.uid ? a += ` %c[uid: %c${e.uid}%c]` : a += "%c%c%c", s.log.bind(
1247
1263
  s,
1248
1264
  a,
1249
- `color:${ve(a)};font-weight:bold`,
1265
+ `color:${kt(a)};font-weight:bold`,
1250
1266
  "color:#777",
1251
1267
  "color:#aaa",
1252
1268
  "color:#777"
@@ -1255,14 +1271,14 @@ class Gt {
1255
1271
  },
1256
1272
  get warn() {
1257
1273
  var r;
1258
- if (i(n, y).warn === !1 || E(i(n, y).warn) && i(n, y).warn !== n.getEnv() || !i(r = n, V).call(r, e))
1259
- return $e;
1274
+ if (i(n, y).warn === !1 || v(i(n, y).warn) && i(n, y).warn !== n.getEnv() || !i(r = n, j).call(r, t))
1275
+ return vt;
1260
1276
  {
1261
- let a = `%c${e}`;
1262
- return t != null && t.uid ? a += ` %c[uid: %c${t.uid}%c]` : a += "%c%c%c", s.warn.bind(
1277
+ let a = `%c${t}`;
1278
+ return e != null && e.uid ? a += ` %c[uid: %c${e.uid}%c]` : a += "%c%c%c", s.warn.bind(
1263
1279
  s,
1264
1280
  a,
1265
- `color:${ve(a)};font-weight:bold`,
1281
+ `color:${kt(a)};font-weight:bold`,
1266
1282
  "color:#777",
1267
1283
  "color:#aaa",
1268
1284
  "color:#777"
@@ -1271,14 +1287,14 @@ class Gt {
1271
1287
  },
1272
1288
  get error() {
1273
1289
  var r;
1274
- if (i(n, y).error === !1 || E(i(n, y).error) && i(n, y).error !== n.getEnv() || !i(r = n, V).call(r, e))
1275
- return $e;
1290
+ if (i(n, y).error === !1 || v(i(n, y).error) && i(n, y).error !== n.getEnv() || !i(r = n, j).call(r, t))
1291
+ return vt;
1276
1292
  {
1277
- let a = `%c${e}`;
1278
- return t != null && t.uid ? a += ` %c[uid: %c${t.uid}%c]` : a += "%c%c%c", s.error.bind(
1293
+ let a = `%c${t}`;
1294
+ return e != null && e.uid ? a += ` %c[uid: %c${e.uid}%c]` : a += "%c%c%c", s.error.bind(
1279
1295
  s,
1280
1296
  a,
1281
- `color:${ve(a)};font-weight:bold`,
1297
+ `color:${kt(a)};font-weight:bold`,
1282
1298
  "color:#777",
1283
1299
  "color:#aaa",
1284
1300
  "color:#777"
@@ -1286,62 +1302,63 @@ class Gt {
1286
1302
  }
1287
1303
  },
1288
1304
  crash(r) {
1289
- throw n.isMounted && (n.unmount(), n.constructView(i(n, me), {
1305
+ throw n.isMounted && (n.unmount(), n.constructView(i(n, pt), {
1290
1306
  error: r,
1291
- loggerName: e,
1292
- uid: t == null ? void 0 : t.uid
1293
- }).mount(i(n, j))), r;
1307
+ loggerName: t,
1308
+ uid: e == null ? void 0 : e.uid
1309
+ }).mount(i(n, C))), r;
1294
1310
  }
1295
1311
  };
1296
1312
  }
1297
1313
  /**
1298
1314
  *
1299
1315
  */
1300
- constructView(e, t, s = []) {
1301
- return new vt(i(this, g), e, t, s);
1316
+ constructView(t, e, s = []) {
1317
+ return new Me(i(this, g), t, e, s);
1302
1318
  }
1303
1319
  /**
1304
1320
  *
1305
1321
  */
1306
- constructMarkup(e) {
1307
- return Et(kt(i(this, g), e));
1322
+ constructMarkup(t) {
1323
+ return xe(Fe(i(this, g), t));
1308
1324
  }
1309
1325
  }
1310
- O = new WeakMap(), de = new WeakMap(), j = new WeakMap(), B = new WeakMap(), me = new WeakMap(), we = new WeakMap(), pe = new WeakMap(), ge = new WeakMap(), ye = new WeakMap(), be = new WeakMap(), g = new WeakMap(), y = new WeakMap(), V = new WeakMap(), U = new WeakMap(), xe = new WeakMap();
1311
- function Ht() {
1326
+ U = new WeakMap(), wt = new WeakMap(), C = new WeakMap(), H = new WeakMap(), pt = new WeakMap(), gt = new WeakMap(), Z = new WeakMap(), yt = new WeakMap(), bt = new WeakMap(), $t = new WeakMap(), Et = new WeakMap(), g = new WeakMap(), y = new WeakMap(), j = new WeakMap(), V = new WeakMap(), Dt = new WeakMap();
1327
+ function ts() {
1312
1328
  if (typeof window < "u" && window.console)
1313
1329
  return window.console;
1314
1330
  if (typeof global < "u" && global.console)
1315
1331
  return global.console;
1316
1332
  }
1317
- const Qe = new Gt(), Kt = Qe.i18n.t.bind(Qe.i18n);
1318
- function Qt(o) {
1333
+ const Xt = new Ze(), ns = Xt.i18n.t.bind(Xt.i18n);
1334
+ function is(o) {
1319
1335
  typeof window < "u" && (window.DOLLA_DEV_DEBUG = o);
1320
1336
  }
1321
- function Jt() {
1337
+ function as() {
1322
1338
  return typeof window < "u" ? window.DOLLA_DEV_DEBUG === !0 : !1;
1323
1339
  }
1324
1340
  export {
1325
- ht as cond,
1326
- $t as createMarkup,
1327
- wt as createRef,
1328
- Ie as createState,
1329
- Zt as createStore,
1330
- es as createView,
1331
- ot as deepEqual,
1332
- Qe as default,
1341
+ pe as cond,
1342
+ Le as createMarkup,
1343
+ ve as createRef,
1344
+ rs as createRouter,
1345
+ At as createState,
1346
+ hs as createStore,
1347
+ cs as createView,
1348
+ we as deepEqual,
1349
+ Xt as default,
1333
1350
  x as derive,
1334
- Jt as getDevDebug,
1335
- He as html,
1336
- pt as isRef,
1337
- mt as isState,
1338
- ts as portal,
1339
- ss as repeat,
1340
- Qt as setDevDebug,
1341
- Ae as shallowEqual,
1342
- rs as strictEqual,
1343
- Kt as t,
1344
- ft as toState,
1345
- dt as toValue
1351
+ as as getDevDebug,
1352
+ zt as html,
1353
+ ke as isRef,
1354
+ Ee as isState,
1355
+ us as portal,
1356
+ fs as repeat,
1357
+ is as setDevDebug,
1358
+ Ht as shallowEqual,
1359
+ ds as strictEqual,
1360
+ ns as t,
1361
+ be as toState,
1362
+ $e as toValue
1346
1363
  };
1347
1364
  //# sourceMappingURL=index.js.map