PageSourceSearch

https://pcgonline.org/wp-content/plugins/the-events-calendar/commo…/js/utils/query-string.js?ver=4.14.6

js pcgonline.org collected 2026-09-24 10:14:17 UTC 23,201 bytes, 737 lines download raw bytes

vendor: 1,244 bytes, lines 1-18
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
4var replace = String.prototype.replace;
5var percentTwenties = /%20/g;
6
7module.exports = {
8    'default': 'RFC3986',
9    formatters: {
10        RFC1738: function (value) {
11            return replace.call(value, percentTwenties, '+');
12        },
13        RFC3986: function (value) {
14            return value;
15        }
16    },
17    RFC1738: 'RFC1738',
18    RFC3986: 'RFC3986'
vendor: 11,256 bytes, lines 19-369
19};
20
21},{}],2:[function(require,module,exports){
22'use strict';
23
24var stringify = require('./stringify');
25var parse = require('./parse');
26var formats = require('./formats');
27
28module.exports = {
29    formats: formats,
30    parse: parse,
31    stringify: stringify
32};
33
34},{"./formats":1,"./parse":3,"./stringify":4}],3:[function(require,module,exports){
35'use strict';
36
37var utils = require('./utils');
38
39var has = Object.prototype.hasOwnProperty;
40
41var defaults = {
42    allowDots: false,
43    allowPrototypes: false,
44    arrayLimit: 20,
45    charset: 'utf-8',
46    charsetSentinel: false,
47    decoder: utils.decode,
48    delimiter: '&',
49    depth: 5,
50    ignoreQueryPrefix: false,
51    interpretNumericEntities: false,
52    parameterLimit: 1000,
53    parseArrays: true,
54    plainObjects: false,
55    strictNullHandling: false
56};
57
58var interpretNumericEntities = function (str) {
59    return str.replace(/&#(\d+);/g, function ($0, numberStr) {
60        return String.fromCharCode(parseInt(numberStr, 10));
61    });
62};
63
64// This is what browsers will submit when the ✓ character occurs in an
65// application/x-www-form-urlencoded body and the encoding of the page containing
66// the form is iso-8859-1, or when the submitted form has an accept-charset
67// attribute of iso-8859-1. Presumably also with other charsets that do not contain
68// the ✓ character, such as us-ascii.
69var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('&#10003;')
70
71// These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
72var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
73
74var 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
82    var charset = options.charset;
83    if (options.charsetSentinel) {
84        for (i = 0; i < parts.length; ++i) {
85            if (parts[i].indexOf('utf8=') === 0) {
86                if (parts[i] === charsetSentinel) {
87                    charset = 'utf-8';
88                } else if (parts[i] === isoSentinel) {
89                    charset = 'iso-8859-1';
90                }
91                skipIndex = i;
92                i = parts.length; // The eslint settings do not allow break;
93            }
94        }
95    }
96
97    for (i = 0; i < parts.length; ++i) {
98        if (i === skipIndex) {
99            continue;
100        }
101        var part = parts[i];
102
103        var bracketEqualsPos = part.indexOf(']=');
104        var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
105
106        var key, val;
107        if (pos === -1) {
108            key = options.decoder(part, defaults.decoder, charset);
109            val = options.strictNullHandling ? null : '';
110        } else {
111            key = options.decoder(part.slice(0, pos), defaults.decoder, charset);
112            val = options.decoder(part.slice(pos + 1), defaults.decoder, charset);
113        }
114
115        if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
116            val = interpretNumericEntities(val);
117        }
118        if (has.call(obj, key)) {
119            obj[key] = utils.combine(obj[key], val);
120        } else {
121            obj[key] = val;
122        }
123    }
124
125    return obj;
126};
127
128var parseObject = function (chain, val, options) {
129    var leaf = val;
130
131    for (var i = chain.length - 1; i >= 0; --i) {
132        var obj;
133        var root = chain[i];
134
135        if (root === '[]' && options.parseArrays) {
136            obj = [].concat(leaf);
137        } else {
138            obj = options.plainObjects ? Object.create(null) : {};
139            var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
140            var index = parseInt(cleanRoot, 10);
141            if (!options.parseArrays && cleanRoot === '') {
142                obj = { 0: leaf };
143            } else if (
144                !isNaN(index)
145                && root !== cleanRoot
146                && String(index) === cleanRoot
147                && index >= 0
148                && (options.parseArrays && index <= options.arrayLimit)
149            ) {
150                obj = [];
151                obj[index] = leaf;
152            } else {
153                obj[cleanRoot] = leaf;
154            }
155        }
156
157        leaf = obj;
158    }
159
160    return leaf;
161};
162
163var parseKeys = function parseQueryStringKeys(givenKey, val, options) {
164    if (!givenKey) {
165        return;
166    }
167
168    // Transform dot notation to bracket notation
169    var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
170
171    // The regex chunks
172
173    var brackets = /(\[[^[\]]*])/;
174    var child = /(\[[^[\]]*])/g;
175
176    // Get the parent
177
178    var segment = brackets.exec(key);
179    var parent = segment ? key.slice(0, segment.index) : key;
180
181    // Stash the parent if it exists
182
183    var keys = [];
184    if (parent) {
185        // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
186        if (!options.plainObjects && has.call(Object.prototype, parent)) {
187            if (!options.allowPrototypes) {
188                return;
189            }
190        }
191
192        keys.push(parent);
193    }
194
195    // Loop through children appending to the array until we hit depth
196
197    var i = 0;
198    while ((segment = child.exec(key)) !== null && i < options.depth) {
199        i += 1;
200        if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
201            if (!options.allowPrototypes) {
202                return;
203            }
204        }
205        keys.push(segment[1]);
206    }
207
208    // If there's a remainder, just add whatever is left
209
210    if (segment) {
211        keys.push('[' + key.slice(segment.index) + ']');
212    }
213
214    return parseObject(keys, val, options);
215};
216
217module.exports = function (str, opts) {
218    var options = opts ? utils.assign({}, opts) : {};
219
220    if (options.decoder !== null && options.decoder !== undefined && typeof options.decoder !== 'function') {
221        throw new TypeError('Decoder has to be a function.');
222    }
223
224    options.ignoreQueryPrefix = options.ignoreQueryPrefix === true;
225    options.delimiter = typeof options.delimiter === 'string' || utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter;
226    options.depth = typeof options.depth === 'number' ? options.depth : defaults.depth;
227    options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : defaults.arrayLimit;
228    options.parseArrays = options.parseArrays !== false;
229    options.decoder = typeof options.decoder === 'function' ? options.decoder : defaults.decoder;
230    options.allowDots = typeof options.allowDots === 'undefined' ? defaults.allowDots : !!options.allowDots;
231    options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : defaults.plainObjects;
232    options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : defaults.allowPrototypes;
233    options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : defaults.parameterLimit;
234    options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;
235
236    if (typeof options.charset !== 'undefined' && options.charset !== 'utf-8' && options.charset !== 'iso-8859-1') {
237        throw new Error('The charset option must be either utf-8, iso-8859-1, or undefined');
238    }
239    if (typeof options.charset === 'undefined') {
240        options.charset = defaults.charset;
241    }
242
243    if (str === '' || str === null || typeof str === 'undefined') {
244        return options.plainObjects ? Object.create(null) : {};
245    }
246
247    var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
248    var obj = options.plainObjects ? Object.create(null) : {};
249
250    // Iterate over the keys and setup the new object
251
252    var keys = Object.keys(tempObj);
253    for (var i = 0; i < keys.length; ++i) {
254        var key = keys[i];
255        var newObj = parseKeys(key, tempObj[key], options);
256        obj = utils.merge(obj, newObj, options);
257    }
258
259    return utils.compact(obj);
260};
261
262},{"./utils":5}],4:[function(require,module,exports){
263'use strict';
264
265var utils = require('./utils');
266var formats = require('./formats');
267
268var arrayPrefixGenerators = {
269    brackets: function brackets(prefix) { // eslint-disable-line func-name-matching
270        return prefix + '[]';
271    },
272    indices: function indices(prefix, key) { // eslint-disable-line func-name-matching
273        return prefix + '[' + key + ']';
274    },
275    repeat: function repeat(prefix) { // eslint-disable-line func-name-matching
276        return prefix;
277    }
278};
279
280var isArray = Array.isArray;
281var push = Array.prototype.push;
282var pushToArray = function (arr, valueOrArray) {
283    push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
284};
285
286var toISO = Date.prototype.toISOString;
287
288var defaults = {
289    addQueryPrefix: false,
290    allowDots: false,
291    charset: 'utf-8',
292    charsetSentinel: false,
293    delimiter: '&',
294    encode: true,
295    encoder: utils.encode,
296    encodeValuesOnly: false,
297    // deprecated
298    indices: false,
299    serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching
300        return toISO.call(date);
301    },
302    skipNulls: false,
303    strictNullHandling: false
304};
305
306var stringify = function stringify( // eslint-disable-line func-name-matching
307    object,
308    prefix,
309    generateArrayPrefix,
310    strictNullHandling,
311    skipNulls,
312    encoder,
313    filter,
314    sort,
315    allowDots,
316    serializeDate,
317    formatter,
318    encodeValuesOnly,
319    charset
320) {
321    var obj = object;
322    if (typeof filter === 'function') {
323        obj = filter(prefix, obj);
324    } else if (obj instanceof Date) {
325        obj = serializeDate(obj);
326    }
327
328    if (obj === null) {
329        if (strictNullHandling) {
330            return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset) : prefix;
331        }
332
333        obj = '';
334    }
335
336    if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) {
337        if (encoder) {
338            var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset);
339            return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset))];
340        }
341        return [formatter(prefix) + '=' + formatter(String(obj))];
342    }
343
344    var values = [];
345
346    if (typeof obj === 'undefined') {
347        return values;
348    }
349
350    var objKeys;
351    if (Array.isArray(filter)) {
352        objKeys = filter;
353    } else {
354        var keys = Object.keys(obj);
355        objKeys = sort ? keys.sort(sort) : keys;
356    }
357
358    for (var i = 0; i < objKeys.length; ++i) {
359        var key = objKeys[i];
360
361        if (skipNulls && obj[key] === null) {
362            continue;
363        }
364
365        if (Array.isArray(obj)) {
366            pushToArray(values, stringify(
367                obj[key],
368                generateArrayPrefix(prefix, key),
369                generateArrayPrefix,
370                strictNullHandling,
371                skipNulls,
372                encoder,
373                filter,
374                sort,
375                allowDots,
376                serializeDate,
377                formatter,
378                encodeValuesOnly,
379                charset
380            ));
381        } else {
382            pushToArray(values, stringify(
383                obj[key],
384                prefix + (allowDots ? '.' + key : '[' + key + ']'),
385                generateArrayPrefix,
386                strictNullHandling,
387                skipNulls,
388                encoder,
389                filter,
390                sort,
391                allowDots,
392                serializeDate,
393                formatter,
394                encodeValuesOnly,
395                charset
396            ));
397        }
398    }
399
400    return values;
401};
402
403module.exports = function (object, opts) {
404    var obj = object;
405    var options = opts ? utils.assign({}, opts) : {};
406
407    if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') {
408        throw new TypeError('Encoder has to be a function.');
409    }
410
411    var delimiter = typeof options.delimiter === 'undefined' ? defaults.delimiter : options.delimiter;
412    var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;
413    var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : defaults.skipNulls;
414    var encode = typeof options.encode === 'boolean' ? options.encode : defaults.encode;
415    var encoder = typeof options.encoder === 'function' ? options.encoder : defaults.encoder;
416    var sort = typeof options.sort === 'function' ? options.sort : null;
417    var allowDots = typeof options.allowDots === 'undefined' ? defaults.allowDots : !!options.allowDots;
418    var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults.serializeDate;
419    var encodeValuesOnly = typeof options.encodeValuesOnly === 'boolean' ? options.encodeValuesOnly : defaults.encodeValuesOnly;
420    var charset = options.charset || defaults.charset;
421    if (typeof options.charset !== 'undefined' && options.charset !== 'utf-8' && options.charset !== 'iso-8859-1') {
422        throw new Error('The charset option must be either utf-8, iso-8859-1, or undefined');
423    }
424
425    if (typeof options.format === 'undefined') {
426        options.format = formats['default'];
427    } else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) {
428        throw new TypeError('Unknown format option provided.');
429    }
430    var formatter = formats.formatters[options.format];
431    var objKeys;
432    var filter;
433
434    if (typeof options.filter === 'function') {
435        filter = options.filter;
436        obj = filter('', obj);
437    } else if (Array.isArray(options.filter)) {
438        filter = options.filter;
439        objKeys = filter;
440    }
441
442    var keys = [];
443
444    if (typeof obj !== 'object' || obj === null) {
445        return '';
446    }
447
448    var arrayFormat;
449    if (options.arrayFormat in arrayPrefixGenerators) {
450        arrayFormat = options.arrayFormat;
451    } else if ('indices' in options) {
452        arrayFormat = options.indices ? 'indices' : 'repeat';
453    } else {
454        arrayFormat = 'indices';
455    }
456
457    var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
458
459    if (!objKeys) {
460        objKeys = Object.keys(obj);
461    }
462
463    if (sort) {
464        objKeys.sort(sort);
465    }
466
467    for (var i = 0; i < objKeys.length; ++i) {
468        var key = objKeys[i];
469
470        if (skipNulls && obj[key] === null) {
471            continue;
472        }
473        pushToArray(keys, stringify(
474            obj[key],
475            key,
476            generateArrayPrefix,
477            strictNullHandling,
478            skipNulls,
479            encode ? encoder : null,
480            filter,
481            sort,
482            allowDots,
483            serializeDate,
484            formatter,
485            encodeValuesOnly,
486            charset
487        ));
488    }
489
490    var joined = keys.join(delimiter);
491    var prefix = options.addQueryPrefix === true ? '?' : '';
492
493    if (options.charsetSentinel) {
494        if (charset === 'iso-8859-1') {
495            // encodeURIComponent('&#10003;'), the "numeric entity" representation of a checkmark
496            prefix += 'utf8=%26%2310003%3B&';
497        } else {
498            // encodeURIComponent('✓')
499            prefix += 'utf8=%E2%9C%93&';
500        }
501    }
502
503    return joined.length >
503 0 ? prefix + joined : '';
504};
505
506},{"./formats":1,"./utils":5}],5:[function(require,module,exports){
507'use strict';
508
509var has = Object.prototype.hasOwnProperty;
510
511var hexTable = (function () {
512    var array = [];
513    for (var i = 0; i < 256; ++i) {
514        array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
515    }
516
517    return array;
518}());
519
520var compactQueue = function compactQueue(queue) {
521    while (queue.length > 1) {
522        var item = queue.pop();
523        var obj = item.obj[item.prop];
524
525        if (Array.isArray(obj)) {
526            var compacted = [];
527
528            for (var j = 0; j < obj.length; ++j) {
529                if (typeof obj[j] !== 'undefined') {
530                    compacted.push(obj[j]);
531                }
532            }
533
534            item.obj[item.prop] = compacted;
535        }
536    }
537};
538
539var arrayToObject = function arrayToObject(source, options) {
540    var obj = options && options.plainObjects ? Object.create(null) : {};
541    for (var i = 0; i < source.length; ++i) {
542        if (typeof source[i] !== 'undefined') {
543            obj[i] = source[i];
544        }
545    }
546
547    return obj;
548};
549
550var merge = function merge(target, source, options) {
551    if (!source) {
552        return target;
553    }
554
555    if (typeof source !== 'object') {
556        if (Array.isArray(target)) {
557            target.push(source);
558        } else if (typeof target === 'object') {
559            if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) {
560                target[source] = true;
561            }
562        } else {
563            return [target, source];
564        }
565
566        return target;
567    }
568
569    if (typeof target !== 'object') {
570        return [target].concat(source);
571    }
572
573    var mergeTarget = target;
574    if (Array.isArray(target) && !Array.isArray(source)) {
575        mergeTarget = arrayToObject(target, options);
576    }
577
578    if (Array.isArray(target) && Array.isArray(source)) {
579        source.forEach(function (item, i) {
580            if (has.call(target, i)) {
581                if (target[i] && typeof target[i] === 'object') {
582                    target[i] = merge(target[i], item, options);
583                } else {
584                    target.push(item);
585                }
586            } else {
587                target[i] = item;
588            }
589        });
590        return target;
591    }
592
593    return Object.keys(source).reduce(function (acc, key) {
594        var value = source[key];
595
596        if (has.call(acc, key)) {
597            acc[key] = merge(acc[key], value, options);
598        } else {
599            acc[key] = value;
600        }
601        return acc;
602    }, mergeTarget);
603};
604
605var assign = function assignSingleSource(target, source) {
606    return Object.keys(source).reduce(function (acc, key) {
607        acc[key] = source[key];
608        return acc;
609    }, target);
610};
611
612var decode = function (str, decoder, charset) {
613    var strWithoutPlus = str.replace(/\+/g, ' ');
614    if (charset === 'iso-8859-1') {
615        // unescape never throws, no try...catch needed:
616        return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
617    }
618    // utf-8
619    try {
620        return decodeURIComponent(strWithoutPlus);
621    } catch (e) {
622        return strWithoutPlus;
623    }
624};
625
626var encode = function encode(str, defaultEncoder, charset) {
627    // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
628    // It has been adapted here for stricter adherence to RFC 3986
629    if (str.length === 0) {
630        return str;
631    }
632
633    var string = typeof str === 'string' ? str : String(str);
634
635    if (charset === 'iso-8859-1') {
636        return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
637            return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
638        });
639    }
640
641    var out = '';
642    for (var i = 0; i < string.length; ++i) {
643        var c = string.charCodeAt(i);
644
645        if (
646            c === 0x2D // -
647            || c === 0x2E // .
648            || c === 0x5F // _
649            || c === 0x7E // ~
650            || (c >= 0x30 && c <= 0x39) // 0-9
651            || (c >= 0x41 && c <= 0x5A) // a-z
652            || (c >= 0x61 && c <= 0x7A) // A-Z
653        ) {
654            out += string.charAt(i);
655            continue;
656        }
657
658        if (c < 0x80) {
659            out = out + hexTable[c];
660            continue;
661        }
662
663        if (c < 0x800) {
664            out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
665            continue;
666        }
667
668        if (c < 0xD800 || c >= 0xE000) {
669            out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
670            continue;
671        }
672
673        i += 1;
674        c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
675        out += hexTable[0xF0 | (c >> 18)]
676            + hexTable[0x80 | ((c >> 12) & 0x3F)]
677            + hexTable[0x80 | ((c >> 6) & 0x3F)]
678            + hexTable[0x80 | (c & 0x3F)];
679    }
680
681    return out;
682};
683
684var compact = function compact(value) {
685    var queue = [{ obj: { o: value }, prop: 'o' }];
686    var refs = [];
687
688    for (var i = 0; i < queue.length; ++i) {
689        var item = queue[i];
690        var obj = item.obj[item.prop];
691
692        var keys = Object.keys(obj);
693        for (var j = 0; j < keys.length; ++j) {
694            var key = keys[j];
695            var val = obj[key];
696            if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
697                queue.push({ obj: obj, prop: key });
698                refs.push(val);
699            }
700        }
701    }
702
703    compactQueue(queue);
704
705    return value;
706};
707
708var isRegExp = function isRegExp(obj) {
709    return Object.prototype.toString.call(obj) === '[object RegExp]';
710};
711
712var isBuffer = function isBuffer(obj) {
713    if (obj === null || typeof obj === 'undefined') {
714        return false;
715    }
716
717    return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
718};
719
720var combine = function combine(a, b) {
721    return [].concat(a, b);
722};
723
724module.exports = {
725    arrayToObject: arrayToObject,
726    assign: assign,
727    combine: combine,
728    compact: compact,
729    decode: decode,
730    encode: encode,
731    isBuffer: isBuffer,
732    isRegExp: isRegExp,
733    merge: merge
734};
735
736},{}]},{},[2])(2)
737});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.