@noego/forge 0.1.27 → 0.1.29

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/README.md CHANGED
@@ -178,6 +178,19 @@ document.addEventListener('DOMContentLoaded', () => {
178
178
  });
179
179
  ```
180
180
 
181
+ `createApp` also supports an optional `controller_factory` for page-controller construction:
182
+
183
+ ```ts
184
+ import { createApp } from '@noego/forge/client';
185
+
186
+ const options = {
187
+ component_dir: 'components',
188
+ renderer: 'index.html',
189
+ open_api_path: 'openapi.yaml',
190
+ controller_factory: (ControllerClass) => new ControllerClass(),
191
+ };
192
+ ```
193
+
181
194
  #### 7. Add Vite config (`vite.config.js`)
182
195
 
183
196
  ```js
@@ -674,7 +687,9 @@ const yamlFiles = import.meta.glob('./openapi/**/*.yaml', {
674
687
 
675
688
  await createApp(document.getElementById('app'), {
676
689
  open_api_path: 'openapi/stitch.yaml',
677
- component_dir: 'components'
690
+ component_dir: 'components',
691
+ // In @noego/app, this is automatically set to resolve from the scoped IoC container.
692
+ // controller_factory: (ControllerClass) => container.instance(ControllerClass),
678
693
  });
679
694
  ```
680
695
 
package/dist/client.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var nt=Object.defineProperty;var ot=(e,t,r)=>t in e?nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ie=(e,t,r)=>ot(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("./page.svelte-CW8PJDdH.cjs");require("svelte/internal/client");const it=require("svelte"),at=require("../src/components/RecursiveRender.svelte"),A=require("svelte/store");function st(e){const t=new I.path_to_regex(e);return r=>{const n=t.match(r);if(!n)return null;const i={};for(const[o,a]of Object.entries(n))i[o]=decodeURIComponent(a);return i}}function ut(e){return e.map(t=>{const r=t.path,n=st(r);return{pattern:r,parser:n}})}var fe=function(e,t){return fe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},fe(e,t)};function V(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");fe(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function ct(e,t,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function u(l){try{c(n.next(l))}catch(p){a(p)}}function s(l){try{c(n.throw(l))}catch(p){a(p)}}function c(l){l.done?o(l.value):i(l.value).then(u,s)}c((n=n.apply(e,t||[])).next())})}function Ce(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=u(0),a.throw=u(1),a.return=u(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(l){return s([c,l])}}function s(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(n=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){r.label=c[1];break}if(c[0]===6&&r.label<o[1]){r.label=o[1],o=c;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(c);break}o[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(l){c=[6,l],i=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function z(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function B(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){a={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o}function Y(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}function W(e){return this instanceof W?(this.v=e,this):new W(e)}function lt(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",a),i[Symbol.asyncIterator]=function(){return this},i;function a(d){return function(v){return Promise.resolve(v).then(d,p)}}function u(d,v){n[d]&&(i[d]=function(f){return new Promise(function(S,w){o.push([d,f,S,w])>1||s(d,f)})},v&&(i[d]=v(i[d])))}function s(d,v){try{c(n[d](v))}catch(f){h(o[0][3],f)}}function c(d){d.value instanceof W?Promise.resolve(d.value.v).then(l,p):h(o[0][2],d)}function l(d){s("next",d)}function p(d){s("throw",d)}function h(d,v){d(v),o.shift(),o.length&&s(o[0][0],o[0][1])}}function ft(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof z=="function"?z(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(a){return new Promise(function(u,s){a=e[o](a),i(u,s,a.done,a.value)})}}function i(o,a,u,s){Promise.resolve(s).then(function(c){o({value:c,done:u})},a)}}function b(e){return typeof e=="function"}function me(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var ae=me(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
1
+ "use strict";var ot=Object.defineProperty;var it=(e,t,r)=>t in e?ot(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ie=(e,t,r)=>it(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("./page.svelte-CW8PJDdH.cjs");require("svelte/internal/client");const at=require("svelte"),st=require("../src/components/RecursiveRender.svelte"),A=require("svelte/store");function ut(e){const t=new I.path_to_regex(e);return r=>{const n=t.match(r);if(!n)return null;const i={};for(const[o,a]of Object.entries(n))i[o]=decodeURIComponent(a);return i}}function ct(e){return e.map(t=>{const r=t.path,n=ut(r);return{pattern:r,parser:n}})}var fe=function(e,t){return fe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},fe(e,t)};function V(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");fe(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function lt(e,t,r,n){function i(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function c(l){try{s(n.next(l))}catch(h){a(h)}}function u(l){try{s(n.throw(l))}catch(h){a(h)}}function s(l){l.done?o(l.value):i(l.value).then(c,u)}s((n=n.apply(e,t||[])).next())})}function Ce(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=c(0),a.throw=c(1),a.return=c(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(s){return function(l){return u([s,l])}}function u(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(n=1,i&&(o=s[0]&2?i.return:s[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,s[1])).done)return o;switch(i=0,o&&(s=[s[0]&2,o.value]),s[0]){case 0:case 1:o=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,i=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){r.label=s[1];break}if(s[0]===6&&r.label<o[1]){r.label=o[1],o=s;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(s);break}o[2]&&r.ops.pop(),r.trys.pop();continue}s=t.call(e,r)}catch(l){s=[6,l],i=0}finally{n=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function z(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function B(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){a={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o}function Y(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}function W(e){return this instanceof W?(this.v=e,this):new W(e)}function ft(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",a),i[Symbol.asyncIterator]=function(){return this},i;function a(d){return function(v){return Promise.resolve(v).then(d,h)}}function c(d,v){n[d]&&(i[d]=function(f){return new Promise(function(S,_){o.push([d,f,S,_])>1||u(d,f)})},v&&(i[d]=v(i[d])))}function u(d,v){try{s(n[d](v))}catch(f){p(o[0][3],f)}}function s(d){d.value instanceof W?Promise.resolve(d.value.v).then(l,h):p(o[0][2],d)}function l(d){u("next",d)}function h(d){u("throw",d)}function p(d,v){d(v),o.shift(),o.length&&u(o[0][0],o[0][1])}}function dt(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof z=="function"?z(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(a){return new Promise(function(c,u){a=e[o](a),i(c,u,a.done,a.value)})}}function i(o,a,c,u){Promise.resolve(u).then(function(s){o({value:s,done:c})},a)}}function w(e){return typeof e=="function"}function me(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var ae=me(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
2
2
  `+r.map(function(n,i){return i+1+") "+n.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=r}});function de(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var re=(function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,i,o;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var u=z(a),s=u.next();!s.done;s=u.next()){var c=s.value;c.remove(this)}}catch(f){t={error:f}}finally{try{s&&!s.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}else a.remove(this);var l=this.initialTeardown;if(b(l))try{l()}catch(f){o=f instanceof ae?f.errors:[f]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var h=z(p),d=h.next();!d.done;d=h.next()){var v=d.value;try{Ee(v)}catch(f){o=o??[],f instanceof ae?o=Y(Y([],B(o)),B(f.errors)):o.push(f)}}}catch(f){n={error:f}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}}if(o)throw new ae(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Ee(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&de(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&de(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})(),je=re.EMPTY;function Le(e){return e instanceof re||e&&"closed"in e&&b(e.remove)&&b(e.add)&&b(e.unsubscribe)}function Ee(e){b(e)?e():e.unsubscribe()}var dt={Promise:void 0},ht={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,Y([e,t],B(r)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function Ne(e){ht.setTimeout(function(){throw e})}function Oe(){}function Z(e){e()}var ye=(function(e){V(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Le(r)&&r.add(n)):n.destination=mt,n}return t.create=function(r,n,i){return new G(r,n,i)},t.prototype.next=function(r){this.isStopped||this._next(r)},t.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t})(re),pt=(function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){K(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){K(n)}else K(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){K(r)}},e})(),G=(function(e){V(t,e);function t(r,n,i){var o=e.call(this)||this,a;return b(r)||!r?a={next:r??void 0,error:n??void 0,complete:i??void 0}:a=r,o.destination=new pt(a),o}return t})(ye);function K(e){Ne(e)}function vt(e){throw e}var mt={closed:!0,next:Oe,error:vt,complete:Oe},be=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function we(e){return e}function yt(e){return e.length===0?we:e.length===1?e[0]:function(r){return e.reduce(function(n,i){return i(n)},r)}}var x=(function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var i=this,o=wt(t)?t:new G(t,r,n);return Z(function(){var a=i,u=a.operator,s=a.source;o.add(u?u.call(o,s):s?i._subscribe(o):i._trySubscribe(o))}),o},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=xe(r),new r(function(i,o){var a=new G({next:function(u){try{t(u)}catch(s){o(s),a.unsubscribe()}},error:o,complete:i});n.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[be]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return yt(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=xe(t),new t(function(n,i){var o;r.subscribe(function(a){return o=a},function(a){return i(a)},function(){return n(o)})})},e.create=function(t){return new e(t)},e})();function xe(e){var t;return(t=e??dt.Promise)!==null&&t!==void 0?t:Promise}function bt(e){return e&&b(e.next)&&b(e.error)&&b(e.complete)}function wt(e){return e&&e instanceof ye||bt(e)&&Le(e)}function gt(e){return b(e==null?void 0:e.lift)}function L(e){return function(t){if(gt(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function j(e,t,r,n,i){return new St(e,t,r,n,i)}var St=(function(e){V(t,e);function t(r,n,i,o,a,u){var s=e.call(this,r)||this;return s.onFinalize=a,s.shouldUnsubscribe=u,s._next=n?function(c){try{n(c)}catch(l){r.error(l)}}:e.prototype._next,s._error=o?function(c){try{o(c)}catch(l){r.error(l)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=i?function(){try{i()}catch(c){r.error(c)}finally{this.unsubscribe()}}:e.prototype._complete,s}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t})(ye),_t=me(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),ne=(function(e){V(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new Ae(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new _t},t.prototype.next=function(r){var n=this;Z(function(){var i,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=z(n.currentObservers),u=a.next();!u.done;u=a.next()){var s=u.value;s.next(r)}}catch(c){i={error:c}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}}})},t.prototype.error=function(r){var n=this;Z(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var i=n.observers;i.length;)i.shift().error(r)}})},t.prototype.complete=function(){var r=this;Z(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,i=this,o=i.hasError,a=i.isStopped,u=i.observers;return o||a?je:(this.currentObservers=null,u.push(r),new re(function(){n.currentObservers=null,de(u,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,i=n.hasError,o=n.thrownError,a=n.isStopped;i?r.error(o):a&&r.complete()},t.prototype.asObservable=function(){var r=new x;return r.source=this,r},t.create=function(r,n){return new Ae(r,n)},t})(x),Ae=(function(e){V(t,e);function t(r,n){var i=e.call(this)||this;return i.destination=r,i.source=n,i}return t.prototype.next=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,r)},t.prototype.error=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&i!==void 0?i:je},t})(ne),Fe={now:function(){return(Fe.delegate||Date).now()},delegate:void 0},Et=(function(e){V(t,e);function t(r,n,i){r===void 0&&(r=1/0),n===void 0&&(n=1/0),i===void 0&&(i=Fe);var o=e.call(this)||this;return o._bufferSize=r,o._windowTime=n,o._timestampProvider=i,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=n===1/0,o._bufferSize=Math.max(1,r),o._windowTime=Math.max(1,n),o}return t.prototype.next=function(r){var n=this,i=n.isStopped,o=n._buffer,a=n._infiniteTimeWindow,u=n._timestampProvider,s=n._windowTime;i||(o.push(r),!a&&o.push(u.now()+s)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),i=this,o=i._infiniteTimeWindow,a=i._buffer,u=a.slice(),s=0;s<u.length&&!r.closed;s+=o?1:2)r.next(u[s]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,i=r._timestampProvider,o=r._buffer,a=r._infiniteTimeWindow,u=(a?1:2)*n;if(n<1/0&&u<o.length&&o.splice(0,o.length-u),!a){for(var s=i.now(),c=0,l=1;l<o.length&&o[l]<=s;l+=2)c=l;c&&o.splice(0,c+1)}},t})(ne),ge=(function(e){return e&&typeof e.length=="number"&&typeof e!="function"});function Ue(e){return b(e==null?void 0:e.then)}function ke(e){return b(e[be])}function $e(e){return Symbol.asyncIterator&&b(e==null?void 0:e[Symbol.asyncIterator])}function Me(e){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.")}function Ot(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var De=Ot();function We(e){return b(e==null?void 0:e[De])}function qe(e){return lt(this,arguments,function(){var r,n,i,o;return Ce(this,function(a){switch(a.label){case 0:r=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,W(r.read())];case 3:return n=a.sent(),i=n.value,o=n.done,o?[4,W(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,W(i)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function ze(e){return b(e==null?void 0:e.getReader)}function N(e){if(e instanceof x)return e;if(e!=null){if(ke(e))return xt(e);if(ge(e))return At(e);if(Ue(e))return Tt(e);if($e(e))return Be(e);if(We(e))return It(e);if(ze(e))return Pt(e)}throw Me(e)}function xt(e){return new x(function(t){var r=e[be]();if(b(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function At(e){return new x(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function Tt(e){return new x(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Ne)})}function It(e){return new x(function(t){var r,n;try{for(var i=z(e),o=i.next();!o.done;o=i.next()){var a=o.value;if(t.next(a),t.closed)return}}catch(u){r={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.complete()})}function Be(e){return new x(function(t){Rt(e,t).catch(function(r){return t.error(r)})})}function Pt(e){return Be(qe(e))}function Rt(e,t){var r,n,i,o;return ct(this,void 0,void 0,function(){var a,u;return Ce(this,function(s){switch(s.label){case 0:s.trys.push([0,5,6,11]),r=ft(e),s.label=1;case 1:return[4,r.next()];case 2:if(n=s.sent(),!!n.done)return[3,4];if(a=n.value,t.next(a),t.closed)return[2];s.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=s.sent(),i={error:u},[3,11];case 6:return s.trys.push([6,,9,10]),n&&!n.done&&(o=r.return)?[4,o.call(r)]:[3,8];case 7:s.sent(),s.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function $(e,t,r,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var o=t.schedule(function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(o),!i)return o}function Ge(e,t){return t===void 0&&(t=0),L(function(r,n){r.subscribe(j(n,function(i){return $(n,e,function(){return n.next(i)},t)},function(){return $(n,e,function(){return n.complete()},t)},function(i){return $(n,e,function(){return n.error(i)},t)}))})}function Ve(e,t){return t===void 0&&(t=0),L(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function Ct(e,t){return N(e).pipe(Ve(t),Ge(t))}function jt(e,t){return N(e).pipe(Ve(t),Ge(t))}function Lt(e,t){return new x(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}function Nt(e,t){return new x(function(r){var n;return $(r,t,function(){n=e[De](),$(r,t,function(){var i,o,a;try{i=n.next(),o=i.value,a=i.done}catch(u){r.error(u);return}a?r.complete():r.next(o)},0,!0)}),function(){return b(n==null?void 0:n.return)&&n.return()}})}function He(e,t){if(!e)throw new Error("Iterable cannot be null");return new x(function(r){$(r,t,function(){var n=e[Symbol.asyncIterator]();$(r,t,function(){n.next().then(function(i){i.done?r.complete():r.next(i.value)})},0,!0)})})}function Ft(e,t){return He(qe(e),t)}function Ut(e,t){if(e!=null){if(ke(e))return Ct(e,t);if(ge(e))return Lt(e,t);if(Ue(e))return jt(e,t);if($e(e))return He(e,t);if(We(e))return Nt(e,t);if(ze(e))return Ft(e,t)}throw Me(e)}function Ye(e,t){return t?Ut(e,t):N(e)}var kt=me(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function $t(e,t){return new Promise(function(r,n){var i=new G({next:function(o){r(o),i.unsubscribe()},error:n,complete:function(){n(new kt)}});e.subscribe(i)})}function Se(e,t){return L(function(r,n){var i=0;r.subscribe(j(n,function(o){n.next(e.call(t,o,i++))}))})}var Mt=Array.isArray;function Dt(e,t){return Mt(t)?e.apply(void 0,Y([],B(t))):e(t)}function Wt(e){return Se(function(t){return Dt(e,t)})}function qt(e,t,r,n,i,o,a,u){var s=[],c=0,l=0,p=!1,h=function(){p&&!s.length&&!c&&t.complete()},d=function(f){return c<n?v(f):s.push(f)},v=function(f){c++;var S=!1;N(r(f,l++)).subscribe(j(t,function(w){t.next(w)},function(){S=!0},void 0,function(){if(S)try{c--;for(var w=function(){var g=s.shift();a||v(g)};s.length&&c<n;)w();h()}catch(g){t.error(g)}}))};return e.subscribe(j(t,d,function(){p=!0,h()})),function(){}}function Je(e,t,r){return r===void 0&&(r=1/0),b(t)?Je(function(n,i){return Se(function(o,a){return t(n,o,i,a)})(N(e(n,i)))},r):(typeof t=="number"&&(r=t),L(function(n,i){return qt(n,i,e,r)}))}var zt=["addListener","removeListener"],Bt=["addEventListener","removeEventListener"],Gt=["on","off"];function he(e,t,r,n){if(b(r)&&(n=r,r=void 0),n)return he(e,t,r).pipe(Wt(n));var i=B(Yt(e)?Bt.map(function(u){return function(s){return e[u](t,s,r)}}):Vt(e)?zt.map(Te(e,t)):Ht(e)?Gt.map(Te(e,t)):[],2),o=i[0],a=i[1];if(!o&&ge(e))return Je(function(u){return he(u,t,r)})(N(e));if(!o)throw new TypeError("Invalid event target");return new x(function(u){var s=function(){for(var c=[],l=0;l<arguments.length;l++)c[l]=arguments[l];return u.next(1<c.length?c:c[0])};return o(s),function(){return a(s)}})}function Te(e,t){return function(r){return function(n){return e[r](t,n)}}}function Vt(e){return b(e.addListener)&&b(e.removeListener)}function Ht(e){return b(e.on)&&b(e.off)}function Yt(e){return b(e.addEventListener)&&b(e.removeEventListener)}function se(e,t){return L(function(r,n){var i=0;r.subscribe(j(n,function(o){return e.call(t,o,i++)&&n.next(o)}))})}function Jt(e,t){return t===void 0&&(t=we),e=e??Kt,L(function(r,n){var i,o=!0;r.subscribe(j(n,function(a){var u=t(a);(o||!e(i,u))&&(o=!1,i=u,n.next(a))}))})}function Kt(e,t){return e===t}function Xt(e){e===void 0&&(e={});var t=e.connector,r=t===void 0?function(){return new ne}:t,n=e.resetOnError,i=n===void 0?!0:n,o=e.resetOnComplete,a=o===void 0?!0:o,u=e.resetOnRefCountZero,s=u===void 0?!0:u;return function(c){var l,p,h,d=0,v=!1,f=!1,S=function(){p==null||p.unsubscribe(),p=void 0},w=function(){S(),l=h=void 0,v=f=!1},g=function(){var _=l;w(),_==null||_.unsubscribe()};return L(function(_,P){d++,!f&&!v&&S();var R=h=h??r();P.add(function(){d--,d===0&&!f&&!v&&(p=ue(g,s))}),R.subscribe(P),!l&&d>0&&(l=new G({next:function(C){return R.next(C)},error:function(C){f=!0,S(),p=ue(w,i,C),R.error(C)},complete:function(){v=!0,S(),p=ue(w,a),R.complete()}}),N(_).subscribe(l))})(c)}}function ue(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(t===!0){e();return}if(t!==!1){var i=new G({next:function(){i.unsubscribe(),e()}});return N(t.apply(void 0,Y([],B(r)))).subscribe(i)}}function Ke(e,t){return L(function(r,n){var i=null,o=0,a=!1,u=function(){return a&&!i&&n.complete()};r.subscribe(j(n,function(s){i==null||i.unsubscribe();var c=0,l=o++;N(e(s,l)).subscribe(i=j(n,function(p){return n.next(t?t(s,p,l,c++):p)},function(){i=null,u()}))},function(){a=!0,u()}))})}function Zt(e,t,r){var n=b(e)||t||r?{next:e,error:t,complete:r}:e;return n?L(function(i,o){var a;(a=n.subscribe)===null||a===void 0||a.call(n);var u=!0;i.subscribe(j(o,function(s){var c;(c=n.next)===null||c===void 0||c.call(n,s),o.next(s)},function(){var s;u=!1,(s=n.complete)===null||s===void 0||s.call(n),o.complete()},function(s){var c;u=!1,(c=n.error)===null||c===void 0||c.call(n,s),o.error(s)},function(){var s,c;u&&((s=n.unsubscribe)===null||s===void 0||s.call(n)),(c=n.finalize)===null||c===void 0||c.call(n)}))}):we}const q=A.writable({});async function Xe(){q.update(e=>(Object.assign(e,window.__MANIFEST__),e))}const F=new Map,Q=5e3;function Qt(e){const t=F.get(e);return t?(F.delete(e),Date.now()-t.createdAt>Q?(t.abortController.abort(),null):t.response$):null}function er(e,t){he(document,"mouseover").pipe(Xt()).pipe(Se(i=>{const o=i.target,a=(o==null?void 0:o.tagName)==="A"?o:o==null?void 0:o.closest("A");if(!a)return null;const u=a.getAttribute("href");return!u||!u.startsWith("/")&&!u.startsWith(".")?null:u}),se(i=>i!==null),se(i=>i!==window.location.pathname),Jt(),se(i=>{const o=i.split("?")[0],a="get",u=e.find(l=>l.method.toLowerCase()===a&&t.find(p=>p.parser(o)&&p.pattern===l.path));if(!u)return!1;const s=t.find(l=>l.parser(o)&&l.pattern===u.path);return!!A.get(q)[s==null?void 0:s.pattern]}),Ke(i=>{const o=F.get(i);if(o&&Date.now()-o.createdAt<Q)return[];const a=new AbortController,u=new Et(1),s={response$:u,createdAt:Date.now(),abortController:a};F.set(i,s);const c={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:a.signal};return c[oe]=!0,Ye(fetch(i,c).then(l=>(u.next(l),u.complete(),i),l=>(u.error(l),F.delete(i),null))).pipe(Zt({unsubscribe:()=>{a.abort(),F.delete(i)}}))})).subscribe(),setInterval(()=>{const i=Date.now();for(const[o,a]of F)i-a.createdAt>Q&&(a.abortController.abort(),F.delete(o))},Q)}var k=(e=>(e[e.TRACE=0]="TRACE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.FATAL=5]="FATAL",e))(k||{});const tr={trace:0,debug:1,info:2,warn:3,error:4,fatal:5};function rr(e){if(!e)return 2;const t=e.trim().toLowerCase(),r=tr[t];if(typeof r=="number")return r;const n=Number(t);return Number.isFinite(n)&&n>=0&&n<=5?n:2}function Ze(e){switch(e){case 0:return"TRACE";case 1:return"DEBUG";case 2:return"INFO";case 3:return"WARN";case 4:return"ERROR";case 5:return"FATAL";default:return"INFO"}}function Ie(e){if(e===void 0)return"undefined";if(e===null)return null;if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};switch(typeof e){case"string":case"number":case"boolean":return e;case"bigint":return e.toString();case"symbol":return String(e);case"function":return`[Function${e.name?`: ${e.name}`:""}]`;default:return e}}class nr{constructor(t,r,n){this.name=t,this.manager=r,this.contextData=n}named(t){return new pe(t,this.manager,this.contextData)}withContext(t){const r=this.contextData?{...this.contextData,...t}:t;return new pe(this.name,this.manager,r)}trace(t,...r){this.log(k.TRACE,t,r)}debug(t,...r){this.log(k.DEBUG,t,r)}info(t,...r){this.log(k.INFO,t,r)}warn(t,...r){this.log(k.WARN,t,r)}error(t,...r){this.log(k.ERROR,t,r)}fatal(t,...r){this.log(k.FATAL,t,r)}log(t,r,n){if(!this.manager.shouldLog(t,this.name))return;const i=new Date().toISOString();let o=n.length>0?n.length===1?Ie(n[0]):n.map(Ie):void 0,a;this.contextData&&o!==void 0?a={...this.contextData,args:o}:this.contextData?a=this.contextData:a=o,this.manager.log({timestamp:i,level:Ze(t),logger:this.name,message:r,context:a})}}class pe extends nr{constructor(t,r,n){super(t,r,n)}}class or{log(t){const r=t.context!==void 0?` ${JSON.stringify(t.context)}`:"",n=`[${t.timestamp}] [${t.logger}] [${t.level}] ${t.message}${r}`;switch(t.level){case"ERROR":case"FATAL":console.error(n);break;case"WARN":console.warn(n);break;default:console.log(n);break}}}const ce=Symbol.for("@noego/logger");class ir{constructor(){var i,o,a;this.transports=[],this.loggerLevels=new Map;const t=typeof process<"u"?(i=process.env)==null?void 0:i.LOG_LEVEL:void 0,r=typeof process<"u"?(o=process.env)==null?void 0:o.SERVICE_NAME:void 0,n=typeof process<"u"?(a=process.env)==null?void 0:a.NODE_ENV:void 0;this.level=rr(t),this.service=r??"noego",this.environment=n??"development"}getLevel(){return this.level}setLevel(t){this.level=t}setLoggerLevel(t,r){this.loggerLevels.set(t,r)}shouldLog(t,r){if(r){const n=this.loggerLevels.get(r);if(n!==void 0)return t>=n}return t>=this.level}addTransport(t){this.transports.push(t)}setTransports(t){this.transports=[...t]}clearTransports(){this.transports=[]}setServiceName(t){this.service=t}log(t){const r={...t,environment:this.environment,service:this.service};for(const n of this.transports)n.log(r)}async closeAll(){for(const t of this.transports)t.close&&await t.close()}formatMessage(t,r,n){return`[${new Date().toISOString()}] [${r}] [${Ze(t)}] ${n}`}}function Qe(){const e=globalThis;if(!e[ce]){const t=new ir;t.addTransport(new or),e[ce]=t}return e[ce]}function _e(e){return new pe(e,Qe())}const m=_e("forge:nav"),ar=1e4;function sr(e,t,r){let n=null,i=!1;const o=new Promise((a,u)=>{n=setTimeout(()=>{i=!0,m.error("Timeout fired after",t,"ms"),r(),u(new Error(`Navigation timed out after ${t}ms`))},t),m.debug("Timeout scheduled for",t,"ms, timeoutId:",n)});return Promise.race([e.finally(()=>{n!==null&&(i?m.warn("Promise settled AFTER timeout already fired"):(m.debug("Clearing timeout",n,"- promise settled successfully"),clearTimeout(n)))}),o])}const ve=new ne;let E=0,H=null;function ur(e){e&&e.redirectPath&&(m.debug("Handling redirect to",e.redirectPath),setTimeout(()=>{window.dispatchEvent(new CustomEvent("forge-redirect",{detail:{path:e.redirectPath}}))},0))}ve.pipe(Ke(e=>Ye(sr(fr(e),ar,()=>{m.error("Navigation timed out"),E++,H&&(H.abort(),H=null)}).catch(t=>{m.error("Navigation failed:",t)})))).subscribe({next:ur,error:e=>{m.error("Stream error:",e)}});function cr(e){var t;m.debug("Pushing navigation event to stream",{url:e.url,currentNavigationId:E,subscriberCount:((t=ve.observers)==null?void 0:t.length)||0}),ve.next(e)}const T=A.writable({active:{layouts:[],view:null,viewPath:null,layoutPaths:[],data:{layout:[],view:{}},params:{},urlParams:{},query:{}},phase:"idle",navigationId:0,page:I.page}),lr=async()=>{const e=A.get(T).navigationId;try{const t=window.location.pathname+window.location.search,r={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"}};r[oe]=!0;const n=await fetch(t,r);if(!n.ok)return!1;const i=await n.json(),o=A.get(T).navigationId;return e!==o?(m.debug("Discarding stale poll response",{pollNavigationId:e,currentNavigationId:o}),!1):(T.update(a=>{var u;return a.active.data={layout:((u=a.active.data)==null?void 0:u.layout)||[],view:i.view},a}),!0)}catch{return!1}};I.page.update(e=>(e.poll=lr,e));async function et(e,t,r,n,i){if(!t.controller)return;let o=J(e,t.controller).toString();i&&(o=o.replace(/\.svelte\.ts$/,".js").replace(/\.ts$/,".js"),/\.[a-z]+$/.test(o)||(o+=".js")),o.startsWith("/")||(o="/"+o);const u=(await import(o)).default,s=new u;return typeof s.initialize=="function"&&await Promise.resolve(s.initialize(r,n)),s}function J(...e){let t=e.map((r,n)=>n===0?r.replace(/\/+$/,""):r.replace(/^\/+|\/+$/g,"")).join("/");return t.startsWith("/")||(t="/"+t),t.split("?")[0]}async function tt(e,t,r,n,i,o){try{const a=typeof t=="string"&&t.indexOf("assets")!==-1,u=(r.layout||[]).map(w=>{let g=J(t,w).toString();return a&&(g=g.endsWith(".svelte")?g.replace(/\.svelte$/,".js"):/[.][a-z]+$/.test(g)?g:g+".js"),g});let s=J(t,r.view).toString();a&&(s=s.endsWith(".svelte")?s.replace(/\.svelte$/,".js"):/[.][a-z]+$/.test(s)?s:s+".js");const c=await Promise.all(u.map(w=>import(w).then(g=>g.default)));s.startsWith("/")||(s="/"+s);const l=await import(s).then(w=>w.default),p=window.__INITIAL_DATA__||{layout:[],view:{}},h=typeof t=="string"&&t.indexOf("assets")!==-1,d=A.get(I.page),v={params:n,urlParams:i,query:o,page:d},f=await et(t,r,p.view,v,h),S={layouts:c,view:l,viewPath:r.view||null,layoutPaths:r.layout||[],data:p,params:n,urlParams:i,query:o,controller:f};T.update(w=>(w.active=S,w.phase="idle",w)),it.hydrate(at,{target:e,props:{root:T}})}catch(a){m.error("Client-side route loading failed:",a)}}function ee(e,t,r,n,i,o,a=!1,u=!0){cr({url:e,base_path:t,route:r,params:n,urlParams:i,query:o,server_loading:a,updateUrl:u})}async function fr(e){var p;const{url:t,base_path:r,route:n,params:i,urlParams:o,query:a,server_loading:u,updateUrl:s}=e,c=++E,l=new AbortController;H=l,m.debug("Starting navigation",{navigationId:c,url:t,updateUrl:s,server_loading:u,currentNavigationId:E,hasAbortController:!!H}),T.update(h=>(h.phase="loading",h.navigationId=c,h));try{let h={layout:[],view:{}};if(u){m.debug("Fetching server data",{navigationId:c,url:t});let y=null;const O=Qt(t);if(O)try{m.debug("Using prefetched response for",t),y=await $t(O)}catch{m.debug("Prefetch failed, falling back to fetch",t),y=null}if(!y){const M={method:n.method,headers:{"Content-Type":"application/json",Accept:"application/json"},signal:l.signal};M[oe]=!0,y=await fetch(t,M)}if(m.debug("Fetch response received",{navigationId:c,url:t,ok:y.ok,status:y.status,redirected:y.redirected,currentNavigationId:E}),y.redirected||y.headers.get("X-Forge-Redirect")==="true")return m.debug("Redirect detected"),T.update(M=>(M.phase="idle",M)),{redirectPath:y.headers.get("X-Forge-Redirect-Path")||void 0};if(!y.ok)throw new Error(`Network response was not ok: ${y.status}`);h=await y.json(),m.debug("Server data received:",h)}if(c!==E){m.debug("Stale navigation after fetch, aborting",{navigationId:c,currentNavigationId:E});return}m.debug("Loading components",{navigationId:c,view:n.view,layouts:n.layout});const d=typeof r=="string"&&r.indexOf("assets")!==-1,v=(n.layout||[]).map(y=>{let O=J(r,y).toString();return d&&(O=O.endsWith(".svelte")?O.replace(/\.svelte$/,".js"):/[.][a-z]+$/.test(O)?O:O+".js"),O});let f=J(r,n.view).toString();d&&(f=f.endsWith(".svelte")?f.replace(/\.svelte$/,".js"):/[.][a-z]+$/.test(f)?f:f+".js"),f.startsWith("/")||(f="/"+f);const S=await Promise.all(v.map(y=>import(y).then(O=>O.default))),w=await import(f).then(y=>y.default);if(m.debug("Components loaded",{navigationId:c,currentNavigationId:E,layoutsCount:S.length,viewLoaded:!!w}),c!==E){m.debug("Stale navigation after component load, aborting",{navigationId:c,currentNavigationId:E});return}const g=A.get(I.page),_={params:i,urlParams:o,query:a,page:g},P=await et(r,n,h.view,_,d);if(c!==E){m.debug("Stale navigation after controller resolution, aborting",{navigationId:c,currentNavigationId:E}),(p=P==null?void 0:P.destroy)==null||p.call(P);return}const R=A.get(T).active.controller;R!=null&&R.destroy&&R.destroy();const C={layouts:S,view:w,viewPath:n.view||null,layoutPaths:n.layout||[],data:h,params:i,urlParams:o,query:a,controller:P};m.debug("Committing new state",{navigationId:c,currentNavigationId:E,layoutsCount:C.layouts.length,viewSet:!!C.view,dataKeys:Object.keys(C.data||{})}),T.update(y=>(y.active=C,y.phase="idle",m.debug("ROOT.active updated",{navigationId:c,layoutsCount:y.active.layouts.length,viewSet:!!y.active.view,dataKeys:Object.keys(y.active.data||{}),paramsKeys:Object.keys(y.active.params||{})}),y)),typeof window<"u"&&window.scroll(0,0),s&&(m.debug("Updating browser URL",{url:t}),window.history.pushState({},"",t)),m.debug("Navigation complete",{navigationId:c,url:t})}catch(h){if(m.error("Navigation failed",{navigationId:c,currentNavigationId:E,url:t,error:h instanceof Error?h.message:String(h)}),T.update(d=>(d.phase="idle",d)),h.name==="AbortError"){m.debug("Navigation aborted");return}throw h}}const U=_e("forge:events");function rt(e,t,r){if(!document){U.error("Document not found");return}document.addEventListener("click",n=>{var a,u;const i=window.location.pathname,o=((a=n.target)==null?void 0:a.tagName)==="A"?n.target:(u=n.target)==null?void 0:u.closest("A");if(o){let s=o.getAttribute("href");if(i===s){n.preventDefault();return}if(s&&s.startsWith("/")||s.startsWith(".")){const c=s.split("?")[0],l=o.getAttribute("method")||"get",p=t.find(h=>h.method.toLowerCase()===l&&r.find(d=>d.parser(c)&&d.pattern===h.path));if(p){n.preventDefault();const h=r.find(_=>_.parser(c)&&_.pattern===p.path),d=(h==null?void 0:h.parser(c))||{},v=new URLSearchParams(s.split("?")[1]||""),f=Object.fromEntries(v.entries())||{},S={...d,...f},g=A.get(q)[h==null?void 0:h.pattern];I.page.update(_=>(_.url=s,_.pathname=c,_.params=d,_.query=f,_)),U.debug("Click navigation to",s),ee(s,e,p,S,d,f,g,!0)}else U.warn("No matching route found",s,"- using fallback navigation")}}}),window.addEventListener("popstate",n=>{const i=window.location.pathname,o=window.location.pathname+window.location.search,a="get",u=t.find(s=>s.method.toLowerCase()===a&&r.find(c=>c.parser(i)&&c.pattern===s.path));if(u){const s=r.find(f=>f.parser(i)&&f.pattern===u.path),c=(s==null?void 0:s.parser(i))||{},l=new URLSearchParams(window.location.search),p=Object.fromEntries(l.entries())||{};I.page.update(f=>(f.url=o,f.pathname=window.location.pathname,f.params=c,f.query=p,f));const h={...c,...p},v=A.get(q)[s==null?void 0:s.pattern];U.debug("Popstate navigation to",o),ee(o,e,u,h,c,p,v,!1)}else U.warn("No matching route found",i,"- using fallback navigation"),window.location.href=i}),window.addEventListener("forge-redirect",(n=>{const i=n.detail.path,o=i.split("?")[0];U.debug("Handling forge-redirect to:",i);const a="get",u=t.find(s=>s.method.toLowerCase()===a&&r.find(c=>c.parser(o)&&c.pattern===s.path));if(u){const s=r.find(f=>f.parser(o)&&f.pattern===u.path),c=(s==null?void 0:s.parser(o))||{},l=new URLSearchParams(i.split("?")[1]||""),p=Object.fromEntries(l.entries())||{},h={...c,...p},v=A.get(q)[s==null?void 0:s.pattern];I.page.update(f=>(f.url=i,f.pathname=o,f.params=c,f.query=p,f)),ee(i,e,u,h,c,p,v,!0)}else U.warn("No matching route found",o,"- using fallback navigation"),window.location.href=o})),er(t,r)}const Pe="/__forge/dev-logs",dr=100,hr=20;class pr{constructor(){ie(this,"buffer",[]);ie(this,"timer",null);typeof window<"u"&&window.addEventListener("beforeunload",()=>{this.beaconFlush()})}log(t){if(this.buffer.push(t),this.buffer.length>=hr){this.flush();return}this.timer||(this.timer=setTimeout(()=>this.flush(),dr))}flush(){if(this.timer&&(clearTimeout(this.timer),this.timer=null),this.buffer.length===0)return;const t=this.buffer;this.buffer=[];try{fetch(Pe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:!0}).catch(()=>{})}catch{}}beaconFlush(){if(this.buffer.length===0)return;const t=this.buffer;this.buffer=[];try{navigator.sendBeacon(Pe,JSON.stringify(t))}catch{}}}const D=_e("forge:client"),oe=Symbol("forge-load-function");let te=[],X=null;function vr(e){try{const t=new URL(e,window.location.origin);return t.origin===window.location.origin&&!t.pathname.startsWith("/api/")}catch{return!e.startsWith("/api/")}}function mr(){typeof window<"u"&&!X&&(X=window.fetch,window.fetch=async function(e,t={}){if((typeof e=="string"?e:e instanceof URL?e.toString():e.url)==="/__forge/dev-logs")return X(e,t);let n={...t};for(const a of te)try{if(a.length===2){const u=new Headers(n.headers),s=Object.fromEntries(u.entries());await new Promise((c,l)=>{try{a(s,p=>{if(p)l(p);else{const h=new Headers;Object.entries(s).forEach(([d,v])=>{v!==void 0&&h.set(d,v)}),n.headers=h,c()}})}catch(p){l(p)}})}else{const u=await a(n,e);u&&typeof u=="object"&&(n=u)}}catch(u){throw D.error("Middleware error",u),u}const i=n==null?void 0:n[oe];D.debug("Fetch override request",{url:e,hasForgeSymbol:i,headers:n==null?void 0:n.headers});const o=await X(e,n);if(D.debug("Fetch override response",{url:e,responseUrl:o.url,redirected:o.redirected,status:o.status,type:o.type,hasForgeSymbol:i}),i&&o.redirected){const a=typeof e=="string"?e:e.url,u=o.url;if(D.debug("Redirect detected",{requested:a,final:u,redirected:o.redirected}),vr(u)){const s=new URL(u),c=s.pathname+s.search;return D.debug("Redirect detected to:",c,"- will navigate after current request completes"),new Response(JSON.stringify({layout:[],view:{}}),{status:200,headers:{"Content-Type":"application/json","X-Forge-Redirect":"true","X-Forge-Redirect-Path":c}})}}return o})}mr();var Re;if(typeof window<"u"){const e=window.__CONFIGURATION__;(Re=e==null?void 0:e.dev)!=null&&Re.enable_debug_log&&Qe().addTransport(new pr)}const yr={configUpdate(e){if(typeof e!="function")throw new Error("Middleware must be a function");te.push(e)},reset(){te.length=0},getMiddlewareCount(){return te.length}};let le;async function br(e,t){let r=window.__COMPONENT_DIR__||t.component_dir;if(!r&&typeof r!="string")throw new Error("No component directory provided");let n=window.__ROUTING__;if(le=ut(n),window&&window.location){const i=(window.location.pathname||"/").split("?")[0],o=le.find(u=>u.parser(i));let a=o?n.find(u=>u.path===o.pattern):null;if(o&&a){const u=o.parser(i)||{},s=new URLSearchParams(window.location.search),c=Object.fromEntries(s.entries())||{},l={...u,...c};Xe(),tt(e,r,a,l,u,c),rt(r,n,le)}else D.warn("No matching route",i)}}exports.page=I.page;exports.shadowUrl=I.shadowUrl;exports.MANIFEST_STORE=q;exports.bootstrap_events=rt;exports.createApp=br;exports.fetch=yr;exports.loadRoute=tt;exports.updateManifestStore=Xe;exports.updateRoute=ee;
3
+ `):"",this.name="UnsubscriptionError",this.errors=r}});function de(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var re=(function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,i,o;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var c=z(a),u=c.next();!u.done;u=c.next()){var s=u.value;s.remove(this)}}catch(f){t={error:f}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}else a.remove(this);var l=this.initialTeardown;if(w(l))try{l()}catch(f){o=f instanceof ae?f.errors:[f]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var p=z(h),d=p.next();!d.done;d=p.next()){var v=d.value;try{Ee(v)}catch(f){o=o??[],f instanceof ae?o=Y(Y([],B(o)),B(f.errors)):o.push(f)}}}catch(f){n={error:f}}finally{try{d&&!d.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}}if(o)throw new ae(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Ee(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&de(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&de(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})(),je=re.EMPTY;function Le(e){return e instanceof re||e&&"closed"in e&&w(e.remove)&&w(e.add)&&w(e.unsubscribe)}function Ee(e){w(e)?e():e.unsubscribe()}var ht={Promise:void 0},pt={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,Y([e,t],B(r)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function Ne(e){pt.setTimeout(function(){throw e})}function Oe(){}function Z(e){e()}var ye=(function(e){V(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Le(r)&&r.add(n)):n.destination=yt,n}return t.create=function(r,n,i){return new G(r,n,i)},t.prototype.next=function(r){this.isStopped||this._next(r)},t.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t})(re),vt=(function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){K(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){K(n)}else K(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){K(r)}},e})(),G=(function(e){V(t,e);function t(r,n,i){var o=e.call(this)||this,a;return w(r)||!r?a={next:r??void 0,error:n??void 0,complete:i??void 0}:a=r,o.destination=new vt(a),o}return t})(ye);function K(e){Ne(e)}function mt(e){throw e}var yt={closed:!0,next:Oe,error:mt,complete:Oe},be=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function we(e){return e}function bt(e){return e.length===0?we:e.length===1?e[0]:function(r){return e.reduce(function(n,i){return i(n)},r)}}var x=(function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var i=this,o=gt(t)?t:new G(t,r,n);return Z(function(){var a=i,c=a.operator,u=a.source;o.add(c?c.call(o,u):u?i._subscribe(o):i._trySubscribe(o))}),o},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=xe(r),new r(function(i,o){var a=new G({next:function(c){try{t(c)}catch(u){o(u),a.unsubscribe()}},error:o,complete:i});n.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[be]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return bt(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=xe(t),new t(function(n,i){var o;r.subscribe(function(a){return o=a},function(a){return i(a)},function(){return n(o)})})},e.create=function(t){return new e(t)},e})();function xe(e){var t;return(t=e??ht.Promise)!==null&&t!==void 0?t:Promise}function wt(e){return e&&w(e.next)&&w(e.error)&&w(e.complete)}function gt(e){return e&&e instanceof ye||wt(e)&&Le(e)}function St(e){return w(e==null?void 0:e.lift)}function L(e){return function(t){if(St(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function j(e,t,r,n,i){return new _t(e,t,r,n,i)}var _t=(function(e){V(t,e);function t(r,n,i,o,a,c){var u=e.call(this,r)||this;return u.onFinalize=a,u.shouldUnsubscribe=c,u._next=n?function(s){try{n(s)}catch(l){r.error(l)}}:e.prototype._next,u._error=o?function(s){try{o(s)}catch(l){r.error(l)}finally{this.unsubscribe()}}:e.prototype._error,u._complete=i?function(){try{i()}catch(s){r.error(s)}finally{this.unsubscribe()}}:e.prototype._complete,u}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t})(ye),Et=me(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),ne=(function(e){V(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new Ae(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new Et},t.prototype.next=function(r){var n=this;Z(function(){var i,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=z(n.currentObservers),c=a.next();!c.done;c=a.next()){var u=c.value;u.next(r)}}catch(s){i={error:s}}finally{try{c&&!c.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}}})},t.prototype.error=function(r){var n=this;Z(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var i=n.observers;i.length;)i.shift().error(r)}})},t.prototype.complete=function(){var r=this;Z(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,i=this,o=i.hasError,a=i.isStopped,c=i.observers;return o||a?je:(this.currentObservers=null,c.push(r),new re(function(){n.currentObservers=null,de(c,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,i=n.hasError,o=n.thrownError,a=n.isStopped;i?r.error(o):a&&r.complete()},t.prototype.asObservable=function(){var r=new x;return r.source=this,r},t.create=function(r,n){return new Ae(r,n)},t})(x),Ae=(function(e){V(t,e);function t(r,n){var i=e.call(this)||this;return i.destination=r,i.source=n,i}return t.prototype.next=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,r)},t.prototype.error=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&i!==void 0?i:je},t})(ne),Fe={now:function(){return(Fe.delegate||Date).now()},delegate:void 0},Ot=(function(e){V(t,e);function t(r,n,i){r===void 0&&(r=1/0),n===void 0&&(n=1/0),i===void 0&&(i=Fe);var o=e.call(this)||this;return o._bufferSize=r,o._windowTime=n,o._timestampProvider=i,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=n===1/0,o._bufferSize=Math.max(1,r),o._windowTime=Math.max(1,n),o}return t.prototype.next=function(r){var n=this,i=n.isStopped,o=n._buffer,a=n._infiniteTimeWindow,c=n._timestampProvider,u=n._windowTime;i||(o.push(r),!a&&o.push(c.now()+u)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),i=this,o=i._infiniteTimeWindow,a=i._buffer,c=a.slice(),u=0;u<c.length&&!r.closed;u+=o?1:2)r.next(c[u]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,i=r._timestampProvider,o=r._buffer,a=r._infiniteTimeWindow,c=(a?1:2)*n;if(n<1/0&&c<o.length&&o.splice(0,o.length-c),!a){for(var u=i.now(),s=0,l=1;l<o.length&&o[l]<=u;l+=2)s=l;s&&o.splice(0,s+1)}},t})(ne),ge=(function(e){return e&&typeof e.length=="number"&&typeof e!="function"});function Ue(e){return w(e==null?void 0:e.then)}function ke(e){return w(e[be])}function $e(e){return Symbol.asyncIterator&&w(e==null?void 0:e[Symbol.asyncIterator])}function Me(e){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.")}function xt(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var De=xt();function We(e){return w(e==null?void 0:e[De])}function qe(e){return ft(this,arguments,function(){var r,n,i,o;return Ce(this,function(a){switch(a.label){case 0:r=e.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,W(r.read())];case 3:return n=a.sent(),i=n.value,o=n.done,o?[4,W(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,W(i)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function ze(e){return w(e==null?void 0:e.getReader)}function N(e){if(e instanceof x)return e;if(e!=null){if(ke(e))return At(e);if(ge(e))return Tt(e);if(Ue(e))return It(e);if($e(e))return Be(e);if(We(e))return Pt(e);if(ze(e))return Rt(e)}throw Me(e)}function At(e){return new x(function(t){var r=e[be]();if(w(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Tt(e){return new x(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function It(e){return new x(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,Ne)})}function Pt(e){return new x(function(t){var r,n;try{for(var i=z(e),o=i.next();!o.done;o=i.next()){var a=o.value;if(t.next(a),t.closed)return}}catch(c){r={error:c}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.complete()})}function Be(e){return new x(function(t){Ct(e,t).catch(function(r){return t.error(r)})})}function Rt(e){return Be(qe(e))}function Ct(e,t){var r,n,i,o;return lt(this,void 0,void 0,function(){var a,c;return Ce(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),r=dt(e),u.label=1;case 1:return[4,r.next()];case 2:if(n=u.sent(),!!n.done)return[3,4];if(a=n.value,t.next(a),t.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=u.sent(),i={error:c},[3,11];case 6:return u.trys.push([6,,9,10]),n&&!n.done&&(o=r.return)?[4,o.call(r)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function $(e,t,r,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var o=t.schedule(function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(o),!i)return o}function Ge(e,t){return t===void 0&&(t=0),L(function(r,n){r.subscribe(j(n,function(i){return $(n,e,function(){return n.next(i)},t)},function(){return $(n,e,function(){return n.complete()},t)},function(i){return $(n,e,function(){return n.error(i)},t)}))})}function Ve(e,t){return t===void 0&&(t=0),L(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function jt(e,t){return N(e).pipe(Ve(t),Ge(t))}function Lt(e,t){return N(e).pipe(Ve(t),Ge(t))}function Nt(e,t){return new x(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}function Ft(e,t){return new x(function(r){var n;return $(r,t,function(){n=e[De](),$(r,t,function(){var i,o,a;try{i=n.next(),o=i.value,a=i.done}catch(c){r.error(c);return}a?r.complete():r.next(o)},0,!0)}),function(){return w(n==null?void 0:n.return)&&n.return()}})}function He(e,t){if(!e)throw new Error("Iterable cannot be null");return new x(function(r){$(r,t,function(){var n=e[Symbol.asyncIterator]();$(r,t,function(){n.next().then(function(i){i.done?r.complete():r.next(i.value)})},0,!0)})})}function Ut(e,t){return He(qe(e),t)}function kt(e,t){if(e!=null){if(ke(e))return jt(e,t);if(ge(e))return Nt(e,t);if(Ue(e))return Lt(e,t);if($e(e))return He(e,t);if(We(e))return Ft(e,t);if(ze(e))return Ut(e,t)}throw Me(e)}function Ye(e,t){return t?kt(e,t):N(e)}var $t=me(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Mt(e,t){return new Promise(function(r,n){var i=new G({next:function(o){r(o),i.unsubscribe()},error:n,complete:function(){n(new $t)}});e.subscribe(i)})}function Se(e,t){return L(function(r,n){var i=0;r.subscribe(j(n,function(o){n.next(e.call(t,o,i++))}))})}var Dt=Array.isArray;function Wt(e,t){return Dt(t)?e.apply(void 0,Y([],B(t))):e(t)}function qt(e){return Se(function(t){return Wt(e,t)})}function zt(e,t,r,n,i,o,a,c){var u=[],s=0,l=0,h=!1,p=function(){h&&!u.length&&!s&&t.complete()},d=function(f){return s<n?v(f):u.push(f)},v=function(f){s++;var S=!1;N(r(f,l++)).subscribe(j(t,function(_){t.next(_)},function(){S=!0},void 0,function(){if(S)try{s--;for(var _=function(){var g=u.shift();a||v(g)};u.length&&s<n;)_();p()}catch(g){t.error(g)}}))};return e.subscribe(j(t,d,function(){h=!0,p()})),function(){}}function Je(e,t,r){return r===void 0&&(r=1/0),w(t)?Je(function(n,i){return Se(function(o,a){return t(n,o,i,a)})(N(e(n,i)))},r):(typeof t=="number"&&(r=t),L(function(n,i){return zt(n,i,e,r)}))}var Bt=["addListener","removeListener"],Gt=["addEventListener","removeEventListener"],Vt=["on","off"];function he(e,t,r,n){if(w(r)&&(n=r,r=void 0),n)return he(e,t,r).pipe(qt(n));var i=B(Jt(e)?Gt.map(function(c){return function(u){return e[c](t,u,r)}}):Ht(e)?Bt.map(Te(e,t)):Yt(e)?Vt.map(Te(e,t)):[],2),o=i[0],a=i[1];if(!o&&ge(e))return Je(function(c){return he(c,t,r)})(N(e));if(!o)throw new TypeError("Invalid event target");return new x(function(c){var u=function(){for(var s=[],l=0;l<arguments.length;l++)s[l]=arguments[l];return c.next(1<s.length?s:s[0])};return o(u),function(){return a(u)}})}function Te(e,t){return function(r){return function(n){return e[r](t,n)}}}function Ht(e){return w(e.addListener)&&w(e.removeListener)}function Yt(e){return w(e.on)&&w(e.off)}function Jt(e){return w(e.addEventListener)&&w(e.removeEventListener)}function se(e,t){return L(function(r,n){var i=0;r.subscribe(j(n,function(o){return e.call(t,o,i++)&&n.next(o)}))})}function Kt(e,t){return t===void 0&&(t=we),e=e??Xt,L(function(r,n){var i,o=!0;r.subscribe(j(n,function(a){var c=t(a);(o||!e(i,c))&&(o=!1,i=c,n.next(a))}))})}function Xt(e,t){return e===t}function Zt(e){e===void 0&&(e={});var t=e.connector,r=t===void 0?function(){return new ne}:t,n=e.resetOnError,i=n===void 0?!0:n,o=e.resetOnComplete,a=o===void 0?!0:o,c=e.resetOnRefCountZero,u=c===void 0?!0:c;return function(s){var l,h,p,d=0,v=!1,f=!1,S=function(){h==null||h.unsubscribe(),h=void 0},_=function(){S(),l=p=void 0,v=f=!1},g=function(){var b=l;_(),b==null||b.unsubscribe()};return L(function(b,P){d++,!f&&!v&&S();var R=p=p??r();P.add(function(){d--,d===0&&!f&&!v&&(h=ue(g,u))}),R.subscribe(P),!l&&d>0&&(l=new G({next:function(C){return R.next(C)},error:function(C){f=!0,S(),h=ue(_,i,C),R.error(C)},complete:function(){v=!0,S(),h=ue(_,a),R.complete()}}),N(b).subscribe(l))})(s)}}function ue(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(t===!0){e();return}if(t!==!1){var i=new G({next:function(){i.unsubscribe(),e()}});return N(t.apply(void 0,Y([],B(r)))).subscribe(i)}}function Ke(e,t){return L(function(r,n){var i=null,o=0,a=!1,c=function(){return a&&!i&&n.complete()};r.subscribe(j(n,function(u){i==null||i.unsubscribe();var s=0,l=o++;N(e(u,l)).subscribe(i=j(n,function(h){return n.next(t?t(u,h,l,s++):h)},function(){i=null,c()}))},function(){a=!0,c()}))})}function Qt(e,t,r){var n=w(e)||t||r?{next:e,error:t,complete:r}:e;return n?L(function(i,o){var a;(a=n.subscribe)===null||a===void 0||a.call(n);var c=!0;i.subscribe(j(o,function(u){var s;(s=n.next)===null||s===void 0||s.call(n,u),o.next(u)},function(){var u;c=!1,(u=n.complete)===null||u===void 0||u.call(n),o.complete()},function(u){var s;c=!1,(s=n.error)===null||s===void 0||s.call(n,u),o.error(u)},function(){var u,s;c&&((u=n.unsubscribe)===null||u===void 0||u.call(n)),(s=n.finalize)===null||s===void 0||s.call(n)}))}):we}const q=A.writable({});async function Xe(){q.update(e=>(Object.assign(e,window.__MANIFEST__),e))}const F=new Map,Q=5e3;function er(e){const t=F.get(e);return t?(F.delete(e),Date.now()-t.createdAt>Q?(t.abortController.abort(),null):t.response$):null}function tr(e,t){he(document,"mouseover").pipe(Zt()).pipe(Se(i=>{const o=i.target,a=(o==null?void 0:o.tagName)==="A"?o:o==null?void 0:o.closest("A");if(!a)return null;const c=a.getAttribute("href");return!c||!c.startsWith("/")&&!c.startsWith(".")?null:c}),se(i=>i!==null),se(i=>i!==window.location.pathname),Kt(),se(i=>{const o=i.split("?")[0],a="get",c=e.find(l=>l.method.toLowerCase()===a&&t.find(h=>h.parser(o)&&h.pattern===l.path));if(!c)return!1;const u=t.find(l=>l.parser(o)&&l.pattern===c.path);return!!A.get(q)[u==null?void 0:u.pattern]}),Ke(i=>{const o=F.get(i);if(o&&Date.now()-o.createdAt<Q)return[];const a=new AbortController,c=new Ot(1),u={response$:c,createdAt:Date.now(),abortController:a};F.set(i,u);const s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:a.signal};return s[oe]=!0,Ye(fetch(i,s).then(l=>(c.next(l),c.complete(),i),l=>(c.error(l),F.delete(i),null))).pipe(Qt({unsubscribe:()=>{a.abort(),F.delete(i)}}))})).subscribe(),setInterval(()=>{const i=Date.now();for(const[o,a]of F)i-a.createdAt>Q&&(a.abortController.abort(),F.delete(o))},Q)}var k=(e=>(e[e.TRACE=0]="TRACE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.FATAL=5]="FATAL",e))(k||{});const rr={trace:0,debug:1,info:2,warn:3,error:4,fatal:5};function nr(e){if(!e)return 2;const t=e.trim().toLowerCase(),r=rr[t];if(typeof r=="number")return r;const n=Number(t);return Number.isFinite(n)&&n>=0&&n<=5?n:2}function Ze(e){switch(e){case 0:return"TRACE";case 1:return"DEBUG";case 2:return"INFO";case 3:return"WARN";case 4:return"ERROR";case 5:return"FATAL";default:return"INFO"}}function Ie(e){if(e===void 0)return"undefined";if(e===null)return null;if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};switch(typeof e){case"string":case"number":case"boolean":return e;case"bigint":return e.toString();case"symbol":return String(e);case"function":return`[Function${e.name?`: ${e.name}`:""}]`;default:return e}}class or{constructor(t,r,n){this.name=t,this.manager=r,this.contextData=n}named(t){return new pe(t,this.manager,this.contextData)}withContext(t){const r=this.contextData?{...this.contextData,...t}:t;return new pe(this.name,this.manager,r)}trace(t,...r){this.log(k.TRACE,t,r)}debug(t,...r){this.log(k.DEBUG,t,r)}info(t,...r){this.log(k.INFO,t,r)}warn(t,...r){this.log(k.WARN,t,r)}error(t,...r){this.log(k.ERROR,t,r)}fatal(t,...r){this.log(k.FATAL,t,r)}log(t,r,n){if(!this.manager.shouldLog(t,this.name))return;const i=new Date().toISOString();let o=n.length>0?n.length===1?Ie(n[0]):n.map(Ie):void 0,a;this.contextData&&o!==void 0?a={...this.contextData,args:o}:this.contextData?a=this.contextData:a=o,this.manager.log({timestamp:i,level:Ze(t),logger:this.name,message:r,context:a})}}class pe extends or{constructor(t,r,n){super(t,r,n)}}class ir{log(t){const r=t.context!==void 0?` ${JSON.stringify(t.context)}`:"",n=`[${t.timestamp}] [${t.logger}] [${t.level}] ${t.message}${r}`;switch(t.level){case"ERROR":case"FATAL":console.error(n);break;case"WARN":console.warn(n);break;default:console.log(n);break}}}const ce=Symbol.for("@noego/logger");class ar{constructor(){var i,o,a;this.transports=[],this.loggerLevels=new Map;const t=typeof process<"u"?(i=process.env)==null?void 0:i.LOG_LEVEL:void 0,r=typeof process<"u"?(o=process.env)==null?void 0:o.SERVICE_NAME:void 0,n=typeof process<"u"?(a=process.env)==null?void 0:a.NODE_ENV:void 0;this.level=nr(t),this.service=r??"noego",this.environment=n??"development"}getLevel(){return this.level}setLevel(t){this.level=t}setLoggerLevel(t,r){this.loggerLevels.set(t,r)}shouldLog(t,r){if(r){const n=this.loggerLevels.get(r);if(n!==void 0)return t>=n}return t>=this.level}addTransport(t){this.transports.push(t)}setTransports(t){this.transports=[...t]}clearTransports(){this.transports=[]}setServiceName(t){this.service=t}log(t){const r={...t,environment:this.environment,service:this.service};for(const n of this.transports)n.log(r)}async closeAll(){for(const t of this.transports)t.close&&await t.close()}formatMessage(t,r,n){return`[${new Date().toISOString()}] [${r}] [${Ze(t)}] ${n}`}}function Qe(){const e=globalThis;if(!e[ce]){const t=new ar;t.addTransport(new ir),e[ce]=t}return e[ce]}function _e(e){return new pe(e,Qe())}const m=_e("forge:nav"),sr=1e4;function ur(e,t,r){let n=null,i=!1;const o=new Promise((a,c)=>{n=setTimeout(()=>{i=!0,m.error("Timeout fired after",t,"ms"),r(),c(new Error(`Navigation timed out after ${t}ms`))},t),m.debug("Timeout scheduled for",t,"ms, timeoutId:",n)});return Promise.race([e.finally(()=>{n!==null&&(i?m.warn("Promise settled AFTER timeout already fired"):(m.debug("Clearing timeout",n,"- promise settled successfully"),clearTimeout(n)))}),o])}const ve=new ne;let E=0,H=null,et;function cr(e){e&&e.redirectPath&&(m.debug("Handling redirect to",e.redirectPath),setTimeout(()=>{window.dispatchEvent(new CustomEvent("forge-redirect",{detail:{path:e.redirectPath}}))},0))}ve.pipe(Ke(e=>Ye(ur(dr(e),sr,()=>{m.error("Navigation timed out"),E++,H&&(H.abort(),H=null)}).catch(t=>{m.error("Navigation failed:",t)})))).subscribe({next:cr,error:e=>{m.error("Stream error:",e)}});function lr(e){var t;m.debug("Pushing navigation event to stream",{url:e.url,currentNavigationId:E,subscriberCount:((t=ve.observers)==null?void 0:t.length)||0}),ve.next(e)}const T=A.writable({active:{layouts:[],view:null,viewPath:null,layoutPaths:[],data:{layout:[],view:{}},params:{},urlParams:{},query:{}},phase:"idle",navigationId:0,page:I.page}),fr=async()=>{const e=A.get(T).navigationId;try{const t=window.location.pathname+window.location.search,r={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"}};r[oe]=!0;const n=await fetch(t,r);if(!n.ok)return!1;const i=await n.json(),o=A.get(T).navigationId;return e!==o?(m.debug("Discarding stale poll response",{pollNavigationId:e,currentNavigationId:o}),!1):(T.update(a=>{var c;return a.active.data={layout:((c=a.active.data)==null?void 0:c.layout)||[],view:i.view},a}),!0)}catch{return!1}};I.page.update(e=>(e.poll=fr,e));async function tt(e,t,r,n,i,o){if(!t.controller)return;let a=J(e,t.controller).toString();i&&(a=a.replace(/\.svelte\.ts$/,".js").replace(/\.ts$/,".js"),/\.[a-z]+$/.test(a)||(a+=".js")),a.startsWith("/")||(a="/"+a);const u=(await import(a)).default,l=o?await Promise.resolve(o(u)):new u,h=l.initialize;return typeof h=="function"&&await Promise.resolve(h.call(l,r,n)),l}function J(...e){let t=e.map((r,n)=>n===0?r.replace(/\/+$/,""):r.replace(/^\/+|\/+$/g,"")).join("/");return t.startsWith("/")||(t="/"+t),t.split("?")[0]}async function rt(e,t,r,n,i,o,a){et=a;try{const c=typeof t=="string"&&t.indexOf("assets")!==-1,u=(r.layout||[]).map(g=>{let b=J(t,g).toString();return c&&(b=b.endsWith(".svelte")?b.replace(/\.svelte$/,".js"):/[.][a-z]+$/.test(b)?b:b+".js"),b});let s=J(t,r.view).toString();c&&(s=s.endsWith(".svelte")?s.replace(/\.svelte$/,".js"):/[.][a-z]+$/.test(s)?s:s+".js");const l=await Promise.all(u.map(g=>import(g).then(b=>b.default)));s.startsWith("/")||(s="/"+s);const h=await import(s).then(g=>g.default),p=window.__INITIAL_DATA__||{layout:[],view:{}},d=typeof t=="string"&&t.indexOf("assets")!==-1,v=A.get(I.page),f={params:n,urlParams:i,query:o,page:v},S=await tt(t,r,p.view,f,d,a),_={layouts:l,view:h,viewPath:r.view||null,layoutPaths:r.layout||[],data:p,params:n,urlParams:i,query:o,controller:S};T.update(g=>(g.active=_,g.phase="idle",g)),at.hydrate(st,{target:e,props:{root:T}})}catch(c){m.error("Client-side route loading failed:",c)}}function ee(e,t,r,n,i,o,a=!1,c=!0){lr({url:e,base_path:t,route:r,params:n,urlParams:i,query:o,server_loading:a,updateUrl:c})}async function dr(e){var h;const{url:t,base_path:r,route:n,params:i,urlParams:o,query:a,server_loading:c,updateUrl:u}=e,s=++E,l=new AbortController;H=l,m.debug("Starting navigation",{navigationId:s,url:t,updateUrl:u,server_loading:c,currentNavigationId:E,hasAbortController:!!H}),T.update(p=>(p.phase="loading",p.navigationId=s,p));try{let p={layout:[],view:{}};if(c){m.debug("Fetching server data",{navigationId:s,url:t});let y=null;const O=er(t);if(O)try{m.debug("Using prefetched response for",t),y=await Mt(O)}catch{m.debug("Prefetch failed, falling back to fetch",t),y=null}if(!y){const M={method:n.method,headers:{"Content-Type":"application/json",Accept:"application/json"},signal:l.signal};M[oe]=!0,y=await fetch(t,M)}if(m.debug("Fetch response received",{navigationId:s,url:t,ok:y.ok,status:y.status,redirected:y.redirected,currentNavigationId:E}),y.redirected||y.headers.get("X-Forge-Redirect")==="true")return m.debug("Redirect detected"),T.update(M=>(M.phase="idle",M)),{redirectPath:y.headers.get("X-Forge-Redirect-Path")||void 0};if(!y.ok)throw new Error(`Network response was not ok: ${y.status}`);p=await y.json(),m.debug("Server data received:",p)}if(s!==E){m.debug("Stale navigation after fetch, aborting",{navigationId:s,currentNavigationId:E});return}m.debug("Loading components",{navigationId:s,view:n.view,layouts:n.layout});const d=typeof r=="string"&&r.indexOf("assets")!==-1,v=(n.layout||[]).map(y=>{let O=J(r,y).toString();return d&&(O=O.endsWith(".svelte")?O.replace(/\.svelte$/,".js"):/[.][a-z]+$/.test(O)?O:O+".js"),O});let f=J(r,n.view).toString();d&&(f=f.endsWith(".svelte")?f.replace(/\.svelte$/,".js"):/[.][a-z]+$/.test(f)?f:f+".js"),f.startsWith("/")||(f="/"+f);const S=await Promise.all(v.map(y=>import(y).then(O=>O.default))),_=await import(f).then(y=>y.default);if(m.debug("Components loaded",{navigationId:s,currentNavigationId:E,layoutsCount:S.length,viewLoaded:!!_}),s!==E){m.debug("Stale navigation after component load, aborting",{navigationId:s,currentNavigationId:E});return}const g=A.get(I.page),b={params:i,urlParams:o,query:a,page:g},P=await tt(r,n,p.view,b,d,et);if(s!==E){m.debug("Stale navigation after controller resolution, aborting",{navigationId:s,currentNavigationId:E}),(h=P==null?void 0:P.destroy)==null||h.call(P);return}const R=A.get(T).active.controller;R!=null&&R.destroy&&R.destroy();const C={layouts:S,view:_,viewPath:n.view||null,layoutPaths:n.layout||[],data:p,params:i,urlParams:o,query:a,controller:P};m.debug("Committing new state",{navigationId:s,currentNavigationId:E,layoutsCount:C.layouts.length,viewSet:!!C.view,dataKeys:Object.keys(C.data||{})}),T.update(y=>(y.active=C,y.phase="idle",m.debug("ROOT.active updated",{navigationId:s,layoutsCount:y.active.layouts.length,viewSet:!!y.active.view,dataKeys:Object.keys(y.active.data||{}),paramsKeys:Object.keys(y.active.params||{})}),y)),typeof window<"u"&&window.scroll(0,0),u&&(m.debug("Updating browser URL",{url:t}),window.history.pushState({},"",t)),m.debug("Navigation complete",{navigationId:s,url:t})}catch(p){if(m.error("Navigation failed",{navigationId:s,currentNavigationId:E,url:t,error:p instanceof Error?p.message:String(p)}),T.update(d=>(d.phase="idle",d)),p.name==="AbortError"){m.debug("Navigation aborted");return}throw p}}const U=_e("forge:events");function nt(e,t,r){if(!document){U.error("Document not found");return}document.addEventListener("click",n=>{var a,c;const i=window.location.pathname,o=((a=n.target)==null?void 0:a.tagName)==="A"?n.target:(c=n.target)==null?void 0:c.closest("A");if(o){let u=o.getAttribute("href");if(i===u){n.preventDefault();return}if(u&&u.startsWith("/")||u.startsWith(".")){const s=u.split("?")[0],l=o.getAttribute("method")||"get",h=t.find(p=>p.method.toLowerCase()===l&&r.find(d=>d.parser(s)&&d.pattern===p.path));if(h){n.preventDefault();const p=r.find(b=>b.parser(s)&&b.pattern===h.path),d=(p==null?void 0:p.parser(s))||{},v=new URLSearchParams(u.split("?")[1]||""),f=Object.fromEntries(v.entries())||{},S={...d,...f},g=A.get(q)[p==null?void 0:p.pattern];I.page.update(b=>(b.url=u,b.pathname=s,b.params=d,b.query=f,b)),U.debug("Click navigation to",u),ee(u,e,h,S,d,f,g,!0)}else U.warn("No matching route found",u,"- using fallback navigation")}}}),window.addEventListener("popstate",n=>{const i=window.location.pathname,o=window.location.pathname+window.location.search,a="get",c=t.find(u=>u.method.toLowerCase()===a&&r.find(s=>s.parser(i)&&s.pattern===u.path));if(c){const u=r.find(f=>f.parser(i)&&f.pattern===c.path),s=(u==null?void 0:u.parser(i))||{},l=new URLSearchParams(window.location.search),h=Object.fromEntries(l.entries())||{};I.page.update(f=>(f.url=o,f.pathname=window.location.pathname,f.params=s,f.query=h,f));const p={...s,...h},v=A.get(q)[u==null?void 0:u.pattern];U.debug("Popstate navigation to",o),ee(o,e,c,p,s,h,v,!1)}else U.warn("No matching route found",i,"- using fallback navigation"),window.location.href=i}),window.addEventListener("forge-redirect",(n=>{const i=n.detail.path,o=i.split("?")[0];U.debug("Handling forge-redirect to:",i);const a="get",c=t.find(u=>u.method.toLowerCase()===a&&r.find(s=>s.parser(o)&&s.pattern===u.path));if(c){const u=r.find(f=>f.parser(o)&&f.pattern===c.path),s=(u==null?void 0:u.parser(o))||{},l=new URLSearchParams(i.split("?")[1]||""),h=Object.fromEntries(l.entries())||{},p={...s,...h},v=A.get(q)[u==null?void 0:u.pattern];I.page.update(f=>(f.url=i,f.pathname=o,f.params=s,f.query=h,f)),ee(i,e,c,p,s,h,v,!0)}else U.warn("No matching route found",o,"- using fallback navigation"),window.location.href=o})),tr(t,r)}const Pe="/__forge/dev-logs",hr=100,pr=20;class vr{constructor(){ie(this,"buffer",[]);ie(this,"timer",null);typeof window<"u"&&window.addEventListener("beforeunload",()=>{this.beaconFlush()})}log(t){if(this.buffer.push(t),this.buffer.length>=pr){this.flush();return}this.timer||(this.timer=setTimeout(()=>this.flush(),hr))}flush(){if(this.timer&&(clearTimeout(this.timer),this.timer=null),this.buffer.length===0)return;const t=this.buffer;this.buffer=[];try{fetch(Pe,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),keepalive:!0}).catch(()=>{})}catch{}}beaconFlush(){if(this.buffer.length===0)return;const t=this.buffer;this.buffer=[];try{navigator.sendBeacon(Pe,JSON.stringify(t))}catch{}}}const D=_e("forge:client"),oe=Symbol("forge-load-function");let te=[],X=null;function mr(e){try{const t=new URL(e,window.location.origin);return t.origin===window.location.origin&&!t.pathname.startsWith("/api/")}catch{return!e.startsWith("/api/")}}function yr(){typeof window<"u"&&!X&&(X=window.fetch,window.fetch=async function(e,t={}){if((typeof e=="string"?e:e instanceof URL?e.toString():e.url)==="/__forge/dev-logs")return X(e,t);let n={...t};for(const a of te)try{if(a.length===2){const c=new Headers(n.headers),u=Object.fromEntries(c.entries());await new Promise((s,l)=>{try{a(u,h=>{if(h)l(h);else{const p=new Headers;Object.entries(u).forEach(([d,v])=>{v!==void 0&&p.set(d,v)}),n.headers=p,s()}})}catch(h){l(h)}})}else{const c=await a(n,e);c&&typeof c=="object"&&(n=c)}}catch(c){throw D.error("Middleware error",c),c}const i=n==null?void 0:n[oe];D.debug("Fetch override request",{url:e,hasForgeSymbol:i,headers:n==null?void 0:n.headers});const o=await X(e,n);if(D.debug("Fetch override response",{url:e,responseUrl:o.url,redirected:o.redirected,status:o.status,type:o.type,hasForgeSymbol:i}),i&&o.redirected){const a=typeof e=="string"?e:e.url,c=o.url;if(D.debug("Redirect detected",{requested:a,final:c,redirected:o.redirected}),mr(c)){const u=new URL(c),s=u.pathname+u.search;return D.debug("Redirect detected to:",s,"- will navigate after current request completes"),new Response(JSON.stringify({layout:[],view:{}}),{status:200,headers:{"Content-Type":"application/json","X-Forge-Redirect":"true","X-Forge-Redirect-Path":s}})}}return o})}yr();var Re;if(typeof window<"u"){const e=window.__CONFIGURATION__;(Re=e==null?void 0:e.dev)!=null&&Re.enable_debug_log&&Qe().addTransport(new vr)}const br={configUpdate(e){if(typeof e!="function")throw new Error("Middleware must be a function");te.push(e)},reset(){te.length=0},getMiddlewareCount(){return te.length}};let le;async function wr(e,t){let r=window.__COMPONENT_DIR__||t.component_dir;if(!r&&typeof r!="string")throw new Error("No component directory provided");let n=window.__ROUTING__;if(le=ct(n),window&&window.location){const i=(window.location.pathname||"/").split("?")[0],o=le.find(c=>c.parser(i));let a=o?n.find(c=>c.path===o.pattern):null;if(o&&a){const c=o.parser(i)||{},u=new URLSearchParams(window.location.search),s=Object.fromEntries(u.entries())||{},l={...c,...s};Xe(),rt(e,r,a,l,c,s,t.controller_factory),nt(r,n,le)}else D.warn("No matching route",i)}}exports.page=I.page;exports.shadowUrl=I.shadowUrl;exports.MANIFEST_STORE=q;exports.bootstrap_events=nt;exports.createApp=wr;exports.fetch=br;exports.loadRoute=rt;exports.updateManifestStore=Xe;exports.updateRoute=ee;
4
4
  //# sourceMappingURL=client.cjs.map