UNPKG

@bgscore/react-router

Version:

Automatic React Router generator for Vite with TypeScript support

2 lines (1 loc) 30.2 kB
"use strict";Object.defineProperty(exports,"t",{value:!0});var t,e,n,r,o,i,u,f,c,a,l=require("react-router-dom"),s=require("side-channel"),p=require("react");function d(t){return t&&t.t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function y(){if(e)return t;e=1;var n=String.prototype.replace,r=/%20/g,o="RFC3986";return t={default:o,formatters:{RFC1738:function(t){return n.call(t,r,"+")},RFC3986:function(t){return String(t)}},RFC1738:"RFC1738",RFC3986:o}}function v(){if(r)return n;r=1;var t=y(),e=Object.prototype.hasOwnProperty,o=Array.isArray,i=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),u=function(t,e){for(var n=e&&e.plainObjects?{__proto__:null}:{},r=0;r<t.length;++r)void 0!==t[r]&&(n[r]=t[r]);return n},f=1024;return n={arrayToObject:u,assign:function(t,e){return Object.keys(e).reduce((function(t,n){return t[n]=e[n],t}),t)},combine:function(t,e){return[].concat(t,e)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],n=[],r=0;r<e.length;++r)for(var i=e[r],u=i.obj[i.prop],f=Object.keys(u),c=0;c<f.length;++c){var a=f[c],l=u[a];"object"==typeof l&&null!==l&&-1===n.indexOf(l)&&(e.push({obj:u,prop:a}),n.push(l))}return function(t){for(;t.length>1;){var e=t.pop(),n=e.obj[e.prop];if(o(n)){for(var r=[],i=0;i<n.length;++i)void 0!==n[i]&&r.push(n[i]);e.obj[e.prop]=r}}}(e),t},decode:function(t,e,n){var r=t.replace(/\+/g," ");if("iso-8859-1"===n)return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch(t){return r}},encode:function(e,n,r,o,u){if(0===e.length)return e;var c=e;if("symbol"==typeof e?c=Symbol.prototype.toString.call(e):"string"!=typeof e&&(c=String(e)),"iso-8859-1"===r)return escape(c).replace(/%u[0-9a-f]{4}/gi,(function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"}));for(var a="",l=0;l<c.length;l+=f){for(var s=c.length>=f?c.slice(l,l+f):c,p=[],d=0;d<s.length;++d){var y=s.charCodeAt(d);45===y||46===y||95===y||126===y||y>=48&&y<=57||y>=65&&y<=90||y>=97&&y<=122||u===t.RFC1738&&(40===y||41===y)?p[p.length]=s.charAt(d):y<128?p[p.length]=i[y]:y<2048?p[p.length]=i[192|y>>6]+i[128|63&y]:y<55296||y>=57344?p[p.length]=i[224|y>>12]+i[128|y>>6&63]+i[128|63&y]:(d+=1,y=65536+((1023&y)<<10|1023&s.charCodeAt(d)),p[p.length]=i[240|y>>18]+i[128|y>>12&63]+i[128|y>>6&63]+i[128|63&y])}a+=p.join("")}return a},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(o(t)){for(var n=[],r=0;r<t.length;r+=1)n.push(e(t[r]));return n}return e(t)},merge:function t(n,r,i){if(!r)return n;if("object"!=typeof r&&"function"!=typeof r){if(o(n))n.push(r);else{if(!n||"object"!=typeof n)return[n,r];(i&&(i.plainObjects||i.allowPrototypes)||!e.call(Object.prototype,r))&&(n[r]=!0)}return n}if(!n||"object"!=typeof n)return[n].concat(r);var f=n;return o(n)&&!o(r)&&(f=u(n,i)),o(n)&&o(r)?(r.forEach((function(r,o){if(e.call(n,o)){var u=n[o];u&&"object"==typeof u&&r&&"object"==typeof r?n[o]=t(u,r,i):n.push(r)}else n[o]=r})),n):Object.keys(r).reduce((function(n,o){var u=r[o];return e.call(n,o)?n[o]=t(n[o],u,i):n[o]=u,n}),f)}},n}function b(){if(f)return u;f=1;var t=v(),e=Object.prototype.hasOwnProperty,n=Array.isArray,r={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:t.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},o=function(t){return t.replace(/&#(\d+);/g,(function(t,e){return String.fromCharCode(parseInt(e,10))}))},i=function(t,e,n){if(t&&"string"==typeof t&&e.comma&&t.indexOf(",")>-1)return t.split(",");if(e.throwOnLimitExceeded&&n>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(1===e.arrayLimit?"":"s")+" allowed in an array.");return t},c=function(n,r,o,u){if(n){var f=o.allowDots?n.replace(/\.([^.[]+)/g,"[$1]"):n,c=/(\[[^[\]]*])/g,a=o.depth>0&&/(\[[^[\]]*])/.exec(f),l=a?f.slice(0,a.index):f,s=[];if(l){if(!o.plainObjects&&e.call(Object.prototype,l)&&!o.allowPrototypes)return;s.push(l)}for(var p=0;o.depth>0&&null!==(a=c.exec(f))&&p<o.depth;){if(p+=1,!o.plainObjects&&e.call(Object.prototype,a[1].slice(1,-1))&&!o.allowPrototypes)return;s.push(a[1])}if(a){if(!0===o.strictDepth)throw new RangeError("Input depth exceeded depth option of "+o.depth+" and strictDepth is true");s.push("["+f.slice(a.index)+"]")}return function(e,n,r,o){var u=0;if(e.length>0&&"[]"===e[e.length-1]){var f=e.slice(0,-1).join("");u=Array.isArray(n)&&n[f]?n[f].length:0}for(var c=o?n:i(n,r,u),a=e.length-1;a>=0;--a){var l,s=e[a];if("[]"===s&&r.parseArrays)l=r.allowEmptyArrays&&(""===c||r.strictNullHandling&&null===c)?[]:t.combine([],c);else{l=r.plainObjects?{__proto__:null}:{};var p="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,d=r.decodeDotInKeys?p.replace(/%2E/g,"."):p,y=parseInt(d,10);r.parseArrays||""!==d?!isNaN(y)&&s!==d&&String(y)===d&&y>=0&&r.parseArrays&&y<=r.arrayLimit?(l=[])[y]=c:"__proto__"!==d&&(l[d]=c):l={0:c}}c=l}return c}(s,r,o,u)}};return u=function(u,f){var a=function(e){if(!e)return r;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.decodeDotInKeys&&"boolean"!=typeof e.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(void 0!==e.throwOnLimitExceeded&&"boolean"!=typeof e.throwOnLimitExceeded)throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var n=void 0===e.charset?r.charset:e.charset,o=void 0===e.duplicates?r.duplicates:e.duplicates;if("combine"!==o&&"first"!==o&&"last"!==o)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===e.allowDots?!0===e.decodeDotInKeys||r.allowDots:!!e.allowDots,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:r.allowEmptyArrays,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:r.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:r.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:r.arrayLimit,charset:n,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:r.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:r.comma,decodeDotInKeys:"boolean"==typeof e.decodeDotInKeys?e.decodeDotInKeys:r.decodeDotInKeys,decoder:"function"==typeof e.decoder?e.decoder:r.decoder,delimiter:"string"==typeof e.delimiter||t.isRegExp(e.delimiter)?e.delimiter:r.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:r.depth,duplicates:o,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:r.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:r.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:r.plainObjects,strictDepth:"boolean"==typeof e.strictDepth?!!e.strictDepth:r.strictDepth,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:r.strictNullHandling,throwOnLimitExceeded:"boolean"==typeof e.throwOnLimitExceeded&&e.throwOnLimitExceeded}}(f);if(""===u||null==u)return a.plainObjects?{__proto__:null}:{};for(var l="string"==typeof u?function(u,f){var c={__proto__:null},a=f.ignoreQueryPrefix?u.replace(/^\?/,""):u;a=a.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var l=f.parameterLimit===1/0?void 0:f.parameterLimit,s=a.split(f.delimiter,f.throwOnLimitExceeded?l+1:l);if(f.throwOnLimitExceeded&&s.length>l)throw new RangeError("Parameter limit exceeded. Only "+l+" parameter"+(1===l?"":"s")+" allowed.");var p,d=-1,y=f.charset;if(f.charsetSentinel)for(p=0;p<s.length;++p)0===s[p].indexOf("utf8=")&&("utf8=%E2%9C%93"===s[p]?y="utf-8":"utf8=%26%2310003%3B"===s[p]&&(y="iso-8859-1"),d=p,p=s.length);for(p=0;p<s.length;++p)if(p!==d){var v,b,m=s[p],h=m.indexOf("]="),g=-1===h?m.indexOf("="):h+1;-1===g?(v=f.decoder(m,r.decoder,y,"key"),b=f.strictNullHandling?null:""):(v=f.decoder(m.slice(0,g),r.decoder,y,"key"),b=t.maybeMap(i(m.slice(g+1),f,n(c[v])?c[v].length:0),(function(t){return f.decoder(t,r.decoder,y,"value")}))),b&&f.interpretNumericEntities&&"iso-8859-1"===y&&(b=o(String(b))),m.indexOf("[]=")>-1&&(b=n(b)?[b]:b);var j=e.call(c,v);j&&"combine"===f.duplicates?c[v]=t.combine(c[v],b):j&&"last"!==f.duplicates||(c[v]=b)}return c}(u,a):u,s=a.plainObjects?{__proto__:null}:{},p=Object.keys(l),d=0;d<p.length;++d){var y=p[d],v=c(y,l[y],a,"string"==typeof u);s=t.merge(s,v,a)}return!0===a.allowSparse?s:t.compact(s)}}function m(){if(a)return c;a=1;var t=function(){if(i)return o;i=1;var t=s,e=v(),n=y(),r=Object.prototype.hasOwnProperty,u={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},f=Array.isArray,c=Array.prototype.push,a=function(t,e){c.apply(t,f(e)?e:[e])},l=Date.prototype.toISOString,p=n.default,d={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:e.encode,encodeValuesOnly:!1,filter:void 0,format:p,formatter:n.formatters[p],indices:!1,serializeDate:function(t){return l.call(t)},skipNulls:!1,strictNullHandling:!1},b={},m=function n(r,o,i,u,c,l,s,p,y,v,m,h,g,j,w,O,_,x){for(var E,$=r,A=x,R=0,S=!1;void 0!==(A=A.get(b))&&!S;){var D=A.get(r);if(R+=1,void 0!==D){if(D===R)throw new RangeError("Cyclic object value");S=!0}void 0===A.get(b)&&(R=0)}if("function"==typeof v?$=v(o,$):$ instanceof Date?$=g($):"comma"===i&&f($)&&($=e.maybeMap($,(function(t){return t instanceof Date?g(t):t}))),null===$){if(l)return y&&!O?y(o,d.encoder,_,"key",j):o;$=""}if("string"==typeof(E=$)||"number"==typeof E||"boolean"==typeof E||"symbol"==typeof E||"bigint"==typeof E||e.isBuffer($))return y?[w(O?o:y(o,d.encoder,_,"key",j))+"="+w(y($,d.encoder,_,"value",j))]:[w(o)+"="+w(String($))];var C,I=[];if(void 0===$)return I;if("comma"===i&&f($))O&&y&&($=e.maybeMap($,y)),C=[{value:$.length>0?$.join(",")||null:void 0}];else if(f(v))C=v;else{var T=Object.keys($);C=m?T.sort(m):T}var F=p?String(o).replace(/\./g,"%2E"):String(o),U=u&&f($)&&1===$.length?F+"[]":F;if(c&&f($)&&0===$.length)return U+"[]";for(var k=0;k<C.length;++k){var N=C[k],P="object"==typeof N&&N&&void 0!==N.value?N.value:$[N];if(!s||null!==P){var q=h&&p?String(N).replace(/\./g,"%2E"):String(N),L=f($)?"function"==typeof i?i(U,q):U:U+(h?"."+q:"["+q+"]");x.set(r,R);var Q=t();Q.set(b,x),a(I,n(P,L,i,u,c,l,s,p,"comma"===i&&O&&f($)?null:y,v,m,h,g,j,w,O,_,Q))}}return I};return o=function(e,o){var i,c=e,l=function(t){if(!t)return d;if(void 0!==t.allowEmptyArrays&&"boolean"!=typeof t.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==t.encodeDotInKeys&&"boolean"!=typeof t.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||d.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var o=n.default;if(void 0!==t.format){if(!r.call(n.formatters,t.format))throw new TypeError("Unknown format option provided.");o=t.format}var i,c=n.formatters[o],a=d.filter;if(("function"==typeof t.filter||f(t.filter))&&(a=t.filter),i=t.arrayFormat in u?t.arrayFormat:"indices"in t?t.indices?"indices":"repeat":d.arrayFormat,"commaRoundTrip"in t&&"boolean"!=typeof t.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var l=void 0===t.allowDots?!0===t.encodeDotInKeys||d.allowDots:!!t.allowDots;return{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:d.addQueryPrefix,allowDots:l,allowEmptyArrays:"boolean"==typeof t.allowEmptyArrays?!!t.allowEmptyArrays:d.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:d.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:void 0===t.delimiter?d.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:d.encode,encodeDotInKeys:"boolean"==typeof t.encodeDotInKeys?t.encodeDotInKeys:d.encodeDotInKeys,encoder:"function"==typeof t.encoder?t.encoder:d.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:d.encodeValuesOnly,filter:a,format:o,formatter:c,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:d.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:d.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:d.strictNullHandling}}(o);"function"==typeof l.filter?c=(0,l.filter)("",c):f(l.filter)&&(i=l.filter);var s=[];if("object"!=typeof c||null===c)return"";var p=u[l.arrayFormat],y="comma"===p&&l.commaRoundTrip;i||(i=Object.keys(c)),l.sort&&i.sort(l.sort);for(var v=t(),b=0;b<i.length;++b){var h=i[b],g=c[h];l.skipNulls&&null===g||a(s,m(g,h,p,y,l.allowEmptyArrays,l.strictNullHandling,l.skipNulls,l.encodeDotInKeys,l.encode?l.encoder:null,l.filter,l.sort,l.allowDots,l.serializeDate,l.format,l.formatter,l.encodeValuesOnly,l.charset,v))}var j=s.join(l.delimiter),w=!0===l.addQueryPrefix?"?":"";return l.charsetSentinel&&("iso-8859-1"===l.charset?w+="utf8=%26%2310003%3B&":w+="utf8=%E2%9C%93&"),j.length>0?w+j:""}}(),e=b(),n=y();return c={formats:n,parse:e,stringify:t}}var h=d(m());function g(t,e){return t===e||t!=t&&e!=e}function j(t,e){for(var n=t.length;n--;)if(g(t[n][0],e))return n;return-1}var w=Array.prototype.splice;function O(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}O.prototype.clear=function(){this.i=[],this.size=0},O.prototype.delete=function(t){var e=this.i,n=j(e,t);return!(n<0||(n==e.length-1?e.pop():w.call(e,n,1),--this.size,0))},O.prototype.get=function(t){var e=this.i,n=j(e,t);return n<0?void 0:e[n][1]},O.prototype.has=function(t){return j(this.i,t)>-1},O.prototype.set=function(t,e){var n=this.i,r=j(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};var _="object"==typeof global&&global&&global.Object===Object&&global,x="object"==typeof self&&self&&self.Object===Object&&self,E=_||x||Function("return this")(),$=E.Symbol,A=Object.prototype,R=A.hasOwnProperty,S=A.toString,D=$?$.toStringTag:void 0,C=Object.prototype.toString,I=$?$.toStringTag:void 0;function T(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":I&&I in Object(t)?function(t){var e=R.call(t,D),n=t[D];try{t[D]=void 0;var r=!0}catch(t){}var o=S.call(t);return r&&(e?t[D]=n:delete t[D]),o}(t):function(t){return C.call(t)}(t)}function F(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function U(t){if(!F(t))return!1;var e=T(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var k,N=E["u"],P=(k=/[^.]+$/.exec(N&&N.keys&&N.keys.IE_PROTO||""))?"Symbol(src)_1."+k:"",q=Function.prototype.toString,L=/^\[object .+?Constructor\]$/,Q=Function.prototype,B=Object.prototype,K=Q.toString,H=B.hasOwnProperty,M=RegExp("^"+K.call(H).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function z(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!F(t)||(e=t,P&&P in e))&&(U(t)?M:L).test(function(t){if(null!=t){try{return q.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t));var e}(n)?n:void 0}var V=z(E,"Map"),G=z(Object,"create"),J=Object.prototype.hasOwnProperty,W=Object.prototype.hasOwnProperty;function X(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Y(t,e){var n,r,o=t.i;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function Z(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function tt(t){var e=this.i=new O(t);this.size=e.size}X.prototype.clear=function(){this.i=G?G(null):{},this.size=0},X.prototype.delete=function(t){var e=this.has(t)&&delete this.i[t];return this.size-=e?1:0,e},X.prototype.get=function(t){var e=this.i;if(G){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return J.call(e,t)?e[t]:void 0},X.prototype.has=function(t){var e=this.i;return G?void 0!==e[t]:W.call(e,t)},X.prototype.set=function(t,e){var n=this.i;return this.size+=this.has(t)?0:1,n[t]=G&&void 0===e?"__lodash_hash_undefined__":e,this},Z.prototype.clear=function(){this.size=0,this.i={hash:new X,map:new(V||O),string:new X}},Z.prototype.delete=function(t){var e=Y(this,t).delete(t);return this.size-=e?1:0,e},Z.prototype.get=function(t){return Y(this,t).get(t)},Z.prototype.has=function(t){return Y(this,t).has(t)},Z.prototype.set=function(t,e){var n=Y(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},tt.prototype.clear=function(){this.i=new O,this.size=0},tt.prototype.delete=function(t){var e=this.i,n=e.delete(t);return this.size=e.size,n},tt.prototype.get=function(t){return this.i.get(t)},tt.prototype.has=function(t){return this.i.has(t)},tt.prototype.set=function(t,e){var n=this.i;if(n instanceof O){var r=n.i;if(!V||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.i=new Z(r)}return n.set(t,e),this.size=n.size,this};var et=function(){try{var t=z(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();function nt(t,e,n){"__proto__"==e&&et?et(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function rt(t,e,n){(void 0!==n&&!g(t[e],n)||void 0===n&&!(e in t))&&nt(t,e,n)}var ot="object"==typeof exports&&exports&&!exports.nodeType&&exports,it=ot&&"object"==typeof module&&module&&!module.nodeType&&module,ut=it&&it.exports===ot?E.Buffer:void 0;ut&&ut.allocUnsafe;var ft,ct,at=E.Uint8Array,lt=Object.create,st=function(){function t(){}return function(e){if(!F(e))return{};if(lt)return lt(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}(),pt=(ft=Object.getPrototypeOf,ct=Object,function(t){return ft(ct(t))}),dt=Object.prototype;function yt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||dt)}function vt(t){return null!=t&&"object"==typeof t}function bt(t){return vt(t)&&"[object Arguments]"==T(t)}var mt=Object.prototype,ht=mt.hasOwnProperty,gt=mt.propertyIsEnumerable,jt=bt(function(){return arguments}())?bt:function(t){return vt(t)&&ht.call(t,"callee")&&!gt.call(t,"callee")},wt=Array.isArray;function Ot(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function _t(t){return null!=t&&Ot(t.length)&&!U(t)}var xt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Et=xt&&"object"==typeof module&&module&&!module.nodeType&&module,$t=Et&&Et.exports===xt?E.Buffer:void 0,At=($t?$t.isBuffer:void 0)||function(){return!1},Rt=Function.prototype,St=Object.prototype,Dt=Rt.toString,Ct=St.hasOwnProperty,It=Dt.call(Object),Tt={};Tt["[object Float32Array]"]=Tt["[object Float64Array]"]=Tt["[object Int8Array]"]=Tt["[object Int16Array]"]=Tt["[object Int32Array]"]=Tt["[object Uint8Array]"]=Tt["[object Uint8ClampedArray]"]=Tt["[object Uint16Array]"]=Tt["[object Uint32Array]"]=!0,Tt["[object Arguments]"]=Tt["[object Array]"]=Tt["[object ArrayBuffer]"]=Tt["[object Boolean]"]=Tt["[object DataView]"]=Tt["[object Date]"]=Tt["[object Error]"]=Tt["[object Function]"]=Tt["[object Map]"]=Tt["[object Number]"]=Tt["[object Object]"]=Tt["[object RegExp]"]=Tt["[object Set]"]=Tt["[object String]"]=Tt["[object WeakMap]"]=!1;var Ft="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ut=Ft&&"object"==typeof module&&module&&!module.nodeType&&module,kt=Ut&&Ut.exports===Ft&&_.process,Nt=function(){try{return Ut&&Ut.require&&Ut.require("util").types||kt&&kt.binding&&kt.binding("util")}catch(t){}}(),Pt=Nt&&Nt.isTypedArray,qt=Pt?function(t){return function(e){return t(e)}}(Pt):function(t){return vt(t)&&Ot(t.length)&&!!Tt[T(t)]};function Lt(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Qt=Object.prototype.hasOwnProperty;function Bt(t,e,n){var r=t[e];Qt.call(t,e)&&g(r,n)&&(void 0!==n||e in t)||nt(t,e,n)}var Kt=/^(?:0|[1-9]\d*)$/;function Ht(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Kt.test(t))&&t>-1&&t%1==0&&t<e}var Mt=Object.prototype.hasOwnProperty;function zt(t){return _t(t)?function(t){var e=wt(t),n=!e&&jt(t),r=!e&&!n&&At(t),o=!e&&!n&&!r&&qt(t),i=e||n||r||o,u=i?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],f=u.length;for(var c in t)i&&("length"==c||r&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Ht(c,f))||u.push(c);return u}(t):function(t){if(!F(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=yt(t),n=[];for(var r in t)("constructor"!=r||!e&&Mt.call(t,r))&&n.push(r);return n}(t)}function Vt(t,e,n,r,o){t!==e&&function(t,e,n){for(var r=-1,o=Object(t),i=n(t),u=i.length;u--;){var f=i[++r];if(!1===e(o[f],f))break}}(e,(function(i,u){if(o||(o=new tt),F(i))!function(t,e,n,r,o,i,u){var f,c,a,l,s=Lt(t,n),p=Lt(e,n),d=u.get(p);if(d)rt(t,n,d);else{var y,v=i?i(s,p,n+"",t,e,u):void 0,b=void 0===v;if(b){var m=wt(p),h=!m&&At(p),g=!m&&!h&&qt(p);v=p,m||h||g?wt(s)?v=s:vt(y=s)&&_t(y)?v=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(s):h?(b=!1,v=p.slice()):g?(b=!1,a=new(c=(f=p).buffer).constructor(c.byteLength),new at(a).set(new at(c)),l=a,v=new f.constructor(l,f.byteOffset,f.length)):v=[]:function(t){if(!vt(t)||"[object Object]"!=T(t))return!1;var e=pt(t);if(null===e)return!0;var n=Ct.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Dt.call(n)==It}(p)||jt(p)?(v=s,jt(s)?v=function(t){return function(t,e,n){var r=!n;n||(n={});for(var o=-1,i=e.length;++o<i;){var u=e[o],f=void 0;void 0===f&&(f=t[u]),r?nt(n,u,f):Bt(n,u,f)}return n}(t,zt(t))}(s):F(s)&&!U(s)||(v=function(t){return"function"!=typeof t.constructor||yt(t)?{}:st(pt(t))}(p))):b=!1}b&&(u.set(p,v),o(v,p,r,i,u),u.delete(p)),rt(t,n,v)}}(t,e,u,n,Vt,r,o);else{var f=r?r(Lt(t,u),i,u+"",t,e,o):void 0;void 0===f&&(f=i),rt(t,u,f)}}),zt)}function Gt(t){return t}var Jt,Wt=Math.max,Xt=et?function(t,e){return et(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:Gt,Yt=Date.now,Zt=function(t){var e=0,n=0;return function(){var r=Yt(),o=16-(r-n);if(n=r,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(Xt),te=(Jt=function(t,e,n){Vt(t,e,n)},function(t){return Zt(function(t,e,n){return e=Wt(void 0===e?t.length-1:e,0),function(){for(var r=arguments,o=-1,i=Wt(r.length-e,0),u=Array(i);++o<i;)u[o]=r[e+o];o=-1;for(var f=Array(e+1);++o<e;)f[o]=r[o];return f[e]=n(u),function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}(t,this,f)}}(t,void 0,Gt),t+"")}((function(t,e){var n=-1,r=e.length,o=r>1?e[r-1]:void 0,i=r>2?e[2]:void 0;for(o=Jt.length>3&&"function"==typeof o?(r--,o):void 0,i&&function(t,e,n){if(!F(n))return!1;var r=typeof e;return!!("number"==r?_t(n)&&Ht(e,n.length):"string"==r&&e in n)&&g(n[e],t)}(e[0],e[1],i)&&(o=r<3?void 0:o,r=1),t=Object(t);++n<r;){var u=e[n];u&&Jt(t,u,n)}return t})));const ee=(t,e,n)=>{if(!t)return n;if(t.hasOwnProperty(e))return t[e];const r=e.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of r){if(null==o)return n;o=o[t]}return void 0===o?n:o};function ne(t){return!(null==t||"string"==typeof t&&""===t.trim()||Array.isArray(t)&&0===t.length||"object"==typeof t&&null!==t&&!Array.isArray(t)&&0===Object.keys(t).length)}function re(t){if("null"===t)return null;if(Array.isArray(t))for(let e=0;e<t.length;e++)t[e]=re(t[e]);else if(t&&"object"==typeof t)for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e]=re(t[e]));return t}function oe(t,e=""){const n=[];for(const r in t)if(t.hasOwnProperty(r)){const o=t[r],i=e?`${e}[${encodeURIComponent(r)}]`:encodeURIComponent(r);if(!ne(o))continue;Array.isArray(o)?o.forEach((t=>{n.push(`${i}=${encodeURIComponent(t)}`)})):"object"==typeof o&&null!==o?n.push(oe(o,i)):n.push(`${i}=${encodeURIComponent(o)}`)}return n.join("&")}function ie(){const t=l.useParams(),e=l.useLocation(),n=l.useNavigate(),r=l.useNavigation(),o=l.useRouteError(),i=l.useMatches(),u=i[i.length-1],f=u?.id??"",c=l.useRouteLoaderData(f)||{},a=l.useNavigationType();return p.useMemo((()=>{const u=h.parse(e.search,{ignoreQueryPrefix:!0}),l=ce({...t,...u}),s=i.find((t=>t.pathname===e.pathname&&t.data))?.data||{},p={...s?.metadata,...c?.metadata},d={...s?.data,...c?.data};return p&&(delete p?.loader,delete p?.errorElement),{push:(t,r)=>{if("string"==typeof t){let o=t;const{preserveQuery:i,replaceSameName:u,query:f,queryData:c,data:a,...s}=r||{};if(i&&e.search&&!f&&(o+=e.search),f){const t=u?{...l,...f}:te({},i?l:{},f);o+=`${o.includes("?")?"&":"?"}${ue(t)}`}if(a&&c){let t={};Object.entries(c).forEach((([e,n])=>{const r=ae(a,n);fe(r)&&(t[e]=r)})),o+=`${o.includes("?")?"&":"?"}${ue(t)}`}const p=o.replace(/:(\w+)/g,((t,e)=>{const n=ae(a,e);return fe(n)?encodeURIComponent(n):""}));n(p,s)}else n(t,r)},pathname:e.pathname,query:l,location:e,navigate:n,goBack:function(t){try{n("PUSH"===a?-1:t)}catch(t){}},metadata:p,data:d,navigation:r,loading:"loading"===r.state,idle:"idle"===r.state,submitting:"submitting"===r.state,error:o,matches:i,id:f}}),[t,e,n,i])}function ue(t,e=""){const n=[];for(const r in t)if(t.hasOwnProperty(r)){const o=t[r],i=e?`${e}[${encodeURIComponent(r)}]`:encodeURIComponent(r);if(!fe(o))continue;Array.isArray(o)?o.forEach((t=>{n.push(`${i}=${encodeURIComponent(t)}`)})):"object"==typeof o&&null!==o?n.push(ue(o,i)):n.push(`${i}=${encodeURIComponent(o)}`)}return n.join("&")}function fe(t){return!(null==t||"string"==typeof t&&""===t.trim()||Array.isArray(t)&&0===t.length||"object"==typeof t&&null!==t&&!Array.isArray(t)&&0===Object.keys(t).length)}function ce(t){if("null"===t)return null;if(Array.isArray(t))for(let e=0;e<t.length;e++)t[e]=ce(t[e]);else if(t&&"object"==typeof t)for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e]=ce(t[e]));return t}const ae=(t,e,n)=>{if(!t)return n;if(t.hasOwnProperty(e))return t[e];const r=e.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of r){if(null==o)return n;o=o[t]}return void 0===o?n:o};exports.Link=({data:t,to:e="",children:n,query:r,queryData:o,preserveQuery:i,replaceSameName:u,ignoreTrailingSlash:f,...c})=>{const a=l.useLocation(),s=l.useParams(),d=p.useMemo((()=>{let n=`${e||""}`;const c=h.parse(a.search,{ignoreQueryPrefix:!0}),l=re({...s,...c});if(i&&a.search&&!ne(r)&&(n+=a.search),r){const t=u?{...l,...r}:te({},i?l:{},r);n+=`${n.includes("?")?"&":"?"}${oe(t)}`}if(t&&o){let e={};Object.entries(o).forEach((([n,r])=>{const o=ee(t,r);ne(o)&&(e[n]=o)})),n+=`${n.includes("?")?"&":"?"}${oe(e)}`}return t&&(n=n.replace(/:(\w+)/g,((e,n)=>{const r=ee(t,n);return ne(r)?encodeURIComponent(String(r)):""}))),f||(n=n.replace(/\/+/g,"/")),n}),[e,t,a.search,i,u,r,o,s,f]);return p.createElement(l.Link,{to:d,...c},n)},exports.default=ie,exports.useMetadata=function(t,e,n=" | "){const r=p.useRef(document.title);p.useEffect((()=>{const o=r.current,i=[],u=document.head,f=t.templateTitle?t.templateTitle:!0===e?o:e,c=t.sparatorTitle||n;return!1===e&&"boolean"==typeof e||(t.title?document.title=f?`${t.title}${c}${f}`:t.title:document.title=`${f||""}`),[{name:"description",content:t.description},{name:"application-name",content:t.applicationName},{name:"keywords",content:t.keywords?.join(", ")},{name:"robots",content:"string"==typeof t.robots?t.robots:t.robots?[t.robots.index?"index":"noindex",t.robots.follow?"follow":"nofollow",t.robots.nocache&&"nocache",t.robots.noimageindex&&"noimageindex",t.robots.nosnippet&&"nosnippet"].filter(Boolean).join(", "):null}].forEach((({name:t,content:e})=>{if(!e)return;let n=document.querySelector(`meta[name="${t}"]`);n||(n=document.createElement("meta"),n.setAttribute("name",t),u.appendChild(n),i.push(n)),n.setAttribute("content",e)})),document.querySelectorAll('meta[name="author"], link[rel="author"]').forEach((t=>t.remove())),t.authors?.forEach((t=>{const e=document.createElement("meta");if(e.name="author",e.content=t.name,u.appendChild(e),i.push(e),t.url){const e=document.createElement("link");e.rel="author",e.href=t.url,u.appendChild(e),i.push(e)}})),document.querySelectorAll('meta[property^="og:"]').forEach((t=>t.remove())),t.openGraph&&([{property:"og:type",content:t.openGraph.type||"website"},{property:"og:title",content:t.openGraph.title||t.title},{property:"og:description",content:t.openGraph.description||t.description},{property:"og:url",content:t.openGraph.url},{property:"og:site_name",content:t.openGraph.siteName}].forEach((({property:t,content:e})=>{if(!e)return;const n=document.createElement("meta");n.setAttribute("property",t),n.content=e,u.appendChild(n),i.push(n)})),t.openGraph.images?.forEach((t=>{[{property:"og:image",content:t.url},{property:"og:image:width",content:t.width?.toString()},{property:"og:image:height",content:t.height?.toString()},{property:"og:image:alt",content:t.alt}].forEach((({property:t,content:e})=>{if(!e)return;const n=document.createElement("meta");n.setAttribute("property",t),n.content=e,u.appendChild(n),i.push(n)}))}))),()=>{i.forEach((t=>t.remove())),t.title&&(document.title="")}}),[t])},exports.useRouter=ie;