Node-Red configuration
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

qs.js 68KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054
  1. (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Qs = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
  2. 'use strict';
  3. var replace = String.prototype.replace;
  4. var percentTwenties = /%20/g;
  5. var Format = {
  6. RFC1738: 'RFC1738',
  7. RFC3986: 'RFC3986'
  8. };
  9. module.exports = {
  10. 'default': Format.RFC3986,
  11. formatters: {
  12. RFC1738: function (value) {
  13. return replace.call(value, percentTwenties, '+');
  14. },
  15. RFC3986: function (value) {
  16. return String(value);
  17. }
  18. },
  19. RFC1738: Format.RFC1738,
  20. RFC3986: Format.RFC3986
  21. };
  22. },{}],2:[function(require,module,exports){
  23. 'use strict';
  24. var stringify = require('./stringify');
  25. var parse = require('./parse');
  26. var formats = require('./formats');
  27. module.exports = {
  28. formats: formats,
  29. parse: parse,
  30. stringify: stringify
  31. };
  32. },{"./formats":1,"./parse":3,"./stringify":4}],3:[function(require,module,exports){
  33. 'use strict';
  34. var utils = require('./utils');
  35. var has = Object.prototype.hasOwnProperty;
  36. var isArray = Array.isArray;
  37. var defaults = {
  38. allowDots: false,
  39. allowPrototypes: false,
  40. allowSparse: false,
  41. arrayLimit: 20,
  42. charset: 'utf-8',
  43. charsetSentinel: false,
  44. comma: false,
  45. decoder: utils.decode,
  46. delimiter: '&',
  47. depth: 5,
  48. ignoreQueryPrefix: false,
  49. interpretNumericEntities: false,
  50. parameterLimit: 1000,
  51. parseArrays: true,
  52. plainObjects: false,
  53. strictNullHandling: false
  54. };
  55. var interpretNumericEntities = function (str) {
  56. return str.replace(/&#(\d+);/g, function ($0, numberStr) {
  57. return String.fromCharCode(parseInt(numberStr, 10));
  58. });
  59. };
  60. var parseArrayValue = function (val, options) {
  61. if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
  62. return val.split(',');
  63. }
  64. return val;
  65. };
  66. // This is what browsers will submit when the ✓ character occurs in an
  67. // application/x-www-form-urlencoded body and the encoding of the page containing
  68. // the form is iso-8859-1, or when the submitted form has an accept-charset
  69. // attribute of iso-8859-1. Presumably also with other charsets that do not contain
  70. // the ✓ character, such as us-ascii.
  71. var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('&#10003;')
  72. // These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
  73. var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
  74. var parseValues = function parseQueryStringValues(str, options) {
  75. var obj = {};
  76. var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
  77. var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
  78. var parts = cleanStr.split(options.delimiter, limit);
  79. var skipIndex = -1; // Keep track of where the utf8 sentinel was found
  80. var i;
  81. var charset = options.charset;
  82. if (options.charsetSentinel) {
  83. for (i = 0; i < parts.length; ++i) {
  84. if (parts[i].indexOf('utf8=') === 0) {
  85. if (parts[i] === charsetSentinel) {
  86. charset = 'utf-8';
  87. } else if (parts[i] === isoSentinel) {
  88. charset = 'iso-8859-1';
  89. }
  90. skipIndex = i;
  91. i = parts.length; // The eslint settings do not allow break;
  92. }
  93. }
  94. }
  95. for (i = 0; i < parts.length; ++i) {
  96. if (i === skipIndex) {
  97. continue;
  98. }
  99. var part = parts[i];
  100. var bracketEqualsPos = part.indexOf(']=');
  101. var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
  102. var key, val;
  103. if (pos === -1) {
  104. key = options.decoder(part, defaults.decoder, charset, 'key');
  105. val = options.strictNullHandling ? null : '';
  106. } else {
  107. key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
  108. val = utils.maybeMap(
  109. parseArrayValue(part.slice(pos + 1), options),
  110. function (encodedVal) {
  111. return options.decoder(encodedVal, defaults.decoder, charset, 'value');
  112. }
  113. );
  114. }
  115. if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
  116. val = interpretNumericEntities(val);
  117. }
  118. if (part.indexOf('[]=') > -1) {
  119. val = isArray(val) ? [val] : val;
  120. }
  121. if (has.call(obj, key)) {
  122. obj[key] = utils.combine(obj[key], val);
  123. } else {
  124. obj[key] = val;
  125. }
  126. }
  127. return obj;
  128. };
  129. var parseObject = function (chain, val, options, valuesParsed) {
  130. var leaf = valuesParsed ? val : parseArrayValue(val, options);
  131. for (var i = chain.length - 1; i >= 0; --i) {
  132. var obj;
  133. var root = chain[i];
  134. if (root === '[]' && options.parseArrays) {
  135. obj = [].concat(leaf);
  136. } else {
  137. obj = options.plainObjects ? Object.create(null) : {};
  138. var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
  139. var index = parseInt(cleanRoot, 10);
  140. if (!options.parseArrays && cleanRoot === '') {
  141. obj = { 0: leaf };
  142. } else if (
  143. !isNaN(index)
  144. && root !== cleanRoot
  145. && String(index) === cleanRoot
  146. && index >= 0
  147. && (options.parseArrays && index <= options.arrayLimit)
  148. ) {
  149. obj = [];
  150. obj[index] = leaf;
  151. } else if (cleanRoot !== '__proto__') {
  152. obj[cleanRoot] = leaf;
  153. }
  154. }
  155. leaf = obj;
  156. }
  157. return leaf;
  158. };
  159. var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
  160. if (!givenKey) {
  161. return;
  162. }
  163. // Transform dot notation to bracket notation
  164. var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
  165. // The regex chunks
  166. var brackets = /(\[[^[\]]*])/;
  167. var child = /(\[[^[\]]*])/g;
  168. // Get the parent
  169. var segment = options.depth > 0 && brackets.exec(key);
  170. var parent = segment ? key.slice(0, segment.index) : key;
  171. // Stash the parent if it exists
  172. var keys = [];
  173. if (parent) {
  174. // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
  175. if (!options.plainObjects && has.call(Object.prototype, parent)) {
  176. if (!options.allowPrototypes) {
  177. return;
  178. }
  179. }
  180. keys.push(parent);
  181. }
  182. // Loop through children appending to the array until we hit depth
  183. var i = 0;
  184. while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
  185. i += 1;
  186. if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
  187. if (!options.allowPrototypes) {
  188. return;
  189. }
  190. }
  191. keys.push(segment[1]);
  192. }
  193. // If there's a remainder, just add whatever is left
  194. if (segment) {
  195. keys.push('[' + key.slice(segment.index) + ']');
  196. }
  197. return parseObject(keys, val, options, valuesParsed);
  198. };
  199. var normalizeParseOptions = function normalizeParseOptions(opts) {
  200. if (!opts) {
  201. return defaults;
  202. }
  203. if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {
  204. throw new TypeError('Decoder has to be a function.');
  205. }
  206. if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
  207. throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
  208. }
  209. var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;
  210. return {
  211. allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
  212. allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,
  213. allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,
  214. arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,
  215. charset: charset,
  216. charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
  217. comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,
  218. decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,
  219. delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
  220. // eslint-disable-next-line no-implicit-coercion, no-extra-parens
  221. depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth,
  222. ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
  223. interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
  224. parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,
  225. parseArrays: opts.parseArrays !== false,
  226. plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
  227. strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
  228. };
  229. };
  230. module.exports = function (str, opts) {
  231. var options = normalizeParseOptions(opts);
  232. if (str === '' || str === null || typeof str === 'undefined') {
  233. return options.plainObjects ? Object.create(null) : {};
  234. }
  235. var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
  236. var obj = options.plainObjects ? Object.create(null) : {};
  237. // Iterate over the keys and setup the new object
  238. var keys = Object.keys(tempObj);
  239. for (var i = 0; i < keys.length; ++i) {
  240. var key = keys[i];
  241. var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
  242. obj = utils.merge(obj, newObj, options);
  243. }
  244. if (options.allowSparse === true) {
  245. return obj;
  246. }
  247. return utils.compact(obj);
  248. };
  249. },{"./utils":5}],4:[function(require,module,exports){
  250. 'use strict';
  251. var getSideChannel = require('side-channel');
  252. var utils = require('./utils');
  253. var formats = require('./formats');
  254. var has = Object.prototype.hasOwnProperty;
  255. var arrayPrefixGenerators = {
  256. brackets: function brackets(prefix) {
  257. return prefix + '[]';
  258. },
  259. comma: 'comma',
  260. indices: function indices(prefix, key) {
  261. return prefix + '[' + key + ']';
  262. },
  263. repeat: function repeat(prefix) {
  264. return prefix;
  265. }
  266. };
  267. var isArray = Array.isArray;
  268. var split = String.prototype.split;
  269. var push = Array.prototype.push;
  270. var pushToArray = function (arr, valueOrArray) {
  271. push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
  272. };
  273. var toISO = Date.prototype.toISOString;
  274. var defaultFormat = formats['default'];
  275. var defaults = {
  276. addQueryPrefix: false,
  277. allowDots: false,
  278. charset: 'utf-8',
  279. charsetSentinel: false,
  280. delimiter: '&',
  281. encode: true,
  282. encoder: utils.encode,
  283. encodeValuesOnly: false,
  284. format: defaultFormat,
  285. formatter: formats.formatters[defaultFormat],
  286. // deprecated
  287. indices: false,
  288. serializeDate: function serializeDate(date) {
  289. return toISO.call(date);
  290. },
  291. skipNulls: false,
  292. strictNullHandling: false
  293. };
  294. var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
  295. return typeof v === 'string'
  296. || typeof v === 'number'
  297. || typeof v === 'boolean'
  298. || typeof v === 'symbol'
  299. || typeof v === 'bigint';
  300. };
  301. var sentinel = {};
  302. var stringify = function stringify(
  303. object,
  304. prefix,
  305. generateArrayPrefix,
  306. commaRoundTrip,
  307. strictNullHandling,
  308. skipNulls,
  309. encoder,
  310. filter,
  311. sort,
  312. allowDots,
  313. serializeDate,
  314. format,
  315. formatter,
  316. encodeValuesOnly,
  317. charset,
  318. sideChannel
  319. ) {
  320. var obj = object;
  321. var tmpSc = sideChannel;
  322. var step = 0;
  323. var findFlag = false;
  324. while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
  325. // Where object last appeared in the ref tree
  326. var pos = tmpSc.get(object);
  327. step += 1;
  328. if (typeof pos !== 'undefined') {
  329. if (pos === step) {
  330. throw new RangeError('Cyclic object value');
  331. } else {
  332. findFlag = true; // Break while
  333. }
  334. }
  335. if (typeof tmpSc.get(sentinel) === 'undefined') {
  336. step = 0;
  337. }
  338. }
  339. if (typeof filter === 'function') {
  340. obj = filter(prefix, obj);
  341. } else if (obj instanceof Date) {
  342. obj = serializeDate(obj);
  343. } else if (generateArrayPrefix === 'comma' && isArray(obj)) {
  344. obj = utils.maybeMap(obj, function (value) {
  345. if (value instanceof Date) {
  346. return serializeDate(value);
  347. }
  348. return value;
  349. });
  350. }
  351. if (obj === null) {
  352. if (strictNullHandling) {
  353. return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix;
  354. }
  355. obj = '';
  356. }
  357. if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
  358. if (encoder) {
  359. var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
  360. if (generateArrayPrefix === 'comma' && encodeValuesOnly) {
  361. var valuesArray = split.call(String(obj), ',');
  362. var valuesJoined = '';
  363. for (var i = 0; i < valuesArray.length; ++i) {
  364. valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format));
  365. }
  366. return [formatter(keyValue) + (commaRoundTrip && isArray(obj) && valuesArray.length === 1 ? '[]' : '') + '=' + valuesJoined];
  367. }
  368. return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
  369. }
  370. return [formatter(prefix) + '=' + formatter(String(obj))];
  371. }
  372. var values = [];
  373. if (typeof obj === 'undefined') {
  374. return values;
  375. }
  376. var objKeys;
  377. if (generateArrayPrefix === 'comma' && isArray(obj)) {
  378. // we need to join elements in
  379. objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
  380. } else if (isArray(filter)) {
  381. objKeys = filter;
  382. } else {
  383. var keys = Object.keys(obj);
  384. objKeys = sort ? keys.sort(sort) : keys;
  385. }
  386. var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? prefix + '[]' : prefix;
  387. for (var j = 0; j < objKeys.length; ++j) {
  388. var key = objKeys[j];
  389. var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
  390. if (skipNulls && value === null) {
  391. continue;
  392. }
  393. var keyPrefix = isArray(obj)
  394. ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix
  395. : adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']');
  396. sideChannel.set(object, step);
  397. var valueSideChannel = getSideChannel();
  398. valueSideChannel.set(sentinel, sideChannel);
  399. pushToArray(values, stringify(
  400. value,
  401. keyPrefix,
  402. generateArrayPrefix,
  403. commaRoundTrip,
  404. strictNullHandling,
  405. skipNulls,
  406. encoder,
  407. filter,
  408. sort,
  409. allowDots,
  410. serializeDate,
  411. format,
  412. formatter,
  413. encodeValuesOnly,
  414. charset,
  415. valueSideChannel
  416. ));
  417. }
  418. return values;
  419. };
  420. var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
  421. if (!opts) {
  422. return defaults;
  423. }
  424. if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
  425. throw new TypeError('Encoder has to be a function.');
  426. }
  427. var charset = opts.charset || defaults.charset;
  428. if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
  429. throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
  430. }
  431. var format = formats['default'];
  432. if (typeof opts.format !== 'undefined') {
  433. if (!has.call(formats.formatters, opts.format)) {
  434. throw new TypeError('Unknown format option provided.');
  435. }
  436. format = opts.format;
  437. }
  438. var formatter = formats.formatters[format];
  439. var filter = defaults.filter;
  440. if (typeof opts.filter === 'function' || isArray(opts.filter)) {
  441. filter = opts.filter;
  442. }
  443. return {
  444. addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix,
  445. allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
  446. charset: charset,
  447. charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
  448. delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter,
  449. encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode,
  450. encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder,
  451. encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly,
  452. filter: filter,
  453. format: format,
  454. formatter: formatter,
  455. serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate,
  456. skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls,
  457. sort: typeof opts.sort === 'function' ? opts.sort : null,
  458. strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
  459. };
  460. };
  461. module.exports = function (object, opts) {
  462. var obj = object;
  463. var options = normalizeStringifyOptions(opts);
  464. var objKeys;
  465. var filter;
  466. if (typeof options.filter === 'function') {
  467. filter = options.filter;
  468. obj = filter('', obj);
  469. } else if (isArray(options.filter)) {
  470. filter = options.filter;
  471. objKeys = filter;
  472. }
  473. var keys = [];
  474. if (typeof obj !== 'object' || obj === null) {
  475. return '';
  476. }
  477. var arrayFormat;
  478. if (opts && opts.arrayFormat in arrayPrefixGenerators) {
  479. arrayFormat = opts.arrayFormat;
  480. } else if (opts && 'indices' in opts) {
  481. arrayFormat = opts.indices ? 'indices' : 'repeat';
  482. } else {
  483. arrayFormat = 'indices';
  484. }
  485. var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
  486. if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
  487. throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
  488. }
  489. var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip;
  490. if (!objKeys) {
  491. objKeys = Object.keys(obj);
  492. }
  493. if (options.sort) {
  494. objKeys.sort(options.sort);
  495. }
  496. var sideChannel = getSideChannel();
  497. for (var i = 0; i < objKeys.length; ++i) {
  498. var key = objKeys[i];
  499. if (options.skipNulls && obj[key] === null) {
  500. continue;
  501. }
  502. pushToArray(keys, stringify(
  503. obj[key],
  504. key,
  505. generateArrayPrefix,
  506. commaRoundTrip,
  507. options.strictNullHandling,
  508. options.skipNulls,
  509. options.encode ? options.encoder : null,
  510. options.filter,
  511. options.sort,
  512. options.allowDots,
  513. options.serializeDate,
  514. options.format,
  515. options.formatter,
  516. options.encodeValuesOnly,
  517. options.charset,
  518. sideChannel
  519. ));
  520. }
  521. var joined = keys.join(options.delimiter);
  522. var prefix = options.addQueryPrefix === true ? '?' : '';
  523. if (options.charsetSentinel) {
  524. if (options.charset === 'iso-8859-1') {
  525. // encodeURIComponent('&#10003;'), the "numeric entity" representation of a checkmark
  526. prefix += 'utf8=%26%2310003%3B&';
  527. } else {
  528. // encodeURIComponent('✓')
  529. prefix += 'utf8=%E2%9C%93&';
  530. }
  531. }
  532. return joined.length > 0 ? prefix + joined : '';
  533. };
  534. },{"./formats":1,"./utils":5,"side-channel":16}],5:[function(require,module,exports){
  535. 'use strict';
  536. var formats = require('./formats');
  537. var has = Object.prototype.hasOwnProperty;
  538. var isArray = Array.isArray;
  539. var hexTable = (function () {
  540. var array = [];
  541. for (var i = 0; i < 256; ++i) {
  542. array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
  543. }
  544. return array;
  545. }());
  546. var compactQueue = function compactQueue(queue) {
  547. while (queue.length > 1) {
  548. var item = queue.pop();
  549. var obj = item.obj[item.prop];
  550. if (isArray(obj)) {
  551. var compacted = [];
  552. for (var j = 0; j < obj.length; ++j) {
  553. if (typeof obj[j] !== 'undefined') {
  554. compacted.push(obj[j]);
  555. }
  556. }
  557. item.obj[item.prop] = compacted;
  558. }
  559. }
  560. };
  561. var arrayToObject = function arrayToObject(source, options) {
  562. var obj = options && options.plainObjects ? Object.create(null) : {};
  563. for (var i = 0; i < source.length; ++i) {
  564. if (typeof source[i] !== 'undefined') {
  565. obj[i] = source[i];
  566. }
  567. }
  568. return obj;
  569. };
  570. var merge = function merge(target, source, options) {
  571. /* eslint no-param-reassign: 0 */
  572. if (!source) {
  573. return target;
  574. }
  575. if (typeof source !== 'object') {
  576. if (isArray(target)) {
  577. target.push(source);
  578. } else if (target && typeof target === 'object') {
  579. if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) {
  580. target[source] = true;
  581. }
  582. } else {
  583. return [target, source];
  584. }
  585. return target;
  586. }
  587. if (!target || typeof target !== 'object') {
  588. return [target].concat(source);
  589. }
  590. var mergeTarget = target;
  591. if (isArray(target) && !isArray(source)) {
  592. mergeTarget = arrayToObject(target, options);
  593. }
  594. if (isArray(target) && isArray(source)) {
  595. source.forEach(function (item, i) {
  596. if (has.call(target, i)) {
  597. var targetItem = target[i];
  598. if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
  599. target[i] = merge(targetItem, item, options);
  600. } else {
  601. target.push(item);
  602. }
  603. } else {
  604. target[i] = item;
  605. }
  606. });
  607. return target;
  608. }
  609. return Object.keys(source).reduce(function (acc, key) {
  610. var value = source[key];
  611. if (has.call(acc, key)) {
  612. acc[key] = merge(acc[key], value, options);
  613. } else {
  614. acc[key] = value;
  615. }
  616. return acc;
  617. }, mergeTarget);
  618. };
  619. var assign = function assignSingleSource(target, source) {
  620. return Object.keys(source).reduce(function (acc, key) {
  621. acc[key] = source[key];
  622. return acc;
  623. }, target);
  624. };
  625. var decode = function (str, decoder, charset) {
  626. var strWithoutPlus = str.replace(/\+/g, ' ');
  627. if (charset === 'iso-8859-1') {
  628. // unescape never throws, no try...catch needed:
  629. return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
  630. }
  631. // utf-8
  632. try {
  633. return decodeURIComponent(strWithoutPlus);
  634. } catch (e) {
  635. return strWithoutPlus;
  636. }
  637. };
  638. var encode = function encode(str, defaultEncoder, charset, kind, format) {
  639. // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
  640. // It has been adapted here for stricter adherence to RFC 3986
  641. if (str.length === 0) {
  642. return str;
  643. }
  644. var string = str;
  645. if (typeof str === 'symbol') {
  646. string = Symbol.prototype.toString.call(str);
  647. } else if (typeof str !== 'string') {
  648. string = String(str);
  649. }
  650. if (charset === 'iso-8859-1') {
  651. return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
  652. return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
  653. });
  654. }
  655. var out = '';
  656. for (var i = 0; i < string.length; ++i) {
  657. var c = string.charCodeAt(i);
  658. if (
  659. c === 0x2D // -
  660. || c === 0x2E // .
  661. || c === 0x5F // _
  662. || c === 0x7E // ~
  663. || (c >= 0x30 && c <= 0x39) // 0-9
  664. || (c >= 0x41 && c <= 0x5A) // a-z
  665. || (c >= 0x61 && c <= 0x7A) // A-Z
  666. || (format === formats.RFC1738 && (c === 0x28 || c === 0x29)) // ( )
  667. ) {
  668. out += string.charAt(i);
  669. continue;
  670. }
  671. if (c < 0x80) {
  672. out = out + hexTable[c];
  673. continue;
  674. }
  675. if (c < 0x800) {
  676. out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
  677. continue;
  678. }
  679. if (c < 0xD800 || c >= 0xE000) {
  680. out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
  681. continue;
  682. }
  683. i += 1;
  684. c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
  685. /* eslint operator-linebreak: [2, "before"] */
  686. out += hexTable[0xF0 | (c >> 18)]
  687. + hexTable[0x80 | ((c >> 12) & 0x3F)]
  688. + hexTable[0x80 | ((c >> 6) & 0x3F)]
  689. + hexTable[0x80 | (c & 0x3F)];
  690. }
  691. return out;
  692. };
  693. var compact = function compact(value) {
  694. var queue = [{ obj: { o: value }, prop: 'o' }];
  695. var refs = [];
  696. for (var i = 0; i < queue.length; ++i) {
  697. var item = queue[i];
  698. var obj = item.obj[item.prop];
  699. var keys = Object.keys(obj);
  700. for (var j = 0; j < keys.length; ++j) {
  701. var key = keys[j];
  702. var val = obj[key];
  703. if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
  704. queue.push({ obj: obj, prop: key });
  705. refs.push(val);
  706. }
  707. }
  708. }
  709. compactQueue(queue);
  710. return value;
  711. };
  712. var isRegExp = function isRegExp(obj) {
  713. return Object.prototype.toString.call(obj) === '[object RegExp]';
  714. };
  715. var isBuffer = function isBuffer(obj) {
  716. if (!obj || typeof obj !== 'object') {
  717. return false;
  718. }
  719. return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
  720. };
  721. var combine = function combine(a, b) {
  722. return [].concat(a, b);
  723. };
  724. var maybeMap = function maybeMap(val, fn) {
  725. if (isArray(val)) {
  726. var mapped = [];
  727. for (var i = 0; i < val.length; i += 1) {
  728. mapped.push(fn(val[i]));
  729. }
  730. return mapped;
  731. }
  732. return fn(val);
  733. };
  734. module.exports = {
  735. arrayToObject: arrayToObject,
  736. assign: assign,
  737. combine: combine,
  738. compact: compact,
  739. decode: decode,
  740. encode: encode,
  741. isBuffer: isBuffer,
  742. isRegExp: isRegExp,
  743. maybeMap: maybeMap,
  744. merge: merge
  745. };
  746. },{"./formats":1}],6:[function(require,module,exports){
  747. },{}],7:[function(require,module,exports){
  748. 'use strict';
  749. var GetIntrinsic = require('get-intrinsic');
  750. var callBind = require('./');
  751. var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
  752. module.exports = function callBoundIntrinsic(name, allowMissing) {
  753. var intrinsic = GetIntrinsic(name, !!allowMissing);
  754. if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
  755. return callBind(intrinsic);
  756. }
  757. return intrinsic;
  758. };
  759. },{"./":8,"get-intrinsic":11}],8:[function(require,module,exports){
  760. 'use strict';
  761. var bind = require('function-bind');
  762. var GetIntrinsic = require('get-intrinsic');
  763. var $apply = GetIntrinsic('%Function.prototype.apply%');
  764. var $call = GetIntrinsic('%Function.prototype.call%');
  765. var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
  766. var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
  767. var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
  768. var $max = GetIntrinsic('%Math.max%');
  769. if ($defineProperty) {
  770. try {
  771. $defineProperty({}, 'a', { value: 1 });
  772. } catch (e) {
  773. // IE 8 has a broken defineProperty
  774. $defineProperty = null;
  775. }
  776. }
  777. module.exports = function callBind(originalFunction) {
  778. var func = $reflectApply(bind, $call, arguments);
  779. if ($gOPD && $defineProperty) {
  780. var desc = $gOPD(func, 'length');
  781. if (desc.configurable) {
  782. // original length, plus the receiver, minus any additional arguments (after the receiver)
  783. $defineProperty(
  784. func,
  785. 'length',
  786. { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
  787. );
  788. }
  789. }
  790. return func;
  791. };
  792. var applyBind = function applyBind() {
  793. return $reflectApply(bind, $apply, arguments);
  794. };
  795. if ($defineProperty) {
  796. $defineProperty(module.exports, 'apply', { value: applyBind });
  797. } else {
  798. module.exports.apply = applyBind;
  799. }
  800. },{"function-bind":10,"get-intrinsic":11}],9:[function(require,module,exports){
  801. 'use strict';
  802. /* eslint no-invalid-this: 1 */
  803. var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
  804. var slice = Array.prototype.slice;
  805. var toStr = Object.prototype.toString;
  806. var funcType = '[object Function]';
  807. module.exports = function bind(that) {
  808. var target = this;
  809. if (typeof target !== 'function' || toStr.call(target) !== funcType) {
  810. throw new TypeError(ERROR_MESSAGE + target);
  811. }
  812. var args = slice.call(arguments, 1);
  813. var bound;
  814. var binder = function () {
  815. if (this instanceof bound) {
  816. var result = target.apply(
  817. this,
  818. args.concat(slice.call(arguments))
  819. );
  820. if (Object(result) === result) {
  821. return result;
  822. }
  823. return this;
  824. } else {
  825. return target.apply(
  826. that,
  827. args.concat(slice.call(arguments))
  828. );
  829. }
  830. };
  831. var boundLength = Math.max(0, target.length - args.length);
  832. var boundArgs = [];
  833. for (var i = 0; i < boundLength; i++) {
  834. boundArgs.push('$' + i);
  835. }
  836. bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
  837. if (target.prototype) {
  838. var Empty = function Empty() {};
  839. Empty.prototype = target.prototype;
  840. bound.prototype = new Empty();
  841. Empty.prototype = null;
  842. }
  843. return bound;
  844. };
  845. },{}],10:[function(require,module,exports){
  846. 'use strict';
  847. var implementation = require('./implementation');
  848. module.exports = Function.prototype.bind || implementation;
  849. },{"./implementation":9}],11:[function(require,module,exports){
  850. 'use strict';
  851. var undefined;
  852. var $SyntaxError = SyntaxError;
  853. var $Function = Function;
  854. var $TypeError = TypeError;
  855. // eslint-disable-next-line consistent-return
  856. var getEvalledConstructor = function (expressionSyntax) {
  857. try {
  858. return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
  859. } catch (e) {}
  860. };
  861. var $gOPD = Object.getOwnPropertyDescriptor;
  862. if ($gOPD) {
  863. try {
  864. $gOPD({}, '');
  865. } catch (e) {
  866. $gOPD = null; // this is IE 8, which has a broken gOPD
  867. }
  868. }
  869. var throwTypeError = function () {
  870. throw new $TypeError();
  871. };
  872. var ThrowTypeError = $gOPD
  873. ? (function () {
  874. try {
  875. // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
  876. arguments.callee; // IE 8 does not throw here
  877. return throwTypeError;
  878. } catch (calleeThrows) {
  879. try {
  880. // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
  881. return $gOPD(arguments, 'callee').get;
  882. } catch (gOPDthrows) {
  883. return throwTypeError;
  884. }
  885. }
  886. }())
  887. : throwTypeError;
  888. var hasSymbols = require('has-symbols')();
  889. var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
  890. var needsEval = {};
  891. var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
  892. var INTRINSICS = {
  893. '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
  894. '%Array%': Array,
  895. '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
  896. '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
  897. '%AsyncFromSyncIteratorPrototype%': undefined,
  898. '%AsyncFunction%': needsEval,
  899. '%AsyncGenerator%': needsEval,
  900. '%AsyncGeneratorFunction%': needsEval,
  901. '%AsyncIteratorPrototype%': needsEval,
  902. '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
  903. '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
  904. '%Boolean%': Boolean,
  905. '%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
  906. '%Date%': Date,
  907. '%decodeURI%': decodeURI,
  908. '%decodeURIComponent%': decodeURIComponent,
  909. '%encodeURI%': encodeURI,
  910. '%encodeURIComponent%': encodeURIComponent,
  911. '%Error%': Error,
  912. '%eval%': eval, // eslint-disable-line no-eval
  913. '%EvalError%': EvalError,
  914. '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
  915. '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
  916. '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
  917. '%Function%': $Function,
  918. '%GeneratorFunction%': needsEval,
  919. '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
  920. '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
  921. '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
  922. '%isFinite%': isFinite,
  923. '%isNaN%': isNaN,
  924. '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
  925. '%JSON%': typeof JSON === 'object' ? JSON : undefined,
  926. '%Map%': typeof Map === 'undefined' ? undefined : Map,
  927. '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
  928. '%Math%': Math,
  929. '%Number%': Number,
  930. '%Object%': Object,
  931. '%parseFloat%': parseFloat,
  932. '%parseInt%': parseInt,
  933. '%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
  934. '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
  935. '%RangeError%': RangeError,
  936. '%ReferenceError%': ReferenceError,
  937. '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
  938. '%RegExp%': RegExp,
  939. '%Set%': typeof Set === 'undefined' ? undefined : Set,
  940. '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
  941. '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
  942. '%String%': String,
  943. '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
  944. '%Symbol%': hasSymbols ? Symbol : undefined,
  945. '%SyntaxError%': $SyntaxError,
  946. '%ThrowTypeError%': ThrowTypeError,
  947. '%TypedArray%': TypedArray,
  948. '%TypeError%': $TypeError,
  949. '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
  950. '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
  951. '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
  952. '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
  953. '%URIError%': URIError,
  954. '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
  955. '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
  956. '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
  957. };
  958. var doEval = function doEval(name) {
  959. var value;
  960. if (name === '%AsyncFunction%') {
  961. value = getEvalledConstructor('async function () {}');
  962. } else if (name === '%GeneratorFunction%') {
  963. value = getEvalledConstructor('function* () {}');
  964. } else if (name === '%AsyncGeneratorFunction%') {
  965. value = getEvalledConstructor('async function* () {}');
  966. } else if (name === '%AsyncGenerator%') {
  967. var fn = doEval('%AsyncGeneratorFunction%');
  968. if (fn) {
  969. value = fn.prototype;
  970. }
  971. } else if (name === '%AsyncIteratorPrototype%') {
  972. var gen = doEval('%AsyncGenerator%');
  973. if (gen) {
  974. value = getProto(gen.prototype);
  975. }
  976. }
  977. INTRINSICS[name] = value;
  978. return value;
  979. };
  980. var LEGACY_ALIASES = {
  981. '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
  982. '%ArrayPrototype%': ['Array', 'prototype'],
  983. '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
  984. '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
  985. '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
  986. '%ArrayProto_values%': ['Array', 'prototype', 'values'],
  987. '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
  988. '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
  989. '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
  990. '%BooleanPrototype%': ['Boolean', 'prototype'],
  991. '%DataViewPrototype%': ['DataView', 'prototype'],
  992. '%DatePrototype%': ['Date', 'prototype'],
  993. '%ErrorPrototype%': ['Error', 'prototype'],
  994. '%EvalErrorPrototype%': ['EvalError', 'prototype'],
  995. '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
  996. '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
  997. '%FunctionPrototype%': ['Function', 'prototype'],
  998. '%Generator%': ['GeneratorFunction', 'prototype'],
  999. '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
  1000. '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
  1001. '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
  1002. '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
  1003. '%JSONParse%': ['JSON', 'parse'],
  1004. '%JSONStringify%': ['JSON', 'stringify'],
  1005. '%MapPrototype%': ['Map', 'prototype'],
  1006. '%NumberPrototype%': ['Number', 'prototype'],
  1007. '%ObjectPrototype%': ['Object', 'prototype'],
  1008. '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
  1009. '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
  1010. '%PromisePrototype%': ['Promise', 'prototype'],
  1011. '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
  1012. '%Promise_all%': ['Promise', 'all'],
  1013. '%Promise_reject%': ['Promise', 'reject'],
  1014. '%Promise_resolve%': ['Promise', 'resolve'],
  1015. '%RangeErrorPrototype%': ['RangeError', 'prototype'],
  1016. '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
  1017. '%RegExpPrototype%': ['RegExp', 'prototype'],
  1018. '%SetPrototype%': ['Set', 'prototype'],
  1019. '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
  1020. '%StringPrototype%': ['String', 'prototype'],
  1021. '%SymbolPrototype%': ['Symbol', 'prototype'],
  1022. '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
  1023. '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
  1024. '%TypeErrorPrototype%': ['TypeError', 'prototype'],
  1025. '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
  1026. '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
  1027. '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
  1028. '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
  1029. '%URIErrorPrototype%': ['URIError', 'prototype'],
  1030. '%WeakMapPrototype%': ['WeakMap', 'prototype'],
  1031. '%WeakSetPrototype%': ['WeakSet', 'prototype']
  1032. };
  1033. var bind = require('function-bind');
  1034. var hasOwn = require('has');
  1035. var $concat = bind.call(Function.call, Array.prototype.concat);
  1036. var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
  1037. var $replace = bind.call(Function.call, String.prototype.replace);
  1038. var $strSlice = bind.call(Function.call, String.prototype.slice);
  1039. /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
  1040. var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
  1041. var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
  1042. var stringToPath = function stringToPath(string) {
  1043. var first = $strSlice(string, 0, 1);
  1044. var last = $strSlice(string, -1);
  1045. if (first === '%' && last !== '%') {
  1046. throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
  1047. } else if (last === '%' && first !== '%') {
  1048. throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
  1049. }
  1050. var result = [];
  1051. $replace(string, rePropName, function (match, number, quote, subString) {
  1052. result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
  1053. });
  1054. return result;
  1055. };
  1056. /* end adaptation */
  1057. var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
  1058. var intrinsicName = name;
  1059. var alias;
  1060. if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
  1061. alias = LEGACY_ALIASES[intrinsicName];
  1062. intrinsicName = '%' + alias[0] + '%';
  1063. }
  1064. if (hasOwn(INTRINSICS, intrinsicName)) {
  1065. var value = INTRINSICS[intrinsicName];
  1066. if (value === needsEval) {
  1067. value = doEval(intrinsicName);
  1068. }
  1069. if (typeof value === 'undefined' && !allowMissing) {
  1070. throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
  1071. }
  1072. return {
  1073. alias: alias,
  1074. name: intrinsicName,
  1075. value: value
  1076. };
  1077. }
  1078. throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
  1079. };
  1080. module.exports = function GetIntrinsic(name, allowMissing) {
  1081. if (typeof name !== 'string' || name.length === 0) {
  1082. throw new $TypeError('intrinsic name must be a non-empty string');
  1083. }
  1084. if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
  1085. throw new $TypeError('"allowMissing" argument must be a boolean');
  1086. }
  1087. var parts = stringToPath(name);
  1088. var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
  1089. var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
  1090. var intrinsicRealName = intrinsic.name;
  1091. var value = intrinsic.value;
  1092. var skipFurtherCaching = false;
  1093. var alias = intrinsic.alias;
  1094. if (alias) {
  1095. intrinsicBaseName = alias[0];
  1096. $spliceApply(parts, $concat([0, 1], alias));
  1097. }
  1098. for (var i = 1, isOwn = true; i < parts.length; i += 1) {
  1099. var part = parts[i];
  1100. var first = $strSlice(part, 0, 1);
  1101. var last = $strSlice(part, -1);
  1102. if (
  1103. (
  1104. (first === '"' || first === "'" || first === '`')
  1105. || (last === '"' || last === "'" || last === '`')
  1106. )
  1107. && first !== last
  1108. ) {
  1109. throw new $SyntaxError('property names with quotes must have matching quotes');
  1110. }
  1111. if (part === 'constructor' || !isOwn) {
  1112. skipFurtherCaching = true;
  1113. }
  1114. intrinsicBaseName += '.' + part;
  1115. intrinsicRealName = '%' + intrinsicBaseName + '%';
  1116. if (hasOwn(INTRINSICS, intrinsicRealName)) {
  1117. value = INTRINSICS[intrinsicRealName];
  1118. } else if (value != null) {
  1119. if (!(part in value)) {
  1120. if (!allowMissing) {
  1121. throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
  1122. }
  1123. return void undefined;
  1124. }
  1125. if ($gOPD && (i + 1) >= parts.length) {
  1126. var desc = $gOPD(value, part);
  1127. isOwn = !!desc;
  1128. // By convention, when a data property is converted to an accessor
  1129. // property to emulate a data property that does not suffer from
  1130. // the override mistake, that accessor's getter is marked with
  1131. // an `originalValue` property. Here, when we detect this, we
  1132. // uphold the illusion by pretending to see that original data
  1133. // property, i.e., returning the value rather than the getter
  1134. // itself.
  1135. if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
  1136. value = desc.get;
  1137. } else {
  1138. value = value[part];
  1139. }
  1140. } else {
  1141. isOwn = hasOwn(value, part);
  1142. value = value[part];
  1143. }
  1144. if (isOwn && !skipFurtherCaching) {
  1145. INTRINSICS[intrinsicRealName] = value;
  1146. }
  1147. }
  1148. }
  1149. return value;
  1150. };
  1151. },{"function-bind":10,"has":14,"has-symbols":12}],12:[function(require,module,exports){
  1152. 'use strict';
  1153. var origSymbol = typeof Symbol !== 'undefined' && Symbol;
  1154. var hasSymbolSham = require('./shams');
  1155. module.exports = function hasNativeSymbols() {
  1156. if (typeof origSymbol !== 'function') { return false; }
  1157. if (typeof Symbol !== 'function') { return false; }
  1158. if (typeof origSymbol('foo') !== 'symbol') { return false; }
  1159. if (typeof Symbol('bar') !== 'symbol') { return false; }
  1160. return hasSymbolSham();
  1161. };
  1162. },{"./shams":13}],13:[function(require,module,exports){
  1163. 'use strict';
  1164. /* eslint complexity: [2, 18], max-statements: [2, 33] */
  1165. module.exports = function hasSymbols() {
  1166. if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
  1167. if (typeof Symbol.iterator === 'symbol') { return true; }
  1168. var obj = {};
  1169. var sym = Symbol('test');
  1170. var symObj = Object(sym);
  1171. if (typeof sym === 'string') { return false; }
  1172. if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
  1173. if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
  1174. // temp disabled per https://github.com/ljharb/object.assign/issues/17
  1175. // if (sym instanceof Symbol) { return false; }
  1176. // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
  1177. // if (!(symObj instanceof Symbol)) { return false; }
  1178. // if (typeof Symbol.prototype.toString !== 'function') { return false; }
  1179. // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
  1180. var symVal = 42;
  1181. obj[sym] = symVal;
  1182. for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
  1183. if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
  1184. if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
  1185. var syms = Object.getOwnPropertySymbols(obj);
  1186. if (syms.length !== 1 || syms[0] !== sym) { return false; }
  1187. if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
  1188. if (typeof Object.getOwnPropertyDescriptor === 'function') {
  1189. var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
  1190. if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
  1191. }
  1192. return true;
  1193. };
  1194. },{}],14:[function(require,module,exports){
  1195. 'use strict';
  1196. var bind = require('function-bind');
  1197. module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
  1198. },{"function-bind":10}],15:[function(require,module,exports){
  1199. var hasMap = typeof Map === 'function' && Map.prototype;
  1200. var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
  1201. var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
  1202. var mapForEach = hasMap && Map.prototype.forEach;
  1203. var hasSet = typeof Set === 'function' && Set.prototype;
  1204. var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
  1205. var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
  1206. var setForEach = hasSet && Set.prototype.forEach;
  1207. var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
  1208. var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
  1209. var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
  1210. var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
  1211. var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
  1212. var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
  1213. var booleanValueOf = Boolean.prototype.valueOf;
  1214. var objectToString = Object.prototype.toString;
  1215. var functionToString = Function.prototype.toString;
  1216. var $match = String.prototype.match;
  1217. var $slice = String.prototype.slice;
  1218. var $replace = String.prototype.replace;
  1219. var $toUpperCase = String.prototype.toUpperCase;
  1220. var $toLowerCase = String.prototype.toLowerCase;
  1221. var $test = RegExp.prototype.test;
  1222. var $concat = Array.prototype.concat;
  1223. var $join = Array.prototype.join;
  1224. var $arrSlice = Array.prototype.slice;
  1225. var $floor = Math.floor;
  1226. var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
  1227. var gOPS = Object.getOwnPropertySymbols;
  1228. var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
  1229. var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
  1230. // ie, `has-tostringtag/shams
  1231. var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol')
  1232. ? Symbol.toStringTag
  1233. : null;
  1234. var isEnumerable = Object.prototype.propertyIsEnumerable;
  1235. var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (
  1236. [].__proto__ === Array.prototype // eslint-disable-line no-proto
  1237. ? function (O) {
  1238. return O.__proto__; // eslint-disable-line no-proto
  1239. }
  1240. : null
  1241. );
  1242. function addNumericSeparator(num, str) {
  1243. if (
  1244. num === Infinity
  1245. || num === -Infinity
  1246. || num !== num
  1247. || (num && num > -1000 && num < 1000)
  1248. || $test.call(/e/, str)
  1249. ) {
  1250. return str;
  1251. }
  1252. var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
  1253. if (typeof num === 'number') {
  1254. var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)
  1255. if (int !== num) {
  1256. var intStr = String(int);
  1257. var dec = $slice.call(str, intStr.length + 1);
  1258. return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');
  1259. }
  1260. }
  1261. return $replace.call(str, sepRegex, '$&_');
  1262. }
  1263. var utilInspect = require('./util.inspect');
  1264. var inspectCustom = utilInspect.custom;
  1265. var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
  1266. module.exports = function inspect_(obj, options, depth, seen) {
  1267. var opts = options || {};
  1268. if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
  1269. throw new TypeError('option "quoteStyle" must be "single" or "double"');
  1270. }
  1271. if (
  1272. has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'
  1273. ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity
  1274. : opts.maxStringLength !== null
  1275. )
  1276. ) {
  1277. throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
  1278. }
  1279. var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;
  1280. if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
  1281. throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
  1282. }
  1283. if (
  1284. has(opts, 'indent')
  1285. && opts.indent !== null
  1286. && opts.indent !== '\t'
  1287. && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)
  1288. ) {
  1289. throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
  1290. }
  1291. if (has(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {
  1292. throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
  1293. }
  1294. var numericSeparator = opts.numericSeparator;
  1295. if (typeof obj === 'undefined') {
  1296. return 'undefined';
  1297. }
  1298. if (obj === null) {
  1299. return 'null';
  1300. }
  1301. if (typeof obj === 'boolean') {
  1302. return obj ? 'true' : 'false';
  1303. }
  1304. if (typeof obj === 'string') {
  1305. return inspectString(obj, opts);
  1306. }
  1307. if (typeof obj === 'number') {
  1308. if (obj === 0) {
  1309. return Infinity / obj > 0 ? '0' : '-0';
  1310. }
  1311. var str = String(obj);
  1312. return numericSeparator ? addNumericSeparator(obj, str) : str;
  1313. }
  1314. if (typeof obj === 'bigint') {
  1315. var bigIntStr = String(obj) + 'n';
  1316. return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;
  1317. }
  1318. var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
  1319. if (typeof depth === 'undefined') { depth = 0; }
  1320. if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
  1321. return isArray(obj) ? '[Array]' : '[Object]';
  1322. }
  1323. var indent = getIndent(opts, depth);
  1324. if (typeof seen === 'undefined') {
  1325. seen = [];
  1326. } else if (indexOf(seen, obj) >= 0) {
  1327. return '[Circular]';
  1328. }
  1329. function inspect(value, from, noIndent) {
  1330. if (from) {
  1331. seen = $arrSlice.call(seen);
  1332. seen.push(from);
  1333. }
  1334. if (noIndent) {
  1335. var newOpts = {
  1336. depth: opts.depth
  1337. };
  1338. if (has(opts, 'quoteStyle')) {
  1339. newOpts.quoteStyle = opts.quoteStyle;
  1340. }
  1341. return inspect_(value, newOpts, depth + 1, seen);
  1342. }
  1343. return inspect_(value, opts, depth + 1, seen);
  1344. }
  1345. if (typeof obj === 'function' && !isRegExp(obj)) { // in older engines, regexes are callable
  1346. var name = nameOf(obj);
  1347. var keys = arrObjKeys(obj, inspect);
  1348. return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
  1349. }
  1350. if (isSymbol(obj)) {
  1351. var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
  1352. return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
  1353. }
  1354. if (isElement(obj)) {
  1355. var s = '<' + $toLowerCase.call(String(obj.nodeName));
  1356. var attrs = obj.attributes || [];
  1357. for (var i = 0; i < attrs.length; i++) {
  1358. s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
  1359. }
  1360. s += '>';
  1361. if (obj.childNodes && obj.childNodes.length) { s += '...'; }
  1362. s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';
  1363. return s;
  1364. }
  1365. if (isArray(obj)) {
  1366. if (obj.length === 0) { return '[]'; }
  1367. var xs = arrObjKeys(obj, inspect);
  1368. if (indent && !singleLineValues(xs)) {
  1369. return '[' + indentedJoin(xs, indent) + ']';
  1370. }
  1371. return '[ ' + $join.call(xs, ', ') + ' ]';
  1372. }
  1373. if (isError(obj)) {
  1374. var parts = arrObjKeys(obj, inspect);
  1375. if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) {
  1376. return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
  1377. }
  1378. if (parts.length === 0) { return '[' + String(obj) + ']'; }
  1379. return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
  1380. }
  1381. if (typeof obj === 'object' && customInspect) {
  1382. if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) {
  1383. return utilInspect(obj, { depth: maxDepth - depth });
  1384. } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
  1385. return obj.inspect();
  1386. }
  1387. }
  1388. if (isMap(obj)) {
  1389. var mapParts = [];
  1390. mapForEach.call(obj, function (value, key) {
  1391. mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
  1392. });
  1393. return collectionOf('Map', mapSize.call(obj), mapParts, indent);
  1394. }
  1395. if (isSet(obj)) {
  1396. var setParts = [];
  1397. setForEach.call(obj, function (value) {
  1398. setParts.push(inspect(value, obj));
  1399. });
  1400. return collectionOf('Set', setSize.call(obj), setParts, indent);
  1401. }
  1402. if (isWeakMap(obj)) {
  1403. return weakCollectionOf('WeakMap');
  1404. }
  1405. if (isWeakSet(obj)) {
  1406. return weakCollectionOf('WeakSet');
  1407. }
  1408. if (isWeakRef(obj)) {
  1409. return weakCollectionOf('WeakRef');
  1410. }
  1411. if (isNumber(obj)) {
  1412. return markBoxed(inspect(Number(obj)));
  1413. }
  1414. if (isBigInt(obj)) {
  1415. return markBoxed(inspect(bigIntValueOf.call(obj)));
  1416. }
  1417. if (isBoolean(obj)) {
  1418. return markBoxed(booleanValueOf.call(obj));
  1419. }
  1420. if (isString(obj)) {
  1421. return markBoxed(inspect(String(obj)));
  1422. }
  1423. if (!isDate(obj) && !isRegExp(obj)) {
  1424. var ys = arrObjKeys(obj, inspect);
  1425. var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
  1426. var protoTag = obj instanceof Object ? '' : 'null prototype';
  1427. var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';
  1428. var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
  1429. var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');
  1430. if (ys.length === 0) { return tag + '{}'; }
  1431. if (indent) {
  1432. return tag + '{' + indentedJoin(ys, indent) + '}';
  1433. }
  1434. return tag + '{ ' + $join.call(ys, ', ') + ' }';
  1435. }
  1436. return String(obj);
  1437. };
  1438. function wrapQuotes(s, defaultStyle, opts) {
  1439. var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
  1440. return quoteChar + s + quoteChar;
  1441. }
  1442. function quote(s) {
  1443. return $replace.call(String(s), /"/g, '&quot;');
  1444. }
  1445. function isArray(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
  1446. function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
  1447. function isRegExp(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
  1448. function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
  1449. function isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
  1450. function isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
  1451. function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
  1452. // Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
  1453. function isSymbol(obj) {
  1454. if (hasShammedSymbols) {
  1455. return obj && typeof obj === 'object' && obj instanceof Symbol;
  1456. }
  1457. if (typeof obj === 'symbol') {
  1458. return true;
  1459. }
  1460. if (!obj || typeof obj !== 'object' || !symToString) {
  1461. return false;
  1462. }
  1463. try {
  1464. symToString.call(obj);
  1465. return true;
  1466. } catch (e) {}
  1467. return false;
  1468. }
  1469. function isBigInt(obj) {
  1470. if (!obj || typeof obj !== 'object' || !bigIntValueOf) {
  1471. return false;
  1472. }
  1473. try {
  1474. bigIntValueOf.call(obj);
  1475. return true;
  1476. } catch (e) {}
  1477. return false;
  1478. }
  1479. var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
  1480. function has(obj, key) {
  1481. return hasOwn.call(obj, key);
  1482. }
  1483. function toStr(obj) {
  1484. return objectToString.call(obj);
  1485. }
  1486. function nameOf(f) {
  1487. if (f.name) { return f.name; }
  1488. var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/);
  1489. if (m) { return m[1]; }
  1490. return null;
  1491. }
  1492. function indexOf(xs, x) {
  1493. if (xs.indexOf) { return xs.indexOf(x); }
  1494. for (var i = 0, l = xs.length; i < l; i++) {
  1495. if (xs[i] === x) { return i; }
  1496. }
  1497. return -1;
  1498. }
  1499. function isMap(x) {
  1500. if (!mapSize || !x || typeof x !== 'object') {
  1501. return false;
  1502. }
  1503. try {
  1504. mapSize.call(x);
  1505. try {
  1506. setSize.call(x);
  1507. } catch (s) {
  1508. return true;
  1509. }
  1510. return x instanceof Map; // core-js workaround, pre-v2.5.0
  1511. } catch (e) {}
  1512. return false;
  1513. }
  1514. function isWeakMap(x) {
  1515. if (!weakMapHas || !x || typeof x !== 'object') {
  1516. return false;
  1517. }
  1518. try {
  1519. weakMapHas.call(x, weakMapHas);
  1520. try {
  1521. weakSetHas.call(x, weakSetHas);
  1522. } catch (s) {
  1523. return true;
  1524. }
  1525. return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
  1526. } catch (e) {}
  1527. return false;
  1528. }
  1529. function isWeakRef(x) {
  1530. if (!weakRefDeref || !x || typeof x !== 'object') {
  1531. return false;
  1532. }
  1533. try {
  1534. weakRefDeref.call(x);
  1535. return true;
  1536. } catch (e) {}
  1537. return false;
  1538. }
  1539. function isSet(x) {
  1540. if (!setSize || !x || typeof x !== 'object') {
  1541. return false;
  1542. }
  1543. try {
  1544. setSize.call(x);
  1545. try {
  1546. mapSize.call(x);
  1547. } catch (m) {
  1548. return true;
  1549. }
  1550. return x instanceof Set; // core-js workaround, pre-v2.5.0
  1551. } catch (e) {}
  1552. return false;
  1553. }
  1554. function isWeakSet(x) {
  1555. if (!weakSetHas || !x || typeof x !== 'object') {
  1556. return false;
  1557. }
  1558. try {
  1559. weakSetHas.call(x, weakSetHas);
  1560. try {
  1561. weakMapHas.call(x, weakMapHas);
  1562. } catch (s) {
  1563. return true;
  1564. }
  1565. return x instanceof WeakSet; // core-js workaround, pre-v2.5.0
  1566. } catch (e) {}
  1567. return false;
  1568. }
  1569. function isElement(x) {
  1570. if (!x || typeof x !== 'object') { return false; }
  1571. if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
  1572. return true;
  1573. }
  1574. return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
  1575. }
  1576. function inspectString(str, opts) {
  1577. if (str.length > opts.maxStringLength) {
  1578. var remaining = str.length - opts.maxStringLength;
  1579. var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
  1580. return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
  1581. }
  1582. // eslint-disable-next-line no-control-regex
  1583. var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte);
  1584. return wrapQuotes(s, 'single', opts);
  1585. }
  1586. function lowbyte(c) {
  1587. var n = c.charCodeAt(0);
  1588. var x = {
  1589. 8: 'b',
  1590. 9: 't',
  1591. 10: 'n',
  1592. 12: 'f',
  1593. 13: 'r'
  1594. }[n];
  1595. if (x) { return '\\' + x; }
  1596. return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));
  1597. }
  1598. function markBoxed(str) {
  1599. return 'Object(' + str + ')';
  1600. }
  1601. function weakCollectionOf(type) {
  1602. return type + ' { ? }';
  1603. }
  1604. function collectionOf(type, size, entries, indent) {
  1605. var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');
  1606. return type + ' (' + size + ') {' + joinedEntries + '}';
  1607. }
  1608. function singleLineValues(xs) {
  1609. for (var i = 0; i < xs.length; i++) {
  1610. if (indexOf(xs[i], '\n') >= 0) {
  1611. return false;
  1612. }
  1613. }
  1614. return true;
  1615. }
  1616. function getIndent(opts, depth) {
  1617. var baseIndent;
  1618. if (opts.indent === '\t') {
  1619. baseIndent = '\t';
  1620. } else if (typeof opts.indent === 'number' && opts.indent > 0) {
  1621. baseIndent = $join.call(Array(opts.indent + 1), ' ');
  1622. } else {
  1623. return null;
  1624. }
  1625. return {
  1626. base: baseIndent,
  1627. prev: $join.call(Array(depth + 1), baseIndent)
  1628. };
  1629. }
  1630. function indentedJoin(xs, indent) {
  1631. if (xs.length === 0) { return ''; }
  1632. var lineJoiner = '\n' + indent.prev + indent.base;
  1633. return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev;
  1634. }
  1635. function arrObjKeys(obj, inspect) {
  1636. var isArr = isArray(obj);
  1637. var xs = [];
  1638. if (isArr) {
  1639. xs.length = obj.length;
  1640. for (var i = 0; i < obj.length; i++) {
  1641. xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
  1642. }
  1643. }
  1644. var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
  1645. var symMap;
  1646. if (hasShammedSymbols) {
  1647. symMap = {};
  1648. for (var k = 0; k < syms.length; k++) {
  1649. symMap['$' + syms[k]] = syms[k];
  1650. }
  1651. }
  1652. for (var key in obj) { // eslint-disable-line no-restricted-syntax
  1653. if (!has(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
  1654. if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
  1655. if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
  1656. // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
  1657. continue; // eslint-disable-line no-restricted-syntax, no-continue
  1658. } else if ($test.call(/[^\w$]/, key)) {
  1659. xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
  1660. } else {
  1661. xs.push(key + ': ' + inspect(obj[key], obj));
  1662. }
  1663. }
  1664. if (typeof gOPS === 'function') {
  1665. for (var j = 0; j < syms.length; j++) {
  1666. if (isEnumerable.call(obj, syms[j])) {
  1667. xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
  1668. }
  1669. }
  1670. }
  1671. return xs;
  1672. }
  1673. },{"./util.inspect":6}],16:[function(require,module,exports){
  1674. 'use strict';
  1675. var GetIntrinsic = require('get-intrinsic');
  1676. var callBound = require('call-bind/callBound');
  1677. var inspect = require('object-inspect');
  1678. var $TypeError = GetIntrinsic('%TypeError%');
  1679. var $WeakMap = GetIntrinsic('%WeakMap%', true);
  1680. var $Map = GetIntrinsic('%Map%', true);
  1681. var $weakMapGet = callBound('WeakMap.prototype.get', true);
  1682. var $weakMapSet = callBound('WeakMap.prototype.set', true);
  1683. var $weakMapHas = callBound('WeakMap.prototype.has', true);
  1684. var $mapGet = callBound('Map.prototype.get', true);
  1685. var $mapSet = callBound('Map.prototype.set', true);
  1686. var $mapHas = callBound('Map.prototype.has', true);
  1687. /*
  1688. * This function traverses the list returning the node corresponding to the
  1689. * given key.
  1690. *
  1691. * That node is also moved to the head of the list, so that if it's accessed
  1692. * again we don't need to traverse the whole list. By doing so, all the recently
  1693. * used nodes can be accessed relatively quickly.
  1694. */
  1695. var listGetNode = function (list, key) { // eslint-disable-line consistent-return
  1696. for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {
  1697. if (curr.key === key) {
  1698. prev.next = curr.next;
  1699. curr.next = list.next;
  1700. list.next = curr; // eslint-disable-line no-param-reassign
  1701. return curr;
  1702. }
  1703. }
  1704. };
  1705. var listGet = function (objects, key) {
  1706. var node = listGetNode(objects, key);
  1707. return node && node.value;
  1708. };
  1709. var listSet = function (objects, key, value) {
  1710. var node = listGetNode(objects, key);
  1711. if (node) {
  1712. node.value = value;
  1713. } else {
  1714. // Prepend the new node to the beginning of the list
  1715. objects.next = { // eslint-disable-line no-param-reassign
  1716. key: key,
  1717. next: objects.next,
  1718. value: value
  1719. };
  1720. }
  1721. };
  1722. var listHas = function (objects, key) {
  1723. return !!listGetNode(objects, key);
  1724. };
  1725. module.exports = function getSideChannel() {
  1726. var $wm;
  1727. var $m;
  1728. var $o;
  1729. var channel = {
  1730. assert: function (key) {
  1731. if (!channel.has(key)) {
  1732. throw new $TypeError('Side channel does not contain ' + inspect(key));
  1733. }
  1734. },
  1735. get: function (key) { // eslint-disable-line consistent-return
  1736. if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
  1737. if ($wm) {
  1738. return $weakMapGet($wm, key);
  1739. }
  1740. } else if ($Map) {
  1741. if ($m) {
  1742. return $mapGet($m, key);
  1743. }
  1744. } else {
  1745. if ($o) { // eslint-disable-line no-lonely-if
  1746. return listGet($o, key);
  1747. }
  1748. }
  1749. },
  1750. has: function (key) {
  1751. if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
  1752. if ($wm) {
  1753. return $weakMapHas($wm, key);
  1754. }
  1755. } else if ($Map) {
  1756. if ($m) {
  1757. return $mapHas($m, key);
  1758. }
  1759. } else {
  1760. if ($o) { // eslint-disable-line no-lonely-if
  1761. return listHas($o, key);
  1762. }
  1763. }
  1764. return false;
  1765. },
  1766. set: function (key, value) {
  1767. if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
  1768. if (!$wm) {
  1769. $wm = new $WeakMap();
  1770. }
  1771. $weakMapSet($wm, key, value);
  1772. } else if ($Map) {
  1773. if (!$m) {
  1774. $m = new $Map();
  1775. }
  1776. $mapSet($m, key, value);
  1777. } else {
  1778. if (!$o) {
  1779. /*
  1780. * Initialize the linked list as an empty node, so that we don't have
  1781. * to special-case handling of the first node: we can always refer to
  1782. * it as (previous node).next, instead of something like (list).head
  1783. */
  1784. $o = { key: {}, next: null };
  1785. }
  1786. listSet($o, key, value);
  1787. }
  1788. }
  1789. };
  1790. return channel;
  1791. };
  1792. },{"call-bind/callBound":7,"get-intrinsic":11,"object-inspect":15}]},{},[2])(2)
  1793. });