Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

navi

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

navi - npm Package Compare versions

Comparing version 0.10.13 to 0.11.0-alpha.1

1

dist/commonjs/index.d.ts

@@ -1,2 +0,1 @@

export { app, getApp } from './app';
export { createContext, isValidContext, Context } from './Context';

@@ -3,0 +2,0 @@ export { Env } from './Env';

@@ -6,5 +6,2 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var app_1 = require("./app");
exports.app = app_1.app;
exports.getApp = app_1.getApp;
var Context_1 = require("./Context");

@@ -11,0 +8,0 @@ exports.createContext = Context_1.createContext;

@@ -1,2 +0,1 @@

export { app, getApp } from './app';
export { createContext, isValidContext, Context } from './Context';

@@ -3,0 +2,0 @@ export { Env } from './Env';

@@ -1,2 +0,1 @@

export { app, getApp } from './app';
export { createContext, isValidContext } from './Context';

@@ -3,0 +2,0 @@ export { isValidDeclaration } from './isValidDeclaration';

2

dist/umd/navi.min.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("history")):"function"==typeof define&&define.amd?define(["exports","history"],t):t((e=e||self).Navi={},e.History)}(this,function(e,t){"use strict";function r(e,t){return e==t||!(!e||!t)&&(e.pathname==t.pathname&&e.search==t.search&&e.hash==t.hash&&e.state==t.state)}var n=/((((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/;function s(e,t){var r,s,a,u,h,c=void 0===t?{}:t,l=c.ensureTrailingSlash,p=void 0===l||l,f=c.removeHash,d=void 0!==f&&f;if("string"==typeof e){var v=n.exec(e);if(!v)throw new Error("Couldn't parse the provided URL.");r=v[2]||"",s=o(a=v[6]||""),u=v[7]||""}else r=e.pathname||"",s=e.query||(e.search?o(e.search):{}),a=e.search||i(s),u=e.hash||"",h=e.state;return p&&r.length&&"/"!==r.substr(-1)&&(r+="/"),{pathname:r,query:s,search:a,hash:d?"":u,href:r+a+u,state:h}}function o(e,t){if(void 0===t&&(t="?"),!e||e[0]!=t)return{};for(var r={},n=e.slice(1).split("&"),s=0,o=n.length;s<o;s++){var i=n[s].split("=");r[i[0]]=i[1]?decodeURIComponent(i[1]):""}return r}function i(e,t){void 0===t&&(t="?");var r=Object.keys(e);if(0===r.length)return"";for(var n=[],s=0,o=r.length;s<o;s++){var i=r[s],a=String(e[i]);n.push(""===a?i:i+"="+encodeURIComponent(a))}return t+n.join("&")}function a(e,t){return t?("/"===e[e.length-1]&&(e=e.substr(0,e.length-1)),"/"===t[0]&&(t=t.substr(1)),e+"/"+t):e}var u,h,c=(u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),l=function(e){function t(t){var r=this,n=this.constructor.prototype;return(r=e.call(this,t)||this).__proto__=n,Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(r,r.constructor):Object.defineProperty(r,"stack",{value:(new Error).stack}),Object.defineProperty(r,"message",{value:t}),r}return c(t,e),t}(Error),p=function(e){function t(t){var r=e.call(this,"URL not found: "+t)||this;return r.pathname=t,r.name="NotFoundError",r}return c(t,e),t}(l),f=function(e){function t(t){var r=e.call(this,"URL not managed by router: "+t.href)||this;return r.url=t,r.name="OutOfRootError",r}return c(t,e),t}(l);function d(t,r){return t===e.Status.Error||r===e.Status.Error?e.Status.Error:t===e.Status.Busy||r===e.Status.Busy?e.Status.Busy:e.Status.Ready}(h=e.Status||(e.Status={})).Ready="ready",h.Busy="busy",h.Error="error";var v,y,b=function(){function t(){this.listenerIds=new Map,this.nextId=1,this.results=new WeakMap}return t.prototype.listen=function(e,t){this.listenerIds.set(e,t)},t.prototype.unlisten=function(e){this.listenerIds.delete(e)},t.prototype.resolve=function(t,r,n){var s=this.results.get(t);s||(s=new Map,this.results.set(t,s));var o=s.get(r);if(o)return o;var i,u=n&&s.get(n)||{promise:Promise.resolve()},h=this.nextId++,c=r(t,u.promise);if(!(i=c)||!i.then){var l={id:h,status:e.Status.Ready,value:c,promise:Promise.resolve(c)};return s.set(r,l),l}var p=c.then(m),f={id:h,status:e.Status.Busy,promise:p};return s.set(r,f),this.listenForChanges(p,s,r,h,a(t.pathname,t.unmatchedPathnamePart)),f},t.prototype.listenForChanges=function(t,r,n,s,o){var i=this;t.then(function(o){var i=r.get(n);if(i&&i.id===s)return r.set(n,{id:i.id,status:e.Status.Ready,value:o,promise:t}),!0},function(i){var a=r.get(n);if(i instanceof p&&!i.pathname&&(i.pathname=o),a&&a.id===s)return r.set(n,{id:a.id,status:e.Status.Error,error:i||new Error,promise:t}),!0}).then(function(e){if(e)for(var t=Array.from(i.listenerIds.entries()),r=0;r<t.length;r++){var n=t[r],o=n[0];-1!==n[1].indexOf(s)&&o()}})},t}();function m(e){return function(e){return e&&"object"==typeof e&&"default"in e}(e)?e.default:e}function g(t){return t.status!==e.Status.Busy&&(0===t.remainingSegments.length||g(t.remainingSegments[0]))}function w(e,t,r,n){return void 0===n&&(n=!0),Object.assign({type:e,meta:void 0,params:t.params,url:s({pathname:t.pathname,query:t.query},{ensureTrailingSlash:n}),remainingSegments:r.remainingSegments||[]},r)}function R(t,r,n){return void 0===n&&(n=!0),w(e.SegmentType.Placeholder,t,{status:r?e.Status.Error:e.Status.Busy,error:r},n)}function S(t){var r=a(t.pathname,t.unmatchedPathnamePart),n=new p(r);return{type:e.SegmentType.Placeholder,params:t.params,url:s({pathname:r,query:t.query}),status:e.Status.Error,error:n,remainingSegments:[]}}(v=e.SegmentType||(e.SegmentType={})).Placeholder="placeholder",v.Switch="switch",v.Page="page",v.Redirect="redirect",function(e){e.Switch="switch",e.Page="page",e.Redirect="redirect",e.Context="context"}(y||(y={}));var P=function(){function e(e,t){void 0===t&&(t=!1),this.appendFinalSlash=!!e.appendFinalSlash,this.env=e.env,this.resolver=e.resolver,this.withContent=!!e.withContent,this.wildcard=t}return e.prototype.getResult=function(){var e=this.env.unmatchedPathnamePart;return this.wildcard||!e||"/"===e?this.execute():{resolutionIds:[],segment:S(this.env)}},e}(),x=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),O=function(){return(O=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},C=function(t){function r(e){return t.call(this,e,!0)||this}return x(r,t),r.prototype.execute=function(){var t=this.resolver.resolve(this.env,this.constructor.childContextResolvable);if(t.status!==e.Status.Ready)return{resolutionIds:[t.id],segment:R(this.env,t.error,this.appendFinalSlash)};var r,n=t.value;this.last&&this.last.childContext===n?r=this.last.childEnv:(r=O({},this.env,{context:n}),this.last={childContext:n,childEnv:r});var s=this.resolver.resolve(r,this.constructor.childNodeResolvable);if(s.status!==e.Status.Ready)return{resolutionIds:[s.id],segment:R(r,s.error,this.appendFinalSlash)};var o,i=s.value;return this.last.node!==i?(o=new i({env:r,resolver:this.resolver,withContent:this.withContent,appendFinalSlash:this.appendFinalSlash}),this.last=O({},this.last,{node:i,matcher:o})):o=this.last.matcher,o.getResult()},r.isNode=!0,r.type=y.Context,r}(P);function T(e){return e&&e.prototype&&e.prototype instanceof C}var _=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),E=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return _(r,t),r.prototype.execute=function(){var t,r,n,s,o=[],i=e.Status.Ready;if(this.constructor.getMeta){var a=this.resolver.resolve(this.env,this.constructor.getMeta);o.push(a.id),r=a.value,i=d(i,a.status),t=t||a.error}else r=this.constructor.meta;if(this.withContent&&this.constructor.getContent){var u=this.resolver.resolve(this.env,this.constructor.getContent,this.constructor.getMeta);o.push(u.id),n=u.value,i=d(i,u.status),t=t||u.error}else n=this.constructor.content;if(this.constructor.getTitle){var h=this.resolver.resolve(this.env,this.constructor.getTitle,this.constructor.getMeta);o.push(h.id),s=h.value,i=d(i,h.status),t=t||h.error}else s=this.constructor.title;return{resolutionIds:o,segment:w(e.SegmentType.Page,this.env,{title:s,meta:r||{},status:i,error:t,content:n,remainingSegments:[]})}},r.isNode=!0,r.type=y.Page,r}(P);function j(e){return e&&e.prototype&&e.prototype instanceof E}var U=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),M={},N=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return U(r,t),r.prototype.execute=function(){var t,r=this.resolver.resolve(this.env,this.constructor.to),n=r.value,o=r.status,i=r.error,u=this.resolver.resolve(this.env,this.constructor.meta),h=u.value;return o=d(o,u.status),i=i||u.error,"string"==typeof n?t="./"===n.slice(0,2)?a(this.env.pathname.split("/").slice(0,-1).join("/"),n.slice(2)):n:n&&(t=s(n).href),{resolutionIds:[r.id,u.id],segment:w(e.SegmentType.Redirect,this.env,{to:t,meta:h||M,status:o,error:i,remainingSegments:[]})}},r.isNode=!0,r.type=y.Redirect,r}(P);function k(e){return e&&e.prototype&&e.prototype instanceof N}var I=function(){return(I=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},D="\0";function F(e,t){var r=e;if(r.length>1&&"/"===r.substr(-1)&&(r=r.substr(0,r.length-1)),"/"!==r[0]&&(r="/"+r),/\/{2,}/.test(r)&&(r=r.replace(/\/{2,}/g,"/")),/^([A-Za-z0-9\$\-_\.+!*'\(\),\/]|\/:)+$/.test(r),0===r.length)throw new Error('You cannot use an empty string "" as a pattern!');for(var n=r.split("/").slice(1),s=[],o=[],i=["^"],a=0;a<n.length;a++){var u=n[a];u.length>1&&":"===u[0]?(s.push(u.slice(1)),o.push(D),i.push("([^/]+)")):(o.push(u),i.push(u.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")))}return{key:o.join("/"),maybeResolvableNode:t,pattern:r,pathParamNames:s.length?s:void 0,regExp:new RegExp(i.join("/"))}}function V(e,t,r){var n=t.regExp.exec(e.unmatchedPathnamePart);if(n){var s=n[0],o=e.params;if(t.pathParamNames){o=I({},e.params);for(var i=0;i<t.pathParamNames.length;i++){o[t.pathParamNames[i]]=n[i+1]}}var u=a(e.mountname,s);return{context:e.context,headers:{},method:e.method,params:o,pathname:u,mountname:u,query:e.query,search:e.search,router:e.router,unmatchedPathnamePart:e.unmatchedPathnamePart.slice(s.length)||(r?"/":""),url:e.url}}}var B=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),q=function(t){function r(e){for(var r=t.call(this,e,!0)||this,n=r.constructor.orderedMappings,s=n.length-1;s>=0;s--){var o=n[s],i=V(r.env,o,r.appendFinalSlash);if(i){r.child={mapping:o,matcherOptions:{env:i,resolver:r.resolver,withContent:r.withContent,appendFinalSlash:r.appendFinalSlash},maybeResolvableNode:o.maybeResolvableNode};break}}return r}return B(r,t),r.prototype.execute=function(){var t,r,n,s,o,i,a,u,h=[],c=e.Status.Ready;if(this.constructor.getMeta){var l=this.resolver.resolve(this.env,this.constructor.getMeta);h.push(l.id),r=l.value,c=d(c,l.status),t=t||l.error}else r=this.constructor.meta;if(this.withContent&&this.constructor.getContent){var p=this.resolver.resolve(this.env,this.constructor.getContent,this.constructor.getMeta);h.push(p.id),n=p.value,c=d(c,p.status),t=t||p.error}else n=this.constructor.content;if(this.constructor.getTitle){var f=this.resolver.resolve(this.env,this.constructor.getTitle,this.constructor.getMeta);h.push(f.id),s=f.value,c=d(c,f.status),t=t||f.error}else s=this.constructor.title;if(this.child){var v=void 0;this.child.maybeResolvableNode.isNode?v=this.child.maybeResolvableNode:(i=this.resolver.resolve(this.child.matcherOptions.env,this.child.maybeResolvableNode),h.push(i.id),v=i.value),this.last&&this.last.node===v?o=this.last.matcher:v&&(o=new v(this.child.matcherOptions)),this.last={node:v,matcher:o}}o&&(a=o.getResult()),a?u=a&&a.segment:i?u=R(this.child.matcherOptions.env,i.error,this.appendFinalSlash):this.env.unmatchedPathnamePart&&(u=S(this.env));var y=[];return u&&(y=u.type===e.SegmentType.Switch?[u].concat(u.remainingSegments):[u]),{resolutionIds:h.concat(a?a.resolutionIds:[]),segment:w(e.SegmentType.Switch,this.env,{status:c,error:t,content:n,meta:r||{},title:s,switch:this.constructor,nextPattern:this.child&&this.child.mapping.pattern,nextSegment:u,lastRemainingSegment:y[y.length-1],remainingSegments:y},this.appendFinalSlash)}},r.isNode=!0,r.type=y.Switch,r}(P);function A(e){return e&&e.prototype&&e.prototype instanceof q}var L=function(){return function(){this.promise=new Promise(function(e,t){this.resolve=e,this.reject=t}.bind(this)),Object.freeze(this)}}(),H=function(){function e(e,t){this.close=e,this.observer=t,this.observer.start&&this.observer.start(this)}return e.prototype.unsubscribe=function(){this.closed||(this.closed=!0,this.close(this.observer),delete this.close,delete this.observer)},e}();function Q(e,t,r){return"function"==typeof e?{next:e,error:t,complete:r}:e}function G(e){return new Promise(function(t,r){e.subscribe({start:function(e){this.subscription=e},next:function(e){this.value=e},complete:function(){t(this.value),this.subscription.unsubscribe()},error:function(e){r(e),this.subscription.unsubscribe()}})})}var $=function(){return($=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},z=function(e,t,r,n){return new(r||(r=Promise))(function(s,o){function i(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){e.done?s(e.value):new r(function(t){t(e.value)}).then(i,a)}u((n=n.apply(e,t||[])).next())})},W=function(e,t){var r,n,s,o,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(s=2&o[0]?n.return:o[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,o[1])).done)return s;switch(n=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(s=(s=i.trys).length>0&&s[s.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){i.label=o[1];break}if(6===o[0]&&i.label<s[1]){i.label=s[1],s=o;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(o);break}s[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{r=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};function Y(e){return new J(e.history,e.router)}var Z,J=function(){function t(t,r){var n=this;this.handleUnsubscribe=function(e){var t=n.observers.indexOf(e);-1!==t&&n.observers.splice(t,1)},this.update=function(t){var r=n.lastURL,s=t||n.lastRoute,o=t&&t.lastSegment;if(o&&o.type===e.SegmentType.Redirect&&o.to)n.history.replace(o.to);else{n.lastRoute=$({},s,{url:r}),n.waitUntilSteadyDeferred&&n.lastRoute.isSteady&&(n.waitUntilSteadyDeferred.resolve(n.lastRoute),delete n.waitUntilSteadyDeferred);for(var i=0;i<n.observers.length;i++)n.observers[i].next(n.lastRoute)}},this.observers=[],this.router=r,this.history=t,this.lastURL=s(this.history.location),this.unlisten=this.history.listen(function(e){return n.handleURLChange(s(e))}),this.refresh()}return t.prototype.dispose=function(){this.observers.length=0,this.unlisten(),delete this.unlisten,delete this.history,this.observableSubscription&&this.observableSubscription.unsubscribe(),delete this.observableSubscription,delete this.router,delete this.waitUntilSteadyDeferred,delete this.lastRoute},t.prototype.refresh=function(){this.handleURLChange(s(this.history.location),!0)},t.prototype.setRouter=function(e){this.router=e,this.refresh()},t.prototype.getValue=function(){return this.lastRoute},t.prototype.getSteadyRoute=function(){return z(this,void 0,void 0,function(){return W(this,function(e){return this.error?[2,Promise.reject(this.error)]:this.lastRoute&&this.lastRoute.isSteady?[2,Promise.resolve(this.lastRoute)]:(this.waitUntilSteadyDeferred||(this.waitUntilSteadyDeferred=new L),[2,this.waitUntilSteadyDeferred.promise])})})},t.prototype.subscribe=function(e,t,r){var n=Q(e,t,r);return this.observers.push(n),new H(this.handleUnsubscribe,n)},t.prototype.handleURLChange=function(e,t){if(!t&&this.lastReceivedURL&&r(this.lastReceivedURL,e))for(var n=0;n<this.observers.length;n++)this.observers[n].next(this.lastRoute);else{if(this.lastReceivedURL=e,"/"!==e.pathname.substr(-1))return e=$({},e,{pathname:e.pathname+"/"}),void this.history.replace(e);var s,o,i=this.lastURL;if(this.lastURL=e,e&&i&&(s=e.pathname!==i.pathname,o=e.search!==i.search),t||s||o||this.lastRoute.error){this.observableSubscription&&this.observableSubscription.unsubscribe();var a=this.router.createObservable(e,{withContent:!0});if(a)this.observableSubscription=a.subscribe(this.update);else if(!i)throw new f(e)}else this.update()}},t}();function K(e){return Object.values(e).every(function(e){return e.isSteady})}function X(t,r){for(var n,s=[r].concat(r.remainingSegments),o=s[s.length-1],i=o.status,a=0;a<s.length;a++){var u=s[a];u.status===e.Status.Error&&(n=u.error,i=e.Status.Error)}var h={type:o.type,url:t,segments:s,firstSegment:s[0],lastSegment:o,isSteady:g(s[0]),error:n,status:i};return o.type===e.SegmentType.Redirect&&(h.to=o.to,h.meta=o.meta),o.type===e.SegmentType.Page&&(h.title=o.title,h.meta=o.meta,h.content=o.content),h}(Z=e.RouteType||(e.RouteType={})).Switch="switch",Z.Page="page",Z.Redirect="redirect",Z.Plaecholder="placeholder";var ee,te=function(){function e(e,t,r,n,s){var o=this;this.handleUnsubscribe=function(e){var t=o.observers.indexOf(e);-1!==t&&o.observers.splice(t,1)},this.handleChange=function(){o.refresh();for(var e=0;e<o.observers.length;e++){var t=o.observers[e];t.next(o.cachedValue),o.cachedValue.isSteady&&t.complete&&t.complete()}o.cachedValue.isSteady&&(o.resolver.unlisten(o.handleChange),delete o.matcher,delete o.resolver)},this.refresh=function(){var e=o.matcher.getResult(),t=e.segment,r=e.resolutionIds;o.cachedValue=X(o.url,t),o.resolver.listen(o.handleChange,r)},this.url=e,this.resolver=n,this.observers=[],this.matcher=new r({appendFinalSlash:!0,env:t,resolver:this.resolver,withContent:s})}return e.prototype.subscribe=function(e,t,r){if(!this.resolver)throw new Error("Can't subscribe to an already-complete RoutingObservable.");var n=Q(e,t,r);this.observers.push(n);var s=new H(this.handleUnsubscribe,n);return 1===this.observers.length&&this.handleChange(),s},e}();!function(e){e.Post="post",e.Get="get",e.Put="put",e.Patch="patch",e.Delete="delete",e.Head="head",e.Options="options"}(ee||(ee={}));var re=function(e,t,r,n){return new(r||(r=Promise))(function(s,o){function i(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){e.done?s(e.value):new r(function(t){t(e.value)}).then(i,a)}u((n=n.apply(e,t||[])).next())})},ne=function(e,t){var r,n,s,o,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(s=2&o[0]?n.return:o[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,o[1])).done)return s;switch(n=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(s=(s=i.trys).length>0&&s[s.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){i.label=o[1];break}if(6===o[0]&&i.label<s[1]){i.label=s[1],s=o;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(o);break}s[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{r=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},se=function(){function t(t,r,n,o,i,u,h){var c=this;this.handleUnsubscribe=function(e){var t=c.observers.indexOf(e);-1!==t&&c.observers.splice(t,1)},this.handleResolverUpdate=function(){c.isRefreshing?c.isRefreshScheduled||(c.isRefreshScheduled=!0):c.refresh()},this.refresh=function(){return re(c,void 0,void 0,function(){var t,r,n,o,i,u,h,c,l,p,f,d,v,y,b,m,g,w,R,S,P,x;return ne(this,function(O){switch(O.label){case 0:this.isRefreshScheduled=!1,this.isRefreshing=!0,t=[],r=0,O.label=1;case 1:if(!(r<this.mapItems.length))return[3,6];if(v=this.mapItems[r],w=v.pathname,n=v.matcher.getResult(),o=n.segment,i=n.resolutionIds,y=o.lastRemainingSegment||o,u=v.lastSegmentCache,v.segmentCache=o,v.lastSegmentCache=y,y.status===e.Status.Error||this.options.predicate&&!this.options.predicate(y))return this.removeFromQueue(v),[3,1];if(!this.options.followRedirects||y.type!==e.SegmentType.Redirect||y.status!==e.Status.Ready||!y.to||u&&u.type===e.SegmentType.Redirect&&u.status===e.Status.Ready&&u.to&&u.to===y.to||this.addToQueue(y.to,v.depth+1,w,v.order),y.type!==e.SegmentType.Switch||y.status!==e.Status.Ready||u&&u.type===e.SegmentType.Switch&&u.status!==e.Status.Busy)return[3,5];h=y.switch.patterns,c=0,O.label=2;case 2:return c<h.length?[4,this.expandPatterns(a(w,h[c]))]:[3,5];case 3:for(l=O.sent(),p=0;p<l.length;p++)this.addToQueue(l[p],v.depth+1,w,v.order.concat(c,p));O.label=4;case 4:return c++,[3,2];case 5:return i&&(t=t.concat(i)),r++,[3,1];case 6:for(f=[],d=0;d<this.mapItems.length;d++)v=this.mapItems[d],(y=v.lastSegmentCache).type!==e.SegmentType.Switch&&y.status!==e.Status.Error&&f.push([a(v.pathname,"/"),X(s(v.pathname,{ensureTrailingSlash:!1}),v.segmentCache),v.order]);if(this.resolver.listen(this.handleResolverUpdate,t),f.sort(function(e,t){var r=e[2],n=t[2];if(r.length<n.length)return-1;if(r.length>n.length)return 1;for(var s=0;s<r.length;s++){if(r[s]<n[s])return-1;if(r[s]>n[s])return 1}return 0}),this.isRefreshScheduled)this.refresh();else{for(b={},m=0;m<f.length;m++)g=f[m],w=g[0],R=g[1],b[w]=R;for(S=K(b),P=0;P<this.observers.length;P++)(x=this.observers[P]).next(b),S&&x.complete&&x.complete();S&&(this.resolver.unlisten(this.handleResolverUpdate),delete this.rootContext,delete this.mapItems,delete this.router,delete this.observers,delete this.resolver),this.isRefreshing=!1}return[2]}})})},this.observers=[],this.mapItems=[],this.resolver=i,this.router=u,this.rootContext=r,this.pages=n,this.rootMapping=o,this.options=h,this.seenPathnames=new Set;var l=t.pathname;"/"===l.substr(-1)&&(l=l.substr(0,l.length-1)),this.addToQueue(l,0)}return t.prototype.subscribe=function(e,t,r){if(!this.resolver)throw new Error("Can't subscribe to an already-complete RoutingObservable.");var n=Q(e,t,r);this.observers.push(n);var s=new H(this.handleUnsubscribe,n);return 1===this.observers.length&&this.refresh(),s},t.prototype.expandPatterns=function(e){return re(this,void 0,void 0,function(){var t;return ne(this,function(r){switch(r.label){case 0:return this.options.expandPattern?[4,this.options.expandPattern(e,this.router)]:[3,2];case 1:if(t=r.sent())return[2,t];r.label=2;case 2:return[2,[e].filter(function(e){return!/\/:/.test(e)})]}})})},t.prototype.removeFromQueue=function(e){var t=this.mapItems.indexOf(e);-1!==t&&this.mapItems.splice(t,1)},t.prototype.addToQueue=function(e,t,r,n){if(void 0===n&&(n=[0]),!this.seenPathnames.has(e)&&(!this.options.maxDepth||t<=this.options.maxDepth)){this.seenPathnames.add(e);var o=s(e,{ensureTrailingSlash:!1,removeHash:!0}),i=V({context:this.rootContext,headers:{},method:ee.Get,params:{},pathname:"",mountname:"",query:o.query,search:o.search,router:this.router,unmatchedPathnamePart:o.pathname,url:o},this.rootMapping,!1);i&&this.mapItems.push({url:o,fromPathname:r,depth:t,pathname:e,order:n,matcher:new this.pages({appendFinalSlash:!1,env:i,resolver:this.resolver,withContent:this.options.withContent})})}},t}();var oe=function(){function t(e,t){this.resolver=e,this.context=t.context||{},this.pages=t.pages;var r,n,s=t.basename;s&&"/"===s.slice(-1)&&(s=s.slice(0,-1)),this.rootMapping=(r=t.pages,void 0===(n=s)&&(n=""),""!==n?F(n,r):{pattern:n,key:"",regExp:new RegExp(""),maybeResolvableNode:r})}return t.prototype.createObservable=function(e,t){void 0===t&&(t={});var r=s(e,{removeHash:!0}),n=V({context:this.context,headers:{},method:t.method||ee.Get,mountname:"",params:r.query,pathname:"",query:r.query,search:r.search,router:this,url:r,unmatchedPathnamePart:r.pathname},this.rootMapping,!0);if(n)return new te(r,n,this.pages,this.resolver,!!t.withContent)},t.prototype.createMapObservable=function(e,t){return void 0===t&&(t={}),new se(s(e,{ensureTrailingSlash:!1}),this.context,this.pages,this.rootMapping,this.resolver,this,t)},t.prototype.resolve=function(e,t){var r=this;void 0===t&&(t={});var n=function(e){return Array.isArray(e)?e.map(function(e){return s(e)}):[s(e)]}(e);if(!n.length)return Promise.resolve([]);var o=n.map(function(e){return r.getPageRoutePromise(e,t)});return Array.isArray(e)?Promise.all(o):o[0]},t.prototype.resolveSiteMap=function(t,r){return void 0===r&&(r={}),G(this.createMapObservable(t,r)).then(function(t){for(var r={},n={},s=Object.keys(t),o=0;o<s.length;o++){var i=s[o],a=t[i];if(a.status===e.Status.Ready){if(a.type===e.RouteType.Page){r[i]=a;continue}if(a.type===e.RouteType.Redirect){n[i]=a;continue}}throw a.error||new Error("router error")}return{pages:r,redirects:n}})},t.prototype.resolvePageMap=function(e,t){return void 0===t&&(t={}),this.resolveSiteMap(e,t).then(function(e){return e.pages})},t.prototype.getPageRoutePromise=function(t,r){var n=this,o=this.createObservable(t,r);return o?G(o).then(function(t){if(t.status===e.Status.Ready){if(t.type===e.RouteType.Redirect&&r.followRedirects)return n.getPageRoutePromise(s(t.to),r);if(t.type===e.RouteType.Page)return t}throw t.error||new Error("router error")}):Promise.reject(new f(t))},t}();var ie=function(e,t,r,n){return new(r||(r=Promise))(function(s,o){function i(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){e.done?s(e.value):new r(function(t){t(e.value)}).then(i,a)}u((n=n.apply(e,t||[])).next())})},ae=function(e,t){var r,n,s,o,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(s=2&o[0]?n.return:o[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,o[1])).done)return s;switch(n=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(s=(s=i.trys).length>0&&s[s.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){i.label=o[1];break}if(6===o[0]&&i.label<s[1]){i.label=s[1],s=o;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(o);break}s[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{r=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};var ue=function(){function n(n){var s=this;this.handleChange=function(e){s.receivedRoute=e},this.handleRendered=function(){if(s.renderedRoute!==s.receivedRoute){var t=s.renderedRoute,n=s.receivedRoute;if(n&&n.type===e.RouteType.Page&&n.status===e.Status.Ready&&s.setDocumentTitle&&(document.title=s.setDocumentTitle(n.title)),n&&n.isSteady){if(t&&r(n.url,t.url))return;s.disableScrollHandling||t&&t.url&&t.url.hash===n.url.hash&&t.url.pathname===n.url.pathname||he(n.url.hash,t&&t.url&&t.url.pathname===n.url.pathname?s.hashScrollBehavior:"instant")}s.renderedRoute=s.receivedRoute}else s.receivedRoute&&s.receivedRoute.url.hash&&he(s.receivedRoute.url.hash,s.hashScrollBehavior)},this.history=n.history||t.createBrowserHistory(),this.resolver=new b,this.pages=n.pages,this.basename=n.basename,this.router=new oe(this.resolver,{context:n.context,pages:n.pages,basename:n.basename}),!1!==n.setDocumentTitle&&(this.setDocumentTitle="function"==typeof n.setDocumentTitle?n.setDocumentTitle:function(e){return e||"Untitled Page"}),this.disableScrollHandling=!!n.disableScrollHandling,this.currentRouteObservable=Y({history:this.history,router:this.router}),this.currentRouteObservable.subscribe(this.handleChange),this.renderedRoute=this.currentRouteObservable.getValue(),this.hashScrollBehavior=n.hashScrollBehavior||"smooth"}return n.prototype.dispose=function(){this.currentRouteObservable.dispose(),delete this.currentRouteObservable,delete this.router,delete this.history,delete this.resolver,delete this.pages,delete this.setDocumentTitle,delete this.receivedRoute,delete this.renderedRoute},n.prototype.setContext=function(e){this.router=new oe(this.resolver,{context:e,pages:this.pages,basename:this.basename}),this.currentRouteObservable.setRouter(this.router)},n.prototype.getCurrentValue=function(){var e=this.currentRouteObservable.getValue();return{route:e,url:e.url,history:this.history,router:this.router,onRendered:this.handleRendered}},n.prototype.steady=function(){return ie(this,void 0,void 0,function(){return ae(this,function(e){switch(e.label){case 0:return[4,this.getSteadyValue()];case 1:return e.sent(),[2]}})})},n.prototype.getSteadyValue=function(){return ie(this,void 0,void 0,function(){var e=this;return ae(this,function(t){return[2,this.currentRouteObservable.getSteadyRoute().then(function(t){return{route:t,url:t.url,history:e.history,router:e.router,onRendered:e.handleRendered}})]})})},n.prototype.subscribe=function(e,t,r){var n=Q(e,t,r),s=new ce(n,this,this.handleRendered);return this.currentRouteObservable.subscribe(s)},n}();function he(e,t){if(e){var r=document.getElementById(e.slice(1));r&&(r.scrollIntoView({behavior:t,block:"start"}),r.focus())}else window.scroll({top:0,left:0,behavior:"auto"})}var ce=function(){function e(e,t,r){this.navigation=t,this.observer=e,this.onRendered=r}return e.prototype.next=function(e){this.observer.next({route:e,url:e.url,history:this.navigation.history,router:this.navigation.router,onRendered:this.onRendered})},e.prototype.error=function(e){this.observer.error&&this.observer.error(e)},e}(),le=function(e,t,r,n){return new(r||(r=Promise))(function(s,o){function i(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){e.done?s(e.value):new r(function(t){t(e.value)}).then(i,a)}u((n=n.apply(e,t||[])).next())})},pe=function(e,t){var r,n,s,o,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(s=2&o[0]?n.return:o[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,o[1])).done)return s;switch(n=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(s=(s=i.trys).length>0&&s[s.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){i.label=o[1];break}if(6===o[0]&&i.label<s[1]){i.label=s[1],s=o;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(o);break}s[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{r=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};var fe=function(){function e(e){this.history=t.createMemoryHistory({initialEntries:[s(e.url).href]}),this.resolver=new b,this.pages=e.pages,this.basename=e.basename,this.router=new oe(this.resolver,{context:e.context,pages:this.pages,basename:this.basename}),this.currentRouteObservable=Y({history:this.history,router:this.router})}return e.prototype.dispose=function(){this.currentRouteObservable.dispose(),delete this.currentRouteObservable,delete this.router,delete this.resolver,delete this.pages},e.prototype.setContext=function(e){this.router=new oe(this.resolver,{context:e,pages:this.pages,basename:this.basename}),this.currentRouteObservable.setRouter(this.router)},e.prototype.getCurrentValue=function(){var e=this.currentRouteObservable.getValue();return{route:e,url:e.url,history:this.history,router:this.router,onRendered:de}},e.prototype.getSteadyValue=function(){return le(this,void 0,void 0,function(){var e=this;return pe(this,function(t){return[2,this.currentRouteObservable.getSteadyRoute().then(function(t){return{route:t,url:t.url,history:e.history,router:e.router,onRendered:de}})]})})},e.prototype.steady=function(){return le(this,void 0,void 0,function(){return pe(this,function(e){switch(e.label){case 0:return[4,this.getSteadyValue()];case 1:return e.sent(),[2]}})})},e.prototype.subscribe=function(e,t,r){var n=Q(e,t,r),s=new ve(n,this);return this.currentRouteObservable.subscribe(s)},e}(),de=function(){},ve=function(){function e(e,t){this.observer=e,this.navigation=t}return e.prototype.next=function(e){this.observer.next({route:e,url:e.url,history:this.navigation.history,router:this.navigation.router,onRendered:de})},e.prototype.error=function(e){this.observer.error&&this.observer.error(e)},e}();e.app=function(e){var t=window,r=t.NaviApp;r||(r=t.NaviApp={}),Object.assign(r,e),r.isBuild||e.main()},e.getApp=function(){return window.NaviApp||{}},e.createContext=function(e,t){var r,n=t.isNode?function(){return t}:t,s="function"!=typeof e?function(){return e}:e;return(r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return x(t,e),t}(C)).childNodeResolvable=n,r.childContextResolvable=s,r},e.isValidContext=T,e.isValidDeclaration=function(e){return T(e)||j(e)||k(e)||A(e)},e.createSwitch=function(e){var t;if(!e)throw new Error("createSwitch() must be supplied with an options object.");e.paths||(e.paths={});var r=Object.keys(e.paths),n=r.filter(function(t){return"function"!=typeof e.paths[t]});if(n.length>0){var s=1===n.length;throw new TypeError("The given "+(s?"path":"paths")+": "+n.join(", ")+" "+(s?"is":"are")+" invalid. Path should be an instance of Switch, Page, Redirect, Context or a function. See https://frontarm.com/navi/reference/declarations/#declaring-pages")}var o=r.map(function(t){return F(t,e.paths[t])}).sort(function(e,t){return r=e.key,n=t.key,r<n?-1:r>n?1:0;var r,n});return(t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return B(t,e),t}(q)).paths=e.paths,t.meta=e.meta,t.getMeta=e.getMeta,t.title=e.title,t.getTitle=e.getTitle,t.content=e.content,t.getContent=e.getContent,t.orderedMappings=o,t.patterns=r,t},e.isValidSwitch=A,e.CurrentRouteObservable=J,e.createCurrentRouteObservable=Y,e.createPage=function(e){var t;return(t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return _(t,e),t}(E)).title=e.title,t.getTitle=e.getTitle,t.meta=e.meta,t.getMeta=e.getMeta,t.content=e.content,t.getContent=e.getContent,t},e.isValidPage=j,e.createRedirect=function(e,t){var r;return(r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return U(t,e),t}(N)).to="function"==typeof e?e:function(){return e},r.meta="function"==typeof t?t:function(){return t},r},e.isValidRedirect=k,e.Router=oe,e.createRouter=function(e){return new oe(new b,e)},e.createBrowserNavigation=function(e){return new ue(e)},e.BrowserNavigation=ue,e.createMemoryNavigation=function(e){return new fe(e)},e.MemoryNavigation=fe,e.areURLDescriptorsEqual=r,e.createURLDescriptor=s,e.parseQuery=o,e.stringifyQuery=i,e.joinPaths=a,e.isSegmentSteady=g,e.createSegment=w,e.createPlaceholderSegment=R,e.createNotFoundSegment=S,e.NaviError=l,e.NotFoundError=p,e.OutOfRootError=f,e.isRouteMapSteady=K,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("history")):"function"==typeof define&&define.amd?define(["exports","history"],t):t((e=e||self).Navi={},e.History)}(this,function(e,t){"use strict";function r(e,t){return e==t||!(!e||!t)&&(e.pathname==t.pathname&&e.search==t.search&&e.hash==t.hash&&e.state==t.state)}var n=/((((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/;function s(e,t){var r,s,a,u,h,c=void 0===t?{}:t,l=c.ensureTrailingSlash,p=void 0===l||l,f=c.removeHash,d=void 0!==f&&f;if("string"==typeof e){var v=n.exec(e);if(!v)throw new Error("Couldn't parse the provided URL.");r=v[2]||"",s=o(a=v[6]||""),u=v[7]||""}else r=e.pathname||"",s=e.query||(e.search?o(e.search):{}),a=e.search||i(s),u=e.hash||"",h=e.state;return p&&r.length&&"/"!==r.substr(-1)&&(r+="/"),{pathname:r,query:s,search:a,hash:d?"":u,href:r+a+u,state:h}}function o(e,t){if(void 0===t&&(t="?"),!e||e[0]!=t)return{};for(var r={},n=e.slice(1).split("&"),s=0,o=n.length;s<o;s++){var i=n[s].split("=");r[i[0]]=i[1]?decodeURIComponent(i[1]):""}return r}function i(e,t){void 0===t&&(t="?");var r=Object.keys(e);if(0===r.length)return"";for(var n=[],s=0,o=r.length;s<o;s++){var i=r[s],a=String(e[i]);n.push(""===a?i:i+"="+encodeURIComponent(a))}return t+n.join("&")}function a(e,t){return t?("/"===e[e.length-1]&&(e=e.substr(0,e.length-1)),"/"===t[0]&&(t=t.substr(1)),e+"/"+t):e}var u,h,c=(u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),l=function(e){function t(t){var r=this,n=this.constructor.prototype;return(r=e.call(this,t)||this).__proto__=n,Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(r,r.constructor):Object.defineProperty(r,"stack",{value:(new Error).stack}),Object.defineProperty(r,"message",{value:t}),r}return c(t,e),t}(Error),p=function(e){function t(t){var r=e.call(this,"URL not found: "+t)||this;return r.pathname=t,r.name="NotFoundError",r}return c(t,e),t}(l),f=function(e){function t(t){var r=e.call(this,"URL not managed by router: "+t.href)||this;return r.url=t,r.name="OutOfRootError",r}return c(t,e),t}(l);function d(t,r){return t===e.Status.Error||r===e.Status.Error?e.Status.Error:t===e.Status.Busy||r===e.Status.Busy?e.Status.Busy:e.Status.Ready}(h=e.Status||(e.Status={})).Ready="ready",h.Busy="busy",h.Error="error";var v,y,b=function(){function t(){this.listenerIds=new Map,this.nextId=1,this.results=new WeakMap}return t.prototype.listen=function(e,t){this.listenerIds.set(e,t)},t.prototype.unlisten=function(e){this.listenerIds.delete(e)},t.prototype.resolve=function(t,r,n){var s=this.results.get(t);s||(s=new Map,this.results.set(t,s));var o=s.get(r);if(o)return o;var i,u=n&&s.get(n)||{promise:Promise.resolve()},h=this.nextId++,c=r(t,u.promise);if(!(i=c)||!i.then){var l={id:h,status:e.Status.Ready,value:c,promise:Promise.resolve(c)};return s.set(r,l),l}var p=c.then(m),f={id:h,status:e.Status.Busy,promise:p};return s.set(r,f),this.listenForChanges(p,s,r,h,a(t.pathname,t.unmatchedPathnamePart)),f},t.prototype.listenForChanges=function(t,r,n,s,o){var i=this;t.then(function(o){var i=r.get(n);if(i&&i.id===s)return r.set(n,{id:i.id,status:e.Status.Ready,value:o,promise:t}),!0},function(i){var a=r.get(n);if(i instanceof p&&!i.pathname&&(i.pathname=o),a&&a.id===s)return r.set(n,{id:a.id,status:e.Status.Error,error:i||new Error,promise:t}),!0}).then(function(e){if(e)for(var t=Array.from(i.listenerIds.entries()),r=0;r<t.length;r++){var n=t[r],o=n[0];-1!==n[1].indexOf(s)&&o()}})},t}();function m(e){return function(e){return e&&"object"==typeof e&&"default"in e}(e)?e.default:e}function g(t){return t.status!==e.Status.Busy&&(0===t.remainingSegments.length||g(t.remainingSegments[0]))}function w(e,t,r,n){return void 0===n&&(n=!0),Object.assign({type:e,meta:void 0,params:t.params,url:s({pathname:t.pathname,query:t.query},{ensureTrailingSlash:n}),remainingSegments:r.remainingSegments||[]},r)}function R(t,r,n){return void 0===n&&(n=!0),w(e.SegmentType.Placeholder,t,{status:r?e.Status.Error:e.Status.Busy,error:r},n)}function S(t){var r=a(t.pathname,t.unmatchedPathnamePart),n=new p(r);return{type:e.SegmentType.Placeholder,params:t.params,url:s({pathname:r,query:t.query}),status:e.Status.Error,error:n,remainingSegments:[]}}(v=e.SegmentType||(e.SegmentType={})).Placeholder="placeholder",v.Switch="switch",v.Page="page",v.Redirect="redirect",function(e){e.Switch="switch",e.Page="page",e.Redirect="redirect",e.Context="context"}(y||(y={}));var P=function(){function e(e,t){void 0===t&&(t=!1),this.appendFinalSlash=!!e.appendFinalSlash,this.env=e.env,this.resolver=e.resolver,this.withContent=!!e.withContent,this.wildcard=t}return e.prototype.getResult=function(){var e=this.env.unmatchedPathnamePart;return this.wildcard||!e||"/"===e?this.execute():{resolutionIds:[],segment:S(this.env)}},e}(),x=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),O=function(){return(O=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},C=function(t){function r(e){return t.call(this,e,!0)||this}return x(r,t),r.prototype.execute=function(){var t=this.resolver.resolve(this.env,this.constructor.childContextResolvable);if(t.status!==e.Status.Ready)return{resolutionIds:[t.id],segment:R(this.env,t.error,this.appendFinalSlash)};var r,n=t.value;this.last&&this.last.childContext===n?r=this.last.childEnv:(r=O({},this.env,{context:n}),this.last={childContext:n,childEnv:r});var s=this.resolver.resolve(r,this.constructor.childNodeResolvable);if(s.status!==e.Status.Ready)return{resolutionIds:[s.id],segment:R(r,s.error,this.appendFinalSlash)};var o,i=s.value;return this.last.node!==i?(o=new i({env:r,resolver:this.resolver,withContent:this.withContent,appendFinalSlash:this.appendFinalSlash}),this.last=O({},this.last,{node:i,matcher:o})):o=this.last.matcher,o.getResult()},r.isNode=!0,r.type=y.Context,r}(P);function T(e){return e&&e.prototype&&e.prototype instanceof C}var _=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),E=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return _(r,t),r.prototype.execute=function(){var t,r,n,s,o=[],i=e.Status.Ready;if(this.constructor.getMeta){var a=this.resolver.resolve(this.env,this.constructor.getMeta);o.push(a.id),r=a.value,i=d(i,a.status),t=t||a.error}else r=this.constructor.meta;if(this.withContent&&this.constructor.getContent){var u=this.resolver.resolve(this.env,this.constructor.getContent,this.constructor.getMeta);o.push(u.id),n=u.value,i=d(i,u.status),t=t||u.error}else n=this.constructor.content;if(this.constructor.getTitle){var h=this.resolver.resolve(this.env,this.constructor.getTitle,this.constructor.getMeta);o.push(h.id),s=h.value,i=d(i,h.status),t=t||h.error}else s=this.constructor.title;return{resolutionIds:o,segment:w(e.SegmentType.Page,this.env,{title:s,meta:r||{},status:i,error:t,content:n,remainingSegments:[]})}},r.isNode=!0,r.type=y.Page,r}(P);function j(e){return e&&e.prototype&&e.prototype instanceof E}var U=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),M={},k=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return U(r,t),r.prototype.execute=function(){var t,r=this.resolver.resolve(this.env,this.constructor.to),n=r.value,o=r.status,i=r.error,u=this.resolver.resolve(this.env,this.constructor.meta),h=u.value;return o=d(o,u.status),i=i||u.error,"string"==typeof n?t="./"===n.slice(0,2)?a(this.env.pathname.split("/").slice(0,-1).join("/"),n.slice(2)):n:n&&(t=s(n).href),{resolutionIds:[r.id,u.id],segment:w(e.SegmentType.Redirect,this.env,{to:t,meta:h||M,status:o,error:i,remainingSegments:[]})}},r.isNode=!0,r.type=y.Redirect,r}(P);function I(e){return e&&e.prototype&&e.prototype instanceof k}var N=function(){return(N=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},D="\0";function F(e,t){var r=e;if(r.length>1&&"/"===r.substr(-1)&&(r=r.substr(0,r.length-1)),"/"!==r[0]&&(r="/"+r),/\/{2,}/.test(r)&&(r=r.replace(/\/{2,}/g,"/")),/^([A-Za-z0-9\$\-_\.+!*'\(\),\/]|\/:)+$/.test(r),0===r.length)throw new Error('You cannot use an empty string "" as a pattern!');for(var n=r.split("/").slice(1),s=[],o=[],i=["^"],a=0;a<n.length;a++){var u=n[a];u.length>1&&":"===u[0]?(s.push(u.slice(1)),o.push(D),i.push("([^/]+)")):(o.push(u),i.push(u.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")))}return{key:o.join("/"),maybeResolvableNode:t,pattern:r,pathParamNames:s.length?s:void 0,regExp:new RegExp(i.join("/"))}}function V(e,t,r){var n=t.regExp.exec(e.unmatchedPathnamePart);if(n){var s=n[0],o=e.params;if(t.pathParamNames){o=N({},e.params);for(var i=0;i<t.pathParamNames.length;i++){o[t.pathParamNames[i]]=n[i+1]}}var u=a(e.mountname,s);return{context:e.context,headers:{},method:e.method,params:o,pathname:u,mountname:u,query:e.query,search:e.search,router:e.router,unmatchedPathnamePart:e.unmatchedPathnamePart.slice(s.length)||(r?"/":""),url:e.url}}}var B=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),q=function(t){function r(e){for(var r=t.call(this,e,!0)||this,n=r.constructor.orderedMappings,s=n.length-1;s>=0;s--){var o=n[s],i=V(r.env,o,r.appendFinalSlash);if(i){r.child={mapping:o,matcherOptions:{env:i,resolver:r.resolver,withContent:r.withContent,appendFinalSlash:r.appendFinalSlash},maybeResolvableNode:o.maybeResolvableNode};break}}return r}return B(r,t),r.prototype.execute=function(){var t,r,n,s,o,i,a,u,h=[],c=e.Status.Ready;if(this.constructor.getMeta){var l=this.resolver.resolve(this.env,this.constructor.getMeta);h.push(l.id),r=l.value,c=d(c,l.status),t=t||l.error}else r=this.constructor.meta;if(this.withContent&&this.constructor.getContent){var p=this.resolver.resolve(this.env,this.constructor.getContent,this.constructor.getMeta);h.push(p.id),n=p.value,c=d(c,p.status),t=t||p.error}else n=this.constructor.content;if(this.constructor.getTitle){var f=this.resolver.resolve(this.env,this.constructor.getTitle,this.constructor.getMeta);h.push(f.id),s=f.value,c=d(c,f.status),t=t||f.error}else s=this.constructor.title;if(this.child){var v=void 0;this.child.maybeResolvableNode.isNode?v=this.child.maybeResolvableNode:(i=this.resolver.resolve(this.child.matcherOptions.env,this.child.maybeResolvableNode),h.push(i.id),v=i.value),this.last&&this.last.node===v?o=this.last.matcher:v&&(o=new v(this.child.matcherOptions)),this.last={node:v,matcher:o}}o&&(a=o.getResult()),a?u=a&&a.segment:i?u=R(this.child.matcherOptions.env,i.error,this.appendFinalSlash):this.env.unmatchedPathnamePart&&(u=S(this.env));var y=[];return u&&(y=u.type===e.SegmentType.Switch?[u].concat(u.remainingSegments):[u]),{resolutionIds:h.concat(a?a.resolutionIds:[]),segment:w(e.SegmentType.Switch,this.env,{status:c,error:t,content:n,meta:r||{},title:s,switch:this.constructor,nextPattern:this.child&&this.child.mapping.pattern,nextSegment:u,lastRemainingSegment:y[y.length-1],remainingSegments:y},this.appendFinalSlash)}},r.isNode=!0,r.type=y.Switch,r}(P);function L(e){return e&&e.prototype&&e.prototype instanceof q}var A=function(){return function(){this.promise=new Promise(function(e,t){this.resolve=e,this.reject=t}.bind(this)),Object.freeze(this)}}(),H=function(){function e(e,t){this.close=e,this.observer=t,this.observer.start&&this.observer.start(this)}return e.prototype.unsubscribe=function(){this.closed||(this.closed=!0,this.close(this.observer),delete this.close,delete this.observer)},e}();function Q(e,t,r){return"function"==typeof e?{next:e,error:t,complete:r}:e}function G(e){return new Promise(function(t,r){e.subscribe({start:function(e){this.subscription=e},next:function(e){this.value=e},complete:function(){t(this.value),this.subscription.unsubscribe()},error:function(e){r(e),this.subscription.unsubscribe()}})})}var $=function(){return($=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},z=function(e,t,r,n){return new(r||(r=Promise))(function(s,o){function i(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){e.done?s(e.value):new r(function(t){t(e.value)}).then(i,a)}u((n=n.apply(e,t||[])).next())})},W=function(e,t){var r,n,s,o,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(s=2&o[0]?n.return:o[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,o[1])).done)return s;switch(n=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(s=(s=i.trys).length>0&&s[s.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){i.label=o[1];break}if(6===o[0]&&i.label<s[1]){i.label=s[1],s=o;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(o);break}s[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{r=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};function Y(e){return new J(e.history,e.router)}var Z,J=function(){function t(t,r){var n=this;this.handleUnsubscribe=function(e){var t=n.observers.indexOf(e);-1!==t&&n.observers.splice(t,1)},this.update=function(t){var r=n.lastURL,s=t||n.lastRoute,o=t&&t.lastSegment;if(o&&o.type===e.SegmentType.Redirect&&o.to)n.history.replace(o.to);else{n.lastRoute=$({},s,{url:r}),n.waitUntilSteadyDeferred&&n.lastRoute.isSteady&&(n.waitUntilSteadyDeferred.resolve(n.lastRoute),delete n.waitUntilSteadyDeferred);for(var i=0;i<n.observers.length;i++)n.observers[i].next(n.lastRoute)}},this.observers=[],this.router=r,this.history=t,this.lastURL=s(this.history.location),this.unlisten=this.history.listen(function(e){return n.handleURLChange(s(e))}),this.refresh()}return t.prototype.dispose=function(){this.observers.length=0,this.unlisten(),delete this.unlisten,delete this.history,this.observableSubscription&&this.observableSubscription.unsubscribe(),delete this.observableSubscription,delete this.router,delete this.waitUntilSteadyDeferred,delete this.lastRoute},t.prototype.refresh=function(){this.handleURLChange(s(this.history.location),!0)},t.prototype.setRouter=function(e){this.router=e,this.refresh()},t.prototype.getValue=function(){return this.lastRoute},t.prototype.getSteadyRoute=function(){return z(this,void 0,void 0,function(){return W(this,function(e){return this.error?[2,Promise.reject(this.error)]:this.lastRoute&&this.lastRoute.isSteady?[2,Promise.resolve(this.lastRoute)]:(this.waitUntilSteadyDeferred||(this.waitUntilSteadyDeferred=new A),[2,this.waitUntilSteadyDeferred.promise])})})},t.prototype.subscribe=function(e,t,r){var n=Q(e,t,r);return this.observers.push(n),new H(this.handleUnsubscribe,n)},t.prototype.handleURLChange=function(e,t){if(!t&&this.lastReceivedURL&&r(this.lastReceivedURL,e))for(var n=0;n<this.observers.length;n++)this.observers[n].next(this.lastRoute);else{if(this.lastReceivedURL=e,"/"!==e.pathname.substr(-1))return e=$({},e,{pathname:e.pathname+"/"}),void this.history.replace(e);var s,o,i=this.lastURL;if(this.lastURL=e,e&&i&&(s=e.pathname!==i.pathname,o=e.search!==i.search),t||s||o||this.lastRoute.error){this.observableSubscription&&this.observableSubscription.unsubscribe();var a=this.router.createObservable(e,{withContent:!0});if(a)this.observableSubscription=a.subscribe(this.update);else if(!i)throw new f(e)}else this.update()}},t}();function K(e){return Object.values(e).every(function(e){return e.isSteady})}function X(t,r){for(var n,s=[r].concat(r.remainingSegments),o=s[s.length-1],i=o.status,a=0;a<s.length;a++){var u=s[a];u.status===e.Status.Error&&(n=u.error,i=e.Status.Error)}var h={type:o.type,url:t,segments:s,firstSegment:s[0],lastSegment:o,isSteady:g(s[0]),error:n,status:i};return o.type===e.SegmentType.Redirect&&(h.to=o.to,h.meta=o.meta),o.type===e.SegmentType.Page&&(h.title=o.title,h.meta=o.meta,h.content=o.content),h}(Z=e.RouteType||(e.RouteType={})).Switch="switch",Z.Page="page",Z.Redirect="redirect",Z.Plaecholder="placeholder";var ee,te=function(){function e(e,t,r,n,s){var o=this;this.handleUnsubscribe=function(e){var t=o.observers.indexOf(e);-1!==t&&o.observers.splice(t,1)},this.handleChange=function(){o.refresh();for(var e=0;e<o.observers.length;e++){var t=o.observers[e];t.next(o.cachedValue),o.cachedValue.isSteady&&t.complete&&t.complete()}o.cachedValue.isSteady&&(o.resolver.unlisten(o.handleChange),delete o.matcher,delete o.resolver)},this.refresh=function(){var e=o.matcher.getResult(),t=e.segment,r=e.resolutionIds;o.cachedValue=X(o.url,t),o.resolver.listen(o.handleChange,r)},this.url=e,this.resolver=n,this.observers=[],this.matcher=new r({appendFinalSlash:!0,env:t,resolver:this.resolver,withContent:s})}return e.prototype.subscribe=function(e,t,r){if(!this.resolver)throw new Error("Can't subscribe to an already-complete RoutingObservable.");var n=Q(e,t,r);this.observers.push(n);var s=new H(this.handleUnsubscribe,n);return 1===this.observers.length&&this.handleChange(),s},e}();!function(e){e.Post="post",e.Get="get",e.Put="put",e.Patch="patch",e.Delete="delete",e.Head="head",e.Options="options"}(ee||(ee={}));var re=function(e,t,r,n){return new(r||(r=Promise))(function(s,o){function i(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){e.done?s(e.value):new r(function(t){t(e.value)}).then(i,a)}u((n=n.apply(e,t||[])).next())})},ne=function(e,t){var r,n,s,o,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(s=2&o[0]?n.return:o[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,o[1])).done)return s;switch(n=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(s=(s=i.trys).length>0&&s[s.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){i.label=o[1];break}if(6===o[0]&&i.label<s[1]){i.label=s[1],s=o;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(o);break}s[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{r=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},se=function(){function t(t,r,n,o,i,u,h){var c=this;this.handleUnsubscribe=function(e){var t=c.observers.indexOf(e);-1!==t&&c.observers.splice(t,1)},this.handleResolverUpdate=function(){c.isRefreshing?c.isRefreshScheduled||(c.isRefreshScheduled=!0):c.refresh()},this.refresh=function(){return re(c,void 0,void 0,function(){var t,r,n,o,i,u,h,c,l,p,f,d,v,y,b,m,g,w,R,S,P,x;return ne(this,function(O){switch(O.label){case 0:this.isRefreshScheduled=!1,this.isRefreshing=!0,t=[],r=0,O.label=1;case 1:if(!(r<this.mapItems.length))return[3,6];if(v=this.mapItems[r],w=v.pathname,n=v.matcher.getResult(),o=n.segment,i=n.resolutionIds,y=o.lastRemainingSegment||o,u=v.lastSegmentCache,v.segmentCache=o,v.lastSegmentCache=y,y.status===e.Status.Error||this.options.predicate&&!this.options.predicate(y))return this.removeFromQueue(v),[3,1];if(!this.options.followRedirects||y.type!==e.SegmentType.Redirect||y.status!==e.Status.Ready||!y.to||u&&u.type===e.SegmentType.Redirect&&u.status===e.Status.Ready&&u.to&&u.to===y.to||this.addToQueue(y.to,v.depth+1,w,v.order),y.type!==e.SegmentType.Switch||y.status!==e.Status.Ready||u&&u.type===e.SegmentType.Switch&&u.status!==e.Status.Busy)return[3,5];h=y.switch.patterns,c=0,O.label=2;case 2:return c<h.length?[4,this.expandPatterns(a(w,h[c]))]:[3,5];case 3:for(l=O.sent(),p=0;p<l.length;p++)this.addToQueue(l[p],v.depth+1,w,v.order.concat(c,p));O.label=4;case 4:return c++,[3,2];case 5:return i&&(t=t.concat(i)),r++,[3,1];case 6:for(f=[],d=0;d<this.mapItems.length;d++)v=this.mapItems[d],(y=v.lastSegmentCache).type!==e.SegmentType.Switch&&y.status!==e.Status.Error&&f.push([a(v.pathname,"/"),X(s(v.pathname,{ensureTrailingSlash:!1}),v.segmentCache),v.order]);if(this.resolver.listen(this.handleResolverUpdate,t),f.sort(function(e,t){var r=e[2],n=t[2];if(r.length<n.length)return-1;if(r.length>n.length)return 1;for(var s=0;s<r.length;s++){if(r[s]<n[s])return-1;if(r[s]>n[s])return 1}return 0}),this.isRefreshScheduled)this.refresh();else{for(b={},m=0;m<f.length;m++)g=f[m],w=g[0],R=g[1],b[w]=R;for(S=K(b),P=0;P<this.observers.length;P++)(x=this.observers[P]).next(b),S&&x.complete&&x.complete();S&&(this.resolver.unlisten(this.handleResolverUpdate),delete this.rootContext,delete this.mapItems,delete this.router,delete this.observers,delete this.resolver),this.isRefreshing=!1}return[2]}})})},this.observers=[],this.mapItems=[],this.resolver=i,this.router=u,this.rootContext=r,this.pages=n,this.rootMapping=o,this.options=h,this.seenPathnames=new Set;var l=t.pathname;"/"===l.substr(-1)&&(l=l.substr(0,l.length-1)),this.addToQueue(l,0)}return t.prototype.subscribe=function(e,t,r){if(!this.resolver)throw new Error("Can't subscribe to an already-complete RoutingObservable.");var n=Q(e,t,r);this.observers.push(n);var s=new H(this.handleUnsubscribe,n);return 1===this.observers.length&&this.refresh(),s},t.prototype.expandPatterns=function(e){return re(this,void 0,void 0,function(){var t;return ne(this,function(r){switch(r.label){case 0:return this.options.expandPattern?[4,this.options.expandPattern(e,this.router)]:[3,2];case 1:if(t=r.sent())return[2,t];r.label=2;case 2:return[2,[e].filter(function(e){return!/\/:/.test(e)})]}})})},t.prototype.removeFromQueue=function(e){var t=this.mapItems.indexOf(e);-1!==t&&this.mapItems.splice(t,1)},t.prototype.addToQueue=function(e,t,r,n){if(void 0===n&&(n=[0]),!this.seenPathnames.has(e)&&(!this.options.maxDepth||t<=this.options.maxDepth)){this.seenPathnames.add(e);var o=s(e,{ensureTrailingSlash:!1,removeHash:!0}),i=V({context:this.rootContext,headers:{},method:ee.Get,params:{},pathname:"",mountname:"",query:o.query,search:o.search,router:this.router,unmatchedPathnamePart:o.pathname,url:o},this.rootMapping,!1);i&&this.mapItems.push({url:o,fromPathname:r,depth:t,pathname:e,order:n,matcher:new this.pages({appendFinalSlash:!1,env:i,resolver:this.resolver,withContent:this.options.withContent})})}},t}();var oe=function(){function t(e,t){this.resolver=e,this.context=t.context||{},this.pages=t.pages;var r,n,s=t.basename;s&&"/"===s.slice(-1)&&(s=s.slice(0,-1)),this.rootMapping=(r=t.pages,void 0===(n=s)&&(n=""),""!==n?F(n,r):{pattern:n,key:"",regExp:new RegExp(""),maybeResolvableNode:r})}return t.prototype.createObservable=function(e,t){void 0===t&&(t={});var r=s(e,{removeHash:!0}),n=V({context:this.context,headers:{},method:t.method||ee.Get,mountname:"",params:r.query,pathname:"",query:r.query,search:r.search,router:this,url:r,unmatchedPathnamePart:r.pathname},this.rootMapping,!0);if(n)return new te(r,n,this.pages,this.resolver,!!t.withContent)},t.prototype.createMapObservable=function(e,t){return void 0===t&&(t={}),new se(s(e,{ensureTrailingSlash:!1}),this.context,this.pages,this.rootMapping,this.resolver,this,t)},t.prototype.resolve=function(e,t){var r=this;void 0===t&&(t={});var n=function(e){return Array.isArray(e)?e.map(function(e){return s(e)}):[s(e)]}(e);if(!n.length)return Promise.resolve([]);var o=n.map(function(e){return r.getPageRoutePromise(e,t)});return Array.isArray(e)?Promise.all(o):o[0]},t.prototype.resolveSiteMap=function(t,r){return void 0===r&&(r={}),G(this.createMapObservable(t,r)).then(function(t){for(var r={},n={},s=Object.keys(t),o=0;o<s.length;o++){var i=s[o],a=t[i];if(a.status===e.Status.Ready){if(a.type===e.RouteType.Page){r[i]=a;continue}if(a.type===e.RouteType.Redirect){n[i]=a;continue}}throw a.error||new Error("router error")}return{pages:r,redirects:n}})},t.prototype.resolvePageMap=function(e,t){return void 0===t&&(t={}),this.resolveSiteMap(e,t).then(function(e){return e.pages})},t.prototype.getPageRoutePromise=function(t,r){var n=this,o=this.createObservable(t,r);return o?G(o).then(function(t){if(t.status===e.Status.Ready){if(t.type===e.RouteType.Redirect&&r.followRedirects)return n.getPageRoutePromise(s(t.to),r);if(t.type===e.RouteType.Page)return t}throw t.error||new Error("router error")}):Promise.reject(new f(t))},t}();var ie=function(e,t,r,n){return new(r||(r=Promise))(function(s,o){function i(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){e.done?s(e.value):new r(function(t){t(e.value)}).then(i,a)}u((n=n.apply(e,t||[])).next())})},ae=function(e,t){var r,n,s,o,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(s=2&o[0]?n.return:o[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,o[1])).done)return s;switch(n=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(s=(s=i.trys).length>0&&s[s.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){i.label=o[1];break}if(6===o[0]&&i.label<s[1]){i.label=s[1],s=o;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(o);break}s[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{r=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};var ue=function(){function n(n){var s=this;this.handleChange=function(e){s.receivedRoute=e},this.handleRendered=function(){if(s.renderedRoute!==s.receivedRoute){var t=s.renderedRoute,n=s.receivedRoute;if(n&&n.type===e.RouteType.Page&&n.status===e.Status.Ready&&s.setDocumentTitle&&(document.title=s.setDocumentTitle(n.title)),n&&n.isSteady){if(t&&r(n.url,t.url))return;s.disableScrollHandling||t&&t.url&&t.url.hash===n.url.hash&&t.url.pathname===n.url.pathname||he(n.url.hash,t&&t.url&&t.url.pathname===n.url.pathname?s.hashScrollBehavior:"instant")}s.renderedRoute=s.receivedRoute}else s.receivedRoute&&s.receivedRoute.url.hash&&he(s.receivedRoute.url.hash,s.hashScrollBehavior)},this.history=n.history||t.createBrowserHistory(),this.resolver=new b,this.pages=n.pages,this.basename=n.basename,this.router=new oe(this.resolver,{context:n.context,pages:n.pages,basename:n.basename}),!1!==n.setDocumentTitle&&(this.setDocumentTitle="function"==typeof n.setDocumentTitle?n.setDocumentTitle:function(e){return e||"Untitled Page"}),this.disableScrollHandling=!!n.disableScrollHandling,this.currentRouteObservable=Y({history:this.history,router:this.router}),this.currentRouteObservable.subscribe(this.handleChange),this.renderedRoute=this.currentRouteObservable.getValue(),this.hashScrollBehavior=n.hashScrollBehavior||"smooth"}return n.prototype.dispose=function(){this.currentRouteObservable.dispose(),delete this.currentRouteObservable,delete this.router,delete this.history,delete this.resolver,delete this.pages,delete this.setDocumentTitle,delete this.receivedRoute,delete this.renderedRoute},n.prototype.setContext=function(e){this.router=new oe(this.resolver,{context:e,pages:this.pages,basename:this.basename}),this.currentRouteObservable.setRouter(this.router)},n.prototype.getCurrentValue=function(){var e=this.currentRouteObservable.getValue();return{route:e,url:e.url,history:this.history,router:this.router,onRendered:this.handleRendered}},n.prototype.steady=function(){return ie(this,void 0,void 0,function(){return ae(this,function(e){switch(e.label){case 0:return[4,this.getSteadyValue()];case 1:return e.sent(),[2]}})})},n.prototype.getSteadyValue=function(){return ie(this,void 0,void 0,function(){var e=this;return ae(this,function(t){return[2,this.currentRouteObservable.getSteadyRoute().then(function(t){return{route:t,url:t.url,history:e.history,router:e.router,onRendered:e.handleRendered}})]})})},n.prototype.subscribe=function(e,t,r){var n=Q(e,t,r),s=new ce(n,this,this.handleRendered);return this.currentRouteObservable.subscribe(s)},n}();function he(e,t){if(e){var r=document.getElementById(e.slice(1));r&&(r.scrollIntoView({behavior:t,block:"start"}),r.focus())}else window.scroll({top:0,left:0,behavior:"auto"})}var ce=function(){function e(e,t,r){this.navigation=t,this.observer=e,this.onRendered=r}return e.prototype.next=function(e){this.observer.next({route:e,url:e.url,history:this.navigation.history,router:this.navigation.router,onRendered:this.onRendered})},e.prototype.error=function(e){this.observer.error&&this.observer.error(e)},e}(),le=function(e,t,r,n){return new(r||(r=Promise))(function(s,o){function i(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){e.done?s(e.value):new r(function(t){t(e.value)}).then(i,a)}u((n=n.apply(e,t||[])).next())})},pe=function(e,t){var r,n,s,o,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(s=2&o[0]?n.return:o[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,o[1])).done)return s;switch(n=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(s=(s=i.trys).length>0&&s[s.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){i.label=o[1];break}if(6===o[0]&&i.label<s[1]){i.label=s[1],s=o;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(o);break}s[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{r=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};var fe=function(){function e(e){this.history=t.createMemoryHistory({initialEntries:[s(e.url).href]}),this.resolver=new b,this.pages=e.pages,this.basename=e.basename,this.router=new oe(this.resolver,{context:e.context,pages:this.pages,basename:this.basename}),this.currentRouteObservable=Y({history:this.history,router:this.router})}return e.prototype.dispose=function(){this.currentRouteObservable.dispose(),delete this.currentRouteObservable,delete this.router,delete this.resolver,delete this.pages},e.prototype.setContext=function(e){this.router=new oe(this.resolver,{context:e,pages:this.pages,basename:this.basename}),this.currentRouteObservable.setRouter(this.router)},e.prototype.getCurrentValue=function(){var e=this.currentRouteObservable.getValue();return{route:e,url:e.url,history:this.history,router:this.router,onRendered:de}},e.prototype.getSteadyValue=function(){return le(this,void 0,void 0,function(){var e=this;return pe(this,function(t){return[2,this.currentRouteObservable.getSteadyRoute().then(function(t){return{route:t,url:t.url,history:e.history,router:e.router,onRendered:de}})]})})},e.prototype.steady=function(){return le(this,void 0,void 0,function(){return pe(this,function(e){switch(e.label){case 0:return[4,this.getSteadyValue()];case 1:return e.sent(),[2]}})})},e.prototype.subscribe=function(e,t,r){var n=Q(e,t,r),s=new ve(n,this);return this.currentRouteObservable.subscribe(s)},e}(),de=function(){},ve=function(){function e(e,t){this.observer=e,this.navigation=t}return e.prototype.next=function(e){this.observer.next({route:e,url:e.url,history:this.navigation.history,router:this.navigation.router,onRendered:de})},e.prototype.error=function(e){this.observer.error&&this.observer.error(e)},e}();e.createContext=function(e,t){var r,n=t.isNode?function(){return t}:t,s="function"!=typeof e?function(){return e}:e;return(r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return x(t,e),t}(C)).childNodeResolvable=n,r.childContextResolvable=s,r},e.isValidContext=T,e.isValidDeclaration=function(e){return T(e)||j(e)||I(e)||L(e)},e.createSwitch=function(e){var t;if(!e)throw new Error("createSwitch() must be supplied with an options object.");e.paths||(e.paths={});var r=Object.keys(e.paths),n=r.filter(function(t){return"function"!=typeof e.paths[t]});if(n.length>0){var s=1===n.length;throw new TypeError("The given "+(s?"path":"paths")+": "+n.join(", ")+" "+(s?"is":"are")+" invalid. Path should be an instance of Switch, Page, Redirect, Context or a function. See https://frontarm.com/navi/reference/declarations/#declaring-pages")}var o=r.map(function(t){return F(t,e.paths[t])}).sort(function(e,t){return r=e.key,n=t.key,r<n?-1:r>n?1:0;var r,n});return(t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return B(t,e),t}(q)).paths=e.paths,t.meta=e.meta,t.getMeta=e.getMeta,t.title=e.title,t.getTitle=e.getTitle,t.content=e.content,t.getContent=e.getContent,t.orderedMappings=o,t.patterns=r,t},e.isValidSwitch=L,e.CurrentRouteObservable=J,e.createCurrentRouteObservable=Y,e.createPage=function(e){var t;return(t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return _(t,e),t}(E)).title=e.title,t.getTitle=e.getTitle,t.meta=e.meta,t.getMeta=e.getMeta,t.content=e.content,t.getContent=e.getContent,t},e.isValidPage=j,e.createRedirect=function(e,t){var r;return(r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return U(t,e),t}(k)).to="function"==typeof e?e:function(){return e},r.meta="function"==typeof t?t:function(){return t},r},e.isValidRedirect=I,e.Router=oe,e.createRouter=function(e){return new oe(new b,e)},e.createBrowserNavigation=function(e){return new ue(e)},e.BrowserNavigation=ue,e.createMemoryNavigation=function(e){return new fe(e)},e.MemoryNavigation=fe,e.areURLDescriptorsEqual=r,e.createURLDescriptor=s,e.parseQuery=o,e.stringifyQuery=i,e.joinPaths=a,e.isSegmentSteady=g,e.createSegment=w,e.createPlaceholderSegment=R,e.createNotFoundSegment=S,e.NaviError=l,e.NotFoundError=p,e.OutOfRootError=f,e.isRouteMapSteady=K,Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "navi",
"version": "0.10.13",
"version": "0.11.0-alpha.1",
"description": "A router-loader for React.",

@@ -58,3 +58,3 @@ "author": "James K Nelson <james@jamesknelson.com>",

},
"gitHead": "1d8a274940c08bd4ad892886357e3d5540169745"
"gitHead": "d5a51171b74368c67d53aab71735cddddb6f68ce"
}

@@ -1,2 +0,1 @@

export { app, getApp } from './app'
export { createContext, isValidContext, Context } from './Context'

@@ -3,0 +2,0 @@ export { Env } from './Env'

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc