UNPKG

@rzl-zone/ziggy-route

Version:

Typed Laravel route generator for any frontend — works with React, Vue, Vanilla JS, and other JavaScript-based stacks.

10 lines 46.9 kB
/*! * ==================================================== * Rzl Ziggy-Route. * ---------------------------------------------------- * Version: 0.0.15. * Author: Rizalvin Dwiky. * Repository: https://github.com/rzl-zone/ziggy-route. * ==================================================== */ !function(){"use strict";var e=Object.create,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,a=Object.getPrototypeOf,n=Object.prototype.hasOwnProperty,i=(e,t)=>function(){return t||(0,e[o(e)[0]])((t={exports:{}}).exports,t),t.exports},s=(i,s,c)=>(c=null!=i?e(a(i)):{},((e,a,i,s)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let c of o(a))n.call(e,c)||c===i||t(e,c,{get:()=>a[c],enumerable:!(s=r(a,c))||s.enumerable});return e})(t(c,"default",{value:i,enumerable:!0}),i)),c=i({"node_modules/qs/lib/formats.js"(e,t){var r=String.prototype.replace,o=/%20/g,a="RFC1738",n="RFC3986";t.exports={default:n,formatters:{RFC1738:function(e){return r.call(e,o,"+")},RFC3986:function(e){return String(e)}},RFC1738:a,RFC3986:n}}}),l=i({"node_modules/qs/lib/utils.js"(e,t){var r=c(),o=Object.prototype.hasOwnProperty,a=Array.isArray,n=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),i=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},o=0;o<e.length;++o)void 0!==e[o]&&(r[o]=e[o]);return r};t.exports={arrayToObject:i,assign:function(e,t){return Object.keys(t).reduce(function(e,r){return e[r]=t[r],e},e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],o=0;o<t.length;++o)for(var n=t[o],i=n.obj[n.prop],s=Object.keys(i),c=0;c<s.length;++c){var l=s[c],u=i[l];"object"==typeof u&&null!==u&&-1===r.indexOf(u)&&(t.push({obj:i,prop:l}),r.push(u))}return function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(a(r)){for(var o=[],n=0;n<r.length;++n)void 0!==r[n]&&o.push(r[n]);t.obj[t.prop]=o}}}(t),e},decode:function(e,t,r){var o=e.replace(/\+/g," ");if("iso-8859-1"===r)return o.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(o)}catch(e){return o}},encode:function(e,t,o,a,i){if(0===e.length)return e;var s=e;if("symbol"==typeof e?s=Symbol.prototype.toString.call(e):"string"!=typeof e&&(s=String(e)),"iso-8859-1"===o)return escape(s).replace(/%u[0-9a-f]{4}/gi,function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"});for(var c="",l=0;l<s.length;++l){var u=s.charCodeAt(l);45===u||46===u||95===u||126===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||i===r.RFC1738&&(40===u||41===u)?c+=s.charAt(l):u<128?c+=n[u]:u<2048?c+=n[192|u>>6]+n[128|63&u]:u<55296||u>=57344?c+=n[224|u>>12]+n[128|u>>6&63]+n[128|63&u]:(l+=1,u=65536+((1023&u)<<10|1023&s.charCodeAt(l)),c+=n[240|u>>18]+n[128|u>>12&63]+n[128|u>>6&63]+n[128|63&u])}return c},isBuffer:function(e){return!(!e||"object"!=typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(a(e)){for(var r=[],o=0;o<e.length;o+=1)r.push(t(e[o]));return r}return t(e)},merge:function e(t,r,n){if(!r)return t;if("object"!=typeof r){if(a(t))t.push(r);else{if(!t||"object"!=typeof t)return[t,r];(n&&(n.plainObjects||n.allowPrototypes)||!o.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(r);var s=t;return a(t)&&!a(r)&&(s=i(t,n)),a(t)&&a(r)?(r.forEach(function(r,a){if(o.call(t,a)){var i=t[a];i&&"object"==typeof i&&r&&"object"==typeof r?t[a]=e(i,r,n):t.push(r)}else t[a]=r}),t):Object.keys(r).reduce(function(t,a){var i=r[a];return o.call(t,a)?t[a]=e(t[a],i,n):t[a]=i,t},s)}}}}),u=i({"node_modules/qs/lib/stringify.js"(e,t){var r=l(),o=c(),a=Object.prototype.hasOwnProperty,n={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},i=Array.isArray,s=String.prototype.split,u=Array.prototype.push,f=function(e,t){u.apply(e,i(t)?t:[t])},p=Date.prototype.toISOString,m=o.default,d={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:r.encode,encodeValuesOnly:!1,format:m,formatter:o.formatters[m],indices:!1,serializeDate:function(e){return p.call(e)},skipNulls:!1,strictNullHandling:!1},y=function e(t,o,a,n,c,l,u,p,m,y,b,h,g,S){var v,A=t;if("function"==typeof u?A=u(o,A):A instanceof Date?A=y(A):"comma"===a&&i(A)&&(A=r.maybeMap(A,function(e){return e instanceof Date?y(e):e})),null===A){if(n)return l&&!g?l(o,d.encoder,S,"key",b):o;A=""}if("string"==typeof(v=A)||"number"==typeof v||"boolean"==typeof v||"symbol"==typeof v||"bigint"==typeof v||r.isBuffer(A)){if(l){var C=g?o:l(o,d.encoder,S,"key",b);if("comma"===a&&g){for(var w=s.call(String(A),","),P="",E=0;E<w.length;++E)P+=(0===E?"":",")+h(l(w[E],d.encoder,S,"value",b));return[h(C)+"="+P]}return[h(C)+"="+h(l(A,d.encoder,S,"value",b))]}return[h(o)+"="+h(String(A))]}var T,I=[];if(void 0===A)return I;if("comma"===a&&i(A))T=[{value:A.length>0?A.join(",")||null:void 0}];else if(i(u))T=u;else{var O=Object.keys(A);T=p?O.sort(p):O}for(var N=0;N<T.length;++N){var R=T[N],j="object"==typeof R&&void 0!==R.value?R.value:A[R];if(!c||null!==j){var L=i(A)?"function"==typeof a?a(o,R):o:o+(m?"."+R:"["+R+"]");f(I,e(j,L,a,n,c,l,u,p,m,y,b,h,g,S))}}return I};t.exports=function(e,t){var r,s=e,c=function(e){if(!e)return d;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||d.charset;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");var r=o.default;if(void 0!==e.format){if(!a.call(o.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var n=o.formatters[r],s=d.filter;return("function"==typeof e.filter||i(e.filter))&&(s=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:d.addQueryPrefix,allowDots:void 0===e.allowDots?d.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:d.charsetSentinel,delimiter:void 0===e.delimiter?d.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:d.encode,encoder:"function"==typeof e.encoder?e.encoder:d.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:d.encodeValuesOnly,filter:s,format:r,formatter:n,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:d.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:d.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:d.strictNullHandling}}(t);"function"==typeof c.filter?s=(0,c.filter)("",s):i(c.filter)&&(r=c.filter);var l,u=[];if("object"!=typeof s||null===s)return"";l=t&&t.arrayFormat in n?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var p=n[l];r||(r=Object.keys(s)),c.sort&&r.sort(c.sort);for(var m=0;m<r.length;++m){var b=r[m];c.skipNulls&&null===s[b]||f(u,y(s[b],b,p,c.strictNullHandling,c.skipNulls,c.encode?c.encoder:null,c.filter,c.sort,c.allowDots,c.serializeDate,c.format,c.formatter,c.encodeValuesOnly,c.charset))}var h=u.join(c.delimiter),g=!0===c.addQueryPrefix?"?":"";return c.charsetSentinel&&("iso-8859-1"===c.charset?g+="utf8=%26%2310003%3B&":g+="utf8=%E2%9C%93&"),h.length>0?g+h:""}}}),f=i({"node_modules/qs/lib/parse.js"(e,t){var r=l(),o=Object.prototype.hasOwnProperty,a=Array.isArray,n={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:r.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},i=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},s=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},c=function(e,t,r,a){if(e){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,i=/(\[[^[\]]*])/g,c=r.depth>0&&/(\[[^[\]]*])/.exec(n),l=c?n.slice(0,c.index):n,u=[];if(l){if(!r.plainObjects&&o.call(Object.prototype,l)&&!r.allowPrototypes)return;u.push(l)}for(var f=0;r.depth>0&&null!==(c=i.exec(n))&&f<r.depth;){if(f+=1,!r.plainObjects&&o.call(Object.prototype,c[1].slice(1,-1))&&!r.allowPrototypes)return;u.push(c[1])}return c&&u.push("["+n.slice(c.index)+"]"),function(e,t,r,o){for(var a=o?t:s(t,r),n=e.length-1;n>=0;--n){var i,c=e[n];if("[]"===c&&r.parseArrays)i=[].concat(a);else{i=r.plainObjects?Object.create(null):{};var l="["===c.charAt(0)&&"]"===c.charAt(c.length-1)?c.slice(1,-1):c,u=parseInt(l,10);r.parseArrays||""!==l?!isNaN(u)&&c!==l&&String(u)===l&&u>=0&&r.parseArrays&&u<=r.arrayLimit?(i=[])[u]=a:"__proto__"!==l&&(i[l]=a):i={0:a}}a=i}return a}(u,t,r,a)}};t.exports=function(e,t){var l=function(e){if(!e)return n;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");var t=void 0===e.charset?n.charset:e.charset;return{allowDots:void 0===e.allowDots?n.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:n.allowPrototypes,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:n.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:n.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:n.comma,decoder:"function"==typeof e.decoder?e.decoder:n.decoder,delimiter:"string"==typeof e.delimiter||r.isRegExp(e.delimiter)?e.delimiter:n.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:n.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:n.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:n.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:n.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:n.strictNullHandling}}(t);if(""===e||null==e)return l.plainObjects?Object.create(null):{};for(var u="string"==typeof e?function(e,t){var c,l={},u=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,f=t.parameterLimit===1/0?void 0:t.parameterLimit,p=u.split(t.delimiter,f),m=-1,d=t.charset;if(t.charsetSentinel)for(c=0;c<p.length;++c)0===p[c].indexOf("utf8=")&&("utf8=%E2%9C%93"===p[c]?d="utf-8":"utf8=%26%2310003%3B"===p[c]&&(d="iso-8859-1"),m=c,c=p.length);for(c=0;c<p.length;++c)if(c!==m){var y,b,h=p[c],g=h.indexOf("]="),S=-1===g?h.indexOf("="):g+1;-1===S?(y=t.decoder(h,n.decoder,d,"key"),b=t.strictNullHandling?null:""):(y=t.decoder(h.slice(0,S),n.decoder,d,"key"),b=r.maybeMap(s(h.slice(S+1),t),function(e){return t.decoder(e,n.decoder,d,"value")})),b&&t.interpretNumericEntities&&"iso-8859-1"===d&&(b=i(b)),h.indexOf("[]=")>-1&&(b=a(b)?[b]:b),o.call(l,y)?l[y]=r.combine(l[y],b):l[y]=b}return l}(e,l):e,f=l.plainObjects?Object.create(null):{},p=Object.keys(u),m=0;m<p.length;++m){var d=p[m],y=c(d,u[d],l,"string"==typeof e);f=r.merge(f,y,l)}return r.compact(f)}}}),p=i({"node_modules/qs/lib/index.js"(e,t){var r=u(),o=f(),a=c();t.exports={formats:a,parse:o,stringify:r}}}),m={PACKAGE:{NPM_NAME:"@rzl-zone/ziggy-route",PREFIX:{NAME:"RZL ZIGGY"}},REPO:{LINK:"https://github.com/rzl-zone/ziggy-route"}},d=s(p()),y=s(p()),b=e=>"boolean"==typeof e,h=e=>"function"==typeof e;function g(e){return null==e}function S(e){return Array.isArray(e)}function v(e){return"object"==typeof e&&!g(e)&&!S(e)}function A(e){if(!v(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}var C=e=>"string"==typeof e;function w(e){return v(e)&&"[object Number]"===Object.prototype.toString.call(e)}function P(e){return"number"==typeof e?Number.isNaN(e):w(e)&&Number.isNaN(e.valueOf())}var E=e=>null===e,T=(e,t={})=>{b(e)||z({value:e,options:t,requiredValidType:"boolean"})},I=(e,t={})=>{G(t,{message:({currentType:e,validType:t})=>`Second parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const r=!(!A(t)||!b(t.includeNaN))&&t.includeNaN;T(r,{message:({currentType:e,validType:t})=>`Parameter \`includeNaN\` property of the \`options\` (second parameter) must be of type \`${t}\`, but received: \`${e}\`.`});const o="number"==typeof e;return r?o:o&&!Number.isNaN(e)},O=e=>"symbol"==typeof e,N=e=>void 0===e;function R(e){return S(e)||v(e)}function j(e,t,r={}){if(!C(e)&&!R(e)&&!h(e))return!1;G(r,{message:({currentType:e,validType:t})=>`Third parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const o=void 0===r.discardUndefined||r.discardUndefined,a=void 0!==r.discardNull&&r.discardNull;T(o,{message:({currentType:e,validType:t})=>`Parameter \`discardUndefined\` property of the \`options\` (third parameter) must be of type \`${t}\`, but received: \`${e}\`.`}),T(a,{message:({currentType:e,validType:t})=>`Parameter \`discardNull\` property of the \`options\` (third parameter) must be of type \`${t}\`, but received: \`${e}\`.`});const n=[];if(C(t)&&t.trim().length>0||I(t,{includeNaN:!0})){(I(t,{includeNaN:!0})?String(t):t).split(".").forEach(e=>{const t=e.match(/^\[(\d+)\]$/),r=e.match(/^Symbol\((.+)\)$/);t?n.push(Number(t[1])):r?n.push(Symbol.for(r[1])):P(Number(e))?n.push(e):n.push(Number(e))})}else{if(!O(t))return!1;n.push(t)}let i=C(e)&&e.trim().length>0?Object(e):e;for(const e of n)if(C(e)&&e.trim().length>0||I(e,{includeNaN:!0})){if(E(i)||!Object.prototype.hasOwnProperty.call(i,e))return!1;i=i[e]}else{if(!O(e))return!1;{if(E(i)||"object"!=typeof i&&!h(i))return!1;const t=Object.getOwnPropertySymbols(i).find(t=>t===e||t.description===e.description);if(!t)return!1;i=i[t]}}return(!o||!N(i))&&(!a||!E(i))}var L=(e,t={})=>{if(!C(e))return!1;G(t,{message:({currentType:e,validType:t})=>`Second parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const r=!j(t,"trim")||t.trim;T(r,{message:({currentType:e,validType:t})=>`Parameter \`trim\` property of the \`options\` (second parameter) must be of type \`${t}\`, but received: \`${e}\`.`});return(r?e.trim():e).length>0},D=e=>"[object Error]"===Object.prototype.toString.call(e)||e instanceof Error;function M(e){return v(e)&&"[object String]"===Object.prototype.toString.call(e)}function $(e){return v(e)&&"[object Boolean]"===Object.prototype.toString.call(e)}function F(e){if("number"==typeof e||w(e)){const t=Number(e);return t===1/0||t===-1/0}return!1}function _(e){return Array.isArray(e)&&e.length>0}function x(e){return"[object Set]"===Object.prototype.toString.call(e)||e instanceof Set}var k=e=>{let t="";return S(e)?t=e.map(e=>L(e)?e.trim():"").filter(e=>e.length).join("-"):L(e)&&(t=e.trim()),t.split(/[^\p{L}\p{N}]+/u).filter(Boolean)},B=e=>{const t=new Set([]),r=e=>e.trim().split(/[^\p{L}\p{N}]+/u).filter(Boolean).join("");if(L(e)){const o=r(e);o&&t.add(o)}return _(e)&&e.forEach(e=>{if(L(e)){const o=r(e);o&&t.add(o)}}),x(e)&&e.forEach(e=>{if(L(e)){const o=r(e);o&&t.add(o)}}),t},U=(e,t)=>{if(!_(e)&&!L(e))return"";const r=k(e),o=B(t);return r.map(e=>o.has(e)?e:e.toLowerCase()).join("-")},K=class e{static FIXES_RAW=Object.freeze({string:"String",number:"Number",boolean:"Boolean",bigint:"Bigint",symbol:"Symbol",undefined:"Undefined",null:"Null",regexp:"Reg Exp",reflect:"Reflect",proxy:"Proxy",atomics:"Atomics",array:"Array",object:"Object",function:"Function",arguments:"Arguments",asyncfunction:"Async Function",generatorfunction:"Generator Function",asyncgeneratorfunction:"Async Generator Function",generator:"Generator",promise:"Promise",evalerror:"Eval Error",rangeerror:"Range Error",referenceerror:"Reference Error",syntaxerror:"Syntax Error",typeerror:"Type Error",urierror:"URI Error",aggregateerror:"Aggregate Error",error:"Error",int8array:"Int 8 Array",uint8array:"Uint 8 Array",uint8clampedarray:"Uint 8 Clamped Array",int16array:"Int 16 Array",uint16array:"Uint 16 Array",int32array:"Int 32 Array",uint32array:"Uint 32 Array",float32array:"Float 32 Array",float64array:"Float 64 Array",bigint64array:"Big Int 64 Array",biguint64array:"Big Uint 64 Array",arraybuffer:"Array Buffer",sharedarraybuffer:"Shared Array Buffer",dataview:"Data View",arraybufferview:"Array Buffer View",map:"Map",set:"Set",weakmap:"Weak Map",weakset:"Weak Set",mapiterator:"Map Iterator",weakmapiterator:"Weak Map Iterator",setiterator:"Set Iterator",weaksetiterator:"Weak Set Iterator",arrayiterator:"Array Iterator",stringiterator:"String Iterator",asynciterator:"Async Iterator",iteratorresult:"Iterator Result",arrayiteratorresult:"Array Iterator Result",readablestream:"Readable Stream",writablestream:"Writable Stream",transformstream:"Transform Stream",readablestreamdefaultreader:"Readable Stream Default Reader",writablestreamdefaultwriter:"Writable Stream Default Writer",readablestreamdefaultcontroller:"Readable Stream Default Controller",transformstreamdefaultcontroller:"Transform Stream Default Controller",abortcontroller:"Abort Controller",abortsignal:"Abort Signal",fetch:"fetch",request:"Request",response:"Response",headers:"Headers",formdata:"FormData",blob:"Blob",file:"File",filelist:"FileList",filereader:"FileReader",intl:"Intl",collator:"Intl. Collator",datetimeformat:"Intl. Date Time Format",displaynames:"Intl. Display Names",listformat:"Intl. List Format",locale:"Intl. Locale",numberformat:"Intl. Number Format",pluralrules:"Intl. Plural Rules",relativetimeformat:"Intl. Relative Time Format",segmenter:"Intl. Segmenter",weakref:"Weak Ref",urlpattern:"URLPattern",structuredclone:"structured Clone",finalizationregistry:"Finalization Registry",performance:"Performance",performanceobserver:"Performance Observer",performanceentry:"Performance Entry",performancemark:"Performance Mark",performancemeasure:"Performance Measure",webassembly:"Web Assembly",wasmmodule:"WebAssembly. Module",wasminstance:"WebAssembly. Instance",wasmmemory:"WebAssembly. Memory",wasmtable:"WebAssembly. Table",buffer:"Buffer",process:"Process",eventemitter:"Event Emitter",stream:"Stream",fs:"fs",path:"path",url:"URL",urlsearchparams:"URL Search Params",node:"Node",element:"Element",htmlelement:"HTML Element",svgelement:"SVG Element",document:"Document",documentfragment:"Document Fragment",shadowroot:"Shadow Root",nodelist:"Node List",htmlcollection:"HTML Collection",resizeobserver:"Resize Observer",mutationobserver:"Mutation Observer",intersectionobserver:"Intersection Observer",symboliterator:"Symbol. Iterator",symbolasynciterator:"Symbol. Async Iterator",symboltostringtag:"Symbol. To String Tag",symbolspecies:"Symbol. Species",symbolhasinstance:"Symbol. Has Instance",symbolisconcatspreadable:"Symbol. Is Concat Spreadable",symbolunscopables:"Symbol. Unscopables",symbolmatch:"Symbol. Match",symbolreplace:"Symbol. Replace",symbolsearch:"Symbol. Search",symbolsplit:"Symbol. Split",symboltoprimitive:"Symbol. To Primitive",symbolmatchall:"Symbol. Match All",symbolarguments:"Symbol. Arguments",math:"Math",bigintconstructor:"Bigint Constructor",numberconstructor:"Number Constructor",stringconstructor:"String Constructor",booleanconstructor:"Boolean Constructor",formdataevent:"Form Data Event",customevent:"Custom Event",messagechannel:"Message Channel",messageport:"Message Port",messageevent:"Message Event",websocket:"Web Socket",eventsource:"Event Source",indexeddb:"IndexedDB",idbrequest:"IDB Request",idbtransaction:"IDB Transaction",idbobjectstore:"IDB Object Store",idbcursor:"IDB Cursor",localstorage:"Local Storage",sessionstorage:"Session Storage",navigator:"Navigator",geolocation:"Geolocation",clipboard:"Clipboard",notification:"Notification",canvas:"Canvas",canvasrenderingcontext2d:"Canvas Rendering Context 2D",offscreencanvas:"Offscreen Canvas",webglrenderingcontext:"WebGL Rendering Context",imagedata:"Image Data",imagebitmap:"Image Bitmap",mediastream:"Media Stream",mediarecorder:"Media Recorder",mediastreamtrack:"Media Stream Track",audiocontext:"Audio Context",audiobuffer:"Audio Buffer",audioworklet:"Audio Worklet",worker:"Worker",sharedworker:"Shared Worker",serviceworker:"Service Worker",workerglobalscope:"Worker Global Scope",structuredcloneerror:"Structured Clone Error",transferable:"Transferable",report:"Report",console:"Console",diagnosticreport:"Diagnostic Report",domrect:"DOM Rect",dompoint:"DOM Point",dommatrix:"DOM Matrix",domparser:"DOM Parser",xmlhttprequest:"XML HTTP Request",customelementregistry:"Custom Element Registry",text:"Text",comment:"Comment",animation:"Animation",documenttype:"Document Type",characterdata:"Character Data",animationevent:"Animation Event",customemmetregistry:"Custom Emmet Registry",websocketmessageevent:"WebSocket Message Event"});static SPECIAL_TYPE=Object.freeze(["-Infinity","Infinity","NaN"]);static ACRONYMS=Object.freeze(["URI","URL","URN","HTTP","HTTPS","FTP","FTPS","SFTP","SSH","SMTP","POP3","IMAP","WS","WSS","TCP","UDP","IP","ICMP","ARP","RTP","RTSP","SIP","HTML","XHTML","XML","WBR","CSS","SVG","JSON","JSONP","DOM","IDB","DB","RTC","ICE","TLS","SSL","CORS","WASM","CSR","SSR","PWA","DPI","CDN","JS","TS","JSX","TSX","CLI","API","SDK","UI","UX","OS","ID","UUID","PID","NPM","YARN","ESM","CJS","BOM","MVC","MVVM","ORM","DAO","CRUD","FIFO","LIFO","OOP","FP","REPL","CSV","TSV","SQL","YAML","JSON","MD","INI","PDF","XLS","XLSX","RTF","XML","BMP","GIF","PNG","JPEG","WEBP","MP3","MP4","AVI","MOV","FLAC","MKV","WAV","URLSearchParams","XHR","2D","3D","GL","WebGL","TTL","UID","GID","MAC","IP","DNS","DHCP","VPN","LAN","WAN","SSID","IoT","API","SDK","CLI","LTS","EOL","CPU","GPU","RAM","ROM","SSD","HDD","BIOS","USB","PCI","SATA","DIMM","DDR","VGA","HDMI","KVM","ASIC","FPGA","SoC","NAS","SAN","TCP","UDP","IP","MAC","DNS","DHCP","VPN","LAN","WAN","SSID","NAT","QoS","MPLS","BGP","OSPF","ICMP","IGMP","LLDP","ARP","RARP","AES","RSA","OTP","MFA","PKI","VPN","IAM","ACL","CSP","XSS","CSRF","HSTS","WAF","DDoS","IDS","IPS","SOC","SIEM","AWS","GCP","AZURE","CI","CD","K8S","IaC","PaaS","SaaS","IaaS","API","CLI","SDK","REST","SOAP","JSON-RPC","gRPC","ELB","EKS","AKS","FaaS","CaaS","GUI","IDE","FAQ","UX","UI","CLI","API","SDK","LTS","EOL","WYSIWYG","CMS","CRM","GPS","LED","OLED","LCD","RFID","NFC","CPU","GPU","AI","ML","DL","DB","SQL","NoSQL","ORM","JSON","XML","CSV","HTTP","HTTPS","TDD","BDD","CI","CD","QA","SLA","SLO","MTTR","MTBF","UAT","RPA","KPI","OKR","ROI","RFP","SLA","CRM","ERP","PMO","SCRUM","KANBAN","FPS","HDR","VR","AR","3D","2D","MP3","MP4","GIF","PNG","JPEG","SVG","BMP","TIFF","POSIX","NTFS","FAT","EXT","EXT4","APFS","HFS","ISO","HTML","CSS","JS","TS","PHP","SQL","JSON","XML","YAML","BASH","ZSH","JSON","YAML","INI","DOTENV","VM","VMM","VPC","OCI","LXC","Docker","K8S","CRI","CNI"]);static FIXES_CASTABLE_TABLE=Object.freeze(Object.entries(e.FIXES_RAW).reduce((t,[r,o])=>(t[e.normalizeKeyForCase(r)]=o,t),{}));formatCase="toKebabCase";useAcronyms=!1;constructor(e){this.formatCase=e?.formatCase,this.useAcronyms=e?.useAcronyms}determineOptions(e){return{formatCase:e?.formatCase||this.formatCase,useAcronyms:e?.useAcronyms??this.useAcronyms}}getHtmlElementType(t,r){const{formatCase:o,useAcronyms:a}=this.determineOptions(r);if("undefined"==typeof HTMLElement||!(t instanceof HTMLElement))return null;const n=t.tagName,i={a:"Anchor",abbr:"Abbreviation",address:"Address",area:"Area",article:"Article",aside:"Aside",audio:"Audio",b:"Bold",base:"Base",bdi:"BDI",bdo:"BDO",blockquote:"Blockquote",body:"Body",br:"Break",button:"Button",canvas:"Canvas",caption:"Caption",cite:"Cite",code:"Code",col:"Column",colgroup:"Column Group",data:"Data",datalist:"Datalist",dd:"Definition Description",del:"Deleted Text",details:"Details",dfn:"Definition",dialog:"Dialog",div:"Div",dl:"Definition List",dt:"Definition Term",em:"Emphasis",embed:"Embed",fieldset:"Fieldset",figcaption:"Figcaption",figure:"Figure",footer:"Footer",form:"Form",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",head:"Head",header:"Header",hr:"Horizontal Rule",html:"HTML",i:"Italic",iframe:"IFrame",img:"Image",input:"Input",ins:"Inserted Text",kbd:"Keyboard",label:"Label",legend:"Legend",li:"List Item",link:"Link",main:"Main",map:"Map",mark:"Mark",meta:"Meta",meter:"Meter",nav:"Nav",noscript:"NoScript",object:"Object",ol:"Ordered List",optgroup:"Option Group",option:"Option",output:"Output",p:"Paragraph",param:"Param",picture:"Picture",pre:"Preformatted",progress:"Progress",q:"Quote",rp:"RP",rt:"RT",ruby:"Ruby",s:"Strikethrough",samp:"Sample",script:"Script",section:"Section",select:"Select",small:"Small",source:"Source",span:"Span",strong:"Strong",style:"Style",sub:"Subscript",summary:"Summary",sup:"Superscript",table:"Table",tbody:"Table Body",td:"Table Data",template:"Template",textarea:"Textarea",tfoot:"Table Footer",th:"Table Header",thead:"Table Head",time:"Time",title:"Title",tr:"Table Row",track:"Track",u:"Underline",ul:"Unordered List",var:"Variable",video:"Video",wbr:"WBR"},s=e.FIXES_CASTABLE_TABLE[e.normalizeKeyForCase(n)]??(i[n]?`HTML ${i[n]} Element`:"HTML Element");return this.converter(s,{formatCase:o,useAcronyms:a})}getCommentNodeType(t,r){const{formatCase:o,useAcronyms:a}=this.determineOptions(r);return t instanceof Comment?this.converter(e.FIXES_CASTABLE_TABLE[e.normalizeKeyForCase("comment")]??"Comment",{formatCase:o,useAcronyms:a}):null}getTextNodeType(t,r){const{formatCase:o,useAcronyms:a}=this.determineOptions(r);return t instanceof Text?this.converter(e.FIXES_CASTABLE_TABLE[e.normalizeKeyForCase("text")]??"Text",{formatCase:o,useAcronyms:a}):null}getOtherNodeType(t,r){const{formatCase:o,useAcronyms:a}=this.determineOptions(r);return"undefined"!=typeof Node&&t instanceof Node?this.converter(e.FIXES_CASTABLE_TABLE[e.normalizeKeyForCase("node")]??"Node",{formatCase:o,useAcronyms:a}):null}getSymbolName(t,r){const{formatCase:o,useAcronyms:a}=this.determineOptions(r),n=new Map([[Symbol.iterator,"symboliterator"],[Symbol.asyncIterator,"symbolasynciterator"],[Symbol.toStringTag,"symboltostringtag"],[Symbol.species,"symbolspecies"],[Symbol.hasInstance,"symbolhasinstance"],[Symbol.isConcatSpreadable,"symbolisconcatspreadable"],[Symbol.unscopables,"symbolunscopables"],[Symbol.match,"symbolmatch"],[Symbol.replace,"symbolreplace"],[Symbol.search,"symbolsearch"],[Symbol.split,"symbolsplit"],[Symbol.toPrimitive,"symboltoprimitive"],[Symbol.matchAll,"symbolmatchall"]]).get(t);return n?this.converter(e.FIXES_CASTABLE_TABLE[e.normalizeKeyForCase(n)]??n,{formatCase:o,useAcronyms:a}):this.converter(e.FIXES_CASTABLE_TABLE[e.normalizeKeyForCase("symbol")]??"Symbol",{formatCase:o,useAcronyms:a})}detectDomNodeType(e,t){const{formatCase:r,useAcronyms:o}=this.determineOptions(t);try{return this.getHtmlElementType(e,{formatCase:r,useAcronyms:o})||this.getCommentNodeType(e,{formatCase:r,useAcronyms:o})||this.getTextNodeType(e,{formatCase:r,useAcronyms:o})||this.getOtherNodeType(e,{formatCase:r,useAcronyms:o})}catch{return null}}isProxy(e){if(E(e)||!R(e))return!1;const t=Object.prototype.toString.call(e);if(["[object Array]","[object Date]","[object RegExp]","[object Map]","[object Set]","[object WeakMap]","[object WeakSet]","[object Function]","[object Error]","[object Promise]","[object Generator]","[object GeneratorFunction]","[object AsyncFunction]"].includes(t))return!1;try{return Reflect.defineProperty(e,"__proxy_detect__",{configurable:!0,value:1}),Reflect.deleteProperty(e,"__proxy_detect__"),!1}catch{return!0}}converter(t,r){const{formatCase:o,useAcronyms:a}=this.determineOptions(r),n=a?e.ACRONYMS:[];switch(o){case"slugify":return((e,t)=>{if(!_(e)&&!L(e))return"";const r=k(e),o=B(t);return r.map(e=>o.has(e)?e:e.toLowerCase()).join("-").replace(/^-+|-+$/g,"")})(t,n);case"toDotCase":return((e,t)=>{if(!_(e)&&!L(e))return"";const r=k(e),o=B(t);return r.map(e=>o.has(e)?e:e.toLowerCase()).join(".")})(t,n);case"toCamelCase":return((e,t)=>{if(!_(e)&&!L(e))return"";const r=k(e),o=B(t);return r.map((e,t)=>o.has(e)?e:0===t?e.toLowerCase():e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join("")})(t,n);case"toSnakeCase":return((e,t)=>{if(!_(e)&&!L(e))return"";const r=k(e),o=B(t);return r.map(e=>o.has(e)?e:e.toLowerCase()).join("_")})(t,n);case"toLowerCase":return((e,t)=>{if(!_(e)&&!L(e))return"";const r=k(e),o=B(t);return r.map(e=>o.has(e)?e:e.toLowerCase()).join(" ")})(t,n);case"toPascalCase":return((e,t)=>{if(!_(e)&&!L(e))return"";const r=k(e),o=B(t);return r.map(e=>o.has(e)?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join("")})(t,n);case"toPascalCaseSpace":return((e,t)=>{if(!_(e)&&!L(e))return"";const r=k(e),o=B(t);return r.map(e=>o.has(e)?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")})(t,n);default:return U(t,n)}}static normalizeKeyForCase(e){return e.replace(/[\s_\-\.]+/g,"").toLowerCase()}static get castableTable(){return e.FIXES_CASTABLE_TABLE}static get specialType(){return this.SPECIAL_TYPE}static get fixesRaw(){return this.FIXES_RAW}static get acronymsList(){return this.ACRONYMS}},H=(()=>{const e=new Map;return(t,r={})=>{A(r)||(r={});const o=JSON.stringify({formatCase:r.formatCase||"toKebabCase",useAcronyms:r.useAcronyms??!1});let a=e.get(o);if(a||(e.size>=25&&e.clear(),a=new K(r),e.set(o,a)),E(t))return a.converter(K.castableTable[K.normalizeKeyForCase("null")]??"Null");if(P(t))return"NaN";if(F(t))return String(t);if("undefined"!=typeof BigInt&&t===BigInt)return a.converter(K.castableTable[K.normalizeKeyForCase("bigint constructor")]);if(w(t)||t===Number)return a.converter(K.castableTable[K.normalizeKeyForCase("number constructor")]);if(M(t)||t===String)return a.converter(K.castableTable[K.normalizeKeyForCase("string constructor")]);if($(t)||t===Boolean)return a.converter(K.castableTable[K.normalizeKeyForCase("boolean constructor")]);const n=typeof t;if(!R(t)&&!h(t)&&"symbol"!==n)return a.converter(K.castableTable[K.normalizeKeyForCase(n)]??n);if("symbol"===n)return a.getSymbolName(t);if(R(t)&&"EventEmitter"===t.constructor?.name)return a.converter(K.castableTable[K.normalizeKeyForCase("event emitter")]??"Event Emitter");const i=a.detectDomNodeType(t);if(i)return i;if((e=>"undefined"!=typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(e))(t))return a.converter(K.castableTable[K.normalizeKeyForCase("buffer")]??"Buffer");if(a.isProxy(t))return a.converter(K.castableTable[K.normalizeKeyForCase("proxy")]??"Proxy");if(v(t)&&h(t?.next)&&h(t?.throw))return a.converter(K.castableTable[K.normalizeKeyForCase("generator")]??"Generator");if(D(t)){const e=t.constructor?.name??"Error";return a.converter(K.castableTable[K.normalizeKeyForCase(e)]??K.castableTable[K.normalizeKeyForCase(e.replace(/\s+/g,""))]??e)}if(R(t)&&"done"in t&&"value"in t&&2===Object.keys(t).length)return a.converter(K.castableTable[K.normalizeKeyForCase("iterator result")]);if(E(Object.getPrototypeOf(t)))return a.converter(K.castableTable[K.normalizeKeyForCase("object")]??"Object");const s=Object.prototype.toString.call(t).slice(8,-1)||"Object",c=K.castableTable[K.normalizeKeyForCase(s)];if(c)return a.converter(c);const l=t?.constructor?.name;return l&&"Object"!==l?a.converter(K.castableTable[K.normalizeKeyForCase(l)]??l):a.converter(s)}})(),W=(e,t)=>{switch(e){case"Error":throw new Error(t);case"EvalError":throw new EvalError(t);case"RangeError":throw new RangeError(t);case"ReferenceError":throw new ReferenceError(t);case"SyntaxError":throw new SyntaxError(t);case"URIError":throw new URIError(t);default:throw new TypeError(t)}};function z(e){const{requiredValidType:t,value:r,options:o}=e||{},{message:a,formatCase:n,useAcronyms:i,errorType:s="TypeError"}=A(o)?o:{},c=U(t),l=H(r,{formatCase:n,useAcronyms:i}),u={currentType:l,validType:c},f=`Parameter input (\`value\`) must be of type \`${c}\`, but received: \`${l}\`.`,p=h(a)?L(a(u))?a(u).trim():f:L(a)?a.trim():f;return W(s,p)}function G(e,t={}){A(e)||z({value:e,options:t,requiredValidType:"plain object"})}var V=(e,t={})=>!L(e,t);var X=(e,t={})=>{G(t,{message:({currentType:e,validType:t})=>`Second parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const r=!!j(t,"pretty")&&t.pretty,o=!j(t,"sortKeys")||t.sortKeys,a=!!j(t,"sortArray")&&t.sortArray,n=!!j(t,"keepUndefined")&&t.keepUndefined;if(!(b(o)&&b(a)&&b(r)&&b(n)))throw new TypeError(`Parameters \`sortKeys\`, \`sortArray\`, \`keepUndefined\` and \`pretty\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: "['sortKeys': \`${H(o)}\`, 'sortArray': \`${H(a)}\`, 'keepUndefined': \`${H(n)}\`, 'pretty': \`${H(r)}\`]".`);if(N(e))return n?"undefined":"null";const i=new WeakSet,s=e=>E(e)||!R(e)&&!h(e),c=e=>{if(w(e)){const t=e.valueOf();return P(t)||F(t)?null:t}if(M(e))return e.valueOf();if($(e))return e.valueOf();if(!h(e)&&!O(e)){if((e=>"bigint"==typeof e)(e))return e.toString();if(P(e)||F(e))return null;if(N(e))return n?void 0:null;if(R(e)){if(i.has(e))return"[Circular]";if(i.add(e),((e,t={})=>{G(t,{message:({currentType:e,validType:t})=>`Second parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const r=!(!A(t)||!b(t.skipInvalidDate))&&t.skipInvalidDate,o=e instanceof Date;return r?o:o&&!P(e.getTime())})(e))return e.toISOString();if(function(e){return"[object Map]"===Object.prototype.toString.call(e)||e instanceof Map}(e))return{map:Array.from(e.entries()).map(([e,t])=>[e,c(t)])};if(x(e))return{set:Array.from(e.values()).map(c)};if(S(e)){const t=e.map(c);if(a){const e=[],r=[];for(const o of t)s(o)?e.push(o):r.push(o);return e.sort((e,t)=>I(e)&&I(t)?e-t:String(e).localeCompare(String(t))),[...e,...r]}return t}const t=Object.keys(e);o&&t.sort((e,t)=>{const r=Number(e),o=Number(t);return P(r)||P(o)?e.localeCompare(t):r-o});const r={};if(v(e))for(const o of t){const t=c(e[o]);N(t)||(r[o]=t)}return r}return e}};try{return JSON.stringify(c(e),null,r?2:0)}catch(e){return console.warn("Error in safeStableStringify:",e),"{}"}},q=class extends Error{constructor(e,t,r){const o=r?.trim()||m.PACKAGE.PREFIX.NAME,a=e.trim();super(`\n${o.startsWith("❌")?o:"❌ "+o} - ${a}`),this.originalError=t,this.name="RouteConfigError",Error.captureStackTrace&&Error.captureStackTrace(this,Q)}},Q=class e extends Error{constructor(t,r,o){const a=o?.trim()||m.PACKAGE.PREFIX.NAME,n=t.trim();super(`\n${a.startsWith("❌")?a:"❌ "+a} - ${n}`),this.originalError=r,this.name="RoutePropsError",Error.captureStackTrace&&Error.captureStackTrace(this,e)}},J=class{name;definition;config;wheres;bindings={};constructor(e,t,r){this.name=e,this.definition=t,this.bindings=t?.bindings??{},this.wheres=t?.wheres??{},this.config=r}get template(){const e=`${this.origin}/${this.definition?.uri}`.replace(/\/+$/,"");return V(e)?"/":e}get origin(){if(!this.config?.absolute)return"";if(this.definition?.domain){const e=this.config.url.match(/^\w+:\/\//);if(!e)throw new q('Invalid `config.url` missing protocol (e.g., `"http://"` or `"https://"`).');return`${e[0]}${this.definition.domain}${this.config.port?`:${this.config.port}`:""}`}return this.config.url}get parameterSegments(){return this.template.match(/{[^}?]+\??}/g)?.map(e=>({name:e.replace(/{|\??}/g,""),required:!/\?}$/.test(e)}))??[]}matchesUrl(e){if(!this.definition?.methods.includes("GET"))return!1;const t=this.template.replace(/[.*+$()[\]]/g,"\\$&").replace(/(\/?){([^}?]*)(\??)}/g,(e,t,r,o)=>{const a=`(?<${r}>${this.wheres[r]?.replace(/(^\^)|(\$$)/g,"")||"[^/?]+"})`;return o?`(${t}${a})?`:`${t}${a}`}).replace(/^\w+:\/\//,""),[r,o]=e.replace(/^\w+:\/\//,"").split("?"),a=new RegExp(`^${t}/?$`).exec(r)??new RegExp(`^${t}/?$`).exec(decodeURI(r));if(a){for(const e in a.groups)a.groups[e]=C(a.groups[e])?decodeURIComponent(a.groups[e]):a.groups[e];return{params:a.groups,query:(0,y.parse)(o)}}return!1}compile(e={}){const t=this.template.replace(/{([^}?]+)(\??)}/g,(t,r,o)=>{const a=e[r];if(!o&&g(a))throw new Q(`Invalid \`"${r}"\` parameter is required for route \`"${this.name}"\`.`);const n=this.wheres[r];if(n){const e=new RegExp(`^${n}$`);if(C(a)&&!e.test(a))throw new Q(`Invalid \`"${r}"\` parameter \`"${a}"\` does not match required format \`${n}\` for route \`"${this.name}"\`.`)}return encodeURI(C(a)?a:"").replace(/%7C/g,"|").replace(/%25/g,"%").replace(/\$/g,"%24")});let r=t;if(this.config?.absolute&&t.includes("://")){const[e,o]=t.split("://");r=e+"://"+o.replace(/\/{2,}/g,"/")}else r=t.replace(/\/{2,}/g,"/");return"/"===r?"/":r.replace(/\/+$/,"")}},Y=e=>X(e,{keepUndefined:!0}),{REPO:Z}=m,ee=`\n\nℹ️ Learn more: \`${Z.LINK}#importing-the-route-function\`.`,te=class e{absolute;url;port;defaults;routes;location;constructor(e){this.absolute=e.absolute,this.url=e.url,this.port=e.port,this.defaults=e.defaults,this.routes=e.routes,this.location=e.location}static isRouterConfigRaw(e){if(!A(e))return!1;if(!A(e))throw new q(`Invalid \`route()\` the \`config\` property at (fourth parameter) detected:\n- Ensure that \`appRoutes\` is defined globally or passed as a valid config object, but received: \`${H(e)}\`, with value: \`${Y(e)}\`.${ee}`);if(!C(e.url))throw new q(`Invalid \`route()\` parameter \`config.url\` property of the \`config\` (fourth parameter) detected:\n- Ensure that \`appRoutes\` is defined globally or passed as a valid \`config.url\`.\n - Parameter \`config.url\` must be of type \`string\` or \`null\`, but received: \`${H(e.url)}\`.${ee}`);if(!E(e.port)&&!I(e.port))throw new q(`Invalid \`route()\` parameter \`config.port\` property of the \`config\` (fourth parameter) detected:\n- Ensure that \`appRoutes\` is defined globally or passed as a valid \`config.port\`.\n - Parameter \`config.port\` must be of type \`number\` or \`null\`, but received: \`${H(e.port)}\`, with value: \`${Y(e.port)}\`.${ee}`);if(!A(e.defaults))throw new q(`Invalid \`route()\` parameter \`config.defaults\` property of the \`config\` (fourth parameter) detected:\n- Ensure that \`appRoutes\` is defined globally or passed as a valid \`config.defaults\`.\n - Parameter \`config.defaults\` must be of type \`plain-object\` defaults property, but received: \`${H(e.defaults)}\`, with value: \`${Y(e.defaults)}\`.${ee}`);if(!A(e.routes))throw new q(`Invalid \`route()\` parameter \`config.routes\` property of the \`config\` (fourth parameter) detected:\n- Ensure that \`appRoutes\` is defined globally or passed as a valid \`config.routes\`.\n - Parameter \`config.routes\` must be of type \`plain-object\` routes property, but received: \`${H(e.routes)}\`, with value: \`${Y(e.routes)}\`.${ee}`);if(j(e,"location")){const t=e.location;if(!A(t))throw new q(`Invalid \`route()\` parameter \`config.location\` property of the \`config\` (fourth parameter) detected:\n- Ensure that \`appLocation\` is defined globally or passed as a valid \`config.location\`.\n - Parameter \`config.location\` must be of type \`plain-object ({ host?: string | undefined; pathname?: string | undefined; search?: string | undefined; })\` of location property, but received: \`${H(t)}\`, with value: \`${Y(t)}\`.${ee}`);const r=t;if(j(r,"host")&&!C(r.host))throw new q(`Invalid \`route()\` parameter \`config.location.host\` property of the \`config\` (fourth parameter) detected:\n- Ensure that \`appLocation\` is defined globally or passed as a valid \`config.location\`.\n - Parameter \`config.location.host\` must be of type \`string\` or \`undefined\`, but received: \`${H(r.host)}\`, with value: \`${Y(r.host)}\`.${ee}`);if(j(r,"pathname")&&!C(r.pathname))throw new q(`Invalid \`route()\` parameter \`config.location.pathname\` property of the \`config\` (fourth parameter) detected:\n- Ensure that \`appLocation\` is defined globally or passed as a valid \`config.location\`.\n - Parameter \`config.location.pathname\` must be of type \`string\` or \`undefined\`, but received: \`${H(r.pathname)}\`, with value: \`${Y(r.pathname)}\`.${ee}`);if(j(r,"search")&&!C(r.search))throw new q(`Invalid \`route()\` parameter \`config.location.search\` property of the \`config\` (fourth parameter) detected:\n- Ensure that \`appLocation\` is defined globally or passed as a valid \`config.location\`.\n - Parameter \`config.location.search\` must be of type \`string\` or \`undefined\`, but received: \`${H(r.search)}\`, with value: \`${Y(r.search)}\`.${ee}`)}return!0}static validateAndWrap(t){try{if(t instanceof e)return t;if(!this.isRouterConfigRaw(t))throw new q(`Invalid \`route()\` the \`config\` property at (fourth parameter) detected:\n- Ensure that \`appRoutes\` is defined globally or passed as a valid config object, but received: \`${H(t)}\`, with value: \`${Y(t)}\`.${ee}`);return new e(t)}catch(e){if(e instanceof q)throw e;throw new q(`Invalid \`route()\` the \`config\` property at (fourth parameter) detected:\n- Ensure that \`appRoutes\` is defined globally or passed as a valid config object, but received: \`${H(t)}\`, with value: \`${Y(t)}\`.${ee}`,D(e)?e:new Error(String(e)))}}},{REPO:re,PACKAGE:oe}=m,ae=class extends String{_config;_route;_params={};constructor(e,t,r=!1,o){if(super(),!g(e)&&V(e))throw new Q(`Invalid \`route()\`:\n- First parameter (\`name\`) must be of type a \`string\` and a non empty-string.\n- Use \`undefined\` if you don't want to provide a name.\n- Make sure to call a valid \`Router\` instance method, or you'll encounter an error. \n\nℹ️ Learn more: \`${re.LINK}#%EF%B8%8F-warning-calling-route-without-arguments\`.`);if(!E(r)&&!b(r))throw new Q(`Invalid \`route()\`:\n- Third parameter (\`absolute\`) must be of type a \`boolean\` or \`undefined\`, but received: \`${H(r)}\`. \n\nℹ️ Learn more: \`${re.LINK}#absolute-url\`.`);r=!!r;const a=this.safeValidateRouterConfig(o||E(o)?o:"undefined"!=typeof appRoutes?appRoutes:globalThis.appRoutes);if(this._config={...a,absolute:r},e){if(!this._config.routes[e])throw new Q(`Route name \`"${e}"\` (first parameter) is not in the route list.`);this._route=new J(e,this._config.routes[e],this._config),this._params=this._parse(t)}}safeValidateRouterConfig(e){try{return te.validateAndWrap(e)}catch(e){if(e instanceof q)throw e;throw new Error(`${oe.PREFIX.NAME} - Unknown error while validating \`route()\` config`,{cause:D(e)?e:void 0})}}_unresolve(e){e?this._config.absolute&&e.startsWith("/")&&(e=this._location().host+e):e=this._currentUrl();let t={};const[r,o]=Object.entries(this._config.routes).find(([r,o])=>t=new J(r,o,this._config).matchesUrl(e))||[void 0,void 0];return{name:r,...t,route:o}}_currentUrl(){const{host:e,pathname:t,search:r}=this._location();return(this._config.absolute?e+t:t.replace(this._config.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"))+r}_location(){const{host:e="",pathname:t="",search:r=""}="undefined"!=typeof window&&"undefined"!=typeof document?window.location:{};return{host:this._config.location?.host??e,pathname:this._config.location?.pathname??t,search:this._config.location?.search??r}}_parse(e={},t=this._route){if(!A(e)&&!S(e))throw new Q(`Invalid \`route()\` \`params\` property detected. \n- Second Parameter (\`params\`) must be of type \`plain-object\` or \`array\`, but received: \`${H(e)}\`.\n\nℹ️ More info: ${re.LINK}#parameters.`);e??={},e=["string","number"].includes(typeof e)?[e]:e;const r=t?.parameterSegments.filter(({name:e})=>!this._config.defaults[e]);return S(e)?e=e.reduce((e,t,o)=>r?.[o]?{...e,[r[o].name]:t}:A(t)||S(t)?{...e,...t}:{...e,...C(t)?{[t]:""}:{}},{}):1===r?.length&&!e[r?.[0].name]&&(t&&e.hasOwnProperty(Object.values(t.bindings)[0])||e.hasOwnProperty("id"))&&(e={[r?.[0].name]:e}),{...this._defaults(t),...this._substituteBindings(e,t)}}_defaults(e){return e?.parameterSegments.filter(({name:e})=>this._config.defaults[e]).reduce((e,{name:t})=>({...e,[t]:this._config.defaults[t]}),{})}_substituteBindings(e,t=this._route){return Object.entries(e).reduce((e,[r,o])=>{if(!o||"object"!=typeof o||S(o)||!t?.parameterSegments.some(({name:e})=>e===r))return{...e,[r]:o};if(!o.hasOwnProperty(t.bindings[r])){if(!o.hasOwnProperty("id"))throw new Q(`Object passed as \`"${r}"\` parameter is missing route model binding key \`${t.bindings[r]}\`.\n\nℹ️ More info: ${re.LINK}#parameters.`);t.bindings[r]="id"}return{...e,[r]:o[t.bindings[r]]}},{})}get params(){const{params:e,query:t}=this._unresolve(),r={};for(const e in t){const o=t[e];C(o)?r[e]=o:S(o)?r[e]=o.filter(C).join(","):v(o)&&(r[e]=X(o))}return{...e,...r}}get routeParams(){return this._unresolve().params||{}}get queryParams(){return this._unresolve().query||{}}has(e){if(!C(e))throw new Q(`Invalid \`route().has(...)\` parameter \`name\` detected.\n- First parameter (\`name\`) must be of type \`string\`, but received: \`${H(e)}\`.`);return this._config.routes.hasOwnProperty(e)}current(e,t={}){if(e&&!C(e))throw new Q(`Invalid \`route().current(...)\` parameter \`name\` detected.\n- First parameter (\`name\`) must be of type \`string\`, but received: \`${H(e)}\`.`);if(t&&!A(t)&&!S(t))throw new Q(`Invalid parameter \`params\` (\`second parameter\`) value passed to \`route().current(...)\`, expected a object or array (e.g., { foo: "bar" } or [{"foo": "bar"}]), but received: \`${H(t)}\`.\n\nℹ️ Learn more: \`${re.LINK}#routecurrent-optionally-accepts-parameters-as-its-second-argument-and-will-check-that-their-values-also-match-in-the-current-url\`.`);t??={};const{name:r,params:o,query:a,route:n}=this._unresolve();if(!e)return r;const i=C(r)&&new RegExp(`^${e.replace(/\./g,"\\.").replace(/\*/g,".*")}$`).test(r);if(g(t)||!i)return i;const s=new J(r,n,this._config);t=this._parse(t,s);const c={...o,...a};if(Object.values(t).every(e=>!e)&&!Object.values(c).some(e=>!N(e)))return!0;const l=(e,t)=>Object.entries(e).every(([e,r])=>{if(S(r)&&S(t[e])){const o=t[e];return r.every(e=>o.includes(e))}return v(r)&&v(t[e])?l(r,t[e]):t[e]==r});return l(t,c)}toString(){const e=this._route,t=this._params??={};if(!e)throw new Q(`Function route() was called without a \`name\` (first parameter) but used as a \`string\`.\n- Pass a valid route name, or use route().current() to get the current route name — or route().current('dashboard') to check if it matches.\n\nℹ️ More info: ${re.LINK}#%EF%B8%8F-warning-calling-route-without-arguments.`);const r=Object.keys(t).filter(t=>!e.parameterSegments.some(({name:e})=>e===t)).filter(e=>"_query"!==e).reduce((e,r)=>({...e,[r]:t[r]}),{}),o=t._query;if(!N(o)&&!A(o))throw new Q(`Invalid parameter \`_query\` property of the \`params\` (second parameter) value passed to \`route()\`, expected a \`plain-object\` (e.g., { foo: "bar" }), but received: \`${H(o)}\`.\n\nℹ️ More info: ${re.LINK}#query-parameters.`);return e.compile(t)+(0,d.stringify)({...r,...o},{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:(e,t)=>b(e)?String(+e):t(e)})}valueOf(){return this.toString()}};N(globalThis.route)||console.warn(`[${m.PACKAGE.PREFIX.NAME}] WARNING:\n- Detected existing global \`route\`.\n- It will be overridden by "${m.PACKAGE.NPM_NAME}" route implementation.`),globalThis.route=function(e,t,r=!1,o){const a=new ae(e,t,r,o);return e?a.toString():a}}();