@sasha.p/react-router-persistent-state 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1 @@
1
- (function(nt,_t){typeof exports=="object"&&typeof module<"u"?_t(exports,require("react"),require("react-dom"),require("react-router")):typeof define=="function"&&define.amd?define(["exports","react","react-dom","react-router"],_t):(nt=typeof globalThis<"u"?globalThis:nt||self,_t(nt.ReactRouterPersistentState={},nt.React,nt.ReactDOM,nt.reactRouter))})(this,(function(nt,_t,oa,R){"use strict";function bn(a){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const f in a)if(f!=="default"){const l=Object.getOwnPropertyDescriptor(a,f);Object.defineProperty(u,f,l.get?l:{enumerable:!0,get:()=>a[f]})}}return u.default=a,Object.freeze(u)}const j=bn(_t);function cn(a,u){return Object.keys(a).reduce((f,l)=>({...f,[l]:a[l].deserialize(u.get(l))}),{})}function wn(a,u){return Object.keys(a).reduce((f,l)=>({...f,[l]:u[l]!==void 0?a[l].serialize(u[l]):void 0}),{})}function Sn(a,{get:u,save:f}){const l=Object.keys(a).join(),[s,p]=_t.useState(()=>Object.keys(a).reduce((g,v)=>{const h=u(v);return g[v]=a[v].deserialize(h),g},{})),d=_t.useCallback(g=>{p(v=>{const h=typeof g=="function"?g(v):g,S={...cn(a,{get:()=>null}),...h};return f(wn(a,S)),S})},[l]);return[s,d]}var le=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},pe={exports:{}};pe.exports;var fn;function On(){return fn||(fn=1,(function(a,u){var f=200,l="Expected a function",s="__lodash_hash_undefined__",p=1,d=2,g=9007199254740991,v="[object Arguments]",h="[object Array]",S="[object Boolean]",P="[object Date]",x="[object Error]",J="[object Function]",B="[object GeneratorFunction]",F="[object Map]",Z="[object Number]",I="[object Object]",C="[object Promise]",L="[object RegExp]",A="[object Set]",at="[object String]",ot="[object Symbol]",it="[object WeakMap]",ut="[object ArrayBuffer]",Q="[object DataView]",mt="[object Float32Array]",$t="[object Float64Array]",Oe="[object Int8Array]",Ee="[object Int16Array]",Ae="[object Int32Array]",Pe="[object Uint8Array]",xe="[object Uint8ClampedArray]",Ce="[object Uint16Array]",Te="[object Uint32Array]",Ne=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Le=/^\w*$/,Re=/^\./,je=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,De=/[\\^$.*+?()[\]{}|]/g,Ie=/\\(\\)?/g,Fe=/^\[object .+?Constructor\]$/,Ue=/^(?:0|[1-9]\d*)$/,y={};y[mt]=y[$t]=y[Oe]=y[Ee]=y[Ae]=y[Pe]=y[xe]=y[Ce]=y[Te]=!0,y[v]=y[h]=y[ut]=y[S]=y[Q]=y[P]=y[x]=y[J]=y[F]=y[Z]=y[I]=y[L]=y[A]=y[at]=y[it]=!1;var Kt=typeof le=="object"&&le&&le.Object===Object&&le,Me=typeof self=="object"&&self&&self.Object===Object&&self,V=Kt||Me||Function("return this")(),Bt=u&&!u.nodeType&&u,Vt=Bt&&!0&&a&&!a.nodeType&&a,$e=Vt&&Vt.exports===Bt,Wt=$e&&Kt.process,Gt=(function(){try{return Wt&&Wt.binding("util")}catch{}})(),Ht=Gt&&Gt.isTypedArray;function qt(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}function Ke(t,e){for(var r=-1,n=t?t.length:0;++r<n;)if(e(t[r],r,t))return!0;return!1}function Be(t){return function(e){return e?.[t]}}function Ve(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function We(t){return function(e){return t(e)}}function Ge(t,e){return t?.[e]}function bt(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function He(t){var e=-1,r=Array(t.size);return t.forEach(function(n,o){r[++e]=[o,n]}),r}function wt(t,e){return function(r){return t(e(r))}}function qe(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var ze=Array.prototype,ke=Function.prototype,st=Object.prototype,St=V["__core-js_shared__"],zt=(function(){var t=/[^.]+$/.exec(St&&St.keys&&St.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})(),kt=ke.toString,D=st.hasOwnProperty,X=st.toString,Je=RegExp("^"+kt.call(D).replace(De,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Jt=V.Symbol,Xt=V.Uint8Array,Xe=wt(Object.getPrototypeOf,Object),Ye=st.propertyIsEnumerable,Ze=ze.splice,Ot=Object.getOwnPropertySymbols,Qe=wt(Object.keys,Object),Et=Y(V,"DataView"),tt=Y(V,"Map"),At=Y(V,"Promise"),Pt=Y(V,"Set"),xt=Y(V,"WeakMap"),et=Y(Object,"create"),tr=z(Et),er=z(tt),rr=z(At),nr=z(Pt),ar=z(xt),ct=Jt?Jt.prototype:void 0,Ct=ct?ct.valueOf:void 0,Yt=ct?ct.toString:void 0;function q(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function ir(){this.__data__=et?et(null):{}}function or(t){return this.has(t)&&delete this.__data__[t]}function ur(t){var e=this.__data__;if(et){var r=e[t];return r===s?void 0:r}return D.call(e,t)?e[t]:void 0}function sr(t){var e=this.__data__;return et?e[t]!==void 0:D.call(e,t)}function cr(t,e){var r=this.__data__;return r[t]=et&&e===void 0?s:e,this}q.prototype.clear=ir,q.prototype.delete=or,q.prototype.get=ur,q.prototype.has=sr,q.prototype.set=cr;function U(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function fr(){this.__data__=[]}function lr(t){var e=this.__data__,r=lt(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Ze.call(e,r,1),!0}function pr(t){var e=this.__data__,r=lt(e,t);return r<0?void 0:e[r][1]}function dr(t){return lt(this.__data__,t)>-1}function hr(t,e){var r=this.__data__,n=lt(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}U.prototype.clear=fr,U.prototype.delete=lr,U.prototype.get=pr,U.prototype.has=dr,U.prototype.set=hr;function M(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function yr(){this.__data__={hash:new q,map:new(tt||U),string:new q}}function gr(t){return pt(this,t).delete(t)}function vr(t){return pt(this,t).get(t)}function _r(t){return pt(this,t).has(t)}function mr(t,e){return pt(this,t).set(t,e),this}M.prototype.clear=yr,M.prototype.delete=gr,M.prototype.get=vr,M.prototype.has=_r,M.prototype.set=mr;function ft(t){var e=-1,r=t?t.length:0;for(this.__data__=new M;++e<r;)this.add(t[e])}function br(t){return this.__data__.set(t,s),this}function wr(t){return this.__data__.has(t)}ft.prototype.add=ft.prototype.push=br,ft.prototype.has=wr;function $(t){this.__data__=new U(t)}function Sr(){this.__data__=new U}function Or(t){return this.__data__.delete(t)}function Er(t){return this.__data__.get(t)}function Ar(t){return this.__data__.has(t)}function Pr(t,e){var r=this.__data__;if(r instanceof U){var n=r.__data__;if(!tt||n.length<f-1)return n.push([t,e]),this;r=this.__data__=new M(n)}return r.set(t,e),this}$.prototype.clear=Sr,$.prototype.delete=Or,$.prototype.get=Er,$.prototype.has=Ar,$.prototype.set=Pr;function Zt(t,e){var r=G(t)||ue(t)?Ve(t.length,String):[],n=r.length,o=!!n;for(var i in t)(e||D.call(t,i))&&!(o&&(i=="length"||re(i,n)))&&r.push(i);return r}function lt(t,e){for(var r=t.length;r--;)if(oe(t[r][0],e))return r;return-1}function Qt(t,e){e=dt(e,t)?[e]:te(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[ht(e[r++])];return r&&r==n?t:void 0}function xr(t,e,r){var n=e(t);return G(t)?n:qt(n,r(t))}function Cr(t){return X.call(t)}function Tr(t,e){return t!=null&&e in Object(t)}function Tt(t,e,r,n,o){return t===e?!0:t==null||e==null||!rt(t)&&!yt(e)?t!==t&&e!==e:Nr(t,e,Tt,r,n,o)}function Nr(t,e,r,n,o,i){var c=G(t),_=G(e),m=h,b=h;c||(m=W(t),m=m==v?I:m),_||(b=W(e),b=b==v?I:b);var O=m==I&&!bt(t),E=b==I&&!bt(e),w=m==b;if(w&&!O)return i||(i=new $),c||tn(t)?ee(t,e,r,n,o,i):Vr(t,e,m,r,n,o,i);if(!(o&d)){var T=O&&D.call(t,"__wrapped__"),N=E&&D.call(e,"__wrapped__");if(T||N){var H=T?t.value():t,K=N?e.value():e;return i||(i=new $),r(H,K,n,o,i)}}return w?(i||(i=new $),Wr(t,e,r,n,o,i)):!1}function Lr(t,e,r,n){var o=r.length,i=o;if(t==null)return!i;for(t=Object(t);o--;){var c=r[o];if(c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++o<i;){c=r[o];var _=c[0],m=t[_],b=c[1];if(c[2]){if(m===void 0&&!(_ in t))return!1}else{var O=new $,E;if(!(E===void 0?Tt(b,m,n,p|d,O):E))return!1}}return!0}function Rr(t){if(!rt(t)||Xr(t))return!1;var e=se(t)||bt(t)?Je:Fe;return e.test(z(t))}function jr(t){return yt(t)&&Rt(t.length)&&!!y[X.call(t)]}function Dr(t){return typeof t=="function"?t:t==null?un:typeof t=="object"?G(t)?Mr(t[0],t[1]):Ur(t):sn(t)}function Ir(t){if(!ne(t))return Qe(t);var e=[];for(var r in Object(t))D.call(t,r)&&r!="constructor"&&e.push(r);return e}function Fr(t){if(!rt(t))return Yr(t);var e=ne(t),r=[];for(var n in t)n=="constructor"&&(e||!D.call(t,n))||r.push(n);return r}function Ur(t){var e=Hr(t);return e.length==1&&e[0][2]?ie(e[0][0],e[0][1]):function(r){return r===t||Lr(r,t,e)}}function Mr(t,e){return dt(t)&&ae(e)?ie(ht(t),e):function(r){var n=rn(r,t);return n===void 0&&n===e?nn(r,t):Tt(e,n,void 0,p|d)}}function $r(t,e,r){for(var n=-1,o=e.length,i={};++n<o;){var c=e[n],_=t[c];r(_,c)&&(i[c]=_)}return i}function Kr(t){return function(e){return Qt(e,t)}}function Br(t){if(typeof t=="string")return t;if(jt(t))return Yt?Yt.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function te(t){return G(t)?t:Zr(t)}function ee(t,e,r,n,o,i){var c=o&d,_=t.length,m=e.length;if(_!=m&&!(c&&m>_))return!1;var b=i.get(t);if(b&&i.get(e))return b==e;var O=-1,E=!0,w=o&p?new ft:void 0;for(i.set(t,e),i.set(e,t);++O<_;){var T=t[O],N=e[O];if(n)var H=c?n(N,T,O,e,t,i):n(T,N,O,t,e,i);if(H!==void 0){if(H)continue;E=!1;break}if(w){if(!Ke(e,function(K,k){if(!w.has(k)&&(T===K||r(T,K,n,o,i)))return w.add(k)})){E=!1;break}}else if(!(T===N||r(T,N,n,o,i))){E=!1;break}}return i.delete(t),i.delete(e),E}function Vr(t,e,r,n,o,i,c){switch(r){case Q:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case ut:return!(t.byteLength!=e.byteLength||!n(new Xt(t),new Xt(e)));case S:case P:case Z:return oe(+t,+e);case x:return t.name==e.name&&t.message==e.message;case L:case at:return t==e+"";case F:var _=He;case A:var m=i&d;if(_||(_=qe),t.size!=e.size&&!m)return!1;var b=c.get(t);if(b)return b==e;i|=p,c.set(t,e);var O=ee(_(t),_(e),n,o,i,c);return c.delete(t),O;case ot:if(Ct)return Ct.call(t)==Ct.call(e)}return!1}function Wr(t,e,r,n,o,i){var c=o&d,_=Dt(t),m=_.length,b=Dt(e),O=b.length;if(m!=O&&!c)return!1;for(var E=m;E--;){var w=_[E];if(!(c?w in e:D.call(e,w)))return!1}var T=i.get(t);if(T&&i.get(e))return T==e;var N=!0;i.set(t,e),i.set(e,t);for(var H=c;++E<m;){w=_[E];var K=t[w],k=e[w];if(n)var fe=c?n(k,K,w,e,t,i):n(K,k,w,t,e,i);if(!(fe===void 0?K===k||r(K,k,n,o,i):fe)){N=!1;break}H||(H=w=="constructor")}if(N&&!H){var gt=t.constructor,vt=e.constructor;gt!=vt&&"constructor"in t&&"constructor"in e&&!(typeof gt=="function"&&gt instanceof gt&&typeof vt=="function"&&vt instanceof vt)&&(N=!1)}return i.delete(t),i.delete(e),N}function Gr(t){return xr(t,an,zr)}function pt(t,e){var r=t.__data__;return Jr(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Hr(t){for(var e=Dt(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,ae(o)]}return e}function Y(t,e){var r=Ge(t,e);return Rr(r)?r:void 0}var qr=Ot?wt(Ot,Object):ce,zr=Ot?function(t){for(var e=[];t;)qt(e,qr(t)),t=Xe(t);return e}:ce,W=Cr;(Et&&W(new Et(new ArrayBuffer(1)))!=Q||tt&&W(new tt)!=F||At&&W(At.resolve())!=C||Pt&&W(new Pt)!=A||xt&&W(new xt)!=it)&&(W=function(t){var e=X.call(t),r=e==I?t.constructor:void 0,n=r?z(r):void 0;if(n)switch(n){case tr:return Q;case er:return F;case rr:return C;case nr:return A;case ar:return it}return e});function kr(t,e,r){e=dt(e,t)?[e]:te(e);for(var n,o=-1,c=e.length;++o<c;){var i=ht(e[o]);if(!(n=t!=null&&r(t,i)))break;t=t[i]}if(n)return n;var c=t?t.length:0;return!!c&&Rt(c)&&re(i,c)&&(G(t)||ue(t))}function re(t,e){return e=e??g,!!e&&(typeof t=="number"||Ue.test(t))&&t>-1&&t%1==0&&t<e}function dt(t,e){if(G(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||jt(t)?!0:Le.test(t)||!Ne.test(t)||e!=null&&t in Object(e)}function Jr(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Xr(t){return!!zt&&zt in t}function ne(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||st;return t===r}function ae(t){return t===t&&!rt(t)}function ie(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function Yr(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Zr=Nt(function(t){t=en(t);var e=[];return Re.test(t)&&e.push(""),t.replace(je,function(r,n,o,i){e.push(o?i.replace(Ie,"$1"):n||r)}),e});function ht(t){if(typeof t=="string"||jt(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function z(t){if(t!=null){try{return kt.call(t)}catch{}try{return t+""}catch{}}return""}function Nt(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(l);var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var c=t.apply(this,n);return r.cache=i.set(o,c),c};return r.cache=new(Nt.Cache||M),r}Nt.Cache=M;function oe(t,e){return t===e||t!==t&&e!==e}function ue(t){return Qr(t)&&D.call(t,"callee")&&(!Ye.call(t,"callee")||X.call(t)==v)}var G=Array.isArray;function Lt(t){return t!=null&&Rt(t.length)&&!se(t)}function Qr(t){return yt(t)&&Lt(t)}function se(t){var e=rt(t)?X.call(t):"";return e==J||e==B}function Rt(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=g}function rt(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function yt(t){return!!t&&typeof t=="object"}function jt(t){return typeof t=="symbol"||yt(t)&&X.call(t)==ot}var tn=Ht?We(Ht):jr;function en(t){return t==null?"":Br(t)}function rn(t,e,r){var n=t==null?void 0:Qt(t,e);return n===void 0?r:n}function nn(t,e){return t!=null&&kr(t,e,Tr)}function Dt(t){return Lt(t)?Zt(t):Ir(t)}function an(t){return Lt(t)?Zt(t,!0):Fr(t)}function on(t,e){return t==null?{}:$r(t,Gr(t),Dr(e))}function un(t){return t}function sn(t){return dt(t)?Be(ht(t)):Kr(t)}function ce(){return[]}a.exports=on})(pe,pe.exports)),pe.exports}On();var de=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function En(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Mt={exports:{}};Mt.exports;var ln;function An(){return ln||(ln=1,(function(a,u){var f=200,l="Expected a function",s="__lodash_hash_undefined__",p=1,d=2,g=9007199254740991,v="[object Arguments]",h="[object Array]",S="[object Boolean]",P="[object Date]",x="[object Error]",J="[object Function]",B="[object GeneratorFunction]",F="[object Map]",Z="[object Number]",I="[object Object]",C="[object Promise]",L="[object RegExp]",A="[object Set]",at="[object String]",ot="[object Symbol]",it="[object WeakMap]",ut="[object ArrayBuffer]",Q="[object DataView]",mt="[object Float32Array]",$t="[object Float64Array]",Oe="[object Int8Array]",Ee="[object Int16Array]",Ae="[object Int32Array]",Pe="[object Uint8Array]",xe="[object Uint8ClampedArray]",Ce="[object Uint16Array]",Te="[object Uint32Array]",Ne=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Le=/^\w*$/,Re=/^\./,je=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,De=/[\\^$.*+?()[\]{}|]/g,Ie=/\\(\\)?/g,Fe=/^\[object .+?Constructor\]$/,Ue=/^(?:0|[1-9]\d*)$/,y={};y[mt]=y[$t]=y[Oe]=y[Ee]=y[Ae]=y[Pe]=y[xe]=y[Ce]=y[Te]=!0,y[v]=y[h]=y[ut]=y[S]=y[Q]=y[P]=y[x]=y[J]=y[F]=y[Z]=y[I]=y[L]=y[A]=y[at]=y[it]=!1;var Kt=typeof de=="object"&&de&&de.Object===Object&&de,Me=typeof self=="object"&&self&&self.Object===Object&&self,V=Kt||Me||Function("return this")(),Bt=u&&!u.nodeType&&u,Vt=Bt&&!0&&a&&!a.nodeType&&a,$e=Vt&&Vt.exports===Bt,Wt=$e&&Kt.process,Gt=(function(){try{return Wt&&Wt.binding("util")}catch{}})(),Ht=Gt&&Gt.isTypedArray;function qt(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}function Ke(t,e){for(var r=-1,n=t?t.length:0;++r<n;)if(e(t[r],r,t))return!0;return!1}function Be(t){return function(e){return e?.[t]}}function Ve(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function We(t){return function(e){return t(e)}}function Ge(t,e){return t?.[e]}function bt(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function He(t){var e=-1,r=Array(t.size);return t.forEach(function(n,o){r[++e]=[o,n]}),r}function wt(t,e){return function(r){return t(e(r))}}function qe(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var ze=Array.prototype,ke=Function.prototype,st=Object.prototype,St=V["__core-js_shared__"],zt=(function(){var t=/[^.]+$/.exec(St&&St.keys&&St.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})(),kt=ke.toString,D=st.hasOwnProperty,X=st.toString,Je=RegExp("^"+kt.call(D).replace(De,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Jt=V.Symbol,Xt=V.Uint8Array,Xe=wt(Object.getPrototypeOf,Object),Ye=st.propertyIsEnumerable,Ze=ze.splice,Ot=Object.getOwnPropertySymbols,Qe=wt(Object.keys,Object),Et=Y(V,"DataView"),tt=Y(V,"Map"),At=Y(V,"Promise"),Pt=Y(V,"Set"),xt=Y(V,"WeakMap"),et=Y(Object,"create"),tr=z(Et),er=z(tt),rr=z(At),nr=z(Pt),ar=z(xt),ct=Jt?Jt.prototype:void 0,Ct=ct?ct.valueOf:void 0,Yt=ct?ct.toString:void 0;function q(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function ir(){this.__data__=et?et(null):{}}function or(t){return this.has(t)&&delete this.__data__[t]}function ur(t){var e=this.__data__;if(et){var r=e[t];return r===s?void 0:r}return D.call(e,t)?e[t]:void 0}function sr(t){var e=this.__data__;return et?e[t]!==void 0:D.call(e,t)}function cr(t,e){var r=this.__data__;return r[t]=et&&e===void 0?s:e,this}q.prototype.clear=ir,q.prototype.delete=or,q.prototype.get=ur,q.prototype.has=sr,q.prototype.set=cr;function U(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function fr(){this.__data__=[]}function lr(t){var e=this.__data__,r=lt(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():Ze.call(e,r,1),!0}function pr(t){var e=this.__data__,r=lt(e,t);return r<0?void 0:e[r][1]}function dr(t){return lt(this.__data__,t)>-1}function hr(t,e){var r=this.__data__,n=lt(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}U.prototype.clear=fr,U.prototype.delete=lr,U.prototype.get=pr,U.prototype.has=dr,U.prototype.set=hr;function M(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function yr(){this.__data__={hash:new q,map:new(tt||U),string:new q}}function gr(t){return pt(this,t).delete(t)}function vr(t){return pt(this,t).get(t)}function _r(t){return pt(this,t).has(t)}function mr(t,e){return pt(this,t).set(t,e),this}M.prototype.clear=yr,M.prototype.delete=gr,M.prototype.get=vr,M.prototype.has=_r,M.prototype.set=mr;function ft(t){var e=-1,r=t?t.length:0;for(this.__data__=new M;++e<r;)this.add(t[e])}function br(t){return this.__data__.set(t,s),this}function wr(t){return this.__data__.has(t)}ft.prototype.add=ft.prototype.push=br,ft.prototype.has=wr;function $(t){this.__data__=new U(t)}function Sr(){this.__data__=new U}function Or(t){return this.__data__.delete(t)}function Er(t){return this.__data__.get(t)}function Ar(t){return this.__data__.has(t)}function Pr(t,e){var r=this.__data__;if(r instanceof U){var n=r.__data__;if(!tt||n.length<f-1)return n.push([t,e]),this;r=this.__data__=new M(n)}return r.set(t,e),this}$.prototype.clear=Sr,$.prototype.delete=Or,$.prototype.get=Er,$.prototype.has=Ar,$.prototype.set=Pr;function Zt(t,e){var r=G(t)||ue(t)?Ve(t.length,String):[],n=r.length,o=!!n;for(var i in t)(e||D.call(t,i))&&!(o&&(i=="length"||re(i,n)))&&r.push(i);return r}function lt(t,e){for(var r=t.length;r--;)if(oe(t[r][0],e))return r;return-1}function Qt(t,e){e=dt(e,t)?[e]:te(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[ht(e[r++])];return r&&r==n?t:void 0}function xr(t,e,r){var n=e(t);return G(t)?n:qt(n,r(t))}function Cr(t){return X.call(t)}function Tr(t,e){return t!=null&&e in Object(t)}function Tt(t,e,r,n,o){return t===e?!0:t==null||e==null||!rt(t)&&!yt(e)?t!==t&&e!==e:Nr(t,e,Tt,r,n,o)}function Nr(t,e,r,n,o,i){var c=G(t),_=G(e),m=h,b=h;c||(m=W(t),m=m==v?I:m),_||(b=W(e),b=b==v?I:b);var O=m==I&&!bt(t),E=b==I&&!bt(e),w=m==b;if(w&&!O)return i||(i=new $),c||tn(t)?ee(t,e,r,n,o,i):Vr(t,e,m,r,n,o,i);if(!(o&d)){var T=O&&D.call(t,"__wrapped__"),N=E&&D.call(e,"__wrapped__");if(T||N){var H=T?t.value():t,K=N?e.value():e;return i||(i=new $),r(H,K,n,o,i)}}return w?(i||(i=new $),Wr(t,e,r,n,o,i)):!1}function Lr(t,e,r,n){var o=r.length,i=o;if(t==null)return!i;for(t=Object(t);o--;){var c=r[o];if(c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++o<i;){c=r[o];var _=c[0],m=t[_],b=c[1];if(c[2]){if(m===void 0&&!(_ in t))return!1}else{var O=new $,E;if(!(E===void 0?Tt(b,m,n,p|d,O):E))return!1}}return!0}function Rr(t){if(!rt(t)||Xr(t))return!1;var e=se(t)||bt(t)?Je:Fe;return e.test(z(t))}function jr(t){return yt(t)&&Rt(t.length)&&!!y[X.call(t)]}function Dr(t){return typeof t=="function"?t:t==null?un:typeof t=="object"?G(t)?Mr(t[0],t[1]):Ur(t):sn(t)}function Ir(t){if(!ne(t))return Qe(t);var e=[];for(var r in Object(t))D.call(t,r)&&r!="constructor"&&e.push(r);return e}function Fr(t){if(!rt(t))return Yr(t);var e=ne(t),r=[];for(var n in t)n=="constructor"&&(e||!D.call(t,n))||r.push(n);return r}function Ur(t){var e=Hr(t);return e.length==1&&e[0][2]?ie(e[0][0],e[0][1]):function(r){return r===t||Lr(r,t,e)}}function Mr(t,e){return dt(t)&&ae(e)?ie(ht(t),e):function(r){var n=rn(r,t);return n===void 0&&n===e?nn(r,t):Tt(e,n,void 0,p|d)}}function $r(t,e,r){for(var n=-1,o=e.length,i={};++n<o;){var c=e[n],_=t[c];r(_,c)&&(i[c]=_)}return i}function Kr(t){return function(e){return Qt(e,t)}}function Br(t){if(typeof t=="string")return t;if(jt(t))return Yt?Yt.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function te(t){return G(t)?t:Zr(t)}function ee(t,e,r,n,o,i){var c=o&d,_=t.length,m=e.length;if(_!=m&&!(c&&m>_))return!1;var b=i.get(t);if(b&&i.get(e))return b==e;var O=-1,E=!0,w=o&p?new ft:void 0;for(i.set(t,e),i.set(e,t);++O<_;){var T=t[O],N=e[O];if(n)var H=c?n(N,T,O,e,t,i):n(T,N,O,t,e,i);if(H!==void 0){if(H)continue;E=!1;break}if(w){if(!Ke(e,function(K,k){if(!w.has(k)&&(T===K||r(T,K,n,o,i)))return w.add(k)})){E=!1;break}}else if(!(T===N||r(T,N,n,o,i))){E=!1;break}}return i.delete(t),i.delete(e),E}function Vr(t,e,r,n,o,i,c){switch(r){case Q:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case ut:return!(t.byteLength!=e.byteLength||!n(new Xt(t),new Xt(e)));case S:case P:case Z:return oe(+t,+e);case x:return t.name==e.name&&t.message==e.message;case L:case at:return t==e+"";case F:var _=He;case A:var m=i&d;if(_||(_=qe),t.size!=e.size&&!m)return!1;var b=c.get(t);if(b)return b==e;i|=p,c.set(t,e);var O=ee(_(t),_(e),n,o,i,c);return c.delete(t),O;case ot:if(Ct)return Ct.call(t)==Ct.call(e)}return!1}function Wr(t,e,r,n,o,i){var c=o&d,_=Dt(t),m=_.length,b=Dt(e),O=b.length;if(m!=O&&!c)return!1;for(var E=m;E--;){var w=_[E];if(!(c?w in e:D.call(e,w)))return!1}var T=i.get(t);if(T&&i.get(e))return T==e;var N=!0;i.set(t,e),i.set(e,t);for(var H=c;++E<m;){w=_[E];var K=t[w],k=e[w];if(n)var fe=c?n(k,K,w,e,t,i):n(K,k,w,t,e,i);if(!(fe===void 0?K===k||r(K,k,n,o,i):fe)){N=!1;break}H||(H=w=="constructor")}if(N&&!H){var gt=t.constructor,vt=e.constructor;gt!=vt&&"constructor"in t&&"constructor"in e&&!(typeof gt=="function"&&gt instanceof gt&&typeof vt=="function"&&vt instanceof vt)&&(N=!1)}return i.delete(t),i.delete(e),N}function Gr(t){return xr(t,an,zr)}function pt(t,e){var r=t.__data__;return Jr(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Hr(t){for(var e=Dt(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,ae(o)]}return e}function Y(t,e){var r=Ge(t,e);return Rr(r)?r:void 0}var qr=Ot?wt(Ot,Object):ce,zr=Ot?function(t){for(var e=[];t;)qt(e,qr(t)),t=Xe(t);return e}:ce,W=Cr;(Et&&W(new Et(new ArrayBuffer(1)))!=Q||tt&&W(new tt)!=F||At&&W(At.resolve())!=C||Pt&&W(new Pt)!=A||xt&&W(new xt)!=it)&&(W=function(t){var e=X.call(t),r=e==I?t.constructor:void 0,n=r?z(r):void 0;if(n)switch(n){case tr:return Q;case er:return F;case rr:return C;case nr:return A;case ar:return it}return e});function kr(t,e,r){e=dt(e,t)?[e]:te(e);for(var n,o=-1,c=e.length;++o<c;){var i=ht(e[o]);if(!(n=t!=null&&r(t,i)))break;t=t[i]}if(n)return n;var c=t?t.length:0;return!!c&&Rt(c)&&re(i,c)&&(G(t)||ue(t))}function re(t,e){return e=e??g,!!e&&(typeof t=="number"||Ue.test(t))&&t>-1&&t%1==0&&t<e}function dt(t,e){if(G(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||jt(t)?!0:Le.test(t)||!Ne.test(t)||e!=null&&t in Object(e)}function Jr(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Xr(t){return!!zt&&zt in t}function ne(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||st;return t===r}function ae(t){return t===t&&!rt(t)}function ie(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function Yr(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}var Zr=Nt(function(t){t=en(t);var e=[];return Re.test(t)&&e.push(""),t.replace(je,function(r,n,o,i){e.push(o?i.replace(Ie,"$1"):n||r)}),e});function ht(t){if(typeof t=="string"||jt(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function z(t){if(t!=null){try{return kt.call(t)}catch{}try{return t+""}catch{}}return""}function Nt(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(l);var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var c=t.apply(this,n);return r.cache=i.set(o,c),c};return r.cache=new(Nt.Cache||M),r}Nt.Cache=M;function oe(t,e){return t===e||t!==t&&e!==e}function ue(t){return Qr(t)&&D.call(t,"callee")&&(!Ye.call(t,"callee")||X.call(t)==v)}var G=Array.isArray;function Lt(t){return t!=null&&Rt(t.length)&&!se(t)}function Qr(t){return yt(t)&&Lt(t)}function se(t){var e=rt(t)?X.call(t):"";return e==J||e==B}function Rt(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=g}function rt(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function yt(t){return!!t&&typeof t=="object"}function jt(t){return typeof t=="symbol"||yt(t)&&X.call(t)==ot}var tn=Ht?We(Ht):jr;function en(t){return t==null?"":Br(t)}function rn(t,e,r){var n=t==null?void 0:Qt(t,e);return n===void 0?r:n}function nn(t,e){return t!=null&&kr(t,e,Tr)}function Dt(t){return Lt(t)?Zt(t):Ir(t)}function an(t){return Lt(t)?Zt(t,!0):Fr(t)}function on(t,e){return t==null?{}:$r(t,Gr(t),Dr(e))}function un(t){return t}function sn(t){return dt(t)?Be(ht(t)):Kr(t)}function ce(){return[]}a.exports=on})(Mt,Mt.exports)),Mt.exports}var Pn=An();const xn=En(Pn);/**
2
- * @remix-run/router v1.23.0
3
- *
4
- * Copyright (c) Remix Software Inc.
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE.md file in the root directory of this source tree.
8
- *
9
- * @license MIT
10
- */var pn;(function(a){a.Pop="POP",a.Push="PUSH",a.Replace="REPLACE"})(pn||(pn={}));function It(a,u){throw new Error(u)}function he(a,u){if(!a){typeof console<"u"&&console.warn(u);try{throw new Error(u)}catch{}}}var dn;(function(a){a.data="data",a.deferred="deferred",a.redirect="redirect",a.error="error"})(dn||(dn={}));function hn(a,u){typeof a=="string"&&(a={path:a,caseSensitive:!1,end:!0});let[f,l]=Cn(a.path,a.caseSensitive,a.end),s=u.match(f);if(!s)return null;let p=s[0],d=p.replace(/(.)\/+$/,"$1"),g=s.slice(1);return{params:l.reduce((h,S,P)=>{let{paramName:x,isOptional:J}=S;if(x==="*"){let F=g[P]||"";d=p.slice(0,p.length-F.length).replace(/(.)\/+$/,"$1")}const B=g[P];return J&&!B?h[x]=void 0:h[x]=(B||"").replace(/%2F/g,"/"),h},{}),pathname:p,pathnameBase:d,pattern:a}}function Cn(a,u,f){u===void 0&&(u=!1),f===void 0&&(f=!0),he(a==="*"||!a.endsWith("*")||a.endsWith("/*"),'Route path "'+a+'" will be treated as if it were '+('"'+a.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+a.replace(/\*$/,"/*")+'".'));let l=[],s="^"+a.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,g,v)=>(l.push({paramName:g,isOptional:v!=null}),v?"/?([^\\/]+)?":"/([^\\/]+)"));return a.endsWith("*")?(l.push({paramName:"*"}),s+=a==="*"||a==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):f?s+="\\/*$":a!==""&&a!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,u?void 0:"i"),l]}function Ft(a,u){if(u==="/")return a;if(!a.toLowerCase().startsWith(u.toLowerCase()))return null;let f=u.endsWith("/")?u.length-1:u.length,l=a.charAt(f);return l&&l!=="/"?null:a.slice(f)||"/"}const Tn=a=>a.join("/").replace(/\/\/+/g,"/"),yn=["post","put","patch","delete"];new Set(yn);const Nn=["get",...yn];new Set(Nn);/**
11
- * React Router DOM v6.30.1
12
- *
13
- * Copyright (c) Remix Software Inc.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE.md file in the root directory of this source tree.
17
- *
18
- * @license MIT
19
- */function Ut(){return Ut=Object.assign?Object.assign.bind():function(a){for(var u=1;u<arguments.length;u++){var f=arguments[u];for(var l in f)Object.prototype.hasOwnProperty.call(f,l)&&(a[l]=f[l])}return a},Ut.apply(this,arguments)}function be(a,u){if(a==null)return{};var f={},l=Object.keys(a),s,p;for(p=0;p<l.length;p++)s=l[p],!(u.indexOf(s)>=0)&&(f[s]=a[s]);return f}const ye="get",ge="application/x-www-form-urlencoded";function ve(a){return a!=null&&typeof a.tagName=="string"}function Ln(a){return ve(a)&&a.tagName.toLowerCase()==="button"}function Rn(a){return ve(a)&&a.tagName.toLowerCase()==="form"}function jn(a){return ve(a)&&a.tagName.toLowerCase()==="input"}function Dn(a){return!!(a.metaKey||a.altKey||a.ctrlKey||a.shiftKey)}function In(a,u){return a.button===0&&(!u||u==="_self")&&!Dn(a)}function we(a){return a===void 0&&(a=""),new URLSearchParams(typeof a=="string"||Array.isArray(a)||a instanceof URLSearchParams?a:Object.keys(a).reduce((u,f)=>{let l=a[f];return u.concat(Array.isArray(l)?l.map(s=>[f,s]):[[f,l]])},[]))}function Fn(a,u){let f=we(a);return u&&u.forEach((l,s)=>{f.has(s)||u.getAll(s).forEach(p=>{f.append(s,p)})}),f}let _e=null;function Un(){if(_e===null)try{new FormData(document.createElement("form"),0),_e=!1}catch{_e=!0}return _e}const Mn=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Se(a){return a!=null&&!Mn.has(a)?(process.env.NODE_ENV!=="production"&&he(!1,'"'+a+'" is not a valid `encType` for `<Form>`/`<fetcher.Form>` '+('and will default to "'+ge+'"')),null):a}function $n(a,u){let f,l,s,p,d;if(Rn(a)){let g=a.getAttribute("action");l=g?Ft(g,u):null,f=a.getAttribute("method")||ye,s=Se(a.getAttribute("enctype"))||ge,p=new FormData(a)}else if(Ln(a)||jn(a)&&(a.type==="submit"||a.type==="image")){let g=a.form;if(g==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let v=a.getAttribute("formaction")||g.getAttribute("action");if(l=v?Ft(v,u):null,f=a.getAttribute("formmethod")||g.getAttribute("method")||ye,s=Se(a.getAttribute("formenctype"))||Se(g.getAttribute("enctype"))||ge,p=new FormData(g,a),!Un()){let{name:h,type:S,value:P}=a;if(S==="image"){let x=h?h+".":"";p.append(x+"x","0"),p.append(x+"y","0")}else h&&p.append(h,P)}}else{if(ve(a))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');f=ye,l=null,s=ge,d=a}return p&&s==="text/plain"&&(d=p,p=void 0),{action:l,method:f.toLowerCase(),encType:s,formData:p,body:d}}const Kn=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Bn=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],Vn=["fetcherKey","navigate","reloadDocument","replace","state","method","action","onSubmit","relative","preventScrollReset","viewTransition"],Wn="6";try{window.__reactRouterVersion=Wn}catch{}const gn=j.createContext({isTransitioning:!1});process.env.NODE_ENV!=="production"&&(gn.displayName="ViewTransition");const Gn=j.createContext(new Map);process.env.NODE_ENV!=="production"&&(Gn.displayName="Fetchers"),process.env.NODE_ENV;const Hn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",qn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,vn=j.forwardRef(function(u,f){let{onClick:l,relative:s,reloadDocument:p,replace:d,state:g,target:v,to:h,preventScrollReset:S,viewTransition:P}=u,x=be(u,Kn),{basename:J}=j.useContext(R.UNSAFE_NavigationContext),B,F=!1;if(typeof h=="string"&&qn.test(h)&&(B=h,Hn))try{let L=new URL(window.location.href),A=h.startsWith("//")?new URL(L.protocol+h):new URL(h),at=Ft(A.pathname,J);A.origin===L.origin&&at!=null?h=at+A.search+A.hash:F=!0}catch{process.env.NODE_ENV!=="production"&&he(!1,'<Link to="'+h+'"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.')}let Z=R.useHref(h,{relative:s}),I=Xn(h,{replace:d,state:g,target:v,preventScrollReset:S,relative:s,viewTransition:P});function C(L){l&&l(L),L.defaultPrevented||I(L)}return j.createElement("a",Ut({},x,{href:B||Z,onClick:F||p?l:C,ref:f,target:v}))});process.env.NODE_ENV!=="production"&&(vn.displayName="Link");const zn=j.forwardRef(function(u,f){let{"aria-current":l="page",caseSensitive:s=!1,className:p="",end:d=!1,style:g,to:v,viewTransition:h,children:S}=u,P=be(u,Bn),x=R.useResolvedPath(v,{relative:P.relative}),J=R.useLocation(),B=j.useContext(R.UNSAFE_DataRouterStateContext),{navigator:F,basename:Z}=j.useContext(R.UNSAFE_NavigationContext),I=B!=null&&na(x)&&h===!0,C=F.encodeLocation?F.encodeLocation(x).pathname:x.pathname,L=J.pathname,A=B&&B.navigation&&B.navigation.location?B.navigation.location.pathname:null;s||(L=L.toLowerCase(),A=A?A.toLowerCase():null,C=C.toLowerCase()),A&&Z&&(A=Ft(A,Z)||A);const at=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let ot=L===C||!d&&L.startsWith(C)&&L.charAt(at)==="/",it=A!=null&&(A===C||!d&&A.startsWith(C)&&A.charAt(C.length)==="/"),ut={isActive:ot,isPending:it,isTransitioning:I},Q=ot?l:void 0,mt;typeof p=="function"?mt=p(ut):mt=[p,ot?"active":null,it?"pending":null,I?"transitioning":null].filter(Boolean).join(" ");let $t=typeof g=="function"?g(ut):g;return j.createElement(vn,Ut({},P,{"aria-current":Q,className:mt,ref:f,style:$t,to:v,viewTransition:h}),typeof S=="function"?S(ut):S)});process.env.NODE_ENV!=="production"&&(zn.displayName="NavLink");const kn=j.forwardRef((a,u)=>{let{fetcherKey:f,navigate:l,reloadDocument:s,replace:p,state:d,method:g=ye,action:v,onSubmit:h,relative:S,preventScrollReset:P,viewTransition:x}=a,J=be(a,Vn),B=ea(),F=ra(v,{relative:S}),Z=g.toLowerCase()==="get"?"get":"post",I=C=>{if(h&&h(C),C.defaultPrevented)return;C.preventDefault();let L=C.nativeEvent.submitter,A=L?.getAttribute("formmethod")||g;B(L||C.currentTarget,{fetcherKey:f,method:A,navigate:l,replace:p,state:d,relative:S,preventScrollReset:P,viewTransition:x})};return j.createElement("form",Ut({ref:u,method:Z,action:F,onSubmit:s?h:I},J))});process.env.NODE_ENV!=="production"&&(kn.displayName="Form"),process.env.NODE_ENV;var me;(function(a){a.UseScrollRestoration="useScrollRestoration",a.UseSubmit="useSubmit",a.UseSubmitFetcher="useSubmitFetcher",a.UseFetcher="useFetcher",a.useViewTransitionState="useViewTransitionState"})(me||(me={}));var _n;(function(a){a.UseFetcher="useFetcher",a.UseFetchers="useFetchers",a.UseScrollRestoration="useScrollRestoration"})(_n||(_n={}));function Jn(a){return a+" must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router."}function mn(a){let u=j.useContext(R.UNSAFE_DataRouterContext);return u||(process.env.NODE_ENV!=="production"?It(!1,Jn(a)):It()),u}function Xn(a,u){let{target:f,replace:l,state:s,preventScrollReset:p,relative:d,viewTransition:g}=u===void 0?{}:u,v=R.useNavigate(),h=R.useLocation(),S=R.useResolvedPath(a,{relative:d});return j.useCallback(P=>{if(In(P,f)){P.preventDefault();let x=l!==void 0?l:R.createPath(h)===R.createPath(S);v(a,{replace:x,state:s,preventScrollReset:p,relative:d,viewTransition:g})}},[h,v,S,l,s,f,a,p,d,g])}function Yn(a){process.env.NODE_ENV!=="production"&&he(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let u=j.useRef(we(a)),f=j.useRef(!1),l=R.useLocation(),s=j.useMemo(()=>Fn(l.search,f.current?null:u.current),[l.search]),p=R.useNavigate(),d=j.useCallback((g,v)=>{const h=we(typeof g=="function"?g(s):g);f.current=!0,p("?"+h,v)},[p,s]);return[s,d]}function Zn(){if(typeof document>"u")throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.")}let Qn=0,ta=()=>"__"+String(++Qn)+"__";function ea(){let{router:a}=mn(me.UseSubmit),{basename:u}=j.useContext(R.UNSAFE_NavigationContext),f=R.UNSAFE_useRouteId();return j.useCallback(function(l,s){s===void 0&&(s={}),Zn();let{action:p,method:d,encType:g,formData:v,body:h}=$n(l,u);if(s.navigate===!1){let S=s.fetcherKey||ta();a.fetch(S,f,s.action||p,{preventScrollReset:s.preventScrollReset,formData:v,body:h,formMethod:s.method||d,formEncType:s.encType||g,flushSync:s.flushSync})}else a.navigate(s.action||p,{preventScrollReset:s.preventScrollReset,formData:v,body:h,formMethod:s.method||d,formEncType:s.encType||g,replace:s.replace,state:s.state,fromRouteId:f,flushSync:s.flushSync,viewTransition:s.viewTransition})},[a,u,f])}function ra(a,u){let{relative:f}=u===void 0?{}:u,{basename:l}=j.useContext(R.UNSAFE_NavigationContext),s=j.useContext(R.UNSAFE_RouteContext);s||(process.env.NODE_ENV!=="production"?It(!1,"useFormAction must be used inside a RouteContext"):It());let[p]=s.matches.slice(-1),d=Ut({},R.useResolvedPath(a||".",{relative:f})),g=R.useLocation();if(a==null){d.search=g.search;let v=new URLSearchParams(d.search),h=v.getAll("index");if(h.some(P=>P==="")){v.delete("index"),h.filter(x=>x).forEach(x=>v.append("index",x));let P=v.toString();d.search=P?"?"+P:""}}return(!a||a===".")&&p.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),l!=="/"&&(d.pathname=d.pathname==="/"?l:Tn([l,d.pathname])),R.createPath(d)}function na(a,u){u===void 0&&(u={});let f=j.useContext(gn);f==null&&(process.env.NODE_ENV!=="production"?It(!1,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"):It());let{basename:l}=mn(me.useViewTransitionState),s=R.useResolvedPath(a,{relative:u.relative});if(!f.isTransitioning)return!1;let p=Ft(f.currentLocation.pathname,l)||f.currentLocation.pathname,d=Ft(f.nextLocation.pathname,l)||f.nextLocation.pathname;return hn(s.pathname,d)!=null||hn(s.pathname,p)!=null}function aa(a,u){const[f,l]=Yn(),s=JSON.stringify(u||{}),p=_t.useCallback(d=>{l(g=>{const v=g.entries().reduce((h,[S,P])=>(h[S]=P,h),{});return xn({...v,...d},Boolean)},JSON.parse(s))},[s,l]);return Sn(a,{get:f.get.bind(f),save:p})}function ia(a){const u=new URLSearchParams(document.location.search);return cn(a,{get:f=>u.get(f)})}nt.getPersistedValues=ia,nt.useSearchParamsState=aa,Object.defineProperty(nt,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("@sasha.p/use-persistent-state"),require("react"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","@sasha.p/use-persistent-state","react","react-router-dom"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.ReactRouterPersistentState={},e.UsePersistentState,e.React,e.ReactRouterDOM))})(this,(function(e,t,i,f){"use strict";function m(a,n){const{emptyValues:s,...r}=n??{},[u,c]=f.useSearchParams(),o=i.useRef({setSearchParams:c,navigateOptions:r,emptyValues:s});o.current={setSearchParams:c,navigateOptions:r,emptyValues:s};const h=i.useCallback(P=>{const{setSearchParams:S,navigateOptions:l,emptyValues:g}=o.current;S(O=>{const R={...Object.fromEntries(O),...P};return Object.fromEntries(Object.entries(R).filter(d=>d[1]!==void 0&&(g==="preserve"||d[1]!=="")))},l)},[]);return t.usePersistentState(a,{get:u.get.bind(u),save:h},{emptyValues:s})}function p(a,n){const s=new URLSearchParams(typeof document>"u"?"":document.location.search);return t.getValues(a,{get:r=>s.get(r)},n)}e.getPersistedValues=p,e.useSearchParamsState=m,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,18 +1,20 @@
1
1
  {
2
2
  "name": "@sasha.p/react-router-persistent-state",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "description": "hook that have useState-like semantic but allows to persist state in react-router's useSearchParams, based on @sasha.p/use-persistent-state",
5
5
  "main": "dist/react-router-persistent-state.umd.js",
6
- "module": "react-router-persistent-state.es.js",
7
- "types": "dist/index.ts",
6
+ "module": "dist/react-router-persistent-state.es.js",
7
+ "types": "dist/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
+ "types": "./dist/index.d.ts",
10
11
  "import": "./dist/react-router-persistent-state.es.js",
11
12
  "require": "./dist/react-router-persistent-state.umd.js"
12
13
  }
13
14
  },
14
15
  "files": [
15
- "dist"
16
+ "dist",
17
+ "CHANGELOG.md"
16
18
  ],
17
19
  "repository": {
18
20
  "type": "git",
@@ -33,48 +35,47 @@
33
35
  "url": "https://github.com/stushurik/react-router-persistent-state/issues"
34
36
  },
35
37
  "homepage": "https://github.com/stushurik/react-router-persistent-state#readme",
36
- "dependencies": {
37
- "lodash.pickby": "^4.6.0"
38
- },
39
38
  "peerDependencies": {
39
+ "@sasha.p/use-persistent-state": "^1.1.0",
40
40
  "react": ">=18.2.0",
41
41
  "react-dom": ">=18.2.0",
42
- "react-router-dom": "^6.0.0 || ^7.0.0",
43
- "@sasha.p/use-persistent-state": ">=1.0.5"
42
+ "react-router-dom": "^6.0.0 || ^7.0.0"
44
43
  },
45
44
  "devDependencies": {
46
- "@types/lodash.pickby": "^4.6.9",
47
- "@types/node": "20.19.0",
48
- "@types/react": "18.0.25",
49
- "@types/react-dom": "18.0.9",
45
+ "@eslint/js": "^10.0.1",
46
+ "@sasha.p/use-persistent-state": "^1.1.0",
50
47
  "@testing-library/react": "^16.3.0",
51
- "@types/jest": "^27.5.2",
52
- "@typescript-eslint/eslint-plugin": "6.0.0",
53
- "@typescript-eslint/parser": "6.0.0",
48
+ "@types/jest": "^30.0.0",
49
+ "@types/node": "20.19.0",
50
+ "@types/react": "^18.3.32",
51
+ "@types/react-dom": "^18.3.7",
54
52
  "@vitejs/plugin-react": "^4.6.0",
55
- "eslint": "8.29.0",
56
- "eslint-config-prettier": "8.6.0",
57
- "eslint-config-react-app": "^7.0.1",
58
- "eslint-import-resolver-typescript": "3.5.5",
59
- "eslint-plugin-import": "2.27.5",
60
- "eslint-plugin-n": "15.5.1",
61
- "eslint-plugin-promise": "6.1.1",
62
- "eslint-plugin-react": "7.31.11",
63
- "husky": "8.0.0",
64
- "jest": "^29.5.0",
65
- "jest-environment-jsdom": "^30.0.4",
66
- "lint-staged": "13.0.4",
53
+ "eslint": "^10.16.0",
54
+ "eslint-config-prettier": "^10.1.9",
55
+ "eslint-import-resolver-typescript": "^4.4.6",
56
+ "eslint-plugin-import-x": "^4.19.0",
57
+ "eslint-plugin-react-hooks": "^7.1.1",
58
+ "globals": "^17.15.0",
59
+ "jest": "^30.5.2",
60
+ "jest-environment-jsdom": "^30.5.2",
67
61
  "prettier": "2.8.3",
68
- "prop-types": "15.8.1",
69
- "ts-jest": "^29.4.0",
62
+ "react": "^18.3.1",
63
+ "react-dom": "^18.3.1",
64
+ "react-router-dom": "^6.30.6",
65
+ "ts-jest": "^29.4.15",
70
66
  "typescript": "^5.1.6",
67
+ "typescript-eslint": "^8.74.0",
71
68
  "vite": "^7.0.3",
72
- "vite-plugin-dts": "^4.5.4"
69
+ "vite-plugin-dts": "^5.1.2"
73
70
  },
74
71
  "scripts": {
75
72
  "build": "vite build",
76
73
  "test": "jest",
77
- "lint": "eslint src",
78
- "lint:fix": "eslint src --fix"
79
- }
80
- }
74
+ "lint": "eslint .",
75
+ "lint:fix": "eslint . --fix",
76
+ "typecheck": "tsc --noEmit",
77
+ "format:check": "prettier --check src",
78
+ "prepublishOnly": "npm run lint && npm run typecheck && npm test && npm run build"
79
+ },
80
+ "sideEffects": false
81
+ }