atomic-router
Advanced tools
| export declare const equals: (a: Record<string, any>, b: Record<string, any>) => boolean; |
| export const equals = (a: Record<string, any>, b: Record<string, any>) => { | ||
| if (Object.keys(a).length !== Object.keys(b).length) { | ||
| return false; | ||
| } | ||
| for (const k in a) { | ||
| if (a[k] !== b[k]) { | ||
| return false; | ||
| } | ||
| } | ||
| return true; | ||
| }; |
@@ -1026,2 +1026,16 @@ 'use strict'; | ||
| var equals = function equals(a, b) { | ||
| if (Object.keys(a).length !== Object.keys(b).length) { | ||
| return false; | ||
| } | ||
| for (var k in a) { | ||
| if (a[k] !== b[k]) { | ||
| return false; | ||
| } | ||
| } | ||
| return true; | ||
| }; | ||
| var historyPushFx = /*#__PURE__*/effector.createEffect(function (pushParams) { | ||
@@ -1036,3 +1050,3 @@ if (!pushParams.history) { | ||
| name: "historyPushFx", | ||
| sid: "sn2691" | ||
| sid: "t43sn8" | ||
| }); | ||
@@ -1069,15 +1083,15 @@ | ||
| name: "setHistory", | ||
| sid: "-d2vpek" | ||
| sid: "-clu30d" | ||
| }); | ||
| var routeNotFound = effector.createEvent({ | ||
| name: "routeNotFound", | ||
| sid: "-y4sqp2" | ||
| sid: "-xnr4av" | ||
| }); | ||
| var $query = effector.createStore({}, { | ||
| name: "$query", | ||
| sid: "hnxt1l" | ||
| sid: "i4zffs" | ||
| }); | ||
| var $path = effector.createStore('', { | ||
| name: "$path", | ||
| sid: "-sa8poc" | ||
| sid: "-rt73a5" | ||
| }); | ||
@@ -1089,3 +1103,3 @@ var $activeRoutes = effector.createStore([], { | ||
| name: "$activeRoutes", | ||
| sid: "62zlkr" | ||
| sid: "ghza91" | ||
| }); // @ts-expect-error | ||
@@ -1098,3 +1112,3 @@ | ||
| name: "$history", | ||
| sid: "-7y2vlh" | ||
| sid: "-7h197a" | ||
| }); | ||
@@ -1120,3 +1134,3 @@ $history.on(setHistory, function (_, nextHistory) { | ||
| name: "pushFx", | ||
| sid: "e2mlkx" | ||
| sid: "ejo7z4" | ||
| } | ||
@@ -1142,3 +1156,3 @@ }); // Triggered whenever some route.navigate.doneData is triggered | ||
| name: "openedFx", | ||
| sid: "171qv8" | ||
| sid: "1o3d9f" | ||
| }); // Recalculate opened/closed routes | ||
@@ -1175,3 +1189,3 @@ | ||
| name: "recalculateFx", | ||
| sid: "-8daxxq" | ||
| sid: "-7w9bjj" | ||
| }); | ||
@@ -1198,3 +1212,3 @@ $path.on(recalculateFx.done, function (_prev, _ref4) { | ||
| or: { | ||
| sid: "7csm23" | ||
| sid: "7dceng" | ||
| } | ||
@@ -1217,3 +1231,3 @@ }); // sample({ | ||
| or: { | ||
| sid: "7tafux" | ||
| sid: "7tu8ga" | ||
| } | ||
@@ -1234,3 +1248,3 @@ }); | ||
| name: "$isOpenedManually", | ||
| sid: "by1u5o" | ||
| sid: "cf3gjv" | ||
| }); // Watch for route.navigate.doneData to build new path and push | ||
@@ -1255,3 +1269,3 @@ | ||
| or: { | ||
| sid: "-jxfhr2" | ||
| sid: "-jwvp5p" | ||
| } | ||
@@ -1276,3 +1290,3 @@ }); | ||
| name: "opened", | ||
| sid: "-6e1ik" | ||
| sid: "ankvn" | ||
| } | ||
@@ -1287,3 +1301,3 @@ }), | ||
| name: "updated", | ||
| sid: "-y6s1fj" | ||
| sid: "-xpqf1c" | ||
| } | ||
@@ -1298,3 +1312,3 @@ }), | ||
| name: "closed", | ||
| sid: "2bzoi7" | ||
| sid: "2t1awe" | ||
| } | ||
@@ -1308,3 +1322,3 @@ }) | ||
| effector.guard({ | ||
| var updated = effector.guard({ | ||
| and: [{ | ||
@@ -1314,7 +1328,38 @@ clock: recheckLifecycle.updated, | ||
| return !isOpenedManually; | ||
| }) | ||
| }], | ||
| or: { | ||
| name: "updated", | ||
| sid: "-i38vyc" | ||
| } | ||
| }); | ||
| effector.sample({ | ||
| and: [{ | ||
| source: effector.restore(updated, null, { | ||
| name: "source", | ||
| sid: "-1th5mi" | ||
| }), | ||
| clock: effector.guard({ | ||
| and: [{ | ||
| clock: updated, | ||
| source: [routeObj.route.$params, routeObj.route.$query], | ||
| // Skip .updated() calls if params & query are the same | ||
| filter: function filter(_ref14, next) { | ||
| var params = _ref14[0], | ||
| query = _ref14[1]; | ||
| return !equals(params, next.params) || !equals(query, next.query); | ||
| } | ||
| }], | ||
| or: { | ||
| name: "clock", | ||
| sid: "cdcuni" | ||
| } | ||
| }), | ||
| fn: function fn(payload) { | ||
| return payload; | ||
| }, | ||
| target: routeObj.route.updated | ||
| }], | ||
| or: { | ||
| sid: "-iiuf5u" | ||
| sid: "-i4jrqg" | ||
| } | ||
@@ -1332,3 +1377,3 @@ }); // Trigger .opened() for the routes marked as "opened" | ||
| or: { | ||
| sid: "-i3zz53" | ||
| sid: "-hlayyt" | ||
| } | ||
@@ -1343,3 +1388,3 @@ }); // Trigger .closed() for the routes marked as "closed" | ||
| or: { | ||
| sid: "-i0p7kx" | ||
| sid: "-h6giy2" | ||
| } | ||
@@ -1353,3 +1398,3 @@ }); // Reset $isOpenedManually | ||
| or: { | ||
| sid: "lycydm" | ||
| sid: "-wz7y6w" | ||
| } | ||
@@ -1403,3 +1448,3 @@ })); | ||
| name: "recheckFx", | ||
| sid: "-aaaqj8" | ||
| sid: "fr6h5h" | ||
| } | ||
@@ -1413,3 +1458,3 @@ }); | ||
| or: { | ||
| sid: "-gnriv8" | ||
| sid: "-g52ioy" | ||
| } | ||
@@ -1460,3 +1505,3 @@ }); // Triggered whenever history instance is set | ||
| name: "subscribeHistoryFx", | ||
| sid: "-ec82v1" | ||
| sid: "bp94to" | ||
| } | ||
@@ -1473,3 +1518,3 @@ }); // If `hydrate` flag is set, | ||
| or: { | ||
| sid: "-fmxb0l" | ||
| sid: "-4uqk3n" | ||
| } | ||
@@ -1485,3 +1530,3 @@ }); | ||
| or: { | ||
| sid: "-5aolek" | ||
| sid: "-4rzl8a" | ||
| } | ||
@@ -1488,0 +1533,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
| "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("effector"),t=require("path-to-regexp");function r(e,t,r,n,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function n(e){return function(){var t=this,n=arguments;return new Promise((function(o,a){var i=e.apply(t,n);function c(e){r(i,o,a,c,u,"next",e)}function u(e){r(i,o,a,c,u,"throw",e)}c(void 0)}))}}function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function i(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return a(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c,u=(function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),a=new k(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var c=w(i,r);if(c){if(c===d)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,a),o}function s(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var d={};function f(){}function p(){}function l(){}var h={};c(h,o,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(E([])));y&&y!==t&&r.call(y,o)&&(h=y);var v=l.prototype=f.prototype=Object.create(h);function g(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var n;this._invoke=function(o,a){function i(){return new t((function(n,i){!function n(o,a,i,c){var u=s(e[o],e,a);if("throw"!==u.type){var d=u.arg,f=d.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(f).then((function(e){d.value=e,i(d)}),(function(e){return n("throw",e,i,c)}))}c(u.arg)}(o,a,n,i)}))}return n=n?n.then(i,i):i()}}function w(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var n=s(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,d;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function E(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:q}}function q(){return{value:void 0,done:!0}}return p.prototype=l,c(v,"constructor",l),c(l,"constructor",p),p.displayName=c(l,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,c(e,i,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},g(b.prototype),c(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new b(u(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},g(v),c(v,i,"Generator"),c(v,o,(function(){return this})),c(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=E,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),O(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:E(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(c={exports:{}}),c.exports),s={ROUTE:Symbol()},d=function(){var t=e.createEffect(function(){var e=n(u.mark((function e(t){return u.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{params:t.params||{},query:t.query||{}});case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),{name:"navigateFx",sid:"-apj8ex"}),r=e.attach({and:{effect:t,mapParams:function(e){return{params:e||{},query:{}}}},or:{name:"openFx",sid:"-ju5g7s"}}),o=e.createStore(!1,{name:"$isOpened",sid:"7ntohw"}),a=e.createStore({},{name:"$params",sid:"1blfp4"}),i=e.createStore({},{name:"$query",sid:"rvelj"}),c=e.createEvent({name:"opened",sid:"-f8s17u"}),d=e.createEvent({name:"updated",sid:"slzlyp"}),f=e.createEvent({name:"left",sid:"yy6ys3"}),p=e.createEvent({name:"closed",sid:"-say4ff"});return o.on(c,(function(){return!0})).on(f,(function(){return!1})),a.on(c,(function(e,t){return t.params})).on(d,(function(e,t){return t.params})),i.on(c,(function(e,t){return t.query})).on(d,(function(e,t){return t.query})),e.split({and:[{source:t.doneData,match:o.map((function(e){return e?"updated":"opened"})),cases:{opened:c,updated:d}}],or:{sid:"-x6h86m"}}),e.sample({and:[{clock:p,target:f}],or:{sid:"-wqj6z5"}}),{$isOpened:o,$params:a,$query:i,opened:c,updated:d,closed:p,left:f,navigate:t,open:r,kind:s.ROUTE}};function f(e){var r=e.params,n=e.query;return t.compile(e.pathCreator)(r)+(Object.keys(n).length?"?"+new URLSearchParams(n):"")}function p(e){var r=e.actualPath,n=t.match(e.pathCreator)(new URL("http://_"+r).pathname);return n?{matches:!0,params:n.params}:{matches:!1}}var l=e.createEffect((function(e){if(!e.history)throw new Error("[Routing] No history provided");return e.history[e.method](e.path,{}),e}),{name:"historyPushFx",sid:"sn2691"}),h=function(e){return"object"==typeof e&&null!==e&&"kind"in e&&e.kind===s.ROUTE},m=function(t){return e.is.store(t,{sid:"-v906zu"})?t:e.createStore(t,{sid:"-v904rr"})};exports.Kind=s,exports.buildPath=f,exports.chainRoute=function(t){var r=function(t){if(h(t))return{route:t,chainedRoute:e.withFactory({sid:"jogy9l",fn:function(){return d()},name:"chainedRoute",method:"createRoute"}),beforeOpen:e.createEvent({name:"beforeOpen",sid:"8mpttm"}),openOn:[t.opened,t.closed],cancelOn:[e.createEvent({name:"cancelOn",sid:"ahjdm4"})]};var r=t;if(!("enterOn"in r)&&e.is.effect(r.beforeOpen,{sid:"fx5yhy"}))return{route:r.route,chainedRoute:r.chainedRoute||e.withFactory({sid:"fyulbq",fn:function(){return d()},name:"chainedRoute",method:"createRoute"}),beforeOpen:r.beforeOpen,openOn:r.beforeOpen.doneData,cancelOn:r.beforeOpen.failData};var n=t;return{route:n.route,chainedRoute:n.chainedRoute||e.withFactory({sid:"u6793u",fn:function(){return d()},name:"chainedRoute",method:"createRoute"}),beforeOpen:n.beforeOpen,openOn:e.sample({and:[{clock:n.openOn}],or:{name:"openOn",sid:"-mm7rdb"}}),cancelOn:e.sample({and:[{clock:n.cancelOn||e.createEvent({name:"clock",sid:"y2etk0"})}],or:{name:"cancelOn",sid:"-vntqxj"}})}}(t),n=r.route,o=r.chainedRoute,a=r.beforeOpen,i=r.openOn,c=r.cancelOn,u=e.createStore({},{name:"$params",sid:"ru233x"}),s=e.createStore({},{name:"$query",sid:"2tnaew"}),f=e.combine({and:[e.combine({and:[[n.$params,n.$query]],or:{name:"and",sid:"-t8sbqu"}}),e.combine({and:[[u,s]],or:{name:"and",sid:"-t8s8s2"}}),function(e,t){return e[0]===t[0]&&e[1]===t[1]}],or:{name:"$hasSameParams",sid:"-w0fyuc"}}),p=e.sample({and:[{clock:[n.opened,n.updated]}],or:{name:"routeOpened",sid:"nobe5z"}});e.sample({and:[{clock:p,target:a}],or:{sid:"n0i9a7"}}),u.on(p,(function(e,t){return t.params})),s.on(p,(function(e,t){return t.query}));var l=e.guard({and:[{clock:i,source:{params:u,query:s},filter:f}],or:{name:"chainedRouteResolved",sid:"-qurk3a"}});e.sample({and:[{clock:l,target:o.navigate}],or:{sid:"ningv4"}});var m=e.merge([n.closed,c],{name:"aborted",sid:"-qm6c6a"});return u.reset(m),s.reset(m),e.sample({and:[{clock:m,target:o.closed}],or:{sid:"nz5any"}}),o},exports.createHistoryRouter=function(t){var r=function(e){for(var t,r=[],n=function(){var e=t.value;Array.isArray(e.route)?r.push.apply(r,e.route.map((function(t){return o({},e,{route:t})}))):r.push(e)},a=i(e);!(t=a()).done;)n();return r}(t.routes),a=e.createEvent({name:"setHistory",sid:"-d2vpek"}),c=e.createEvent({name:"routeNotFound",sid:"-y4sqp2"}),s=e.createStore({},{name:"$query",sid:"hnxt1l"}),d=e.createStore("",{name:"$path",sid:"-sa8poc"}),h=e.createStore([],{and:{serialize:"ignore"},name:"$activeRoutes",sid:"62zlkr"}),m=e.createStore(null,{and:{serialize:"ignore"},name:"$history",sid:"-7y2vlh"});m.on(a,(function(e,t){return t}));var y=e.attach({and:{source:{history:m},effect:l,mapParams:function(e,t){return o({history:t.history},e)}},or:{name:"pushFx",sid:"e2mlkx"}}),v=e.createEffect((function(e){var t=e.params,r=e.query;return{path:f({pathCreator:e.route.path,params:t,query:r}),params:t,query:r,method:"push"}}),{name:"openedFx",sid:"171qv8"}),g=e.createEffect((function(e){for(var t,n=e.path,o=e.query,a=[],c=[],u=i(r);!(t=u()).done;){var s=t.value,d=p({pathCreator:s.path,actualPath:n});(d.matches?a:c).push({route:s,params:d.params,query:o})}return{opened:a,closed:c}}),{name:"recalculateFx",sid:"-8daxxq"});d.on(g.done,(function(e,t){return t.params.path})),s.on(g.done,(function(e,t){return t.params.query})),h.on(g.doneData,(function(e,t){return t.opened.map((function(e){return e.route.route}))})),e.sample({and:[{clock:v.doneData,target:y}],or:{sid:"7csm23"}}),e.guard({and:[{clock:g.doneData,filter:function(e){return 0===e.opened.length},target:c}],or:{sid:"7tafux"}});for(var b,w=g.doneData.map((function(e){return e.opened})),x=g.doneData.map((function(e){return e.closed})),O=function(){var t=b.value,r=e.createStore(!1,{name:"$isOpenedManually",sid:"by1u5o"}),n=t.route.navigate.done;e.sample({and:[{clock:n,fn:function(e){var r=e.result;return{route:t,params:r.params,query:r.query}},target:v}],or:{sid:"-jxfhr2"}});var o=function(e){return e.find((function(e){return e.route===t}))},a={opened:e.guard({and:[{clock:w.filterMap(o),filter:t.route.$isOpened.map((function(e){return!e}))}],or:{name:"opened",sid:"-6e1ik"}}),updated:e.guard({and:[{clock:w.filterMap(o),filter:t.route.$isOpened}],or:{name:"updated",sid:"-y6s1fj"}}),closed:e.guard({and:[{clock:x.filterMap(o),filter:t.route.$isOpened}],or:{name:"closed",sid:"2bzoi7"}})};r.on(n,(function(){return!0})),e.guard({and:[{clock:a.updated,filter:r.map((function(e){return!e})),target:t.route.updated}],or:{sid:"-iiuf5u"}}),e.guard({and:[{clock:a.opened,filter:r.map((function(e){return!e})),target:t.route.opened}],or:{sid:"-i3zz53"}}),e.sample({and:[{clock:a.closed,target:t.route.closed}],or:{sid:"-i0p7kx"}}),r.reset(e.sample({and:[{clock:w}],or:{sid:"lycydm"}}))},k=i(r);!(b=k()).done;)O();var E,q=e.attach({and:{source:{history:m},effect:(E=n(u.mark((function e(t){var r,n;return u.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=[(r=t.history).location.pathname,Object.fromEntries(new URLSearchParams(r.location.search))],e.abrupt("return",{path:n[0],query:n[1]});case 3:case"end":return e.stop()}}),e)}))),function(e){return E.apply(this,arguments)})},or:{name:"recheckFx",sid:"-aaaqj8"}});e.sample({and:[{source:q.doneData,target:g}],or:{sid:"-gnriv8"}});var j,L=e.attach({and:{source:{history:m},effect:(j=n(u.mark((function t(r){var n,o;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=r.history,o=q;try{o=e.scopeBind(q)}catch(e){}return n.listen((function(){o()})),t.abrupt("return",!0);case 5:case"end":return t.stop()}}),t)}))),function(e){return j.apply(this,arguments)})},or:{name:"subscribeHistoryFx",sid:"-ec82v1"}});return t.hydrate||e.sample({and:[{clock:L.doneData,target:q}],or:{sid:"-fmxb0l"}}),e.sample({and:[{clock:m,target:L}],or:{sid:"-5aolek"}}),{$path:d,$query:s,$activeRoutes:h,$history:m,setHistory:a,push:y,routes:r,routeNotFound:c}},exports.createRoute=d,exports.isRoute=h,exports.matchPath=p,exports.redirect=function(t){var r=t.clock?e.sample({and:[{clock:t.clock}],or:{name:"clock",sid:"-nsh945"}}):e.createEvent({name:"clock",sid:"-nbfmpy"}),n=m(t.params||{}),o=m(t.query||{});return e.sample({and:[{clock:r,source:{params:n,query:o},fn:function(e,t){var r=e.params,n=e.query;return{params:"function"==typeof r?r(t):r,query:"function"==typeof n?n(t):n}},target:t.route.navigate}],or:{sid:"-8kqnzy"}}),r}; | ||
| "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("effector"),t=require("path-to-regexp");function r(e,t,r,n,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function n(e){return function(){var t=this,n=arguments;return new Promise((function(o,a){var i=e.apply(t,n);function c(e){r(i,o,a,c,u,"next",e)}function u(e){r(i,o,a,c,u,"throw",e)}c(void 0)}))}}function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function i(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return a(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c,u=(function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),a=new k(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var c=b(i,r);if(c){if(c===d)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,a),o}function s(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var d={};function f(){}function p(){}function l(){}var h={};c(h,o,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(E([])));y&&y!==t&&r.call(y,o)&&(h=y);var v=l.prototype=f.prototype=Object.create(h);function g(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){var n;this._invoke=function(o,a){function i(){return new t((function(n,i){!function n(o,a,i,c){var u=s(e[o],e,a);if("throw"!==u.type){var d=u.arg,f=d.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(f).then((function(e){d.value=e,i(d)}),(function(e){return n("throw",e,i,c)}))}c(u.arg)}(o,a,n,i)}))}return n=n?n.then(i,i):i()}}function b(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var n=s(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,d;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function E(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:q}}function q(){return{value:void 0,done:!0}}return p.prototype=l,c(v,"constructor",l),c(l,"constructor",p),p.displayName=c(l,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,c(e,i,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},g(w.prototype),c(w.prototype,a,(function(){return this})),e.AsyncIterator=w,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new w(u(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},g(v),c(v,i,"Generator"),c(v,o,(function(){return this})),c(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=E,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),O(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:E(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(c={exports:{}}),c.exports),s={ROUTE:Symbol()},d=function(){var t=e.createEffect(function(){var e=n(u.mark((function e(t){return u.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{params:t.params||{},query:t.query||{}});case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),{name:"navigateFx",sid:"-apj8ex"}),r=e.attach({and:{effect:t,mapParams:function(e){return{params:e||{},query:{}}}},or:{name:"openFx",sid:"-ju5g7s"}}),o=e.createStore(!1,{name:"$isOpened",sid:"7ntohw"}),a=e.createStore({},{name:"$params",sid:"1blfp4"}),i=e.createStore({},{name:"$query",sid:"rvelj"}),c=e.createEvent({name:"opened",sid:"-f8s17u"}),d=e.createEvent({name:"updated",sid:"slzlyp"}),f=e.createEvent({name:"left",sid:"yy6ys3"}),p=e.createEvent({name:"closed",sid:"-say4ff"});return o.on(c,(function(){return!0})).on(f,(function(){return!1})),a.on(c,(function(e,t){return t.params})).on(d,(function(e,t){return t.params})),i.on(c,(function(e,t){return t.query})).on(d,(function(e,t){return t.query})),e.split({and:[{source:t.doneData,match:o.map((function(e){return e?"updated":"opened"})),cases:{opened:c,updated:d}}],or:{sid:"-x6h86m"}}),e.sample({and:[{clock:p,target:f}],or:{sid:"-wqj6z5"}}),{$isOpened:o,$params:a,$query:i,opened:c,updated:d,closed:p,left:f,navigate:t,open:r,kind:s.ROUTE}};function f(e){var r=e.params,n=e.query;return t.compile(e.pathCreator)(r)+(Object.keys(n).length?"?"+new URLSearchParams(n):"")}function p(e){var r=e.actualPath,n=t.match(e.pathCreator)(new URL("http://_"+r).pathname);return n?{matches:!0,params:n.params}:{matches:!1}}var l=function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var r in e)if(e[r]!==t[r])return!1;return!0},h=e.createEffect((function(e){if(!e.history)throw new Error("[Routing] No history provided");return e.history[e.method](e.path,{}),e}),{name:"historyPushFx",sid:"t43sn8"}),m=function(e){return"object"==typeof e&&null!==e&&"kind"in e&&e.kind===s.ROUTE},y=function(t){return e.is.store(t,{sid:"-v906zu"})?t:e.createStore(t,{sid:"-v904rr"})};exports.Kind=s,exports.buildPath=f,exports.chainRoute=function(t){var r=function(t){if(m(t))return{route:t,chainedRoute:e.withFactory({sid:"jogy9l",fn:function(){return d()},name:"chainedRoute",method:"createRoute"}),beforeOpen:e.createEvent({name:"beforeOpen",sid:"8mpttm"}),openOn:[t.opened,t.closed],cancelOn:[e.createEvent({name:"cancelOn",sid:"ahjdm4"})]};var r=t;if(!("enterOn"in r)&&e.is.effect(r.beforeOpen,{sid:"fx5yhy"}))return{route:r.route,chainedRoute:r.chainedRoute||e.withFactory({sid:"fyulbq",fn:function(){return d()},name:"chainedRoute",method:"createRoute"}),beforeOpen:r.beforeOpen,openOn:r.beforeOpen.doneData,cancelOn:r.beforeOpen.failData};var n=t;return{route:n.route,chainedRoute:n.chainedRoute||e.withFactory({sid:"u6793u",fn:function(){return d()},name:"chainedRoute",method:"createRoute"}),beforeOpen:n.beforeOpen,openOn:e.sample({and:[{clock:n.openOn}],or:{name:"openOn",sid:"-mm7rdb"}}),cancelOn:e.sample({and:[{clock:n.cancelOn||e.createEvent({name:"clock",sid:"y2etk0"})}],or:{name:"cancelOn",sid:"-vntqxj"}})}}(t),n=r.route,o=r.chainedRoute,a=r.beforeOpen,i=r.openOn,c=r.cancelOn,u=e.createStore({},{name:"$params",sid:"ru233x"}),s=e.createStore({},{name:"$query",sid:"2tnaew"}),f=e.combine({and:[e.combine({and:[[n.$params,n.$query]],or:{name:"and",sid:"-t8sbqu"}}),e.combine({and:[[u,s]],or:{name:"and",sid:"-t8s8s2"}}),function(e,t){return e[0]===t[0]&&e[1]===t[1]}],or:{name:"$hasSameParams",sid:"-w0fyuc"}}),p=e.sample({and:[{clock:[n.opened,n.updated]}],or:{name:"routeOpened",sid:"nobe5z"}});e.sample({and:[{clock:p,target:a}],or:{sid:"n0i9a7"}}),u.on(p,(function(e,t){return t.params})),s.on(p,(function(e,t){return t.query}));var l=e.guard({and:[{clock:i,source:{params:u,query:s},filter:f}],or:{name:"chainedRouteResolved",sid:"-qurk3a"}});e.sample({and:[{clock:l,target:o.navigate}],or:{sid:"ningv4"}});var h=e.merge([n.closed,c],{name:"aborted",sid:"-qm6c6a"});return u.reset(h),s.reset(h),e.sample({and:[{clock:h,target:o.closed}],or:{sid:"nz5any"}}),o},exports.createHistoryRouter=function(t){var r=function(e){for(var t,r=[],n=function(){var e=t.value;Array.isArray(e.route)?r.push.apply(r,e.route.map((function(t){return o({},e,{route:t})}))):r.push(e)},a=i(e);!(t=a()).done;)n();return r}(t.routes),a=e.createEvent({name:"setHistory",sid:"-clu30d"}),c=e.createEvent({name:"routeNotFound",sid:"-xnr4av"}),s=e.createStore({},{name:"$query",sid:"i4zffs"}),d=e.createStore("",{name:"$path",sid:"-rt73a5"}),m=e.createStore([],{and:{serialize:"ignore"},name:"$activeRoutes",sid:"ghza91"}),y=e.createStore(null,{and:{serialize:"ignore"},name:"$history",sid:"-7h197a"});y.on(a,(function(e,t){return t}));var v=e.attach({and:{source:{history:y},effect:h,mapParams:function(e,t){return o({history:t.history},e)}},or:{name:"pushFx",sid:"ejo7z4"}}),g=e.createEffect((function(e){var t=e.params,r=e.query;return{path:f({pathCreator:e.route.path,params:t,query:r}),params:t,query:r,method:"push"}}),{name:"openedFx",sid:"1o3d9f"}),w=e.createEffect((function(e){for(var t,n=e.path,o=e.query,a=[],c=[],u=i(r);!(t=u()).done;){var s=t.value,d=p({pathCreator:s.path,actualPath:n});(d.matches?a:c).push({route:s,params:d.params,query:o})}return{opened:a,closed:c}}),{name:"recalculateFx",sid:"-7w9bjj"});d.on(w.done,(function(e,t){return t.params.path})),s.on(w.done,(function(e,t){return t.params.query})),m.on(w.doneData,(function(e,t){return t.opened.map((function(e){return e.route.route}))})),e.sample({and:[{clock:g.doneData,target:v}],or:{sid:"7dceng"}}),e.guard({and:[{clock:w.doneData,filter:function(e){return 0===e.opened.length},target:c}],or:{sid:"7tu8ga"}});for(var b,x=w.doneData.map((function(e){return e.opened})),O=w.doneData.map((function(e){return e.closed})),k=function(){var t=b.value,r=e.createStore(!1,{name:"$isOpenedManually",sid:"cf3gjv"}),n=t.route.navigate.done;e.sample({and:[{clock:n,fn:function(e){var r=e.result;return{route:t,params:r.params,query:r.query}},target:g}],or:{sid:"-jwvp5p"}});var o=function(e){return e.find((function(e){return e.route===t}))},a={opened:e.guard({and:[{clock:x.filterMap(o),filter:t.route.$isOpened.map((function(e){return!e}))}],or:{name:"opened",sid:"ankvn"}}),updated:e.guard({and:[{clock:x.filterMap(o),filter:t.route.$isOpened}],or:{name:"updated",sid:"-xpqf1c"}}),closed:e.guard({and:[{clock:O.filterMap(o),filter:t.route.$isOpened}],or:{name:"closed",sid:"2t1awe"}})};r.on(n,(function(){return!0}));var i=e.guard({and:[{clock:a.updated,filter:r.map((function(e){return!e}))}],or:{name:"updated",sid:"-i38vyc"}});e.sample({and:[{source:e.restore(i,null,{name:"source",sid:"-1th5mi"}),clock:e.guard({and:[{clock:i,source:[t.route.$params,t.route.$query],filter:function(e,t){var r=e[1];return!l(e[0],t.params)||!l(r,t.query)}}],or:{name:"clock",sid:"cdcuni"}}),fn:function(e){return e},target:t.route.updated}],or:{sid:"-i4jrqg"}}),e.guard({and:[{clock:a.opened,filter:r.map((function(e){return!e})),target:t.route.opened}],or:{sid:"-hlayyt"}}),e.sample({and:[{clock:a.closed,target:t.route.closed}],or:{sid:"-h6giy2"}}),r.reset(e.sample({and:[{clock:x}],or:{sid:"-wz7y6w"}}))},E=i(r);!(b=E()).done;)k();var q,j=e.attach({and:{source:{history:y},effect:(q=n(u.mark((function e(t){var r,n;return u.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=[(r=t.history).location.pathname,Object.fromEntries(new URLSearchParams(r.location.search))],e.abrupt("return",{path:n[0],query:n[1]});case 3:case"end":return e.stop()}}),e)}))),function(e){return q.apply(this,arguments)})},or:{name:"recheckFx",sid:"fr6h5h"}});e.sample({and:[{source:j.doneData,target:w}],or:{sid:"-g52ioy"}});var L,R=e.attach({and:{source:{history:y},effect:(L=n(u.mark((function t(r){var n,o;return u.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=r.history,o=j;try{o=e.scopeBind(j)}catch(e){}return n.listen((function(){o()})),t.abrupt("return",!0);case 5:case"end":return t.stop()}}),t)}))),function(e){return L.apply(this,arguments)})},or:{name:"subscribeHistoryFx",sid:"bp94to"}});return t.hydrate||e.sample({and:[{clock:R.doneData,target:j}],or:{sid:"-4uqk3n"}}),e.sample({and:[{clock:y,target:R}],or:{sid:"-4rzl8a"}}),{$path:d,$query:s,$activeRoutes:m,$history:y,setHistory:a,push:v,routes:r,routeNotFound:c}},exports.createRoute=d,exports.isRoute=m,exports.matchPath=p,exports.redirect=function(t){var r=t.clock?e.sample({and:[{clock:t.clock}],or:{name:"clock",sid:"-nsh945"}}):e.createEvent({name:"clock",sid:"-nbfmpy"}),n=y(t.params||{}),o=y(t.query||{});return e.sample({and:[{clock:r,source:{params:n,query:o},fn:function(e,t){var r=e.params,n=e.query;return{params:"function"==typeof r?r(t):r,query:"function"==typeof n?n(t):n}},target:t.route.navigate}],or:{sid:"-8kqnzy"}}),r}; | ||
| //# sourceMappingURL=atomic-router.cjs.production.min.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"atomic-router.cjs.production.min.js","sources":["../node_modules/regenerator-runtime/runtime.js","../src/types.ts","../src/create-route.ts","../src/utils/build-path.ts","../src/create-history-router.ts","../src/utils/is-route.ts","../src/utils/redirect.ts","../src/utils/chain-route.ts"],"sourcesContent":["/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","import { Effect, Event, Store } from 'effector';\n\nexport type RouteParams = Record<string, any>;\n\nexport type RouteQuery = Record<string, any>;\n\nexport type RouteParamsAndQuery<Params extends RouteParams> = {\n params: Params;\n query: RouteQuery;\n};\n\nexport type RouteInstance<Params extends RouteParams> = {\n $isOpened: Store<boolean>;\n $params: Store<Params>;\n $query: Store<RouteQuery>;\n opened: Event<RouteParamsAndQuery<Params>>;\n updated: Event<RouteParamsAndQuery<Params>>;\n closed: Event<void>;\n /** @deprecated Will be removed in 0.6.0. Use `route.closed` instead */\n left: Event<void>;\n navigate: Effect<RouteParamsAndQuery<Params>, RouteParamsAndQuery<Params>>;\n open: Effect<Params, RouteParamsAndQuery<Params>>;\n kind: typeof Kind.ROUTE;\n};\n\n// @ts-expect-error\nexport type PathCreator<Params extends RouteParams> = string;\n\nexport const Kind = {\n ROUTE: Symbol(),\n};\n","import {\n attach,\n createEffect,\n createEvent,\n createStore,\n sample,\n split,\n} from 'effector';\nimport {\n RouteParams,\n RouteParamsAndQuery,\n RouteQuery,\n RouteInstance,\n Kind,\n} from './types';\n\nexport const createRoute = <Params extends RouteParams>() => {\n const navigateFx = createEffect(\n async ({ params, query }: RouteParamsAndQuery<Params>) => {\n return {\n params: params || {},\n query: query || {},\n } as RouteParamsAndQuery<Params>;\n }\n );\n\n const openFx = attach({\n effect: navigateFx,\n mapParams: (params: Params) => ({\n params: params || ({} as Params),\n query: {} as RouteQuery,\n }),\n });\n\n const $isOpened = createStore<boolean>(false);\n const $params = createStore<Params>({} as Params);\n const $query = createStore<RouteQuery>({});\n\n const opened = createEvent<RouteParamsAndQuery<Params>>();\n const updated = createEvent<RouteParamsAndQuery<Params>>();\n /** @deprecated Will be removed in 0.6.0. Use `route.closed` instead */\n const left = createEvent<void>();\n const closed = createEvent<void>();\n\n $isOpened.on(opened, () => true).on(left, () => false);\n\n $params\n .on(opened, (_, { params }) => params)\n .on(updated, (_, { params }) => params);\n\n $query\n .on(opened, (_, { query }) => query)\n .on(updated, (_, { query }) => query);\n\n split({\n source: navigateFx.doneData,\n match: $isOpened.map(isOpened => (isOpened ? 'updated' : 'opened')),\n cases: {\n opened,\n updated,\n },\n });\n\n sample({\n clock: closed,\n target: left,\n });\n\n const instance: RouteInstance<Params> = {\n $isOpened,\n $params,\n $query,\n opened,\n updated,\n closed,\n left,\n navigate: navigateFx,\n open: openFx,\n kind: Kind.ROUTE,\n };\n\n return instance;\n};\n","import { match, compile } from 'path-to-regexp';\n\nimport { RouteParams, PathCreator, RouteQuery } from '../types';\n\nconst getPathname = (path: string) => new URL(`http://_${path}`).pathname;\n\ntype BuildPathParams<Params extends RouteParams> = {\n pathCreator: PathCreator<Params>;\n params: Params;\n query: RouteQuery;\n};\nexport function buildPath<Params extends RouteParams>({\n pathCreator,\n params,\n query,\n}: BuildPathParams<Params>) {\n const pathname = compile(pathCreator)(params);\n const qs = Object.keys(query).length\n ? `?${new URLSearchParams(query as Record<string, string>)}`\n : '';\n const url = `${pathname}${qs}`;\n return url;\n}\n\ntype MatchPathParams<Params extends RouteParams> = {\n pathCreator: PathCreator<Params>;\n actualPath: string;\n};\nexport function matchPath<Params extends RouteParams>({\n pathCreator,\n actualPath,\n}: MatchPathParams<Params>) {\n const matches = match(pathCreator)(getPathname(actualPath));\n if (matches) {\n return { matches: true, params: matches.params } as const;\n }\n return { matches: false } as const;\n}\n","import { buildPath, matchPath } from './utils/build-path';\nimport { History } from 'history';\nimport { RouteInstance, RouteParams, RouteQuery } from './types';\nimport {\n attach,\n createEffect,\n guard,\n sample,\n createStore,\n createEvent,\n scopeBind,\n} from 'effector';\n\ntype RouteObject<Params extends RouteParams> = {\n route: RouteInstance<Params>;\n path: string;\n};\n\ntype UnmappedRouteObject<Params extends RouteParams> = {\n route: RouteInstance<Params> | RouteInstance<Params>[];\n path: string;\n};\n\ntype HistoryPushParams = {\n history: History;\n path: string;\n params: RouteParams;\n query: RouteQuery;\n method: 'replace' | 'push';\n};\n\nconst historyPushFx = createEffect<HistoryPushParams, HistoryPushParams>(\n pushParams => {\n if (!pushParams.history) {\n throw new Error('[Routing] No history provided');\n }\n pushParams.history[pushParams.method](pushParams.path, {});\n return pushParams;\n }\n);\n\nconst remapRouteObjects = (objects: UnmappedRouteObject<any>[]) => {\n const next = [] as RouteObject<any>[];\n for (const routeObj of objects) {\n if (Array.isArray(routeObj.route)) {\n next.push(...routeObj.route.map(route => ({ ...routeObj, route })));\n } else {\n // @ts-expect-error\n next.push(routeObj);\n }\n }\n return next;\n};\n\nexport const createHistoryRouter = (params: {\n routes: UnmappedRouteObject<any>[];\n hydrate?: boolean;\n}) => {\n type PushParams = Omit<HistoryPushParams, 'history'>;\n type EnterParams<Params extends RouteParams> = {\n route: RouteObject<Params>;\n params: Params;\n query: RouteQuery;\n };\n type RecheckResult<Params extends RouteParams> = {\n route: RouteObject<Params>;\n params: Params;\n query: RouteQuery;\n };\n\n const remappedRoutes = remapRouteObjects(params.routes);\n\n const setHistory = createEvent<History>();\n const routeNotFound = createEvent();\n\n const $query = createStore({});\n const $path = createStore('');\n const $activeRoutes = createStore<RouteInstance<any>[]>([], {\n serialize: 'ignore',\n });\n\n // @ts-expect-error\n const $history = createStore<History>(null, {\n serialize: 'ignore',\n });\n\n $history.on(setHistory, (_, nextHistory) => nextHistory);\n\n // historyPushFx for the current history\n const pushFx = attach({\n source: {\n history: $history,\n },\n effect: historyPushFx,\n mapParams: (params: PushParams, { history }) => {\n return {\n history,\n ...params,\n };\n },\n });\n\n // Triggered whenever some route.navigate.doneData is triggered\n const openedFx = createEffect<EnterParams<any>, PushParams>(\n ({ route, params, query }) => {\n const path = buildPath({\n pathCreator: route.path,\n params,\n query,\n });\n return {\n path,\n params,\n query,\n method: 'push',\n };\n }\n );\n\n // Recalculate opened/closed routes\n const recalculateFx = createEffect<\n {\n path: string;\n query: RouteQuery;\n },\n {\n opened: RecheckResult<any>[];\n closed: RecheckResult<any>[];\n }\n >(({ path, query }) => {\n const opened = [] as RecheckResult<any>[];\n const closed = [] as RecheckResult<any>[];\n\n for (const route of remappedRoutes) {\n const { matches, params } = matchPath({\n pathCreator: route.path,\n actualPath: path,\n });\n (matches ? opened : closed).push({\n route,\n params,\n query,\n });\n }\n\n return {\n opened,\n closed,\n };\n });\n\n $path.on(recalculateFx.done, (_prev, { params: { path } }) => path);\n\n $query.on(recalculateFx.done, (_prev, { params: { query } }) => query);\n\n $activeRoutes.on(recalculateFx.doneData, (_prev, { opened }) =>\n opened.map(recheckResult => recheckResult.route.route)\n );\n\n sample({\n clock: openedFx.doneData,\n target: pushFx,\n });\n\n // sample({\n // clock: pushFx.doneData,\n // target: recalculateFx,\n // });\n\n // Trigger 404 if no routes were opened\n guard({\n clock: recalculateFx.doneData,\n filter: ({ opened }) => opened.length === 0,\n target: routeNotFound,\n });\n\n const routesOpened = recalculateFx.doneData.map(({ opened }) => opened);\n const routesClosed = recalculateFx.doneData.map(({ closed }) => closed);\n\n for (const routeObj of remappedRoutes) {\n const $isOpenedManually = createStore(false);\n\n // Watch for route.navigate.doneData to build new path and push\n const navigatedManually = routeObj.route.navigate.done;\n\n sample({\n clock: navigatedManually,\n fn: ({ result: { params, query } }) => ({\n route: routeObj,\n params,\n query,\n }),\n target: openedFx,\n });\n\n const containsCurrentRoute = (recheckResults: RecheckResult<any>[]) => {\n return recheckResults.find(\n recheckResult => recheckResult.route === routeObj\n );\n };\n\n const recheckLifecycle = {\n opened: guard({\n clock: routesOpened.filterMap(containsCurrentRoute),\n filter: routeObj.route.$isOpened.map(isOpened => !isOpened),\n }),\n updated: guard({\n clock: routesOpened.filterMap(containsCurrentRoute),\n filter: routeObj.route.$isOpened,\n }),\n closed: guard({\n clock: routesClosed.filterMap(containsCurrentRoute),\n filter: routeObj.route.$isOpened,\n }),\n };\n\n // This is needed to skip extra opened/udpated calls from the route itself\n $isOpenedManually.on(navigatedManually, () => true);\n\n // Trigger .updated() for already opened routes marked as \"opened\"\n guard({\n clock: recheckLifecycle.updated,\n filter: $isOpenedManually.map(isOpenedManually => !isOpenedManually),\n target: routeObj.route.updated,\n });\n\n // Trigger .opened() for the routes marked as \"opened\"\n guard({\n clock: recheckLifecycle.opened,\n filter: $isOpenedManually.map(isOpenedManually => !isOpenedManually),\n target: routeObj.route.opened,\n });\n\n // Trigger .closed() for the routes marked as \"closed\"\n sample({\n clock: recheckLifecycle.closed,\n target: routeObj.route.closed,\n });\n\n // Reset $isOpenedManually\n $isOpenedManually.reset(sample({ clock: routesOpened }));\n }\n\n // Takes current path from history and triggers recalculate\n // Triggered on every history change + once when history instance is set\n const recheckFx = attach({\n source: {\n history: $history,\n },\n effect: async ({ history }) => {\n const [path, query] = [\n history.location.pathname,\n Object.fromEntries(\n // @ts-expect-error\n new URLSearchParams(history.location.search)\n ) as RouteQuery,\n ];\n return {\n path,\n query,\n };\n },\n });\n\n sample({\n source: recheckFx.doneData,\n target: recalculateFx,\n });\n\n // Triggered whenever history instance is set\n const subscribeHistoryFx = attach({\n source: {\n history: $history,\n },\n effect: async ({ history }) => {\n let scopedRecheck = recheckFx;\n try {\n // @ts-expect-error\n scopedRecheck = scopeBind(recheckFx);\n } catch (err) {}\n history.listen(() => {\n scopedRecheck();\n });\n return true;\n },\n });\n\n // If `hydrate` flag is set,\n // don't trigger recheck on history init\n if (!params.hydrate) {\n sample({\n clock: subscribeHistoryFx.doneData,\n target: recheckFx,\n });\n }\n\n sample({\n clock: $history,\n target: subscribeHistoryFx,\n });\n\n return {\n $path,\n $query,\n $activeRoutes,\n $history,\n setHistory,\n push: pushFx,\n routes: remappedRoutes,\n routeNotFound,\n };\n};\n","import { Kind, RouteInstance } from '../types';\n\n/** Detects whether passed value is a `RouteInstance<any>` or not */\nexport const isRoute = (\n route: RouteInstance<any> | unknown\n): route is RouteInstance<any> => {\n return (\n typeof route === 'object' &&\n route !== null &&\n 'kind' in route &&\n // @ts-expect-error\n route.kind === Kind.ROUTE\n );\n};\n","import { Clock, createEvent, createStore, is, sample, Store } from 'effector';\nimport { RouteInstance, RouteQuery } from '../types';\n\ntype RedirectParams<T, Params> = {\n clock?: Clock<T>;\n route: RouteInstance<Params>;\n params?: ((clock: T) => Params) | Store<Params> | Params;\n query?: ((clock: T) => RouteQuery) | Store<RouteQuery> | RouteQuery;\n};\n\n/** Opens passed `route` upon `clock` trigger */\nexport const redirect = <T, Params>(options: RedirectParams<T, Params>) => {\n const clock = options.clock\n ? sample({ clock: options.clock })\n : createEvent<T>();\n let params = toStore(options.params || {});\n let query = toStore(options.query || {});\n\n sample({\n clock: clock,\n source: { params, query },\n fn: ({ params, query }, clock) => ({\n params: typeof params === 'function' ? params(clock) : params,\n query: typeof query === 'function' ? query(clock) : query,\n }),\n target: options.route.navigate,\n });\n return clock;\n};\n\nconst toStore = <T>(payload: T | Store<T>): Store<T> => {\n return is.store(payload) ? payload : createStore(payload as T);\n};\n","import {\n is,\n guard,\n merge,\n sample,\n combine,\n createStore,\n Unit,\n Clock,\n Effect,\n StoreValue,\n createEvent,\n} from 'effector';\n\nimport { createRoute } from '../create-route';\nimport { RouteInstance, RouteParamsAndQuery } from '../types';\n\nimport { isRoute } from './is-route';\n\ntype ChainRouteParamsWithEffect<Params> = {\n route: RouteInstance<Params>;\n chainedRoute?: RouteInstance<Params>;\n beforeOpen: Effect<RouteParamsAndQuery<Params>, any, any>;\n};\n\ntype ChainRouteParamsAdvanced<Params> = {\n route: RouteInstance<Params>;\n chainedRoute?: RouteInstance<Params>;\n beforeOpen: Clock<RouteParamsAndQuery<Params>>;\n openOn: Clock<any>;\n cancelOn?: Clock<any>;\n};\n\ntype ChainRouteParamsNormalized<Params> = {\n route: RouteInstance<Params>;\n chainedRoute: RouteInstance<Params>;\n beforeOpen: Clock<RouteParamsAndQuery<Params>>;\n openOn: Clock<any>;\n cancelOn: Clock<any>;\n};\n\ntype chainRouteParams<Params> =\n | RouteInstance<Params>\n | ChainRouteParamsWithEffect<Params>\n | ChainRouteParamsAdvanced<Params>;\n\nconst normalizeChainRouteParams = <Params>(\n params: chainRouteParams<Params>\n): ChainRouteParamsNormalized<Params> => {\n if (isRoute(params)) {\n return {\n route: params,\n chainedRoute: createRoute<Params>(),\n beforeOpen: createEvent(),\n openOn: [params.opened, params.closed],\n cancelOn: [createEvent()],\n };\n }\n const effectParams = params as ChainRouteParamsWithEffect<Params>;\n if (!('enterOn' in effectParams) && is.effect(effectParams.beforeOpen)) {\n return {\n route: effectParams.route,\n chainedRoute: effectParams.chainedRoute || createRoute<Params>(),\n beforeOpen: effectParams.beforeOpen,\n openOn: effectParams.beforeOpen.doneData,\n cancelOn: effectParams.beforeOpen.failData,\n };\n }\n const advancedParams = params as ChainRouteParamsAdvanced<Params>;\n return {\n route: advancedParams.route,\n chainedRoute: advancedParams.chainedRoute || createRoute<Params>(),\n beforeOpen: advancedParams.beforeOpen,\n openOn: sample({ clock: advancedParams.openOn }),\n cancelOn: sample({ clock: advancedParams.cancelOn || createEvent() }),\n };\n};\n\n/**\n * Creates chained route\n * @link https://github.com/Kelin2025/atomic-router/issues/10\n * @param {RouteInstance<any>} params.route - Route to listen\n * @param {RouteInstance<any>} [params.chainedRoute] - Route to be created\n * @param {Clock<any>} params.beforeOpen - Will be triggered when `params.route` open\n * @param {Clock<any>} params.enterOn - Will open `chainedRoute` if `params.route` is still opened\n * @param {Clock<any>} params.cancelOn - Cancels chain\n * @returns {RouteInstance<any>} `chainedRoute`\n */\nexport const chainRoute = <Params>(params: chainRouteParams<Params>) => {\n const {\n route,\n chainedRoute,\n beforeOpen,\n openOn,\n cancelOn,\n } = normalizeChainRouteParams(params);\n const $params = createStore({} as StoreValue<typeof route['$params']>);\n const $query = createStore({} as StoreValue<typeof route['$query']>);\n const $hasSameParams = combine(\n combine([route.$params, route.$query]),\n combine([$params, $query]),\n (current, stored) => {\n return current[0] === stored[0] && current[1] === stored[1];\n }\n );\n const routeOpened = sample({\n clock: [route.opened, route.updated],\n });\n // 1. Call `beforeOpen` whenever route is opened\n sample({\n clock: routeOpened,\n target: beforeOpen as Unit<RouteParamsAndQuery<any>>,\n });\n $params.on(routeOpened, (_prev, { params }) => params);\n $query.on(routeOpened, (_prev, { query }) => query);\n // 2. Listen to `openOn` if route is still opened on the same position\n const chainedRouteResolved = guard({\n clock: openOn,\n source: { params: $params, query: $query },\n filter: $hasSameParams,\n });\n sample({\n clock: chainedRouteResolved,\n target: chainedRoute.navigate,\n });\n // 4. Cancel loading if page closed or `cancelOn` is called\n // @ts-expect-error\n const aborted = merge([route.closed, cancelOn]);\n $params.reset(aborted);\n $query.reset(aborted);\n sample({\n clock: aborted,\n target: chainedRoute.closed,\n });\n return chainedRoute;\n};\n"],"names":["runtime","exports","Op","Object","prototype","hasOwn","hasOwnProperty","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","obj","key","value","defineProperty","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","generator","create","Generator","context","Context","_invoke","state","method","arg","Error","undefined","done","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","type","makeInvokeMethod","fn","call","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","this","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","AsyncIterator","PromiseImpl","previousPromise","callInvokeWithMethodAndArg","resolve","reject","invoke","result","__await","then","unwrapped","error","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","doneResult","displayName","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","catch","thrown","delegateYield","module","regeneratorRuntime","accidentalStrictMode","globalThis","Function","Kind","ROUTE","createRoute","navigateFx","createEffect","params","query","openFx","attach","effect","mapParams","$isOpened","createStore","$params","$query","opened","createEvent","updated","left","closed","on","_","split","source","doneData","match","map","isOpened","cases","sample","clock","target","navigate","open","kind","buildPath","compile","pathCreator","URLSearchParams","matchPath","actualPath","matches","URL","pathname","historyPushFx","pushParams","history","path","isRoute","route","toStore","payload","is","store","chainedRoute","beforeOpen","openOn","cancelOn","effectParams","failData","advancedParams","normalizeChainRouteParams","$hasSameParams","combine","current","stored","routeOpened","_prev","chainedRouteResolved","guard","filter","aborted","merge","remappedRoutes","objects","routeObj","Array","isArray","remapRouteObjects","routes","setHistory","routeNotFound","$path","$activeRoutes","serialize","$history","nextHistory","pushFx","openedFx","recalculateFx","recheckResult","routesOpened","routesClosed","$isOpenedManually","navigatedManually","containsCurrentRoute","recheckResults","find","recheckLifecycle","filterMap","isOpenedManually","recheckFx","location","fromEntries","search","subscribeHistoryFx","scopedRecheck","scopeBind","listen","hydrate","options"],"mappings":"09CAOA,IAAIA,EAAW,SAAUC,GAGvB,IAAIC,EAAKC,OAAOC,UACZC,EAASH,EAAGI,eAEZC,EAA4B,mBAAXC,OAAwBA,OAAS,GAClDC,EAAiBF,EAAQG,UAAY,aACrCC,EAAsBJ,EAAQK,eAAiB,kBAC/CC,EAAoBN,EAAQO,aAAe,gBAE/C,SAASC,EAAOC,EAAKC,EAAKC,GAOxB,OANAf,OAAOgB,eAAeH,EAAKC,EAAK,CAC9BC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"} | ||
| {"version":3,"file":"atomic-router.cjs.production.min.js","sources":["../node_modules/regenerator-runtime/runtime.js","../src/types.ts","../src/create-route.ts","../src/utils/build-path.ts","../src/utils/equals.ts","../src/create-history-router.ts","../src/utils/is-route.ts","../src/utils/redirect.ts","../src/utils/chain-route.ts"],"sourcesContent":["/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","import { Effect, Event, Store } from 'effector';\n\nexport type RouteParams = Record<string, any>;\n\nexport type RouteQuery = Record<string, any>;\n\nexport type RouteParamsAndQuery<Params extends RouteParams> = {\n params: Params;\n query: RouteQuery;\n};\n\nexport type RouteInstance<Params extends RouteParams> = {\n $isOpened: Store<boolean>;\n $params: Store<Params>;\n $query: Store<RouteQuery>;\n opened: Event<RouteParamsAndQuery<Params>>;\n updated: Event<RouteParamsAndQuery<Params>>;\n closed: Event<void>;\n /** @deprecated Will be removed in 0.6.0. Use `route.closed` instead */\n left: Event<void>;\n navigate: Effect<RouteParamsAndQuery<Params>, RouteParamsAndQuery<Params>>;\n open: Effect<Params, RouteParamsAndQuery<Params>>;\n kind: typeof Kind.ROUTE;\n};\n\n// @ts-expect-error\nexport type PathCreator<Params extends RouteParams> = string;\n\nexport const Kind = {\n ROUTE: Symbol(),\n};\n","import {\n attach,\n createEffect,\n createEvent,\n createStore,\n sample,\n split,\n} from 'effector';\nimport {\n RouteParams,\n RouteParamsAndQuery,\n RouteQuery,\n RouteInstance,\n Kind,\n} from './types';\n\nexport const createRoute = <Params extends RouteParams>() => {\n const navigateFx = createEffect(\n async ({ params, query }: RouteParamsAndQuery<Params>) => {\n return {\n params: params || {},\n query: query || {},\n } as RouteParamsAndQuery<Params>;\n }\n );\n\n const openFx = attach({\n effect: navigateFx,\n mapParams: (params: Params) => ({\n params: params || ({} as Params),\n query: {} as RouteQuery,\n }),\n });\n\n const $isOpened = createStore<boolean>(false);\n const $params = createStore<Params>({} as Params);\n const $query = createStore<RouteQuery>({});\n\n const opened = createEvent<RouteParamsAndQuery<Params>>();\n const updated = createEvent<RouteParamsAndQuery<Params>>();\n /** @deprecated Will be removed in 0.6.0. Use `route.closed` instead */\n const left = createEvent<void>();\n const closed = createEvent<void>();\n\n $isOpened.on(opened, () => true).on(left, () => false);\n\n $params\n .on(opened, (_, { params }) => params)\n .on(updated, (_, { params }) => params);\n\n $query\n .on(opened, (_, { query }) => query)\n .on(updated, (_, { query }) => query);\n\n split({\n source: navigateFx.doneData,\n match: $isOpened.map(isOpened => (isOpened ? 'updated' : 'opened')),\n cases: {\n opened,\n updated,\n },\n });\n\n sample({\n clock: closed,\n target: left,\n });\n\n const instance: RouteInstance<Params> = {\n $isOpened,\n $params,\n $query,\n opened,\n updated,\n closed,\n left,\n navigate: navigateFx,\n open: openFx,\n kind: Kind.ROUTE,\n };\n\n return instance;\n};\n","import { match, compile } from 'path-to-regexp';\n\nimport { RouteParams, PathCreator, RouteQuery } from '../types';\n\nconst getPathname = (path: string) => new URL(`http://_${path}`).pathname;\n\ntype BuildPathParams<Params extends RouteParams> = {\n pathCreator: PathCreator<Params>;\n params: Params;\n query: RouteQuery;\n};\nexport function buildPath<Params extends RouteParams>({\n pathCreator,\n params,\n query,\n}: BuildPathParams<Params>) {\n const pathname = compile(pathCreator)(params);\n const qs = Object.keys(query).length\n ? `?${new URLSearchParams(query as Record<string, string>)}`\n : '';\n const url = `${pathname}${qs}`;\n return url;\n}\n\ntype MatchPathParams<Params extends RouteParams> = {\n pathCreator: PathCreator<Params>;\n actualPath: string;\n};\nexport function matchPath<Params extends RouteParams>({\n pathCreator,\n actualPath,\n}: MatchPathParams<Params>) {\n const matches = match(pathCreator)(getPathname(actualPath));\n if (matches) {\n return { matches: true, params: matches.params } as const;\n }\n return { matches: false } as const;\n}\n","export const equals = (a: Record<string, any>, b: Record<string, any>) => {\n if (Object.keys(a).length !== Object.keys(b).length) {\n return false;\n }\n for (const k in a) {\n if (a[k] !== b[k]) {\n return false;\n }\n }\n return true;\n};\n","import { buildPath, matchPath } from './utils/build-path';\nimport { History } from 'history';\nimport { RouteInstance, RouteParams, RouteQuery } from './types';\nimport {\n attach,\n createEffect,\n guard,\n sample,\n createStore,\n createEvent,\n scopeBind,\n restore,\n} from 'effector';\nimport { equals } from './utils/equals';\n\ntype RouteObject<Params extends RouteParams> = {\n route: RouteInstance<Params>;\n path: string;\n};\n\ntype UnmappedRouteObject<Params extends RouteParams> = {\n route: RouteInstance<Params> | RouteInstance<Params>[];\n path: string;\n};\n\ntype HistoryPushParams = {\n history: History;\n path: string;\n params: RouteParams;\n query: RouteQuery;\n method: 'replace' | 'push';\n};\n\nconst historyPushFx = createEffect<HistoryPushParams, HistoryPushParams>(\n pushParams => {\n if (!pushParams.history) {\n throw new Error('[Routing] No history provided');\n }\n pushParams.history[pushParams.method](pushParams.path, {});\n return pushParams;\n }\n);\n\nconst remapRouteObjects = (objects: UnmappedRouteObject<any>[]) => {\n const next = [] as RouteObject<any>[];\n for (const routeObj of objects) {\n if (Array.isArray(routeObj.route)) {\n next.push(...routeObj.route.map(route => ({ ...routeObj, route })));\n } else {\n // @ts-expect-error\n next.push(routeObj);\n }\n }\n return next;\n};\n\nexport const createHistoryRouter = (params: {\n routes: UnmappedRouteObject<any>[];\n hydrate?: boolean;\n}) => {\n type PushParams = Omit<HistoryPushParams, 'history'>;\n type EnterParams<Params extends RouteParams> = {\n route: RouteObject<Params>;\n params: Params;\n query: RouteQuery;\n };\n type RecheckResult<Params extends RouteParams> = {\n route: RouteObject<Params>;\n params: Params;\n query: RouteQuery;\n };\n\n const remappedRoutes = remapRouteObjects(params.routes);\n\n const setHistory = createEvent<History>();\n const routeNotFound = createEvent();\n\n const $query = createStore({});\n const $path = createStore('');\n const $activeRoutes = createStore<RouteInstance<any>[]>([], {\n serialize: 'ignore',\n });\n\n // @ts-expect-error\n const $history = createStore<History>(null, {\n serialize: 'ignore',\n });\n\n $history.on(setHistory, (_, nextHistory) => nextHistory);\n\n // historyPushFx for the current history\n const pushFx = attach({\n source: {\n history: $history,\n },\n effect: historyPushFx,\n mapParams: (params: PushParams, { history }) => {\n return {\n history,\n ...params,\n };\n },\n });\n\n // Triggered whenever some route.navigate.doneData is triggered\n const openedFx = createEffect<EnterParams<any>, PushParams>(\n ({ route, params, query }) => {\n const path = buildPath({\n pathCreator: route.path,\n params,\n query,\n });\n return {\n path,\n params,\n query,\n method: 'push',\n };\n }\n );\n\n // Recalculate opened/closed routes\n const recalculateFx = createEffect<\n {\n path: string;\n query: RouteQuery;\n },\n {\n opened: RecheckResult<any>[];\n closed: RecheckResult<any>[];\n }\n >(({ path, query }) => {\n const opened = [] as RecheckResult<any>[];\n const closed = [] as RecheckResult<any>[];\n\n for (const route of remappedRoutes) {\n const { matches, params } = matchPath({\n pathCreator: route.path,\n actualPath: path,\n });\n (matches ? opened : closed).push({\n route,\n params,\n query,\n });\n }\n\n return {\n opened,\n closed,\n };\n });\n\n $path.on(recalculateFx.done, (_prev, { params: { path } }) => path);\n\n $query.on(recalculateFx.done, (_prev, { params: { query } }) => query);\n\n $activeRoutes.on(recalculateFx.doneData, (_prev, { opened }) =>\n opened.map(recheckResult => recheckResult.route.route)\n );\n\n sample({\n clock: openedFx.doneData,\n target: pushFx,\n });\n\n // sample({\n // clock: pushFx.doneData,\n // target: recalculateFx,\n // });\n\n // Trigger 404 if no routes were opened\n guard({\n clock: recalculateFx.doneData,\n filter: ({ opened }) => opened.length === 0,\n target: routeNotFound,\n });\n\n const routesOpened = recalculateFx.doneData.map(({ opened }) => opened);\n const routesClosed = recalculateFx.doneData.map(({ closed }) => closed);\n\n for (const routeObj of remappedRoutes) {\n const $isOpenedManually = createStore(false);\n\n // Watch for route.navigate.doneData to build new path and push\n const navigatedManually = routeObj.route.navigate.done;\n\n sample({\n clock: navigatedManually,\n fn: ({ result: { params, query } }) => ({\n route: routeObj,\n params,\n query,\n }),\n target: openedFx,\n });\n\n const containsCurrentRoute = (recheckResults: RecheckResult<any>[]) => {\n return recheckResults.find(\n recheckResult => recheckResult.route === routeObj\n );\n };\n\n const recheckLifecycle = {\n opened: guard({\n clock: routesOpened.filterMap(containsCurrentRoute),\n filter: routeObj.route.$isOpened.map(isOpened => !isOpened),\n }),\n updated: guard({\n clock: routesOpened.filterMap(containsCurrentRoute),\n filter: routeObj.route.$isOpened,\n }),\n closed: guard({\n clock: routesClosed.filterMap(containsCurrentRoute),\n filter: routeObj.route.$isOpened,\n }),\n };\n\n // This is needed to skip extra opened/udpated calls from the route itself\n $isOpenedManually.on(navigatedManually, () => true);\n\n // Trigger .updated() for already opened routes marked as \"opened\"\n const updated = guard({\n clock: recheckLifecycle.updated,\n filter: $isOpenedManually.map(isOpenedManually => !isOpenedManually),\n });\n\n sample({\n source: restore(updated, null),\n clock: guard({\n clock: updated,\n source: [routeObj.route.$params, routeObj.route.$query],\n // Skip .updated() calls if params & query are the same\n filter: ([params, query], next) => {\n return !equals(params, next.params) || !equals(query, next.query);\n },\n }),\n fn: payload => payload!,\n target: routeObj.route.updated,\n });\n\n // Trigger .opened() for the routes marked as \"opened\"\n guard({\n clock: recheckLifecycle.opened,\n filter: $isOpenedManually.map(isOpenedManually => !isOpenedManually),\n target: routeObj.route.opened,\n });\n\n // Trigger .closed() for the routes marked as \"closed\"\n sample({\n clock: recheckLifecycle.closed,\n target: routeObj.route.closed,\n });\n\n // Reset $isOpenedManually\n $isOpenedManually.reset(sample({ clock: routesOpened }));\n }\n\n // Takes current path from history and triggers recalculate\n // Triggered on every history change + once when history instance is set\n const recheckFx = attach({\n source: {\n history: $history,\n },\n effect: async ({ history }) => {\n const [path, query] = [\n history.location.pathname,\n Object.fromEntries(\n // @ts-expect-error\n new URLSearchParams(history.location.search)\n ) as RouteQuery,\n ];\n return {\n path,\n query,\n };\n },\n });\n\n sample({\n source: recheckFx.doneData,\n target: recalculateFx,\n });\n\n // Triggered whenever history instance is set\n const subscribeHistoryFx = attach({\n source: {\n history: $history,\n },\n effect: async ({ history }) => {\n let scopedRecheck = recheckFx;\n try {\n // @ts-expect-error\n scopedRecheck = scopeBind(recheckFx);\n } catch (err) {}\n history.listen(() => {\n scopedRecheck();\n });\n return true;\n },\n });\n\n // If `hydrate` flag is set,\n // don't trigger recheck on history init\n if (!params.hydrate) {\n sample({\n clock: subscribeHistoryFx.doneData,\n target: recheckFx,\n });\n }\n\n sample({\n clock: $history,\n target: subscribeHistoryFx,\n });\n\n return {\n $path,\n $query,\n $activeRoutes,\n $history,\n setHistory,\n push: pushFx,\n routes: remappedRoutes,\n routeNotFound,\n };\n};\n","import { Kind, RouteInstance } from '../types';\n\n/** Detects whether passed value is a `RouteInstance<any>` or not */\nexport const isRoute = (\n route: RouteInstance<any> | unknown\n): route is RouteInstance<any> => {\n return (\n typeof route === 'object' &&\n route !== null &&\n 'kind' in route &&\n // @ts-expect-error\n route.kind === Kind.ROUTE\n );\n};\n","import { Clock, createEvent, createStore, is, sample, Store } from 'effector';\nimport { RouteInstance, RouteQuery } from '../types';\n\ntype RedirectParams<T, Params> = {\n clock?: Clock<T>;\n route: RouteInstance<Params>;\n params?: ((clock: T) => Params) | Store<Params> | Params;\n query?: ((clock: T) => RouteQuery) | Store<RouteQuery> | RouteQuery;\n};\n\n/** Opens passed `route` upon `clock` trigger */\nexport const redirect = <T, Params>(options: RedirectParams<T, Params>) => {\n const clock = options.clock\n ? sample({ clock: options.clock })\n : createEvent<T>();\n let params = toStore(options.params || {});\n let query = toStore(options.query || {});\n\n sample({\n clock: clock,\n source: { params, query },\n fn: ({ params, query }, clock) => ({\n params: typeof params === 'function' ? params(clock) : params,\n query: typeof query === 'function' ? query(clock) : query,\n }),\n target: options.route.navigate,\n });\n return clock;\n};\n\nconst toStore = <T>(payload: T | Store<T>): Store<T> => {\n return is.store(payload) ? payload : createStore(payload as T);\n};\n","import {\n is,\n guard,\n merge,\n sample,\n combine,\n createStore,\n Unit,\n Clock,\n Effect,\n StoreValue,\n createEvent,\n} from 'effector';\n\nimport { createRoute } from '../create-route';\nimport { RouteInstance, RouteParamsAndQuery } from '../types';\n\nimport { isRoute } from './is-route';\n\ntype ChainRouteParamsWithEffect<Params> = {\n route: RouteInstance<Params>;\n chainedRoute?: RouteInstance<Params>;\n beforeOpen: Effect<RouteParamsAndQuery<Params>, any, any>;\n};\n\ntype ChainRouteParamsAdvanced<Params> = {\n route: RouteInstance<Params>;\n chainedRoute?: RouteInstance<Params>;\n beforeOpen: Clock<RouteParamsAndQuery<Params>>;\n openOn: Clock<any>;\n cancelOn?: Clock<any>;\n};\n\ntype ChainRouteParamsNormalized<Params> = {\n route: RouteInstance<Params>;\n chainedRoute: RouteInstance<Params>;\n beforeOpen: Clock<RouteParamsAndQuery<Params>>;\n openOn: Clock<any>;\n cancelOn: Clock<any>;\n};\n\ntype chainRouteParams<Params> =\n | RouteInstance<Params>\n | ChainRouteParamsWithEffect<Params>\n | ChainRouteParamsAdvanced<Params>;\n\nconst normalizeChainRouteParams = <Params>(\n params: chainRouteParams<Params>\n): ChainRouteParamsNormalized<Params> => {\n if (isRoute(params)) {\n return {\n route: params,\n chainedRoute: createRoute<Params>(),\n beforeOpen: createEvent(),\n openOn: [params.opened, params.closed],\n cancelOn: [createEvent()],\n };\n }\n const effectParams = params as ChainRouteParamsWithEffect<Params>;\n if (!('enterOn' in effectParams) && is.effect(effectParams.beforeOpen)) {\n return {\n route: effectParams.route,\n chainedRoute: effectParams.chainedRoute || createRoute<Params>(),\n beforeOpen: effectParams.beforeOpen,\n openOn: effectParams.beforeOpen.doneData,\n cancelOn: effectParams.beforeOpen.failData,\n };\n }\n const advancedParams = params as ChainRouteParamsAdvanced<Params>;\n return {\n route: advancedParams.route,\n chainedRoute: advancedParams.chainedRoute || createRoute<Params>(),\n beforeOpen: advancedParams.beforeOpen,\n openOn: sample({ clock: advancedParams.openOn }),\n cancelOn: sample({ clock: advancedParams.cancelOn || createEvent() }),\n };\n};\n\n/**\n * Creates chained route\n * @link https://github.com/Kelin2025/atomic-router/issues/10\n * @param {RouteInstance<any>} params.route - Route to listen\n * @param {RouteInstance<any>} [params.chainedRoute] - Route to be created\n * @param {Clock<any>} params.beforeOpen - Will be triggered when `params.route` open\n * @param {Clock<any>} params.enterOn - Will open `chainedRoute` if `params.route` is still opened\n * @param {Clock<any>} params.cancelOn - Cancels chain\n * @returns {RouteInstance<any>} `chainedRoute`\n */\nexport const chainRoute = <Params>(params: chainRouteParams<Params>) => {\n const {\n route,\n chainedRoute,\n beforeOpen,\n openOn,\n cancelOn,\n } = normalizeChainRouteParams(params);\n const $params = createStore({} as StoreValue<typeof route['$params']>);\n const $query = createStore({} as StoreValue<typeof route['$query']>);\n const $hasSameParams = combine(\n combine([route.$params, route.$query]),\n combine([$params, $query]),\n (current, stored) => {\n return current[0] === stored[0] && current[1] === stored[1];\n }\n );\n const routeOpened = sample({\n clock: [route.opened, route.updated],\n });\n // 1. Call `beforeOpen` whenever route is opened\n sample({\n clock: routeOpened,\n target: beforeOpen as Unit<RouteParamsAndQuery<any>>,\n });\n $params.on(routeOpened, (_prev, { params }) => params);\n $query.on(routeOpened, (_prev, { query }) => query);\n // 2. Listen to `openOn` if route is still opened on the same position\n const chainedRouteResolved = guard({\n clock: openOn,\n source: { params: $params, query: $query },\n filter: $hasSameParams,\n });\n sample({\n clock: chainedRouteResolved,\n target: chainedRoute.navigate,\n });\n // 4. Cancel loading if page closed or `cancelOn` is called\n // @ts-expect-error\n const aborted = merge([route.closed, cancelOn]);\n $params.reset(aborted);\n $query.reset(aborted);\n sample({\n clock: aborted,\n target: chainedRoute.closed,\n });\n return chainedRoute;\n};\n"],"names":["runtime","exports","Op","Object","prototype","hasOwn","hasOwnProperty","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","obj","key","value","defineProperty","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","generator","create","Generator","context","Context","_invoke","state","method","arg","Error","undefined","done","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","type","makeInvokeMethod","fn","call","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","this","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","AsyncIterator","PromiseImpl","previousPromise","callInvokeWithMethodAndArg","resolve","reject","invoke","result","__await","then","unwrapped","error","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","doneResult","displayName","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","catch","thrown","delegateYield","module","regeneratorRuntime","accidentalStrictMode","globalThis","Function","Kind","ROUTE","createRoute","navigateFx","createEffect","params","query","openFx","attach","effect","mapParams","$isOpened","createStore","$params","$query","opened","createEvent","updated","left","closed","on","_","split","source","doneData","match","map","isOpened","cases","sample","clock","target","navigate","open","kind","buildPath","compile","pathCreator","URLSearchParams","matchPath","actualPath","matches","URL","pathname","equals","a","b","k","historyPushFx","pushParams","history","path","isRoute","route","toStore","payload","is","store","chainedRoute","beforeOpen","openOn","cancelOn","effectParams","failData","advancedParams","normalizeChainRouteParams","$hasSameParams","combine","current","stored","routeOpened","_prev","chainedRouteResolved","guard","filter","aborted","merge","remappedRoutes","objects","routeObj","Array","isArray","remapRouteObjects","routes","setHistory","routeNotFound","$path","$activeRoutes","serialize","$history","nextHistory","pushFx","openedFx","recalculateFx","recheckResult","routesOpened","routesClosed","$isOpenedManually","navigatedManually","containsCurrentRoute","recheckResults","find","recheckLifecycle","filterMap","isOpenedManually","restore","recheckFx","location","fromEntries","search","subscribeHistoryFx","scopedRecheck","scopeBind","listen","hydrate","options"],"mappings":"09CAOA,IAAIA,EAAW,SAAUC,GAGvB,IAAIC,EAAKC,OAAOC,UACZC,EAASH,EAAGI,eAE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CACLC,MAAOgF,EAAmBtF,SAC1BO,OAAQ2E,yBAIZ7E,eAAO,CACLC,MAAO2D,EACP1D,OAAQ+E,yBAGH,CACLxB,MAAAA,EACAxE,OAAAA,EACAyE,cAAAA,EACAE,SAAAA,EACAL,WAAAA,EACAvI,KAAM8I,EACNR,OAAQN,EACRQ,cAAAA,iFEzToB,SAAY8B,OAC5BrF,EAAQqF,EAAQrF,MAClBD,eAAO,CAAEC,MAAOqF,EAAQrF,0CACxBd,4CACAX,EAASiD,EAAQ6D,EAAQ9G,QAAU,IACnCC,EAAQgD,EAAQ6D,EAAQ7G,OAAS,WAErCuB,eAAO,CACLC,MAAOA,EACPP,OAAQ,CAAElB,OAAAA,EAAQC,MAAAA,GAClB/F,GAAI,WAAoBuH,OAAjBzB,IAAAA,OAAQC,IAAAA,YAAoB,CACjCD,OAA0B,mBAAXA,EAAwBA,EAAOyB,GAASzB,EACvDC,MAAwB,mBAAVA,EAAuBA,EAAMwB,GAASxB,IAEtDyB,OAAQoF,EAAQ9D,MAAMrB,gCAEjBF"} |
@@ -1,2 +0,2 @@ | ||
| import { createEffect, attach, createStore, createEvent, split, sample, guard, scopeBind, is, combine, merge, withFactory } from 'effector'; | ||
| import { createEffect, attach, createStore, createEvent, split, sample, guard, restore, scopeBind, is, combine, merge, withFactory } from 'effector'; | ||
| import { compile, match } from 'path-to-regexp'; | ||
@@ -1022,2 +1022,16 @@ | ||
| var equals = function equals(a, b) { | ||
| if (Object.keys(a).length !== Object.keys(b).length) { | ||
| return false; | ||
| } | ||
| for (var k in a) { | ||
| if (a[k] !== b[k]) { | ||
| return false; | ||
| } | ||
| } | ||
| return true; | ||
| }; | ||
| var historyPushFx = /*#__PURE__*/createEffect(function (pushParams) { | ||
@@ -1032,3 +1046,3 @@ if (!pushParams.history) { | ||
| name: "historyPushFx", | ||
| sid: "sn2691" | ||
| sid: "t43sn8" | ||
| }); | ||
@@ -1065,15 +1079,15 @@ | ||
| name: "setHistory", | ||
| sid: "-d2vpek" | ||
| sid: "-clu30d" | ||
| }); | ||
| var routeNotFound = createEvent({ | ||
| name: "routeNotFound", | ||
| sid: "-y4sqp2" | ||
| sid: "-xnr4av" | ||
| }); | ||
| var $query = createStore({}, { | ||
| name: "$query", | ||
| sid: "hnxt1l" | ||
| sid: "i4zffs" | ||
| }); | ||
| var $path = createStore('', { | ||
| name: "$path", | ||
| sid: "-sa8poc" | ||
| sid: "-rt73a5" | ||
| }); | ||
@@ -1085,3 +1099,3 @@ var $activeRoutes = createStore([], { | ||
| name: "$activeRoutes", | ||
| sid: "62zlkr" | ||
| sid: "ghza91" | ||
| }); // @ts-expect-error | ||
@@ -1094,3 +1108,3 @@ | ||
| name: "$history", | ||
| sid: "-7y2vlh" | ||
| sid: "-7h197a" | ||
| }); | ||
@@ -1116,3 +1130,3 @@ $history.on(setHistory, function (_, nextHistory) { | ||
| name: "pushFx", | ||
| sid: "e2mlkx" | ||
| sid: "ejo7z4" | ||
| } | ||
@@ -1138,3 +1152,3 @@ }); // Triggered whenever some route.navigate.doneData is triggered | ||
| name: "openedFx", | ||
| sid: "171qv8" | ||
| sid: "1o3d9f" | ||
| }); // Recalculate opened/closed routes | ||
@@ -1171,3 +1185,3 @@ | ||
| name: "recalculateFx", | ||
| sid: "-8daxxq" | ||
| sid: "-7w9bjj" | ||
| }); | ||
@@ -1194,3 +1208,3 @@ $path.on(recalculateFx.done, function (_prev, _ref4) { | ||
| or: { | ||
| sid: "7csm23" | ||
| sid: "7dceng" | ||
| } | ||
@@ -1213,3 +1227,3 @@ }); // sample({ | ||
| or: { | ||
| sid: "7tafux" | ||
| sid: "7tu8ga" | ||
| } | ||
@@ -1230,3 +1244,3 @@ }); | ||
| name: "$isOpenedManually", | ||
| sid: "by1u5o" | ||
| sid: "cf3gjv" | ||
| }); // Watch for route.navigate.doneData to build new path and push | ||
@@ -1251,3 +1265,3 @@ | ||
| or: { | ||
| sid: "-jxfhr2" | ||
| sid: "-jwvp5p" | ||
| } | ||
@@ -1272,3 +1286,3 @@ }); | ||
| name: "opened", | ||
| sid: "-6e1ik" | ||
| sid: "ankvn" | ||
| } | ||
@@ -1283,3 +1297,3 @@ }), | ||
| name: "updated", | ||
| sid: "-y6s1fj" | ||
| sid: "-xpqf1c" | ||
| } | ||
@@ -1294,3 +1308,3 @@ }), | ||
| name: "closed", | ||
| sid: "2bzoi7" | ||
| sid: "2t1awe" | ||
| } | ||
@@ -1304,3 +1318,3 @@ }) | ||
| guard({ | ||
| var updated = guard({ | ||
| and: [{ | ||
@@ -1310,7 +1324,38 @@ clock: recheckLifecycle.updated, | ||
| return !isOpenedManually; | ||
| }) | ||
| }], | ||
| or: { | ||
| name: "updated", | ||
| sid: "-i38vyc" | ||
| } | ||
| }); | ||
| sample({ | ||
| and: [{ | ||
| source: restore(updated, null, { | ||
| name: "source", | ||
| sid: "-1th5mi" | ||
| }), | ||
| clock: guard({ | ||
| and: [{ | ||
| clock: updated, | ||
| source: [routeObj.route.$params, routeObj.route.$query], | ||
| // Skip .updated() calls if params & query are the same | ||
| filter: function filter(_ref14, next) { | ||
| var params = _ref14[0], | ||
| query = _ref14[1]; | ||
| return !equals(params, next.params) || !equals(query, next.query); | ||
| } | ||
| }], | ||
| or: { | ||
| name: "clock", | ||
| sid: "cdcuni" | ||
| } | ||
| }), | ||
| fn: function fn(payload) { | ||
| return payload; | ||
| }, | ||
| target: routeObj.route.updated | ||
| }], | ||
| or: { | ||
| sid: "-iiuf5u" | ||
| sid: "-i4jrqg" | ||
| } | ||
@@ -1328,3 +1373,3 @@ }); // Trigger .opened() for the routes marked as "opened" | ||
| or: { | ||
| sid: "-i3zz53" | ||
| sid: "-hlayyt" | ||
| } | ||
@@ -1339,3 +1384,3 @@ }); // Trigger .closed() for the routes marked as "closed" | ||
| or: { | ||
| sid: "-i0p7kx" | ||
| sid: "-h6giy2" | ||
| } | ||
@@ -1349,3 +1394,3 @@ }); // Reset $isOpenedManually | ||
| or: { | ||
| sid: "lycydm" | ||
| sid: "-wz7y6w" | ||
| } | ||
@@ -1399,3 +1444,3 @@ })); | ||
| name: "recheckFx", | ||
| sid: "-aaaqj8" | ||
| sid: "fr6h5h" | ||
| } | ||
@@ -1409,3 +1454,3 @@ }); | ||
| or: { | ||
| sid: "-gnriv8" | ||
| sid: "-g52ioy" | ||
| } | ||
@@ -1456,3 +1501,3 @@ }); // Triggered whenever history instance is set | ||
| name: "subscribeHistoryFx", | ||
| sid: "-ec82v1" | ||
| sid: "bp94to" | ||
| } | ||
@@ -1469,3 +1514,3 @@ }); // If `hydrate` flag is set, | ||
| or: { | ||
| sid: "-fmxb0l" | ||
| sid: "-4uqk3n" | ||
| } | ||
@@ -1481,3 +1526,3 @@ }); | ||
| or: { | ||
| sid: "-5aolek" | ||
| sid: "-4rzl8a" | ||
| } | ||
@@ -1484,0 +1529,0 @@ }); |
+1
-1
| { | ||
| "version": "0.5.0-dev.9", | ||
| "version": "0.5.0-dev.10", | ||
| "license": "MIT", | ||
@@ -4,0 +4,0 @@ "main": "dist/index.js", |
@@ -12,3 +12,5 @@ import { buildPath, matchPath } from './utils/build-path'; | ||
| scopeBind, | ||
| restore, | ||
| } from 'effector'; | ||
| import { equals } from './utils/equals'; | ||
@@ -222,5 +224,18 @@ type RouteObject<Params extends RouteParams> = { | ||
| // Trigger .updated() for already opened routes marked as "opened" | ||
| guard({ | ||
| const updated = guard({ | ||
| clock: recheckLifecycle.updated, | ||
| filter: $isOpenedManually.map(isOpenedManually => !isOpenedManually), | ||
| }); | ||
| sample({ | ||
| source: restore(updated, null), | ||
| clock: guard({ | ||
| clock: updated, | ||
| source: [routeObj.route.$params, routeObj.route.$query], | ||
| // Skip .updated() calls if params & query are the same | ||
| filter: ([params, query], next) => { | ||
| return !equals(params, next.params) || !equals(query, next.query); | ||
| }, | ||
| }), | ||
| fn: payload => payload!, | ||
| target: routeObj.route.updated, | ||
@@ -227,0 +242,0 @@ }); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
372473
2.22%28
7.69%3958
2.91%