index-c0b93546.js 11 KB

1
  1. import{cW as ee}from"./index-0d8158eb.js";var re=String.prototype.replace,ne=/%20/g,Q={RFC1738:"RFC1738",RFC3986:"RFC3986"},H={default:Q.RFC3986,formatters:{RFC1738:function(a){return re.call(a,ne,"+")},RFC3986:function(a){return String(a)}},RFC1738:Q.RFC1738,RFC3986:Q.RFC3986},te=H,R=Object.prototype.hasOwnProperty,O=Array.isArray,b=function(){for(var a=[],e=0;e<256;++e)a.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return a}(),ae=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(O(n)){for(var f=[],l=0;l<n.length;++l)typeof n[l]<"u"&&f.push(n[l]);r.obj[r.prop]=f}}},G=function(e,r){for(var n=r&&r.plainObjects?Object.create(null):{},f=0;f<e.length;++f)typeof e[f]<"u"&&(n[f]=e[f]);return n},ie=function a(e,r,n){if(!r)return e;if(typeof r!="object"){if(O(e))e.push(r);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!R.call(Object.prototype,r))&&(e[r]=!0);else return[e,r];return e}if(!e||typeof e!="object")return[e].concat(r);var f=e;return O(e)&&!O(r)&&(f=G(e,n)),O(e)&&O(r)?(r.forEach(function(l,t){if(R.call(e,t)){var u=e[t];u&&typeof u=="object"&&l&&typeof l=="object"?e[t]=a(u,l,n):e.push(l)}else e[t]=l}),e):Object.keys(r).reduce(function(l,t){var u=r[t];return R.call(l,t)?l[t]=a(l[t],u,n):l[t]=u,l},f)},fe=function(e,r){return Object.keys(r).reduce(function(n,f){return n[f]=r[f],n},e)},le=function(a,e,r){var n=a.replace(/\+/g," ");if(r==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},oe=function(e,r,n,f,l){if(e.length===0)return e;var t=e;if(typeof e=="symbol"?t=Symbol.prototype.toString.call(e):typeof e!="string"&&(t=String(e)),n==="iso-8859-1")return escape(t).replace(/%u[0-9a-f]{4}/gi,function(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});for(var u="",o=0;o<t.length;++o){var i=t.charCodeAt(o);if(i===45||i===46||i===95||i===126||i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122||l===te.RFC1738&&(i===40||i===41)){u+=t.charAt(o);continue}if(i<128){u=u+b[i];continue}if(i<2048){u=u+(b[192|i>>6]+b[128|i&63]);continue}if(i<55296||i>=57344){u=u+(b[224|i>>12]+b[128|i>>6&63]+b[128|i&63]);continue}o+=1,i=65536+((i&1023)<<10|t.charCodeAt(o)&1023),u+=b[240|i>>18]+b[128|i>>12&63]+b[128|i>>6&63]+b[128|i&63]}return u},ue=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],f=0;f<r.length;++f)for(var l=r[f],t=l.obj[l.prop],u=Object.keys(t),o=0;o<u.length;++o){var i=u[o],c=t[i];typeof c=="object"&&c!==null&&n.indexOf(c)===-1&&(r.push({obj:t,prop:i}),n.push(c))}return ae(r),e},ce=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},se=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},de=function(e,r){return[].concat(e,r)},ye=function(e,r){if(O(e)){for(var n=[],f=0;f<e.length;f+=1)n.push(r(e[f]));return n}return r(e)},X={arrayToObject:G,assign:fe,combine:de,compact:ue,decode:le,encode:oe,isBuffer:se,isRegExp:ce,maybeMap:ye,merge:ie},Y=ee,$=X,F=H,ve=Object.prototype.hasOwnProperty,K={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},x=Array.isArray,pe=String.prototype.split,me=Array.prototype.push,Z=function(a,e){me.apply(a,x(e)?e:[e])},he=Date.prototype.toISOString,W=F.default,v={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:$.encode,encodeValuesOnly:!1,format:W,formatter:F.formatters[W],indices:!1,serializeDate:function(e){return he.call(e)},skipNulls:!1,strictNullHandling:!1},be=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},T={},ge=function a(e,r,n,f,l,t,u,o,i,c,p,h,m,y,S){for(var s=e,N=S,E=0,z=!1;(N=N.get(T))!==void 0&&!z;){var B=N.get(e);if(E+=1,typeof B<"u"){if(B===E)throw new RangeError("Cyclic object value");z=!0}typeof N.get(T)>"u"&&(E=0)}if(typeof u=="function"?s=u(r,s):s instanceof Date?s=c(s):n==="comma"&&x(s)&&(s=$.maybeMap(s,function(A){return A instanceof Date?c(A):A})),s===null){if(f)return t&&!m?t(r,v.encoder,y,"key",p):r;s=""}if(be(s)||$.isBuffer(s)){if(t){var I=m?r:t(r,v.encoder,y,"key",p);if(n==="comma"&&m){for(var M=pe.call(String(s),","),V="",C=0;C<M.length;++C)V+=(C===0?"":",")+h(t(M[C],v.encoder,y,"value",p));return[h(I)+"="+V]}return[h(I)+"="+h(t(s,v.encoder,y,"value",p))]}return[h(r)+"="+h(String(s))]}var D=[];if(typeof s>"u")return D;var j;if(n==="comma"&&x(s))j=[{value:s.length>0?s.join(",")||null:void 0}];else if(x(u))j=u;else{var _=Object.keys(s);j=o?_.sort(o):_}for(var P=0;P<j.length;++P){var g=j[P],U=typeof g=="object"&&typeof g.value<"u"?g.value:s[g];if(!(l&&U===null)){var J=x(s)?typeof n=="function"?n(r,g):r:r+(i?"."+g:"["+g+"]");S.set(e,E);var k=Y();k.set(T,S),Z(D,a(U,J,n,f,l,t,u,o,i,c,p,h,m,y,k))}}return D},Oe=function(e){if(!e)return v;if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var r=e.charset||v.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=F.default;if(typeof e.format<"u"){if(!ve.call(F.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var f=F.formatters[n],l=v.filter;return(typeof e.filter=="function"||x(e.filter))&&(l=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:v.addQueryPrefix,allowDots:typeof e.allowDots>"u"?v.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:v.charsetSentinel,delimiter:typeof e.delimiter>"u"?v.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:v.encode,encoder:typeof e.encoder=="function"?e.encoder:v.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:v.encodeValuesOnly,filter:l,format:n,formatter:f,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:v.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:v.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:v.strictNullHandling}},xe=function(a,e){var r=a,n=Oe(e),f,l;typeof n.filter=="function"?(l=n.filter,r=l("",r)):x(n.filter)&&(l=n.filter,f=l);var t=[];if(typeof r!="object"||r===null)return"";var u;e&&e.arrayFormat in K?u=e.arrayFormat:e&&"indices"in e?u=e.indices?"indices":"repeat":u="indices";var o=K[u];f||(f=Object.keys(r)),n.sort&&f.sort(n.sort);for(var i=Y(),c=0;c<f.length;++c){var p=f[c];n.skipNulls&&r[p]===null||Z(t,ge(r[p],p,o,n.strictNullHandling,n.skipNulls,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,i))}var h=t.join(n.delimiter),m=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?m+="utf8=%26%2310003%3B&":m+="utf8=%E2%9C%93&"),h.length>0?m+h:""},w=X,L=Object.prototype.hasOwnProperty,we=Array.isArray,d={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:w.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Se=function(a){return a.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},q=function(a,e){return a&&typeof a=="string"&&e.comma&&a.indexOf(",")>-1?a.split(","):a},je="utf8=%26%2310003%3B",Fe="utf8=%E2%9C%93",Ne=function(e,r){var n={},f=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,l=r.parameterLimit===1/0?void 0:r.parameterLimit,t=f.split(r.delimiter,l),u=-1,o,i=r.charset;if(r.charsetSentinel)for(o=0;o<t.length;++o)t[o].indexOf("utf8=")===0&&(t[o]===Fe?i="utf-8":t[o]===je&&(i="iso-8859-1"),u=o,o=t.length);for(o=0;o<t.length;++o)if(o!==u){var c=t[o],p=c.indexOf("]="),h=p===-1?c.indexOf("="):p+1,m,y;h===-1?(m=r.decoder(c,d.decoder,i,"key"),y=r.strictNullHandling?null:""):(m=r.decoder(c.slice(0,h),d.decoder,i,"key"),y=w.maybeMap(q(c.slice(h+1),r),function(S){return r.decoder(S,d.decoder,i,"value")})),y&&r.interpretNumericEntities&&i==="iso-8859-1"&&(y=Se(y)),c.indexOf("[]=")>-1&&(y=we(y)?[y]:y),L.call(n,m)?n[m]=w.combine(n[m],y):n[m]=y}return n},Ee=function(a,e,r,n){for(var f=n?e:q(e,r),l=a.length-1;l>=0;--l){var t,u=a[l];if(u==="[]"&&r.parseArrays)t=[].concat(f);else{t=r.plainObjects?Object.create(null):{};var o=u.charAt(0)==="["&&u.charAt(u.length-1)==="]"?u.slice(1,-1):u,i=parseInt(o,10);!r.parseArrays&&o===""?t={0:f}:!isNaN(i)&&u!==o&&String(i)===o&&i>=0&&r.parseArrays&&i<=r.arrayLimit?(t=[],t[i]=f):o!=="__proto__"&&(t[o]=f)}f=t}return f},Ce=function(e,r,n,f){if(e){var l=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,t=/(\[[^[\]]*])/,u=/(\[[^[\]]*])/g,o=n.depth>0&&t.exec(l),i=o?l.slice(0,o.index):l,c=[];if(i){if(!n.plainObjects&&L.call(Object.prototype,i)&&!n.allowPrototypes)return;c.push(i)}for(var p=0;n.depth>0&&(o=u.exec(l))!==null&&p<n.depth;){if(p+=1,!n.plainObjects&&L.call(Object.prototype,o[1].slice(1,-1))&&!n.allowPrototypes)return;c.push(o[1])}return o&&c.push("["+l.slice(o.index)+"]"),Ee(c,r,n,f)}},De=function(e){if(!e)return d;if(e.decoder!==null&&e.decoder!==void 0&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=typeof e.charset>"u"?d.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?d.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:d.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:d.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:d.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:d.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:d.comma,decoder:typeof e.decoder=="function"?e.decoder:d.decoder,delimiter:typeof e.delimiter=="string"||w.isRegExp(e.delimiter)?e.delimiter:d.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:d.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:d.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:d.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:d.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:d.strictNullHandling}},Pe=function(a,e){var r=De(e);if(a===""||a===null||typeof a>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof a=="string"?Ne(a,r):a,f=r.plainObjects?Object.create(null):{},l=Object.keys(n),t=0;t<l.length;++t){var u=l[t],o=Ce(u,n[u],r,typeof a=="string");f=w.merge(f,o,r)}return r.allowSparse===!0?f:w.compact(f)},Ae=xe,Qe=Pe,Re=H,$e={formats:Re,parse:Qe,stringify:Ae};export{$e as l};