@noego/forge 0.1.18 → 0.1.19

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/client.mjs CHANGED
@@ -1,10 +1,11 @@
1
- import { p as Ee, a as b } from "./page.svelte-Bq1Q01H0.js";
2
- import { s as gt } from "./page.svelte-Bq1Q01H0.js";
3
- import * as re from "svelte/internal/client";
4
- import { hydrate as _e } from "svelte";
5
- import Oe from "../src/components/RecursiveRender.svelte";
6
- function Ae(e) {
7
- const r = new Ee(e);
1
+ import { p as Fe, a as k } from "./page.svelte-4uv4nQ2i.js";
2
+ import { s as tr } from "./page.svelte-4uv4nQ2i.js";
3
+ import "svelte/internal/client";
4
+ import { hydrate as Me } from "svelte";
5
+ import $e from "../src/components/RecursiveRender.svelte";
6
+ import { writable as me, get as C } from "svelte/store";
7
+ function We(e) {
8
+ const r = new Fe(e);
8
9
  return (t) => {
9
10
  const n = r.match(t);
10
11
  if (!n) return null;
@@ -14,116 +15,116 @@ function Ae(e) {
14
15
  return o;
15
16
  };
16
17
  }
17
- function Pe(e) {
18
+ function De(e) {
18
19
  return e.map((r) => {
19
- const t = r.path, n = Ae(t);
20
+ const t = r.path, n = We(t);
20
21
  return { pattern: t, parser: n };
21
22
  });
22
23
  }
23
- var $ = function(e, r) {
24
- return $ = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
24
+ var re = function(e, r) {
25
+ return re = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, n) {
25
26
  t.__proto__ = n;
26
27
  } || function(t, n) {
27
28
  for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]);
28
- }, $(e, r);
29
+ }, re(e, r);
29
30
  };
30
- function x(e, r) {
31
+ function L(e, r) {
31
32
  if (typeof r != "function" && r !== null)
32
33
  throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
33
- $(e, r);
34
+ re(e, r);
34
35
  function t() {
35
36
  this.constructor = e;
36
37
  }
37
38
  e.prototype = r === null ? Object.create(r) : (t.prototype = r.prototype, new t());
38
39
  }
39
- function Ie(e, r, t, n) {
40
+ function qe(e, r, t, n) {
40
41
  function o(i) {
41
42
  return i instanceof t ? i : new t(function(a) {
42
43
  a(i);
43
44
  });
44
45
  }
45
46
  return new (t || (t = Promise))(function(i, a) {
46
- function u(f) {
47
+ function c(l) {
47
48
  try {
48
- c(n.next(f));
49
- } catch (d) {
50
- a(d);
49
+ u(n.next(l));
50
+ } catch (f) {
51
+ a(f);
51
52
  }
52
53
  }
53
- function s(f) {
54
+ function s(l) {
54
55
  try {
55
- c(n.throw(f));
56
- } catch (d) {
57
- a(d);
56
+ u(n.throw(l));
57
+ } catch (f) {
58
+ a(f);
58
59
  }
59
60
  }
60
- function c(f) {
61
- f.done ? i(f.value) : o(f.value).then(u, s);
61
+ function u(l) {
62
+ l.done ? i(l.value) : o(l.value).then(c, s);
62
63
  }
63
- c((n = n.apply(e, r || [])).next());
64
+ u((n = n.apply(e, r || [])).next());
64
65
  });
65
66
  }
66
- function ne(e, r) {
67
+ function we(e, r) {
67
68
  var t = { label: 0, sent: function() {
68
69
  if (i[0] & 1) throw i[1];
69
70
  return i[1];
70
71
  }, trys: [], ops: [] }, n, o, i, a = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
71
- return a.next = u(0), a.throw = u(1), a.return = u(2), typeof Symbol == "function" && (a[Symbol.iterator] = function() {
72
+ return a.next = c(0), a.throw = c(1), a.return = c(2), typeof Symbol == "function" && (a[Symbol.iterator] = function() {
72
73
  return this;
73
74
  }), a;
74
- function u(c) {
75
- return function(f) {
76
- return s([c, f]);
75
+ function c(u) {
76
+ return function(l) {
77
+ return s([u, l]);
77
78
  };
78
79
  }
79
- function s(c) {
80
+ function s(u) {
80
81
  if (n) throw new TypeError("Generator is already executing.");
81
- for (; a && (a = 0, c[0] && (t = 0)), t; ) try {
82
- if (n = 1, o && (i = c[0] & 2 ? o.return : c[0] ? o.throw || ((i = o.return) && i.call(o), 0) : o.next) && !(i = i.call(o, c[1])).done) return i;
83
- switch (o = 0, i && (c = [c[0] & 2, i.value]), c[0]) {
82
+ for (; a && (a = 0, u[0] && (t = 0)), t; ) try {
83
+ if (n = 1, o && (i = u[0] & 2 ? o.return : u[0] ? o.throw || ((i = o.return) && i.call(o), 0) : o.next) && !(i = i.call(o, u[1])).done) return i;
84
+ switch (o = 0, i && (u = [u[0] & 2, i.value]), u[0]) {
84
85
  case 0:
85
86
  case 1:
86
- i = c;
87
+ i = u;
87
88
  break;
88
89
  case 4:
89
- return t.label++, { value: c[1], done: !1 };
90
+ return t.label++, { value: u[1], done: !1 };
90
91
  case 5:
91
- t.label++, o = c[1], c = [0];
92
+ t.label++, o = u[1], u = [0];
92
93
  continue;
93
94
  case 7:
94
- c = t.ops.pop(), t.trys.pop();
95
+ u = t.ops.pop(), t.trys.pop();
95
96
  continue;
96
97
  default:
97
- if (i = t.trys, !(i = i.length > 0 && i[i.length - 1]) && (c[0] === 6 || c[0] === 2)) {
98
+ if (i = t.trys, !(i = i.length > 0 && i[i.length - 1]) && (u[0] === 6 || u[0] === 2)) {
98
99
  t = 0;
99
100
  continue;
100
101
  }
101
- if (c[0] === 3 && (!i || c[1] > i[0] && c[1] < i[3])) {
102
- t.label = c[1];
102
+ if (u[0] === 3 && (!i || u[1] > i[0] && u[1] < i[3])) {
103
+ t.label = u[1];
103
104
  break;
104
105
  }
105
- if (c[0] === 6 && t.label < i[1]) {
106
- t.label = i[1], i = c;
106
+ if (u[0] === 6 && t.label < i[1]) {
107
+ t.label = i[1], i = u;
107
108
  break;
108
109
  }
109
110
  if (i && t.label < i[2]) {
110
- t.label = i[2], t.ops.push(c);
111
+ t.label = i[2], t.ops.push(u);
111
112
  break;
112
113
  }
113
114
  i[2] && t.ops.pop(), t.trys.pop();
114
115
  continue;
115
116
  }
116
- c = r.call(e, t);
117
- } catch (f) {
118
- c = [6, f], o = 0;
117
+ u = r.call(e, t);
118
+ } catch (l) {
119
+ u = [6, l], o = 0;
119
120
  } finally {
120
121
  n = i = 0;
121
122
  }
122
- if (c[0] & 5) throw c[1];
123
- return { value: c[0] ? c[1] : void 0, done: !0 };
123
+ if (u[0] & 5) throw u[1];
124
+ return { value: u[0] ? u[1] : void 0, done: !0 };
124
125
  }
125
126
  }
126
- function I(e) {
127
+ function j(e) {
127
128
  var r = typeof Symbol == "function" && Symbol.iterator, t = r && e[r], n = 0;
128
129
  if (t) return t.call(e);
129
130
  if (e && typeof e.length == "number") return {
@@ -133,14 +134,14 @@ function I(e) {
133
134
  };
134
135
  throw new TypeError(r ? "Object is not iterable." : "Symbol.iterator is not defined.");
135
136
  }
136
- function D(e, r) {
137
+ function N(e, r) {
137
138
  var t = typeof Symbol == "function" && e[Symbol.iterator];
138
139
  if (!t) return e;
139
140
  var n = t.call(e), o, i = [], a;
140
141
  try {
141
142
  for (; (r === void 0 || r-- > 0) && !(o = n.next()).done; ) i.push(o.value);
142
- } catch (u) {
143
- a = { error: u };
143
+ } catch (c) {
144
+ a = { error: c };
144
145
  } finally {
145
146
  try {
146
147
  o && !o.done && (t = n.return) && t.call(n);
@@ -150,81 +151,81 @@ function D(e, r) {
150
151
  }
151
152
  return i;
152
153
  }
153
- function W(e, r, t) {
154
+ function M(e, r, t) {
154
155
  if (t || arguments.length === 2) for (var n = 0, o = r.length, i; n < o; n++)
155
156
  (i || !(n in r)) && (i || (i = Array.prototype.slice.call(r, 0, n)), i[n] = r[n]);
156
157
  return e.concat(i || Array.prototype.slice.call(r));
157
158
  }
158
- function P(e) {
159
- return this instanceof P ? (this.v = e, this) : new P(e);
159
+ function R(e) {
160
+ return this instanceof R ? (this.v = e, this) : new R(e);
160
161
  }
161
- function Te(e, r, t) {
162
+ function ze(e, r, t) {
162
163
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
163
164
  var n = t.apply(e, r || []), o, i = [];
164
- return o = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), u("next"), u("throw"), u("return", a), o[Symbol.asyncIterator] = function() {
165
+ return o = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), c("next"), c("throw"), c("return", a), o[Symbol.asyncIterator] = function() {
165
166
  return this;
166
167
  }, o;
167
- function a(l) {
168
- return function(h) {
169
- return Promise.resolve(h).then(l, d);
168
+ function a(d) {
169
+ return function(p) {
170
+ return Promise.resolve(p).then(d, f);
170
171
  };
171
172
  }
172
- function u(l, h) {
173
- n[l] && (o[l] = function(v) {
174
- return new Promise(function(A, _) {
175
- i.push([l, v, A, _]) > 1 || s(l, v);
173
+ function c(d, p) {
174
+ n[d] && (o[d] = function(h) {
175
+ return new Promise(function(g, b) {
176
+ i.push([d, h, g, b]) > 1 || s(d, h);
176
177
  });
177
- }, h && (o[l] = h(o[l])));
178
+ }, p && (o[d] = p(o[d])));
178
179
  }
179
- function s(l, h) {
180
+ function s(d, p) {
180
181
  try {
181
- c(n[l](h));
182
- } catch (v) {
183
- p(i[0][3], v);
182
+ u(n[d](p));
183
+ } catch (h) {
184
+ v(i[0][3], h);
184
185
  }
185
186
  }
186
- function c(l) {
187
- l.value instanceof P ? Promise.resolve(l.value.v).then(f, d) : p(i[0][2], l);
187
+ function u(d) {
188
+ d.value instanceof R ? Promise.resolve(d.value.v).then(l, f) : v(i[0][2], d);
188
189
  }
189
- function f(l) {
190
- s("next", l);
190
+ function l(d) {
191
+ s("next", d);
191
192
  }
192
- function d(l) {
193
- s("throw", l);
193
+ function f(d) {
194
+ s("throw", d);
194
195
  }
195
- function p(l, h) {
196
- l(h), i.shift(), i.length && s(i[0][0], i[0][1]);
196
+ function v(d, p) {
197
+ d(p), i.shift(), i.length && s(i[0][0], i[0][1]);
197
198
  }
198
199
  }
199
- function xe(e) {
200
+ function Ge(e) {
200
201
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
201
202
  var r = e[Symbol.asyncIterator], t;
202
- return r ? r.call(e) : (e = typeof I == "function" ? I(e) : e[Symbol.iterator](), t = {}, n("next"), n("throw"), n("return"), t[Symbol.asyncIterator] = function() {
203
+ return r ? r.call(e) : (e = typeof j == "function" ? j(e) : e[Symbol.iterator](), t = {}, n("next"), n("throw"), n("return"), t[Symbol.asyncIterator] = function() {
203
204
  return this;
204
205
  }, t);
205
206
  function n(i) {
206
207
  t[i] = e[i] && function(a) {
207
- return new Promise(function(u, s) {
208
- a = e[i](a), o(u, s, a.done, a.value);
208
+ return new Promise(function(c, s) {
209
+ a = e[i](a), o(c, s, a.done, a.value);
209
210
  });
210
211
  };
211
212
  }
212
- function o(i, a, u, s) {
213
- Promise.resolve(s).then(function(c) {
214
- i({ value: c, done: u });
213
+ function o(i, a, c, s) {
214
+ Promise.resolve(s).then(function(u) {
215
+ i({ value: u, done: c });
215
216
  }, a);
216
217
  }
217
218
  }
218
- function m(e) {
219
+ function w(e) {
219
220
  return typeof e == "function";
220
221
  }
221
- function oe(e) {
222
+ function ae(e) {
222
223
  var r = function(n) {
223
224
  Error.call(n), n.stack = new Error().stack;
224
225
  }, t = e(r);
225
226
  return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t;
226
227
  }
227
- var V = oe(function(e) {
228
+ var X = ae(function(e) {
228
229
  return function(t) {
229
230
  e(this), this.message = t ? t.length + ` errors occurred during unsubscription:
230
231
  ` + t.map(function(n, o) {
@@ -233,13 +234,13 @@ var V = oe(function(e) {
233
234
  `) : "", this.name = "UnsubscriptionError", this.errors = t;
234
235
  };
235
236
  });
236
- function G(e, r) {
237
+ function ne(e, r) {
237
238
  if (e) {
238
239
  var t = e.indexOf(r);
239
240
  0 <= t && e.splice(t, 1);
240
241
  }
241
242
  }
242
- var k = (function() {
243
+ var B = (function() {
243
244
  function e(r) {
244
245
  this.initialTeardown = r, this.closed = !1, this._parentage = null, this._finalizers = null;
245
246
  }
@@ -251,58 +252,58 @@ var k = (function() {
251
252
  if (a)
252
253
  if (this._parentage = null, Array.isArray(a))
253
254
  try {
254
- for (var u = I(a), s = u.next(); !s.done; s = u.next()) {
255
- var c = s.value;
256
- c.remove(this);
255
+ for (var c = j(a), s = c.next(); !s.done; s = c.next()) {
256
+ var u = s.value;
257
+ u.remove(this);
257
258
  }
258
- } catch (v) {
259
- r = { error: v };
259
+ } catch (h) {
260
+ r = { error: h };
260
261
  } finally {
261
262
  try {
262
- s && !s.done && (t = u.return) && t.call(u);
263
+ s && !s.done && (t = c.return) && t.call(c);
263
264
  } finally {
264
265
  if (r) throw r.error;
265
266
  }
266
267
  }
267
268
  else
268
269
  a.remove(this);
269
- var f = this.initialTeardown;
270
- if (m(f))
270
+ var l = this.initialTeardown;
271
+ if (w(l))
271
272
  try {
272
- f();
273
- } catch (v) {
274
- i = v instanceof V ? v.errors : [v];
273
+ l();
274
+ } catch (h) {
275
+ i = h instanceof X ? h.errors : [h];
275
276
  }
276
- var d = this._finalizers;
277
- if (d) {
277
+ var f = this._finalizers;
278
+ if (f) {
278
279
  this._finalizers = null;
279
280
  try {
280
- for (var p = I(d), l = p.next(); !l.done; l = p.next()) {
281
- var h = l.value;
281
+ for (var v = j(f), d = v.next(); !d.done; d = v.next()) {
282
+ var p = d.value;
282
283
  try {
283
- Q(h);
284
- } catch (v) {
285
- i = i ?? [], v instanceof V ? i = W(W([], D(i)), D(v.errors)) : i.push(v);
284
+ de(p);
285
+ } catch (h) {
286
+ i = i ?? [], h instanceof X ? i = M(M([], N(i)), N(h.errors)) : i.push(h);
286
287
  }
287
288
  }
288
- } catch (v) {
289
- n = { error: v };
289
+ } catch (h) {
290
+ n = { error: h };
290
291
  } finally {
291
292
  try {
292
- l && !l.done && (o = p.return) && o.call(p);
293
+ d && !d.done && (o = v.return) && o.call(v);
293
294
  } finally {
294
295
  if (n) throw n.error;
295
296
  }
296
297
  }
297
298
  }
298
299
  if (i)
299
- throw new V(i);
300
+ throw new X(i);
300
301
  }
301
302
  }, e.prototype.add = function(r) {
302
303
  var t;
303
304
  if (r && r !== this)
304
305
  if (this.closed)
305
- Q(r);
306
+ de(r);
306
307
  else {
307
308
  if (r instanceof e) {
308
309
  if (r.closed || r._hasParent(this))
@@ -319,52 +320,52 @@ var k = (function() {
319
320
  this._parentage = Array.isArray(t) ? (t.push(r), t) : t ? [t, r] : r;
320
321
  }, e.prototype._removeParent = function(r) {
321
322
  var t = this._parentage;
322
- t === r ? this._parentage = null : Array.isArray(t) && G(t, r);
323
+ t === r ? this._parentage = null : Array.isArray(t) && ne(t, r);
323
324
  }, e.prototype.remove = function(r) {
324
325
  var t = this._finalizers;
325
- t && G(t, r), r instanceof e && r._removeParent(this);
326
+ t && ne(t, r), r instanceof e && r._removeParent(this);
326
327
  }, e.EMPTY = (function() {
327
328
  var r = new e();
328
329
  return r.closed = !0, r;
329
330
  })(), e;
330
- })(), ie = k.EMPTY;
331
- function ae(e) {
332
- return e instanceof k || e && "closed" in e && m(e.remove) && m(e.add) && m(e.unsubscribe);
331
+ })(), be = B.EMPTY;
332
+ function ge(e) {
333
+ return e instanceof B || e && "closed" in e && w(e.remove) && w(e.add) && w(e.unsubscribe);
333
334
  }
334
- function Q(e) {
335
- m(e) ? e() : e.unsubscribe();
335
+ function de(e) {
336
+ w(e) ? e() : e.unsubscribe();
336
337
  }
337
- var Re = {
338
+ var He = {
338
339
  Promise: void 0
339
- }, je = {
340
+ }, Be = {
340
341
  setTimeout: function(e, r) {
341
342
  for (var t = [], n = 2; n < arguments.length; n++)
342
343
  t[n - 2] = arguments[n];
343
- return setTimeout.apply(void 0, W([e, r], D(t)));
344
+ return setTimeout.apply(void 0, M([e, r], N(t)));
344
345
  },
345
346
  clearTimeout: function(e) {
346
347
  return clearTimeout(e);
347
348
  },
348
349
  delegate: void 0
349
350
  };
350
- function se(e) {
351
- je.setTimeout(function() {
351
+ function Se(e) {
352
+ Be.setTimeout(function() {
352
353
  throw e;
353
354
  });
354
355
  }
355
- function Z() {
356
+ function he() {
356
357
  }
357
- function j(e) {
358
+ function q(e) {
358
359
  e();
359
360
  }
360
- var B = (function(e) {
361
- x(r, e);
361
+ var se = (function(e) {
362
+ L(r, e);
362
363
  function r(t) {
363
364
  var n = e.call(this) || this;
364
- return n.isStopped = !1, t ? (n.destination = t, ae(t) && t.add(n)) : n.destination = Ue, n;
365
+ return n.isStopped = !1, t ? (n.destination = t, ge(t) && t.add(n)) : n.destination = Xe, n;
365
366
  }
366
367
  return r.create = function(t, n, o) {
367
- return new H(t, n, o);
368
+ return new U(t, n, o);
368
369
  }, r.prototype.next = function(t) {
369
370
  this.isStopped || this._next(t);
370
371
  }, r.prototype.error = function(t) {
@@ -388,7 +389,7 @@ var B = (function(e) {
388
389
  this.unsubscribe();
389
390
  }
390
391
  }, r;
391
- })(k), Ne = (function() {
392
+ })(B), Ye = (function() {
392
393
  function e(r) {
393
394
  this.partialObserver = r;
394
395
  }
@@ -398,7 +399,7 @@ var B = (function(e) {
398
399
  try {
399
400
  t.next(r);
400
401
  } catch (n) {
401
- R(n);
402
+ D(n);
402
403
  }
403
404
  }, e.prototype.error = function(r) {
404
405
  var t = this.partialObserver;
@@ -406,56 +407,56 @@ var B = (function(e) {
406
407
  try {
407
408
  t.error(r);
408
409
  } catch (n) {
409
- R(n);
410
+ D(n);
410
411
  }
411
412
  else
412
- R(r);
413
+ D(r);
413
414
  }, e.prototype.complete = function() {
414
415
  var r = this.partialObserver;
415
416
  if (r.complete)
416
417
  try {
417
418
  r.complete();
418
419
  } catch (t) {
419
- R(t);
420
+ D(t);
420
421
  }
421
422
  }, e;
422
- })(), H = (function(e) {
423
- x(r, e);
423
+ })(), U = (function(e) {
424
+ L(r, e);
424
425
  function r(t, n, o) {
425
426
  var i = e.call(this) || this, a;
426
- return m(t) || !t ? a = {
427
+ return w(t) || !t ? a = {
427
428
  next: t ?? void 0,
428
429
  error: n ?? void 0,
429
430
  complete: o ?? void 0
430
- } : a = t, i.destination = new Ne(a), i;
431
+ } : a = t, i.destination = new Ye(a), i;
431
432
  }
432
433
  return r;
433
- })(B);
434
- function R(e) {
435
- se(e);
434
+ })(se);
435
+ function D(e) {
436
+ Se(e);
436
437
  }
437
- function Ce(e) {
438
+ function Ke(e) {
438
439
  throw e;
439
440
  }
440
- var Ue = {
441
+ var Xe = {
441
442
  closed: !0,
442
- next: Z,
443
- error: Ce,
444
- complete: Z
445
- }, X = (function() {
443
+ next: he,
444
+ error: Ke,
445
+ complete: he
446
+ }, ue = (function() {
446
447
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
447
448
  })();
448
- function ke(e) {
449
+ function ce(e) {
449
450
  return e;
450
451
  }
451
- function Le(e) {
452
- return e.length === 0 ? ke : e.length === 1 ? e[0] : function(t) {
452
+ function Je(e) {
453
+ return e.length === 0 ? ce : e.length === 1 ? e[0] : function(t) {
453
454
  return e.reduce(function(n, o) {
454
455
  return o(n);
455
456
  }, t);
456
457
  };
457
458
  }
458
- var E = (function() {
459
+ var _ = (function() {
459
460
  function e(r) {
460
461
  r && (this._subscribe = r);
461
462
  }
@@ -463,10 +464,10 @@ var E = (function() {
463
464
  var t = new e();
464
465
  return t.source = this, t.operator = r, t;
465
466
  }, e.prototype.subscribe = function(r, t, n) {
466
- var o = this, i = Fe(r) ? r : new H(r, t, n);
467
- return j(function() {
468
- var a = o, u = a.operator, s = a.source;
469
- i.add(u ? u.call(i, s) : s ? o._subscribe(i) : o._trySubscribe(i));
467
+ var o = this, i = Qe(r) ? r : new U(r, t, n);
468
+ return q(function() {
469
+ var a = o, c = a.operator, s = a.source;
470
+ i.add(c ? c.call(i, s) : s ? o._subscribe(i) : o._trySubscribe(i));
470
471
  }), i;
471
472
  }, e.prototype._trySubscribe = function(r) {
472
473
  try {
@@ -476,11 +477,11 @@ var E = (function() {
476
477
  }
477
478
  }, e.prototype.forEach = function(r, t) {
478
479
  var n = this;
479
- return t = ee(t), new t(function(o, i) {
480
- var a = new H({
481
- next: function(u) {
480
+ return t = pe(t), new t(function(o, i) {
481
+ var a = new U({
482
+ next: function(c) {
482
483
  try {
483
- r(u);
484
+ r(c);
484
485
  } catch (s) {
485
486
  i(s), a.unsubscribe();
486
487
  }
@@ -493,15 +494,15 @@ var E = (function() {
493
494
  }, e.prototype._subscribe = function(r) {
494
495
  var t;
495
496
  return (t = this.source) === null || t === void 0 ? void 0 : t.subscribe(r);
496
- }, e.prototype[X] = function() {
497
+ }, e.prototype[ue] = function() {
497
498
  return this;
498
499
  }, e.prototype.pipe = function() {
499
500
  for (var r = [], t = 0; t < arguments.length; t++)
500
501
  r[t] = arguments[t];
501
- return Le(r)(this);
502
+ return Je(r)(this);
502
503
  }, e.prototype.toPromise = function(r) {
503
504
  var t = this;
504
- return r = ee(r), new r(function(n, o) {
505
+ return r = pe(r), new r(function(n, o) {
505
506
  var i;
506
507
  t.subscribe(function(a) {
507
508
  return i = a;
@@ -515,22 +516,22 @@ var E = (function() {
515
516
  return new e(r);
516
517
  }, e;
517
518
  })();
518
- function ee(e) {
519
+ function pe(e) {
519
520
  var r;
520
- return (r = e ?? Re.Promise) !== null && r !== void 0 ? r : Promise;
521
+ return (r = e ?? He.Promise) !== null && r !== void 0 ? r : Promise;
521
522
  }
522
- function Ve(e) {
523
- return e && m(e.next) && m(e.error) && m(e.complete);
523
+ function Ze(e) {
524
+ return e && w(e.next) && w(e.error) && w(e.complete);
524
525
  }
525
- function Fe(e) {
526
- return e && e instanceof B || Ve(e) && ae(e);
526
+ function Qe(e) {
527
+ return e && e instanceof se || Ze(e) && ge(e);
527
528
  }
528
- function Me(e) {
529
- return m(e == null ? void 0 : e.lift);
529
+ function et(e) {
530
+ return w(e == null ? void 0 : e.lift);
530
531
  }
531
- function K(e) {
532
+ function P(e) {
532
533
  return function(r) {
533
- if (Me(r))
534
+ if (et(r))
534
535
  return r.lift(function(t) {
535
536
  try {
536
537
  return e(t, this);
@@ -541,32 +542,32 @@ function K(e) {
541
542
  throw new TypeError("Unable to lift unknown Observable type");
542
543
  };
543
544
  }
544
- function z(e, r, t, n, o) {
545
- return new qe(e, r, t, n, o);
545
+ function A(e, r, t, n, o) {
546
+ return new tt(e, r, t, n, o);
546
547
  }
547
- var qe = (function(e) {
548
- x(r, e);
549
- function r(t, n, o, i, a, u) {
548
+ var tt = (function(e) {
549
+ L(r, e);
550
+ function r(t, n, o, i, a, c) {
550
551
  var s = e.call(this, t) || this;
551
- return s.onFinalize = a, s.shouldUnsubscribe = u, s._next = n ? function(c) {
552
+ return s.onFinalize = a, s.shouldUnsubscribe = c, s._next = n ? function(u) {
552
553
  try {
553
- n(c);
554
- } catch (f) {
555
- t.error(f);
554
+ n(u);
555
+ } catch (l) {
556
+ t.error(l);
556
557
  }
557
- } : e.prototype._next, s._error = i ? function(c) {
558
+ } : e.prototype._next, s._error = i ? function(u) {
558
559
  try {
559
- i(c);
560
- } catch (f) {
561
- t.error(f);
560
+ i(u);
561
+ } catch (l) {
562
+ t.error(l);
562
563
  } finally {
563
564
  this.unsubscribe();
564
565
  }
565
566
  } : e.prototype._error, s._complete = o ? function() {
566
567
  try {
567
568
  o();
568
- } catch (c) {
569
- t.error(c);
569
+ } catch (u) {
570
+ t.error(u);
570
571
  } finally {
571
572
  this.unsubscribe();
572
573
  }
@@ -579,38 +580,38 @@ var qe = (function(e) {
579
580
  e.prototype.unsubscribe.call(this), !n && ((t = this.onFinalize) === null || t === void 0 || t.call(this));
580
581
  }
581
582
  }, r;
582
- })(B), $e = oe(function(e) {
583
+ })(se), rt = ae(function(e) {
583
584
  return function() {
584
585
  e(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
585
586
  };
586
- }), ce = (function(e) {
587
- x(r, e);
587
+ }), Y = (function(e) {
588
+ L(r, e);
588
589
  function r() {
589
590
  var t = e.call(this) || this;
590
591
  return t.closed = !1, t.currentObservers = null, t.observers = [], t.isStopped = !1, t.hasError = !1, t.thrownError = null, t;
591
592
  }
592
593
  return r.prototype.lift = function(t) {
593
- var n = new te(this, this);
594
+ var n = new ve(this, this);
594
595
  return n.operator = t, n;
595
596
  }, r.prototype._throwIfClosed = function() {
596
597
  if (this.closed)
597
- throw new $e();
598
+ throw new rt();
598
599
  }, r.prototype.next = function(t) {
599
600
  var n = this;
600
- j(function() {
601
+ q(function() {
601
602
  var o, i;
602
603
  if (n._throwIfClosed(), !n.isStopped) {
603
604
  n.currentObservers || (n.currentObservers = Array.from(n.observers));
604
605
  try {
605
- for (var a = I(n.currentObservers), u = a.next(); !u.done; u = a.next()) {
606
- var s = u.value;
606
+ for (var a = j(n.currentObservers), c = a.next(); !c.done; c = a.next()) {
607
+ var s = c.value;
607
608
  s.next(t);
608
609
  }
609
- } catch (c) {
610
- o = { error: c };
610
+ } catch (u) {
611
+ o = { error: u };
611
612
  } finally {
612
613
  try {
613
- u && !u.done && (i = a.return) && i.call(a);
614
+ c && !c.done && (i = a.return) && i.call(a);
614
615
  } finally {
615
616
  if (o) throw o.error;
616
617
  }
@@ -619,7 +620,7 @@ var qe = (function(e) {
619
620
  });
620
621
  }, r.prototype.error = function(t) {
621
622
  var n = this;
622
- j(function() {
623
+ q(function() {
623
624
  if (n._throwIfClosed(), !n.isStopped) {
624
625
  n.hasError = n.isStopped = !0, n.thrownError = t;
625
626
  for (var o = n.observers; o.length; )
@@ -628,7 +629,7 @@ var qe = (function(e) {
628
629
  });
629
630
  }, r.prototype.complete = function() {
630
631
  var t = this;
631
- j(function() {
632
+ q(function() {
632
633
  if (t._throwIfClosed(), !t.isStopped) {
633
634
  t.isStopped = !0;
634
635
  for (var n = t.observers; n.length; )
@@ -649,21 +650,21 @@ var qe = (function(e) {
649
650
  }, r.prototype._subscribe = function(t) {
650
651
  return this._throwIfClosed(), this._checkFinalizedStatuses(t), this._innerSubscribe(t);
651
652
  }, r.prototype._innerSubscribe = function(t) {
652
- var n = this, o = this, i = o.hasError, a = o.isStopped, u = o.observers;
653
- return i || a ? ie : (this.currentObservers = null, u.push(t), new k(function() {
654
- n.currentObservers = null, G(u, t);
653
+ var n = this, o = this, i = o.hasError, a = o.isStopped, c = o.observers;
654
+ return i || a ? be : (this.currentObservers = null, c.push(t), new B(function() {
655
+ n.currentObservers = null, ne(c, t);
655
656
  }));
656
657
  }, r.prototype._checkFinalizedStatuses = function(t) {
657
658
  var n = this, o = n.hasError, i = n.thrownError, a = n.isStopped;
658
659
  o ? t.error(i) : a && t.complete();
659
660
  }, r.prototype.asObservable = function() {
660
- var t = new E();
661
+ var t = new _();
661
662
  return t.source = this, t;
662
663
  }, r.create = function(t, n) {
663
- return new te(t, n);
664
+ return new ve(t, n);
664
665
  }, r;
665
- })(E), te = (function(e) {
666
- x(r, e);
666
+ })(_), ve = (function(e) {
667
+ L(r, e);
667
668
  function r(t, n) {
668
669
  var o = e.call(this) || this;
669
670
  return o.destination = t, o.source = n, o;
@@ -679,47 +680,75 @@ var qe = (function(e) {
679
680
  (n = (t = this.destination) === null || t === void 0 ? void 0 : t.complete) === null || n === void 0 || n.call(t);
680
681
  }, r.prototype._subscribe = function(t) {
681
682
  var n, o;
682
- return (o = (n = this.source) === null || n === void 0 ? void 0 : n.subscribe(t)) !== null && o !== void 0 ? o : ie;
683
+ return (o = (n = this.source) === null || n === void 0 ? void 0 : n.subscribe(t)) !== null && o !== void 0 ? o : be;
684
+ }, r;
685
+ })(Y), _e = {
686
+ now: function() {
687
+ return (_e.delegate || Date).now();
688
+ },
689
+ delegate: void 0
690
+ }, nt = (function(e) {
691
+ L(r, e);
692
+ function r(t, n, o) {
693
+ t === void 0 && (t = 1 / 0), n === void 0 && (n = 1 / 0), o === void 0 && (o = _e);
694
+ var i = e.call(this) || this;
695
+ return i._bufferSize = t, i._windowTime = n, i._timestampProvider = o, i._buffer = [], i._infiniteTimeWindow = !0, i._infiniteTimeWindow = n === 1 / 0, i._bufferSize = Math.max(1, t), i._windowTime = Math.max(1, n), i;
696
+ }
697
+ return r.prototype.next = function(t) {
698
+ var n = this, o = n.isStopped, i = n._buffer, a = n._infiniteTimeWindow, c = n._timestampProvider, s = n._windowTime;
699
+ o || (i.push(t), !a && i.push(c.now() + s)), this._trimBuffer(), e.prototype.next.call(this, t);
700
+ }, r.prototype._subscribe = function(t) {
701
+ this._throwIfClosed(), this._trimBuffer();
702
+ for (var n = this._innerSubscribe(t), o = this, i = o._infiniteTimeWindow, a = o._buffer, c = a.slice(), s = 0; s < c.length && !t.closed; s += i ? 1 : 2)
703
+ t.next(c[s]);
704
+ return this._checkFinalizedStatuses(t), n;
705
+ }, r.prototype._trimBuffer = function() {
706
+ var t = this, n = t._bufferSize, o = t._timestampProvider, i = t._buffer, a = t._infiniteTimeWindow, c = (a ? 1 : 2) * n;
707
+ if (n < 1 / 0 && c < i.length && i.splice(0, i.length - c), !a) {
708
+ for (var s = o.now(), u = 0, l = 1; l < i.length && i[l] <= s; l += 2)
709
+ u = l;
710
+ u && i.splice(0, u + 1);
711
+ }
683
712
  }, r;
684
- })(ce), ue = (function(e) {
713
+ })(Y), le = (function(e) {
685
714
  return e && typeof e.length == "number" && typeof e != "function";
686
715
  });
687
- function le(e) {
688
- return m(e == null ? void 0 : e.then);
716
+ function Ee(e) {
717
+ return w(e == null ? void 0 : e.then);
689
718
  }
690
- function fe(e) {
691
- return m(e[X]);
719
+ function Oe(e) {
720
+ return w(e[ue]);
692
721
  }
693
- function de(e) {
694
- return Symbol.asyncIterator && m(e == null ? void 0 : e[Symbol.asyncIterator]);
722
+ function Ae(e) {
723
+ return Symbol.asyncIterator && w(e == null ? void 0 : e[Symbol.asyncIterator]);
695
724
  }
696
- function he(e) {
725
+ function Pe(e) {
697
726
  return new TypeError("You provided " + (e !== null && typeof e == "object" ? "an invalid object" : "'" + e + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
698
727
  }
699
- function De() {
728
+ function ot() {
700
729
  return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
701
730
  }
702
- var pe = De();
703
- function ve(e) {
704
- return m(e == null ? void 0 : e[pe]);
731
+ var Ie = ot();
732
+ function Te(e) {
733
+ return w(e == null ? void 0 : e[Ie]);
705
734
  }
706
- function ye(e) {
707
- return Te(this, arguments, function() {
735
+ function xe(e) {
736
+ return ze(this, arguments, function() {
708
737
  var t, n, o, i;
709
- return ne(this, function(a) {
738
+ return we(this, function(a) {
710
739
  switch (a.label) {
711
740
  case 0:
712
741
  t = e.getReader(), a.label = 1;
713
742
  case 1:
714
743
  a.trys.push([1, , 9, 10]), a.label = 2;
715
744
  case 2:
716
- return [4, P(t.read())];
745
+ return [4, R(t.read())];
717
746
  case 3:
718
- return n = a.sent(), o = n.value, i = n.done, i ? [4, P(void 0)] : [3, 5];
747
+ return n = a.sent(), o = n.value, i = n.done, i ? [4, R(void 0)] : [3, 5];
719
748
  case 4:
720
749
  return [2, a.sent()];
721
750
  case 5:
722
- return [4, P(o)];
751
+ return [4, R(o)];
723
752
  case 6:
724
753
  return [4, a.sent()];
725
754
  case 7:
@@ -734,63 +763,63 @@ function ye(e) {
734
763
  });
735
764
  });
736
765
  }
737
- function me(e) {
738
- return m(e == null ? void 0 : e.getReader);
766
+ function Ce(e) {
767
+ return w(e == null ? void 0 : e.getReader);
739
768
  }
740
- function L(e) {
741
- if (e instanceof E)
769
+ function I(e) {
770
+ if (e instanceof _)
742
771
  return e;
743
772
  if (e != null) {
744
- if (fe(e))
745
- return We(e);
746
- if (ue(e))
747
- return Ge(e);
773
+ if (Oe(e))
774
+ return it(e);
748
775
  if (le(e))
749
- return He(e);
750
- if (de(e))
751
- return we(e);
752
- if (ve(e))
753
- return ze(e);
754
- if (me(e))
755
- return Ye(e);
776
+ return at(e);
777
+ if (Ee(e))
778
+ return st(e);
779
+ if (Ae(e))
780
+ return Re(e);
781
+ if (Te(e))
782
+ return ut(e);
783
+ if (Ce(e))
784
+ return ct(e);
756
785
  }
757
- throw he(e);
786
+ throw Pe(e);
758
787
  }
759
- function We(e) {
760
- return new E(function(r) {
761
- var t = e[X]();
762
- if (m(t.subscribe))
788
+ function it(e) {
789
+ return new _(function(r) {
790
+ var t = e[ue]();
791
+ if (w(t.subscribe))
763
792
  return t.subscribe(r);
764
793
  throw new TypeError("Provided object does not correctly implement Symbol.observable");
765
794
  });
766
795
  }
767
- function Ge(e) {
768
- return new E(function(r) {
796
+ function at(e) {
797
+ return new _(function(r) {
769
798
  for (var t = 0; t < e.length && !r.closed; t++)
770
799
  r.next(e[t]);
771
800
  r.complete();
772
801
  });
773
802
  }
774
- function He(e) {
775
- return new E(function(r) {
803
+ function st(e) {
804
+ return new _(function(r) {
776
805
  e.then(function(t) {
777
806
  r.closed || (r.next(t), r.complete());
778
807
  }, function(t) {
779
808
  return r.error(t);
780
- }).then(null, se);
809
+ }).then(null, Se);
781
810
  });
782
811
  }
783
- function ze(e) {
784
- return new E(function(r) {
812
+ function ut(e) {
813
+ return new _(function(r) {
785
814
  var t, n;
786
815
  try {
787
- for (var o = I(e), i = o.next(); !i.done; i = o.next()) {
816
+ for (var o = j(e), i = o.next(); !i.done; i = o.next()) {
788
817
  var a = i.value;
789
818
  if (r.next(a), r.closed)
790
819
  return;
791
820
  }
792
- } catch (u) {
793
- t = { error: u };
821
+ } catch (c) {
822
+ t = { error: c };
794
823
  } finally {
795
824
  try {
796
825
  i && !i.done && (n = o.return) && n.call(o);
@@ -801,24 +830,24 @@ function ze(e) {
801
830
  r.complete();
802
831
  });
803
832
  }
804
- function we(e) {
805
- return new E(function(r) {
806
- Be(e, r).catch(function(t) {
833
+ function Re(e) {
834
+ return new _(function(r) {
835
+ lt(e, r).catch(function(t) {
807
836
  return r.error(t);
808
837
  });
809
838
  });
810
839
  }
811
- function Ye(e) {
812
- return we(ye(e));
840
+ function ct(e) {
841
+ return Re(xe(e));
813
842
  }
814
- function Be(e, r) {
843
+ function lt(e, r) {
815
844
  var t, n, o, i;
816
- return Ie(this, void 0, void 0, function() {
817
- var a, u;
818
- return ne(this, function(s) {
845
+ return qe(this, void 0, void 0, function() {
846
+ var a, c;
847
+ return we(this, function(s) {
819
848
  switch (s.label) {
820
849
  case 0:
821
- s.trys.push([0, 5, 6, 11]), t = xe(e), s.label = 1;
850
+ s.trys.push([0, 5, 6, 11]), t = Ge(e), s.label = 1;
822
851
  case 1:
823
852
  return [4, t.next()];
824
853
  case 2:
@@ -831,7 +860,7 @@ function Be(e, r) {
831
860
  case 4:
832
861
  return [3, 11];
833
862
  case 5:
834
- return u = s.sent(), o = { error: u }, [3, 11];
863
+ return c = s.sent(), o = { error: c }, [3, 11];
835
864
  case 6:
836
865
  return s.trys.push([6, , 9, 10]), n && !n.done && (i = t.return) ? [4, i.call(t)] : [3, 8];
837
866
  case 7:
@@ -849,7 +878,7 @@ function Be(e, r) {
849
878
  });
850
879
  });
851
880
  }
852
- function O(e, r, t, n, o) {
881
+ function x(e, r, t, n, o) {
853
882
  n === void 0 && (n = 0), o === void 0 && (o = !1);
854
883
  var i = r.schedule(function() {
855
884
  t(), o ? e.add(this.schedule(null, n)) : this.unsubscribe();
@@ -857,70 +886,70 @@ function O(e, r, t, n, o) {
857
886
  if (e.add(i), !o)
858
887
  return i;
859
888
  }
860
- function be(e, r) {
861
- return r === void 0 && (r = 0), K(function(t, n) {
862
- t.subscribe(z(n, function(o) {
863
- return O(n, e, function() {
889
+ function je(e, r) {
890
+ return r === void 0 && (r = 0), P(function(t, n) {
891
+ t.subscribe(A(n, function(o) {
892
+ return x(n, e, function() {
864
893
  return n.next(o);
865
894
  }, r);
866
895
  }, function() {
867
- return O(n, e, function() {
896
+ return x(n, e, function() {
868
897
  return n.complete();
869
898
  }, r);
870
899
  }, function(o) {
871
- return O(n, e, function() {
900
+ return x(n, e, function() {
872
901
  return n.error(o);
873
902
  }, r);
874
903
  }));
875
904
  });
876
905
  }
877
- function ge(e, r) {
878
- return r === void 0 && (r = 0), K(function(t, n) {
906
+ function Ne(e, r) {
907
+ return r === void 0 && (r = 0), P(function(t, n) {
879
908
  n.add(e.schedule(function() {
880
909
  return t.subscribe(n);
881
910
  }, r));
882
911
  });
883
912
  }
884
- function Xe(e, r) {
885
- return L(e).pipe(ge(r), be(r));
913
+ function ft(e, r) {
914
+ return I(e).pipe(Ne(r), je(r));
886
915
  }
887
- function Ke(e, r) {
888
- return L(e).pipe(ge(r), be(r));
916
+ function dt(e, r) {
917
+ return I(e).pipe(Ne(r), je(r));
889
918
  }
890
- function Je(e, r) {
891
- return new E(function(t) {
919
+ function ht(e, r) {
920
+ return new _(function(t) {
892
921
  var n = 0;
893
922
  return r.schedule(function() {
894
923
  n === e.length ? t.complete() : (t.next(e[n++]), t.closed || this.schedule());
895
924
  });
896
925
  });
897
926
  }
898
- function Qe(e, r) {
899
- return new E(function(t) {
927
+ function pt(e, r) {
928
+ return new _(function(t) {
900
929
  var n;
901
- return O(t, r, function() {
902
- n = e[pe](), O(t, r, function() {
930
+ return x(t, r, function() {
931
+ n = e[Ie](), x(t, r, function() {
903
932
  var o, i, a;
904
933
  try {
905
934
  o = n.next(), i = o.value, a = o.done;
906
- } catch (u) {
907
- t.error(u);
935
+ } catch (c) {
936
+ t.error(c);
908
937
  return;
909
938
  }
910
939
  a ? t.complete() : t.next(i);
911
940
  }, 0, !0);
912
941
  }), function() {
913
- return m(n == null ? void 0 : n.return) && n.return();
942
+ return w(n == null ? void 0 : n.return) && n.return();
914
943
  };
915
944
  });
916
945
  }
917
- function Se(e, r) {
946
+ function Ue(e, r) {
918
947
  if (!e)
919
948
  throw new Error("Iterable cannot be null");
920
- return new E(function(t) {
921
- O(t, r, function() {
949
+ return new _(function(t) {
950
+ x(t, r, function() {
922
951
  var n = e[Symbol.asyncIterator]();
923
- O(t, r, function() {
952
+ x(t, r, function() {
924
953
  n.next().then(function(o) {
925
954
  o.done ? t.complete() : t.next(o.value);
926
955
  });
@@ -928,54 +957,334 @@ function Se(e, r) {
928
957
  });
929
958
  });
930
959
  }
931
- function Ze(e, r) {
932
- return Se(ye(e), r);
960
+ function vt(e, r) {
961
+ return Ue(xe(e), r);
933
962
  }
934
- function et(e, r) {
963
+ function yt(e, r) {
935
964
  if (e != null) {
936
- if (fe(e))
937
- return Xe(e, r);
938
- if (ue(e))
939
- return Je(e, r);
965
+ if (Oe(e))
966
+ return ft(e, r);
940
967
  if (le(e))
941
- return Ke(e, r);
942
- if (de(e))
943
- return Se(e, r);
944
- if (ve(e))
945
- return Qe(e, r);
946
- if (me(e))
947
- return Ze(e, r);
968
+ return ht(e, r);
969
+ if (Ee(e))
970
+ return dt(e, r);
971
+ if (Ae(e))
972
+ return Ue(e, r);
973
+ if (Te(e))
974
+ return pt(e, r);
975
+ if (Ce(e))
976
+ return vt(e, r);
948
977
  }
949
- throw he(e);
978
+ throw Pe(e);
979
+ }
980
+ function Le(e, r) {
981
+ return r ? yt(e, r) : I(e);
982
+ }
983
+ var mt = ae(function(e) {
984
+ return function() {
985
+ e(this), this.name = "EmptyError", this.message = "no elements in sequence";
986
+ };
987
+ });
988
+ function wt(e, r) {
989
+ return new Promise(function(t, n) {
990
+ var o = new U({
991
+ next: function(i) {
992
+ t(i), o.unsubscribe();
993
+ },
994
+ error: n,
995
+ complete: function() {
996
+ n(new mt());
997
+ }
998
+ });
999
+ e.subscribe(o);
1000
+ });
1001
+ }
1002
+ function fe(e, r) {
1003
+ return P(function(t, n) {
1004
+ var o = 0;
1005
+ t.subscribe(A(n, function(i) {
1006
+ n.next(e.call(r, i, o++));
1007
+ }));
1008
+ });
1009
+ }
1010
+ var bt = Array.isArray;
1011
+ function gt(e, r) {
1012
+ return bt(r) ? e.apply(void 0, M([], N(r))) : e(r);
1013
+ }
1014
+ function St(e) {
1015
+ return fe(function(r) {
1016
+ return gt(e, r);
1017
+ });
1018
+ }
1019
+ function _t(e, r, t, n, o, i, a, c) {
1020
+ var s = [], u = 0, l = 0, f = !1, v = function() {
1021
+ f && !s.length && !u && r.complete();
1022
+ }, d = function(h) {
1023
+ return u < n ? p(h) : s.push(h);
1024
+ }, p = function(h) {
1025
+ u++;
1026
+ var g = !1;
1027
+ I(t(h, l++)).subscribe(A(r, function(b) {
1028
+ r.next(b);
1029
+ }, function() {
1030
+ g = !0;
1031
+ }, void 0, function() {
1032
+ if (g)
1033
+ try {
1034
+ u--;
1035
+ for (var b = function() {
1036
+ var y = s.shift();
1037
+ a || p(y);
1038
+ }; s.length && u < n; )
1039
+ b();
1040
+ v();
1041
+ } catch (y) {
1042
+ r.error(y);
1043
+ }
1044
+ }));
1045
+ };
1046
+ return e.subscribe(A(r, d, function() {
1047
+ f = !0, v();
1048
+ })), function() {
1049
+ };
1050
+ }
1051
+ function ke(e, r, t) {
1052
+ return t === void 0 && (t = 1 / 0), w(r) ? ke(function(n, o) {
1053
+ return fe(function(i, a) {
1054
+ return r(n, i, o, a);
1055
+ })(I(e(n, o)));
1056
+ }, t) : (typeof r == "number" && (t = r), P(function(n, o) {
1057
+ return _t(n, o, e, t);
1058
+ }));
1059
+ }
1060
+ var Et = ["addListener", "removeListener"], Ot = ["addEventListener", "removeEventListener"], At = ["on", "off"];
1061
+ function oe(e, r, t, n) {
1062
+ if (w(t) && (n = t, t = void 0), n)
1063
+ return oe(e, r, t).pipe(St(n));
1064
+ var o = N(Tt(e) ? Ot.map(function(c) {
1065
+ return function(s) {
1066
+ return e[c](r, s, t);
1067
+ };
1068
+ }) : Pt(e) ? Et.map(ye(e, r)) : It(e) ? At.map(ye(e, r)) : [], 2), i = o[0], a = o[1];
1069
+ if (!i && le(e))
1070
+ return ke(function(c) {
1071
+ return oe(c, r, t);
1072
+ })(I(e));
1073
+ if (!i)
1074
+ throw new TypeError("Invalid event target");
1075
+ return new _(function(c) {
1076
+ var s = function() {
1077
+ for (var u = [], l = 0; l < arguments.length; l++)
1078
+ u[l] = arguments[l];
1079
+ return c.next(1 < u.length ? u : u[0]);
1080
+ };
1081
+ return i(s), function() {
1082
+ return a(s);
1083
+ };
1084
+ });
1085
+ }
1086
+ function ye(e, r) {
1087
+ return function(t) {
1088
+ return function(n) {
1089
+ return e[t](r, n);
1090
+ };
1091
+ };
1092
+ }
1093
+ function Pt(e) {
1094
+ return w(e.addListener) && w(e.removeListener);
1095
+ }
1096
+ function It(e) {
1097
+ return w(e.on) && w(e.off);
950
1098
  }
951
- function tt(e, r) {
952
- return r ? et(e, r) : L(e);
1099
+ function Tt(e) {
1100
+ return w(e.addEventListener) && w(e.removeEventListener);
953
1101
  }
954
- function rt(e, r) {
955
- return K(function(t, n) {
956
- var o = null, i = 0, a = !1, u = function() {
1102
+ function J(e, r) {
1103
+ return P(function(t, n) {
1104
+ var o = 0;
1105
+ t.subscribe(A(n, function(i) {
1106
+ return e.call(r, i, o++) && n.next(i);
1107
+ }));
1108
+ });
1109
+ }
1110
+ function xt(e, r) {
1111
+ return r === void 0 && (r = ce), e = e ?? Ct, P(function(t, n) {
1112
+ var o, i = !0;
1113
+ t.subscribe(A(n, function(a) {
1114
+ var c = r(a);
1115
+ (i || !e(o, c)) && (i = !1, o = c, n.next(a));
1116
+ }));
1117
+ });
1118
+ }
1119
+ function Ct(e, r) {
1120
+ return e === r;
1121
+ }
1122
+ function Rt(e) {
1123
+ e === void 0 && (e = {});
1124
+ var r = e.connector, t = r === void 0 ? function() {
1125
+ return new Y();
1126
+ } : r, n = e.resetOnError, o = n === void 0 ? !0 : n, i = e.resetOnComplete, a = i === void 0 ? !0 : i, c = e.resetOnRefCountZero, s = c === void 0 ? !0 : c;
1127
+ return function(u) {
1128
+ var l, f, v, d = 0, p = !1, h = !1, g = function() {
1129
+ f == null || f.unsubscribe(), f = void 0;
1130
+ }, b = function() {
1131
+ g(), l = v = void 0, p = h = !1;
1132
+ }, y = function() {
1133
+ var m = l;
1134
+ b(), m == null || m.unsubscribe();
1135
+ };
1136
+ return P(function(m, E) {
1137
+ d++, !h && !p && g();
1138
+ var $ = v = v ?? t();
1139
+ E.add(function() {
1140
+ d--, d === 0 && !h && !p && (f = Z(y, s));
1141
+ }), $.subscribe(E), !l && d > 0 && (l = new U({
1142
+ next: function(W) {
1143
+ return $.next(W);
1144
+ },
1145
+ error: function(W) {
1146
+ h = !0, g(), f = Z(b, o, W), $.error(W);
1147
+ },
1148
+ complete: function() {
1149
+ p = !0, g(), f = Z(b, a), $.complete();
1150
+ }
1151
+ }), I(m).subscribe(l));
1152
+ })(u);
1153
+ };
1154
+ }
1155
+ function Z(e, r) {
1156
+ for (var t = [], n = 2; n < arguments.length; n++)
1157
+ t[n - 2] = arguments[n];
1158
+ if (r === !0) {
1159
+ e();
1160
+ return;
1161
+ }
1162
+ if (r !== !1) {
1163
+ var o = new U({
1164
+ next: function() {
1165
+ o.unsubscribe(), e();
1166
+ }
1167
+ });
1168
+ return I(r.apply(void 0, M([], N(t)))).subscribe(o);
1169
+ }
1170
+ }
1171
+ function Ve(e, r) {
1172
+ return P(function(t, n) {
1173
+ var o = null, i = 0, a = !1, c = function() {
957
1174
  return a && !o && n.complete();
958
1175
  };
959
- t.subscribe(z(n, function(s) {
1176
+ t.subscribe(A(n, function(s) {
960
1177
  o == null || o.unsubscribe();
961
- var c = 0, f = i++;
962
- L(e(s, f)).subscribe(o = z(n, function(d) {
963
- return n.next(r ? r(s, d, f, c++) : d);
1178
+ var u = 0, l = i++;
1179
+ I(e(s, l)).subscribe(o = A(n, function(f) {
1180
+ return n.next(r ? r(s, f, l, u++) : f);
964
1181
  }, function() {
965
- o = null, u();
1182
+ o = null, c();
966
1183
  }));
967
1184
  }, function() {
968
- a = !0, u();
1185
+ a = !0, c();
969
1186
  }));
970
1187
  });
971
1188
  }
972
- const nt = 1e4;
973
- function ot(e, r, t) {
1189
+ function jt(e, r, t) {
1190
+ var n = w(e) || r || t ? { next: e, error: r, complete: t } : e;
1191
+ return n ? P(function(o, i) {
1192
+ var a;
1193
+ (a = n.subscribe) === null || a === void 0 || a.call(n);
1194
+ var c = !0;
1195
+ o.subscribe(A(i, function(s) {
1196
+ var u;
1197
+ (u = n.next) === null || u === void 0 || u.call(n, s), i.next(s);
1198
+ }, function() {
1199
+ var s;
1200
+ c = !1, (s = n.complete) === null || s === void 0 || s.call(n), i.complete();
1201
+ }, function(s) {
1202
+ var u;
1203
+ c = !1, (u = n.error) === null || u === void 0 || u.call(n, s), i.error(s);
1204
+ }, function() {
1205
+ var s, u;
1206
+ c && ((s = n.unsubscribe) === null || s === void 0 || s.call(n)), (u = n.finalize) === null || u === void 0 || u.call(n);
1207
+ }));
1208
+ }) : ce;
1209
+ }
1210
+ const V = me({});
1211
+ async function Nt() {
1212
+ V.update((e) => (Object.assign(e, window.__MANIFEST__), e));
1213
+ }
1214
+ const T = /* @__PURE__ */ new Map(), z = 5e3;
1215
+ function Ut(e) {
1216
+ const r = T.get(e);
1217
+ return r ? (T.delete(e), Date.now() - r.createdAt > z ? (r.abortController.abort(), null) : r.response$) : null;
1218
+ }
1219
+ function Lt(e, r) {
1220
+ oe(document, "mouseover").pipe(Rt()).pipe(
1221
+ // Extract <a> element from hover target
1222
+ fe((o) => {
1223
+ const i = o.target, a = (i == null ? void 0 : i.tagName) === "A" ? i : i == null ? void 0 : i.closest("A");
1224
+ if (!a) return null;
1225
+ const c = a.getAttribute("href");
1226
+ return !c || !c.startsWith("/") && !c.startsWith(".") ? null : c;
1227
+ }),
1228
+ // Drop non-link hovers
1229
+ J((o) => o !== null),
1230
+ // Drop if same URL as current page
1231
+ J((o) => o !== window.location.pathname),
1232
+ // Deduplicate consecutive hovers to same URL
1233
+ xt(),
1234
+ // Check that route requires server data
1235
+ J((o) => {
1236
+ const i = o.split("?")[0], a = "get", c = e.find(
1237
+ (l) => l.method.toLowerCase() === a && r.find((f) => f.parser(i) && f.pattern === l.path)
1238
+ );
1239
+ if (!c) return !1;
1240
+ const s = r.find((l) => l.parser(i) && l.pattern === c.path);
1241
+ return !!C(V)[s == null ? void 0 : s.pattern];
1242
+ }),
1243
+ // switchMap cancels prior prefetch when hovering a new link
1244
+ Ve((o) => {
1245
+ const i = T.get(o);
1246
+ if (i && Date.now() - i.createdAt < z)
1247
+ return [];
1248
+ const a = new AbortController(), c = new nt(1), s = {
1249
+ response$: c,
1250
+ createdAt: Date.now(),
1251
+ abortController: a
1252
+ };
1253
+ T.set(o, s);
1254
+ const u = {
1255
+ method: "GET",
1256
+ headers: {
1257
+ "Content-Type": "application/json",
1258
+ Accept: "application/json"
1259
+ },
1260
+ signal: a.signal
1261
+ };
1262
+ return u[K] = !0, Le(
1263
+ fetch(o, u).then(
1264
+ (l) => (c.next(l), c.complete(), o),
1265
+ (l) => (c.error(l), T.delete(o), null)
1266
+ )
1267
+ ).pipe(
1268
+ jt({
1269
+ unsubscribe: () => {
1270
+ a.abort(), T.delete(o);
1271
+ }
1272
+ })
1273
+ );
1274
+ })
1275
+ ).subscribe(), setInterval(() => {
1276
+ const o = Date.now();
1277
+ for (const [i, a] of T)
1278
+ o - a.createdAt > z && (a.abortController.abort(), T.delete(i));
1279
+ }, z);
1280
+ }
1281
+ const kt = 1e4;
1282
+ function Vt(e, r, t) {
974
1283
  let n = null, o = !1;
975
- const i = new Promise((a, u) => {
1284
+ const i = new Promise((a, c) => {
976
1285
  n = setTimeout(
977
1286
  () => {
978
- o = !0, console.error("[TIMEOUT] Timeout fired after", r, "ms"), t(), u(new Error(`Navigation timed out after ${r}ms`));
1287
+ o = !0, console.error("[TIMEOUT] Timeout fired after", r, "ms"), t(), c(new Error(`Navigation timed out after ${r}ms`));
979
1288
  },
980
1289
  r
981
1290
  ), console.log("[TIMEOUT] Timeout scheduled for", r, "ms, timeoutId:", n);
@@ -987,9 +1296,9 @@ function ot(e, r, t) {
987
1296
  i
988
1297
  ]);
989
1298
  }
990
- const Y = new ce();
991
- let g = 0, T = null;
992
- function it(e) {
1299
+ const ie = new Y();
1300
+ let S = 0, F = null;
1301
+ function Ft(e) {
993
1302
  e && e.redirectPath && (console.log("[NAV] Handling redirect to", e.redirectPath), setTimeout(
994
1303
  () => {
995
1304
  window.dispatchEvent(new CustomEvent("forge-redirect", { detail: { path: e.redirectPath } }));
@@ -997,28 +1306,30 @@ function it(e) {
997
1306
  0
998
1307
  ));
999
1308
  }
1000
- Y.pipe(rt((e) => tt(ot(ct(e), nt, () => {
1001
- console.error("[NAV] Navigation timed out"), g++, T && (T.abort(), T = null);
1309
+ ie.pipe(Ve((e) => Le(Vt(Dt(e), kt, () => {
1310
+ console.error("[NAV] Navigation timed out"), S++, F && (F.abort(), F = null);
1002
1311
  }).catch((r) => {
1003
1312
  console.error("[NAV] Navigation failed:", r);
1004
1313
  })))).subscribe({
1005
- next: it,
1314
+ next: Ft,
1006
1315
  error: (e) => {
1007
1316
  console.error("[NAV] Stream error:", e);
1008
1317
  }
1009
1318
  });
1010
- function at(e) {
1319
+ function Mt(e) {
1011
1320
  var r;
1012
1321
  console.log("[NAV STREAM] Pushing navigation event to stream", {
1013
1322
  url: e.url,
1014
- currentNavigationId: g,
1015
- subscriberCount: ((r = Y.observers) == null ? void 0 : r.length) || 0
1016
- }), Y.next(e);
1323
+ currentNavigationId: S,
1324
+ subscriberCount: ((r = ie.observers) == null ? void 0 : r.length) || 0
1325
+ }), ie.next(e);
1017
1326
  }
1018
- const w = re.proxy({
1327
+ const O = me({
1019
1328
  active: {
1020
1329
  layouts: [],
1021
1330
  view: null,
1331
+ viewPath: null,
1332
+ layoutPaths: [],
1022
1333
  data: { layout: [], view: {} },
1023
1334
  params: {},
1024
1335
  urlParams: {},
@@ -1026,61 +1337,69 @@ const w = re.proxy({
1026
1337
  },
1027
1338
  phase: "idle",
1028
1339
  navigationId: 0,
1029
- page: b
1030
- });
1031
- b.poll = async () => {
1340
+ page: k
1341
+ }), $t = async () => {
1342
+ const e = C(O).navigationId;
1032
1343
  try {
1033
- const e = window.location.pathname + window.location.search, r = {
1344
+ const r = window.location.pathname + window.location.search, t = {
1034
1345
  method: "GET",
1035
1346
  headers: {
1036
1347
  "Content-Type": "application/json",
1037
1348
  Accept: "application/json"
1038
1349
  }
1039
1350
  };
1040
- r[J] = !0;
1041
- const t = await fetch(e, r);
1042
- if (!t.ok) return !1;
1043
- const n = await t.json();
1044
- return w.active.data = { ...w.active.data, view: n.view }, !0;
1351
+ t[K] = !0;
1352
+ const n = await fetch(r, t);
1353
+ if (!n.ok) return !1;
1354
+ const o = await n.json(), i = C(O).navigationId;
1355
+ return e !== i ? (console.log("[NAV POLL] Discarding stale poll response", { pollNavigationId: e, currentNavigationId: i }), !1) : (O.update((a) => {
1356
+ var c;
1357
+ return a.active.data = { layout: ((c = a.active.data) == null ? void 0 : c.layout) || [], view: o.view }, a;
1358
+ }), !0);
1045
1359
  } catch {
1046
1360
  return !1;
1047
1361
  }
1048
1362
  };
1049
- function U(...e) {
1363
+ k.update((e) => (e.poll = $t, e));
1364
+ function H(...e) {
1050
1365
  let r = e.map((t, n) => n === 0 ? t.replace(/\/+$/, "") : t.replace(/^\/+|\/+$/g, "")).join("/");
1051
1366
  return r.startsWith("/") || (r = "/" + r), r.split("?")[0];
1052
1367
  }
1053
- async function st(e, r, t, n, o, i) {
1368
+ async function Wt(e, r, t, n, o, i) {
1054
1369
  try {
1055
- const a = typeof r == "string" && r.indexOf("assets") !== -1, u = (t.layout || []).map((l) => {
1056
- let h = U(r, l).toString();
1057
- return a && (h = h.endsWith(".svelte") ? h.replace(/\.svelte$/, ".js") : /[.][a-z]+$/.test(h) ? h : h + ".js"), h;
1370
+ const a = typeof r == "string" && r.indexOf("assets") !== -1, c = (t.layout || []).map((d) => {
1371
+ let p = H(r, d).toString();
1372
+ return a && (p = p.endsWith(".svelte") ? p.replace(/\.svelte$/, ".js") : /[.][a-z]+$/.test(p) ? p : p + ".js"), p;
1058
1373
  });
1059
- let s = U(r, t.view).toString();
1374
+ let s = H(r, t.view).toString();
1060
1375
  a && (s = s.endsWith(".svelte") ? s.replace(/\.svelte$/, ".js") : /[.][a-z]+$/.test(s) ? s : s + ".js");
1061
- const c = await Promise.all(u.map((l) => import(
1376
+ const u = await Promise.all(c.map((d) => import(
1062
1377
  /* @vite-ignore */
1063
- l
1064
- ).then((h) => h.default)));
1378
+ d
1379
+ ).then((p) => p.default)));
1065
1380
  s.startsWith("/") || (s = "/" + s);
1066
- const f = await import(
1381
+ const l = await import(
1067
1382
  /* @vite-ignore */
1068
1383
  s
1069
- ).then((l) => l.default), d = window.__INITIAL_DATA__ || { layout: [], view: {} }, p = {
1070
- layouts: c,
1071
- view: f,
1072
- data: d,
1384
+ ).then((d) => d.default), f = window.__INITIAL_DATA__ || { layout: [], view: {} }, v = {
1385
+ layouts: u,
1386
+ view: l,
1387
+ viewPath: t.view || null,
1388
+ // Store original path for debugging
1389
+ layoutPaths: t.layout || [],
1390
+ // Store original paths for debugging
1391
+ data: f,
1073
1392
  params: n,
1074
1393
  urlParams: o,
1075
1394
  query: i
1076
1395
  };
1077
- w.active = p, w.phase = "idle", _e(Oe, { target: e, props: { root: w } });
1396
+ O.update((d) => (d.active = v, d.phase = "idle", d)), Me($e, { target: e, props: { root: O } });
1078
1397
  } catch (a) {
1079
1398
  console.error("Client-side route loading failed:", a);
1080
1399
  }
1081
1400
  }
1082
- function F(e, r, t, n, o, i, a = !1, u = !0) {
1083
- at({
1401
+ function Q(e, r, t, n, o, i, a = !1, c = !0) {
1402
+ Mt({
1084
1403
  url: e,
1085
1404
  base_path: r,
1086
1405
  route: t,
@@ -1088,10 +1407,10 @@ function F(e, r, t, n, o, i, a = !1, u = !0) {
1088
1407
  urlParams: o,
1089
1408
  query: i,
1090
1409
  server_loading: a,
1091
- updateUrl: u
1410
+ updateUrl: c
1092
1411
  });
1093
1412
  }
1094
- async function ct(e) {
1413
+ async function Dt(e) {
1095
1414
  const {
1096
1415
  url: r,
1097
1416
  base_path: t,
@@ -1099,112 +1418,128 @@ async function ct(e) {
1099
1418
  params: o,
1100
1419
  urlParams: i,
1101
1420
  query: a,
1102
- server_loading: u,
1421
+ server_loading: c,
1103
1422
  updateUrl: s
1104
- } = e, c = ++g, f = new AbortController();
1105
- T = f, console.log("[NAV] Starting navigation", {
1106
- navigationId: c,
1423
+ } = e, u = ++S, l = new AbortController();
1424
+ F = l, console.log("[NAV] Starting navigation", {
1425
+ navigationId: u,
1107
1426
  url: r,
1108
1427
  updateUrl: s,
1109
- server_loading: u,
1110
- currentNavigationId: g,
1111
- hasAbortController: !!T
1112
- }), w.phase = "loading", w.navigationId = c;
1428
+ server_loading: c,
1429
+ currentNavigationId: S,
1430
+ hasAbortController: !!F
1431
+ }), O.update((f) => (f.phase = "loading", f.navigationId = u, f));
1113
1432
  try {
1114
- let d = { layout: [], view: {} };
1115
- if (u) {
1116
- console.log("[NAV] Fetching server data", { navigationId: c, url: r });
1117
- const S = {
1118
- method: n.method,
1119
- headers: {
1120
- "Content-Type": "application/json",
1121
- Accept: "application/json"
1122
- },
1123
- signal: f.signal
1124
- };
1125
- S[J] = !0;
1126
- const y = await fetch(r, S);
1433
+ let f = { layout: [], view: {} };
1434
+ if (c) {
1435
+ console.log("[NAV] Fetching server data", { navigationId: u, url: r });
1436
+ let y = null;
1437
+ const m = Ut(r);
1438
+ if (m)
1439
+ try {
1440
+ console.log("[NAV] Using prefetched response for", r), y = await wt(m);
1441
+ } catch {
1442
+ console.log("[NAV] Prefetch failed, falling back to fetch", r), y = null;
1443
+ }
1444
+ if (!y) {
1445
+ const E = {
1446
+ method: n.method,
1447
+ headers: {
1448
+ "Content-Type": "application/json",
1449
+ Accept: "application/json"
1450
+ },
1451
+ signal: l.signal
1452
+ };
1453
+ E[K] = !0, y = await fetch(r, E);
1454
+ }
1127
1455
  if (console.log("[NAV] Fetch response received", {
1128
- navigationId: c,
1456
+ navigationId: u,
1129
1457
  url: r,
1130
1458
  ok: y.ok,
1131
1459
  status: y.status,
1132
1460
  redirected: y.redirected,
1133
- currentNavigationId: g
1461
+ currentNavigationId: S
1134
1462
  }), y.redirected || y.headers.get("X-Forge-Redirect") === "true")
1135
- return console.log("[NAV] Redirect detected"), w.phase = "idle", {
1463
+ return console.log("[NAV] Redirect detected"), O.update((E) => (E.phase = "idle", E)), {
1136
1464
  redirectPath: y.headers.get("X-Forge-Redirect-Path") || void 0
1137
1465
  };
1138
1466
  if (!y.ok)
1139
1467
  throw new Error(`Network response was not ok: ${y.status}`);
1140
- d = await y.json(), console.log("[NAV] Server data received:", d);
1468
+ f = await y.json(), console.log("[NAV] Server data received:", f);
1141
1469
  }
1142
- if (c !== g) {
1143
- console.log("[NAV] Stale navigation after fetch, aborting", { navigationId: c, currentNavigationId: g });
1470
+ if (u !== S) {
1471
+ console.log("[NAV] Stale navigation after fetch, aborting", { navigationId: u, currentNavigationId: S });
1144
1472
  return;
1145
1473
  }
1146
- console.log("[NAV] Loading components", { navigationId: c, view: n.view, layouts: n.layout });
1147
- const p = typeof t == "string" && t.indexOf("assets") !== -1, l = (n.layout || []).map((S) => {
1148
- let y = U(t, S).toString();
1149
- return p && (y = y.endsWith(".svelte") ? y.replace(/\.svelte$/, ".js") : /[.][a-z]+$/.test(y) ? y : y + ".js"), y;
1474
+ console.log("[NAV] Loading components", { navigationId: u, view: n.view, layouts: n.layout });
1475
+ const v = typeof t == "string" && t.indexOf("assets") !== -1, d = (n.layout || []).map((y) => {
1476
+ let m = H(t, y).toString();
1477
+ return v && (m = m.endsWith(".svelte") ? m.replace(/\.svelte$/, ".js") : /[.][a-z]+$/.test(m) ? m : m + ".js"), m;
1150
1478
  });
1151
- let h = U(t, n.view).toString();
1152
- p && (h = h.endsWith(".svelte") ? h.replace(/\.svelte$/, ".js") : /[.][a-z]+$/.test(h) ? h : h + ".js"), h.startsWith("/") || (h = "/" + h);
1153
- const v = await Promise.all(l.map((S) => import(
1479
+ let p = H(t, n.view).toString();
1480
+ v && (p = p.endsWith(".svelte") ? p.replace(/\.svelte$/, ".js") : /[.][a-z]+$/.test(p) ? p : p + ".js"), p.startsWith("/") || (p = "/" + p);
1481
+ const h = await Promise.all(d.map((y) => import(
1154
1482
  /* @vite-ignore */
1155
- S
1156
- ).then((y) => y.default))), A = await import(
1483
+ y
1484
+ ).then((m) => m.default))), g = await import(
1157
1485
  /* @vite-ignore */
1158
- h
1159
- ).then((S) => S.default);
1486
+ p
1487
+ ).then((y) => y.default);
1160
1488
  if (console.log("[NAV] Components loaded", {
1161
- navigationId: c,
1162
- currentNavigationId: g,
1163
- layoutsCount: v.length,
1164
- viewLoaded: !!A
1165
- }), c !== g) {
1166
- console.log("[NAV] Stale navigation after component load, aborting", { navigationId: c, currentNavigationId: g });
1489
+ navigationId: u,
1490
+ currentNavigationId: S,
1491
+ layoutsCount: h.length,
1492
+ viewLoaded: !!g
1493
+ }), u !== S) {
1494
+ console.log("[NAV] Stale navigation after component load, aborting", { navigationId: u, currentNavigationId: S });
1167
1495
  return;
1168
1496
  }
1169
- const _ = { layouts: v, view: A, data: d, params: o, urlParams: i, query: a };
1170
- console.log("[NAV] Built complete state, performing atomic swap", {
1171
- navigationId: c,
1172
- currentNavigationId: g,
1173
- layoutsCount: _.layouts.length,
1174
- viewSet: !!_.view,
1175
- dataKeys: Object.keys(_.data || {})
1176
- }), w.active = _, w.phase = "idle", console.log("[NAV] ROOT.active updated atomically", {
1177
- navigationId: c,
1178
- layoutsCount: w.active.layouts.length,
1179
- viewSet: !!w.active.view,
1180
- dataKeys: Object.keys(w.active.data || {}),
1181
- paramsKeys: Object.keys(w.active.params || {})
1182
- }), typeof window < "u" && window.scroll(0, 0), s && (console.log("[NAV] Updating browser URL", { url: r }), window.history.pushState({}, "", r)), console.log("[NAV] Navigation complete", { navigationId: c, url: r });
1183
- } catch (d) {
1497
+ const b = {
1498
+ layouts: h,
1499
+ view: g,
1500
+ viewPath: n.view || null,
1501
+ // Store original path for debugging
1502
+ layoutPaths: n.layout || [],
1503
+ // Store original paths for debugging
1504
+ data: f,
1505
+ params: o,
1506
+ urlParams: i,
1507
+ query: a
1508
+ };
1509
+ console.log("[NAV] Committing new state", {
1510
+ navigationId: u,
1511
+ currentNavigationId: S,
1512
+ layoutsCount: b.layouts.length,
1513
+ viewSet: !!b.view,
1514
+ dataKeys: Object.keys(b.data || {})
1515
+ }), O.update((y) => (y.active = b, y.phase = "idle", console.log("[NAV] ROOT.active updated", {
1516
+ navigationId: u,
1517
+ layoutsCount: y.active.layouts.length,
1518
+ viewSet: !!y.active.view,
1519
+ dataKeys: Object.keys(y.active.data || {}),
1520
+ paramsKeys: Object.keys(y.active.params || {})
1521
+ }), y)), typeof window < "u" && window.scroll(0, 0), s && (console.log("[NAV] Updating browser URL", { url: r }), window.history.pushState({}, "", r)), console.log("[NAV] Navigation complete", { navigationId: u, url: r });
1522
+ } catch (f) {
1184
1523
  if (console.error("[NAV] Navigation failed", {
1185
- navigationId: c,
1186
- currentNavigationId: g,
1524
+ navigationId: u,
1525
+ currentNavigationId: S,
1187
1526
  url: r,
1188
- error: d instanceof Error ? d.message : String(d)
1189
- }), w.phase = "idle", d.name === "AbortError") {
1527
+ error: f instanceof Error ? f.message : String(f)
1528
+ }), O.update((v) => (v.phase = "idle", v)), f.name === "AbortError") {
1190
1529
  console.log("[NAV] Navigation aborted");
1191
1530
  return;
1192
1531
  }
1193
- throw d;
1532
+ throw f;
1194
1533
  }
1195
1534
  }
1196
- const N = re.proxy({});
1197
- async function ut() {
1198
- Object.assign(N, window.__MANIFEST__);
1199
- }
1200
- function lt(e, r, t) {
1535
+ function qt(e, r, t) {
1201
1536
  if (!document) {
1202
1537
  console.error("Document not found");
1203
1538
  return;
1204
1539
  }
1205
1540
  document.addEventListener("click", (n) => {
1206
- var a, u;
1207
- const o = window.location.pathname, i = ((a = n.target) == null ? void 0 : a.tagName) === "A" ? n.target : (u = n.target) == null ? void 0 : u.closest("A");
1541
+ var a, c;
1542
+ const o = window.location.pathname, i = ((a = n.target) == null ? void 0 : a.tagName) === "A" ? n.target : (c = n.target) == null ? void 0 : c.closest("A");
1208
1543
  if (i) {
1209
1544
  let s = i.getAttribute("href");
1210
1545
  if (o === s) {
@@ -1212,40 +1547,38 @@ function lt(e, r, t) {
1212
1547
  return;
1213
1548
  }
1214
1549
  if (s && s.startsWith("/") || s.startsWith(".")) {
1215
- const c = s.split("?")[0], f = i.getAttribute("method") || "get", d = r.find((p) => p.method.toLowerCase() === f && t.find((l) => l.parser(c) && l.pattern === p.path));
1216
- if (d) {
1550
+ const u = s.split("?")[0], l = i.getAttribute("method") || "get", f = r.find((v) => v.method.toLowerCase() === l && t.find((d) => d.parser(u) && d.pattern === v.path));
1551
+ if (f) {
1217
1552
  n.preventDefault();
1218
- const p = t.find((S) => S.parser(c) && S.pattern === d.path), l = (p == null ? void 0 : p.parser(c)) || {}, h = new URLSearchParams(s.split("?")[1] || ""), v = Object.fromEntries(h.entries()) || {}, A = { ...l, ...v }, _ = N[p == null ? void 0 : p.pattern];
1219
- b.url = s, b.pathname = c, b.params = l, b.query = v, console.log("[EVENTS] Click navigation to", s), F(s, e, d, A, l, v, _, !0);
1553
+ const v = t.find((m) => m.parser(u) && m.pattern === f.path), d = (v == null ? void 0 : v.parser(u)) || {}, p = new URLSearchParams(s.split("?")[1] || ""), h = Object.fromEntries(p.entries()) || {}, g = { ...d, ...h }, y = C(V)[v == null ? void 0 : v.pattern];
1554
+ k.update((m) => (m.url = s, m.pathname = u, m.params = d, m.query = h, m)), console.log("[EVENTS] Click navigation to", s), Q(s, e, f, g, d, h, y, !0);
1220
1555
  } else
1221
1556
  console.log("No matching route found for URL:", s, "- using fallback navigation");
1222
1557
  }
1223
1558
  }
1224
1559
  }), window.addEventListener("popstate", (n) => {
1225
- const o = window.location.pathname, i = window.location.pathname + window.location.search;
1226
- b.url = i, b.pathname = window.location.pathname;
1227
- const a = "get", u = r.find((s) => s.method.toLowerCase() === a && t.find((c) => c.parser(o) && c.pattern === s.path));
1228
- if (u) {
1229
- const s = t.find((h) => h.parser(o) && h.pattern === u.path), c = (s == null ? void 0 : s.parser(o)) || {}, f = new URLSearchParams(window.location.search), d = Object.fromEntries(f.entries()) || {};
1230
- b.params = c, b.query = d;
1231
- const p = { ...c, ...d }, l = N[s == null ? void 0 : s.pattern];
1232
- console.log("[EVENTS] Popstate navigation to", i), F(i, e, u, p, c, d, l, !1);
1560
+ const o = window.location.pathname, i = window.location.pathname + window.location.search, a = "get", c = r.find((s) => s.method.toLowerCase() === a && t.find((u) => u.parser(o) && u.pattern === s.path));
1561
+ if (c) {
1562
+ const s = t.find((h) => h.parser(o) && h.pattern === c.path), u = (s == null ? void 0 : s.parser(o)) || {}, l = new URLSearchParams(window.location.search), f = Object.fromEntries(l.entries()) || {};
1563
+ k.update((h) => (h.url = i, h.pathname = window.location.pathname, h.params = u, h.query = f, h));
1564
+ const v = { ...u, ...f }, p = C(V)[s == null ? void 0 : s.pattern];
1565
+ console.log("[EVENTS] Popstate navigation to", i), Q(i, e, c, v, u, f, p, !1);
1233
1566
  } else
1234
1567
  console.log("No matching route found for popstate navigation to:", o, "- using fallback navigation"), window.location.href = o;
1235
1568
  }), window.addEventListener("forge-redirect", ((n) => {
1236
1569
  const o = n.detail.path, i = o.split("?")[0];
1237
1570
  console.log("[EVENTS] Handling forge-redirect to:", o);
1238
- const a = "get", u = r.find((s) => s.method.toLowerCase() === a && t.find((c) => c.parser(i) && c.pattern === s.path));
1239
- if (u) {
1240
- const s = t.find((h) => h.parser(i) && h.pattern === u.path), c = (s == null ? void 0 : s.parser(i)) || {}, f = new URLSearchParams(o.split("?")[1] || ""), d = Object.fromEntries(f.entries()) || {}, p = { ...c, ...d }, l = N[s == null ? void 0 : s.pattern];
1241
- b.url = o, b.pathname = i, b.params = c, b.query = d, F(o, e, u, p, c, d, l, !0);
1571
+ const a = "get", c = r.find((s) => s.method.toLowerCase() === a && t.find((u) => u.parser(i) && u.pattern === s.path));
1572
+ if (c) {
1573
+ const s = t.find((h) => h.parser(i) && h.pattern === c.path), u = (s == null ? void 0 : s.parser(i)) || {}, l = new URLSearchParams(o.split("?")[1] || ""), f = Object.fromEntries(l.entries()) || {}, v = { ...u, ...f }, p = C(V)[s == null ? void 0 : s.pattern];
1574
+ k.update((h) => (h.url = o, h.pathname = i, h.params = u, h.query = f, h)), Q(o, e, c, v, u, f, p, !0);
1242
1575
  } else
1243
1576
  console.log("No matching route found for redirect to:", i, "- using fallback navigation"), window.location.href = i;
1244
- }));
1577
+ })), Lt(r, t);
1245
1578
  }
1246
- const J = Symbol("forge-load-function");
1247
- let C = [], M = null;
1248
- function ft(e) {
1579
+ const K = Symbol("forge-load-function");
1580
+ let G = [], ee = null;
1581
+ function zt(e) {
1249
1582
  try {
1250
1583
  const r = new URL(e, window.location.origin);
1251
1584
  return r.origin === window.location.origin && !r.pathname.startsWith("/api/");
@@ -1253,27 +1586,27 @@ function ft(e) {
1253
1586
  return !e.startsWith("/api/");
1254
1587
  }
1255
1588
  }
1256
- function dt() {
1257
- typeof window < "u" && !M && (M = window.fetch, window.fetch = async function(e, r = {}) {
1589
+ function Gt() {
1590
+ typeof window < "u" && !ee && (ee = window.fetch, window.fetch = async function(e, r = {}) {
1258
1591
  let t = { ...r };
1259
- for (const i of C)
1592
+ for (const i of G)
1260
1593
  try {
1261
1594
  if (i.length === 2) {
1262
- const a = new Headers(t.headers), u = Object.fromEntries(a.entries());
1263
- await new Promise((s, c) => {
1595
+ const a = new Headers(t.headers), c = Object.fromEntries(a.entries());
1596
+ await new Promise((s, u) => {
1264
1597
  try {
1265
- i(u, (f) => {
1266
- if (f)
1267
- c(f);
1598
+ i(c, (l) => {
1599
+ if (l)
1600
+ u(l);
1268
1601
  else {
1269
- const d = new Headers();
1270
- Object.entries(u).forEach(([p, l]) => {
1271
- l !== void 0 && d.set(p, l);
1272
- }), t.headers = d, s();
1602
+ const f = new Headers();
1603
+ Object.entries(c).forEach(([v, d]) => {
1604
+ d !== void 0 && f.set(v, d);
1605
+ }), t.headers = f, s();
1273
1606
  }
1274
1607
  });
1275
- } catch (f) {
1276
- c(f);
1608
+ } catch (l) {
1609
+ u(l);
1277
1610
  }
1278
1611
  });
1279
1612
  } else {
@@ -1283,13 +1616,13 @@ function dt() {
1283
1616
  } catch (a) {
1284
1617
  throw console.error("🔴 Middleware error:", a), a;
1285
1618
  }
1286
- const n = t == null ? void 0 : t[J];
1619
+ const n = t == null ? void 0 : t[K];
1287
1620
  console.log("[FETCH OVERRIDE] Request", {
1288
1621
  url: e,
1289
1622
  hasForgeSymbol: n,
1290
1623
  headers: t == null ? void 0 : t.headers
1291
1624
  });
1292
- const o = await M(e, t);
1625
+ const o = await ee(e, t);
1293
1626
  if (console.log("[FETCH OVERRIDE] Response", {
1294
1627
  url: e,
1295
1628
  responseUrl: o.url,
@@ -1303,8 +1636,8 @@ function dt() {
1303
1636
  requested: i,
1304
1637
  final: a,
1305
1638
  redirected: o.redirected
1306
- }), ft(a)) {
1307
- const u = new URL(a), s = u.pathname + u.search;
1639
+ }), zt(a)) {
1640
+ const c = new URL(a), s = c.pathname + c.search;
1308
1641
  return console.log("[FORGE REDIRECT] Detected redirect to:", s, "- will navigate after current request completes"), new Response(JSON.stringify({ layout: [], view: {} }), {
1309
1642
  status: 200,
1310
1643
  headers: {
@@ -1318,54 +1651,54 @@ function dt() {
1318
1651
  return o;
1319
1652
  });
1320
1653
  }
1321
- dt();
1322
- const yt = {
1654
+ Gt();
1655
+ const Jt = {
1323
1656
  /**
1324
1657
  * Add middleware to the fetch pipeline
1325
1658
  */
1326
1659
  configUpdate(e) {
1327
1660
  if (typeof e != "function")
1328
1661
  throw new Error("Middleware must be a function");
1329
- C.push(e);
1662
+ G.push(e);
1330
1663
  },
1331
1664
  /**
1332
1665
  * Reset all middleware
1333
1666
  */
1334
1667
  reset() {
1335
- C.length = 0;
1668
+ G.length = 0;
1336
1669
  },
1337
1670
  /**
1338
1671
  * Get current middleware count (for debugging)
1339
1672
  */
1340
1673
  getMiddlewareCount() {
1341
- return C.length;
1674
+ return G.length;
1342
1675
  }
1343
1676
  };
1344
- let q;
1345
- async function mt(e, r) {
1677
+ let te;
1678
+ async function Zt(e, r) {
1346
1679
  let t = window.__COMPONENT_DIR__ || r.component_dir;
1347
1680
  if (!t && typeof t != "string")
1348
1681
  throw new Error("No component directory provided");
1349
1682
  let n = window.__ROUTING__;
1350
- if (q = Pe(n), window && window.location) {
1351
- const o = (window.location.pathname || "/").split("?")[0], i = q.find((u) => u.parser(o));
1352
- let a = i ? n.find((u) => u.path === i.pattern) : null;
1683
+ if (te = De(n), window && window.location) {
1684
+ const o = (window.location.pathname || "/").split("?")[0], i = te.find((c) => c.parser(o));
1685
+ let a = i ? n.find((c) => c.path === i.pattern) : null;
1353
1686
  if (i && a) {
1354
- const u = i.parser(o) || {}, s = new URLSearchParams(window.location.search), c = Object.fromEntries(s.entries()) || {}, f = { ...u, ...c };
1355
- ut(), st(e, t, a, f, u, c), lt(t, n, q);
1687
+ const c = i.parser(o) || {}, s = new URLSearchParams(window.location.search), u = Object.fromEntries(s.entries()) || {}, l = { ...c, ...u };
1688
+ Nt(), Wt(e, t, a, l, c, u), qt(t, n, te);
1356
1689
  } else
1357
1690
  console.warn("No matching route found for:", o);
1358
1691
  }
1359
1692
  }
1360
1693
  export {
1361
- N as MANIFEST_STORE,
1362
- lt as bootstrap_events,
1363
- mt as createApp,
1364
- yt as fetch,
1365
- st as loadRoute,
1366
- b as page,
1367
- gt as shadowUrl,
1368
- ut as updateManifestStore,
1369
- F as updateRoute
1694
+ V as MANIFEST_STORE,
1695
+ qt as bootstrap_events,
1696
+ Zt as createApp,
1697
+ Jt as fetch,
1698
+ Wt as loadRoute,
1699
+ k as page,
1700
+ tr as shadowUrl,
1701
+ Nt as updateManifestStore,
1702
+ Q as updateRoute
1370
1703
  };
1371
1704
  //# sourceMappingURL=client.mjs.map