@manyducks.co/dolla 2.0.0-alpha.10 → 2.0.0-alpha.12

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,22 +1,22 @@
1
- var gt = Object.defineProperty;
2
- var Ze = (a) => {
3
- throw TypeError(a);
1
+ var kt = Object.defineProperty;
2
+ var st = (i) => {
3
+ throw TypeError(i);
4
4
  };
5
- var mt = (a, e, t) => e in a ? gt(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
6
- var P = (a, e, t) => mt(a, typeof e != "symbol" ? e + "" : e, t), ze = (a, e, t) => e.has(a) || Ze("Cannot " + t);
7
- var n = (a, e, t) => (ze(a, e, "read from private field"), t ? t.call(a) : e.get(a)), h = (a, e, t) => e.has(a) ? Ze("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(a) : e.set(a, t), g = (a, e, t, r) => (ze(a, e, "write to private field"), r ? r.call(a, t) : e.set(a, t), t), S = (a, e, t) => (ze(a, e, "access private method"), t);
8
- var et = (a, e, t, r) => ({
9
- set _(i) {
10
- g(a, e, i, t);
5
+ var Et = (i, e, t) => e in i ? kt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
6
+ var S = (i, e, t) => Et(i, typeof e != "symbol" ? e + "" : e, t), Be = (i, e, t) => e.has(i) || st("Cannot " + t);
7
+ var s = (i, e, t) => (Be(i, e, "read from private field"), t ? t.call(i) : e.get(i)), d = (i, e, t) => e.has(i) ? st("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), b = (i, e, t, n) => (Be(i, e, "write to private field"), n ? n.call(i, t) : e.set(i, t), t), k = (i, e, t) => (Be(i, e, "access private method"), t);
8
+ var it = (i, e, t, n) => ({
9
+ set _(a) {
10
+ b(i, e, a, t);
11
11
  },
12
12
  get _() {
13
- return n(a, e, r);
13
+ return s(i, e, n);
14
14
  }
15
15
  });
16
- import { h as tt, c as wt, i as Ge, t as Be, a as yt, d as ae, b as bt, e as Xe, f as U, g as K, j as lt, k as vt, w as ut, P as ht, l as rt, m as $t, n as Et, v as kt, o as Pt, p as St, q as nt, r as at, s as Lt, u as Te, x as Ae, y as Rt, z as xt, A as Ot } from "./passthrough-9kwwjgWk.js";
17
- import { B as rr, C as nr, D as ar } from "./passthrough-9kwwjgWk.js";
18
- function Nt(a) {
19
- return tt`
16
+ import { h as ot, c as Pt, i as Ke, t as Qe, d as ye, a as St, b as at, e as q, f as lt, g as oe, j as pt, k as Rt, w as gt, P as mt, l as ct, m as xt, n as Lt, v as Nt, o as Ot, p as Mt, q as ut, r as ht, s as Tt, u as Ae, x as De, y as jt, z as At, A as Dt } from "./passthrough-Bz5ZF4jn.js";
17
+ import { B as cr, C as ur, D as hr } from "./passthrough-Bz5ZF4jn.js";
18
+ function _t(i) {
19
+ return ot`
20
20
  <div
21
21
  style=${{
22
22
  backgroundColor: "#880000",
@@ -29,8 +29,8 @@ function Nt(a) {
29
29
  >
30
30
  <h1 style=${{ marginBottom: "0.5rem" }}>The app has crashed</h1>
31
31
  <p style=${{ marginBottom: "0.25rem" }}>
32
- <span style=${{ fontFamily: "monospace" }}>${a.loggerName}</span>
33
- ${wt(a.uid, tt`<span style=${{ fontFamily: "monospace", opacity: 0.5 }}> [uid: ${a.uid}]</span>`)}
32
+ <span style=${{ fontFamily: "monospace" }}>${i.loggerName}</span>
33
+ ${Pt(i.uid, ot`<span style=${{ fontFamily: "monospace", opacity: 0.5 }}> [uid: ${i.uid}]</span>`)}
34
34
  ${" "}says:
35
35
  </p>
36
36
  <blockquote
@@ -53,21 +53,21 @@ function Nt(a) {
53
53
  fontWeight: "bold"
54
54
  }}
55
55
  >
56
- ${a.error.name}
56
+ ${i.error.name}
57
57
  </span>
58
- ${a.error.message}
58
+ ${i.error.message}
59
59
  </blockquote>
60
60
 
61
61
  <p>Please see the browser console for details.</p>
62
62
  </div>
63
63
  `;
64
64
  }
65
- var J, Fe, M, C;
66
- class Mt {
65
+ var X, Ge, T, _;
66
+ class Ct {
67
67
  constructor() {
68
- h(this, M);
69
- h(this, J, []);
70
- h(this, Fe, Tt());
68
+ d(this, T);
69
+ d(this, X, []);
70
+ d(this, Ge, Vt());
71
71
  }
72
72
  /**
73
73
  * Adds a new middleware that will apply to subsequent requests.
@@ -76,228 +76,304 @@ class Mt {
76
76
  * @param middleware - A middleware function that will intercept requests.
77
77
  */
78
78
  use(e) {
79
- return n(this, J).push(e), () => {
80
- n(this, J).splice(n(this, J).indexOf(e), 1);
79
+ return s(this, X).push(e), () => {
80
+ s(this, X).splice(s(this, X).indexOf(e), 1);
81
81
  };
82
82
  }
83
83
  async get(e, t) {
84
- return S(this, M, C).call(this, "get", e, t);
84
+ return k(this, T, _).call(this, "get", e, t);
85
85
  }
86
86
  async put(e, t) {
87
- return S(this, M, C).call(this, "put", e, t);
87
+ return k(this, T, _).call(this, "put", e, t);
88
88
  }
89
89
  async patch(e, t) {
90
- return S(this, M, C).call(this, "patch", e, t);
90
+ return k(this, T, _).call(this, "patch", e, t);
91
91
  }
92
92
  async post(e, t) {
93
- return S(this, M, C).call(this, "post", e, t);
93
+ return k(this, T, _).call(this, "post", e, t);
94
94
  }
95
95
  async delete(e, t) {
96
- return S(this, M, C).call(this, "delete", e, t);
96
+ return k(this, T, _).call(this, "delete", e, t);
97
97
  }
98
98
  async head(e, t) {
99
- return S(this, M, C).call(this, "head", e, t);
99
+ return k(this, T, _).call(this, "head", e, t);
100
100
  }
101
101
  async options(e, t) {
102
- return S(this, M, C).call(this, "options", e, t);
102
+ return k(this, T, _).call(this, "options", e, t);
103
103
  }
104
104
  async trace(e, t) {
105
- return S(this, M, C).call(this, "trace", e, t);
105
+ return k(this, T, _).call(this, "trace", e, t);
106
106
  }
107
107
  }
108
- J = new WeakMap(), Fe = new WeakMap(), M = new WeakSet(), C = async function(e, t, r) {
109
- return jt({
110
- ...r,
108
+ X = new WeakMap(), Ge = new WeakMap(), T = new WeakSet(), _ = async function(e, t, n) {
109
+ return qt({
110
+ ...n,
111
111
  method: e,
112
112
  uri: t,
113
- middleware: n(this, J),
114
- fetch: n(this, Fe)
113
+ middleware: s(this, X),
114
+ fetch: s(this, Ge)
115
115
  });
116
116
  };
117
- function Tt() {
117
+ function Vt() {
118
118
  if (typeof window < "u" && window.fetch)
119
119
  return window.fetch.bind(window);
120
120
  if (typeof global < "u" && global.fetch)
121
121
  return global.fetch.bind(global);
122
122
  throw new Error("Running in neither browser nor node. Please run this app in one of the supported environments.");
123
123
  }
124
- class At extends Error {
124
+ class Ft extends Error {
125
125
  constructor(t) {
126
- const { status: r, statusText: i, method: s, uri: o } = t, f = `${r} ${i}: Request failed (${s.toUpperCase()} ${o})`;
127
- super(f);
128
- P(this, "response");
126
+ const { status: n, statusText: a, method: r, uri: o } = t, h = `${n} ${a}: Request failed (${r.toUpperCase()} ${o})`;
127
+ super(h);
128
+ S(this, "response");
129
129
  this.response = t;
130
130
  }
131
131
  }
132
- async function jt(a) {
133
- const { headers: e, query: t, fetch: r, middleware: i } = a, s = {
134
- method: a.method,
135
- uri: a.uri,
132
+ async function qt(i) {
133
+ const { headers: e, query: t, fetch: n, middleware: a } = i, r = {
134
+ method: i.method,
135
+ uri: i.uri,
136
136
  get sameOrigin() {
137
- return !s.uri.startsWith("http");
137
+ return !r.uri.startsWith("http");
138
138
  },
139
139
  query: new URLSearchParams(),
140
140
  headers: new Headers(),
141
- body: a.body
141
+ body: i.body
142
142
  };
143
143
  if (e)
144
144
  if (e instanceof Map || e instanceof Headers)
145
- e.forEach((c, w) => {
146
- s.headers.set(w, c);
145
+ e.forEach((l, m) => {
146
+ r.headers.set(m, l);
147
147
  });
148
148
  else if (e != null && typeof e == "object" && !Array.isArray(e))
149
- for (const c in e) {
150
- const w = e[c];
151
- w instanceof Date ? s.headers.set(c, w.toISOString()) : w != null && s.headers.set(c, String(w));
149
+ for (const l in e) {
150
+ const m = e[l];
151
+ m instanceof Date ? r.headers.set(l, m.toISOString()) : m != null && r.headers.set(l, String(m));
152
152
  }
153
153
  else
154
154
  throw new TypeError(`Unknown headers type. Got: ${e}`);
155
155
  if (t)
156
156
  if (t instanceof Map || t instanceof URLSearchParams)
157
- t.forEach((c, w) => {
158
- s.query.set(w, c);
157
+ t.forEach((l, m) => {
158
+ r.query.set(m, l);
159
159
  });
160
160
  else if (t != null && typeof t == "object" && !Array.isArray(t))
161
- for (const c in t) {
162
- const w = t[c];
163
- w instanceof Date ? s.query.set(c, w.toISOString()) : w != null && s.query.set(c, String(w));
161
+ for (const l in t) {
162
+ const m = t[l];
163
+ m instanceof Date ? r.query.set(l, m.toISOString()) : m != null && r.query.set(l, String(m));
164
164
  }
165
165
  else
166
166
  throw new TypeError(`Unknown query params type. Got: ${t}`);
167
167
  let o;
168
- const f = async () => {
169
- const c = s.query.toString(), w = c.length > 0 ? s.uri + "?" + c : s.uri;
170
- let y;
171
- !s.headers.has("content-type") && Ge(s.body) ? (s.headers.set("content-type", "application/json"), y = JSON.stringify(s.body)) : y = s.body;
172
- const m = await r(w, {
173
- method: s.method,
174
- headers: s.headers,
175
- body: y
176
- }), d = Object.fromEntries(m.headers.entries()), b = d["content-type"];
177
- let $;
178
- b != null && b.includes("application/json") ? $ = await m.json() : b != null && b.includes("application/x-www-form-urlencoded") ? $ = await m.formData() : $ = await m.text(), o = {
179
- method: s.method,
180
- uri: s.uri,
181
- status: m.status,
182
- statusText: m.statusText,
183
- headers: d,
184
- body: $
168
+ const h = async () => {
169
+ const l = r.query.toString(), m = l.length > 0 ? r.uri + "?" + l : r.uri;
170
+ let f;
171
+ !r.headers.has("content-type") && Ke(r.body) ? (r.headers.set("content-type", "application/json"), f = JSON.stringify(r.body)) : f = r.body;
172
+ const g = await n(m, {
173
+ method: r.method,
174
+ headers: r.headers,
175
+ body: f
176
+ }), u = Object.fromEntries(g.headers.entries()), y = u["content-type"];
177
+ let E;
178
+ y != null && y.includes("application/json") ? E = await g.json() : y != null && y.includes("application/x-www-form-urlencoded") ? E = await g.formData() : E = await g.text(), o = {
179
+ method: r.method,
180
+ uri: r.uri,
181
+ status: g.status,
182
+ statusText: g.statusText,
183
+ headers: u,
184
+ body: E
185
185
  };
186
186
  };
187
- if (i.length > 0) {
188
- const c = (w = 0) => {
189
- const y = i[w], m = i[w + 1] ? c(w + 1) : f;
190
- return async () => y(s, async () => (await m(), o));
187
+ if (a.length > 0) {
188
+ const l = (m = 0) => {
189
+ const f = a[m], g = a[m + 1] ? l(m + 1) : h;
190
+ return async () => f(r, async () => (await g(), o));
191
191
  };
192
- await c()();
192
+ await l()();
193
193
  } else
194
- await f();
194
+ await h();
195
195
  if (o.status < 200 || o.status >= 400)
196
- throw new At(o);
196
+ throw new Ft(o);
197
197
  return o;
198
198
  }
199
- class Dt {
199
+ const Ut = Qe("[NO LANGUAGE SET]");
200
+ var We, le, ne, Je, wt;
201
+ class Ht {
200
202
  constructor(e, t) {
201
- P(this, "dolla");
202
- P(this, "config");
203
- P(this, "strings");
203
+ d(this, ne);
204
+ S(this, "dolla");
205
+ S(this, "config");
206
+ d(this, We, !1);
207
+ d(this, le, /* @__PURE__ */ new Map());
204
208
  this.config = e, this.dolla = t;
205
209
  }
206
210
  async load() {
207
- if (this.strings == null) {
208
- if (Xe(this.config.fetch)) {
209
- const e = await this.config.fetch();
210
- if (Ge(e))
211
- this.strings = e;
212
- else
211
+ let e;
212
+ if (!s(this, We)) {
213
+ if (at(this.config.fetch)) {
214
+ if (e = await this.config.fetch(), !Ke(e))
213
215
  throw new Error(`Fetch function did not return an object of language strings: ${e}`);
214
- } else if (U(this.config.path)) {
215
- const e = await this.dolla.http.get(this.config.path);
216
- if (e.status >= 200 && e.status < 300)
217
- if (Ge(e.body))
218
- this.strings = e.body;
216
+ } else if (q(this.config.path)) {
217
+ const t = await this.dolla.http.get(this.config.path);
218
+ if (t.status >= 200 && t.status < 300)
219
+ if (Ke(t.body))
220
+ e = t.body;
219
221
  else
220
222
  throw new Error(
221
- `Language path '${this.config.path}' did not return an object of language strings: ${e.body}`
223
+ `Language path '${this.config.path}' did not return an object of language strings: ${t.body}`
222
224
  );
223
225
  else
224
226
  throw new Error("HTTP request failed.");
225
227
  }
226
228
  }
227
- if (this.strings == null)
229
+ if (e == null)
228
230
  throw new Error("Language could not be loaded.");
229
- return this.strings;
231
+ {
232
+ const t = k(this, ne, Je).call(this, e);
233
+ for (const n of t)
234
+ s(this, le).set(n[0], n[1]);
235
+ console.log(t);
236
+ }
237
+ }
238
+ getTemplate(e) {
239
+ return s(this, le).get(e) ?? null;
240
+ }
241
+ hasTemplate(e) {
242
+ return s(this, le).has(e);
230
243
  }
231
244
  }
232
- var ye, Y, x, ie, be, ve, oe, $e, Ie, ft;
233
- class Ct {
245
+ We = new WeakMap(), le = new WeakMap(), ne = new WeakSet(), Je = function(e, t = []) {
246
+ const n = [];
247
+ for (const a in e)
248
+ switch (lt(e[a])) {
249
+ case "string":
250
+ n.push([[...t, a].join("."), k(this, ne, wt).call(this, e[a])]);
251
+ break;
252
+ case "object":
253
+ n.push(...k(this, ne, Je).call(this, e[a], [...t, a]));
254
+ break;
255
+ default:
256
+ throw new Error(
257
+ `Expected to find a string or object at ${[...t, a].join(".")}. Got: ${lt(e[a])}`
258
+ );
259
+ }
260
+ return n;
261
+ }, wt = function(e) {
262
+ let t;
263
+ ((u) => {
264
+ 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";
265
+ })(t || (t = {}));
266
+ const n = {
267
+ segments: []
268
+ };
269
+ let a = "", r = 0, o = 0, h, l, m;
270
+ const f = () => {
271
+ h = {
272
+ type: 1,
273
+ name: "",
274
+ formats: []
275
+ };
276
+ }, g = () => {
277
+ l = {
278
+ name: "",
279
+ options: {}
280
+ };
281
+ };
282
+ for (; r < e.length; ) {
283
+ if (o !== 0 && e[r] === " ") {
284
+ r++;
285
+ continue;
286
+ }
287
+ switch (o) {
288
+ case 0:
289
+ e[r] === "{" && e[r + 1] === "{" ? (o = 1, r += 2, a.length > 0 && (n.segments.push({ type: 0, text: a }), a = ""), f()) : (a += e[r], r++);
290
+ break;
291
+ case 1:
292
+ e[r] === "|" ? (o = 2, r += 1, h.name = a, a = "", g()) : e[r] === "}" && e[r + 1] === "}" ? (o = 0, r += 2, h.name = a, a = "", n.segments.push(h)) : (a += e[r], r++);
293
+ break;
294
+ case 2:
295
+ e[r] === "(" ? (o = 3, r += 1, l.name = a, a = "") : e[r] === "}" && e[r + 1] === "}" ? (o = 0, r += 2, h.formats.push(l), n.segments.push(h)) : (a += e[r], r++);
296
+ break;
297
+ case 3:
298
+ e[r] === ")" || (e[r] === ":" ? (o = 4, r += 1, m = a, a = "") : e[r] === "}" && e[r + 1] === "}" || (a += e[r], r++));
299
+ break;
300
+ case 4:
301
+ e[r] === ")" ? (o = 5, r += 1, l.options[m] = a, a = "", h.formats.push(l)) : e[r] === "," ? (o = 3, r += 1, l.options[m] = a, a = "") : e[r] === "}" && e[r + 1] === "}" || (a += e[r], r++);
302
+ break;
303
+ case 5:
304
+ e[r] === "|" ? (o = 2, r += 1, g()) : e[r] === "}" && e[r + 1] === "}" && (o = 0, r += 2, n.segments.push(h));
305
+ break;
306
+ }
307
+ }
308
+ return o === 0 && a.length > 0 && n.segments.push({ type: 0, text: a }), n;
309
+ };
310
+ var ve, U, L, $e, H, ke, Ee, N, yt, Ye, Xe, Ze, bt;
311
+ class It {
234
312
  constructor(e) {
235
- h(this, Ie);
236
- h(this, ye);
237
- h(this, Y);
238
- h(this, x, /* @__PURE__ */ new Map());
239
- h(this, ie, []);
240
- h(this, be, "auto");
241
- P(this, "$locale");
242
- h(this, ve);
243
- h(this, oe);
244
- h(this, $e);
245
- g(this, ye, e), g(this, Y, e.createLogger("dolla/i18n"));
246
- const [t, r] = K(), [i, s] = K();
247
- this.$locale = t, g(this, ve, r), g(this, oe, i), g(this, $e, s), e.beforeMount(async () => {
248
- n(this, x).size > 0 && await this.setLocale(n(this, be));
313
+ d(this, N);
314
+ d(this, ve);
315
+ d(this, U);
316
+ d(this, L, /* @__PURE__ */ new Map());
317
+ d(this, $e, []);
318
+ d(this, H, /* @__PURE__ */ new Map());
319
+ d(this, ke, "auto");
320
+ S(this, "$locale");
321
+ d(this, Ee);
322
+ b(this, ve, e), b(this, U, e.createLogger("dolla/i18n"));
323
+ const [t, n] = oe();
324
+ this.$locale = t, b(this, Ee, n), s(this, H).set("number", (a, r, o) => k(this, N, Ye).call(this, Number(r), o)), s(this, H).set("datetime", (a, r, o) => k(this, N, Xe).call(this, r, o)), s(this, H).set("list", (a, r, o) => k(this, N, Ze).call(this, r, o)), e.beforeMount(async () => {
325
+ s(this, L).size > 0 && await this.setLocale(s(this, ke));
249
326
  });
250
327
  }
251
328
  get locales() {
252
- return [...n(this, x).keys()];
329
+ return [...s(this, L).keys()];
253
330
  }
254
331
  setup(e) {
255
332
  if (e.translations.forEach((t) => {
256
- n(this, x).set(t.locale, new Dt(t, n(this, ye)));
333
+ s(this, L).set(t.locale, new Ht(t, s(this, ve)));
257
334
  }), e.locale && e.locale !== "auto") {
258
- if (!e.translations.some((r) => r.locale === e.locale))
335
+ if (!e.translations.some((n) => n.locale === e.locale))
259
336
  throw new Error(`Initial locale '${e.locale}' is not registered in the locales array.`);
260
- g(this, be, e.locale);
337
+ b(this, ke, e.locale);
261
338
  }
262
- n(this, Y).info(
263
- `${n(this, x).size} language${n(this, x).size === 1 ? "" : "s"} supported: '${[...n(this, x).keys()].join("', '")}'`
339
+ s(this, U).info(
340
+ `${s(this, L).size} language${s(this, L).size === 1 ? "" : "s"} supported: '${[...s(this, L).keys()].join("', '")}'`
264
341
  );
265
342
  }
266
343
  async setLocale(e) {
267
- var i;
344
+ var a;
268
345
  let t;
269
346
  if (e === "auto") {
270
- let s = [];
347
+ let r = [];
271
348
  if (typeof navigator == "object") {
272
349
  const o = navigator;
273
- ((i = o.languages) == null ? void 0 : i.length) > 0 ? s.push(...o.languages) : o.language ? s.push(o.language) : o.browserLanguage ? s.push(o.browserLanguage) : o.userLanguage && s.push(o.userLanguage);
350
+ ((a = o.languages) == null ? void 0 : a.length) > 0 ? r.push(...o.languages) : o.language ? r.push(o.language) : o.browserLanguage ? r.push(o.browserLanguage) : o.userLanguage && r.push(o.userLanguage);
274
351
  }
275
- for (const o of s)
276
- n(this, x).has(o) && (t = o);
352
+ for (const o of r)
353
+ s(this, L).has(o) && (t = o);
277
354
  } else
278
- n(this, x).has(e) && (t = e);
355
+ s(this, L).has(e) && (t = e);
279
356
  if (t == null) {
280
- const s = n(this, x).keys().next().value;
281
- s && (t = s);
357
+ const r = s(this, L).keys().next().value;
358
+ r && (t = r);
282
359
  }
283
- if (!t || !n(this, x).has(t))
360
+ if (!t || !s(this, L).has(t))
284
361
  throw new Error(`Language '${e}' is not configured for this app.`);
285
- const r = n(this, x).get(t);
362
+ const n = s(this, L).get(t);
286
363
  try {
287
- const s = await r.load();
288
- n(this, $e).call(this, s), n(this, ve).call(this, t), n(this, Y).info("set language to " + t);
289
- } catch (s) {
290
- s instanceof Error && n(this, Y).crash(s);
364
+ await n.load(), b(this, $e, []), s(this, Ee).call(this, t), s(this, U).info("set language to " + t);
365
+ } catch (r) {
366
+ r instanceof Error && s(this, U).crash(r);
291
367
  }
292
368
  }
293
369
  /**
294
370
  * Returns a State containing the value at `key`.
295
371
 
296
- * @param key - Key to the translated value.
297
- * @param values - A map of {{placeholder}} names and the values to replace them with.
372
+ * @param selector - Key to the translated value.
373
+ * @param options - A map of `{{placeholder}}` names and the values to replace them with.
298
374
  *
299
375
  * @example
300
- * const $value = t("your.key.here");
376
+ * const $value = t("your.key.here", { count: 5 });
301
377
  */
302
378
  t(e, t) {
303
379
  if (this === void 0)
@@ -305,39 +381,35 @@ class Ct {
305
381
  `The 't' function cannot be destructured. If you need a standalone version you can import it like so: 'import { t } from "@manyducks.co/dolla"'`
306
382
  );
307
383
  if (!this.$locale.get())
308
- return qt;
309
- const r = S(this, Ie, ft).call(this, e, t);
310
- if (r)
311
- return r;
312
- if (t) {
313
- const s = {};
314
- for (const [f, c] of Object.entries(t))
315
- yt(c) && (s[f] = c);
316
- const o = Object.entries(s);
317
- if (o.length > 0) {
318
- const f = o.map((w) => w[1]), c = ae([n(this, oe), ...f], (w, ...y) => {
319
- const m = y.map(($, j) => o[j]), d = {
320
- ...t
321
- };
322
- for (let $ = 0; $ < m.length; $++) {
323
- const j = m[$][0];
324
- d[j] = y[$];
325
- }
326
- const b = it(w, e) || `[NO TRANSLATION: ${e}]`;
327
- return st(b, d);
328
- });
329
- return n(this, ie).push([e, t, c]), c;
330
- }
331
- }
332
- const i = ae([n(this, oe)], (s) => {
333
- let o = it(s, e) || `[NO TRANSLATION: ${e}]`;
334
- return t && (o = st(o, t)), o;
335
- });
336
- return n(this, ie).push([e, t, i]), i;
384
+ return Ut;
385
+ let n = [], a = [];
386
+ for (const r in t)
387
+ n.push(r), a.push(t[r]);
388
+ return ye(
389
+ [this.$locale, ...a],
390
+ (r, ...o) => k(this, N, yt).call(this, r, e, n, ...o)
391
+ );
392
+ }
393
+ /**
394
+ * Add a custom format callback.
395
+ *
396
+ * @example
397
+ * Dolla.i18n.addFormat("myCurrency", (locale, value, options) => {
398
+ * // ...
399
+ * });
400
+ *
401
+ * {
402
+ * "exampleKey": "{{count | myCurrency}} dollars"
403
+ * }
404
+ *
405
+ * t("exampleKey", {count: 5}); // State<"&5 dollars">
406
+ */
407
+ addFormat(e, t) {
408
+ s(this, H).set(e, t);
337
409
  }
338
410
  /**
339
- * Creates a wrapped `Intl.Collator` configured for the current locale.
340
- * NOTE: The Collator remains bound to the locale it was created with.
411
+ * Creates an `Intl.Collator` configured for the current locale.
412
+ * NOTE: The Collator remains bound to the locale it was created with, even when the app's locale changes.
341
413
  *
342
414
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator#options
343
415
  */
@@ -350,7 +422,7 @@ class Ct {
350
422
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
351
423
  */
352
424
  number(e, t) {
353
- return ae([this.$locale, e], (r, i) => new Intl.NumberFormat(this.$locale.get(), t).format(i));
425
+ return ye([this.$locale, e], (n, a) => k(this, N, Ye).call(this, a, t));
354
426
  }
355
427
  /**
356
428
  * Returns a State containing the date formatted for the current locale. Uses `Intl.DateTimeFormat` under the hood.
@@ -362,9 +434,7 @@ class Ct {
362
434
  * const $formatted = Dolla.i18n.dateTime(date, { dateFormat: "short" });
363
435
  */
364
436
  dateTime(e, t) {
365
- return ae([this.$locale, e], (r, i) => new Intl.DateTimeFormat(this.$locale.get(), t).format(
366
- typeof i == "string" ? new Date(i) : i
367
- ));
437
+ return ye([this.$locale, e], (n, a) => k(this, N, Xe).call(this, a, t));
368
438
  }
369
439
  /**
370
440
  * Returns a State containing the date formatted for the current locale. Uses `Intl.DateTimeFormat` under the hood.
@@ -376,46 +446,87 @@ class Ct {
376
446
  * const $formatted = Dolla.i18n.list(list, { });
377
447
  */
378
448
  list(e, t) {
379
- return ae([this.$locale, e], (r, i) => new Intl.ListFormat(this.$locale.get(), t).format(i));
449
+ return ye([this.$locale, e], (n, a) => k(this, N, Ze).call(this, a, t));
380
450
  }
381
451
  }
382
- ye = new WeakMap(), Y = new WeakMap(), x = new WeakMap(), ie = new WeakMap(), be = new WeakMap(), ve = new WeakMap(), oe = new WeakMap(), $e = new WeakMap(), Ie = new WeakSet(), // relativeTime(): State<string> {
452
+ ve = new WeakMap(), U = new WeakMap(), L = new WeakMap(), $e = new WeakMap(), H = new WeakMap(), ke = new WeakMap(), Ee = new WeakMap(), N = new WeakSet(), yt = function(e, t, n, ...a) {
453
+ const r = {};
454
+ for (let f = 0; f < a.length; f++)
455
+ r[n[f]] = a[f];
456
+ const o = k(this, N, bt).call(this, t, r);
457
+ if (o) return o;
458
+ const h = s(this, L).get(e);
459
+ if (r.context != null && (t += "_" + r.context), r.count != null)
460
+ if (r.ordinal) {
461
+ const f = `${t}_ordinal_(=${r.count})`;
462
+ h.hasTemplate(f) ? t = f : t += "_ordinal_" + new Intl.PluralRules(e, { type: "ordinal" }).select(r.count);
463
+ } else {
464
+ const f = `${t}_(=${r.count})`;
465
+ h.hasTemplate(f) ? t = f : t += "_" + new Intl.PluralRules(e).select(r.count);
466
+ }
467
+ const l = h.getTemplate(t) || {
468
+ segments: [{ type: 0, text: `[MISSING: ${t}]` }]
469
+ };
470
+ let m = "";
471
+ for (const f of l.segments)
472
+ if (f.type === 0)
473
+ m += f.text;
474
+ else if (f.type === 1) {
475
+ const g = [...f.formats];
476
+ let u = Gt(r, f.name);
477
+ f.name === "count" && g.length === 0 && g.push({ name: "number", options: {} });
478
+ for (const y of g) {
479
+ const E = s(this, H).get(y.name);
480
+ if (E == null) {
481
+ const V = new Error(
482
+ `Failed to load format '${y.name}' when processing '${t}', template: ${l}`
483
+ );
484
+ throw s(this, U).crash(V), V;
485
+ }
486
+ u = E(e, u, y.options);
487
+ }
488
+ m += u;
489
+ }
490
+ return m;
491
+ }, Ye = function(e, t) {
492
+ return new Intl.NumberFormat(this.$locale.get(), t).format(e);
493
+ }, Xe = function(e, t) {
494
+ return new Intl.DateTimeFormat(this.$locale.get(), t).format(
495
+ typeof e == "string" ? new Date(e) : e
496
+ );
497
+ }, Ze = function(e, t) {
498
+ return new Intl.ListFormat(this.$locale.get(), t).format(e);
499
+ }, // relativeTime(): State<string> {
383
500
  // }
384
- ft = function(e, t) {
385
- for (const r of n(this, ie))
386
- if (r[0] === e && bt(r[1], t))
387
- return r[2];
501
+ bt = function(e, t) {
502
+ for (const n of s(this, $e))
503
+ if (n[0] === e && St(n[1], t))
504
+ return n[2];
388
505
  };
389
- const qt = Be("[NO LANGUAGE SET]");
390
- function st(a, e) {
391
- for (const t in e)
392
- a = a.replace(`{{${t}}}`, String(e[t]));
393
- return a;
394
- }
395
- function it(a, e) {
396
- const t = String(e).split(/[\.\[\]]/).filter((i) => i.trim() !== "");
397
- let r = a;
506
+ function Gt(i, e) {
507
+ const t = String(e).split(/[\.\[\]]/).filter((a) => a.trim() !== "");
508
+ let n = i;
398
509
  for (; t.length > 0; ) {
399
- const i = t.shift();
400
- r != null ? r = r[i] : r = void 0;
510
+ const a = t.shift();
511
+ n != null ? n = n[a] : n = void 0;
401
512
  }
402
- return r;
513
+ return n;
403
514
  }
404
- var X, Ee, _, H, ce, q, le, je;
405
- class Vt {
515
+ var Z, Pe, I, G, ce, C, ue, _e;
516
+ class Wt {
406
517
  constructor(e) {
407
- h(this, le);
408
- h(this, X);
409
- h(this, Ee);
518
+ d(this, ue);
519
+ d(this, Z);
520
+ d(this, Pe);
410
521
  // Keyed updates ensure only the most recent callback queued with a certain key
411
522
  // will be called, keeping DOM operations to a minimum.
412
- h(this, _, /* @__PURE__ */ new Map());
523
+ d(this, I, /* @__PURE__ */ new Map());
413
524
  // All unkeyed updates are run on every batch.
414
- h(this, H, []);
525
+ d(this, G, []);
415
526
  // All read callbacks are run before updates on every batch.
416
- h(this, ce, []);
417
- h(this, q, !1);
418
- g(this, X, e), g(this, Ee, e.createLogger("dolla/render"));
527
+ d(this, ce, []);
528
+ d(this, C, !1);
529
+ b(this, Z, e), b(this, Pe, e.createLogger("dolla/render"));
419
530
  }
420
531
  /**
421
532
  * Queues a callback to run in the next render batch.
@@ -423,12 +534,12 @@ class Vt {
423
534
  * Returns a Promise that resolves once the callback has run.
424
535
  */
425
536
  update(e, t) {
426
- return new Promise((r) => {
427
- t ? n(this, _).set(t, () => {
428
- e(), r();
429
- }) : n(this, H).push(() => {
430
- e(), r();
431
- }), !n(this, q) && n(this, X).isMounted && (g(this, q, !0), S(this, le, je).call(this));
537
+ return new Promise((n) => {
538
+ t ? s(this, I).set(t, () => {
539
+ e(), n();
540
+ }) : s(this, G).push(() => {
541
+ e(), n();
542
+ }), !s(this, C) && s(this, Z).isMounted && (b(this, C, !0), k(this, ue, _e).call(this));
432
543
  });
433
544
  }
434
545
  /**
@@ -438,50 +549,50 @@ class Vt {
438
549
  */
439
550
  read(e) {
440
551
  return new Promise((t) => {
441
- n(this, ce).push(() => {
552
+ s(this, ce).push(() => {
442
553
  e(), t();
443
- }), !n(this, q) && n(this, X).isMounted && (g(this, q, !0), S(this, le, je).call(this));
554
+ }), !s(this, C) && s(this, Z).isMounted && (b(this, C, !0), k(this, ue, _e).call(this));
444
555
  });
445
556
  }
446
557
  }
447
- X = new WeakMap(), Ee = new WeakMap(), _ = new WeakMap(), H = new WeakMap(), ce = new WeakMap(), q = new WeakMap(), le = new WeakSet(), je = function() {
448
- const e = n(this, _).size + n(this, H).length;
449
- if ((!n(this, X).isMounted || e === 0) && g(this, q, !1), !n(this, q)) {
450
- for (const t of n(this, ce))
558
+ Z = new WeakMap(), Pe = new WeakMap(), I = new WeakMap(), G = new WeakMap(), ce = new WeakMap(), C = new WeakMap(), ue = new WeakSet(), _e = function() {
559
+ const e = s(this, I).size + s(this, G).length;
560
+ if ((!s(this, Z).isMounted || e === 0) && b(this, C, !1), !s(this, C)) {
561
+ for (const t of s(this, ce))
451
562
  t();
452
- g(this, ce, []);
563
+ b(this, ce, []);
453
564
  return;
454
565
  }
455
566
  requestAnimationFrame(() => {
456
- n(this, Ee).info(`Batching ${n(this, _).size + n(this, H).length} queued DOM update(s).`);
457
- for (const t of n(this, _).values())
567
+ s(this, Pe).info(`Batching ${s(this, I).size + s(this, G).length} queued DOM update(s).`);
568
+ for (const t of s(this, I).values())
458
569
  t();
459
- n(this, _).clear();
460
- for (const t of n(this, H))
570
+ s(this, I).clear();
571
+ for (const t of s(this, G))
461
572
  t();
462
- g(this, H, []), S(this, le, je).call(this);
573
+ b(this, G, []), k(this, ue, _e).call(this);
463
574
  });
464
575
  };
465
- function de() {
466
- return de = Object.assign ? Object.assign.bind() : function(a) {
576
+ function pe() {
577
+ return pe = Object.assign ? Object.assign.bind() : function(i) {
467
578
  for (var e = 1; e < arguments.length; e++) {
468
579
  var t = arguments[e];
469
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (a[r] = t[r]);
580
+ for (var n in t) ({}).hasOwnProperty.call(t, n) && (i[n] = t[n]);
470
581
  }
471
- return a;
472
- }, de.apply(null, arguments);
582
+ return i;
583
+ }, pe.apply(null, arguments);
473
584
  }
474
585
  var A;
475
- (function(a) {
476
- a.Pop = "POP", a.Push = "PUSH", a.Replace = "REPLACE";
586
+ (function(i) {
587
+ i.Pop = "POP", i.Push = "PUSH", i.Replace = "REPLACE";
477
588
  })(A || (A = {}));
478
- var Ve = process.env.NODE_ENV !== "production" ? function(a) {
479
- return Object.freeze(a);
480
- } : function(a) {
481
- return a;
589
+ var qe = process.env.NODE_ENV !== "production" ? function(i) {
590
+ return Object.freeze(i);
591
+ } : function(i) {
592
+ return i;
482
593
  };
483
- function De(a, e) {
484
- if (!a) {
594
+ function Ce(i, e) {
595
+ if (!i) {
485
596
  typeof console < "u" && console.warn(e);
486
597
  try {
487
598
  throw new Error(e);
@@ -489,38 +600,38 @@ function De(a, e) {
489
600
  }
490
601
  }
491
602
  }
492
- var Ue = "beforeunload", Ut = "hashchange", dt = "popstate";
493
- function _t(a) {
494
- a === void 0 && (a = {});
495
- var e = a, t = e.window, r = t === void 0 ? document.defaultView : t, i = r.history;
496
- function s() {
497
- var p = r.location, l = p.pathname, u = p.search, v = p.hash, E = i.state || {};
498
- return [E.idx, Ve({
499
- pathname: l,
500
- search: u,
603
+ var Ue = "beforeunload", zt = "hashchange", vt = "popstate";
604
+ function Bt(i) {
605
+ i === void 0 && (i = {});
606
+ var e = i, t = e.window, n = t === void 0 ? document.defaultView : t, a = n.history;
607
+ function r() {
608
+ var w = n.location, c = w.pathname, p = w.search, v = w.hash, $ = a.state || {};
609
+ return [$.idx, qe({
610
+ pathname: c,
611
+ search: p,
501
612
  hash: v,
502
- state: E.usr || null,
503
- key: E.key || "default"
613
+ state: $.usr || null,
614
+ key: $.key || "default"
504
615
  })];
505
616
  }
506
617
  var o = null;
507
- function f() {
618
+ function h() {
508
619
  if (o)
509
- b.call(o), o = null;
620
+ y.call(o), o = null;
510
621
  else {
511
- var p = A.Pop, l = s(), u = l[0], v = l[1];
512
- if (b.length)
513
- if (u != null) {
514
- var E = y - u;
515
- E && (o = {
516
- action: p,
622
+ var w = A.Pop, c = r(), p = c[0], v = c[1];
623
+ if (y.length)
624
+ if (p != null) {
625
+ var $ = f - p;
626
+ $ && (o = {
627
+ action: w,
517
628
  location: v,
518
629
  retry: function() {
519
- V(E * -1);
630
+ F($ * -1);
520
631
  }
521
- }, V(E));
632
+ }, F($));
522
633
  } else
523
- process.env.NODE_ENV !== "production" && De(
634
+ process.env.NODE_ENV !== "production" && Ce(
524
635
  !1,
525
636
  // TODO: Write up a doc that explains our blocking strategy in
526
637
  // detail and link to it here so people can understand better what
@@ -528,137 +639,137 @@ function _t(a) {
528
639
  "You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."
529
640
  );
530
641
  else
531
- re(p);
642
+ ae(w);
532
643
  }
533
644
  }
534
- r.addEventListener(dt, f);
535
- var c = A.Pop, w = s(), y = w[0], m = w[1], d = He(), b = He();
536
- y == null && (y = 0, i.replaceState(de({}, i.state, {
537
- idx: y
645
+ n.addEventListener(vt, h);
646
+ var l = A.Pop, m = r(), f = m[0], g = m[1], u = Ie(), y = Ie();
647
+ f == null && (f = 0, a.replaceState(pe({}, a.state, {
648
+ idx: f
538
649
  }), ""));
539
- function $(p) {
540
- return typeof p == "string" ? p : Ce(p);
650
+ function E(w) {
651
+ return typeof w == "string" ? w : Ve(w);
541
652
  }
542
- function j(p, l) {
543
- return l === void 0 && (l = null), Ve(de({
544
- pathname: m.pathname,
653
+ function V(w, c) {
654
+ return c === void 0 && (c = null), qe(pe({
655
+ pathname: g.pathname,
545
656
  hash: "",
546
657
  search: ""
547
- }, typeof p == "string" ? Qe(p) : p, {
548
- state: l,
549
- key: pt()
658
+ }, typeof w == "string" ? et(w) : w, {
659
+ state: c,
660
+ key: $t()
550
661
  }));
551
662
  }
552
- function pe(p, l) {
663
+ function ge(w, c) {
553
664
  return [{
554
- usr: p.state,
555
- key: p.key,
556
- idx: l
557
- }, $(p)];
558
- }
559
- function ge(p, l, u) {
560
- return !b.length || (b.call({
561
- action: p,
562
- location: l,
563
- retry: u
665
+ usr: w.state,
666
+ key: w.key,
667
+ idx: c
668
+ }, E(w)];
669
+ }
670
+ function me(w, c, p) {
671
+ return !y.length || (y.call({
672
+ action: w,
673
+ location: c,
674
+ retry: p
564
675
  }), !1);
565
676
  }
566
- function re(p) {
567
- c = p;
568
- var l = s();
569
- y = l[0], m = l[1], d.call({
570
- action: c,
571
- location: m
677
+ function ae(w) {
678
+ l = w;
679
+ var c = r();
680
+ f = c[0], g = c[1], u.call({
681
+ action: l,
682
+ location: g
572
683
  });
573
684
  }
574
- function ne(p, l) {
575
- var u = A.Push, v = j(p, l);
576
- function E() {
577
- ne(p, l);
685
+ function se(w, c) {
686
+ var p = A.Push, v = V(w, c);
687
+ function $() {
688
+ se(w, c);
578
689
  }
579
- if (ge(u, v, E)) {
580
- var L = pe(v, y + 1), O = L[0], T = L[1];
690
+ if (me(p, v, $)) {
691
+ var R = ge(v, f + 1), O = R[0], j = R[1];
581
692
  try {
582
- i.pushState(O, "", T);
693
+ a.pushState(O, "", j);
583
694
  } catch {
584
- r.location.assign(T);
695
+ n.location.assign(j);
585
696
  }
586
- re(u);
697
+ ae(p);
587
698
  }
588
699
  }
589
- function me(p, l) {
590
- var u = A.Replace, v = j(p, l);
591
- function E() {
592
- me(p, l);
700
+ function we(w, c) {
701
+ var p = A.Replace, v = V(w, c);
702
+ function $() {
703
+ we(w, c);
593
704
  }
594
- if (ge(u, v, E)) {
595
- var L = pe(v, y), O = L[0], T = L[1];
596
- i.replaceState(O, "", T), re(u);
705
+ if (me(p, v, $)) {
706
+ var R = ge(v, f), O = R[0], j = R[1];
707
+ a.replaceState(O, "", j), ae(p);
597
708
  }
598
709
  }
599
- function V(p) {
600
- i.go(p);
710
+ function F(w) {
711
+ a.go(w);
601
712
  }
602
- var Q = {
713
+ var Y = {
603
714
  get action() {
604
- return c;
715
+ return l;
605
716
  },
606
717
  get location() {
607
- return m;
718
+ return g;
608
719
  },
609
- createHref: $,
610
- push: ne,
611
- replace: me,
612
- go: V,
720
+ createHref: E,
721
+ push: se,
722
+ replace: we,
723
+ go: F,
613
724
  back: function() {
614
- V(-1);
725
+ F(-1);
615
726
  },
616
727
  forward: function() {
617
- V(1);
728
+ F(1);
618
729
  },
619
- listen: function(l) {
620
- return d.push(l);
730
+ listen: function(c) {
731
+ return u.push(c);
621
732
  },
622
- block: function(l) {
623
- var u = b.push(l);
624
- return b.length === 1 && r.addEventListener(Ue, _e), function() {
625
- u(), b.length || r.removeEventListener(Ue, _e);
733
+ block: function(c) {
734
+ var p = y.push(c);
735
+ return y.length === 1 && n.addEventListener(Ue, He), function() {
736
+ p(), y.length || n.removeEventListener(Ue, He);
626
737
  };
627
738
  }
628
739
  };
629
- return Q;
740
+ return Y;
630
741
  }
631
- function Ht(a) {
632
- a === void 0 && (a = {});
633
- var e = a, t = e.window, r = t === void 0 ? document.defaultView : t, i = r.history;
634
- function s() {
635
- var l = Qe(r.location.hash.substr(1)), u = l.pathname, v = u === void 0 ? "/" : u, E = l.search, L = E === void 0 ? "" : E, O = l.hash, T = O === void 0 ? "" : O, D = i.state || {};
636
- return [D.idx, Ve({
742
+ function Kt(i) {
743
+ i === void 0 && (i = {});
744
+ var e = i, t = e.window, n = t === void 0 ? document.defaultView : t, a = n.history;
745
+ function r() {
746
+ var c = et(n.location.hash.substr(1)), p = c.pathname, v = p === void 0 ? "/" : p, $ = c.search, R = $ === void 0 ? "" : $, O = c.hash, j = O === void 0 ? "" : O, D = a.state || {};
747
+ return [D.idx, qe({
637
748
  pathname: v,
638
- search: L,
639
- hash: T,
749
+ search: R,
750
+ hash: j,
640
751
  state: D.usr || null,
641
752
  key: D.key || "default"
642
753
  })];
643
754
  }
644
755
  var o = null;
645
- function f() {
756
+ function h() {
646
757
  if (o)
647
- b.call(o), o = null;
758
+ y.call(o), o = null;
648
759
  else {
649
- var l = A.Pop, u = s(), v = u[0], E = u[1];
650
- if (b.length)
760
+ var c = A.Pop, p = r(), v = p[0], $ = p[1];
761
+ if (y.length)
651
762
  if (v != null) {
652
- var L = y - v;
653
- L && (o = {
654
- action: l,
655
- location: E,
763
+ var R = f - v;
764
+ R && (o = {
765
+ action: c,
766
+ location: $,
656
767
  retry: function() {
657
- Q(L * -1);
768
+ Y(R * -1);
658
769
  }
659
- }, Q(L));
770
+ }, Y(R));
660
771
  } else
661
- process.env.NODE_ENV !== "production" && De(
772
+ process.env.NODE_ENV !== "production" && Ce(
662
773
  !1,
663
774
  // TODO: Write up a doc that explains our blocking strategy in
664
775
  // detail and link to it here so people can understand better
@@ -666,371 +777,371 @@ function Ht(a) {
666
777
  "You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation."
667
778
  );
668
779
  else
669
- ne(l);
780
+ se(c);
670
781
  }
671
782
  }
672
- r.addEventListener(dt, f), r.addEventListener(Ut, function() {
673
- var l = s(), u = l[1];
674
- Ce(u) !== Ce(m) && f();
783
+ n.addEventListener(vt, h), n.addEventListener(zt, function() {
784
+ var c = r(), p = c[1];
785
+ Ve(p) !== Ve(g) && h();
675
786
  });
676
- var c = A.Pop, w = s(), y = w[0], m = w[1], d = He(), b = He();
677
- y == null && (y = 0, i.replaceState(de({}, i.state, {
678
- idx: y
787
+ var l = A.Pop, m = r(), f = m[0], g = m[1], u = Ie(), y = Ie();
788
+ f == null && (f = 0, a.replaceState(pe({}, a.state, {
789
+ idx: f
679
790
  }), ""));
680
- function $() {
681
- var l = document.querySelector("base"), u = "";
682
- if (l && l.getAttribute("href")) {
683
- var v = r.location.href, E = v.indexOf("#");
684
- u = E === -1 ? v : v.slice(0, E);
791
+ function E() {
792
+ var c = document.querySelector("base"), p = "";
793
+ if (c && c.getAttribute("href")) {
794
+ var v = n.location.href, $ = v.indexOf("#");
795
+ p = $ === -1 ? v : v.slice(0, $);
685
796
  }
686
- return u;
797
+ return p;
687
798
  }
688
- function j(l) {
689
- return $() + "#" + (typeof l == "string" ? l : Ce(l));
799
+ function V(c) {
800
+ return E() + "#" + (typeof c == "string" ? c : Ve(c));
690
801
  }
691
- function pe(l, u) {
692
- return u === void 0 && (u = null), Ve(de({
693
- pathname: m.pathname,
802
+ function ge(c, p) {
803
+ return p === void 0 && (p = null), qe(pe({
804
+ pathname: g.pathname,
694
805
  hash: "",
695
806
  search: ""
696
- }, typeof l == "string" ? Qe(l) : l, {
697
- state: u,
698
- key: pt()
807
+ }, typeof c == "string" ? et(c) : c, {
808
+ state: p,
809
+ key: $t()
699
810
  }));
700
811
  }
701
- function ge(l, u) {
812
+ function me(c, p) {
702
813
  return [{
703
- usr: l.state,
704
- key: l.key,
705
- idx: u
706
- }, j(l)];
814
+ usr: c.state,
815
+ key: c.key,
816
+ idx: p
817
+ }, V(c)];
707
818
  }
708
- function re(l, u, v) {
709
- return !b.length || (b.call({
710
- action: l,
711
- location: u,
819
+ function ae(c, p, v) {
820
+ return !y.length || (y.call({
821
+ action: c,
822
+ location: p,
712
823
  retry: v
713
824
  }), !1);
714
825
  }
715
- function ne(l) {
716
- c = l;
717
- var u = s();
718
- y = u[0], m = u[1], d.call({
719
- action: c,
720
- location: m
826
+ function se(c) {
827
+ l = c;
828
+ var p = r();
829
+ f = p[0], g = p[1], u.call({
830
+ action: l,
831
+ location: g
721
832
  });
722
833
  }
723
- function me(l, u) {
724
- var v = A.Push, E = pe(l, u);
725
- function L() {
726
- me(l, u);
834
+ function we(c, p) {
835
+ var v = A.Push, $ = ge(c, p);
836
+ function R() {
837
+ we(c, p);
727
838
  }
728
- if (process.env.NODE_ENV !== "production" && De(E.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(l) + ")"), re(v, E, L)) {
729
- var O = ge(E, y + 1), T = O[0], D = O[1];
839
+ if (process.env.NODE_ENV !== "production" && Ce($.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.push(" + JSON.stringify(c) + ")"), ae(v, $, R)) {
840
+ var O = me($, f + 1), j = O[0], D = O[1];
730
841
  try {
731
- i.pushState(T, "", D);
842
+ a.pushState(j, "", D);
732
843
  } catch {
733
- r.location.assign(D);
844
+ n.location.assign(D);
734
845
  }
735
- ne(v);
846
+ se(v);
736
847
  }
737
848
  }
738
- function V(l, u) {
739
- var v = A.Replace, E = pe(l, u);
740
- function L() {
741
- V(l, u);
849
+ function F(c, p) {
850
+ var v = A.Replace, $ = ge(c, p);
851
+ function R() {
852
+ F(c, p);
742
853
  }
743
- if (process.env.NODE_ENV !== "production" && De(E.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(l) + ")"), re(v, E, L)) {
744
- var O = ge(E, y), T = O[0], D = O[1];
745
- i.replaceState(T, "", D), ne(v);
854
+ if (process.env.NODE_ENV !== "production" && Ce($.pathname.charAt(0) === "/", "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(c) + ")"), ae(v, $, R)) {
855
+ var O = me($, f), j = O[0], D = O[1];
856
+ a.replaceState(j, "", D), se(v);
746
857
  }
747
858
  }
748
- function Q(l) {
749
- i.go(l);
859
+ function Y(c) {
860
+ a.go(c);
750
861
  }
751
- var p = {
862
+ var w = {
752
863
  get action() {
753
- return c;
864
+ return l;
754
865
  },
755
866
  get location() {
756
- return m;
867
+ return g;
757
868
  },
758
- createHref: j,
759
- push: me,
760
- replace: V,
761
- go: Q,
869
+ createHref: V,
870
+ push: we,
871
+ replace: F,
872
+ go: Y,
762
873
  back: function() {
763
- Q(-1);
874
+ Y(-1);
764
875
  },
765
876
  forward: function() {
766
- Q(1);
877
+ Y(1);
767
878
  },
768
- listen: function(u) {
769
- return d.push(u);
879
+ listen: function(p) {
880
+ return u.push(p);
770
881
  },
771
- block: function(u) {
772
- var v = b.push(u);
773
- return b.length === 1 && r.addEventListener(Ue, _e), function() {
774
- v(), b.length || r.removeEventListener(Ue, _e);
882
+ block: function(p) {
883
+ var v = y.push(p);
884
+ return y.length === 1 && n.addEventListener(Ue, He), function() {
885
+ v(), y.length || n.removeEventListener(Ue, He);
775
886
  };
776
887
  }
777
888
  };
778
- return p;
889
+ return w;
779
890
  }
780
- function _e(a) {
781
- a.preventDefault(), a.returnValue = "";
891
+ function He(i) {
892
+ i.preventDefault(), i.returnValue = "";
782
893
  }
783
- function He() {
784
- var a = [];
894
+ function Ie() {
895
+ var i = [];
785
896
  return {
786
897
  get length() {
787
- return a.length;
898
+ return i.length;
788
899
  },
789
900
  push: function(t) {
790
- return a.push(t), function() {
791
- a = a.filter(function(r) {
792
- return r !== t;
901
+ return i.push(t), function() {
902
+ i = i.filter(function(n) {
903
+ return n !== t;
793
904
  });
794
905
  };
795
906
  },
796
907
  call: function(t) {
797
- a.forEach(function(r) {
798
- return r && r(t);
908
+ i.forEach(function(n) {
909
+ return n && n(t);
799
910
  });
800
911
  }
801
912
  };
802
913
  }
803
- function pt() {
914
+ function $t() {
804
915
  return Math.random().toString(36).substr(2, 8);
805
916
  }
806
- function Ce(a) {
807
- var e = a.pathname, t = e === void 0 ? "/" : e, r = a.search, i = r === void 0 ? "" : r, s = a.hash, o = s === void 0 ? "" : s;
808
- return i && i !== "?" && (t += i.charAt(0) === "?" ? i : "?" + i), o && o !== "#" && (t += o.charAt(0) === "#" ? o : "#" + o), t;
917
+ function Ve(i) {
918
+ var e = i.pathname, t = e === void 0 ? "/" : e, n = i.search, a = n === void 0 ? "" : n, r = i.hash, o = r === void 0 ? "" : r;
919
+ return a && a !== "?" && (t += a.charAt(0) === "?" ? a : "?" + a), o && o !== "#" && (t += o.charAt(0) === "#" ? o : "#" + o), t;
809
920
  }
810
- function Qe(a) {
921
+ function et(i) {
811
922
  var e = {};
812
- if (a) {
813
- var t = a.indexOf("#");
814
- t >= 0 && (e.hash = a.substr(t), a = a.substr(0, t));
815
- var r = a.indexOf("?");
816
- r >= 0 && (e.search = a.substr(r), a = a.substr(0, r)), a && (e.pathname = a);
923
+ if (i) {
924
+ var t = i.indexOf("#");
925
+ t >= 0 && (e.hash = i.substr(t), i = i.substr(0, t));
926
+ var n = i.indexOf("?");
927
+ n >= 0 && (e.search = i.substr(n), i = i.substr(0, n)), i && (e.pathname = i);
817
928
  }
818
929
  return e;
819
930
  }
820
- function we(a) {
821
- return lt(a, "Expected `path` to be a string. Got type: %t, value: %v"), a.split("/").map((e) => e.trim()).filter((e) => e !== "");
931
+ function be(i) {
932
+ return pt(i, "Expected `path` to be a string. Got type: %t, value: %v"), i.split("/").map((e) => e.trim()).filter((e) => e !== "");
822
933
  }
823
- function se(a) {
934
+ function ie(i) {
824
935
  var t;
825
- vt(
826
- (r) => Xe(r == null ? void 0 : r.toString),
827
- a,
936
+ Rt(
937
+ (n) => at(n == null ? void 0 : n.toString),
938
+ i,
828
939
  "Expected `parts` to be an array of objects with a .toString() method. Got type: %t, value: %v"
829
- ), a = a.filter((r) => r).flatMap(String);
830
- let e = (t = a.shift()) == null ? void 0 : t.toString();
940
+ ), i = i.filter((n) => n).flatMap(String);
941
+ let e = (t = i.shift()) == null ? void 0 : t.toString();
831
942
  if (e) {
832
- for (const r of a.map((i) => i.toString()))
833
- r.startsWith(".") ? e = qe(e, r) : e[e.length - 1] !== "/" ? r[0] !== "/" ? e += "/" + r : e += r : r[0] === "/" ? e += r.slice(1) : e += r;
943
+ for (const n of i.map((a) => a.toString()))
944
+ n.startsWith(".") ? e = Fe(e, n) : e[e.length - 1] !== "/" ? n[0] !== "/" ? e += "/" + n : e += n : n[0] === "/" ? e += n.slice(1) : e += n;
834
945
  e && e !== "/" && e.endsWith("/") && (e = e.slice(0, e.length - 1));
835
946
  }
836
947
  return e ?? "";
837
948
  }
838
- function qe(a, e) {
839
- if (lt(a, "Expected `base` to be a string. Got type: %t, value: %v"), e == null && (e = a, a = ""), e.startsWith("/"))
949
+ function Fe(i, e) {
950
+ if (pt(i, "Expected `base` to be a string. Got type: %t, value: %v"), e == null && (e = i, i = ""), e.startsWith("/"))
840
951
  return e;
841
- let t = a;
952
+ let t = i;
842
953
  for (; ; )
843
954
  if (e.startsWith("..")) {
844
- for (let r = t.length; r > 0; --r)
845
- if (t[r] === "/" || r === 0) {
846
- t = t.slice(0, r), e = e.replace(/^\.\.\/?/, "");
955
+ for (let n = t.length; n > 0; --n)
956
+ if (t[n] === "/" || n === 0) {
957
+ t = t.slice(0, n), e = e.replace(/^\.\.\/?/, "");
847
958
  break;
848
959
  }
849
960
  } else if (e.startsWith("."))
850
961
  e = e.replace(/^\.\/?/, "");
851
962
  else
852
963
  break;
853
- return se([t, e]);
964
+ return ie([t, e]);
854
965
  }
855
- function Ke(a) {
856
- if (!a) return {};
857
- a.startsWith("?") && (a = a.slice(1));
858
- const e = a.split("&").filter((t) => t.trim() !== "").map((t) => {
859
- const [r, i] = t.split("=").map((s) => s.trim());
860
- return i.toLowerCase() === "true" ? [r, !0] : i.toLowerCase() === "false" ? [r, !1] : isNaN(Number(i)) ? [r, i] : [r, Number(i)];
966
+ function tt(i) {
967
+ if (!i) return {};
968
+ i.startsWith("?") && (i = i.slice(1));
969
+ const e = i.split("&").filter((t) => t.trim() !== "").map((t) => {
970
+ const [n, a] = t.split("=").map((r) => r.trim());
971
+ return a.toLowerCase() === "true" ? [n, !0] : a.toLowerCase() === "false" ? [n, !1] : isNaN(Number(a)) ? [n, a] : [n, Number(a)];
861
972
  });
862
973
  return Object.fromEntries(e);
863
974
  }
864
- function ot(a, e, t = {}) {
975
+ function ft(i, e, t = {}) {
865
976
  var o;
866
- const [r, i] = e.split("?"), s = we(r);
867
- e: for (const f of a) {
868
- const { fragments: c } = f;
869
- if (!(((o = c[c.length - 1]) == null ? void 0 : o.type) === 3) && c.length !== s.length || t.willMatch && !t.willMatch(f))
977
+ const [n, a] = e.split("?"), r = be(n);
978
+ e: for (const h of i) {
979
+ const { fragments: l } = h;
980
+ if (!(((o = l[l.length - 1]) == null ? void 0 : o.type) === 3) && l.length !== r.length || t.willMatch && !t.willMatch(h))
870
981
  continue e;
871
- const y = [];
872
- t: for (let d = 0; d < c.length; d++) {
873
- const b = s[d], $ = c[d];
874
- if (b == null && $.type !== 3)
982
+ const f = [];
983
+ t: for (let u = 0; u < l.length; u++) {
984
+ const y = r[u], E = l[u];
985
+ if (y == null && E.type !== 3)
875
986
  continue e;
876
- switch ($.type) {
987
+ switch (E.type) {
877
988
  case 1:
878
- if ($.name.toLowerCase() === b.toLowerCase()) {
879
- y.push($);
989
+ if (E.name.toLowerCase() === y.toLowerCase()) {
990
+ f.push(E);
880
991
  break;
881
992
  } else
882
993
  continue e;
883
994
  case 2:
884
- y.push({ ...$, value: b });
995
+ f.push({ ...E, value: y });
885
996
  break;
886
997
  case 3:
887
- y.push({ ...$, value: s.slice(d).join("/") });
998
+ f.push({ ...E, value: r.slice(u).join("/") });
888
999
  break t;
889
1000
  case 4:
890
- if (isNaN(Number(b)))
1001
+ if (isNaN(Number(y)))
891
1002
  continue e;
892
- y.push({ ...$, value: Number(b) });
1003
+ f.push({ ...E, value: Number(y) });
893
1004
  break;
894
1005
  default:
895
- throw new Error(`Unknown fragment type: ${$.type}`);
1006
+ throw new Error(`Unknown fragment type: ${E.type}`);
896
1007
  }
897
1008
  }
898
- const m = /* @__PURE__ */ Object.create(null);
899
- for (const d of y)
900
- d.type === 2 && (m[d.name] = decodeURIComponent(d.value)), d.type === 4 && (m[d.name] = d.value), d.type === 3 && (m.wildcard = "/" + decodeURIComponent(d.value));
1009
+ const g = /* @__PURE__ */ Object.create(null);
1010
+ for (const u of f)
1011
+ u.type === 2 && (g[u.name] = decodeURIComponent(u.value)), u.type === 4 && (g[u.name] = u.value), u.type === 3 && (g.wildcard = "/" + decodeURIComponent(u.value));
901
1012
  return {
902
- path: "/" + y.map((d) => d.value).join("/"),
903
- pattern: "/" + c.map((d) => d.type === 2 ? `{${d.name}}` : d.type === 4 ? `{#${d.name}}` : d.name).join("/"),
904
- params: m,
905
- query: Ke(i),
906
- meta: f.meta
1013
+ path: "/" + f.map((u) => u.value).join("/"),
1014
+ pattern: "/" + l.map((u) => u.type === 2 ? `{${u.name}}` : u.type === 4 ? `{#${u.name}}` : u.name).join("/"),
1015
+ params: g,
1016
+ query: tt(a),
1017
+ meta: h.meta
907
1018
  };
908
1019
  }
909
1020
  }
910
- function Ft(a) {
911
- const e = [], t = [], r = [], i = [];
912
- for (const o of a) {
913
- const { fragments: f } = o;
914
- f.some(
915
- (c) => c.type === 3
1021
+ function Qt(i) {
1022
+ const e = [], t = [], n = [], a = [];
1023
+ for (const o of i) {
1024
+ const { fragments: h } = o;
1025
+ h.some(
1026
+ (l) => l.type === 3
916
1027
  /* Wildcard */
917
- ) ? i.push(o) : f.some(
918
- (c) => c.type === 4
1028
+ ) ? a.push(o) : h.some(
1029
+ (l) => l.type === 4
919
1030
  /* NumericParam */
920
- ) ? t.push(o) : f.some(
921
- (c) => c.type === 2
1031
+ ) ? t.push(o) : h.some(
1032
+ (l) => l.type === 2
922
1033
  /* Param */
923
- ) ? r.push(o) : e.push(o);
1034
+ ) ? n.push(o) : e.push(o);
924
1035
  }
925
- const s = (o, f) => o.fragments.length > f.fragments.length ? -1 : 1;
926
- return e.sort(s), t.sort(s), r.sort(s), i.sort(s), [...e, ...t, ...r, ...i];
1036
+ const r = (o, h) => o.fragments.length > h.fragments.length ? -1 : 1;
1037
+ return e.sort(r), t.sort(r), n.sort(r), a.sort(r), [...e, ...t, ...n, ...a];
927
1038
  }
928
- function It(a) {
929
- const e = we(a), t = [];
930
- for (let r = 0; r < e.length; r++) {
931
- const i = e[r];
932
- if (i === "*") {
933
- if (r !== e.length - 1)
934
- throw new Error(`Wildcard must be at the end of a pattern. Received: ${a}`);
1039
+ function Jt(i) {
1040
+ const e = be(i), t = [];
1041
+ for (let n = 0; n < e.length; n++) {
1042
+ const a = e[n];
1043
+ if (a === "*") {
1044
+ if (n !== e.length - 1)
1045
+ throw new Error(`Wildcard must be at the end of a pattern. Received: ${i}`);
935
1046
  t.push({
936
1047
  type: 3,
937
1048
  name: "*",
938
1049
  value: null
939
1050
  });
940
- } else i.at(0) === "{" && i.at(-1) === "}" ? t.push({
941
- type: i[1] === "#" ? 4 : 2,
942
- name: i[1] === "#" ? i.slice(2, -1) : i.slice(1, -1),
1051
+ } else a.at(0) === "{" && a.at(-1) === "}" ? t.push({
1052
+ type: a[1] === "#" ? 4 : 2,
1053
+ name: a[1] === "#" ? a.slice(2, -1) : a.slice(1, -1),
943
1054
  value: null
944
1055
  }) : t.push({
945
1056
  type: 1,
946
- name: i,
947
- value: i
1057
+ name: a,
1058
+ value: a
948
1059
  });
949
1060
  }
950
1061
  return t;
951
1062
  }
952
- var ke, N, Z, k, We, F, Pe, ee, I, ue, he, fe, Se, B, Je, Ye;
953
- class Wt {
1063
+ var Se, M, ee, P, ze, W, Re, te, z, he, fe, de, xe, J, rt, nt;
1064
+ class Yt {
954
1065
  constructor(e, t) {
955
- h(this, B);
956
- h(this, ke);
957
- h(this, N);
958
- h(this, Z);
959
- h(this, k);
960
- h(this, We, 0);
961
- h(this, F, []);
962
- h(this, Pe);
963
- h(this, ee, []);
1066
+ d(this, J);
1067
+ d(this, Se);
1068
+ d(this, M);
1069
+ d(this, ee);
1070
+ d(this, P);
1071
+ d(this, ze, 0);
1072
+ d(this, W, []);
1073
+ d(this, Re);
1074
+ d(this, te, []);
964
1075
  // Callbacks that need to be called on unmount.
965
- h(this, I, []);
1076
+ d(this, z, []);
966
1077
  /**
967
1078
  * The currently matched route pattern, if any.
968
1079
  */
969
- P(this, "$pattern");
970
- h(this, ue);
1080
+ S(this, "$pattern");
1081
+ d(this, he);
971
1082
  /**
972
1083
  * The current URL path.
973
1084
  */
974
- P(this, "$path");
975
- h(this, he);
1085
+ S(this, "$path");
1086
+ d(this, fe);
976
1087
  /**
977
1088
  * The current named path params.
978
1089
  */
979
- P(this, "$params");
980
- h(this, fe);
1090
+ S(this, "$params");
1091
+ d(this, de);
981
1092
  /**
982
1093
  * The current query params. Changes to this object will be reflected in the URL.
983
1094
  */
984
- P(this, "$query");
985
- h(this, Se);
986
- g(this, ke, e), g(this, N, e.createLogger("dolla/router")), g(this, Z, t);
987
- const [r, i] = K(null), [s, o] = K(""), [f, c] = K({}), [w, y] = K(
988
- Ke(typeof window > "u" ? "" : window.location.search ?? "")
1095
+ S(this, "$query");
1096
+ d(this, xe);
1097
+ b(this, Se, e), b(this, M, e.createLogger("dolla/router")), b(this, ee, t);
1098
+ const [n, a] = oe(null), [r, o] = oe(""), [h, l] = oe({}), [m, f] = oe(
1099
+ tt(typeof window > "u" ? "" : window.location.search ?? "")
989
1100
  );
990
- this.$pattern = r, g(this, ue, i), this.$path = s, g(this, he, o), this.$params = f, g(this, fe, c), this.$query = w, g(this, Se, y), e.beforeMount(() => {
991
- n(this, k) != null && (n(this, I).push(
992
- ut([w], (m) => {
993
- const d = new URLSearchParams();
994
- for (const $ in m)
995
- d.set($, String(m[$]));
996
- const b = "?" + d.toString();
997
- b != n(this, k).location.search && n(this, k).replace({
998
- pathname: n(this, k).location.pathname,
999
- search: b
1101
+ this.$pattern = n, b(this, he, a), this.$path = r, b(this, fe, o), this.$params = h, b(this, de, l), this.$query = m, b(this, xe, f), e.beforeMount(() => {
1102
+ s(this, P) != null && (s(this, z).push(
1103
+ gt([m], (g) => {
1104
+ const u = new URLSearchParams();
1105
+ for (const E in g)
1106
+ u.set(E, String(g[E]));
1107
+ const y = "?" + u.toString();
1108
+ y != s(this, P).location.search && s(this, P).replace({
1109
+ pathname: s(this, P).location.pathname,
1110
+ search: y
1000
1111
  });
1001
1112
  })
1002
- ), n(this, I).push(n(this, k).listen(S(this, B, Ye).bind(this))), S(this, B, Ye).call(this, n(this, k)), n(this, I).push(
1003
- Bt(n(this, Z).rootElement, (m) => {
1004
- let d = m.getAttribute("href");
1005
- n(this, N).info("Intercepted link click", m, d), /^https?:\/\/|^\//.test(d) || (d = se([n(this, k).location.pathname, d])), n(this, k).push(d);
1113
+ ), s(this, z).push(s(this, P).listen(k(this, J, nt).bind(this))), k(this, J, nt).call(this, s(this, P)), s(this, z).push(
1114
+ er(s(this, ee).rootElement, (g) => {
1115
+ let u = g.getAttribute("href");
1116
+ s(this, M).info("Intercepted link click", g, u), /^https?:\/\/|^\//.test(u) || (u = ie([s(this, P).location.pathname, u])), s(this, P).push(u);
1006
1117
  })
1007
- ), n(this, N).info("Intercepting <a> clicks within root element:", n(this, Z).rootElement));
1118
+ ), s(this, M).info("Intercepting <a> clicks within root element:", s(this, ee).rootElement));
1008
1119
  }), e.onUnmount(() => {
1009
- for (; n(this, I).length > 0; )
1010
- n(this, I).pop()();
1120
+ for (; s(this, z).length > 0; )
1121
+ s(this, z).pop()();
1011
1122
  });
1012
1123
  }
1013
1124
  setup(e) {
1014
- if (n(this, ke).isMounted) {
1015
- n(this, N).crash(
1125
+ if (s(this, Se).isMounted) {
1126
+ s(this, M).crash(
1016
1127
  new Error("Dolla is already mounted. Router setup must be called before Dolla.mount is called.")
1017
1128
  );
1018
1129
  return;
1019
1130
  }
1020
- e.style === "hash" ? g(this, k, Ht()) : g(this, k, _t()), g(this, ee, Ft(
1021
- e.routes.flatMap((t) => S(this, B, Je).call(this, t)).map((t) => ({
1131
+ e.style === "hash" ? b(this, P, Kt()) : b(this, P, Bt()), b(this, te, Qt(
1132
+ e.routes.flatMap((t) => k(this, J, rt).call(this, t)).map((t) => ({
1022
1133
  pattern: t.pattern,
1023
1134
  meta: t.meta,
1024
- fragments: It(t.pattern)
1135
+ fragments: Jt(t.pattern)
1025
1136
  }))
1026
1137
  ));
1027
- for (const t of n(this, ee))
1138
+ for (const t of s(this, te))
1028
1139
  if (t.meta.redirect) {
1029
- let r;
1030
- if (!Xe(t.meta.redirect)) if (U(t.meta.redirect)) {
1031
- if (r = t.meta.redirect, !ot(n(this, ee), r, {
1032
- willMatch(s) {
1033
- return s !== t;
1140
+ let n;
1141
+ if (!at(t.meta.redirect)) if (q(t.meta.redirect)) {
1142
+ if (n = t.meta.redirect, !ft(s(this, te), n, {
1143
+ willMatch(r) {
1144
+ return r !== t;
1034
1145
  }
1035
1146
  }))
1036
1147
  throw new Error(
@@ -1048,53 +1159,53 @@ class Wt {
1048
1159
  * Dolla.router.go["/users", 215], { replace: true }); // replace current history entry with `/users/215`
1049
1160
  */
1050
1161
  go(e, t = {}) {
1051
- if (n(this, k) == null) {
1052
- n(this, N).crash(
1162
+ if (s(this, P) == null) {
1163
+ s(this, M).crash(
1053
1164
  new Error(
1054
1165
  "Router.go was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
1055
1166
  )
1056
1167
  );
1057
1168
  return;
1058
1169
  }
1059
- let r;
1060
- Array.isArray(e) ? r = se(e) : r = e.toString(), r = qe(n(this, k).location.pathname, r), t.preserveQuery && (r += n(this, k).location.search), t.replace ? n(this, k).replace(r) : n(this, k).push(r);
1170
+ let n;
1171
+ Array.isArray(e) ? n = ie(e) : n = e.toString(), n = Fe(s(this, P).location.pathname, n), t.preserveQuery && (n += s(this, P).location.search), t.replace ? s(this, P).replace(n) : s(this, P).push(n);
1061
1172
  }
1062
1173
  /**
1063
1174
  * Navigate backward. Pass a number of steps to hit the back button that many times.
1064
1175
  */
1065
1176
  back(e = 1) {
1066
- if (n(this, k) == null) {
1067
- n(this, N).crash(
1177
+ if (s(this, P) == null) {
1178
+ s(this, M).crash(
1068
1179
  new Error(
1069
1180
  "Router.back was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
1070
1181
  )
1071
1182
  );
1072
1183
  return;
1073
1184
  }
1074
- n(this, k).go(-e);
1185
+ s(this, P).go(-e);
1075
1186
  }
1076
1187
  /**
1077
1188
  * Navigate forward. Pass a number of steps to hit the forward button that many times.
1078
1189
  */
1079
1190
  forward(e = 1) {
1080
- if (n(this, k) == null) {
1081
- n(this, N).crash(
1191
+ if (s(this, P) == null) {
1192
+ s(this, M).crash(
1082
1193
  new Error(
1083
1194
  "Router.forward was called, but the router was never configured! Run 'Dolla.router.setup' before 'Dolla.mount' to configure routes."
1084
1195
  )
1085
1196
  );
1086
1197
  return;
1087
1198
  }
1088
- n(this, k).go(e);
1199
+ s(this, P).go(e);
1089
1200
  }
1090
1201
  }
1091
- ke = new WeakMap(), N = new WeakMap(), Z = new WeakMap(), k = new WeakMap(), We = new WeakMap(), F = new WeakMap(), Pe = new WeakMap(), ee = new WeakMap(), I = new WeakMap(), ue = new WeakMap(), he = new WeakMap(), fe = new WeakMap(), Se = new WeakMap(), B = new WeakSet(), /**
1202
+ Se = new WeakMap(), M = new WeakMap(), ee = new WeakMap(), P = new WeakMap(), ze = new WeakMap(), W = new WeakMap(), Re = new WeakMap(), te = new WeakMap(), z = new WeakMap(), he = new WeakMap(), fe = new WeakMap(), de = new WeakMap(), xe = new WeakMap(), J = new WeakSet(), /**
1092
1203
  * Parses a route definition object into a set of matchable routes.
1093
1204
  *
1094
1205
  * @param route - Route config object.
1095
1206
  * @param layers - Array of parent layers. Passed when this function calls itself on nested routes.
1096
1207
  */
1097
- Je = function(e, t = [], r = []) {
1208
+ rt = function(e, t = [], n = []) {
1098
1209
  if (!(typeof e == "object" && !Array.isArray(e)) || typeof e.path != "string")
1099
1210
  throw new TypeError(`Route configs must be objects with a 'path' string property. Got: ${e}`);
1100
1211
  if (e.redirect && e.routes)
@@ -1103,146 +1214,146 @@ Je = function(e, t = [], r = []) {
1103
1214
  throw new Error("Route cannot have both a 'redirect' and a 'view'.");
1104
1215
  if (!e.view && !e.routes && !e.redirect)
1105
1216
  throw new Error("Route must have a 'view', a 'redirect', or a set of nested 'routes'.");
1106
- let i = [];
1107
- for (const c of t)
1108
- i.push(...we(c.path));
1109
- i.push(...we(e.path)), i[i.length - 1] === "*" && i.pop();
1110
- const s = [];
1217
+ let a = [];
1218
+ for (const l of t)
1219
+ a.push(...be(l.path));
1220
+ a.push(...be(e.path)), a[a.length - 1] === "*" && a.pop();
1221
+ const r = [];
1111
1222
  if (e.redirect) {
1112
- let c = e.redirect;
1113
- return U(c) && (c = qe(se(i), c), c.startsWith("/") || (c = "/" + c)), s.push({
1114
- pattern: "/" + se([...i, ...we(e.path)]),
1223
+ let l = e.redirect;
1224
+ return q(l) && (l = Fe(ie(a), l), l.startsWith("/") || (l = "/" + l)), r.push({
1225
+ pattern: "/" + ie([...a, ...be(e.path)]),
1115
1226
  meta: {
1116
- redirect: c
1227
+ redirect: l
1117
1228
  }
1118
- }), s;
1229
+ }), r;
1119
1230
  }
1120
- let o = ht;
1231
+ let o = mt;
1121
1232
  if (typeof e.view == "function")
1122
1233
  o = e.view;
1123
1234
  else if (e.view)
1124
1235
  throw new TypeError(`Route '${e.path}' expected a view function or undefined. Got: ${e.view}`);
1125
- const f = { id: et(this, We)._++, view: o };
1236
+ const h = { id: it(this, ze)._++, view: o };
1126
1237
  if (e.routes)
1127
- for (const c of e.routes)
1128
- s.push(...S(this, B, Je).call(this, c, [...t, e], [...r, f]));
1238
+ for (const l of e.routes)
1239
+ r.push(...k(this, J, rt).call(this, l, [...t, e], [...n, h]));
1129
1240
  else
1130
- s.push({
1131
- pattern: parent ? se([...t.map((c) => c.path), e.path]) : e.path,
1241
+ r.push({
1242
+ pattern: parent ? ie([...t.map((l) => l.path), e.path]) : e.path,
1132
1243
  meta: {
1133
1244
  pattern: e.path,
1134
- layers: [...r, f],
1245
+ layers: [...n, h],
1135
1246
  beforeMatch: e.beforeMatch
1136
1247
  }
1137
1248
  });
1138
- return s;
1139
- }, Ye = async function({ location: e }) {
1140
- e.search !== n(this, Pe) && (g(this, Pe, e.search), n(this, Se).call(this, Ke(e.search)));
1141
- const t = ot(n(this, ee), e.pathname);
1249
+ return r;
1250
+ }, nt = async function({ location: e }) {
1251
+ e.search !== s(this, Re) && (b(this, Re, e.search), s(this, xe).call(this, tt(e.search)));
1252
+ const t = ft(s(this, te), e.pathname);
1142
1253
  if (!t) {
1143
- n(this, ue).call(this, null), n(this, he).call(this, e.pathname), n(this, fe).call(this, {
1254
+ s(this, he).call(this, null), s(this, fe).call(this, e.pathname), s(this, de).call(this, {
1144
1255
  wildcard: e.pathname
1145
1256
  });
1146
1257
  return;
1147
1258
  }
1148
1259
  if (t.meta.beforeMatch && await t.meta.beforeMatch({
1149
1260
  // TODO: Allow setting context variables from here.
1150
- redirect: (r) => {
1261
+ redirect: (n) => {
1151
1262
  throw new Error("Redirect not yet implemented.");
1152
1263
  }
1153
1264
  }), t.meta.redirect != null)
1154
1265
  if (typeof t.meta.redirect == "string") {
1155
- const r = Qt(t.meta.redirect, t.params);
1156
- n(this, N).info(`↩️ redirecting from '${t.path}' to '${r}'`), n(this, k).replace(r);
1266
+ const n = tr(t.meta.redirect, t.params);
1267
+ s(this, M).info(`↩️ redirecting from '${t.path}' to '${n}'`), s(this, P).replace(n);
1157
1268
  } else if (typeof t.meta.redirect == "function") {
1158
- const r = {
1269
+ const n = {
1159
1270
  path: t.path,
1160
1271
  pattern: t.pattern,
1161
1272
  params: t.params,
1162
1273
  query: t.query
1163
1274
  };
1164
- let i = await t.meta.redirect(r);
1165
- if (typeof i != "string")
1275
+ let a = await t.meta.redirect(n);
1276
+ if (typeof a != "string")
1166
1277
  throw new Error("Redirect function must return a path to redirect to.");
1167
- i.startsWith("/") || (i = qe(t.path, i)), n(this, N).info(`Redirecting to: '${i}'`), n(this, k).replace(i);
1278
+ a.startsWith("/") || (a = Fe(t.path, a)), s(this, M).info(`Redirecting to: '${a}'`), s(this, P).replace(a);
1168
1279
  } else
1169
1280
  throw new TypeError("Redirect must either be a path string or a function.");
1170
- else if (n(this, N).info(`📍 navigating to '${t.path}'`), n(this, he).call(this, t.path), n(this, fe).call(this, t.params), t.pattern !== this.$pattern.get()) {
1171
- n(this, ue).call(this, t.pattern);
1172
- const r = t.meta.layers;
1173
- for (let i = 0; i < r.length; i++) {
1174
- const s = r[i], o = n(this, F)[i];
1175
- if ((o == null ? void 0 : o.id) !== s.id) {
1176
- g(this, F, n(this, F).slice(0, i));
1177
- const f = n(this, F).at(-1);
1281
+ else if (s(this, M).info(`📍 navigating to '${t.path}'`), s(this, fe).call(this, t.path), s(this, de).call(this, t.params), t.pattern !== this.$pattern.get()) {
1282
+ s(this, he).call(this, t.pattern);
1283
+ const n = t.meta.layers;
1284
+ for (let a = 0; a < n.length; a++) {
1285
+ const r = n[a], o = s(this, W)[a];
1286
+ if ((o == null ? void 0 : o.id) !== r.id) {
1287
+ b(this, W, s(this, W).slice(0, a));
1288
+ const h = s(this, W).at(-1);
1178
1289
  o && o.node.isMounted && o.node.unmount();
1179
- let c;
1180
- f ? c = f.node.setChildView(s.view) : c = n(this, Z).rootView.setChildView(s.view), n(this, F).push({ id: s.id, node: c });
1290
+ let l;
1291
+ h ? l = h.node.setChildView(r.view) : l = s(this, ee).rootView.setChildView(r.view), s(this, W).push({ id: r.id, node: l });
1181
1292
  }
1182
1293
  }
1183
1294
  }
1184
1295
  };
1185
- const zt = /(noopener|noreferrer) (noopener|noreferrer)/, Gt = /^[\w-_]+:/;
1186
- function Bt(a, e, t = window) {
1187
- function r(s) {
1188
- return !s || s === a ? null : s.localName !== "a" || s.href === void 0 ? r(s.parentNode) : s;
1296
+ const Xt = /(noopener|noreferrer) (noopener|noreferrer)/, Zt = /^[\w-_]+:/;
1297
+ function er(i, e, t = window) {
1298
+ function n(r) {
1299
+ return !r || r === i ? null : r.localName !== "a" || r.href === void 0 ? n(r.parentNode) : r;
1189
1300
  }
1190
- function i(s) {
1191
- if (s.button && s.button !== 0 || s.ctrlKey || s.metaKey || s.altKey || s.shiftKey || s.defaultPrevented)
1301
+ function a(r) {
1302
+ if (r.button && r.button !== 0 || r.ctrlKey || r.metaKey || r.altKey || r.shiftKey || r.defaultPrevented)
1192
1303
  return;
1193
- const o = r(s.target);
1194
- o && (t.location.protocol !== o.protocol || t.location.hostname !== o.hostname || t.location.port !== o.port || o.hasAttribute("data-router-ignore") || o.hasAttribute("download") || o.getAttribute("target") === "_blank" && zt.test(o.getAttribute("rel")) || Gt.test(o.getAttribute("href")) || (s.preventDefault(), e(o)));
1304
+ const o = n(r.target);
1305
+ o && (t.location.protocol !== o.protocol || t.location.hostname !== o.hostname || t.location.port !== o.port || o.hasAttribute("data-router-ignore") || o.hasAttribute("download") || o.getAttribute("target") === "_blank" && Xt.test(o.getAttribute("rel")) || Zt.test(o.getAttribute("href")) || (r.preventDefault(), e(o)));
1195
1306
  }
1196
- return a.addEventListener("click", i), function() {
1197
- a.removeEventListener("click", i);
1307
+ return i.addEventListener("click", a), function() {
1308
+ i.removeEventListener("click", a);
1198
1309
  };
1199
1310
  }
1200
- function Qt(a, e) {
1311
+ function tr(i, e) {
1201
1312
  for (const t in e) {
1202
- const r = e[t].toString();
1203
- a = a.replace(`{${t}}`, r).replace(`{#${t}}`, r);
1313
+ const n = e[t].toString();
1314
+ i = i.replace(`{${t}}`, n).replace(`{#${t}}`, n);
1204
1315
  }
1205
- return a;
1316
+ return i;
1206
1317
  }
1207
- var W, Le, z, te, Re, xe, Oe, Ne, Me, R, G;
1208
- class Kt {
1318
+ var B, Le, K, re, Ne, Oe, Me, Te, je, x, Q;
1319
+ class rr {
1209
1320
  constructor() {
1210
- P(this, "http");
1211
- P(this, "i18n");
1212
- P(this, "render");
1213
- P(this, "router");
1214
- h(this, W, !1);
1215
- h(this, Le, "production");
1216
- h(this, z);
1217
- h(this, te);
1218
- h(this, Re, Nt);
1219
- h(this, xe, []);
1220
- h(this, Oe, []);
1221
- h(this, Ne, []);
1222
- h(this, Me, []);
1223
- h(this, R, {
1321
+ S(this, "http");
1322
+ S(this, "i18n");
1323
+ S(this, "render");
1324
+ S(this, "router");
1325
+ d(this, B, !1);
1326
+ d(this, Le, "production");
1327
+ d(this, K);
1328
+ d(this, re);
1329
+ d(this, Ne, _t);
1330
+ d(this, Oe, []);
1331
+ d(this, Me, []);
1332
+ d(this, Te, []);
1333
+ d(this, je, []);
1334
+ d(this, x, {
1224
1335
  info: "development",
1225
1336
  log: "development",
1226
1337
  warn: "development",
1227
1338
  error: !0
1228
1339
  });
1229
- h(this, G, rt("*,-dolla/*"));
1230
- P(this, "createState", K);
1231
- P(this, "createSettableState", $t);
1232
- P(this, "toSettableState", Et);
1233
- P(this, "toState", Be);
1234
- P(this, "valueOf", kt);
1235
- P(this, "derive", ae);
1236
- P(this, "watch", ut);
1237
- P(this, "createRef", Pt);
1238
- P(this, "isRef", St);
1340
+ d(this, Q, ct("*,-dolla/*"));
1341
+ S(this, "createState", oe);
1342
+ S(this, "createSettableState", xt);
1343
+ S(this, "toSettableState", Lt);
1344
+ S(this, "toState", Qe);
1345
+ S(this, "valueOf", Nt);
1346
+ S(this, "derive", ye);
1347
+ S(this, "watch", gt);
1348
+ S(this, "createRef", Ot);
1349
+ S(this, "isRef", Mt);
1239
1350
  const e = this;
1240
- this.http = new Mt(), this.i18n = new Ct(this), this.render = new Vt(this), this.router = new Wt(this, {
1351
+ this.http = new Ct(), this.i18n = new It(this), this.render = new Wt(this), this.router = new Yt(this, {
1241
1352
  get rootElement() {
1242
- return n(e, z);
1353
+ return s(e, K);
1243
1354
  },
1244
1355
  get rootView() {
1245
- return n(e, te);
1356
+ return s(e, re);
1246
1357
  }
1247
1358
  });
1248
1359
  }
@@ -1250,47 +1361,47 @@ class Kt {
1250
1361
  * True when the app is connected to a DOM node and displayed to the user.
1251
1362
  */
1252
1363
  get isMounted() {
1253
- return n(this, W);
1364
+ return s(this, B);
1254
1365
  }
1255
1366
  /**
1256
1367
  * Get the current environment that this app is running in.
1257
1368
  * Environment affects which log messages will print and how much debugging info is included in the DOM.
1258
1369
  */
1259
1370
  getEnv() {
1260
- return n(this, Le);
1371
+ return s(this, Le);
1261
1372
  }
1262
1373
  /**
1263
1374
  * Sets the environment that this app is running in.
1264
1375
  * Environment affects which log messages will print and how much debugging info is included in the DOM.
1265
1376
  */
1266
1377
  setEnv(e) {
1267
- g(this, Le, e);
1378
+ b(this, Le, e);
1268
1379
  }
1269
1380
  /**
1270
1381
  * Sets the view that will be shown when the `crash` method is called on any logger.
1271
1382
  * When a crash is reported the app will be unmounted and replaced with this crash page.
1272
1383
  */
1273
1384
  setCrashView(e) {
1274
- g(this, Re, e);
1385
+ b(this, Ne, e);
1275
1386
  }
1276
1387
  async mount(e, t) {
1277
- if (n(this, W))
1388
+ if (s(this, B))
1278
1389
  throw new Error("Dolla is already mounted.");
1279
- if (U(e)) {
1280
- const i = document.querySelector(e);
1281
- nt(HTMLElement, i, `Selector '${e}' did not match any element.`), g(this, z, i);
1390
+ if (q(e)) {
1391
+ const a = document.querySelector(e);
1392
+ ut(HTMLElement, a, `Selector '${e}' did not match any element.`), b(this, K, a);
1282
1393
  } else
1283
- nt(HTMLElement, e, "Expected an HTML element or a selector string. Got type: %t, value: %v"), g(this, z, e);
1284
- let r;
1285
- t ? r = at(t) : r = at(ht), g(this, te, this.constructView(r.type, r.props)), await Promise.all(n(this, xe).map((i) => i())), n(this, te).mount(n(this, z)), g(this, W, !0);
1286
- for (const i of n(this, Oe))
1287
- i();
1394
+ ut(HTMLElement, e, "Expected an HTML element or a selector string. Got type: %t, value: %v"), b(this, K, e);
1395
+ let n;
1396
+ t ? n = ht(t) : n = ht(mt), b(this, re, this.constructView(n.type, n.props)), await Promise.all(s(this, Oe).map((a) => a())), s(this, re).mount(s(this, K)), b(this, B, !0);
1397
+ for (const a of s(this, Me))
1398
+ a();
1288
1399
  }
1289
1400
  async unmount() {
1290
1401
  var e;
1291
- if (n(this, W)) {
1292
- await Promise.all(n(this, Ne).map((t) => t())), (e = n(this, te)) == null || e.unmount(), g(this, W, !1);
1293
- for (const t of n(this, Me))
1402
+ if (s(this, B)) {
1403
+ await Promise.all(s(this, Te).map((t) => t())), (e = s(this, re)) == null || e.unmount(), b(this, B, !1);
1404
+ for (const t of s(this, je))
1294
1405
  t();
1295
1406
  }
1296
1407
  }
@@ -1299,53 +1410,53 @@ class Kt {
1299
1410
  * it will be awaited before mounting finishes. Use this to perform initial setup before the app is displayed to the user.
1300
1411
  */
1301
1412
  beforeMount(e) {
1302
- n(this, xe).push(e);
1413
+ s(this, Oe).push(e);
1303
1414
  }
1304
1415
  /**
1305
1416
  * Registers a `callback` to run after the app is mounted.
1306
1417
  */
1307
1418
  onMount(e) {
1308
- n(this, Oe).push(e);
1419
+ s(this, Me).push(e);
1309
1420
  }
1310
1421
  /**
1311
1422
  * Registers a `callback` to run after `Dolla.unmount` is called, before the app is unmounted. If `callback` returns a Promise,
1312
1423
  * it will be awaited before unmounting finishes. Use this to perform cleanup.
1313
1424
  */
1314
1425
  beforeUnmount(e) {
1315
- n(this, Ne).push(e);
1426
+ s(this, Te).push(e);
1316
1427
  }
1317
1428
  /**
1318
1429
  * Registers a `callback` to run after the app is unmounted.
1319
1430
  */
1320
1431
  onUnmount(e) {
1321
- n(this, Me).push(e);
1432
+ s(this, je).push(e);
1322
1433
  }
1323
1434
  /**
1324
1435
  * Update log type toggles. Values that are not passed will remain unchanged.
1325
1436
  */
1326
1437
  setLoggles(e) {
1327
1438
  for (const t in e) {
1328
- const r = e[t];
1329
- r && (n(this, R)[t] = r);
1439
+ const n = e[t];
1440
+ n && (s(this, x)[t] = n);
1330
1441
  }
1331
1442
  }
1332
1443
  setLogFilter(e) {
1333
- g(this, G, rt(e));
1444
+ b(this, Q, ct(e));
1334
1445
  }
1335
1446
  createLogger(e, t) {
1336
- const r = Be(e), i = (t == null ? void 0 : t.console) ?? Lt(), s = this;
1447
+ const n = Qe(e), a = (t == null ? void 0 : t.console) ?? Tt(), r = this;
1337
1448
  return {
1338
1449
  get info() {
1339
- var f;
1340
- const o = r.get();
1341
- if (n(s, R).info === !1 || U(n(s, R).info) && n(s, R).info !== s.getEnv() || !n(f = s, G).call(f, o))
1342
- return Te;
1450
+ var h;
1451
+ const o = n.get();
1452
+ if (s(r, x).info === !1 || q(s(r, x).info) && s(r, x).info !== r.getEnv() || !s(h = r, Q).call(h, o))
1453
+ return Ae;
1343
1454
  {
1344
- let c = `%c${o}`;
1345
- return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c", i.info.bind(
1346
- i,
1347
- c,
1348
- `color:${Ae(c)};font-weight:bold`,
1455
+ let l = `%c${o}`;
1456
+ return t != null && t.uid ? l += ` %c[uid: %c${t.uid}%c]` : l += "%c%c%c", a.info.bind(
1457
+ a,
1458
+ l,
1459
+ `color:${De(l)};font-weight:bold`,
1349
1460
  "color:#777",
1350
1461
  "color:#aaa",
1351
1462
  "color:#777"
@@ -1353,16 +1464,16 @@ class Kt {
1353
1464
  }
1354
1465
  },
1355
1466
  get log() {
1356
- var f;
1357
- const o = r.get();
1358
- if (n(s, R).log === !1 || U(n(s, R).log) && n(s, R).log !== s.getEnv() || !n(f = s, G).call(f, o))
1359
- return Te;
1467
+ var h;
1468
+ const o = n.get();
1469
+ if (s(r, x).log === !1 || q(s(r, x).log) && s(r, x).log !== r.getEnv() || !s(h = r, Q).call(h, o))
1470
+ return Ae;
1360
1471
  {
1361
- let c = `%c${o}`;
1362
- return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c", i.log.bind(
1363
- i,
1364
- c,
1365
- `color:${Ae(c)};font-weight:bold`,
1472
+ let l = `%c${o}`;
1473
+ return t != null && t.uid ? l += ` %c[uid: %c${t.uid}%c]` : l += "%c%c%c", a.log.bind(
1474
+ a,
1475
+ l,
1476
+ `color:${De(l)};font-weight:bold`,
1366
1477
  "color:#777",
1367
1478
  "color:#aaa",
1368
1479
  "color:#777"
@@ -1370,16 +1481,16 @@ class Kt {
1370
1481
  }
1371
1482
  },
1372
1483
  get warn() {
1373
- var f;
1374
- const o = r.get();
1375
- if (n(s, R).warn === !1 || U(n(s, R).warn) && n(s, R).warn !== s.getEnv() || !n(f = s, G).call(f, o))
1376
- return Te;
1484
+ var h;
1485
+ const o = n.get();
1486
+ if (s(r, x).warn === !1 || q(s(r, x).warn) && s(r, x).warn !== r.getEnv() || !s(h = r, Q).call(h, o))
1487
+ return Ae;
1377
1488
  {
1378
- let c = `%c${o}`;
1379
- return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c", i.warn.bind(
1380
- i,
1381
- c,
1382
- `color:${Ae(c)};font-weight:bold`,
1489
+ let l = `%c${o}`;
1490
+ return t != null && t.uid ? l += ` %c[uid: %c${t.uid}%c]` : l += "%c%c%c", a.warn.bind(
1491
+ a,
1492
+ l,
1493
+ `color:${De(l)};font-weight:bold`,
1383
1494
  "color:#777",
1384
1495
  "color:#aaa",
1385
1496
  "color:#777"
@@ -1387,16 +1498,16 @@ class Kt {
1387
1498
  }
1388
1499
  },
1389
1500
  get error() {
1390
- var f;
1391
- const o = r.get();
1392
- if (n(s, R).error === !1 || U(n(s, R).error) && n(s, R).error !== s.getEnv() || !n(f = s, G).call(f, o))
1393
- return Te;
1501
+ var h;
1502
+ const o = n.get();
1503
+ if (s(r, x).error === !1 || q(s(r, x).error) && s(r, x).error !== r.getEnv() || !s(h = r, Q).call(h, o))
1504
+ return Ae;
1394
1505
  {
1395
- let c = `%c${o}`;
1396
- return t != null && t.uid ? c += ` %c[uid: %c${t.uid}%c]` : c += "%c%c%c", i.error.bind(
1397
- i,
1398
- c,
1399
- `color:${Ae(c)};font-weight:bold`,
1506
+ let l = `%c${o}`;
1507
+ return t != null && t.uid ? l += ` %c[uid: %c${t.uid}%c]` : l += "%c%c%c", a.error.bind(
1508
+ a,
1509
+ l,
1510
+ `color:${De(l)};font-weight:bold`,
1400
1511
  "color:#777",
1401
1512
  "color:#aaa",
1402
1513
  "color:#777"
@@ -1404,45 +1515,45 @@ class Kt {
1404
1515
  }
1405
1516
  },
1406
1517
  crash(o) {
1407
- throw s.isMounted && (s.unmount(), s.constructView(n(s, Re), {
1518
+ throw r.isMounted && (r.unmount(), r.constructView(s(r, Ne), {
1408
1519
  error: o,
1409
- loggerName: r.get(),
1520
+ loggerName: n.get(),
1410
1521
  uid: t == null ? void 0 : t.uid
1411
- }).mount(n(s, z))), o;
1522
+ }).mount(s(r, K))), o;
1412
1523
  }
1413
1524
  };
1414
1525
  }
1415
1526
  /**
1416
1527
  *
1417
1528
  */
1418
- constructView(e, t, r = []) {
1419
- return Rt({ root: this, data: {} }, e, t, r);
1529
+ constructView(e, t, n = []) {
1530
+ return jt({ root: this, data: {} }, e, t, n);
1420
1531
  }
1421
1532
  /**
1422
1533
  *
1423
1534
  */
1424
1535
  constructMarkup(e) {
1425
- return xt(Ot({ root: this, data: {} }, e));
1536
+ return At(Dt({ root: this, data: {} }, e));
1426
1537
  }
1427
1538
  }
1428
- W = new WeakMap(), Le = new WeakMap(), z = new WeakMap(), te = new WeakMap(), Re = new WeakMap(), xe = new WeakMap(), Oe = new WeakMap(), Ne = new WeakMap(), Me = new WeakMap(), R = new WeakMap(), G = new WeakMap();
1429
- const ct = new Kt(), Zt = ct.i18n.t.bind(ct.i18n);
1539
+ B = new WeakMap(), Le = new WeakMap(), K = new WeakMap(), re = new WeakMap(), Ne = new WeakMap(), Oe = new WeakMap(), Me = new WeakMap(), Te = new WeakMap(), je = new WeakMap(), x = new WeakMap(), Q = new WeakMap();
1540
+ const dt = new rr(), ir = dt.i18n.t.bind(dt.i18n);
1430
1541
  export {
1431
- wt as cond,
1432
- at as createMarkup,
1433
- Pt as createRef,
1434
- $t as createSettableState,
1435
- rr as createSetter,
1436
- K as createState,
1437
- ct as default,
1438
- ae as derive,
1439
- tt as html,
1440
- St as isRef,
1441
- nr as portal,
1442
- ar as repeat,
1443
- Zt as t,
1444
- Et as toSettableState,
1445
- Be as toState,
1446
- kt as valueOf
1542
+ Pt as cond,
1543
+ ht as createMarkup,
1544
+ Ot as createRef,
1545
+ xt as createSettableState,
1546
+ cr as createSetter,
1547
+ oe as createState,
1548
+ dt as default,
1549
+ ye as derive,
1550
+ ot as html,
1551
+ Mt as isRef,
1552
+ ur as portal,
1553
+ hr as repeat,
1554
+ ir as t,
1555
+ Lt as toSettableState,
1556
+ Qe as toState,
1557
+ Nt as valueOf
1447
1558
  };
1448
1559
  //# sourceMappingURL=index.js.map