@suveren/gateway 0.29.0 → 0.30.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.
Files changed (34) hide show
  1. package/content/integrations/gmail.json +13 -2
  2. package/content/integrations/mail.json +12 -2
  3. package/content/integrations/mollie.json +10 -0
  4. package/dist/control-plane/index.mjs +125 -37
  5. package/dist/mcp-server/http.mjs +772 -420
  6. package/dist/ui/assets/index-C2BnlNib.js +123 -0
  7. package/dist/ui/assets/{index-DUIlMVlP.css → index-DPgewsLG.css} +1 -1
  8. package/dist/ui/index.html +2 -2
  9. package/node_modules/qs/.github/THREAT_MODEL.md +4 -2
  10. package/node_modules/qs/CHANGELOG.md +38 -14
  11. package/node_modules/qs/README.md +31 -3
  12. package/node_modules/qs/dist/qs.js +20 -20
  13. package/node_modules/qs/lib/parse.js +94 -4
  14. package/node_modules/qs/lib/stringify.js +4 -4
  15. package/node_modules/qs/lib/utils.js +130 -6
  16. package/node_modules/qs/package.json +4 -4
  17. package/node_modules/qs/test/parse.js +174 -0
  18. package/node_modules/qs/test/stringify.js +263 -33
  19. package/node_modules/qs/test/utils.js +184 -0
  20. package/node_modules/sanitize-html/index.js +47 -10
  21. package/node_modules/sanitize-html/package.json +2 -3
  22. package/package.json +1 -1
  23. package/dist/ui/assets/index-C3vTF2Ye.js +0 -123
  24. package/node_modules/deepmerge/.editorconfig +0 -7
  25. package/node_modules/deepmerge/.eslintcache +0 -1
  26. package/node_modules/deepmerge/changelog.md +0 -167
  27. package/node_modules/deepmerge/dist/cjs.js +0 -133
  28. package/node_modules/deepmerge/dist/umd.js +0 -139
  29. package/node_modules/deepmerge/index.d.ts +0 -20
  30. package/node_modules/deepmerge/index.js +0 -106
  31. package/node_modules/deepmerge/license.txt +0 -21
  32. package/node_modules/deepmerge/package.json +0 -42
  33. package/node_modules/deepmerge/readme.md +0 -264
  34. package/node_modules/deepmerge/rollup.config.js +0 -22
@@ -5,13 +5,13 @@
5
5
  "use strict";var stringify=require(4),parse=require(3),formats=require(1);module.exports={formats:formats,parse:parse,stringify:stringify};
6
6
 
7
7
  },{"1":1,"3":3,"4":4}],3:[function(require,module,exports){
8
- "use strict";var utils=require(5),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,defaults={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:utils.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},interpretNumericEntities=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},parseArrayValue=function(e,t,r){if(e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1){if(t.throwOnLimitExceeded)for(var i=0,a=e.indexOf(",");a>-1;){if((i+=1)>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");a=e.indexOf(",",a+1)}return e.split(",")}if(t.throwOnLimitExceeded&&r>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return e},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function parseQueryStringValues(e,t){var r={__proto__:null},i=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;i=i.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var a=t.parameterLimit===1/0?void 0:t.parameterLimit,o=i.split(t.delimiter,t.throwOnLimitExceeded&&void 0!==a?a+1:a);if(t.throwOnLimitExceeded&&void 0!==a&&o.length>a)throw new RangeError("Parameter limit exceeded. Only "+a+" parameter"+(1===a?"":"s")+" allowed.");var l,n=-1,s=t.charset;if(t.charsetSentinel)for(l=0;l<o.length;++l)0===o[l].indexOf("utf8=")&&(o[l]===charsetSentinel?s="utf-8":o[l]===isoSentinel&&(s="iso-8859-1"),n=l,l=o.length);for(l=0;l<o.length;++l)if(l!==n){var d,c,p=o[l],u=p.indexOf("]="),y=-1===u?p.indexOf("="):u+1;if(-1===y?(d=t.decoder(p,defaults.decoder,s,"key"),c=t.strictNullHandling?null:""):null!==(d=t.decoder(p.slice(0,y),defaults.decoder,s,"key"))&&(c=utils.maybeMap(parseArrayValue(p.slice(y+1),t,isArray(r[d])?r[d].length:0),function(e){return t.decoder(e,defaults.decoder,s,"value")})),c&&t.interpretNumericEntities&&"iso-8859-1"===s&&(c=interpretNumericEntities(String(c))),p.indexOf("[]=")>-1&&(c=isArray(c)?[c]:c),t.comma&&isArray(c)&&c.length>t.arrayLimit&&(c=utils.combine([],c,t.arrayLimit,t.plainObjects,t.throwOnLimitExceeded)),null!==d){var f=has.call(r,d);f&&("combine"===t.duplicates||p.indexOf("[]=")>-1)?r[d]=utils.combine(r[d],c,t.arrayLimit,t.plainObjects,t.throwOnLimitExceeded):f&&"last"!==t.duplicates||(r[d]=c)}}return r},parseObject=function(e,t,r,i){var a=0;if(e.length>0&&"[]"===e[e.length-1]){var o=e.slice(0,-1).join("");a=Array.isArray(t)&&t[o]?t[o].length:0}for(var l=i?t:parseArrayValue(t,r,a),n=e.length-1;n>=0;--n){var s,d=e[n];if("[]"===d&&r.parseArrays)s=utils.isOverflow(l)?l:r.allowEmptyArrays&&(""===l||r.strictNullHandling&&null===l)?[]:utils.combine([],l,r.arrayLimit,r.plainObjects,r.throwOnLimitExceeded);else{s=r.plainObjects?{__proto__:null}:{};var c="["===d.charAt(0)&&"]"===d.charAt(d.length-1)?d.slice(1,-1):d,p=r.decodeDotInKeys?c.replace(/%2E/g,"."):c,u=parseInt(p,10),y=!isNaN(u)&&d!==p&&String(u)===p&&u>=0&&r.parseArrays;if(r.parseArrays||""!==p)if(y&&u<r.arrayLimit)(s=[])[u]=l;else{if(y&&r.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+r.arrayLimit+" element"+(1===r.arrayLimit?"":"s")+" allowed in an array.");y?(s[u]=l,utils.markOverflow(s,u)):"__proto__"!==p&&(s[p]=l)}else s={0:l}}l=s}return l},splitKeyIntoSegments=function splitKeyIntoSegments(e,t){var r=t.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e;if(t.depth<=0){if(!t.plainObjects&&has.call(Object.prototype,r)&&!t.allowPrototypes)return;return[r]}var i=[],a=r.indexOf("["),o=a>=0?r.slice(0,a):r;if(o){if(!t.plainObjects&&has.call(Object.prototype,o)&&!t.allowPrototypes)return;i[i.length]=o}for(var l=r.length,n=a,s=0;n>=0&&s<t.depth;){for(var d=1,c=n+1,p=-1;c<l&&p<0;){var u=r.charCodeAt(c);91===u?d+=1:93===u&&0==(d-=1)&&(p=c),c+=1}if(p<0)return i[i.length]="["+r.slice(n)+"]",i;var y=r.slice(n,p+1),f=y.slice(1,-1);if(!t.plainObjects&&has.call(Object.prototype,f)&&!t.allowPrototypes)return;i[i.length]=y,s+=1,n=r.indexOf("[",p+1)}if(n>=0){if(!0===t.strictDepth)throw new RangeError("Input depth exceeded depth option of "+t.depth+" and strictDepth is true");i[i.length]="["+r.slice(n)+"]"}return i},parseKeys=function parseQueryStringKeys(e,t,r,i){if(e){var a=splitKeyIntoSegments(e,r);if(a)return parseObject(a,t,r,i)}},normalizeParseOptions=function normalizeParseOptions(e){if(!e)return defaults;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 t=void 0===e.charset?defaults.charset:e.charset,r=void 0===e.duplicates?defaults.duplicates:e.duplicates;if("combine"!==r&&"first"!==r&&"last"!==r)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===e.allowDots?!0===e.decodeDotInKeys||defaults.allowDots:!!e.allowDots,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:defaults.allowEmptyArrays,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:defaults.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:defaults.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:defaults.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:defaults.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:defaults.comma,decodeDotInKeys:"boolean"==typeof e.decodeDotInKeys?e.decodeDotInKeys:defaults.decodeDotInKeys,decoder:"function"==typeof e.decoder?e.decoder:defaults.decoder,delimiter:"string"==typeof e.delimiter||utils.isRegExp(e.delimiter)?e.delimiter:defaults.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:defaults.depth,duplicates:r,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:defaults.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:defaults.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:defaults.plainObjects,strictDepth:"boolean"==typeof e.strictDepth?!!e.strictDepth:defaults.strictDepth,strictMerge:"boolean"==typeof e.strictMerge?!!e.strictMerge:defaults.strictMerge,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:defaults.strictNullHandling,throwOnLimitExceeded:"boolean"==typeof e.throwOnLimitExceeded&&e.throwOnLimitExceeded}};module.exports=function(e,t){var r=normalizeParseOptions(t);if(""===e||null==e)return r.plainObjects?{__proto__:null}:{};for(var i="string"==typeof e?parseValues(e,r):e,a=r.plainObjects?{__proto__:null}:{},o=Object.keys(i),l=0;l<o.length;++l){var n=o[l],s=parseKeys(n,i[n],r,"string"==typeof e);a=utils.merge(a,s,r)}return!0===r.allowSparse?a:utils.compact(a)};
8
+ "use strict";var getSideChannel=require(46),utils=require(5),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,getPrototypeOf=Object.getPrototypeOf,isPlainContainer=function isPlainContainer(e){if(!e||"object"!=typeof e)return!1;if(isArray(e))return!0;var t=getPrototypeOf(e);return t===Object.prototype||null===t},emptyCopyOf=function emptyCopyOf(e){if(isArray(e)){var t=[];return t.length=e.length,t}return null===getPrototypeOf(e)?{__proto__:null}:{}},copyInput=function copyInput(e){for(var t=getSideChannel(),r={},i=[{source:e,target:r}],a=0;a<i.length;++a)for(var o=i[a].source,n=i[a].target,l=Object.keys(o),s=0;s<l.length;++s){var c=o[l[s]];if(isPlainContainer(c)){if(!t.has(c)){var p=emptyCopyOf(c);t.set(c,p),i[i.length]={source:c,target:p}}n[l[s]]=t.get(c)}else n[l[s]]=c}return r},defaults={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:utils.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},interpretNumericEntities=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},parseArrayValue=function(e,t,r){if(e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1){if(t.throwOnLimitExceeded)for(var i=0,a=e.indexOf(",");a>-1;){if((i+=1)>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");a=e.indexOf(",",a+1)}return e.split(",")}if(t.throwOnLimitExceeded&&r>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return e},isoSentinel="utf8=%26%2310003%3B",charsetSentinel="utf8=%E2%9C%93",parseValues=function parseQueryStringValues(e,t){var r={__proto__:null},i=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;i=i.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var a=t.parameterLimit===1/0?void 0:t.parameterLimit,o=i.split(t.delimiter,t.throwOnLimitExceeded&&void 0!==a?a+1:a);if(t.throwOnLimitExceeded&&void 0!==a&&o.length>a)throw new RangeError("Parameter limit exceeded. Only "+a+" parameter"+(1===a?"":"s")+" allowed.");var n,l=-1,s=t.charset;if(t.charsetSentinel)for(n=0;n<o.length;++n)0===o[n].indexOf("utf8=")&&(o[n]===charsetSentinel?s="utf-8":o[n]===isoSentinel&&(s="iso-8859-1"),l=n,n=o.length);for(n=0;n<o.length;++n)if(n!==l){var c,p,d=o[n],u=d.indexOf("]="),y=-1===u?d.indexOf("="):u+1,f=y>1&&"[]"===d.slice(y-2,y);if(-1===y?(c=t.decoder(d,defaults.decoder,s,"key"),p=t.strictNullHandling?null:""):null!==(c=t.decoder(d.slice(0,y),defaults.decoder,s,"key"))&&(p=utils.maybeMap(parseArrayValue(d.slice(y+1),t,isArray(r[c])?r[c].length:0),function(e){return t.decoder(e,defaults.decoder,s,"value")})),p&&t.interpretNumericEntities&&"iso-8859-1"===s&&(p=interpretNumericEntities(String(p))),f&&(p=isArray(p)?[p]:p),t.comma&&isArray(p)&&p.length>t.arrayLimit&&(p=utils.combine([],p,t.arrayLimit,t.plainObjects,t.throwOnLimitExceeded)),null!==c){var m=has.call(r,c);m&&("combine"===t.duplicates||f)?r[c]=utils.combine(r[c],p,t.arrayLimit,t.plainObjects,t.throwOnLimitExceeded):m&&"last"!==t.duplicates||(r[c]=p)}}return r},parseObject=function(e,t,r,i){var a=0;if(e.length>0&&"[]"===e[e.length-1]){var o=e.slice(0,-1).join("");a=Array.isArray(t)&&t[o]?t[o].length:0}for(var n=i?t:parseArrayValue(t,r,a),l=e.length-1;l>=0;--l){var s,c=e[l];if("[]"===c&&r.parseArrays)s=utils.isOverflow(n)?n:r.allowEmptyArrays&&(""===n||r.strictNullHandling&&null===n)?[]:utils.combine([],n,r.arrayLimit,r.plainObjects,r.throwOnLimitExceeded);else{s=r.plainObjects?{__proto__:null}:{};var p="["===c.charAt(0)&&"]"===c.charAt(c.length-1)?c.slice(1,-1):c,d=r.decodeDotInKeys?p.replace(/%2E/g,"."):p,u=parseInt(d,10),y=!isNaN(u)&&c!==d&&String(u)===d&&u>=0&&r.parseArrays;if(r.parseArrays||""!==d)if(y&&u<r.arrayLimit)(s=[])[u]=n;else{if(y&&r.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+r.arrayLimit+" element"+(1===r.arrayLimit?"":"s")+" allowed in an array.");y?(s[u]=n,utils.markOverflow(s,u)):"__proto__"!==d&&(s[d]=n)}else s={0:n}}n=s}return n},topLevelDotsToBrackets=function topLevelDotsToBrackets(e){for(var t="",r=0,i=0;i<e.length;i+=1){var a=e.charCodeAt(i);if(91===a)r+=1,t+="[";else if(93===a)r>0&&(r-=1),t+="]";else if(46===a&&0===r&&i+1<e.length&&46!==e.charCodeAt(i+1)&&91!==e.charCodeAt(i+1)){for(var o=i+1,n=o;n<e.length&&46!==e.charCodeAt(n)&&91!==e.charCodeAt(n);)n+=1;t+="["+e.slice(o,n)+"]",i=n-1}else t+=e.charAt(i)}return t},splitKeyIntoSegments=function splitKeyIntoSegments(e,t){var r=t.allowDots?topLevelDotsToBrackets(e):e;if(t.depth<=0){if(!t.plainObjects&&has.call(Object.prototype,r)&&!t.allowPrototypes)return;return[r]}var i=[],a=r.indexOf("["),o=a>=0?r.slice(0,a):r;if(o){if(!t.plainObjects&&has.call(Object.prototype,o)&&!t.allowPrototypes)return;i[i.length]=o}for(var n=r.length,l=a,s=0;l>=0&&s<t.depth;){for(var c=1,p=l+1,d=-1;p<n&&d<0;){var u=r.charCodeAt(p);91===u?c+=1:93===u&&0==(c-=1)&&(d=p),p+=1}if(d<0)return i[i.length]="["+r.slice(l)+"]",i;var y=r.slice(l,d+1),f=y.slice(1,-1);if(!t.plainObjects&&has.call(Object.prototype,f)&&!t.allowPrototypes)return;i[i.length]=y,s+=1,l=r.indexOf("[",d+1)}if(l>=0){if(!0===t.strictDepth)throw new RangeError("Input depth exceeded depth option of "+t.depth+" and strictDepth is true");i[i.length]="["+r.slice(l)+"]"}return i},parseKeys=function parseQueryStringKeys(e,t,r,i){if(e){var a=splitKeyIntoSegments(e,r);if(a)return parseObject(a,t,r,i)}},normalizeParseOptions=function normalizeParseOptions(e){if(!e)return defaults;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 t=void 0===e.charset?defaults.charset:e.charset,r=void 0===e.duplicates?defaults.duplicates:e.duplicates;if("combine"!==r&&"first"!==r&&"last"!==r)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===e.allowDots?!0===e.decodeDotInKeys||defaults.allowDots:!!e.allowDots,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:defaults.allowEmptyArrays,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:defaults.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:defaults.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:defaults.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:defaults.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:defaults.comma,decodeDotInKeys:"boolean"==typeof e.decodeDotInKeys?e.decodeDotInKeys:defaults.decodeDotInKeys,decoder:"function"==typeof e.decoder?e.decoder:defaults.decoder,delimiter:"string"==typeof e.delimiter||utils.isRegExp(e.delimiter)?e.delimiter:defaults.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:defaults.depth,duplicates:r,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:defaults.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:defaults.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:defaults.plainObjects,strictDepth:"boolean"==typeof e.strictDepth?!!e.strictDepth:defaults.strictDepth,strictMerge:"boolean"==typeof e.strictMerge?!!e.strictMerge:defaults.strictMerge,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:defaults.strictNullHandling,throwOnLimitExceeded:"boolean"==typeof e.throwOnLimitExceeded&&e.throwOnLimitExceeded}};module.exports=function(e,t){var r=normalizeParseOptions(t);if(""===e||null==e)return r.plainObjects?{__proto__:null}:{};for(var i="string"==typeof e?parseValues(e,r):copyInput(e),a=r.plainObjects?{__proto__:null}:{},o=Object.keys(i),n=0;n<o.length;++n){var l=o[n],s=parseKeys(l,i[l],r,"string"==typeof e);a=utils.merge(a,s,r)}return!0===r.allowSparse?a:utils.compact(a)};
9
9
 
10
- },{"5":5}],4:[function(require,module,exports){
11
- "use strict";var getSideChannel=require(46),utils=require(5),formats=require(1),has=Object.prototype.hasOwnProperty,arrayPrefixGenerators={brackets:function brackets(e){return e+"[]"},comma:"comma",indices:function indices(e,r){return e+"["+r+"]"},repeat:function repeat(e){return e}},isArray=Array.isArray,push=Array.prototype.push,pushToArray=function(e,r){push.apply(e,isArray(r)?r:[r])},toISO=Date.prototype.toISOString,defaultFormat=formats.default,defaults={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",depth:1/0,encode:!0,encodeDotInKeys:!1,encoder:utils.encode,encodeValuesOnly:!1,filter:void 0,format:defaultFormat,formatter:formats.formatters[defaultFormat],indices:!1,serializeDate:function serializeDate(e){return toISO.call(e)},skipNulls:!1,strictNullHandling:!1},isNonNullishPrimitive=function isNonNullishPrimitive(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||"symbol"==typeof e||"bigint"==typeof e},sentinel={},stringify=function stringify(e,r,t,o,n,a,i,l,s,f,u,d,y,c,p,m,h,v,g,w){var b=e;if(w>g)throw new RangeError("Input depth exceeded depth option of "+g);for(var D=v,A=0,S=!1;void 0!==(D=D.get(sentinel))&&!S;){var E=D.get(e);if(A+=1,void 0!==E){if(E===A)throw new RangeError("Cyclic object value");S=!0}void 0===D.get(sentinel)&&(A=0)}if((b="function"==typeof f?f(r,b):b)instanceof Date?b=y(b):"comma"===t&&isArray(b)&&(b=utils.maybeMap(b,function(e){return e instanceof Date?y(e):e})),null===b){if(a)return p(s&&!m?s(r,defaults.encoder,h,"key",c):r);b=""}if(isNonNullishPrimitive(b)||utils.isBuffer(b))return s?[p(m?r:s(r,defaults.encoder,h,"key",c))+"="+p(s(b,defaults.encoder,h,"value",c))]:[p(r)+"="+p(String(b))];var N,O=[];if(void 0===b)return O;if("comma"===t&&isArray(b))m&&s&&(b=utils.maybeMap(b,function(e){return null==e?e:s(e)})),N=[{value:b.length>0?b.join(",")||null:void 0}];else if(isArray(f))N=f;else{var T=Object.keys(b);N=u?T.sort(u):T}var k=l?String(r).replace(/\./g,"%2E"):String(r),I=o&&isArray(b)&&1===b.length?k+"[]":k;if(n&&isArray(b)&&0===b.length&&0===Object.keys(b).length)return I+"[]";for(var P=0;P<N.length;++P){var x=N[P],K="object"==typeof x&&x&&void 0!==x.value?x.value:b[x];if(!i||null!==K){var z=d&&l?String(x).replace(/\./g,"%2E"):String(x),j=isArray(b)?"function"==typeof t?t(I,z):I:I+(d?"."+z:"["+z+"]");v.set(e,A);var F=getSideChannel();F.set(sentinel,v),pushToArray(O,stringify(K,j,t,o,n,a,i,l,"comma"===t&&m&&isArray(b)?null:s,f,u,d,y,c,p,m,h,F,g,w+1))}}return O},normalizeStringifyOptions=function normalizeStringifyOptions(e){if(!e)return defaults;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.encodeDotInKeys&&"boolean"!=typeof e.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var r=e.charset||defaults.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 t=formats.default;if(void 0!==e.format){if(!has.call(formats.formatters,e.format))throw new TypeError("Unknown format option provided.");t=e.format}var o,n=formats.formatters[t],a=defaults.filter;if(("function"==typeof e.filter||isArray(e.filter))&&(a=e.filter),o=e.arrayFormat in arrayPrefixGenerators?e.arrayFormat:"indices"in e?e.indices?"indices":"repeat":defaults.arrayFormat,"commaRoundTrip"in e&&"boolean"!=typeof e.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var i=void 0===e.allowDots?!0===e.encodeDotInKeys||defaults.allowDots:!!e.allowDots;return{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:defaults.addQueryPrefix,allowDots:i,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:defaults.allowEmptyArrays,arrayFormat:o,charset:r,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:defaults.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:void 0===e.delimiter?defaults.delimiter:e.delimiter,depth:"number"==typeof e.depth?e.depth:defaults.depth,encode:"boolean"==typeof e.encode?e.encode:defaults.encode,encodeDotInKeys:"boolean"==typeof e.encodeDotInKeys?e.encodeDotInKeys:defaults.encodeDotInKeys,encoder:"function"==typeof e.encoder?e.encoder:defaults.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:defaults.encodeValuesOnly,filter:a,format:t,formatter:n,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:defaults.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:defaults.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:defaults.strictNullHandling}};module.exports=function(e,r){var t,o=e,n=normalizeStringifyOptions(r);"function"==typeof n.filter?o=(0,n.filter)("",o):isArray(n.filter)&&(t=n.filter);var a=[];if("object"!=typeof o||null===o)return"";var i=arrayPrefixGenerators[n.arrayFormat],l="comma"===i&&n.commaRoundTrip;t||(t=Object.keys(o)),n.sort&&t.sort(n.sort);for(var s=getSideChannel(),f=0;f<t.length;++f){var u=t[f];if(null!=u){var d=o[u];if(!n.skipNulls||null!==d){var y=n.encodeDotInKeys?String(u).replace(/\./g,"%2E"):String(u);pushToArray(a,stringify(d,y,i,l,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,s,n.depth,0))}}}var c=a.join(n.delimiter),p=!0===n.addQueryPrefix?"?":"";return n.charsetSentinel&&("iso-8859-1"===n.charset?p+="utf8=%26%2310003%3B"+n.delimiter:p+="utf8=%E2%9C%93"+n.delimiter),c.length>0?p+c:""};
10
+ },{"46":46,"5":5}],4:[function(require,module,exports){
11
+ "use strict";var getSideChannel=require(46),utils=require(5),formats=require(1),has=Object.prototype.hasOwnProperty,arrayPrefixGenerators={brackets:function brackets(e){return e+"[]"},comma:"comma",indices:function indices(e,r){return e+"["+r+"]"},repeat:function repeat(e){return e}},isArray=Array.isArray,push=Array.prototype.push,pushToArray=function(e,r){push.apply(e,isArray(r)?r:[r])},toISO=Date.prototype.toISOString,defaultFormat=formats.default,defaults={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",depth:1/0,encode:!0,encodeDotInKeys:!1,encoder:utils.encode,encodeValuesOnly:!1,filter:void 0,format:defaultFormat,formatter:formats.formatters[defaultFormat],indices:!1,serializeDate:function serializeDate(e){return toISO.call(e)},skipNulls:!1,strictNullHandling:!1},isNonNullishPrimitive=function isNonNullishPrimitive(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||"symbol"==typeof e||"bigint"==typeof e},sentinel={},stringify=function stringify(e,r,t,o,n,a,i,l,s,f,u,d,c,y,p,m,h,v,g,b){var w=e;if(b>g)throw new RangeError("Input depth exceeded depth option of "+g);for(var D=v,A=0,S=!1;void 0!==(D=D.get(sentinel))&&!S;){var E=D.get(e);if(A+=1,void 0!==E){if(E===A)throw new RangeError("Cyclic object value");S=!0}void 0===D.get(sentinel)&&(A=0)}if((w="function"==typeof f?f(r,w):w)instanceof Date?w=c(w):"comma"===t&&isArray(w)&&(w=utils.maybeMap(w,function(e){return e instanceof Date?c(e):e})),null===w){if(a)return p(s&&!m?s(r,defaults.encoder,h,"key",y):r);w=""}if(isNonNullishPrimitive(w)||utils.isBuffer(w))return s?[p(m?r:s(r,defaults.encoder,h,"key",y))+"="+p(s(w,defaults.encoder,h,"value",y))]:[p(r)+"="+p(String(w))];var N,O=[];if(void 0===w)return O;if("comma"===t&&isArray(w))m&&s&&(w=utils.maybeMap(w,function(e){return null==e?e:s(e,defaults.encoder,h,"value",y)})),N=[{value:w.length>0?utils.toCoercible(w).join(",")||null:void 0}];else if(isArray(f))N=f;else{var T=Object.keys(w);N=u?T.sort(u):T}var k=String(r),I=o&&isArray(w)&&1===w.length?k+"[]":k;if(n&&isArray(w)&&0===w.length&&0===Object.keys(w).length)return I+"[]";for(var P=0;P<N.length;++P){var x=N[P],K="object"==typeof x&&x&&void 0!==x.value?x.value:w[x];if(!i||null!==K){var z=d&&l?String(x).replace(/\./g,"%2E"):String(x),j=isArray(w)?"function"==typeof t?t(I,z):I:I+(d?"."+z:"["+z+"]");v.set(e,A);var F=getSideChannel();F.set(sentinel,v),pushToArray(O,stringify(K,j,t,o,n,a,i,l,"comma"===t&&m&&isArray(w)?null:s,f,u,d,c,y,p,m,h,F,g,b+1))}}return O},normalizeStringifyOptions=function normalizeStringifyOptions(e){if(!e)return defaults;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.encodeDotInKeys&&"boolean"!=typeof e.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var r=e.charset||defaults.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 t=formats.default;if(void 0!==e.format){if(!has.call(formats.formatters,e.format))throw new TypeError("Unknown format option provided.");t=e.format}var o,n=formats.formatters[t],a=defaults.filter;if(("function"==typeof e.filter||isArray(e.filter))&&(a=e.filter),o=has.call(arrayPrefixGenerators,e.arrayFormat)?e.arrayFormat:"indices"in e?e.indices?"indices":"repeat":defaults.arrayFormat,"commaRoundTrip"in e&&"boolean"!=typeof e.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var i=void 0===e.allowDots?!0===e.encodeDotInKeys||defaults.allowDots:!!e.allowDots;return{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:defaults.addQueryPrefix,allowDots:i,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:defaults.allowEmptyArrays,arrayFormat:o,charset:r,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:defaults.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:void 0===e.delimiter?defaults.delimiter:e.delimiter,depth:"number"==typeof e.depth?e.depth:defaults.depth,encode:"boolean"==typeof e.encode?e.encode:defaults.encode,encodeDotInKeys:"boolean"==typeof e.encodeDotInKeys?e.encodeDotInKeys:defaults.encodeDotInKeys,encoder:"function"==typeof e.encoder?e.encoder:defaults.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:defaults.encodeValuesOnly,filter:a,format:t,formatter:n,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:defaults.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:defaults.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:defaults.strictNullHandling}};module.exports=function(e,r){var t,o=e,n=normalizeStringifyOptions(r);"function"==typeof n.filter?o=(0,n.filter)("",o):isArray(n.filter)&&(t=n.filter);var a=[];if("object"!=typeof o||null===o)return"";var i=arrayPrefixGenerators[n.arrayFormat],l="comma"===i&&n.commaRoundTrip;t||(t=Object.keys(o)),n.sort&&t.sort(n.sort);for(var s=getSideChannel(),f=0;f<t.length;++f){var u=t[f];if(null!=u){var d=o[u];if(!n.skipNulls||null!==d){var c=n.encodeDotInKeys?String(u).replace(/\./g,"%2E"):String(u);pushToArray(a,stringify(d,c,i,l,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,s,n.depth,0))}}}var y=a.join(n.delimiter),p=!0===n.addQueryPrefix?"?":"";return n.charsetSentinel&&("iso-8859-1"===n.charset?p+="utf8=%26%2310003%3B"+n.delimiter:p+="utf8=%E2%9C%93"+n.delimiter),y.length>0?p+y:""};
12
12
 
13
13
  },{"1":1,"46":46,"5":5}],5:[function(require,module,exports){
14
- "use strict";var formats=require(1),getSideChannel=require(46),defineProperty=require(14),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,overflowChannel=getSideChannel(),markOverflow=function markOverflow(e,r){return overflowChannel.set(e,r),e},isOverflow=function isOverflow(e){return overflowChannel.has(e)},getMaxIndex=function getMaxIndex(e){return overflowChannel.get(e)},setMaxIndex=function setMaxIndex(e,r){overflowChannel.set(e,r)},hexTable=function(){for(var e=[],r=0;r<256;++r)e[e.length]="%"+((r<16?"0":"")+r.toString(16)).toUpperCase();return e}(),compactQueue=function compactQueue(e){for(;e.length>1;){var r=e.pop(),t=r.obj[r.prop];if(isArray(t)){for(var n=[],a=0;a<t.length;++a)void 0!==t[a]&&(n[n.length]=t[a]);r.obj[r.prop]=n}}},arrayToObject=function arrayToObject(e,r){for(var t=r&&r.plainObjects?{__proto__:null}:{},n=0;n<e.length;++n)void 0!==e[n]&&(t[n]=e[n]);return t},setProperty=function setProperty(e,r,t){"__proto__"===r&&defineProperty?defineProperty(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t},merge=function merge(e,r,t){if(!r)return e;if("object"!=typeof r&&"function"!=typeof r){if(isArray(e)){var n=e.length;if(t&&"number"==typeof t.arrayLimit&&n>=t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return markOverflow(arrayToObject(e.concat(r),t),n)}e[n]=r}else{if(!e||"object"!=typeof e)return[e,r];if(isOverflow(e)){var a=getMaxIndex(e)+1;e[a]=r,setMaxIndex(e,a)}else{if(t&&t.strictMerge)return[e,r];(t&&(t.plainObjects||t.allowPrototypes)||!has.call(Object.prototype,r))&&(e[r]=!0)}}return e}if(!e||"object"!=typeof e){if(isOverflow(r)){for(var o=Object.keys(r),i=t&&t.plainObjects?{__proto__:null,0:e}:{0:e},l=0;l<o.length;l++)i[parseInt(o[l],10)+1]=r[o[l]];return markOverflow(i,getMaxIndex(r)+1)}var c=[e].concat(r);if(t&&"number"==typeof t.arrayLimit&&c.length>t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return markOverflow(arrayToObject(c,t),c.length-1)}return c}var f=e;if(isArray(e)&&!isArray(r)&&(f=arrayToObject(e,t)),isArray(e)&&isArray(r)){if(r.forEach(function(r,n){if(has.call(e,n)){var a=e[n];a&&"object"==typeof a&&r&&"object"==typeof r?e[n]=merge(a,r,t):e[e.length]=r}else e[n]=r}),t&&"number"==typeof t.arrayLimit&&e.length>t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return markOverflow(arrayToObject(e,t),e.length-1)}return e}return Object.keys(r).reduce(function(e,n){var a=r[n];if(has.call(e,n)?setProperty(e,n,merge(e[n],a,t)):setProperty(e,n,a),isOverflow(r)&&!isOverflow(e)&&markOverflow(e,getMaxIndex(r)),isOverflow(e)){var o=parseInt(n,10);String(o)===n&&o>=0&&o>getMaxIndex(e)&&setMaxIndex(e,o)}return e},f)},assign=function assignSingleSource(e,r){return Object.keys(r).reduce(function(e,t){return setProperty(e,t,r[t]),e},e)},decode=function(e,r,t){var n=e.replace(/\+/g," ");if("iso-8859-1"===t)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},limit=1024,encode=function encode(e,r,t,n,a){if(0===e.length)return e;var o=e;if("symbol"==typeof e?o=Symbol.prototype.toString.call(e):"string"!=typeof e&&(o=String(e)),"iso-8859-1"===t)return escape(o).replace(/%u[0-9a-f]{4}/gi,function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"});for(var i="",l=0;l<o.length;l+=limit){var c=o.length>=limit?o.slice(l,l+limit):o;if(l+limit<o.length){var f=c.charCodeAt(c.length-1);f>=55296&&f<=56319&&(c=c.slice(0,-1),l-=1)}for(var s=[],u=0;u<c.length;++u){var y=c.charCodeAt(u);45===y||46===y||95===y||126===y||y>=48&&y<=57||y>=65&&y<=90||y>=97&&y<=122||a===formats.RFC1738&&(40===y||41===y)?s[s.length]=c.charAt(u):y<128?s[s.length]=hexTable[y]:y<2048?s[s.length]=hexTable[192|y>>6]+hexTable[128|63&y]:y<55296||y>=57344?s[s.length]=hexTable[224|y>>12]+hexTable[128|y>>6&63]+hexTable[128|63&y]:(u+=1,y=65536+((1023&y)<<10|1023&c.charCodeAt(u)),s[s.length]=hexTable[240|y>>18]+hexTable[128|y>>12&63]+hexTable[128|y>>6&63]+hexTable[128|63&y])}i+=s.join("")}return i},compact=function compact(e){for(var r=[{obj:{o:e},prop:"o"}],t=getSideChannel(),n=0;n<r.length;++n)for(var a=r[n],o=a.obj[a.prop],i=Object.keys(o),l=0;l<i.length;++l){var c=i[l],f=o[c];"object"!=typeof f||null===f||t.has(f)||(r[r.length]={obj:o,prop:c},t.set(f,!0))}return compactQueue(r),e},isRegExp=function isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)},isBuffer=function isBuffer(e){return!(!e||"object"!=typeof e||!e.constructor||"function"!=typeof e.constructor.isBuffer||!e.constructor.isBuffer(e))},combine=function combine(e,r,t,n,a){if(isOverflow(e)){if(a)throw new RangeError("Array limit exceeded. Only "+t+" element"+(1===t?"":"s")+" allowed in an array.");for(var o=isArray(r)?r:[r],i=getMaxIndex(e),l=0;l<o.length;++l)e[i+=1]=o[l];return setMaxIndex(e,i),e}var c=[].concat(e,r);if(c.length>t){if(a)throw new RangeError("Array limit exceeded. Only "+t+" element"+(1===t?"":"s")+" allowed in an array.");return markOverflow(arrayToObject(c,{plainObjects:n}),c.length-1)}return c},maybeMap=function maybeMap(e,r){if(isArray(e)){for(var t=[],n=0;n<e.length;n+=1)t[t.length]=r(e[n]);return t}return r(e)};module.exports={/* common-shake removed: arrayToObject:arrayToObject *//* common-shake removed: assign:assign */combine:combine,compact:compact,decode:decode,encode:encode,isBuffer:isBuffer,isOverflow:isOverflow,isRegExp:isRegExp,markOverflow:markOverflow,maybeMap:maybeMap,merge:merge};
14
+ "use strict";var formats=require(1),getSideChannel=require(46),defineProperty=require(14),has=Object.prototype.hasOwnProperty,isArray=Array.isArray,overflowChannel=getSideChannel(),markOverflow=function markOverflow(e,r){return overflowChannel.set(e,r),e},isOverflow=function isOverflow(e){return overflowChannel.has(e)},getMaxIndex=function getMaxIndex(e){return overflowChannel.get(e)},setMaxIndex=function setMaxIndex(e,r){overflowChannel.set(e,r)},conflictChannel=getSideChannel(),markConflict=function markConflict(e,r){return conflictChannel.set(e,r),e},isConflict=function isConflict(e){return conflictChannel.has(e)},getConflictIndex=function getConflictIndex(e){return conflictChannel.get(e)},hexTable=function(){for(var e=[],r=0;r<256;++r)e[e.length]="%"+((r<16?"0":"")+r.toString(16)).toUpperCase();return e}(),compactQueue=function compactQueue(e){for(;e.length>1;){var r=e.pop(),t=r.obj[r.prop];if(isArray(t)){for(var n=[],i=0;i<t.length;++i)void 0!==t[i]&&(n[n.length]=t[i]);r.obj[r.prop]=n}}},arrayToObject=function arrayToObject(e,r){for(var t=r&&r.plainObjects?{__proto__:null}:{},n=0;n<e.length;++n)void 0!==e[n]&&(t[n]=e[n]);return t},setProperty=function setProperty(e,r,t){"__proto__"===r&&defineProperty?defineProperty(e,r,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[r]=t},maxNumericIndex=function maxNumericIndex(e,r){for(var t=r,n=Object.keys(e),i=0;i<n.length;++i){var o=parseInt(n[i],10);String(o)===n[i]&&o>t&&(t=o)}return t},limitedPair=function limitedPair(e,r,t){var n=[e,r];if(t&&"number"==typeof t.arrayLimit&&n.length>t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return markOverflow(arrayToObject(n,t),1)}return n},merge=function merge(e,r,t){if(!r)return e;if("object"!=typeof r&&"function"!=typeof r){if(isArray(e)){var n=e.length;if(t&&"number"==typeof t.arrayLimit&&n>=t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return markOverflow(arrayToObject(e.concat(r),t),n)}e[n]=r}else{if(!e||"object"!=typeof e)return limitedPair(e,r,t);if(isOverflow(e)){var i=getMaxIndex(e)+1;e[i]=r,setMaxIndex(e,i)}else if(t&&t.strictMerge&&isConflict(e)){var o=getConflictIndex(e)+1;if(t.throwOnLimitExceeded&&"number"==typeof t.arrayLimit&&o>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");e[o]=r,markConflict(e,o)}else{if(t&&t.strictMerge){var a=limitedPair(e,r,t);return isArray(a)?markConflict(a,1):a}(t&&(t.plainObjects||t.allowPrototypes)||!has.call(Object.prototype,r))&&(e[r]=!0)}}return e}if(!e||"object"!=typeof e){if(isOverflow(r)){for(var l=Object.keys(r),f=t&&t.plainObjects?{__proto__:null,0:e}:{0:e},c=0;c<l.length;c++)f[parseInt(l[c],10)+1]=r[l[c]];return markOverflow(f,getMaxIndex(r)+1)}var y=[e].concat(r);if(t&&"number"==typeof t.arrayLimit&&y.length>t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return markOverflow(arrayToObject(y,t),y.length-1)}return y}var u=e;if(isArray(e)&&!isArray(r)&&(u=arrayToObject(e,t),isConflict(e)&&markConflict(u,e.length-1)),isArray(e)&&isArray(r)){if(r.forEach(function(r,n){if(has.call(e,n)){var i=e[n];i&&"object"==typeof i&&r&&"object"==typeof r?e[n]=merge(i,r,t):e[e.length]=r}else e[n]=r}),t&&"number"==typeof t.arrayLimit&&e.length>t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return markOverflow(arrayToObject(e,t),e.length-1)}return e}return Object.keys(r).reduce(function(e,n){var i=r[n];if(has.call(e,n)?setProperty(e,n,merge(e[n],i,t)):setProperty(e,n,i),isOverflow(r)&&!isOverflow(e)&&markOverflow(e,maxNumericIndex(e,getMaxIndex(r))),isOverflow(e)){var o=parseInt(n,10);String(o)===n&&o>=0&&o>getMaxIndex(e)&&setMaxIndex(e,o)}if(isConflict(e)){var a=parseInt(n,10);String(a)===n&&a>getConflictIndex(e)&&markConflict(e,a)}return e},u)},assign=function assignSingleSource(e,r){return Object.keys(r).reduce(function(e,t){return setProperty(e,t,r[t]),e},e)},decode=function(e,r,t){if("string"==typeof e&&-1===e.indexOf("%"))return-1===e.indexOf("+")?e:e.replace(/\+/g," ");var n=e.replace(/\+/g," ");if("iso-8859-1"===t)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},hasToPrimitive="function"==typeof Symbol&&"symbol"==typeof Symbol.toPrimitive,arrayJoin=Array.prototype.join,arrayToString=Array.prototype.toString,objectToString=Object.prototype.toString,toCoercible=function toCoercible(e,r){if(!e||"object"!=typeof e&&"function"!=typeof e)return e;if(hasToPrimitive&&null!=e[Symbol.toPrimitive])return e;if(isArray(e)&&e.toString===arrayToString&&e.join===arrayJoin){var t,n=r||getSideChannel();if(n.has(e))return"";n.set(e,!0);for(var i=0;i<e.length;i+=1){var o=e[i],a=toCoercible(o,n);if(!t&&a!==o){t=[];for(var l=0;l<i;l+=1)t[l]=e[l]}t&&(t[i]=a)}return n.delete(e),t||e}if("function"==typeof e.toString)return e;var f=e.valueOf;if("function"==typeof f){var c=f.call(e);if(!c||"object"!=typeof c&&"function"!=typeof c)return String(c)}return objectToString.call(e)},limit=1024,encode=function encode(e,r,t,n,i){if(0===e.length)return e;var o=e;if("symbol"==typeof e?o=Symbol.prototype.toString.call(e):"string"!=typeof e&&(o=String(toCoercible(e))),"iso-8859-1"===t)return escape(o).replace(/%u[0-9a-f]{4}/gi,function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}).replace(/\+/g,"%2B");for(var a="",l=0;l<o.length;l+=limit){var f=o.length>=limit?o.slice(l,l+limit):o;if(l+limit<o.length){var c=f.charCodeAt(f.length-1);c>=55296&&c<=56319&&(f=f.slice(0,-1),l-=1)}for(var y=[],u=0;u<f.length;++u){var s=f.charCodeAt(u);45===s||46===s||95===s||126===s||s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122||i===formats.RFC1738&&(40===s||41===s)?y[y.length]=f.charAt(u):s<128?y[y.length]=hexTable[s]:s<2048?y[y.length]=hexTable[192|s>>6]+hexTable[128|63&s]:s<55296||s>=57344?y[y.length]=hexTable[224|s>>12]+hexTable[128|s>>6&63]+hexTable[128|63&s]:(u+=1,s=65536+((1023&s)<<10|1023&f.charCodeAt(u)),y[y.length]=hexTable[240|s>>18]+hexTable[128|s>>12&63]+hexTable[128|s>>6&63]+hexTable[128|63&s])}a+=y.join("")}return a},compact=function compact(e){for(var r=[{obj:{o:e},prop:"o"}],t=getSideChannel(),n=0;n<r.length;++n)for(var i=r[n],o=i.obj[i.prop],a=Object.keys(o),l=0;l<a.length;++l){var f=a[l],c=o[f];"object"!=typeof c||null===c||t.has(c)||(r[r.length]={obj:o,prop:f},t.set(c,!0))}return compactQueue(r),e},isRegExp=function isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)},isBuffer=function isBuffer(e){return!(!e||"object"!=typeof e||!e.constructor||"function"!=typeof e.constructor.isBuffer||!e.constructor.isBuffer(e))},combine=function combine(e,r,t,n,i){if(isOverflow(e)){if(i)throw new RangeError("Array limit exceeded. Only "+t+" element"+(1===t?"":"s")+" allowed in an array.");for(var o=isArray(r)?r:[r],a=getMaxIndex(e),l=0;l<o.length;++l)e[a+=1]=o[l];return setMaxIndex(e,a),e}var f=[].concat(e,r);if(f.length>t){if(i)throw new RangeError("Array limit exceeded. Only "+t+" element"+(1===t?"":"s")+" allowed in an array.");return markOverflow(arrayToObject(f,{plainObjects:n}),f.length-1)}return f},maybeMap=function maybeMap(e,r){if(isArray(e)){for(var t=[],n=0;n<e.length;n+=1)t[t.length]=r(e[n]);return t}return r(e)};module.exports={/* common-shake removed: arrayToObject:arrayToObject *//* common-shake removed: assign:assign */combine:combine,compact:compact,decode:decode,encode:encode,isBuffer:isBuffer,isOverflow:isOverflow,isRegExp:isRegExp,markOverflow:markOverflow,maybeMap:maybeMap,merge:merge,toCoercible:toCoercible};
15
15
 
16
16
  },{"1":1,"14":14,"46":46}],46:[function(require,module,exports){
17
17
  "use strict";var $TypeError=require(20),inspect=require(42),getSideChannelList=require(43),getSideChannelMap=require(44),getSideChannelWeakMap=require(45),makeChannel=getSideChannelWeakMap||getSideChannelMap||getSideChannelList;module.exports=function getSideChannel(){var e,n={assert:function(e){if(!n.has(e)){var t=e&&Object(e)===e?"the given object key":inspect(e);throw new $TypeError("Side channel does not contain "+t)}},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,t){e||(e=makeChannel()),e.set(n,t)}};return n};
@@ -78,40 +78,40 @@
78
78
  },{}],23:[function(require,module,exports){
79
79
  "use strict";var ERROR_MESSAGE="Function.prototype.bind called on incompatible ",toStr=Object.prototype.toString,max=Math.max,funcType="[object Function]",concatty=function concatty(t,n){for(var r=[],o=0;o<t.length;o+=1)r[o]=t[o];for(var e=0;e<n.length;e+=1)r[e+t.length]=n[e];return r},slicy=function slicy(t,n){for(var r=[],o=n||0,e=0;o<t.length;o+=1,e+=1)r[e]=t[o];return r},joiny=function(t,n){for(var r="",o=0;o<t.length;o+=1)r+=t[o],o+1<t.length&&(r+=n);return r};module.exports=function bind(t){var n=this;if("function"!=typeof n||toStr.apply(n)!==funcType)throw new TypeError(ERROR_MESSAGE+n);for(var r,o=slicy(arguments,1),e=max(0,n.length-o.length),i=[],c=0;c<e;c++)i[c]="$"+c;if(r=Function("binder","return function ("+joiny(i,",")+"){ return binder.apply(this,arguments); }")(function(){if(this instanceof r){var e=n.apply(this,concatty(o,arguments));return Object(e)===e?e:this}return n.apply(t,concatty(o,arguments))}),n.prototype){var p=function Empty(){};p.prototype=n.prototype,r.prototype=new p,p.prototype=null}return r};
80
80
 
81
+ },{}],39:[function(require,module,exports){
82
+ "use strict";module.exports=Math.pow;
83
+
81
84
  },{}],35:[function(require,module,exports){
82
85
  "use strict";module.exports=Math.floor;
83
86
 
87
+ },{}],38:[function(require,module,exports){
88
+ "use strict";module.exports=Math.min;
89
+
84
90
  },{}],34:[function(require,module,exports){
85
91
  "use strict";module.exports=Math.abs;
86
92
 
87
- },{}],37:[function(require,module,exports){
88
- "use strict";module.exports=Math.max;
89
-
90
- },{}],39:[function(require,module,exports){
91
- "use strict";module.exports=Math.pow;
92
-
93
93
  },{}],40:[function(require,module,exports){
94
94
  "use strict";module.exports=Math.round;
95
95
 
96
- },{}],38:[function(require,module,exports){
97
- "use strict";module.exports=Math.min;
96
+ },{}],37:[function(require,module,exports){
97
+ "use strict";module.exports=Math.max;
98
98
 
99
99
  },{}],27:[function(require,module,exports){
100
100
  "use strict";module.exports="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null;
101
101
 
102
- },{}],26:[function(require,module,exports){
103
- "use strict";var $Object=require(22);module.exports=$Object.getPrototypeOf||null;
104
-
105
- },{"22":22}],41:[function(require,module,exports){
102
+ },{}],41:[function(require,module,exports){
106
103
  "use strict";var $isNaN=require(36);module.exports=function sign(i){return $isNaN(i)||0===i?i:i<0?-1:1};
107
104
 
108
- },{"36":36}],33:[function(require,module,exports){
109
- "use strict";var call=Function.prototype.call,$hasOwn=Object.prototype.hasOwnProperty,bind=require(24);module.exports=bind.call(call,$hasOwn);
105
+ },{"36":36}],26:[function(require,module,exports){
106
+ "use strict";var $Object=require(22);module.exports=$Object.getPrototypeOf||null;
110
107
 
111
- },{"24":24}],31:[function(require,module,exports){
108
+ },{"22":22}],31:[function(require,module,exports){
112
109
  "use strict";var origSymbol="undefined"!=typeof Symbol&&Symbol,hasSymbolSham=require(32);module.exports=function hasNativeSymbols(){return"function"==typeof origSymbol&&"function"==typeof Symbol&&"symbol"==typeof origSymbol("foo")&&"symbol"==typeof Symbol("bar")&&hasSymbolSham()};
113
110
 
114
- },{"32":32}],28:[function(require,module,exports){
111
+ },{"32":32}],33:[function(require,module,exports){
112
+ "use strict";var call=Function.prototype.call,$hasOwn=Object.prototype.hasOwnProperty,bind=require(24);module.exports=bind.call(call,$hasOwn);
113
+
114
+ },{"24":24}],28:[function(require,module,exports){
115
115
  "use strict";var reflectGetProto=require(27),originalGetProto=require(26),getDunderProto=require(13);module.exports=reflectGetProto?function getProto(t){return reflectGetProto(t)}:originalGetProto?function getProto(t){if(!t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("getProto: not an object");return originalGetProto(t)}:getDunderProto?function getProto(t){return getDunderProto(t)}:null;
116
116
 
117
117
  },{"13":13,"26":26,"27":27}],29:[function(require,module,exports){
@@ -1,9 +1,59 @@
1
1
  'use strict';
2
2
 
3
+ var getSideChannel = require('side-channel');
3
4
  var utils = require('./utils');
4
5
 
5
6
  var has = Object.prototype.hasOwnProperty;
6
7
  var isArray = Array.isArray;
8
+ var getPrototypeOf = Object.getPrototypeOf;
9
+
10
+ var isPlainContainer = function isPlainContainer(value) {
11
+ if (!value || typeof value !== 'object') {
12
+ return false;
13
+ }
14
+ if (isArray(value)) {
15
+ return true;
16
+ }
17
+ var proto = getPrototypeOf(value);
18
+ return proto === Object.prototype || proto === null;
19
+ };
20
+
21
+ var emptyCopyOf = function emptyCopyOf(value) {
22
+ if (isArray(value)) {
23
+ var arr = [];
24
+ arr.length = value.length;
25
+ return arr;
26
+ }
27
+ return getPrototypeOf(value) === null ? { __proto__: null } : {};
28
+ };
29
+
30
+ // `merge` and `compact` modify the containers they are given, so copy the caller's arrays and plain objects first
31
+ var copyInput = function copyInput(input) {
32
+ var copies = getSideChannel();
33
+ var result = {};
34
+ var queue = [{ source: input, target: result }];
35
+
36
+ for (var i = 0; i < queue.length; ++i) {
37
+ var source = queue[i].source;
38
+ var target = queue[i].target;
39
+ var keys = Object.keys(source);
40
+ for (var j = 0; j < keys.length; ++j) {
41
+ var value = source[keys[j]];
42
+ if (isPlainContainer(value)) {
43
+ if (!copies.has(value)) {
44
+ var copy = emptyCopyOf(value);
45
+ copies.set(value, copy);
46
+ queue[queue.length] = { source: value, target: copy };
47
+ }
48
+ target[keys[j]] = copies.get(value);
49
+ } else {
50
+ target[keys[j]] = value;
51
+ }
52
+ }
53
+ }
54
+
55
+ return result;
56
+ };
7
57
 
8
58
  var defaults = {
9
59
  allowDots: false,
@@ -112,6 +162,9 @@ var parseValues = function parseQueryStringValues(str, options) {
112
162
  var bracketEqualsPos = part.indexOf(']=');
113
163
  var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
114
164
 
165
+ // `[]` belongs to the key, so look for it at the split point, not anywhere in the part
166
+ var isEmptyBracketKey = pos > 1 && part.slice(pos - 2, pos) === '[]';
167
+
115
168
  var key;
116
169
  var val;
117
170
  if (pos === -1) {
@@ -138,7 +191,7 @@ var parseValues = function parseQueryStringValues(str, options) {
138
191
  val = interpretNumericEntities(String(val));
139
192
  }
140
193
 
141
- if (part.indexOf('[]=') > -1) {
194
+ if (isEmptyBracketKey) {
142
195
  val = isArray(val) ? [val] : val;
143
196
  }
144
197
 
@@ -148,7 +201,7 @@ var parseValues = function parseQueryStringValues(str, options) {
148
201
 
149
202
  if (key !== null) {
150
203
  var existing = has.call(obj, key);
151
- if (existing && (options.duplicates === 'combine' || part.indexOf('[]=') > -1)) {
204
+ if (existing && (options.duplicates === 'combine' || isEmptyBracketKey)) {
152
205
  obj[key] = utils.combine(
153
206
  obj[key],
154
207
  val,
@@ -224,10 +277,47 @@ var parseObject = function (chain, val, options, valuesParsed) {
224
277
  return leaf;
225
278
  };
226
279
 
280
+ // Behaves like `key.replace(/\.([^.[]+)/g, '[$1]')`, but only rewrites a dot
281
+ // that sits at bracket depth 0. A literal dot already inside a `[...]` segment
282
+ // is left untouched instead of corrupting the key (e.g. "outer[a.b]"). (#617)
283
+ var topLevelDotsToBrackets = function topLevelDotsToBrackets(key) {
284
+ var result = '';
285
+ var depth = 0;
286
+ for (var i = 0; i < key.length; i += 1) {
287
+ var cu = key.charCodeAt(i);
288
+ if (cu === 0x5B) { // '['
289
+ depth += 1;
290
+ result += '[';
291
+ } else if (cu === 0x5D) { // ']'
292
+ if (depth > 0) {
293
+ depth -= 1;
294
+ }
295
+ result += ']';
296
+ } else if (
297
+ cu === 0x2E // '.'
298
+ && depth === 0
299
+ && i + 1 < key.length
300
+ && key.charCodeAt(i + 1) !== 0x2E // not another '.'
301
+ && key.charCodeAt(i + 1) !== 0x5B // not '['
302
+ ) {
303
+ var start = i + 1;
304
+ var j = start;
305
+ while (j < key.length && key.charCodeAt(j) !== 0x2E && key.charCodeAt(j) !== 0x5B) {
306
+ j += 1;
307
+ }
308
+ result += '[' + key.slice(start, j) + ']';
309
+ i = j - 1;
310
+ } else {
311
+ result += key.charAt(i);
312
+ }
313
+ }
314
+ return result;
315
+ };
316
+
227
317
  // Split a key like "a[b][c[]]" into ['a', '[b]', '[c[]]'] while preserving
228
318
  // qs parse semantics for depth/prototype guards.
229
319
  var splitKeyIntoSegments = function splitKeyIntoSegments(originalKey, options) {
230
- var key = options.allowDots ? originalKey.replace(/\.([^.[]+)/g, '[$1]') : originalKey;
320
+ var key = options.allowDots ? topLevelDotsToBrackets(originalKey) : originalKey;
231
321
 
232
322
  // depth <= 0 keeps the whole key as one segment
233
323
  if (options.depth <= 0) {
@@ -393,7 +483,7 @@ module.exports = function (str, opts) {
393
483
  return options.plainObjects ? { __proto__: null } : {};
394
484
  }
395
485
 
396
- var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
486
+ var tempObj = typeof str === 'string' ? parseValues(str, options) : copyInput(str);
397
487
  var obj = options.plainObjects ? { __proto__: null } : {};
398
488
 
399
489
  // Iterate over the keys and setup the new object
@@ -150,10 +150,10 @@ var stringify = function stringify(
150
150
  // we need to join elements in
151
151
  if (encodeValuesOnly && encoder) {
152
152
  obj = utils.maybeMap(obj, function (v) {
153
- return v == null ? v : encoder(v);
153
+ return v == null ? v : encoder(v, defaults.encoder, charset, 'value', format);
154
154
  });
155
155
  }
156
- objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
156
+ objKeys = [{ value: obj.length > 0 ? utils.toCoercible(obj).join(',') || null : void undefined }];
157
157
  } else if (isArray(filter)) {
158
158
  objKeys = filter;
159
159
  } else {
@@ -161,7 +161,7 @@ var stringify = function stringify(
161
161
  objKeys = sort ? keys.sort(sort) : keys;
162
162
  }
163
163
 
164
- var encodedPrefix = encodeDotInKeys ? String(prefix).replace(/\./g, '%2E') : String(prefix);
164
+ var encodedPrefix = String(prefix);
165
165
 
166
166
  var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? encodedPrefix + '[]' : encodedPrefix;
167
167
 
@@ -251,7 +251,7 @@ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
251
251
  }
252
252
 
253
253
  var arrayFormat;
254
- if (opts.arrayFormat in arrayPrefixGenerators) {
254
+ if (has.call(arrayPrefixGenerators, opts.arrayFormat)) {
255
255
  arrayFormat = opts.arrayFormat;
256
256
  } else if ('indices' in opts) {
257
257
  arrayFormat = opts.indices ? 'indices' : 'repeat';
@@ -28,6 +28,23 @@ var setMaxIndex = function setMaxIndex(obj, maxIndex) {
28
28
  overflowChannel.set(obj, maxIndex);
29
29
  };
30
30
 
31
+ // Track containers produced by a `strictMerge` conflict wrap, and their current max numeric index,
32
+ // so repeated conflicts on one path append instead of nesting a new wrapper each time
33
+ var conflictChannel = getSideChannel();
34
+
35
+ var markConflict = function markConflict(obj, maxIndex) {
36
+ conflictChannel.set(obj, maxIndex);
37
+ return obj;
38
+ };
39
+
40
+ var isConflict = function isConflict(obj) {
41
+ return conflictChannel.has(obj);
42
+ };
43
+
44
+ var getConflictIndex = function getConflictIndex(obj) {
45
+ return conflictChannel.get(obj);
46
+ };
47
+
31
48
  var hexTable = (function () {
32
49
  var array = [];
33
50
  for (var i = 0; i < 256; ++i) {
@@ -80,6 +97,30 @@ var setProperty = function setProperty(obj, key, value) {
80
97
  }
81
98
  };
82
99
 
100
+ var maxNumericIndex = function maxNumericIndex(obj, min) {
101
+ var max = min;
102
+ var keys = Object.keys(obj);
103
+ for (var i = 0; i < keys.length; ++i) {
104
+ var num = parseInt(keys[i], 10);
105
+ if (String(num) === keys[i] && num > max) {
106
+ max = num;
107
+ }
108
+ }
109
+
110
+ return max;
111
+ };
112
+
113
+ var limitedPair = function limitedPair(first, second, options) {
114
+ var pair = [first, second];
115
+ if (options && typeof options.arrayLimit === 'number' && pair.length > options.arrayLimit) {
116
+ if (options.throwOnLimitExceeded) {
117
+ throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
118
+ }
119
+ return markOverflow(arrayToObject(pair, options), 1);
120
+ }
121
+ return pair;
122
+ };
123
+
83
124
  var merge = function merge(target, source, options) {
84
125
  /* eslint no-param-reassign: 0 */
85
126
  if (!source) {
@@ -102,8 +143,20 @@ var merge = function merge(target, source, options) {
102
143
  var newIndex = getMaxIndex(target) + 1;
103
144
  target[newIndex] = source;
104
145
  setMaxIndex(target, newIndex);
146
+ } else if (options && options.strictMerge && isConflict(target)) {
147
+ var nextConflict = getConflictIndex(target) + 1;
148
+ if (
149
+ options.throwOnLimitExceeded
150
+ && typeof options.arrayLimit === 'number'
151
+ && nextConflict >= options.arrayLimit
152
+ ) {
153
+ throw new RangeError('Array limit exceeded. Only ' + options.arrayLimit + ' element' + (options.arrayLimit === 1 ? '' : 's') + ' allowed in an array.');
154
+ }
155
+ target[nextConflict] = source;
156
+ markConflict(target, nextConflict);
105
157
  } else if (options && options.strictMerge) {
106
- return [target, source];
158
+ var conflict = limitedPair(target, source, options);
159
+ return isArray(conflict) ? markConflict(conflict, 1) : conflict;
107
160
  } else if (
108
161
  (options && (options.plainObjects || options.allowPrototypes))
109
162
  || !has.call(Object.prototype, source)
@@ -111,7 +164,7 @@ var merge = function merge(target, source, options) {
111
164
  target[source] = true;
112
165
  }
113
166
  } else {
114
- return [target, source];
167
+ return limitedPair(target, source, options);
115
168
  }
116
169
 
117
170
  return target;
@@ -143,6 +196,10 @@ var merge = function merge(target, source, options) {
143
196
  var mergeTarget = target;
144
197
  if (isArray(target) && !isArray(source)) {
145
198
  mergeTarget = arrayToObject(target, options);
199
+ if (isConflict(target)) {
200
+ // the array may have grown past its last conflict, so continue after its last index
201
+ markConflict(mergeTarget, target.length - 1);
202
+ }
146
203
  }
147
204
 
148
205
  if (isArray(target) && isArray(source)) {
@@ -177,7 +234,7 @@ var merge = function merge(target, source, options) {
177
234
  }
178
235
 
179
236
  if (isOverflow(source) && !isOverflow(acc)) {
180
- markOverflow(acc, getMaxIndex(source));
237
+ markOverflow(acc, maxNumericIndex(acc, getMaxIndex(source)));
181
238
  }
182
239
  if (isOverflow(acc)) {
183
240
  var keyNum = parseInt(key, 10);
@@ -185,6 +242,12 @@ var merge = function merge(target, source, options) {
185
242
  setMaxIndex(acc, keyNum);
186
243
  }
187
244
  }
245
+ if (isConflict(acc)) {
246
+ var conflictKey = parseInt(key, 10);
247
+ if (String(conflictKey) === key && conflictKey > getConflictIndex(acc)) {
248
+ markConflict(acc, conflictKey);
249
+ }
250
+ }
188
251
 
189
252
  return acc;
190
253
  }, mergeTarget);
@@ -198,6 +261,13 @@ var assign = function assignSingleSource(target, source) {
198
261
  };
199
262
 
200
263
  var decode = function (str, defaultDecoder, charset) {
264
+ // With no `%` there is no escape to expand, in either charset: `unescape` has
265
+ // nothing to match, and `decodeURIComponent` is the identity on such a string
266
+ // (and cannot throw). So only `+` -> ' ' remains, and often not even that.
267
+ if (typeof str === 'string' && str.indexOf('%') === -1) {
268
+ return str.indexOf('+') === -1 ? str : str.replace(/\+/g, ' ');
269
+ }
270
+
201
271
  var strWithoutPlus = str.replace(/\+/g, ' ');
202
272
  if (charset === 'iso-8859-1') {
203
273
  // unescape never throws, no try...catch needed:
@@ -211,6 +281,57 @@ var decode = function (str, defaultDecoder, charset) {
211
281
  }
212
282
  };
213
283
 
284
+ var hasToPrimitive = typeof Symbol === 'function' && typeof Symbol.toPrimitive === 'symbol';
285
+ var arrayJoin = Array.prototype.join;
286
+ var arrayToString = Array.prototype.toString;
287
+ var objectToString = Object.prototype.toString;
288
+
289
+ // an object with no callable toString (eg, from JSON, or null-prototype) would make String() or join() throw,
290
+ // so it becomes its primitive valueOf or else Object.prototype.toString; arrays are walked like join walks them,
291
+ // copied only once an element changes, with an array already being joined becoming '' as engines do for cycles
292
+ var toCoercible = function toCoercible(value, joining) {
293
+ if (!value || (typeof value !== 'object' && typeof value !== 'function')) {
294
+ return value;
295
+ }
296
+ if (hasToPrimitive && value[Symbol.toPrimitive] != null) {
297
+ return value;
298
+ }
299
+ if (isArray(value) && value.toString === arrayToString && value.join === arrayJoin) {
300
+ var ancestors = joining || getSideChannel();
301
+ if (ancestors.has(value)) {
302
+ return '';
303
+ }
304
+ ancestors.set(value, true);
305
+ var copy;
306
+ for (var i = 0; i < value.length; i += 1) {
307
+ var item = value[i];
308
+ var coerced = toCoercible(item, ancestors);
309
+ if (!copy && coerced !== item) {
310
+ copy = [];
311
+ for (var j = 0; j < i; j += 1) {
312
+ copy[j] = value[j];
313
+ }
314
+ }
315
+ if (copy) {
316
+ copy[i] = coerced;
317
+ }
318
+ }
319
+ ancestors['delete'](value);
320
+ return copy || value;
321
+ }
322
+ if (typeof value.toString === 'function') {
323
+ return value;
324
+ }
325
+ var valueOf = value.valueOf;
326
+ if (typeof valueOf === 'function') {
327
+ var primitive = valueOf.call(value);
328
+ if (!primitive || (typeof primitive !== 'object' && typeof primitive !== 'function')) {
329
+ return String(primitive);
330
+ }
331
+ }
332
+ return objectToString.call(value);
333
+ };
334
+
214
335
  var limit = 1024;
215
336
 
216
337
  /* eslint operator-linebreak: [2, "before"] */
@@ -226,13 +347,15 @@ var encode = function encode(str, defaultEncoder, charset, kind, format) {
226
347
  if (typeof str === 'symbol') {
227
348
  string = Symbol.prototype.toString.call(str);
228
349
  } else if (typeof str !== 'string') {
229
- string = String(str);
350
+ string = String(toCoercible(str));
230
351
  }
231
352
 
232
353
  if (charset === 'iso-8859-1') {
354
+ // `escape` leaves `+` untouched, but a literal `+` is decoded back to a space,
355
+ // so it must be percent-encoded to round-trip (the utf-8 path already does this).
233
356
  return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
234
357
  return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
235
- });
358
+ }).replace(/\+/g, '%2B');
236
359
  }
237
360
 
238
361
  var out = '';
@@ -384,5 +507,6 @@ module.exports = {
384
507
  isRegExp: isRegExp,
385
508
  markOverflow: markOverflow,
386
509
  maybeMap: maybeMap,
387
- merge: merge
510
+ merge: merge,
511
+ toCoercible: toCoercible
388
512
  };
@@ -2,7 +2,7 @@
2
2
  "name": "qs",
3
3
  "description": "A querystring parser that supports nesting and arrays, with a depth limit",
4
4
  "homepage": "https://github.com/ljharb/qs",
5
- "version": "6.16.0",
5
+ "version": "6.16.1",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/ljharb/qs.git"
@@ -37,13 +37,13 @@
37
37
  "devDependencies": {
38
38
  "@browserify/envify": "^6.0.0",
39
39
  "@browserify/uglifyify": "^6.0.0",
40
- "@ljharb/eslint-config": "^22.2.4",
40
+ "@ljharb/eslint-config": "^22.2.5",
41
41
  "browserify": "^16.5.2",
42
42
  "bundle-collapser": "^1.4.0",
43
43
  "common-shakeify": "~1.0.0",
44
44
  "eclint": "^2.8.1",
45
45
  "es-value-fixtures": "^1.7.1",
46
- "eslint": "^10.9.0",
46
+ "eslint": "^10.12.0",
47
47
  "evalmd": "^0.0.22",
48
48
  "for-each": "^0.3.5",
49
49
  "glob": "=10.3.7",
@@ -65,7 +65,7 @@
65
65
  "qs-iconv": "^1.0.4",
66
66
  "safe-publish-latest": "^2.0.0",
67
67
  "safer-buffer": "^2.1.2",
68
- "tape": "^5.10.2",
68
+ "tape": "^5.10.3",
69
69
  "unassertify": "^3.0.1"
70
70
  },
71
71
  "scripts": {