@mtes-mct/monitor-ui 10.5.0 → 10.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/index.js +2850 -156
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/src/icons/Car.d.ts +2 -0
- package/src/icons/index.d.ts +2 -1
- package/src/index.d.ts +1 -0
- package/src/libs/CustomSearch/cache.d.ts +4 -0
- package/src/libs/CustomSearch/index.d.ts +15 -0
- package/src/libs/CustomSearch/types.d.ts +55 -0
- package/src/types.d.ts +2 -0
- package/src/utils/cleanCollectionDiacritics.d.ts +27 -0
- package/src/utils/getHashFromCollection.d.ts +8 -0
- package/src/libs/CustomSearch.d.ts +0 -82
package/index.js
CHANGED
|
@@ -12,6 +12,34 @@ function getDefaultExportFromCjs (x) {
|
|
|
12
12
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
function getAugmentedNamespace(n) {
|
|
16
|
+
if (n.__esModule) return n;
|
|
17
|
+
var f = n.default;
|
|
18
|
+
if (typeof f == "function") {
|
|
19
|
+
var a = function a () {
|
|
20
|
+
if (this instanceof a) {
|
|
21
|
+
var args = [null];
|
|
22
|
+
args.push.apply(args, arguments);
|
|
23
|
+
var Ctor = Function.bind.apply(f, args);
|
|
24
|
+
return new Ctor();
|
|
25
|
+
}
|
|
26
|
+
return f.apply(this, arguments);
|
|
27
|
+
};
|
|
28
|
+
a.prototype = f.prototype;
|
|
29
|
+
} else a = {};
|
|
30
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
31
|
+
Object.keys(n).forEach(function (k) {
|
|
32
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
33
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () {
|
|
36
|
+
return n[k];
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
return a;
|
|
41
|
+
}
|
|
42
|
+
|
|
15
43
|
var isSameOrAfter$1 = {exports: {}};
|
|
16
44
|
|
|
17
45
|
(function (module, exports) {
|
|
@@ -718,13 +746,13 @@ function _objectIs(a, b) {
|
|
|
718
746
|
|
|
719
747
|
var _objectIs$1 = typeof Object.is === 'function' ? Object.is : _objectIs;
|
|
720
748
|
|
|
721
|
-
var toString$
|
|
749
|
+
var toString$3 = Object.prototype.toString;
|
|
722
750
|
|
|
723
751
|
var _isArguments =
|
|
724
752
|
/*#__PURE__*/
|
|
725
753
|
function () {
|
|
726
|
-
return toString$
|
|
727
|
-
return toString$
|
|
754
|
+
return toString$3.call(arguments) === '[object Arguments]' ? function _isArguments(x) {
|
|
755
|
+
return toString$3.call(x) === '[object Arguments]';
|
|
728
756
|
} : function _isArguments(x) {
|
|
729
757
|
return _has('callee', x);
|
|
730
758
|
};
|
|
@@ -1913,7 +1941,7 @@ function _isTypedArray(val) {
|
|
|
1913
1941
|
* R.empty(Uint8Array.from('123')); //=> Uint8Array []
|
|
1914
1942
|
*/
|
|
1915
1943
|
|
|
1916
|
-
var empty =
|
|
1944
|
+
var empty$2 =
|
|
1917
1945
|
/*#__PURE__*/
|
|
1918
1946
|
_curry1(function empty(x) {
|
|
1919
1947
|
return x != null && typeof x['fantasy-land/empty'] === 'function' ? x['fantasy-land/empty']() : x != null && x.constructor != null && typeof x.constructor['fantasy-land/empty'] === 'function' ? x.constructor['fantasy-land/empty']() : x != null && typeof x.empty === 'function' ? x.empty() : x != null && x.constructor != null && typeof x.constructor.empty === 'function' ? x.constructor.empty() : _isArray(x) ? [] : _isString(x) ? '' : _isObject(x) ? {} : _isArguments(x) ? function () {
|
|
@@ -2010,7 +2038,7 @@ var includes$1 = includes;
|
|
|
2010
2038
|
var isEmpty =
|
|
2011
2039
|
/*#__PURE__*/
|
|
2012
2040
|
_curry1(function isEmpty(x) {
|
|
2013
|
-
return x != null && equals$2(x, empty(x));
|
|
2041
|
+
return x != null && equals$2(x, empty$2(x));
|
|
2014
2042
|
});
|
|
2015
2043
|
|
|
2016
2044
|
var isEmpty$1 = isEmpty;
|
|
@@ -2345,7 +2373,7 @@ const Dialog = Object.assign(RawDialog, {
|
|
|
2345
2373
|
Title: Title$1
|
|
2346
2374
|
});
|
|
2347
2375
|
|
|
2348
|
-
function Item({ accent, Icon, ...originalProps }) {
|
|
2376
|
+
function Item$1({ accent, Icon, ...originalProps }) {
|
|
2349
2377
|
const icon = useMemo(() => (Icon ? jsx(Icon, { size: 20 }) : undefined), [Icon]);
|
|
2350
2378
|
const hasIcon = useMemo(() => Boolean(Icon), [Icon]);
|
|
2351
2379
|
switch (accent) {
|
|
@@ -2473,9 +2501,237 @@ const SecondaryDropdown = styled(Dropdown$1) `
|
|
|
2473
2501
|
`;
|
|
2474
2502
|
RawDropdown.displayName = 'Dropdown';
|
|
2475
2503
|
const Dropdown = Object.assign(RawDropdown, {
|
|
2476
|
-
Item
|
|
2504
|
+
Item: Item$1
|
|
2477
2505
|
});
|
|
2478
2506
|
|
|
2507
|
+
var global$1 = (typeof global !== "undefined" ? global :
|
|
2508
|
+
typeof self !== "undefined" ? self :
|
|
2509
|
+
typeof window !== "undefined" ? window : {});
|
|
2510
|
+
|
|
2511
|
+
// shim for using process in browser
|
|
2512
|
+
// based off https://github.com/defunctzombie/node-process/blob/master/browser.js
|
|
2513
|
+
|
|
2514
|
+
function defaultSetTimout() {
|
|
2515
|
+
throw new Error('setTimeout has not been defined');
|
|
2516
|
+
}
|
|
2517
|
+
function defaultClearTimeout () {
|
|
2518
|
+
throw new Error('clearTimeout has not been defined');
|
|
2519
|
+
}
|
|
2520
|
+
var cachedSetTimeout = defaultSetTimout;
|
|
2521
|
+
var cachedClearTimeout = defaultClearTimeout;
|
|
2522
|
+
if (typeof global$1.setTimeout === 'function') {
|
|
2523
|
+
cachedSetTimeout = setTimeout;
|
|
2524
|
+
}
|
|
2525
|
+
if (typeof global$1.clearTimeout === 'function') {
|
|
2526
|
+
cachedClearTimeout = clearTimeout;
|
|
2527
|
+
}
|
|
2528
|
+
|
|
2529
|
+
function runTimeout(fun) {
|
|
2530
|
+
if (cachedSetTimeout === setTimeout) {
|
|
2531
|
+
//normal enviroments in sane situations
|
|
2532
|
+
return setTimeout(fun, 0);
|
|
2533
|
+
}
|
|
2534
|
+
// if setTimeout wasn't available but was latter defined
|
|
2535
|
+
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
2536
|
+
cachedSetTimeout = setTimeout;
|
|
2537
|
+
return setTimeout(fun, 0);
|
|
2538
|
+
}
|
|
2539
|
+
try {
|
|
2540
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
2541
|
+
return cachedSetTimeout(fun, 0);
|
|
2542
|
+
} catch(e){
|
|
2543
|
+
try {
|
|
2544
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
2545
|
+
return cachedSetTimeout.call(null, fun, 0);
|
|
2546
|
+
} catch(e){
|
|
2547
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
|
2548
|
+
return cachedSetTimeout.call(this, fun, 0);
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
2551
|
+
|
|
2552
|
+
|
|
2553
|
+
}
|
|
2554
|
+
function runClearTimeout(marker) {
|
|
2555
|
+
if (cachedClearTimeout === clearTimeout) {
|
|
2556
|
+
//normal enviroments in sane situations
|
|
2557
|
+
return clearTimeout(marker);
|
|
2558
|
+
}
|
|
2559
|
+
// if clearTimeout wasn't available but was latter defined
|
|
2560
|
+
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
2561
|
+
cachedClearTimeout = clearTimeout;
|
|
2562
|
+
return clearTimeout(marker);
|
|
2563
|
+
}
|
|
2564
|
+
try {
|
|
2565
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
2566
|
+
return cachedClearTimeout(marker);
|
|
2567
|
+
} catch (e){
|
|
2568
|
+
try {
|
|
2569
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
2570
|
+
return cachedClearTimeout.call(null, marker);
|
|
2571
|
+
} catch (e){
|
|
2572
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
|
2573
|
+
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
|
2574
|
+
return cachedClearTimeout.call(this, marker);
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
|
|
2578
|
+
|
|
2579
|
+
|
|
2580
|
+
}
|
|
2581
|
+
var queue = [];
|
|
2582
|
+
var draining = false;
|
|
2583
|
+
var currentQueue;
|
|
2584
|
+
var queueIndex = -1;
|
|
2585
|
+
|
|
2586
|
+
function cleanUpNextTick() {
|
|
2587
|
+
if (!draining || !currentQueue) {
|
|
2588
|
+
return;
|
|
2589
|
+
}
|
|
2590
|
+
draining = false;
|
|
2591
|
+
if (currentQueue.length) {
|
|
2592
|
+
queue = currentQueue.concat(queue);
|
|
2593
|
+
} else {
|
|
2594
|
+
queueIndex = -1;
|
|
2595
|
+
}
|
|
2596
|
+
if (queue.length) {
|
|
2597
|
+
drainQueue();
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
function drainQueue() {
|
|
2602
|
+
if (draining) {
|
|
2603
|
+
return;
|
|
2604
|
+
}
|
|
2605
|
+
var timeout = runTimeout(cleanUpNextTick);
|
|
2606
|
+
draining = true;
|
|
2607
|
+
|
|
2608
|
+
var len = queue.length;
|
|
2609
|
+
while(len) {
|
|
2610
|
+
currentQueue = queue;
|
|
2611
|
+
queue = [];
|
|
2612
|
+
while (++queueIndex < len) {
|
|
2613
|
+
if (currentQueue) {
|
|
2614
|
+
currentQueue[queueIndex].run();
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
queueIndex = -1;
|
|
2618
|
+
len = queue.length;
|
|
2619
|
+
}
|
|
2620
|
+
currentQueue = null;
|
|
2621
|
+
draining = false;
|
|
2622
|
+
runClearTimeout(timeout);
|
|
2623
|
+
}
|
|
2624
|
+
function nextTick(fun) {
|
|
2625
|
+
var args = new Array(arguments.length - 1);
|
|
2626
|
+
if (arguments.length > 1) {
|
|
2627
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
2628
|
+
args[i - 1] = arguments[i];
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
queue.push(new Item(fun, args));
|
|
2632
|
+
if (queue.length === 1 && !draining) {
|
|
2633
|
+
runTimeout(drainQueue);
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
// v8 likes predictible objects
|
|
2637
|
+
function Item(fun, array) {
|
|
2638
|
+
this.fun = fun;
|
|
2639
|
+
this.array = array;
|
|
2640
|
+
}
|
|
2641
|
+
Item.prototype.run = function () {
|
|
2642
|
+
this.fun.apply(null, this.array);
|
|
2643
|
+
};
|
|
2644
|
+
var title = 'browser';
|
|
2645
|
+
var platform = 'browser';
|
|
2646
|
+
var browser = true;
|
|
2647
|
+
var env = {};
|
|
2648
|
+
var argv = [];
|
|
2649
|
+
var version = ''; // empty string to avoid regexp issues
|
|
2650
|
+
var versions = {};
|
|
2651
|
+
var release = {};
|
|
2652
|
+
var config = {};
|
|
2653
|
+
|
|
2654
|
+
function noop() {}
|
|
2655
|
+
|
|
2656
|
+
var on = noop;
|
|
2657
|
+
var addListener = noop;
|
|
2658
|
+
var once = noop;
|
|
2659
|
+
var off = noop;
|
|
2660
|
+
var removeListener = noop;
|
|
2661
|
+
var removeAllListeners = noop;
|
|
2662
|
+
var emit = noop;
|
|
2663
|
+
|
|
2664
|
+
function binding(name) {
|
|
2665
|
+
throw new Error('process.binding is not supported');
|
|
2666
|
+
}
|
|
2667
|
+
|
|
2668
|
+
function cwd () { return '/' }
|
|
2669
|
+
function chdir (dir) {
|
|
2670
|
+
throw new Error('process.chdir is not supported');
|
|
2671
|
+
}function umask() { return 0; }
|
|
2672
|
+
|
|
2673
|
+
// from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
|
|
2674
|
+
var performance$1 = global$1.performance || {};
|
|
2675
|
+
var performanceNow =
|
|
2676
|
+
performance$1.now ||
|
|
2677
|
+
performance$1.mozNow ||
|
|
2678
|
+
performance$1.msNow ||
|
|
2679
|
+
performance$1.oNow ||
|
|
2680
|
+
performance$1.webkitNow ||
|
|
2681
|
+
function(){ return (new Date()).getTime() };
|
|
2682
|
+
|
|
2683
|
+
// generate timestamp or delta
|
|
2684
|
+
// see http://nodejs.org/api/process.html#process_process_hrtime
|
|
2685
|
+
function hrtime(previousTimestamp){
|
|
2686
|
+
var clocktime = performanceNow.call(performance$1)*1e-3;
|
|
2687
|
+
var seconds = Math.floor(clocktime);
|
|
2688
|
+
var nanoseconds = Math.floor((clocktime%1)*1e9);
|
|
2689
|
+
if (previousTimestamp) {
|
|
2690
|
+
seconds = seconds - previousTimestamp[0];
|
|
2691
|
+
nanoseconds = nanoseconds - previousTimestamp[1];
|
|
2692
|
+
if (nanoseconds<0) {
|
|
2693
|
+
seconds--;
|
|
2694
|
+
nanoseconds += 1e9;
|
|
2695
|
+
}
|
|
2696
|
+
}
|
|
2697
|
+
return [seconds,nanoseconds]
|
|
2698
|
+
}
|
|
2699
|
+
|
|
2700
|
+
var startTime = new Date();
|
|
2701
|
+
function uptime() {
|
|
2702
|
+
var currentTime = new Date();
|
|
2703
|
+
var dif = currentTime - startTime;
|
|
2704
|
+
return dif / 1000;
|
|
2705
|
+
}
|
|
2706
|
+
|
|
2707
|
+
var browser$1 = {
|
|
2708
|
+
nextTick: nextTick,
|
|
2709
|
+
title: title,
|
|
2710
|
+
browser: browser,
|
|
2711
|
+
env: env,
|
|
2712
|
+
argv: argv,
|
|
2713
|
+
version: version,
|
|
2714
|
+
versions: versions,
|
|
2715
|
+
on: on,
|
|
2716
|
+
addListener: addListener,
|
|
2717
|
+
once: once,
|
|
2718
|
+
off: off,
|
|
2719
|
+
removeListener: removeListener,
|
|
2720
|
+
removeAllListeners: removeAllListeners,
|
|
2721
|
+
emit: emit,
|
|
2722
|
+
binding: binding,
|
|
2723
|
+
cwd: cwd,
|
|
2724
|
+
chdir: chdir,
|
|
2725
|
+
umask: umask,
|
|
2726
|
+
hrtime: hrtime,
|
|
2727
|
+
platform: platform,
|
|
2728
|
+
release: release,
|
|
2729
|
+
config: config,
|
|
2730
|
+
uptime: uptime
|
|
2731
|
+
};
|
|
2732
|
+
|
|
2733
|
+
var process$1 = browser$1;
|
|
2734
|
+
|
|
2479
2735
|
var reactDom = {exports: {}};
|
|
2480
2736
|
|
|
2481
2737
|
var reactDom_production_min = {};
|
|
@@ -2516,16 +2772,6 @@ function f(a,b){var c=a.length;a.push(b);a:for(;0<c;){var d=c-1>>>1,e=a[d];if(0<
|
|
|
2516
2772
|
|
|
2517
2773
|
var scheduler_development = {};
|
|
2518
2774
|
|
|
2519
|
-
/**
|
|
2520
|
-
* @license React
|
|
2521
|
-
* scheduler.development.js
|
|
2522
|
-
*
|
|
2523
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
2524
|
-
*
|
|
2525
|
-
* This source code is licensed under the MIT license found in the
|
|
2526
|
-
* LICENSE file in the root directory of this source tree.
|
|
2527
|
-
*/
|
|
2528
|
-
|
|
2529
2775
|
var hasRequiredScheduler_development;
|
|
2530
2776
|
|
|
2531
2777
|
function requireScheduler_development () {
|
|
@@ -2533,7 +2779,7 @@ function requireScheduler_development () {
|
|
|
2533
2779
|
hasRequiredScheduler_development = 1;
|
|
2534
2780
|
(function (exports) {
|
|
2535
2781
|
|
|
2536
|
-
if (process.env.NODE_ENV !== "production") {
|
|
2782
|
+
if (process$1.env.NODE_ENV !== "production") {
|
|
2537
2783
|
(function() {
|
|
2538
2784
|
|
|
2539
2785
|
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
@@ -3151,7 +3397,7 @@ function requireScheduler () {
|
|
|
3151
3397
|
if (hasRequiredScheduler) return scheduler.exports;
|
|
3152
3398
|
hasRequiredScheduler = 1;
|
|
3153
3399
|
|
|
3154
|
-
if (process.env.NODE_ENV === 'production') {
|
|
3400
|
+
if (process$1.env.NODE_ENV === 'production') {
|
|
3155
3401
|
scheduler.exports = requireScheduler_production_min();
|
|
3156
3402
|
} else {
|
|
3157
3403
|
scheduler.exports = requireScheduler_development();
|
|
@@ -3489,23 +3735,13 @@ var aa=t__default,ca=requireScheduler();function p(a){for(var b="https://reactjs
|
|
|
3489
3735
|
|
|
3490
3736
|
var reactDom_development = {};
|
|
3491
3737
|
|
|
3492
|
-
/**
|
|
3493
|
-
* @license React
|
|
3494
|
-
* react-dom.development.js
|
|
3495
|
-
*
|
|
3496
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3497
|
-
*
|
|
3498
|
-
* This source code is licensed under the MIT license found in the
|
|
3499
|
-
* LICENSE file in the root directory of this source tree.
|
|
3500
|
-
*/
|
|
3501
|
-
|
|
3502
3738
|
var hasRequiredReactDom_development;
|
|
3503
3739
|
|
|
3504
3740
|
function requireReactDom_development () {
|
|
3505
3741
|
if (hasRequiredReactDom_development) return reactDom_development;
|
|
3506
3742
|
hasRequiredReactDom_development = 1;
|
|
3507
3743
|
|
|
3508
|
-
if (process.env.NODE_ENV !== "production") {
|
|
3744
|
+
if (process$1.env.NODE_ENV !== "production") {
|
|
3509
3745
|
(function() {
|
|
3510
3746
|
|
|
3511
3747
|
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
@@ -33346,7 +33582,7 @@ function checkDCE() {
|
|
|
33346
33582
|
) {
|
|
33347
33583
|
return;
|
|
33348
33584
|
}
|
|
33349
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
33585
|
+
if (process$1.env.NODE_ENV !== 'production') {
|
|
33350
33586
|
// This branch is unreachable because this function is only called
|
|
33351
33587
|
// in production, but the condition is true only in development.
|
|
33352
33588
|
// Therefore if the branch is still here, dead code elimination wasn't
|
|
@@ -33366,7 +33602,7 @@ function checkDCE() {
|
|
|
33366
33602
|
}
|
|
33367
33603
|
}
|
|
33368
33604
|
|
|
33369
|
-
if (process.env.NODE_ENV === 'production') {
|
|
33605
|
+
if (process$1.env.NODE_ENV === 'production') {
|
|
33370
33606
|
// DCE check should happen before ReactDOM bundle executes so that
|
|
33371
33607
|
// DevTools can report bad minification during injection.
|
|
33372
33608
|
checkDCE();
|
|
@@ -34047,6 +34283,10 @@ function Calendar({ color, size, ...nativeProps }) {
|
|
|
34047
34283
|
return (jsx(IconBox, { "$color": color, "$size": size, children: jsx("svg", { height: "20", viewBox: "0 0 20 20", width: "20", ...nativeProps, children: jsxs("g", { transform: "translate(280 -41)", children: [jsxs("g", { children: [jsxs("g", { fill: "none", strokeMiterlimit: "10", children: [jsx("path", { d: "M-266,44V42h-2v2h-4V42h-2v2h-4V59h16V44Zm2,13h-12V50h12Zm0-9h-12V46h12Z", stroke: "none" }), jsx("path", { d: "M -274 42 L -272 42 L -272 44 L -268 44 L -268 42 L -266 42 L -266 44 L -262 44 L -262 59 L -278 59 L -278 44 L -274 44 L -274 42 Z M -264 48 L -264 46 L -276 46 L -276 48 L -264 48 Z M -264 57 L -264 50 L -276 50 L -276 57 L -264 57 Z", fill: "currentColor", stroke: "none" })] }), jsxs("g", { fill: "none", stroke: "currentColor", strokeMiterlimit: "10", strokeWidth: "2", transform: "translate(-274 52)", children: [jsx("rect", { height: "3", stroke: "none", width: "4" }), jsx("rect", { fill: "none", height: "1", width: "2", x: "1", y: "1" })] })] }), jsx("rect", { fill: "none", height: "20", transform: "translate(-280 41)", width: "20" })] }) }) }));
|
|
34048
34284
|
}
|
|
34049
34285
|
|
|
34286
|
+
function Car({ color, size, ...nativeProps }) {
|
|
34287
|
+
return (jsx(IconBox, { "$color": color, "$size": size, children: jsxs("svg", { height: "20", viewBox: "0 0 20 20", width: "20", ...nativeProps, children: [jsxs("g", { transform: "translate(-200 -164)", children: [jsx("path", { d: "M205.238,174.247h-.006a1.515,1.515,0,0,0-1.515,1.516,1.4,1.4,0,0,0,.445,1.056v0a1.5,1.5,0,0,0,1.069.423h.039a1.455,1.455,0,0,0,1.44-1.472,1.5,1.5,0,0,0-.428-1.075A1.405,1.405,0,0,0,205.238,174.247Z", fill: "currentColor" }), jsx("path", { d: "M214.789,174.247a1.409,1.409,0,0,0-1.057.446,1.5,1.5,0,0,0-.421,1.07,1.424,1.424,0,0,0,.432,1.056v0a1.438,1.438,0,0,0,1.039.429,1.5,1.5,0,0,0,1.075-.427,1.407,1.407,0,0,0,.446-1.045,1.478,1.478,0,0,0-.442-1.08A1.46,1.46,0,0,0,214.789,174.247Z", fill: "currentColor" }), jsx("path", { d: "M219,179.862v-6.721l-2.1-6.307a1.222,1.222,0,0,0-.46-.611A1.265,1.265,0,0,0,215.7,166H204.295a1.262,1.262,0,0,0-.736.223,1.23,1.23,0,0,0-.461.614l-2.1,6.3v6.721h0V182h2.261v-2.061h13.477V182H219v-2.138Zm-14.342-12.1h10.685l1.25,3.782H203.406Zm-1.873,10.4v-4.859h14.429v4.859Z", fill: "currentColor" })] }), jsx("rect", { fill: "none", height: "20", width: "20" })] }) }));
|
|
34288
|
+
}
|
|
34289
|
+
|
|
34050
34290
|
function Check({ color, size, ...nativeProps }) {
|
|
34051
34291
|
return (jsx(IconBox, { "$color": color, "$size": size, children: jsx("svg", { height: "20", viewBox: "0 0 20 20", width: "20", ...nativeProps, children: jsxs("g", { transform: "translate(40 -82)", children: [jsxs("g", { fill: "none", strokeMiterlimit: "10", children: [jsx("path", { d: "M-23.99,86.7l-7.778,7.778-4.243-4.243-1.414,1.414,4.243,4.243,1.414,1.414,9.192-9.192Z", stroke: "none" }), jsx("path", { d: "M -23.98955917358398 86.69669342041016 L -22.57537841796875 88.11093139648438 L -31.76775932312012 97.30330657958984 L -37.42462158203125 91.64644622802734 L -36.01044082641602 90.23220825195313 L -31.76775932312012 94.47487640380859 L -23.98955917358398 86.69669342041016 Z", fill: "currentColor", stroke: "none" })] }), jsx("rect", { fill: "none", height: "20", transform: "translate(-40 82)", width: "20" })] }) }) }));
|
|
34052
34292
|
}
|
|
@@ -34359,6 +34599,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
34359
34599
|
Archive: Archive,
|
|
34360
34600
|
Attention: Attention,
|
|
34361
34601
|
Calendar: Calendar,
|
|
34602
|
+
Car: Car,
|
|
34362
34603
|
Check: Check,
|
|
34363
34604
|
Chevron: Chevron,
|
|
34364
34605
|
Clock: Clock,
|
|
@@ -54094,7 +54335,7 @@ diacritics.diacriticsMap = diacriticsMap;
|
|
|
54094
54335
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
54095
54336
|
*/
|
|
54096
54337
|
|
|
54097
|
-
function isArray$
|
|
54338
|
+
function isArray$2(value) {
|
|
54098
54339
|
return !Array.isArray
|
|
54099
54340
|
? getTag(value) === '[object Array]'
|
|
54100
54341
|
: Array.isArray(value)
|
|
@@ -54111,7 +54352,7 @@ function baseToString(value) {
|
|
|
54111
54352
|
return result == '0' && 1 / value == -INFINITY ? '-0' : result
|
|
54112
54353
|
}
|
|
54113
54354
|
|
|
54114
|
-
function toString$
|
|
54355
|
+
function toString$2(value) {
|
|
54115
54356
|
return value == null ? '' : baseToString(value)
|
|
54116
54357
|
}
|
|
54117
54358
|
|
|
@@ -54217,7 +54458,7 @@ function createKey(key) {
|
|
|
54217
54458
|
let weight = 1;
|
|
54218
54459
|
let getFn = null;
|
|
54219
54460
|
|
|
54220
|
-
if (isString$2(key) || isArray$
|
|
54461
|
+
if (isString$2(key) || isArray$2(key)) {
|
|
54221
54462
|
src = key;
|
|
54222
54463
|
path = createKeyPath(key);
|
|
54223
54464
|
id = createKeyId(key);
|
|
@@ -54246,11 +54487,11 @@ function createKey(key) {
|
|
|
54246
54487
|
}
|
|
54247
54488
|
|
|
54248
54489
|
function createKeyPath(key) {
|
|
54249
|
-
return isArray$
|
|
54490
|
+
return isArray$2(key) ? key : key.split('.')
|
|
54250
54491
|
}
|
|
54251
54492
|
|
|
54252
54493
|
function createKeyId(key) {
|
|
54253
|
-
return isArray$
|
|
54494
|
+
return isArray$2(key) ? key.join('.') : key
|
|
54254
54495
|
}
|
|
54255
54496
|
|
|
54256
54497
|
function get$3(obj, path) {
|
|
@@ -54279,8 +54520,8 @@ function get$3(obj, path) {
|
|
|
54279
54520
|
index === path.length - 1 &&
|
|
54280
54521
|
(isString$2(value) || isNumber(value) || isBoolean(value))
|
|
54281
54522
|
) {
|
|
54282
|
-
list.push(toString$
|
|
54283
|
-
} else if (isArray$
|
|
54523
|
+
list.push(toString$2(value));
|
|
54524
|
+
} else if (isArray$2(value)) {
|
|
54284
54525
|
arr = true;
|
|
54285
54526
|
// Search each item in the array.
|
|
54286
54527
|
for (let i = 0, len = value.length; i < len; i += 1) {
|
|
@@ -54491,7 +54732,7 @@ class FuseIndex {
|
|
|
54491
54732
|
return
|
|
54492
54733
|
}
|
|
54493
54734
|
|
|
54494
|
-
if (isArray$
|
|
54735
|
+
if (isArray$2(value)) {
|
|
54495
54736
|
let subRecords = [];
|
|
54496
54737
|
const stack = [{ nestedArrIndex: -1, value }];
|
|
54497
54738
|
|
|
@@ -54510,7 +54751,7 @@ class FuseIndex {
|
|
|
54510
54751
|
};
|
|
54511
54752
|
|
|
54512
54753
|
subRecords.push(subRecord);
|
|
54513
|
-
} else if (isArray$
|
|
54754
|
+
} else if (isArray$2(value)) {
|
|
54514
54755
|
value.forEach((item, k) => {
|
|
54515
54756
|
stack.push({
|
|
54516
54757
|
nestedArrIndex: k,
|
|
@@ -55436,7 +55677,7 @@ const isExpression = (query) =>
|
|
|
55436
55677
|
const isPath = (query) => !!query[KeyType.PATH];
|
|
55437
55678
|
|
|
55438
55679
|
const isLeaf = (query) =>
|
|
55439
|
-
!isArray$
|
|
55680
|
+
!isArray$2(query) && isObject$2(query) && !isExpression(query);
|
|
55440
55681
|
|
|
55441
55682
|
const convertToExplicit = (query) => ({
|
|
55442
55683
|
[LogicalOperator.AND]: Object.keys(query).map((key) => ({
|
|
@@ -55485,7 +55726,7 @@ function parse(query, options, { auto = true } = {}) {
|
|
|
55485
55726
|
keys.forEach((key) => {
|
|
55486
55727
|
const value = query[key];
|
|
55487
55728
|
|
|
55488
|
-
if (isArray$
|
|
55729
|
+
if (isArray$2(value)) {
|
|
55489
55730
|
value.forEach((item) => {
|
|
55490
55731
|
node.children.push(next(item));
|
|
55491
55732
|
});
|
|
@@ -55818,7 +56059,7 @@ class Fuse {
|
|
|
55818
56059
|
|
|
55819
56060
|
let matches = [];
|
|
55820
56061
|
|
|
55821
|
-
if (isArray$
|
|
56062
|
+
if (isArray$2(value)) {
|
|
55822
56063
|
value.forEach(({ v: text, i: idx, n: norm }) => {
|
|
55823
56064
|
if (!isDefined$1(text)) {
|
|
55824
56065
|
return
|
|
@@ -55864,6 +56105,2491 @@ Fuse.config = Config;
|
|
|
55864
56105
|
register(ExtendedSearch);
|
|
55865
56106
|
}
|
|
55866
56107
|
|
|
56108
|
+
var lookup = [];
|
|
56109
|
+
var revLookup = [];
|
|
56110
|
+
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
|
|
56111
|
+
var inited = false;
|
|
56112
|
+
function init () {
|
|
56113
|
+
inited = true;
|
|
56114
|
+
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
56115
|
+
for (var i = 0, len = code.length; i < len; ++i) {
|
|
56116
|
+
lookup[i] = code[i];
|
|
56117
|
+
revLookup[code.charCodeAt(i)] = i;
|
|
56118
|
+
}
|
|
56119
|
+
|
|
56120
|
+
revLookup['-'.charCodeAt(0)] = 62;
|
|
56121
|
+
revLookup['_'.charCodeAt(0)] = 63;
|
|
56122
|
+
}
|
|
56123
|
+
|
|
56124
|
+
function toByteArray (b64) {
|
|
56125
|
+
if (!inited) {
|
|
56126
|
+
init();
|
|
56127
|
+
}
|
|
56128
|
+
var i, j, l, tmp, placeHolders, arr;
|
|
56129
|
+
var len = b64.length;
|
|
56130
|
+
|
|
56131
|
+
if (len % 4 > 0) {
|
|
56132
|
+
throw new Error('Invalid string. Length must be a multiple of 4')
|
|
56133
|
+
}
|
|
56134
|
+
|
|
56135
|
+
// the number of equal signs (place holders)
|
|
56136
|
+
// if there are two placeholders, than the two characters before it
|
|
56137
|
+
// represent one byte
|
|
56138
|
+
// if there is only one, then the three characters before it represent 2 bytes
|
|
56139
|
+
// this is just a cheap hack to not do indexOf twice
|
|
56140
|
+
placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0;
|
|
56141
|
+
|
|
56142
|
+
// base64 is 4/3 + up to two characters of the original data
|
|
56143
|
+
arr = new Arr(len * 3 / 4 - placeHolders);
|
|
56144
|
+
|
|
56145
|
+
// if there are placeholders, only get up to the last complete 4 chars
|
|
56146
|
+
l = placeHolders > 0 ? len - 4 : len;
|
|
56147
|
+
|
|
56148
|
+
var L = 0;
|
|
56149
|
+
|
|
56150
|
+
for (i = 0, j = 0; i < l; i += 4, j += 3) {
|
|
56151
|
+
tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)];
|
|
56152
|
+
arr[L++] = (tmp >> 16) & 0xFF;
|
|
56153
|
+
arr[L++] = (tmp >> 8) & 0xFF;
|
|
56154
|
+
arr[L++] = tmp & 0xFF;
|
|
56155
|
+
}
|
|
56156
|
+
|
|
56157
|
+
if (placeHolders === 2) {
|
|
56158
|
+
tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4);
|
|
56159
|
+
arr[L++] = tmp & 0xFF;
|
|
56160
|
+
} else if (placeHolders === 1) {
|
|
56161
|
+
tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2);
|
|
56162
|
+
arr[L++] = (tmp >> 8) & 0xFF;
|
|
56163
|
+
arr[L++] = tmp & 0xFF;
|
|
56164
|
+
}
|
|
56165
|
+
|
|
56166
|
+
return arr
|
|
56167
|
+
}
|
|
56168
|
+
|
|
56169
|
+
function tripletToBase64 (num) {
|
|
56170
|
+
return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
|
|
56171
|
+
}
|
|
56172
|
+
|
|
56173
|
+
function encodeChunk (uint8, start, end) {
|
|
56174
|
+
var tmp;
|
|
56175
|
+
var output = [];
|
|
56176
|
+
for (var i = start; i < end; i += 3) {
|
|
56177
|
+
tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]);
|
|
56178
|
+
output.push(tripletToBase64(tmp));
|
|
56179
|
+
}
|
|
56180
|
+
return output.join('')
|
|
56181
|
+
}
|
|
56182
|
+
|
|
56183
|
+
function fromByteArray (uint8) {
|
|
56184
|
+
if (!inited) {
|
|
56185
|
+
init();
|
|
56186
|
+
}
|
|
56187
|
+
var tmp;
|
|
56188
|
+
var len = uint8.length;
|
|
56189
|
+
var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
|
|
56190
|
+
var output = '';
|
|
56191
|
+
var parts = [];
|
|
56192
|
+
var maxChunkLength = 16383; // must be multiple of 3
|
|
56193
|
+
|
|
56194
|
+
// go through the array every three bytes, we'll deal with trailing stuff later
|
|
56195
|
+
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
|
56196
|
+
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)));
|
|
56197
|
+
}
|
|
56198
|
+
|
|
56199
|
+
// pad the end with zeros, but make sure to not forget the extra bytes
|
|
56200
|
+
if (extraBytes === 1) {
|
|
56201
|
+
tmp = uint8[len - 1];
|
|
56202
|
+
output += lookup[tmp >> 2];
|
|
56203
|
+
output += lookup[(tmp << 4) & 0x3F];
|
|
56204
|
+
output += '==';
|
|
56205
|
+
} else if (extraBytes === 2) {
|
|
56206
|
+
tmp = (uint8[len - 2] << 8) + (uint8[len - 1]);
|
|
56207
|
+
output += lookup[tmp >> 10];
|
|
56208
|
+
output += lookup[(tmp >> 4) & 0x3F];
|
|
56209
|
+
output += lookup[(tmp << 2) & 0x3F];
|
|
56210
|
+
output += '=';
|
|
56211
|
+
}
|
|
56212
|
+
|
|
56213
|
+
parts.push(output);
|
|
56214
|
+
|
|
56215
|
+
return parts.join('')
|
|
56216
|
+
}
|
|
56217
|
+
|
|
56218
|
+
function read (buffer, offset, isLE, mLen, nBytes) {
|
|
56219
|
+
var e, m;
|
|
56220
|
+
var eLen = nBytes * 8 - mLen - 1;
|
|
56221
|
+
var eMax = (1 << eLen) - 1;
|
|
56222
|
+
var eBias = eMax >> 1;
|
|
56223
|
+
var nBits = -7;
|
|
56224
|
+
var i = isLE ? (nBytes - 1) : 0;
|
|
56225
|
+
var d = isLE ? -1 : 1;
|
|
56226
|
+
var s = buffer[offset + i];
|
|
56227
|
+
|
|
56228
|
+
i += d;
|
|
56229
|
+
|
|
56230
|
+
e = s & ((1 << (-nBits)) - 1);
|
|
56231
|
+
s >>= (-nBits);
|
|
56232
|
+
nBits += eLen;
|
|
56233
|
+
for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
|
|
56234
|
+
|
|
56235
|
+
m = e & ((1 << (-nBits)) - 1);
|
|
56236
|
+
e >>= (-nBits);
|
|
56237
|
+
nBits += mLen;
|
|
56238
|
+
for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
|
|
56239
|
+
|
|
56240
|
+
if (e === 0) {
|
|
56241
|
+
e = 1 - eBias;
|
|
56242
|
+
} else if (e === eMax) {
|
|
56243
|
+
return m ? NaN : ((s ? -1 : 1) * Infinity)
|
|
56244
|
+
} else {
|
|
56245
|
+
m = m + Math.pow(2, mLen);
|
|
56246
|
+
e = e - eBias;
|
|
56247
|
+
}
|
|
56248
|
+
return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
|
|
56249
|
+
}
|
|
56250
|
+
|
|
56251
|
+
function write (buffer, value, offset, isLE, mLen, nBytes) {
|
|
56252
|
+
var e, m, c;
|
|
56253
|
+
var eLen = nBytes * 8 - mLen - 1;
|
|
56254
|
+
var eMax = (1 << eLen) - 1;
|
|
56255
|
+
var eBias = eMax >> 1;
|
|
56256
|
+
var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0);
|
|
56257
|
+
var i = isLE ? 0 : (nBytes - 1);
|
|
56258
|
+
var d = isLE ? 1 : -1;
|
|
56259
|
+
var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
|
|
56260
|
+
|
|
56261
|
+
value = Math.abs(value);
|
|
56262
|
+
|
|
56263
|
+
if (isNaN(value) || value === Infinity) {
|
|
56264
|
+
m = isNaN(value) ? 1 : 0;
|
|
56265
|
+
e = eMax;
|
|
56266
|
+
} else {
|
|
56267
|
+
e = Math.floor(Math.log(value) / Math.LN2);
|
|
56268
|
+
if (value * (c = Math.pow(2, -e)) < 1) {
|
|
56269
|
+
e--;
|
|
56270
|
+
c *= 2;
|
|
56271
|
+
}
|
|
56272
|
+
if (e + eBias >= 1) {
|
|
56273
|
+
value += rt / c;
|
|
56274
|
+
} else {
|
|
56275
|
+
value += rt * Math.pow(2, 1 - eBias);
|
|
56276
|
+
}
|
|
56277
|
+
if (value * c >= 2) {
|
|
56278
|
+
e++;
|
|
56279
|
+
c /= 2;
|
|
56280
|
+
}
|
|
56281
|
+
|
|
56282
|
+
if (e + eBias >= eMax) {
|
|
56283
|
+
m = 0;
|
|
56284
|
+
e = eMax;
|
|
56285
|
+
} else if (e + eBias >= 1) {
|
|
56286
|
+
m = (value * c - 1) * Math.pow(2, mLen);
|
|
56287
|
+
e = e + eBias;
|
|
56288
|
+
} else {
|
|
56289
|
+
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
|
|
56290
|
+
e = 0;
|
|
56291
|
+
}
|
|
56292
|
+
}
|
|
56293
|
+
|
|
56294
|
+
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
|
|
56295
|
+
|
|
56296
|
+
e = (e << mLen) | m;
|
|
56297
|
+
eLen += mLen;
|
|
56298
|
+
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
|
|
56299
|
+
|
|
56300
|
+
buffer[offset + i - d] |= s * 128;
|
|
56301
|
+
}
|
|
56302
|
+
|
|
56303
|
+
var toString$1 = {}.toString;
|
|
56304
|
+
|
|
56305
|
+
var isArray$1 = Array.isArray || function (arr) {
|
|
56306
|
+
return toString$1.call(arr) == '[object Array]';
|
|
56307
|
+
};
|
|
56308
|
+
|
|
56309
|
+
/*!
|
|
56310
|
+
* The buffer module from node.js, for the browser.
|
|
56311
|
+
*
|
|
56312
|
+
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
56313
|
+
* @license MIT
|
|
56314
|
+
*/
|
|
56315
|
+
|
|
56316
|
+
var INSPECT_MAX_BYTES = 50;
|
|
56317
|
+
|
|
56318
|
+
/**
|
|
56319
|
+
* If `Buffer.TYPED_ARRAY_SUPPORT`:
|
|
56320
|
+
* === true Use Uint8Array implementation (fastest)
|
|
56321
|
+
* === false Use Object implementation (most compatible, even IE6)
|
|
56322
|
+
*
|
|
56323
|
+
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
|
|
56324
|
+
* Opera 11.6+, iOS 4.2+.
|
|
56325
|
+
*
|
|
56326
|
+
* Due to various browser bugs, sometimes the Object implementation will be used even
|
|
56327
|
+
* when the browser supports typed arrays.
|
|
56328
|
+
*
|
|
56329
|
+
* Note:
|
|
56330
|
+
*
|
|
56331
|
+
* - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
|
|
56332
|
+
* See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
|
|
56333
|
+
*
|
|
56334
|
+
* - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
|
|
56335
|
+
*
|
|
56336
|
+
* - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
|
|
56337
|
+
* incorrect length in some situations.
|
|
56338
|
+
|
|
56339
|
+
* We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
|
|
56340
|
+
* get the Object implementation, which is slower but behaves correctly.
|
|
56341
|
+
*/
|
|
56342
|
+
Buffer.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== undefined
|
|
56343
|
+
? global$1.TYPED_ARRAY_SUPPORT
|
|
56344
|
+
: true;
|
|
56345
|
+
|
|
56346
|
+
/*
|
|
56347
|
+
* Export kMaxLength after typed array support is determined.
|
|
56348
|
+
*/
|
|
56349
|
+
kMaxLength();
|
|
56350
|
+
|
|
56351
|
+
function kMaxLength () {
|
|
56352
|
+
return Buffer.TYPED_ARRAY_SUPPORT
|
|
56353
|
+
? 0x7fffffff
|
|
56354
|
+
: 0x3fffffff
|
|
56355
|
+
}
|
|
56356
|
+
|
|
56357
|
+
function createBuffer (that, length) {
|
|
56358
|
+
if (kMaxLength() < length) {
|
|
56359
|
+
throw new RangeError('Invalid typed array length')
|
|
56360
|
+
}
|
|
56361
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
56362
|
+
// Return an augmented `Uint8Array` instance, for best performance
|
|
56363
|
+
that = new Uint8Array(length);
|
|
56364
|
+
that.__proto__ = Buffer.prototype;
|
|
56365
|
+
} else {
|
|
56366
|
+
// Fallback: Return an object instance of the Buffer class
|
|
56367
|
+
if (that === null) {
|
|
56368
|
+
that = new Buffer(length);
|
|
56369
|
+
}
|
|
56370
|
+
that.length = length;
|
|
56371
|
+
}
|
|
56372
|
+
|
|
56373
|
+
return that
|
|
56374
|
+
}
|
|
56375
|
+
|
|
56376
|
+
/**
|
|
56377
|
+
* The Buffer constructor returns instances of `Uint8Array` that have their
|
|
56378
|
+
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
|
|
56379
|
+
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
|
|
56380
|
+
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
|
|
56381
|
+
* returns a single octet.
|
|
56382
|
+
*
|
|
56383
|
+
* The `Uint8Array` prototype remains unmodified.
|
|
56384
|
+
*/
|
|
56385
|
+
|
|
56386
|
+
function Buffer (arg, encodingOrOffset, length) {
|
|
56387
|
+
if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
|
|
56388
|
+
return new Buffer(arg, encodingOrOffset, length)
|
|
56389
|
+
}
|
|
56390
|
+
|
|
56391
|
+
// Common case.
|
|
56392
|
+
if (typeof arg === 'number') {
|
|
56393
|
+
if (typeof encodingOrOffset === 'string') {
|
|
56394
|
+
throw new Error(
|
|
56395
|
+
'If encoding is specified then the first argument must be a string'
|
|
56396
|
+
)
|
|
56397
|
+
}
|
|
56398
|
+
return allocUnsafe(this, arg)
|
|
56399
|
+
}
|
|
56400
|
+
return from(this, arg, encodingOrOffset, length)
|
|
56401
|
+
}
|
|
56402
|
+
|
|
56403
|
+
Buffer.poolSize = 8192; // not used by this implementation
|
|
56404
|
+
|
|
56405
|
+
// TODO: Legacy, not needed anymore. Remove in next major version.
|
|
56406
|
+
Buffer._augment = function (arr) {
|
|
56407
|
+
arr.__proto__ = Buffer.prototype;
|
|
56408
|
+
return arr
|
|
56409
|
+
};
|
|
56410
|
+
|
|
56411
|
+
function from (that, value, encodingOrOffset, length) {
|
|
56412
|
+
if (typeof value === 'number') {
|
|
56413
|
+
throw new TypeError('"value" argument must not be a number')
|
|
56414
|
+
}
|
|
56415
|
+
|
|
56416
|
+
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
|
|
56417
|
+
return fromArrayBuffer(that, value, encodingOrOffset, length)
|
|
56418
|
+
}
|
|
56419
|
+
|
|
56420
|
+
if (typeof value === 'string') {
|
|
56421
|
+
return fromString(that, value, encodingOrOffset)
|
|
56422
|
+
}
|
|
56423
|
+
|
|
56424
|
+
return fromObject(that, value)
|
|
56425
|
+
}
|
|
56426
|
+
|
|
56427
|
+
/**
|
|
56428
|
+
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
|
|
56429
|
+
* if value is a number.
|
|
56430
|
+
* Buffer.from(str[, encoding])
|
|
56431
|
+
* Buffer.from(array)
|
|
56432
|
+
* Buffer.from(buffer)
|
|
56433
|
+
* Buffer.from(arrayBuffer[, byteOffset[, length]])
|
|
56434
|
+
**/
|
|
56435
|
+
Buffer.from = function (value, encodingOrOffset, length) {
|
|
56436
|
+
return from(null, value, encodingOrOffset, length)
|
|
56437
|
+
};
|
|
56438
|
+
|
|
56439
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
56440
|
+
Buffer.prototype.__proto__ = Uint8Array.prototype;
|
|
56441
|
+
Buffer.__proto__ = Uint8Array;
|
|
56442
|
+
}
|
|
56443
|
+
|
|
56444
|
+
function assertSize (size) {
|
|
56445
|
+
if (typeof size !== 'number') {
|
|
56446
|
+
throw new TypeError('"size" argument must be a number')
|
|
56447
|
+
} else if (size < 0) {
|
|
56448
|
+
throw new RangeError('"size" argument must not be negative')
|
|
56449
|
+
}
|
|
56450
|
+
}
|
|
56451
|
+
|
|
56452
|
+
function alloc (that, size, fill, encoding) {
|
|
56453
|
+
assertSize(size);
|
|
56454
|
+
if (size <= 0) {
|
|
56455
|
+
return createBuffer(that, size)
|
|
56456
|
+
}
|
|
56457
|
+
if (fill !== undefined) {
|
|
56458
|
+
// Only pay attention to encoding if it's a string. This
|
|
56459
|
+
// prevents accidentally sending in a number that would
|
|
56460
|
+
// be interpretted as a start offset.
|
|
56461
|
+
return typeof encoding === 'string'
|
|
56462
|
+
? createBuffer(that, size).fill(fill, encoding)
|
|
56463
|
+
: createBuffer(that, size).fill(fill)
|
|
56464
|
+
}
|
|
56465
|
+
return createBuffer(that, size)
|
|
56466
|
+
}
|
|
56467
|
+
|
|
56468
|
+
/**
|
|
56469
|
+
* Creates a new filled Buffer instance.
|
|
56470
|
+
* alloc(size[, fill[, encoding]])
|
|
56471
|
+
**/
|
|
56472
|
+
Buffer.alloc = function (size, fill, encoding) {
|
|
56473
|
+
return alloc(null, size, fill, encoding)
|
|
56474
|
+
};
|
|
56475
|
+
|
|
56476
|
+
function allocUnsafe (that, size) {
|
|
56477
|
+
assertSize(size);
|
|
56478
|
+
that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);
|
|
56479
|
+
if (!Buffer.TYPED_ARRAY_SUPPORT) {
|
|
56480
|
+
for (var i = 0; i < size; ++i) {
|
|
56481
|
+
that[i] = 0;
|
|
56482
|
+
}
|
|
56483
|
+
}
|
|
56484
|
+
return that
|
|
56485
|
+
}
|
|
56486
|
+
|
|
56487
|
+
/**
|
|
56488
|
+
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
|
|
56489
|
+
* */
|
|
56490
|
+
Buffer.allocUnsafe = function (size) {
|
|
56491
|
+
return allocUnsafe(null, size)
|
|
56492
|
+
};
|
|
56493
|
+
/**
|
|
56494
|
+
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
|
56495
|
+
*/
|
|
56496
|
+
Buffer.allocUnsafeSlow = function (size) {
|
|
56497
|
+
return allocUnsafe(null, size)
|
|
56498
|
+
};
|
|
56499
|
+
|
|
56500
|
+
function fromString (that, string, encoding) {
|
|
56501
|
+
if (typeof encoding !== 'string' || encoding === '') {
|
|
56502
|
+
encoding = 'utf8';
|
|
56503
|
+
}
|
|
56504
|
+
|
|
56505
|
+
if (!Buffer.isEncoding(encoding)) {
|
|
56506
|
+
throw new TypeError('"encoding" must be a valid string encoding')
|
|
56507
|
+
}
|
|
56508
|
+
|
|
56509
|
+
var length = byteLength(string, encoding) | 0;
|
|
56510
|
+
that = createBuffer(that, length);
|
|
56511
|
+
|
|
56512
|
+
var actual = that.write(string, encoding);
|
|
56513
|
+
|
|
56514
|
+
if (actual !== length) {
|
|
56515
|
+
// Writing a hex string, for example, that contains invalid characters will
|
|
56516
|
+
// cause everything after the first invalid character to be ignored. (e.g.
|
|
56517
|
+
// 'abxxcd' will be treated as 'ab')
|
|
56518
|
+
that = that.slice(0, actual);
|
|
56519
|
+
}
|
|
56520
|
+
|
|
56521
|
+
return that
|
|
56522
|
+
}
|
|
56523
|
+
|
|
56524
|
+
function fromArrayLike (that, array) {
|
|
56525
|
+
var length = array.length < 0 ? 0 : checked(array.length) | 0;
|
|
56526
|
+
that = createBuffer(that, length);
|
|
56527
|
+
for (var i = 0; i < length; i += 1) {
|
|
56528
|
+
that[i] = array[i] & 255;
|
|
56529
|
+
}
|
|
56530
|
+
return that
|
|
56531
|
+
}
|
|
56532
|
+
|
|
56533
|
+
function fromArrayBuffer (that, array, byteOffset, length) {
|
|
56534
|
+
array.byteLength; // this throws if `array` is not a valid ArrayBuffer
|
|
56535
|
+
|
|
56536
|
+
if (byteOffset < 0 || array.byteLength < byteOffset) {
|
|
56537
|
+
throw new RangeError('\'offset\' is out of bounds')
|
|
56538
|
+
}
|
|
56539
|
+
|
|
56540
|
+
if (array.byteLength < byteOffset + (length || 0)) {
|
|
56541
|
+
throw new RangeError('\'length\' is out of bounds')
|
|
56542
|
+
}
|
|
56543
|
+
|
|
56544
|
+
if (byteOffset === undefined && length === undefined) {
|
|
56545
|
+
array = new Uint8Array(array);
|
|
56546
|
+
} else if (length === undefined) {
|
|
56547
|
+
array = new Uint8Array(array, byteOffset);
|
|
56548
|
+
} else {
|
|
56549
|
+
array = new Uint8Array(array, byteOffset, length);
|
|
56550
|
+
}
|
|
56551
|
+
|
|
56552
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
56553
|
+
// Return an augmented `Uint8Array` instance, for best performance
|
|
56554
|
+
that = array;
|
|
56555
|
+
that.__proto__ = Buffer.prototype;
|
|
56556
|
+
} else {
|
|
56557
|
+
// Fallback: Return an object instance of the Buffer class
|
|
56558
|
+
that = fromArrayLike(that, array);
|
|
56559
|
+
}
|
|
56560
|
+
return that
|
|
56561
|
+
}
|
|
56562
|
+
|
|
56563
|
+
function fromObject (that, obj) {
|
|
56564
|
+
if (internalIsBuffer(obj)) {
|
|
56565
|
+
var len = checked(obj.length) | 0;
|
|
56566
|
+
that = createBuffer(that, len);
|
|
56567
|
+
|
|
56568
|
+
if (that.length === 0) {
|
|
56569
|
+
return that
|
|
56570
|
+
}
|
|
56571
|
+
|
|
56572
|
+
obj.copy(that, 0, 0, len);
|
|
56573
|
+
return that
|
|
56574
|
+
}
|
|
56575
|
+
|
|
56576
|
+
if (obj) {
|
|
56577
|
+
if ((typeof ArrayBuffer !== 'undefined' &&
|
|
56578
|
+
obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
|
|
56579
|
+
if (typeof obj.length !== 'number' || isnan(obj.length)) {
|
|
56580
|
+
return createBuffer(that, 0)
|
|
56581
|
+
}
|
|
56582
|
+
return fromArrayLike(that, obj)
|
|
56583
|
+
}
|
|
56584
|
+
|
|
56585
|
+
if (obj.type === 'Buffer' && isArray$1(obj.data)) {
|
|
56586
|
+
return fromArrayLike(that, obj.data)
|
|
56587
|
+
}
|
|
56588
|
+
}
|
|
56589
|
+
|
|
56590
|
+
throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
|
|
56591
|
+
}
|
|
56592
|
+
|
|
56593
|
+
function checked (length) {
|
|
56594
|
+
// Note: cannot use `length < kMaxLength()` here because that fails when
|
|
56595
|
+
// length is NaN (which is otherwise coerced to zero.)
|
|
56596
|
+
if (length >= kMaxLength()) {
|
|
56597
|
+
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
|
|
56598
|
+
'size: 0x' + kMaxLength().toString(16) + ' bytes')
|
|
56599
|
+
}
|
|
56600
|
+
return length | 0
|
|
56601
|
+
}
|
|
56602
|
+
Buffer.isBuffer = isBuffer;
|
|
56603
|
+
function internalIsBuffer (b) {
|
|
56604
|
+
return !!(b != null && b._isBuffer)
|
|
56605
|
+
}
|
|
56606
|
+
|
|
56607
|
+
Buffer.compare = function compare (a, b) {
|
|
56608
|
+
if (!internalIsBuffer(a) || !internalIsBuffer(b)) {
|
|
56609
|
+
throw new TypeError('Arguments must be Buffers')
|
|
56610
|
+
}
|
|
56611
|
+
|
|
56612
|
+
if (a === b) return 0
|
|
56613
|
+
|
|
56614
|
+
var x = a.length;
|
|
56615
|
+
var y = b.length;
|
|
56616
|
+
|
|
56617
|
+
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
56618
|
+
if (a[i] !== b[i]) {
|
|
56619
|
+
x = a[i];
|
|
56620
|
+
y = b[i];
|
|
56621
|
+
break
|
|
56622
|
+
}
|
|
56623
|
+
}
|
|
56624
|
+
|
|
56625
|
+
if (x < y) return -1
|
|
56626
|
+
if (y < x) return 1
|
|
56627
|
+
return 0
|
|
56628
|
+
};
|
|
56629
|
+
|
|
56630
|
+
Buffer.isEncoding = function isEncoding (encoding) {
|
|
56631
|
+
switch (String(encoding).toLowerCase()) {
|
|
56632
|
+
case 'hex':
|
|
56633
|
+
case 'utf8':
|
|
56634
|
+
case 'utf-8':
|
|
56635
|
+
case 'ascii':
|
|
56636
|
+
case 'latin1':
|
|
56637
|
+
case 'binary':
|
|
56638
|
+
case 'base64':
|
|
56639
|
+
case 'ucs2':
|
|
56640
|
+
case 'ucs-2':
|
|
56641
|
+
case 'utf16le':
|
|
56642
|
+
case 'utf-16le':
|
|
56643
|
+
return true
|
|
56644
|
+
default:
|
|
56645
|
+
return false
|
|
56646
|
+
}
|
|
56647
|
+
};
|
|
56648
|
+
|
|
56649
|
+
Buffer.concat = function concat (list, length) {
|
|
56650
|
+
if (!isArray$1(list)) {
|
|
56651
|
+
throw new TypeError('"list" argument must be an Array of Buffers')
|
|
56652
|
+
}
|
|
56653
|
+
|
|
56654
|
+
if (list.length === 0) {
|
|
56655
|
+
return Buffer.alloc(0)
|
|
56656
|
+
}
|
|
56657
|
+
|
|
56658
|
+
var i;
|
|
56659
|
+
if (length === undefined) {
|
|
56660
|
+
length = 0;
|
|
56661
|
+
for (i = 0; i < list.length; ++i) {
|
|
56662
|
+
length += list[i].length;
|
|
56663
|
+
}
|
|
56664
|
+
}
|
|
56665
|
+
|
|
56666
|
+
var buffer = Buffer.allocUnsafe(length);
|
|
56667
|
+
var pos = 0;
|
|
56668
|
+
for (i = 0; i < list.length; ++i) {
|
|
56669
|
+
var buf = list[i];
|
|
56670
|
+
if (!internalIsBuffer(buf)) {
|
|
56671
|
+
throw new TypeError('"list" argument must be an Array of Buffers')
|
|
56672
|
+
}
|
|
56673
|
+
buf.copy(buffer, pos);
|
|
56674
|
+
pos += buf.length;
|
|
56675
|
+
}
|
|
56676
|
+
return buffer
|
|
56677
|
+
};
|
|
56678
|
+
|
|
56679
|
+
function byteLength (string, encoding) {
|
|
56680
|
+
if (internalIsBuffer(string)) {
|
|
56681
|
+
return string.length
|
|
56682
|
+
}
|
|
56683
|
+
if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
|
|
56684
|
+
(ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
|
|
56685
|
+
return string.byteLength
|
|
56686
|
+
}
|
|
56687
|
+
if (typeof string !== 'string') {
|
|
56688
|
+
string = '' + string;
|
|
56689
|
+
}
|
|
56690
|
+
|
|
56691
|
+
var len = string.length;
|
|
56692
|
+
if (len === 0) return 0
|
|
56693
|
+
|
|
56694
|
+
// Use a for loop to avoid recursion
|
|
56695
|
+
var loweredCase = false;
|
|
56696
|
+
for (;;) {
|
|
56697
|
+
switch (encoding) {
|
|
56698
|
+
case 'ascii':
|
|
56699
|
+
case 'latin1':
|
|
56700
|
+
case 'binary':
|
|
56701
|
+
return len
|
|
56702
|
+
case 'utf8':
|
|
56703
|
+
case 'utf-8':
|
|
56704
|
+
case undefined:
|
|
56705
|
+
return utf8ToBytes(string).length
|
|
56706
|
+
case 'ucs2':
|
|
56707
|
+
case 'ucs-2':
|
|
56708
|
+
case 'utf16le':
|
|
56709
|
+
case 'utf-16le':
|
|
56710
|
+
return len * 2
|
|
56711
|
+
case 'hex':
|
|
56712
|
+
return len >>> 1
|
|
56713
|
+
case 'base64':
|
|
56714
|
+
return base64ToBytes(string).length
|
|
56715
|
+
default:
|
|
56716
|
+
if (loweredCase) return utf8ToBytes(string).length // assume utf8
|
|
56717
|
+
encoding = ('' + encoding).toLowerCase();
|
|
56718
|
+
loweredCase = true;
|
|
56719
|
+
}
|
|
56720
|
+
}
|
|
56721
|
+
}
|
|
56722
|
+
Buffer.byteLength = byteLength;
|
|
56723
|
+
|
|
56724
|
+
function slowToString (encoding, start, end) {
|
|
56725
|
+
var loweredCase = false;
|
|
56726
|
+
|
|
56727
|
+
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
|
|
56728
|
+
// property of a typed array.
|
|
56729
|
+
|
|
56730
|
+
// This behaves neither like String nor Uint8Array in that we set start/end
|
|
56731
|
+
// to their upper/lower bounds if the value passed is out of range.
|
|
56732
|
+
// undefined is handled specially as per ECMA-262 6th Edition,
|
|
56733
|
+
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
|
|
56734
|
+
if (start === undefined || start < 0) {
|
|
56735
|
+
start = 0;
|
|
56736
|
+
}
|
|
56737
|
+
// Return early if start > this.length. Done here to prevent potential uint32
|
|
56738
|
+
// coercion fail below.
|
|
56739
|
+
if (start > this.length) {
|
|
56740
|
+
return ''
|
|
56741
|
+
}
|
|
56742
|
+
|
|
56743
|
+
if (end === undefined || end > this.length) {
|
|
56744
|
+
end = this.length;
|
|
56745
|
+
}
|
|
56746
|
+
|
|
56747
|
+
if (end <= 0) {
|
|
56748
|
+
return ''
|
|
56749
|
+
}
|
|
56750
|
+
|
|
56751
|
+
// Force coersion to uint32. This will also coerce falsey/NaN values to 0.
|
|
56752
|
+
end >>>= 0;
|
|
56753
|
+
start >>>= 0;
|
|
56754
|
+
|
|
56755
|
+
if (end <= start) {
|
|
56756
|
+
return ''
|
|
56757
|
+
}
|
|
56758
|
+
|
|
56759
|
+
if (!encoding) encoding = 'utf8';
|
|
56760
|
+
|
|
56761
|
+
while (true) {
|
|
56762
|
+
switch (encoding) {
|
|
56763
|
+
case 'hex':
|
|
56764
|
+
return hexSlice(this, start, end)
|
|
56765
|
+
|
|
56766
|
+
case 'utf8':
|
|
56767
|
+
case 'utf-8':
|
|
56768
|
+
return utf8Slice(this, start, end)
|
|
56769
|
+
|
|
56770
|
+
case 'ascii':
|
|
56771
|
+
return asciiSlice(this, start, end)
|
|
56772
|
+
|
|
56773
|
+
case 'latin1':
|
|
56774
|
+
case 'binary':
|
|
56775
|
+
return latin1Slice(this, start, end)
|
|
56776
|
+
|
|
56777
|
+
case 'base64':
|
|
56778
|
+
return base64Slice(this, start, end)
|
|
56779
|
+
|
|
56780
|
+
case 'ucs2':
|
|
56781
|
+
case 'ucs-2':
|
|
56782
|
+
case 'utf16le':
|
|
56783
|
+
case 'utf-16le':
|
|
56784
|
+
return utf16leSlice(this, start, end)
|
|
56785
|
+
|
|
56786
|
+
default:
|
|
56787
|
+
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
|
56788
|
+
encoding = (encoding + '').toLowerCase();
|
|
56789
|
+
loweredCase = true;
|
|
56790
|
+
}
|
|
56791
|
+
}
|
|
56792
|
+
}
|
|
56793
|
+
|
|
56794
|
+
// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
|
|
56795
|
+
// Buffer instances.
|
|
56796
|
+
Buffer.prototype._isBuffer = true;
|
|
56797
|
+
|
|
56798
|
+
function swap (b, n, m) {
|
|
56799
|
+
var i = b[n];
|
|
56800
|
+
b[n] = b[m];
|
|
56801
|
+
b[m] = i;
|
|
56802
|
+
}
|
|
56803
|
+
|
|
56804
|
+
Buffer.prototype.swap16 = function swap16 () {
|
|
56805
|
+
var len = this.length;
|
|
56806
|
+
if (len % 2 !== 0) {
|
|
56807
|
+
throw new RangeError('Buffer size must be a multiple of 16-bits')
|
|
56808
|
+
}
|
|
56809
|
+
for (var i = 0; i < len; i += 2) {
|
|
56810
|
+
swap(this, i, i + 1);
|
|
56811
|
+
}
|
|
56812
|
+
return this
|
|
56813
|
+
};
|
|
56814
|
+
|
|
56815
|
+
Buffer.prototype.swap32 = function swap32 () {
|
|
56816
|
+
var len = this.length;
|
|
56817
|
+
if (len % 4 !== 0) {
|
|
56818
|
+
throw new RangeError('Buffer size must be a multiple of 32-bits')
|
|
56819
|
+
}
|
|
56820
|
+
for (var i = 0; i < len; i += 4) {
|
|
56821
|
+
swap(this, i, i + 3);
|
|
56822
|
+
swap(this, i + 1, i + 2);
|
|
56823
|
+
}
|
|
56824
|
+
return this
|
|
56825
|
+
};
|
|
56826
|
+
|
|
56827
|
+
Buffer.prototype.swap64 = function swap64 () {
|
|
56828
|
+
var len = this.length;
|
|
56829
|
+
if (len % 8 !== 0) {
|
|
56830
|
+
throw new RangeError('Buffer size must be a multiple of 64-bits')
|
|
56831
|
+
}
|
|
56832
|
+
for (var i = 0; i < len; i += 8) {
|
|
56833
|
+
swap(this, i, i + 7);
|
|
56834
|
+
swap(this, i + 1, i + 6);
|
|
56835
|
+
swap(this, i + 2, i + 5);
|
|
56836
|
+
swap(this, i + 3, i + 4);
|
|
56837
|
+
}
|
|
56838
|
+
return this
|
|
56839
|
+
};
|
|
56840
|
+
|
|
56841
|
+
Buffer.prototype.toString = function toString () {
|
|
56842
|
+
var length = this.length | 0;
|
|
56843
|
+
if (length === 0) return ''
|
|
56844
|
+
if (arguments.length === 0) return utf8Slice(this, 0, length)
|
|
56845
|
+
return slowToString.apply(this, arguments)
|
|
56846
|
+
};
|
|
56847
|
+
|
|
56848
|
+
Buffer.prototype.equals = function equals (b) {
|
|
56849
|
+
if (!internalIsBuffer(b)) throw new TypeError('Argument must be a Buffer')
|
|
56850
|
+
if (this === b) return true
|
|
56851
|
+
return Buffer.compare(this, b) === 0
|
|
56852
|
+
};
|
|
56853
|
+
|
|
56854
|
+
Buffer.prototype.inspect = function inspect () {
|
|
56855
|
+
var str = '';
|
|
56856
|
+
var max = INSPECT_MAX_BYTES;
|
|
56857
|
+
if (this.length > 0) {
|
|
56858
|
+
str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');
|
|
56859
|
+
if (this.length > max) str += ' ... ';
|
|
56860
|
+
}
|
|
56861
|
+
return '<Buffer ' + str + '>'
|
|
56862
|
+
};
|
|
56863
|
+
|
|
56864
|
+
Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
|
|
56865
|
+
if (!internalIsBuffer(target)) {
|
|
56866
|
+
throw new TypeError('Argument must be a Buffer')
|
|
56867
|
+
}
|
|
56868
|
+
|
|
56869
|
+
if (start === undefined) {
|
|
56870
|
+
start = 0;
|
|
56871
|
+
}
|
|
56872
|
+
if (end === undefined) {
|
|
56873
|
+
end = target ? target.length : 0;
|
|
56874
|
+
}
|
|
56875
|
+
if (thisStart === undefined) {
|
|
56876
|
+
thisStart = 0;
|
|
56877
|
+
}
|
|
56878
|
+
if (thisEnd === undefined) {
|
|
56879
|
+
thisEnd = this.length;
|
|
56880
|
+
}
|
|
56881
|
+
|
|
56882
|
+
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
|
|
56883
|
+
throw new RangeError('out of range index')
|
|
56884
|
+
}
|
|
56885
|
+
|
|
56886
|
+
if (thisStart >= thisEnd && start >= end) {
|
|
56887
|
+
return 0
|
|
56888
|
+
}
|
|
56889
|
+
if (thisStart >= thisEnd) {
|
|
56890
|
+
return -1
|
|
56891
|
+
}
|
|
56892
|
+
if (start >= end) {
|
|
56893
|
+
return 1
|
|
56894
|
+
}
|
|
56895
|
+
|
|
56896
|
+
start >>>= 0;
|
|
56897
|
+
end >>>= 0;
|
|
56898
|
+
thisStart >>>= 0;
|
|
56899
|
+
thisEnd >>>= 0;
|
|
56900
|
+
|
|
56901
|
+
if (this === target) return 0
|
|
56902
|
+
|
|
56903
|
+
var x = thisEnd - thisStart;
|
|
56904
|
+
var y = end - start;
|
|
56905
|
+
var len = Math.min(x, y);
|
|
56906
|
+
|
|
56907
|
+
var thisCopy = this.slice(thisStart, thisEnd);
|
|
56908
|
+
var targetCopy = target.slice(start, end);
|
|
56909
|
+
|
|
56910
|
+
for (var i = 0; i < len; ++i) {
|
|
56911
|
+
if (thisCopy[i] !== targetCopy[i]) {
|
|
56912
|
+
x = thisCopy[i];
|
|
56913
|
+
y = targetCopy[i];
|
|
56914
|
+
break
|
|
56915
|
+
}
|
|
56916
|
+
}
|
|
56917
|
+
|
|
56918
|
+
if (x < y) return -1
|
|
56919
|
+
if (y < x) return 1
|
|
56920
|
+
return 0
|
|
56921
|
+
};
|
|
56922
|
+
|
|
56923
|
+
// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
|
|
56924
|
+
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
|
|
56925
|
+
//
|
|
56926
|
+
// Arguments:
|
|
56927
|
+
// - buffer - a Buffer to search
|
|
56928
|
+
// - val - a string, Buffer, or number
|
|
56929
|
+
// - byteOffset - an index into `buffer`; will be clamped to an int32
|
|
56930
|
+
// - encoding - an optional encoding, relevant is val is a string
|
|
56931
|
+
// - dir - true for indexOf, false for lastIndexOf
|
|
56932
|
+
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
|
|
56933
|
+
// Empty buffer means no match
|
|
56934
|
+
if (buffer.length === 0) return -1
|
|
56935
|
+
|
|
56936
|
+
// Normalize byteOffset
|
|
56937
|
+
if (typeof byteOffset === 'string') {
|
|
56938
|
+
encoding = byteOffset;
|
|
56939
|
+
byteOffset = 0;
|
|
56940
|
+
} else if (byteOffset > 0x7fffffff) {
|
|
56941
|
+
byteOffset = 0x7fffffff;
|
|
56942
|
+
} else if (byteOffset < -0x80000000) {
|
|
56943
|
+
byteOffset = -0x80000000;
|
|
56944
|
+
}
|
|
56945
|
+
byteOffset = +byteOffset; // Coerce to Number.
|
|
56946
|
+
if (isNaN(byteOffset)) {
|
|
56947
|
+
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
|
|
56948
|
+
byteOffset = dir ? 0 : (buffer.length - 1);
|
|
56949
|
+
}
|
|
56950
|
+
|
|
56951
|
+
// Normalize byteOffset: negative offsets start from the end of the buffer
|
|
56952
|
+
if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
|
|
56953
|
+
if (byteOffset >= buffer.length) {
|
|
56954
|
+
if (dir) return -1
|
|
56955
|
+
else byteOffset = buffer.length - 1;
|
|
56956
|
+
} else if (byteOffset < 0) {
|
|
56957
|
+
if (dir) byteOffset = 0;
|
|
56958
|
+
else return -1
|
|
56959
|
+
}
|
|
56960
|
+
|
|
56961
|
+
// Normalize val
|
|
56962
|
+
if (typeof val === 'string') {
|
|
56963
|
+
val = Buffer.from(val, encoding);
|
|
56964
|
+
}
|
|
56965
|
+
|
|
56966
|
+
// Finally, search either indexOf (if dir is true) or lastIndexOf
|
|
56967
|
+
if (internalIsBuffer(val)) {
|
|
56968
|
+
// Special case: looking for empty string/buffer always fails
|
|
56969
|
+
if (val.length === 0) {
|
|
56970
|
+
return -1
|
|
56971
|
+
}
|
|
56972
|
+
return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
|
|
56973
|
+
} else if (typeof val === 'number') {
|
|
56974
|
+
val = val & 0xFF; // Search for a byte value [0-255]
|
|
56975
|
+
if (Buffer.TYPED_ARRAY_SUPPORT &&
|
|
56976
|
+
typeof Uint8Array.prototype.indexOf === 'function') {
|
|
56977
|
+
if (dir) {
|
|
56978
|
+
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
|
|
56979
|
+
} else {
|
|
56980
|
+
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
|
|
56981
|
+
}
|
|
56982
|
+
}
|
|
56983
|
+
return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
|
|
56984
|
+
}
|
|
56985
|
+
|
|
56986
|
+
throw new TypeError('val must be string, number or Buffer')
|
|
56987
|
+
}
|
|
56988
|
+
|
|
56989
|
+
function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
|
56990
|
+
var indexSize = 1;
|
|
56991
|
+
var arrLength = arr.length;
|
|
56992
|
+
var valLength = val.length;
|
|
56993
|
+
|
|
56994
|
+
if (encoding !== undefined) {
|
|
56995
|
+
encoding = String(encoding).toLowerCase();
|
|
56996
|
+
if (encoding === 'ucs2' || encoding === 'ucs-2' ||
|
|
56997
|
+
encoding === 'utf16le' || encoding === 'utf-16le') {
|
|
56998
|
+
if (arr.length < 2 || val.length < 2) {
|
|
56999
|
+
return -1
|
|
57000
|
+
}
|
|
57001
|
+
indexSize = 2;
|
|
57002
|
+
arrLength /= 2;
|
|
57003
|
+
valLength /= 2;
|
|
57004
|
+
byteOffset /= 2;
|
|
57005
|
+
}
|
|
57006
|
+
}
|
|
57007
|
+
|
|
57008
|
+
function read (buf, i) {
|
|
57009
|
+
if (indexSize === 1) {
|
|
57010
|
+
return buf[i]
|
|
57011
|
+
} else {
|
|
57012
|
+
return buf.readUInt16BE(i * indexSize)
|
|
57013
|
+
}
|
|
57014
|
+
}
|
|
57015
|
+
|
|
57016
|
+
var i;
|
|
57017
|
+
if (dir) {
|
|
57018
|
+
var foundIndex = -1;
|
|
57019
|
+
for (i = byteOffset; i < arrLength; i++) {
|
|
57020
|
+
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
57021
|
+
if (foundIndex === -1) foundIndex = i;
|
|
57022
|
+
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
|
|
57023
|
+
} else {
|
|
57024
|
+
if (foundIndex !== -1) i -= i - foundIndex;
|
|
57025
|
+
foundIndex = -1;
|
|
57026
|
+
}
|
|
57027
|
+
}
|
|
57028
|
+
} else {
|
|
57029
|
+
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
|
|
57030
|
+
for (i = byteOffset; i >= 0; i--) {
|
|
57031
|
+
var found = true;
|
|
57032
|
+
for (var j = 0; j < valLength; j++) {
|
|
57033
|
+
if (read(arr, i + j) !== read(val, j)) {
|
|
57034
|
+
found = false;
|
|
57035
|
+
break
|
|
57036
|
+
}
|
|
57037
|
+
}
|
|
57038
|
+
if (found) return i
|
|
57039
|
+
}
|
|
57040
|
+
}
|
|
57041
|
+
|
|
57042
|
+
return -1
|
|
57043
|
+
}
|
|
57044
|
+
|
|
57045
|
+
Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
|
|
57046
|
+
return this.indexOf(val, byteOffset, encoding) !== -1
|
|
57047
|
+
};
|
|
57048
|
+
|
|
57049
|
+
Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
|
|
57050
|
+
return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
|
|
57051
|
+
};
|
|
57052
|
+
|
|
57053
|
+
Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
|
|
57054
|
+
return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
|
|
57055
|
+
};
|
|
57056
|
+
|
|
57057
|
+
function hexWrite (buf, string, offset, length) {
|
|
57058
|
+
offset = Number(offset) || 0;
|
|
57059
|
+
var remaining = buf.length - offset;
|
|
57060
|
+
if (!length) {
|
|
57061
|
+
length = remaining;
|
|
57062
|
+
} else {
|
|
57063
|
+
length = Number(length);
|
|
57064
|
+
if (length > remaining) {
|
|
57065
|
+
length = remaining;
|
|
57066
|
+
}
|
|
57067
|
+
}
|
|
57068
|
+
|
|
57069
|
+
// must be an even number of digits
|
|
57070
|
+
var strLen = string.length;
|
|
57071
|
+
if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
|
|
57072
|
+
|
|
57073
|
+
if (length > strLen / 2) {
|
|
57074
|
+
length = strLen / 2;
|
|
57075
|
+
}
|
|
57076
|
+
for (var i = 0; i < length; ++i) {
|
|
57077
|
+
var parsed = parseInt(string.substr(i * 2, 2), 16);
|
|
57078
|
+
if (isNaN(parsed)) return i
|
|
57079
|
+
buf[offset + i] = parsed;
|
|
57080
|
+
}
|
|
57081
|
+
return i
|
|
57082
|
+
}
|
|
57083
|
+
|
|
57084
|
+
function utf8Write (buf, string, offset, length) {
|
|
57085
|
+
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
|
|
57086
|
+
}
|
|
57087
|
+
|
|
57088
|
+
function asciiWrite (buf, string, offset, length) {
|
|
57089
|
+
return blitBuffer(asciiToBytes(string), buf, offset, length)
|
|
57090
|
+
}
|
|
57091
|
+
|
|
57092
|
+
function latin1Write (buf, string, offset, length) {
|
|
57093
|
+
return asciiWrite(buf, string, offset, length)
|
|
57094
|
+
}
|
|
57095
|
+
|
|
57096
|
+
function base64Write (buf, string, offset, length) {
|
|
57097
|
+
return blitBuffer(base64ToBytes(string), buf, offset, length)
|
|
57098
|
+
}
|
|
57099
|
+
|
|
57100
|
+
function ucs2Write (buf, string, offset, length) {
|
|
57101
|
+
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
|
|
57102
|
+
}
|
|
57103
|
+
|
|
57104
|
+
Buffer.prototype.write = function write (string, offset, length, encoding) {
|
|
57105
|
+
// Buffer#write(string)
|
|
57106
|
+
if (offset === undefined) {
|
|
57107
|
+
encoding = 'utf8';
|
|
57108
|
+
length = this.length;
|
|
57109
|
+
offset = 0;
|
|
57110
|
+
// Buffer#write(string, encoding)
|
|
57111
|
+
} else if (length === undefined && typeof offset === 'string') {
|
|
57112
|
+
encoding = offset;
|
|
57113
|
+
length = this.length;
|
|
57114
|
+
offset = 0;
|
|
57115
|
+
// Buffer#write(string, offset[, length][, encoding])
|
|
57116
|
+
} else if (isFinite(offset)) {
|
|
57117
|
+
offset = offset | 0;
|
|
57118
|
+
if (isFinite(length)) {
|
|
57119
|
+
length = length | 0;
|
|
57120
|
+
if (encoding === undefined) encoding = 'utf8';
|
|
57121
|
+
} else {
|
|
57122
|
+
encoding = length;
|
|
57123
|
+
length = undefined;
|
|
57124
|
+
}
|
|
57125
|
+
// legacy write(string, encoding, offset, length) - remove in v0.13
|
|
57126
|
+
} else {
|
|
57127
|
+
throw new Error(
|
|
57128
|
+
'Buffer.write(string, encoding, offset[, length]) is no longer supported'
|
|
57129
|
+
)
|
|
57130
|
+
}
|
|
57131
|
+
|
|
57132
|
+
var remaining = this.length - offset;
|
|
57133
|
+
if (length === undefined || length > remaining) length = remaining;
|
|
57134
|
+
|
|
57135
|
+
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
|
|
57136
|
+
throw new RangeError('Attempt to write outside buffer bounds')
|
|
57137
|
+
}
|
|
57138
|
+
|
|
57139
|
+
if (!encoding) encoding = 'utf8';
|
|
57140
|
+
|
|
57141
|
+
var loweredCase = false;
|
|
57142
|
+
for (;;) {
|
|
57143
|
+
switch (encoding) {
|
|
57144
|
+
case 'hex':
|
|
57145
|
+
return hexWrite(this, string, offset, length)
|
|
57146
|
+
|
|
57147
|
+
case 'utf8':
|
|
57148
|
+
case 'utf-8':
|
|
57149
|
+
return utf8Write(this, string, offset, length)
|
|
57150
|
+
|
|
57151
|
+
case 'ascii':
|
|
57152
|
+
return asciiWrite(this, string, offset, length)
|
|
57153
|
+
|
|
57154
|
+
case 'latin1':
|
|
57155
|
+
case 'binary':
|
|
57156
|
+
return latin1Write(this, string, offset, length)
|
|
57157
|
+
|
|
57158
|
+
case 'base64':
|
|
57159
|
+
// Warning: maxLength not taken into account in base64Write
|
|
57160
|
+
return base64Write(this, string, offset, length)
|
|
57161
|
+
|
|
57162
|
+
case 'ucs2':
|
|
57163
|
+
case 'ucs-2':
|
|
57164
|
+
case 'utf16le':
|
|
57165
|
+
case 'utf-16le':
|
|
57166
|
+
return ucs2Write(this, string, offset, length)
|
|
57167
|
+
|
|
57168
|
+
default:
|
|
57169
|
+
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
|
|
57170
|
+
encoding = ('' + encoding).toLowerCase();
|
|
57171
|
+
loweredCase = true;
|
|
57172
|
+
}
|
|
57173
|
+
}
|
|
57174
|
+
};
|
|
57175
|
+
|
|
57176
|
+
Buffer.prototype.toJSON = function toJSON () {
|
|
57177
|
+
return {
|
|
57178
|
+
type: 'Buffer',
|
|
57179
|
+
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
57180
|
+
}
|
|
57181
|
+
};
|
|
57182
|
+
|
|
57183
|
+
function base64Slice (buf, start, end) {
|
|
57184
|
+
if (start === 0 && end === buf.length) {
|
|
57185
|
+
return fromByteArray(buf)
|
|
57186
|
+
} else {
|
|
57187
|
+
return fromByteArray(buf.slice(start, end))
|
|
57188
|
+
}
|
|
57189
|
+
}
|
|
57190
|
+
|
|
57191
|
+
function utf8Slice (buf, start, end) {
|
|
57192
|
+
end = Math.min(buf.length, end);
|
|
57193
|
+
var res = [];
|
|
57194
|
+
|
|
57195
|
+
var i = start;
|
|
57196
|
+
while (i < end) {
|
|
57197
|
+
var firstByte = buf[i];
|
|
57198
|
+
var codePoint = null;
|
|
57199
|
+
var bytesPerSequence = (firstByte > 0xEF) ? 4
|
|
57200
|
+
: (firstByte > 0xDF) ? 3
|
|
57201
|
+
: (firstByte > 0xBF) ? 2
|
|
57202
|
+
: 1;
|
|
57203
|
+
|
|
57204
|
+
if (i + bytesPerSequence <= end) {
|
|
57205
|
+
var secondByte, thirdByte, fourthByte, tempCodePoint;
|
|
57206
|
+
|
|
57207
|
+
switch (bytesPerSequence) {
|
|
57208
|
+
case 1:
|
|
57209
|
+
if (firstByte < 0x80) {
|
|
57210
|
+
codePoint = firstByte;
|
|
57211
|
+
}
|
|
57212
|
+
break
|
|
57213
|
+
case 2:
|
|
57214
|
+
secondByte = buf[i + 1];
|
|
57215
|
+
if ((secondByte & 0xC0) === 0x80) {
|
|
57216
|
+
tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);
|
|
57217
|
+
if (tempCodePoint > 0x7F) {
|
|
57218
|
+
codePoint = tempCodePoint;
|
|
57219
|
+
}
|
|
57220
|
+
}
|
|
57221
|
+
break
|
|
57222
|
+
case 3:
|
|
57223
|
+
secondByte = buf[i + 1];
|
|
57224
|
+
thirdByte = buf[i + 2];
|
|
57225
|
+
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
|
|
57226
|
+
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);
|
|
57227
|
+
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
|
|
57228
|
+
codePoint = tempCodePoint;
|
|
57229
|
+
}
|
|
57230
|
+
}
|
|
57231
|
+
break
|
|
57232
|
+
case 4:
|
|
57233
|
+
secondByte = buf[i + 1];
|
|
57234
|
+
thirdByte = buf[i + 2];
|
|
57235
|
+
fourthByte = buf[i + 3];
|
|
57236
|
+
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
|
|
57237
|
+
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);
|
|
57238
|
+
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
|
|
57239
|
+
codePoint = tempCodePoint;
|
|
57240
|
+
}
|
|
57241
|
+
}
|
|
57242
|
+
}
|
|
57243
|
+
}
|
|
57244
|
+
|
|
57245
|
+
if (codePoint === null) {
|
|
57246
|
+
// we did not generate a valid codePoint so insert a
|
|
57247
|
+
// replacement char (U+FFFD) and advance only 1 byte
|
|
57248
|
+
codePoint = 0xFFFD;
|
|
57249
|
+
bytesPerSequence = 1;
|
|
57250
|
+
} else if (codePoint > 0xFFFF) {
|
|
57251
|
+
// encode to utf16 (surrogate pair dance)
|
|
57252
|
+
codePoint -= 0x10000;
|
|
57253
|
+
res.push(codePoint >>> 10 & 0x3FF | 0xD800);
|
|
57254
|
+
codePoint = 0xDC00 | codePoint & 0x3FF;
|
|
57255
|
+
}
|
|
57256
|
+
|
|
57257
|
+
res.push(codePoint);
|
|
57258
|
+
i += bytesPerSequence;
|
|
57259
|
+
}
|
|
57260
|
+
|
|
57261
|
+
return decodeCodePointsArray(res)
|
|
57262
|
+
}
|
|
57263
|
+
|
|
57264
|
+
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
|
|
57265
|
+
// the lowest limit is Chrome, with 0x10000 args.
|
|
57266
|
+
// We go 1 magnitude less, for safety
|
|
57267
|
+
var MAX_ARGUMENTS_LENGTH = 0x1000;
|
|
57268
|
+
|
|
57269
|
+
function decodeCodePointsArray (codePoints) {
|
|
57270
|
+
var len = codePoints.length;
|
|
57271
|
+
if (len <= MAX_ARGUMENTS_LENGTH) {
|
|
57272
|
+
return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
|
|
57273
|
+
}
|
|
57274
|
+
|
|
57275
|
+
// Decode in chunks to avoid "call stack size exceeded".
|
|
57276
|
+
var res = '';
|
|
57277
|
+
var i = 0;
|
|
57278
|
+
while (i < len) {
|
|
57279
|
+
res += String.fromCharCode.apply(
|
|
57280
|
+
String,
|
|
57281
|
+
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
|
|
57282
|
+
);
|
|
57283
|
+
}
|
|
57284
|
+
return res
|
|
57285
|
+
}
|
|
57286
|
+
|
|
57287
|
+
function asciiSlice (buf, start, end) {
|
|
57288
|
+
var ret = '';
|
|
57289
|
+
end = Math.min(buf.length, end);
|
|
57290
|
+
|
|
57291
|
+
for (var i = start; i < end; ++i) {
|
|
57292
|
+
ret += String.fromCharCode(buf[i] & 0x7F);
|
|
57293
|
+
}
|
|
57294
|
+
return ret
|
|
57295
|
+
}
|
|
57296
|
+
|
|
57297
|
+
function latin1Slice (buf, start, end) {
|
|
57298
|
+
var ret = '';
|
|
57299
|
+
end = Math.min(buf.length, end);
|
|
57300
|
+
|
|
57301
|
+
for (var i = start; i < end; ++i) {
|
|
57302
|
+
ret += String.fromCharCode(buf[i]);
|
|
57303
|
+
}
|
|
57304
|
+
return ret
|
|
57305
|
+
}
|
|
57306
|
+
|
|
57307
|
+
function hexSlice (buf, start, end) {
|
|
57308
|
+
var len = buf.length;
|
|
57309
|
+
|
|
57310
|
+
if (!start || start < 0) start = 0;
|
|
57311
|
+
if (!end || end < 0 || end > len) end = len;
|
|
57312
|
+
|
|
57313
|
+
var out = '';
|
|
57314
|
+
for (var i = start; i < end; ++i) {
|
|
57315
|
+
out += toHex(buf[i]);
|
|
57316
|
+
}
|
|
57317
|
+
return out
|
|
57318
|
+
}
|
|
57319
|
+
|
|
57320
|
+
function utf16leSlice (buf, start, end) {
|
|
57321
|
+
var bytes = buf.slice(start, end);
|
|
57322
|
+
var res = '';
|
|
57323
|
+
for (var i = 0; i < bytes.length; i += 2) {
|
|
57324
|
+
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
|
|
57325
|
+
}
|
|
57326
|
+
return res
|
|
57327
|
+
}
|
|
57328
|
+
|
|
57329
|
+
Buffer.prototype.slice = function slice (start, end) {
|
|
57330
|
+
var len = this.length;
|
|
57331
|
+
start = ~~start;
|
|
57332
|
+
end = end === undefined ? len : ~~end;
|
|
57333
|
+
|
|
57334
|
+
if (start < 0) {
|
|
57335
|
+
start += len;
|
|
57336
|
+
if (start < 0) start = 0;
|
|
57337
|
+
} else if (start > len) {
|
|
57338
|
+
start = len;
|
|
57339
|
+
}
|
|
57340
|
+
|
|
57341
|
+
if (end < 0) {
|
|
57342
|
+
end += len;
|
|
57343
|
+
if (end < 0) end = 0;
|
|
57344
|
+
} else if (end > len) {
|
|
57345
|
+
end = len;
|
|
57346
|
+
}
|
|
57347
|
+
|
|
57348
|
+
if (end < start) end = start;
|
|
57349
|
+
|
|
57350
|
+
var newBuf;
|
|
57351
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
57352
|
+
newBuf = this.subarray(start, end);
|
|
57353
|
+
newBuf.__proto__ = Buffer.prototype;
|
|
57354
|
+
} else {
|
|
57355
|
+
var sliceLen = end - start;
|
|
57356
|
+
newBuf = new Buffer(sliceLen, undefined);
|
|
57357
|
+
for (var i = 0; i < sliceLen; ++i) {
|
|
57358
|
+
newBuf[i] = this[i + start];
|
|
57359
|
+
}
|
|
57360
|
+
}
|
|
57361
|
+
|
|
57362
|
+
return newBuf
|
|
57363
|
+
};
|
|
57364
|
+
|
|
57365
|
+
/*
|
|
57366
|
+
* Need to make sure that buffer isn't trying to write out of bounds.
|
|
57367
|
+
*/
|
|
57368
|
+
function checkOffset (offset, ext, length) {
|
|
57369
|
+
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
|
|
57370
|
+
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
|
|
57371
|
+
}
|
|
57372
|
+
|
|
57373
|
+
Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
|
|
57374
|
+
offset = offset | 0;
|
|
57375
|
+
byteLength = byteLength | 0;
|
|
57376
|
+
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
57377
|
+
|
|
57378
|
+
var val = this[offset];
|
|
57379
|
+
var mul = 1;
|
|
57380
|
+
var i = 0;
|
|
57381
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
|
57382
|
+
val += this[offset + i] * mul;
|
|
57383
|
+
}
|
|
57384
|
+
|
|
57385
|
+
return val
|
|
57386
|
+
};
|
|
57387
|
+
|
|
57388
|
+
Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
|
|
57389
|
+
offset = offset | 0;
|
|
57390
|
+
byteLength = byteLength | 0;
|
|
57391
|
+
if (!noAssert) {
|
|
57392
|
+
checkOffset(offset, byteLength, this.length);
|
|
57393
|
+
}
|
|
57394
|
+
|
|
57395
|
+
var val = this[offset + --byteLength];
|
|
57396
|
+
var mul = 1;
|
|
57397
|
+
while (byteLength > 0 && (mul *= 0x100)) {
|
|
57398
|
+
val += this[offset + --byteLength] * mul;
|
|
57399
|
+
}
|
|
57400
|
+
|
|
57401
|
+
return val
|
|
57402
|
+
};
|
|
57403
|
+
|
|
57404
|
+
Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
|
|
57405
|
+
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
57406
|
+
return this[offset]
|
|
57407
|
+
};
|
|
57408
|
+
|
|
57409
|
+
Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
|
|
57410
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
57411
|
+
return this[offset] | (this[offset + 1] << 8)
|
|
57412
|
+
};
|
|
57413
|
+
|
|
57414
|
+
Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
|
|
57415
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
57416
|
+
return (this[offset] << 8) | this[offset + 1]
|
|
57417
|
+
};
|
|
57418
|
+
|
|
57419
|
+
Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
|
|
57420
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
57421
|
+
|
|
57422
|
+
return ((this[offset]) |
|
|
57423
|
+
(this[offset + 1] << 8) |
|
|
57424
|
+
(this[offset + 2] << 16)) +
|
|
57425
|
+
(this[offset + 3] * 0x1000000)
|
|
57426
|
+
};
|
|
57427
|
+
|
|
57428
|
+
Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
|
|
57429
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
57430
|
+
|
|
57431
|
+
return (this[offset] * 0x1000000) +
|
|
57432
|
+
((this[offset + 1] << 16) |
|
|
57433
|
+
(this[offset + 2] << 8) |
|
|
57434
|
+
this[offset + 3])
|
|
57435
|
+
};
|
|
57436
|
+
|
|
57437
|
+
Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
|
|
57438
|
+
offset = offset | 0;
|
|
57439
|
+
byteLength = byteLength | 0;
|
|
57440
|
+
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
57441
|
+
|
|
57442
|
+
var val = this[offset];
|
|
57443
|
+
var mul = 1;
|
|
57444
|
+
var i = 0;
|
|
57445
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
|
57446
|
+
val += this[offset + i] * mul;
|
|
57447
|
+
}
|
|
57448
|
+
mul *= 0x80;
|
|
57449
|
+
|
|
57450
|
+
if (val >= mul) val -= Math.pow(2, 8 * byteLength);
|
|
57451
|
+
|
|
57452
|
+
return val
|
|
57453
|
+
};
|
|
57454
|
+
|
|
57455
|
+
Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
|
|
57456
|
+
offset = offset | 0;
|
|
57457
|
+
byteLength = byteLength | 0;
|
|
57458
|
+
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
57459
|
+
|
|
57460
|
+
var i = byteLength;
|
|
57461
|
+
var mul = 1;
|
|
57462
|
+
var val = this[offset + --i];
|
|
57463
|
+
while (i > 0 && (mul *= 0x100)) {
|
|
57464
|
+
val += this[offset + --i] * mul;
|
|
57465
|
+
}
|
|
57466
|
+
mul *= 0x80;
|
|
57467
|
+
|
|
57468
|
+
if (val >= mul) val -= Math.pow(2, 8 * byteLength);
|
|
57469
|
+
|
|
57470
|
+
return val
|
|
57471
|
+
};
|
|
57472
|
+
|
|
57473
|
+
Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
|
|
57474
|
+
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
57475
|
+
if (!(this[offset] & 0x80)) return (this[offset])
|
|
57476
|
+
return ((0xff - this[offset] + 1) * -1)
|
|
57477
|
+
};
|
|
57478
|
+
|
|
57479
|
+
Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
|
|
57480
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
57481
|
+
var val = this[offset] | (this[offset + 1] << 8);
|
|
57482
|
+
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
57483
|
+
};
|
|
57484
|
+
|
|
57485
|
+
Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
|
|
57486
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
57487
|
+
var val = this[offset + 1] | (this[offset] << 8);
|
|
57488
|
+
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
57489
|
+
};
|
|
57490
|
+
|
|
57491
|
+
Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
|
|
57492
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
57493
|
+
|
|
57494
|
+
return (this[offset]) |
|
|
57495
|
+
(this[offset + 1] << 8) |
|
|
57496
|
+
(this[offset + 2] << 16) |
|
|
57497
|
+
(this[offset + 3] << 24)
|
|
57498
|
+
};
|
|
57499
|
+
|
|
57500
|
+
Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
|
|
57501
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
57502
|
+
|
|
57503
|
+
return (this[offset] << 24) |
|
|
57504
|
+
(this[offset + 1] << 16) |
|
|
57505
|
+
(this[offset + 2] << 8) |
|
|
57506
|
+
(this[offset + 3])
|
|
57507
|
+
};
|
|
57508
|
+
|
|
57509
|
+
Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
|
|
57510
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
57511
|
+
return read(this, offset, true, 23, 4)
|
|
57512
|
+
};
|
|
57513
|
+
|
|
57514
|
+
Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
|
|
57515
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
57516
|
+
return read(this, offset, false, 23, 4)
|
|
57517
|
+
};
|
|
57518
|
+
|
|
57519
|
+
Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
|
|
57520
|
+
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
57521
|
+
return read(this, offset, true, 52, 8)
|
|
57522
|
+
};
|
|
57523
|
+
|
|
57524
|
+
Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
|
|
57525
|
+
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
57526
|
+
return read(this, offset, false, 52, 8)
|
|
57527
|
+
};
|
|
57528
|
+
|
|
57529
|
+
function checkInt (buf, value, offset, ext, max, min) {
|
|
57530
|
+
if (!internalIsBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
|
|
57531
|
+
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
|
|
57532
|
+
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
|
57533
|
+
}
|
|
57534
|
+
|
|
57535
|
+
Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
|
|
57536
|
+
value = +value;
|
|
57537
|
+
offset = offset | 0;
|
|
57538
|
+
byteLength = byteLength | 0;
|
|
57539
|
+
if (!noAssert) {
|
|
57540
|
+
var maxBytes = Math.pow(2, 8 * byteLength) - 1;
|
|
57541
|
+
checkInt(this, value, offset, byteLength, maxBytes, 0);
|
|
57542
|
+
}
|
|
57543
|
+
|
|
57544
|
+
var mul = 1;
|
|
57545
|
+
var i = 0;
|
|
57546
|
+
this[offset] = value & 0xFF;
|
|
57547
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
|
57548
|
+
this[offset + i] = (value / mul) & 0xFF;
|
|
57549
|
+
}
|
|
57550
|
+
|
|
57551
|
+
return offset + byteLength
|
|
57552
|
+
};
|
|
57553
|
+
|
|
57554
|
+
Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
|
|
57555
|
+
value = +value;
|
|
57556
|
+
offset = offset | 0;
|
|
57557
|
+
byteLength = byteLength | 0;
|
|
57558
|
+
if (!noAssert) {
|
|
57559
|
+
var maxBytes = Math.pow(2, 8 * byteLength) - 1;
|
|
57560
|
+
checkInt(this, value, offset, byteLength, maxBytes, 0);
|
|
57561
|
+
}
|
|
57562
|
+
|
|
57563
|
+
var i = byteLength - 1;
|
|
57564
|
+
var mul = 1;
|
|
57565
|
+
this[offset + i] = value & 0xFF;
|
|
57566
|
+
while (--i >= 0 && (mul *= 0x100)) {
|
|
57567
|
+
this[offset + i] = (value / mul) & 0xFF;
|
|
57568
|
+
}
|
|
57569
|
+
|
|
57570
|
+
return offset + byteLength
|
|
57571
|
+
};
|
|
57572
|
+
|
|
57573
|
+
Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
|
|
57574
|
+
value = +value;
|
|
57575
|
+
offset = offset | 0;
|
|
57576
|
+
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
|
|
57577
|
+
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
|
|
57578
|
+
this[offset] = (value & 0xff);
|
|
57579
|
+
return offset + 1
|
|
57580
|
+
};
|
|
57581
|
+
|
|
57582
|
+
function objectWriteUInt16 (buf, value, offset, littleEndian) {
|
|
57583
|
+
if (value < 0) value = 0xffff + value + 1;
|
|
57584
|
+
for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
|
|
57585
|
+
buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
|
|
57586
|
+
(littleEndian ? i : 1 - i) * 8;
|
|
57587
|
+
}
|
|
57588
|
+
}
|
|
57589
|
+
|
|
57590
|
+
Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
|
|
57591
|
+
value = +value;
|
|
57592
|
+
offset = offset | 0;
|
|
57593
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
|
|
57594
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
57595
|
+
this[offset] = (value & 0xff);
|
|
57596
|
+
this[offset + 1] = (value >>> 8);
|
|
57597
|
+
} else {
|
|
57598
|
+
objectWriteUInt16(this, value, offset, true);
|
|
57599
|
+
}
|
|
57600
|
+
return offset + 2
|
|
57601
|
+
};
|
|
57602
|
+
|
|
57603
|
+
Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
|
|
57604
|
+
value = +value;
|
|
57605
|
+
offset = offset | 0;
|
|
57606
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
|
|
57607
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
57608
|
+
this[offset] = (value >>> 8);
|
|
57609
|
+
this[offset + 1] = (value & 0xff);
|
|
57610
|
+
} else {
|
|
57611
|
+
objectWriteUInt16(this, value, offset, false);
|
|
57612
|
+
}
|
|
57613
|
+
return offset + 2
|
|
57614
|
+
};
|
|
57615
|
+
|
|
57616
|
+
function objectWriteUInt32 (buf, value, offset, littleEndian) {
|
|
57617
|
+
if (value < 0) value = 0xffffffff + value + 1;
|
|
57618
|
+
for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
|
|
57619
|
+
buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff;
|
|
57620
|
+
}
|
|
57621
|
+
}
|
|
57622
|
+
|
|
57623
|
+
Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
|
|
57624
|
+
value = +value;
|
|
57625
|
+
offset = offset | 0;
|
|
57626
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
|
|
57627
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
57628
|
+
this[offset + 3] = (value >>> 24);
|
|
57629
|
+
this[offset + 2] = (value >>> 16);
|
|
57630
|
+
this[offset + 1] = (value >>> 8);
|
|
57631
|
+
this[offset] = (value & 0xff);
|
|
57632
|
+
} else {
|
|
57633
|
+
objectWriteUInt32(this, value, offset, true);
|
|
57634
|
+
}
|
|
57635
|
+
return offset + 4
|
|
57636
|
+
};
|
|
57637
|
+
|
|
57638
|
+
Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
|
|
57639
|
+
value = +value;
|
|
57640
|
+
offset = offset | 0;
|
|
57641
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
|
|
57642
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
57643
|
+
this[offset] = (value >>> 24);
|
|
57644
|
+
this[offset + 1] = (value >>> 16);
|
|
57645
|
+
this[offset + 2] = (value >>> 8);
|
|
57646
|
+
this[offset + 3] = (value & 0xff);
|
|
57647
|
+
} else {
|
|
57648
|
+
objectWriteUInt32(this, value, offset, false);
|
|
57649
|
+
}
|
|
57650
|
+
return offset + 4
|
|
57651
|
+
};
|
|
57652
|
+
|
|
57653
|
+
Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
|
|
57654
|
+
value = +value;
|
|
57655
|
+
offset = offset | 0;
|
|
57656
|
+
if (!noAssert) {
|
|
57657
|
+
var limit = Math.pow(2, 8 * byteLength - 1);
|
|
57658
|
+
|
|
57659
|
+
checkInt(this, value, offset, byteLength, limit - 1, -limit);
|
|
57660
|
+
}
|
|
57661
|
+
|
|
57662
|
+
var i = 0;
|
|
57663
|
+
var mul = 1;
|
|
57664
|
+
var sub = 0;
|
|
57665
|
+
this[offset] = value & 0xFF;
|
|
57666
|
+
while (++i < byteLength && (mul *= 0x100)) {
|
|
57667
|
+
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
|
|
57668
|
+
sub = 1;
|
|
57669
|
+
}
|
|
57670
|
+
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
|
|
57671
|
+
}
|
|
57672
|
+
|
|
57673
|
+
return offset + byteLength
|
|
57674
|
+
};
|
|
57675
|
+
|
|
57676
|
+
Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
|
|
57677
|
+
value = +value;
|
|
57678
|
+
offset = offset | 0;
|
|
57679
|
+
if (!noAssert) {
|
|
57680
|
+
var limit = Math.pow(2, 8 * byteLength - 1);
|
|
57681
|
+
|
|
57682
|
+
checkInt(this, value, offset, byteLength, limit - 1, -limit);
|
|
57683
|
+
}
|
|
57684
|
+
|
|
57685
|
+
var i = byteLength - 1;
|
|
57686
|
+
var mul = 1;
|
|
57687
|
+
var sub = 0;
|
|
57688
|
+
this[offset + i] = value & 0xFF;
|
|
57689
|
+
while (--i >= 0 && (mul *= 0x100)) {
|
|
57690
|
+
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
|
|
57691
|
+
sub = 1;
|
|
57692
|
+
}
|
|
57693
|
+
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
|
|
57694
|
+
}
|
|
57695
|
+
|
|
57696
|
+
return offset + byteLength
|
|
57697
|
+
};
|
|
57698
|
+
|
|
57699
|
+
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
|
|
57700
|
+
value = +value;
|
|
57701
|
+
offset = offset | 0;
|
|
57702
|
+
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
|
|
57703
|
+
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
|
|
57704
|
+
if (value < 0) value = 0xff + value + 1;
|
|
57705
|
+
this[offset] = (value & 0xff);
|
|
57706
|
+
return offset + 1
|
|
57707
|
+
};
|
|
57708
|
+
|
|
57709
|
+
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
|
|
57710
|
+
value = +value;
|
|
57711
|
+
offset = offset | 0;
|
|
57712
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
|
|
57713
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
57714
|
+
this[offset] = (value & 0xff);
|
|
57715
|
+
this[offset + 1] = (value >>> 8);
|
|
57716
|
+
} else {
|
|
57717
|
+
objectWriteUInt16(this, value, offset, true);
|
|
57718
|
+
}
|
|
57719
|
+
return offset + 2
|
|
57720
|
+
};
|
|
57721
|
+
|
|
57722
|
+
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
|
|
57723
|
+
value = +value;
|
|
57724
|
+
offset = offset | 0;
|
|
57725
|
+
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
|
|
57726
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
57727
|
+
this[offset] = (value >>> 8);
|
|
57728
|
+
this[offset + 1] = (value & 0xff);
|
|
57729
|
+
} else {
|
|
57730
|
+
objectWriteUInt16(this, value, offset, false);
|
|
57731
|
+
}
|
|
57732
|
+
return offset + 2
|
|
57733
|
+
};
|
|
57734
|
+
|
|
57735
|
+
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
|
|
57736
|
+
value = +value;
|
|
57737
|
+
offset = offset | 0;
|
|
57738
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
|
|
57739
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
57740
|
+
this[offset] = (value & 0xff);
|
|
57741
|
+
this[offset + 1] = (value >>> 8);
|
|
57742
|
+
this[offset + 2] = (value >>> 16);
|
|
57743
|
+
this[offset + 3] = (value >>> 24);
|
|
57744
|
+
} else {
|
|
57745
|
+
objectWriteUInt32(this, value, offset, true);
|
|
57746
|
+
}
|
|
57747
|
+
return offset + 4
|
|
57748
|
+
};
|
|
57749
|
+
|
|
57750
|
+
Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
|
|
57751
|
+
value = +value;
|
|
57752
|
+
offset = offset | 0;
|
|
57753
|
+
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
|
|
57754
|
+
if (value < 0) value = 0xffffffff + value + 1;
|
|
57755
|
+
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
57756
|
+
this[offset] = (value >>> 24);
|
|
57757
|
+
this[offset + 1] = (value >>> 16);
|
|
57758
|
+
this[offset + 2] = (value >>> 8);
|
|
57759
|
+
this[offset + 3] = (value & 0xff);
|
|
57760
|
+
} else {
|
|
57761
|
+
objectWriteUInt32(this, value, offset, false);
|
|
57762
|
+
}
|
|
57763
|
+
return offset + 4
|
|
57764
|
+
};
|
|
57765
|
+
|
|
57766
|
+
function checkIEEE754 (buf, value, offset, ext, max, min) {
|
|
57767
|
+
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
|
57768
|
+
if (offset < 0) throw new RangeError('Index out of range')
|
|
57769
|
+
}
|
|
57770
|
+
|
|
57771
|
+
function writeFloat (buf, value, offset, littleEndian, noAssert) {
|
|
57772
|
+
if (!noAssert) {
|
|
57773
|
+
checkIEEE754(buf, value, offset, 4);
|
|
57774
|
+
}
|
|
57775
|
+
write(buf, value, offset, littleEndian, 23, 4);
|
|
57776
|
+
return offset + 4
|
|
57777
|
+
}
|
|
57778
|
+
|
|
57779
|
+
Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
|
|
57780
|
+
return writeFloat(this, value, offset, true, noAssert)
|
|
57781
|
+
};
|
|
57782
|
+
|
|
57783
|
+
Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
|
|
57784
|
+
return writeFloat(this, value, offset, false, noAssert)
|
|
57785
|
+
};
|
|
57786
|
+
|
|
57787
|
+
function writeDouble (buf, value, offset, littleEndian, noAssert) {
|
|
57788
|
+
if (!noAssert) {
|
|
57789
|
+
checkIEEE754(buf, value, offset, 8);
|
|
57790
|
+
}
|
|
57791
|
+
write(buf, value, offset, littleEndian, 52, 8);
|
|
57792
|
+
return offset + 8
|
|
57793
|
+
}
|
|
57794
|
+
|
|
57795
|
+
Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
|
|
57796
|
+
return writeDouble(this, value, offset, true, noAssert)
|
|
57797
|
+
};
|
|
57798
|
+
|
|
57799
|
+
Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
|
|
57800
|
+
return writeDouble(this, value, offset, false, noAssert)
|
|
57801
|
+
};
|
|
57802
|
+
|
|
57803
|
+
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
|
|
57804
|
+
Buffer.prototype.copy = function copy (target, targetStart, start, end) {
|
|
57805
|
+
if (!start) start = 0;
|
|
57806
|
+
if (!end && end !== 0) end = this.length;
|
|
57807
|
+
if (targetStart >= target.length) targetStart = target.length;
|
|
57808
|
+
if (!targetStart) targetStart = 0;
|
|
57809
|
+
if (end > 0 && end < start) end = start;
|
|
57810
|
+
|
|
57811
|
+
// Copy 0 bytes; we're done
|
|
57812
|
+
if (end === start) return 0
|
|
57813
|
+
if (target.length === 0 || this.length === 0) return 0
|
|
57814
|
+
|
|
57815
|
+
// Fatal error conditions
|
|
57816
|
+
if (targetStart < 0) {
|
|
57817
|
+
throw new RangeError('targetStart out of bounds')
|
|
57818
|
+
}
|
|
57819
|
+
if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
|
|
57820
|
+
if (end < 0) throw new RangeError('sourceEnd out of bounds')
|
|
57821
|
+
|
|
57822
|
+
// Are we oob?
|
|
57823
|
+
if (end > this.length) end = this.length;
|
|
57824
|
+
if (target.length - targetStart < end - start) {
|
|
57825
|
+
end = target.length - targetStart + start;
|
|
57826
|
+
}
|
|
57827
|
+
|
|
57828
|
+
var len = end - start;
|
|
57829
|
+
var i;
|
|
57830
|
+
|
|
57831
|
+
if (this === target && start < targetStart && targetStart < end) {
|
|
57832
|
+
// descending copy from end
|
|
57833
|
+
for (i = len - 1; i >= 0; --i) {
|
|
57834
|
+
target[i + targetStart] = this[i + start];
|
|
57835
|
+
}
|
|
57836
|
+
} else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
|
|
57837
|
+
// ascending copy from start
|
|
57838
|
+
for (i = 0; i < len; ++i) {
|
|
57839
|
+
target[i + targetStart] = this[i + start];
|
|
57840
|
+
}
|
|
57841
|
+
} else {
|
|
57842
|
+
Uint8Array.prototype.set.call(
|
|
57843
|
+
target,
|
|
57844
|
+
this.subarray(start, start + len),
|
|
57845
|
+
targetStart
|
|
57846
|
+
);
|
|
57847
|
+
}
|
|
57848
|
+
|
|
57849
|
+
return len
|
|
57850
|
+
};
|
|
57851
|
+
|
|
57852
|
+
// Usage:
|
|
57853
|
+
// buffer.fill(number[, offset[, end]])
|
|
57854
|
+
// buffer.fill(buffer[, offset[, end]])
|
|
57855
|
+
// buffer.fill(string[, offset[, end]][, encoding])
|
|
57856
|
+
Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
|
57857
|
+
// Handle string cases:
|
|
57858
|
+
if (typeof val === 'string') {
|
|
57859
|
+
if (typeof start === 'string') {
|
|
57860
|
+
encoding = start;
|
|
57861
|
+
start = 0;
|
|
57862
|
+
end = this.length;
|
|
57863
|
+
} else if (typeof end === 'string') {
|
|
57864
|
+
encoding = end;
|
|
57865
|
+
end = this.length;
|
|
57866
|
+
}
|
|
57867
|
+
if (val.length === 1) {
|
|
57868
|
+
var code = val.charCodeAt(0);
|
|
57869
|
+
if (code < 256) {
|
|
57870
|
+
val = code;
|
|
57871
|
+
}
|
|
57872
|
+
}
|
|
57873
|
+
if (encoding !== undefined && typeof encoding !== 'string') {
|
|
57874
|
+
throw new TypeError('encoding must be a string')
|
|
57875
|
+
}
|
|
57876
|
+
if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
|
|
57877
|
+
throw new TypeError('Unknown encoding: ' + encoding)
|
|
57878
|
+
}
|
|
57879
|
+
} else if (typeof val === 'number') {
|
|
57880
|
+
val = val & 255;
|
|
57881
|
+
}
|
|
57882
|
+
|
|
57883
|
+
// Invalid ranges are not set to a default, so can range check early.
|
|
57884
|
+
if (start < 0 || this.length < start || this.length < end) {
|
|
57885
|
+
throw new RangeError('Out of range index')
|
|
57886
|
+
}
|
|
57887
|
+
|
|
57888
|
+
if (end <= start) {
|
|
57889
|
+
return this
|
|
57890
|
+
}
|
|
57891
|
+
|
|
57892
|
+
start = start >>> 0;
|
|
57893
|
+
end = end === undefined ? this.length : end >>> 0;
|
|
57894
|
+
|
|
57895
|
+
if (!val) val = 0;
|
|
57896
|
+
|
|
57897
|
+
var i;
|
|
57898
|
+
if (typeof val === 'number') {
|
|
57899
|
+
for (i = start; i < end; ++i) {
|
|
57900
|
+
this[i] = val;
|
|
57901
|
+
}
|
|
57902
|
+
} else {
|
|
57903
|
+
var bytes = internalIsBuffer(val)
|
|
57904
|
+
? val
|
|
57905
|
+
: utf8ToBytes(new Buffer(val, encoding).toString());
|
|
57906
|
+
var len = bytes.length;
|
|
57907
|
+
for (i = 0; i < end - start; ++i) {
|
|
57908
|
+
this[i + start] = bytes[i % len];
|
|
57909
|
+
}
|
|
57910
|
+
}
|
|
57911
|
+
|
|
57912
|
+
return this
|
|
57913
|
+
};
|
|
57914
|
+
|
|
57915
|
+
// HELPER FUNCTIONS
|
|
57916
|
+
// ================
|
|
57917
|
+
|
|
57918
|
+
var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;
|
|
57919
|
+
|
|
57920
|
+
function base64clean (str) {
|
|
57921
|
+
// Node strips out invalid characters like \n and \t from the string, base64-js does not
|
|
57922
|
+
str = stringtrim(str).replace(INVALID_BASE64_RE, '');
|
|
57923
|
+
// Node converts strings with length < 2 to ''
|
|
57924
|
+
if (str.length < 2) return ''
|
|
57925
|
+
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
|
|
57926
|
+
while (str.length % 4 !== 0) {
|
|
57927
|
+
str = str + '=';
|
|
57928
|
+
}
|
|
57929
|
+
return str
|
|
57930
|
+
}
|
|
57931
|
+
|
|
57932
|
+
function stringtrim (str) {
|
|
57933
|
+
if (str.trim) return str.trim()
|
|
57934
|
+
return str.replace(/^\s+|\s+$/g, '')
|
|
57935
|
+
}
|
|
57936
|
+
|
|
57937
|
+
function toHex (n) {
|
|
57938
|
+
if (n < 16) return '0' + n.toString(16)
|
|
57939
|
+
return n.toString(16)
|
|
57940
|
+
}
|
|
57941
|
+
|
|
57942
|
+
function utf8ToBytes (string, units) {
|
|
57943
|
+
units = units || Infinity;
|
|
57944
|
+
var codePoint;
|
|
57945
|
+
var length = string.length;
|
|
57946
|
+
var leadSurrogate = null;
|
|
57947
|
+
var bytes = [];
|
|
57948
|
+
|
|
57949
|
+
for (var i = 0; i < length; ++i) {
|
|
57950
|
+
codePoint = string.charCodeAt(i);
|
|
57951
|
+
|
|
57952
|
+
// is surrogate component
|
|
57953
|
+
if (codePoint > 0xD7FF && codePoint < 0xE000) {
|
|
57954
|
+
// last char was a lead
|
|
57955
|
+
if (!leadSurrogate) {
|
|
57956
|
+
// no lead yet
|
|
57957
|
+
if (codePoint > 0xDBFF) {
|
|
57958
|
+
// unexpected trail
|
|
57959
|
+
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
57960
|
+
continue
|
|
57961
|
+
} else if (i + 1 === length) {
|
|
57962
|
+
// unpaired lead
|
|
57963
|
+
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
57964
|
+
continue
|
|
57965
|
+
}
|
|
57966
|
+
|
|
57967
|
+
// valid lead
|
|
57968
|
+
leadSurrogate = codePoint;
|
|
57969
|
+
|
|
57970
|
+
continue
|
|
57971
|
+
}
|
|
57972
|
+
|
|
57973
|
+
// 2 leads in a row
|
|
57974
|
+
if (codePoint < 0xDC00) {
|
|
57975
|
+
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
57976
|
+
leadSurrogate = codePoint;
|
|
57977
|
+
continue
|
|
57978
|
+
}
|
|
57979
|
+
|
|
57980
|
+
// valid surrogate pair
|
|
57981
|
+
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
|
|
57982
|
+
} else if (leadSurrogate) {
|
|
57983
|
+
// valid bmp char, but last char was a lead
|
|
57984
|
+
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
|
|
57985
|
+
}
|
|
57986
|
+
|
|
57987
|
+
leadSurrogate = null;
|
|
57988
|
+
|
|
57989
|
+
// encode utf8
|
|
57990
|
+
if (codePoint < 0x80) {
|
|
57991
|
+
if ((units -= 1) < 0) break
|
|
57992
|
+
bytes.push(codePoint);
|
|
57993
|
+
} else if (codePoint < 0x800) {
|
|
57994
|
+
if ((units -= 2) < 0) break
|
|
57995
|
+
bytes.push(
|
|
57996
|
+
codePoint >> 0x6 | 0xC0,
|
|
57997
|
+
codePoint & 0x3F | 0x80
|
|
57998
|
+
);
|
|
57999
|
+
} else if (codePoint < 0x10000) {
|
|
58000
|
+
if ((units -= 3) < 0) break
|
|
58001
|
+
bytes.push(
|
|
58002
|
+
codePoint >> 0xC | 0xE0,
|
|
58003
|
+
codePoint >> 0x6 & 0x3F | 0x80,
|
|
58004
|
+
codePoint & 0x3F | 0x80
|
|
58005
|
+
);
|
|
58006
|
+
} else if (codePoint < 0x110000) {
|
|
58007
|
+
if ((units -= 4) < 0) break
|
|
58008
|
+
bytes.push(
|
|
58009
|
+
codePoint >> 0x12 | 0xF0,
|
|
58010
|
+
codePoint >> 0xC & 0x3F | 0x80,
|
|
58011
|
+
codePoint >> 0x6 & 0x3F | 0x80,
|
|
58012
|
+
codePoint & 0x3F | 0x80
|
|
58013
|
+
);
|
|
58014
|
+
} else {
|
|
58015
|
+
throw new Error('Invalid code point')
|
|
58016
|
+
}
|
|
58017
|
+
}
|
|
58018
|
+
|
|
58019
|
+
return bytes
|
|
58020
|
+
}
|
|
58021
|
+
|
|
58022
|
+
function asciiToBytes (str) {
|
|
58023
|
+
var byteArray = [];
|
|
58024
|
+
for (var i = 0; i < str.length; ++i) {
|
|
58025
|
+
// Node's code seems to be doing this and not & 0x7F..
|
|
58026
|
+
byteArray.push(str.charCodeAt(i) & 0xFF);
|
|
58027
|
+
}
|
|
58028
|
+
return byteArray
|
|
58029
|
+
}
|
|
58030
|
+
|
|
58031
|
+
function utf16leToBytes (str, units) {
|
|
58032
|
+
var c, hi, lo;
|
|
58033
|
+
var byteArray = [];
|
|
58034
|
+
for (var i = 0; i < str.length; ++i) {
|
|
58035
|
+
if ((units -= 2) < 0) break
|
|
58036
|
+
|
|
58037
|
+
c = str.charCodeAt(i);
|
|
58038
|
+
hi = c >> 8;
|
|
58039
|
+
lo = c % 256;
|
|
58040
|
+
byteArray.push(lo);
|
|
58041
|
+
byteArray.push(hi);
|
|
58042
|
+
}
|
|
58043
|
+
|
|
58044
|
+
return byteArray
|
|
58045
|
+
}
|
|
58046
|
+
|
|
58047
|
+
|
|
58048
|
+
function base64ToBytes (str) {
|
|
58049
|
+
return toByteArray(base64clean(str))
|
|
58050
|
+
}
|
|
58051
|
+
|
|
58052
|
+
function blitBuffer (src, dst, offset, length) {
|
|
58053
|
+
for (var i = 0; i < length; ++i) {
|
|
58054
|
+
if ((i + offset >= dst.length) || (i >= src.length)) break
|
|
58055
|
+
dst[i + offset] = src[i];
|
|
58056
|
+
}
|
|
58057
|
+
return i
|
|
58058
|
+
}
|
|
58059
|
+
|
|
58060
|
+
function isnan (val) {
|
|
58061
|
+
return val !== val // eslint-disable-line no-self-compare
|
|
58062
|
+
}
|
|
58063
|
+
|
|
58064
|
+
|
|
58065
|
+
// the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence
|
|
58066
|
+
// The _isBuffer check is for Safari 5-7 support, because it's missing
|
|
58067
|
+
// Object.prototype.constructor. Remove this eventually
|
|
58068
|
+
function isBuffer(obj) {
|
|
58069
|
+
return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj))
|
|
58070
|
+
}
|
|
58071
|
+
|
|
58072
|
+
function isFastBuffer (obj) {
|
|
58073
|
+
return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
|
|
58074
|
+
}
|
|
58075
|
+
|
|
58076
|
+
// For Node v0.10 support. Remove this eventually.
|
|
58077
|
+
function isSlowBuffer (obj) {
|
|
58078
|
+
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0))
|
|
58079
|
+
}
|
|
58080
|
+
|
|
58081
|
+
var objectHash$1 = {exports: {}};
|
|
58082
|
+
|
|
58083
|
+
var empty = {};
|
|
58084
|
+
|
|
58085
|
+
var empty$1 = /*#__PURE__*/Object.freeze({
|
|
58086
|
+
__proto__: null,
|
|
58087
|
+
default: empty
|
|
58088
|
+
});
|
|
58089
|
+
|
|
58090
|
+
var require$$0 = /*@__PURE__*/getAugmentedNamespace(empty$1);
|
|
58091
|
+
|
|
58092
|
+
(function (module, exports) {
|
|
58093
|
+
|
|
58094
|
+
var crypto = require$$0;
|
|
58095
|
+
|
|
58096
|
+
/**
|
|
58097
|
+
* Exported function
|
|
58098
|
+
*
|
|
58099
|
+
* Options:
|
|
58100
|
+
*
|
|
58101
|
+
* - `algorithm` hash algo to be used by this instance: *'sha1', 'md5'
|
|
58102
|
+
* - `excludeValues` {true|*false} hash object keys, values ignored
|
|
58103
|
+
* - `encoding` hash encoding, supports 'buffer', '*hex', 'binary', 'base64'
|
|
58104
|
+
* - `ignoreUnknown` {true|*false} ignore unknown object types
|
|
58105
|
+
* - `replacer` optional function that replaces values before hashing
|
|
58106
|
+
* - `respectFunctionProperties` {*true|false} consider function properties when hashing
|
|
58107
|
+
* - `respectFunctionNames` {*true|false} consider 'name' property of functions for hashing
|
|
58108
|
+
* - `respectType` {*true|false} Respect special properties (prototype, constructor)
|
|
58109
|
+
* when hashing to distinguish between types
|
|
58110
|
+
* - `unorderedArrays` {true|*false} Sort all arrays before hashing
|
|
58111
|
+
* - `unorderedSets` {*true|false} Sort `Set` and `Map` instances before hashing
|
|
58112
|
+
* * = default
|
|
58113
|
+
*
|
|
58114
|
+
* @param {object} object value to hash
|
|
58115
|
+
* @param {object} options hashing options
|
|
58116
|
+
* @return {string} hash value
|
|
58117
|
+
* @api public
|
|
58118
|
+
*/
|
|
58119
|
+
exports = module.exports = objectHash;
|
|
58120
|
+
|
|
58121
|
+
function objectHash(object, options){
|
|
58122
|
+
options = applyDefaults(object, options);
|
|
58123
|
+
|
|
58124
|
+
return hash(object, options);
|
|
58125
|
+
}
|
|
58126
|
+
|
|
58127
|
+
/**
|
|
58128
|
+
* Exported sugar methods
|
|
58129
|
+
*
|
|
58130
|
+
* @param {object} object value to hash
|
|
58131
|
+
* @return {string} hash value
|
|
58132
|
+
* @api public
|
|
58133
|
+
*/
|
|
58134
|
+
exports.sha1 = function(object){
|
|
58135
|
+
return objectHash(object);
|
|
58136
|
+
};
|
|
58137
|
+
exports.keys = function(object){
|
|
58138
|
+
return objectHash(object, {excludeValues: true, algorithm: 'sha1', encoding: 'hex'});
|
|
58139
|
+
};
|
|
58140
|
+
exports.MD5 = function(object){
|
|
58141
|
+
return objectHash(object, {algorithm: 'md5', encoding: 'hex'});
|
|
58142
|
+
};
|
|
58143
|
+
exports.keysMD5 = function(object){
|
|
58144
|
+
return objectHash(object, {algorithm: 'md5', encoding: 'hex', excludeValues: true});
|
|
58145
|
+
};
|
|
58146
|
+
|
|
58147
|
+
// Internals
|
|
58148
|
+
var hashes = crypto.getHashes ? crypto.getHashes().slice() : ['sha1', 'md5'];
|
|
58149
|
+
hashes.push('passthrough');
|
|
58150
|
+
var encodings = ['buffer', 'hex', 'binary', 'base64'];
|
|
58151
|
+
|
|
58152
|
+
function applyDefaults(object, sourceOptions){
|
|
58153
|
+
sourceOptions = sourceOptions || {};
|
|
58154
|
+
|
|
58155
|
+
// create a copy rather than mutating
|
|
58156
|
+
var options = {};
|
|
58157
|
+
options.algorithm = sourceOptions.algorithm || 'sha1';
|
|
58158
|
+
options.encoding = sourceOptions.encoding || 'hex';
|
|
58159
|
+
options.excludeValues = sourceOptions.excludeValues ? true : false;
|
|
58160
|
+
options.algorithm = options.algorithm.toLowerCase();
|
|
58161
|
+
options.encoding = options.encoding.toLowerCase();
|
|
58162
|
+
options.ignoreUnknown = sourceOptions.ignoreUnknown !== true ? false : true; // default to false
|
|
58163
|
+
options.respectType = sourceOptions.respectType === false ? false : true; // default to true
|
|
58164
|
+
options.respectFunctionNames = sourceOptions.respectFunctionNames === false ? false : true;
|
|
58165
|
+
options.respectFunctionProperties = sourceOptions.respectFunctionProperties === false ? false : true;
|
|
58166
|
+
options.unorderedArrays = sourceOptions.unorderedArrays !== true ? false : true; // default to false
|
|
58167
|
+
options.unorderedSets = sourceOptions.unorderedSets === false ? false : true; // default to false
|
|
58168
|
+
options.unorderedObjects = sourceOptions.unorderedObjects === false ? false : true; // default to true
|
|
58169
|
+
options.replacer = sourceOptions.replacer || undefined;
|
|
58170
|
+
options.excludeKeys = sourceOptions.excludeKeys || undefined;
|
|
58171
|
+
|
|
58172
|
+
if(typeof object === 'undefined') {
|
|
58173
|
+
throw new Error('Object argument required.');
|
|
58174
|
+
}
|
|
58175
|
+
|
|
58176
|
+
// if there is a case-insensitive match in the hashes list, accept it
|
|
58177
|
+
// (i.e. SHA256 for sha256)
|
|
58178
|
+
for (var i = 0; i < hashes.length; ++i) {
|
|
58179
|
+
if (hashes[i].toLowerCase() === options.algorithm.toLowerCase()) {
|
|
58180
|
+
options.algorithm = hashes[i];
|
|
58181
|
+
}
|
|
58182
|
+
}
|
|
58183
|
+
|
|
58184
|
+
if(hashes.indexOf(options.algorithm) === -1){
|
|
58185
|
+
throw new Error('Algorithm "' + options.algorithm + '" not supported. ' +
|
|
58186
|
+
'supported values: ' + hashes.join(', '));
|
|
58187
|
+
}
|
|
58188
|
+
|
|
58189
|
+
if(encodings.indexOf(options.encoding) === -1 &&
|
|
58190
|
+
options.algorithm !== 'passthrough'){
|
|
58191
|
+
throw new Error('Encoding "' + options.encoding + '" not supported. ' +
|
|
58192
|
+
'supported values: ' + encodings.join(', '));
|
|
58193
|
+
}
|
|
58194
|
+
|
|
58195
|
+
return options;
|
|
58196
|
+
}
|
|
58197
|
+
|
|
58198
|
+
/** Check if the given function is a native function */
|
|
58199
|
+
function isNativeFunction(f) {
|
|
58200
|
+
if ((typeof f) !== 'function') {
|
|
58201
|
+
return false;
|
|
58202
|
+
}
|
|
58203
|
+
var exp = /^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i;
|
|
58204
|
+
return exp.exec(Function.prototype.toString.call(f)) != null;
|
|
58205
|
+
}
|
|
58206
|
+
|
|
58207
|
+
function hash(object, options) {
|
|
58208
|
+
var hashingStream;
|
|
58209
|
+
|
|
58210
|
+
if (options.algorithm !== 'passthrough') {
|
|
58211
|
+
hashingStream = crypto.createHash(options.algorithm);
|
|
58212
|
+
} else {
|
|
58213
|
+
hashingStream = new PassThrough();
|
|
58214
|
+
}
|
|
58215
|
+
|
|
58216
|
+
if (typeof hashingStream.write === 'undefined') {
|
|
58217
|
+
hashingStream.write = hashingStream.update;
|
|
58218
|
+
hashingStream.end = hashingStream.update;
|
|
58219
|
+
}
|
|
58220
|
+
|
|
58221
|
+
var hasher = typeHasher(options, hashingStream);
|
|
58222
|
+
hasher.dispatch(object);
|
|
58223
|
+
if (!hashingStream.update) {
|
|
58224
|
+
hashingStream.end('');
|
|
58225
|
+
}
|
|
58226
|
+
|
|
58227
|
+
if (hashingStream.digest) {
|
|
58228
|
+
return hashingStream.digest(options.encoding === 'buffer' ? undefined : options.encoding);
|
|
58229
|
+
}
|
|
58230
|
+
|
|
58231
|
+
var buf = hashingStream.read();
|
|
58232
|
+
if (options.encoding === 'buffer') {
|
|
58233
|
+
return buf;
|
|
58234
|
+
}
|
|
58235
|
+
|
|
58236
|
+
return buf.toString(options.encoding);
|
|
58237
|
+
}
|
|
58238
|
+
|
|
58239
|
+
/**
|
|
58240
|
+
* Expose streaming API
|
|
58241
|
+
*
|
|
58242
|
+
* @param {object} object Value to serialize
|
|
58243
|
+
* @param {object} options Options, as for hash()
|
|
58244
|
+
* @param {object} stream A stream to write the serializiation to
|
|
58245
|
+
* @api public
|
|
58246
|
+
*/
|
|
58247
|
+
exports.writeToStream = function(object, options, stream) {
|
|
58248
|
+
if (typeof stream === 'undefined') {
|
|
58249
|
+
stream = options;
|
|
58250
|
+
options = {};
|
|
58251
|
+
}
|
|
58252
|
+
|
|
58253
|
+
options = applyDefaults(object, options);
|
|
58254
|
+
|
|
58255
|
+
return typeHasher(options, stream).dispatch(object);
|
|
58256
|
+
};
|
|
58257
|
+
|
|
58258
|
+
function typeHasher(options, writeTo, context){
|
|
58259
|
+
context = context || [];
|
|
58260
|
+
var write = function(str) {
|
|
58261
|
+
if (writeTo.update) {
|
|
58262
|
+
return writeTo.update(str, 'utf8');
|
|
58263
|
+
} else {
|
|
58264
|
+
return writeTo.write(str, 'utf8');
|
|
58265
|
+
}
|
|
58266
|
+
};
|
|
58267
|
+
|
|
58268
|
+
return {
|
|
58269
|
+
dispatch: function(value){
|
|
58270
|
+
if (options.replacer) {
|
|
58271
|
+
value = options.replacer(value);
|
|
58272
|
+
}
|
|
58273
|
+
|
|
58274
|
+
var type = typeof value;
|
|
58275
|
+
if (value === null) {
|
|
58276
|
+
type = 'null';
|
|
58277
|
+
}
|
|
58278
|
+
|
|
58279
|
+
//console.log("[DEBUG] Dispatch: ", value, "->", type, " -> ", "_" + type);
|
|
58280
|
+
|
|
58281
|
+
return this['_' + type](value);
|
|
58282
|
+
},
|
|
58283
|
+
_object: function(object) {
|
|
58284
|
+
var pattern = (/\[object (.*)\]/i);
|
|
58285
|
+
var objString = Object.prototype.toString.call(object);
|
|
58286
|
+
var objType = pattern.exec(objString);
|
|
58287
|
+
if (!objType) { // object type did not match [object ...]
|
|
58288
|
+
objType = 'unknown:[' + objString + ']';
|
|
58289
|
+
} else {
|
|
58290
|
+
objType = objType[1]; // take only the class name
|
|
58291
|
+
}
|
|
58292
|
+
|
|
58293
|
+
objType = objType.toLowerCase();
|
|
58294
|
+
|
|
58295
|
+
var objectNumber = null;
|
|
58296
|
+
|
|
58297
|
+
if ((objectNumber = context.indexOf(object)) >= 0) {
|
|
58298
|
+
return this.dispatch('[CIRCULAR:' + objectNumber + ']');
|
|
58299
|
+
} else {
|
|
58300
|
+
context.push(object);
|
|
58301
|
+
}
|
|
58302
|
+
|
|
58303
|
+
if (typeof Buffer !== 'undefined' && Buffer.isBuffer && Buffer.isBuffer(object)) {
|
|
58304
|
+
write('buffer:');
|
|
58305
|
+
return write(object);
|
|
58306
|
+
}
|
|
58307
|
+
|
|
58308
|
+
if(objType !== 'object' && objType !== 'function' && objType !== 'asyncfunction') {
|
|
58309
|
+
if(this['_' + objType]) {
|
|
58310
|
+
this['_' + objType](object);
|
|
58311
|
+
} else if (options.ignoreUnknown) {
|
|
58312
|
+
return write('[' + objType + ']');
|
|
58313
|
+
} else {
|
|
58314
|
+
throw new Error('Unknown object type "' + objType + '"');
|
|
58315
|
+
}
|
|
58316
|
+
}else {
|
|
58317
|
+
var keys = Object.keys(object);
|
|
58318
|
+
if (options.unorderedObjects) {
|
|
58319
|
+
keys = keys.sort();
|
|
58320
|
+
}
|
|
58321
|
+
// Make sure to incorporate special properties, so
|
|
58322
|
+
// Types with different prototypes will produce
|
|
58323
|
+
// a different hash and objects derived from
|
|
58324
|
+
// different functions (`new Foo`, `new Bar`) will
|
|
58325
|
+
// produce different hashes.
|
|
58326
|
+
// We never do this for native functions since some
|
|
58327
|
+
// seem to break because of that.
|
|
58328
|
+
if (options.respectType !== false && !isNativeFunction(object)) {
|
|
58329
|
+
keys.splice(0, 0, 'prototype', '__proto__', 'constructor');
|
|
58330
|
+
}
|
|
58331
|
+
|
|
58332
|
+
if (options.excludeKeys) {
|
|
58333
|
+
keys = keys.filter(function(key) { return !options.excludeKeys(key); });
|
|
58334
|
+
}
|
|
58335
|
+
|
|
58336
|
+
write('object:' + keys.length + ':');
|
|
58337
|
+
var self = this;
|
|
58338
|
+
return keys.forEach(function(key){
|
|
58339
|
+
self.dispatch(key);
|
|
58340
|
+
write(':');
|
|
58341
|
+
if(!options.excludeValues) {
|
|
58342
|
+
self.dispatch(object[key]);
|
|
58343
|
+
}
|
|
58344
|
+
write(',');
|
|
58345
|
+
});
|
|
58346
|
+
}
|
|
58347
|
+
},
|
|
58348
|
+
_array: function(arr, unordered){
|
|
58349
|
+
unordered = typeof unordered !== 'undefined' ? unordered :
|
|
58350
|
+
options.unorderedArrays !== false; // default to options.unorderedArrays
|
|
58351
|
+
|
|
58352
|
+
var self = this;
|
|
58353
|
+
write('array:' + arr.length + ':');
|
|
58354
|
+
if (!unordered || arr.length <= 1) {
|
|
58355
|
+
return arr.forEach(function(entry) {
|
|
58356
|
+
return self.dispatch(entry);
|
|
58357
|
+
});
|
|
58358
|
+
}
|
|
58359
|
+
|
|
58360
|
+
// the unordered case is a little more complicated:
|
|
58361
|
+
// since there is no canonical ordering on objects,
|
|
58362
|
+
// i.e. {a:1} < {a:2} and {a:1} > {a:2} are both false,
|
|
58363
|
+
// we first serialize each entry using a PassThrough stream
|
|
58364
|
+
// before sorting.
|
|
58365
|
+
// also: we can’t use the same context array for all entries
|
|
58366
|
+
// since the order of hashing should *not* matter. instead,
|
|
58367
|
+
// we keep track of the additions to a copy of the context array
|
|
58368
|
+
// and add all of them to the global context array when we’re done
|
|
58369
|
+
var contextAdditions = [];
|
|
58370
|
+
var entries = arr.map(function(entry) {
|
|
58371
|
+
var strm = new PassThrough();
|
|
58372
|
+
var localContext = context.slice(); // make copy
|
|
58373
|
+
var hasher = typeHasher(options, strm, localContext);
|
|
58374
|
+
hasher.dispatch(entry);
|
|
58375
|
+
// take only what was added to localContext and append it to contextAdditions
|
|
58376
|
+
contextAdditions = contextAdditions.concat(localContext.slice(context.length));
|
|
58377
|
+
return strm.read().toString();
|
|
58378
|
+
});
|
|
58379
|
+
context = context.concat(contextAdditions);
|
|
58380
|
+
entries.sort();
|
|
58381
|
+
return this._array(entries, false);
|
|
58382
|
+
},
|
|
58383
|
+
_date: function(date){
|
|
58384
|
+
return write('date:' + date.toJSON());
|
|
58385
|
+
},
|
|
58386
|
+
_symbol: function(sym){
|
|
58387
|
+
return write('symbol:' + sym.toString());
|
|
58388
|
+
},
|
|
58389
|
+
_error: function(err){
|
|
58390
|
+
return write('error:' + err.toString());
|
|
58391
|
+
},
|
|
58392
|
+
_boolean: function(bool){
|
|
58393
|
+
return write('bool:' + bool.toString());
|
|
58394
|
+
},
|
|
58395
|
+
_string: function(string){
|
|
58396
|
+
write('string:' + string.length + ':');
|
|
58397
|
+
write(string.toString());
|
|
58398
|
+
},
|
|
58399
|
+
_function: function(fn){
|
|
58400
|
+
write('fn:');
|
|
58401
|
+
if (isNativeFunction(fn)) {
|
|
58402
|
+
this.dispatch('[native]');
|
|
58403
|
+
} else {
|
|
58404
|
+
this.dispatch(fn.toString());
|
|
58405
|
+
}
|
|
58406
|
+
|
|
58407
|
+
if (options.respectFunctionNames !== false) {
|
|
58408
|
+
// Make sure we can still distinguish native functions
|
|
58409
|
+
// by their name, otherwise String and Function will
|
|
58410
|
+
// have the same hash
|
|
58411
|
+
this.dispatch("function-name:" + String(fn.name));
|
|
58412
|
+
}
|
|
58413
|
+
|
|
58414
|
+
if (options.respectFunctionProperties) {
|
|
58415
|
+
this._object(fn);
|
|
58416
|
+
}
|
|
58417
|
+
},
|
|
58418
|
+
_number: function(number){
|
|
58419
|
+
return write('number:' + number.toString());
|
|
58420
|
+
},
|
|
58421
|
+
_xml: function(xml){
|
|
58422
|
+
return write('xml:' + xml.toString());
|
|
58423
|
+
},
|
|
58424
|
+
_null: function() {
|
|
58425
|
+
return write('Null');
|
|
58426
|
+
},
|
|
58427
|
+
_undefined: function() {
|
|
58428
|
+
return write('Undefined');
|
|
58429
|
+
},
|
|
58430
|
+
_regexp: function(regex){
|
|
58431
|
+
return write('regex:' + regex.toString());
|
|
58432
|
+
},
|
|
58433
|
+
_uint8array: function(arr){
|
|
58434
|
+
write('uint8array:');
|
|
58435
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
58436
|
+
},
|
|
58437
|
+
_uint8clampedarray: function(arr){
|
|
58438
|
+
write('uint8clampedarray:');
|
|
58439
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
58440
|
+
},
|
|
58441
|
+
_int8array: function(arr){
|
|
58442
|
+
write('int8array:');
|
|
58443
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
58444
|
+
},
|
|
58445
|
+
_uint16array: function(arr){
|
|
58446
|
+
write('uint16array:');
|
|
58447
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
58448
|
+
},
|
|
58449
|
+
_int16array: function(arr){
|
|
58450
|
+
write('int16array:');
|
|
58451
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
58452
|
+
},
|
|
58453
|
+
_uint32array: function(arr){
|
|
58454
|
+
write('uint32array:');
|
|
58455
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
58456
|
+
},
|
|
58457
|
+
_int32array: function(arr){
|
|
58458
|
+
write('int32array:');
|
|
58459
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
58460
|
+
},
|
|
58461
|
+
_float32array: function(arr){
|
|
58462
|
+
write('float32array:');
|
|
58463
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
58464
|
+
},
|
|
58465
|
+
_float64array: function(arr){
|
|
58466
|
+
write('float64array:');
|
|
58467
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
58468
|
+
},
|
|
58469
|
+
_arraybuffer: function(arr){
|
|
58470
|
+
write('arraybuffer:');
|
|
58471
|
+
return this.dispatch(new Uint8Array(arr));
|
|
58472
|
+
},
|
|
58473
|
+
_url: function(url) {
|
|
58474
|
+
return write('url:' + url.toString());
|
|
58475
|
+
},
|
|
58476
|
+
_map: function(map) {
|
|
58477
|
+
write('map:');
|
|
58478
|
+
var arr = Array.from(map);
|
|
58479
|
+
return this._array(arr, options.unorderedSets !== false);
|
|
58480
|
+
},
|
|
58481
|
+
_set: function(set) {
|
|
58482
|
+
write('set:');
|
|
58483
|
+
var arr = Array.from(set);
|
|
58484
|
+
return this._array(arr, options.unorderedSets !== false);
|
|
58485
|
+
},
|
|
58486
|
+
_file: function(file) {
|
|
58487
|
+
write('file:');
|
|
58488
|
+
return this.dispatch([file.name, file.size, file.type, file.lastModfied]);
|
|
58489
|
+
},
|
|
58490
|
+
_blob: function() {
|
|
58491
|
+
if (options.ignoreUnknown) {
|
|
58492
|
+
return write('[blob]');
|
|
58493
|
+
}
|
|
58494
|
+
|
|
58495
|
+
throw Error('Hashing Blob objects is currently not supported\n' +
|
|
58496
|
+
'(see https://github.com/puleos/object-hash/issues/26)\n' +
|
|
58497
|
+
'Use "options.replacer" or "options.ignoreUnknown"\n');
|
|
58498
|
+
},
|
|
58499
|
+
_domwindow: function() { return write('domwindow'); },
|
|
58500
|
+
_bigint: function(number){
|
|
58501
|
+
return write('bigint:' + number.toString());
|
|
58502
|
+
},
|
|
58503
|
+
/* Node.js standard native objects */
|
|
58504
|
+
_process: function() { return write('process'); },
|
|
58505
|
+
_timer: function() { return write('timer'); },
|
|
58506
|
+
_pipe: function() { return write('pipe'); },
|
|
58507
|
+
_tcp: function() { return write('tcp'); },
|
|
58508
|
+
_udp: function() { return write('udp'); },
|
|
58509
|
+
_tty: function() { return write('tty'); },
|
|
58510
|
+
_statwatcher: function() { return write('statwatcher'); },
|
|
58511
|
+
_securecontext: function() { return write('securecontext'); },
|
|
58512
|
+
_connection: function() { return write('connection'); },
|
|
58513
|
+
_zlib: function() { return write('zlib'); },
|
|
58514
|
+
_context: function() { return write('context'); },
|
|
58515
|
+
_nodescript: function() { return write('nodescript'); },
|
|
58516
|
+
_httpparser: function() { return write('httpparser'); },
|
|
58517
|
+
_dataview: function() { return write('dataview'); },
|
|
58518
|
+
_signal: function() { return write('signal'); },
|
|
58519
|
+
_fsevent: function() { return write('fsevent'); },
|
|
58520
|
+
_tlswrap: function() { return write('tlswrap'); },
|
|
58521
|
+
};
|
|
58522
|
+
}
|
|
58523
|
+
|
|
58524
|
+
// Mini-implementation of stream.PassThrough
|
|
58525
|
+
// We are far from having need for the full implementation, and we can
|
|
58526
|
+
// make assumptions like "many writes, then only one final read"
|
|
58527
|
+
// and we can ignore encoding specifics
|
|
58528
|
+
function PassThrough() {
|
|
58529
|
+
return {
|
|
58530
|
+
buf: '',
|
|
58531
|
+
|
|
58532
|
+
write: function(b) {
|
|
58533
|
+
this.buf += b;
|
|
58534
|
+
},
|
|
58535
|
+
|
|
58536
|
+
end: function(b) {
|
|
58537
|
+
this.buf += b;
|
|
58538
|
+
},
|
|
58539
|
+
|
|
58540
|
+
read: function() {
|
|
58541
|
+
return this.buf;
|
|
58542
|
+
}
|
|
58543
|
+
};
|
|
58544
|
+
}
|
|
58545
|
+
} (objectHash$1, objectHash$1.exports));
|
|
58546
|
+
|
|
58547
|
+
var objectHashExports = objectHash$1.exports;
|
|
58548
|
+
var objectHash = /*@__PURE__*/getDefaultExportFromCjs(objectHashExports);
|
|
58549
|
+
|
|
58550
|
+
/**
|
|
58551
|
+
* Generates a simple hash from a collection regardless of order.
|
|
58552
|
+
*
|
|
58553
|
+
* @param collection An array of objects
|
|
58554
|
+
* @returns A hash string representation of the collection
|
|
58555
|
+
*/
|
|
58556
|
+
function getHashFromCollection(collection) {
|
|
58557
|
+
return objectHash(collection, {
|
|
58558
|
+
// The name of this option is misleading:
|
|
58559
|
+
// `true` ensures that the same hash is returned regardless of collection order
|
|
58560
|
+
// https://github.com/puleos/object-hash#hashvalue-options
|
|
58561
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
58562
|
+
unorderedArrays: true
|
|
58563
|
+
});
|
|
58564
|
+
}
|
|
58565
|
+
|
|
58566
|
+
/**
|
|
58567
|
+
* We take advantage of the global JS scope to use this constant as a "singleton" cache
|
|
58568
|
+
* to avoid re-normalizing and re-search-indexing each time `CustomSearch` is instanciated.
|
|
58569
|
+
*
|
|
58570
|
+
* This cache will only be used if the `cacheKey` option is set while instanciating `CustomSearch`.
|
|
58571
|
+
*/
|
|
58572
|
+
const FUSE_SEARCH_CACHE = {};
|
|
58573
|
+
function findCacheRecord(currentCollection, cacheKey, withCacheInvalidation) {
|
|
58574
|
+
if (!cacheKey) {
|
|
58575
|
+
return undefined;
|
|
58576
|
+
}
|
|
58577
|
+
const cacheRecord = FUSE_SEARCH_CACHE[cacheKey];
|
|
58578
|
+
if (!cacheRecord) {
|
|
58579
|
+
return undefined;
|
|
58580
|
+
}
|
|
58581
|
+
if (withCacheInvalidation) {
|
|
58582
|
+
const currentCollectionHash = getHashFromCollection(currentCollection);
|
|
58583
|
+
if (currentCollectionHash !== cacheRecord.originalCollectionHash) {
|
|
58584
|
+
return undefined;
|
|
58585
|
+
}
|
|
58586
|
+
}
|
|
58587
|
+
return cacheRecord;
|
|
58588
|
+
}
|
|
58589
|
+
function storeCacheRecord(cacheKey, cacheRecord) {
|
|
58590
|
+
FUSE_SEARCH_CACHE[cacheKey] = cacheRecord;
|
|
58591
|
+
}
|
|
58592
|
+
|
|
55867
58593
|
var lodash_min = {exports: {}};
|
|
55868
58594
|
|
|
55869
58595
|
/**
|
|
@@ -56959,12 +59685,51 @@ var _ = lodash_minExports.runInContext();
|
|
|
56959
59685
|
var fp = _baseConvert(_, _);
|
|
56960
59686
|
|
|
56961
59687
|
/**
|
|
56962
|
-
*
|
|
56963
|
-
* to avoid re-normalizing and re-search-indexing each time `CustomSearch` is instanciated.
|
|
59688
|
+
* Replace all the diacritics with unaccented letters in a collection, targetting the provided keys.
|
|
56964
59689
|
*
|
|
56965
|
-
*
|
|
59690
|
+
* @param collection An array of objects
|
|
59691
|
+
* @param keys List of item prop path to clean, either a using strings
|
|
59692
|
+
* or [Fuse.js weighted objects](https://fusejs.io/api/options.html#keys)
|
|
59693
|
+
* @returns The same collection with its specified keys normalized without diacritics
|
|
59694
|
+
*
|
|
59695
|
+
* @example
|
|
59696
|
+
* ```ts
|
|
59697
|
+
* const collection = [
|
|
59698
|
+
* { name: 'aérosol', description: 'Un aérosol.', author: { name: 'Camille Hervé' } },
|
|
59699
|
+
* { name: 'martèlement', description: 'Un martèlement.', author: { name: 'Athénée Perreault' } }
|
|
59700
|
+
* ]
|
|
59701
|
+
*
|
|
59702
|
+
* const normalizedCollection = cleanCollectionDiacritics(collection, ['name', 'author.name'])
|
|
59703
|
+
* console.log(normalizedCollection[0])
|
|
59704
|
+
* // => `{ "name": "aerosol", "description": "Un aérosol.", author: { name: 'Camille Herve' } }`
|
|
59705
|
+
*
|
|
59706
|
+
* const normalizedCollection = cleanCollectionDiacritics(collection, [{ name: 'name', weight: 1 }])
|
|
59707
|
+
* console.log(normalizedCollection[0])
|
|
59708
|
+
* // => `{ "name": "aerosol", "description": "Un aérosol.", author: { name: 'Camille Hervé' }`
|
|
59709
|
+
* ```
|
|
56966
59710
|
*/
|
|
56967
|
-
|
|
59711
|
+
function cleanCollectionDiacritics(collection, keys) {
|
|
59712
|
+
// These are the prop paths that needs to be normalized,
|
|
59713
|
+
// represented as an array dot-seperated strings (i.e.: `['aProperty', 'a.nested.property']`)
|
|
59714
|
+
const collectionKeysAsPaths = keys.map(key => (typeof key === 'string' ? key : key.name));
|
|
59715
|
+
// Now that we have a list of prop paths, we want to generate a list of transformers
|
|
59716
|
+
// able for remove diacritics of a collection item, one transformer per collection item prop path.
|
|
59717
|
+
const collectionItemTransformers = collectionKeysAsPaths.map(collectionKeyAsPath => (collectionItem) => {
|
|
59718
|
+
const collectionItemPropValue = fp.get(collectionKeyAsPath, collectionItem);
|
|
59719
|
+
// This type check is a safeguard against unexpected values (a non-string value would otherwise throw an error)
|
|
59720
|
+
if (typeof fp.get(collectionKeyAsPath, collectionItem) !== 'string') {
|
|
59721
|
+
console.warn(`"${collectionKeyAsPath}" is not a string (value: \`${collectionItemPropValue}\`).`);
|
|
59722
|
+
return collectionItem;
|
|
59723
|
+
}
|
|
59724
|
+
return fp.update(collectionKeyAsPath, diacritics.remove, collectionItem);
|
|
59725
|
+
});
|
|
59726
|
+
// We can then generate a single function piping all these collection item transformers...
|
|
59727
|
+
const cleanCollectionItemDiacritics = fp.flow(collectionItemTransformers);
|
|
59728
|
+
// ...and apply them to each collection item via a mapper
|
|
59729
|
+
return collection.map(cleanCollectionItemDiacritics);
|
|
59730
|
+
}
|
|
59731
|
+
|
|
59732
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
56968
59733
|
class CustomSearch {
|
|
56969
59734
|
#originalCollection;
|
|
56970
59735
|
#fuse;
|
|
@@ -56972,42 +59737,45 @@ class CustomSearch {
|
|
|
56972
59737
|
#isDiacriticSensitive;
|
|
56973
59738
|
/** See {@link CustomSearchOptions.isStrict}. */
|
|
56974
59739
|
#isStrict;
|
|
56975
|
-
constructor(collection, keys, { cacheKey, isCaseSensitive = false, isDiacriticSensitive = false, isStrict = false, shouldIgnoreLocation = true, threshold = 0.4 } = {}) {
|
|
56976
|
-
|
|
56977
|
-
//
|
|
56978
|
-
|
|
56979
|
-
|
|
56980
|
-
|
|
56981
|
-
|
|
56982
|
-
|
|
56983
|
-
|
|
56984
|
-
|
|
56985
|
-
{
|
|
59740
|
+
constructor(collection, keys, { cacheKey, isCaseSensitive = false, isDiacriticSensitive = false, isStrict = false, shouldIgnoreLocation = true, threshold = 0.4, withCacheInvalidation = false } = {}) {
|
|
59741
|
+
// Will be `undefined` in any of those cases:
|
|
59742
|
+
// - no cache key was provided
|
|
59743
|
+
// - the cache record doesn't exist
|
|
59744
|
+
// - the cache record is invalidated because the collection hash has changed IF `withCacheInvalidation` is `true`
|
|
59745
|
+
const maybeCacheRecord = findCacheRecord(collection, cacheKey, withCacheInvalidation);
|
|
59746
|
+
const normalizedCollection = maybeCacheRecord?.normalizedCollection ?? isDiacriticSensitive
|
|
59747
|
+
? collection
|
|
59748
|
+
: cleanCollectionDiacritics(collection, keys);
|
|
59749
|
+
this.#fuse = new Fuse(normalizedCollection, {
|
|
56986
59750
|
ignoreLocation: shouldIgnoreLocation,
|
|
56987
59751
|
isCaseSensitive,
|
|
56988
59752
|
keys,
|
|
56989
59753
|
threshold,
|
|
56990
59754
|
useExtendedSearch: isStrict
|
|
56991
|
-
},
|
|
56992
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
56993
|
-
maybeCache ? Fuse.parseIndex(maybeCache.fuseSearchIndex) : undefined);
|
|
59755
|
+
}, maybeCacheRecord ? Fuse.parseIndex(maybeCacheRecord.fuseSearchIndex) : undefined);
|
|
56994
59756
|
this.#isDiacriticSensitive = isDiacriticSensitive;
|
|
56995
59757
|
this.#isStrict = isStrict;
|
|
56996
|
-
this.#originalCollection =
|
|
56997
|
-
|
|
56998
|
-
|
|
59758
|
+
this.#originalCollection = collection;
|
|
59759
|
+
// If a cache key was provided
|
|
59760
|
+
// and the cache record was either nonexistent or invalidated,
|
|
59761
|
+
if (cacheKey && !maybeCacheRecord) {
|
|
59762
|
+
// we create a new cache record
|
|
59763
|
+
const newCacheRecord = {
|
|
56999
59764
|
fuseSearchIndex: this.#fuse.getIndex(),
|
|
57000
59765
|
normalizedCollection,
|
|
57001
|
-
originalCollection: collection
|
|
59766
|
+
originalCollection: collection,
|
|
59767
|
+
originalCollectionHash: getHashFromCollection(collection)
|
|
57002
59768
|
};
|
|
59769
|
+
// and store it
|
|
59770
|
+
storeCacheRecord(cacheKey, newCacheRecord);
|
|
57003
59771
|
}
|
|
57004
59772
|
}
|
|
57005
59773
|
/**
|
|
57006
59774
|
* Searches the entire collection, and returns a list of items matching this query.
|
|
57007
59775
|
*
|
|
57008
|
-
* @param
|
|
57009
|
-
* @param
|
|
57010
|
-
* @returns
|
|
59776
|
+
* @param query The keywords to look for
|
|
59777
|
+
* @param limit Denotes the max number of returned search results
|
|
59778
|
+
* @returns A list of matching items
|
|
57011
59779
|
*/
|
|
57012
59780
|
find(query, limit) {
|
|
57013
59781
|
const normalizedQuery = (this.#isDiacriticSensitive ? query : diacritics.remove(query)).trim();
|
|
@@ -57026,53 +59794,9 @@ class CustomSearch {
|
|
|
57026
59794
|
return (this.#fuse
|
|
57027
59795
|
.search(extendedQuery, limit ? { limit } : undefined)
|
|
57028
59796
|
// We remap to the original collection since the normalized collection can have some accents removed
|
|
57029
|
-
// (because of the internal diacritic-less normalization)
|
|
59797
|
+
// (because of the internal `CustomSearch` diacritic-less normalization)
|
|
57030
59798
|
.map(({ refIndex }) => this.#originalCollection[refIndex]));
|
|
57031
59799
|
}
|
|
57032
|
-
/**
|
|
57033
|
-
* Replace all the diacritics with unaccented letters in a collection, targetting the provided keys.
|
|
57034
|
-
*
|
|
57035
|
-
* @param collection An array of objects
|
|
57036
|
-
* @param keys List of item prop path to clean, either a using strings
|
|
57037
|
-
* or [Fuse.js weighted objects](https://fusejs.io/api/options.html#keys)
|
|
57038
|
-
* @returns The same collection with its specified keys normalized without diacritics
|
|
57039
|
-
*
|
|
57040
|
-
* @example
|
|
57041
|
-
* ```ts
|
|
57042
|
-
* const collection = [
|
|
57043
|
-
* { name: 'aérosol', description: 'Un aérosol.', author: { name: 'Camille Hervé' } },
|
|
57044
|
-
* { name: 'martèlement', description: 'Un martèlement.', author: { name: 'Athénée Perreault' } }
|
|
57045
|
-
* ]
|
|
57046
|
-
*
|
|
57047
|
-
* const normalizedCollection = CustomSearch.cleanCollectionDiacritics(collection, ['name', 'author.name'])
|
|
57048
|
-
* console.log(normalizedCollection[0])
|
|
57049
|
-
* // => `{ "name": "aerosol", "description": "Un aérosol.", author: { name: 'Camille Herve' } }`
|
|
57050
|
-
*
|
|
57051
|
-
* const normalizedCollection = CustomSearch.cleanCollectionDiacritics(collection, [{ name: 'name', weight: 1 }])
|
|
57052
|
-
* console.log(normalizedCollection[0])
|
|
57053
|
-
* // => `{ "name": "aerosol", "description": "Un aérosol.", author: { name: 'Camille Hervé' }`
|
|
57054
|
-
* ```
|
|
57055
|
-
*/
|
|
57056
|
-
static cleanCollectionDiacritics(collection, keys) {
|
|
57057
|
-
// These are the prop paths that needs to be normalized,
|
|
57058
|
-
// represented as an array dot-seperated strings (i.e.: `['aProperty', 'a.nested.property']`)
|
|
57059
|
-
const collectionKeysAsPaths = keys.map(key => (typeof key === 'string' ? key : key.name));
|
|
57060
|
-
// Now that we have a list of prop paths, we want to generate a list of transformers
|
|
57061
|
-
// able for remove diacritics of a collection item, one transformer per collection item prop path.
|
|
57062
|
-
const collectionItemTransformers = collectionKeysAsPaths.map(collectionKeyAsPath => (collectionItem) => {
|
|
57063
|
-
const collectionItemPropValue = fp.get(collectionKeyAsPath, collectionItem);
|
|
57064
|
-
// This type check is a safeguard against unexpected values (a non-string value would otherwise throw an error)
|
|
57065
|
-
if (typeof fp.get(collectionKeyAsPath, collectionItem) !== 'string') {
|
|
57066
|
-
console.warn(`"${collectionKeyAsPath}" is not a string (value: \`${collectionItemPropValue}\`).`);
|
|
57067
|
-
return collectionItem;
|
|
57068
|
-
}
|
|
57069
|
-
return fp.update(collectionKeyAsPath, diacritics.remove, collectionItem);
|
|
57070
|
-
});
|
|
57071
|
-
// We can then generate a single function piping all these collection item transformers...
|
|
57072
|
-
const cleanCollectionItemDiacritics = fp.flow(collectionItemTransformers);
|
|
57073
|
-
// ...and apply them to each collection item via a mapper
|
|
57074
|
-
return collection.map(cleanCollectionItemDiacritics);
|
|
57075
|
-
}
|
|
57076
59800
|
}
|
|
57077
59801
|
|
|
57078
59802
|
function MultiSelect({ baseContainer, className, customSearch, customSearchMinQueryLength = 1, disabled = false, error, isErrorMessageHidden = false, isLabelHidden = false, isLight = false, isUndefinedWhenDisabled = false, label, onChange, options, optionValueKey, searchable = false, style, value, ...originalProps }) {
|
|
@@ -57576,15 +60300,6 @@ var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):601
|
|
|
57576
60300
|
|
|
57577
60301
|
var reactIs_development = {};
|
|
57578
60302
|
|
|
57579
|
-
/** @license React v16.13.1
|
|
57580
|
-
* react-is.development.js
|
|
57581
|
-
*
|
|
57582
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
57583
|
-
*
|
|
57584
|
-
* This source code is licensed under the MIT license found in the
|
|
57585
|
-
* LICENSE file in the root directory of this source tree.
|
|
57586
|
-
*/
|
|
57587
|
-
|
|
57588
60303
|
var hasRequiredReactIs_development;
|
|
57589
60304
|
|
|
57590
60305
|
function requireReactIs_development () {
|
|
@@ -57593,7 +60308,7 @@ function requireReactIs_development () {
|
|
|
57593
60308
|
|
|
57594
60309
|
|
|
57595
60310
|
|
|
57596
|
-
if (process.env.NODE_ENV !== "production") {
|
|
60311
|
+
if (process$1.env.NODE_ENV !== "production") {
|
|
57597
60312
|
(function() {
|
|
57598
60313
|
|
|
57599
60314
|
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
@@ -57769,7 +60484,7 @@ function requireReactIs () {
|
|
|
57769
60484
|
if (hasRequiredReactIs) return reactIs.exports;
|
|
57770
60485
|
hasRequiredReactIs = 1;
|
|
57771
60486
|
|
|
57772
|
-
if (process.env.NODE_ENV === 'production') {
|
|
60487
|
+
if (process$1.env.NODE_ENV === 'production') {
|
|
57773
60488
|
reactIs.exports = requireReactIs_production_min();
|
|
57774
60489
|
} else {
|
|
57775
60490
|
reactIs.exports = requireReactIs_development();
|
|
@@ -57905,13 +60620,6 @@ function requireHas () {
|
|
|
57905
60620
|
return has;
|
|
57906
60621
|
}
|
|
57907
60622
|
|
|
57908
|
-
/**
|
|
57909
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
57910
|
-
*
|
|
57911
|
-
* This source code is licensed under the MIT license found in the
|
|
57912
|
-
* LICENSE file in the root directory of this source tree.
|
|
57913
|
-
*/
|
|
57914
|
-
|
|
57915
60623
|
var checkPropTypes_1;
|
|
57916
60624
|
var hasRequiredCheckPropTypes;
|
|
57917
60625
|
|
|
@@ -57921,7 +60629,7 @@ function requireCheckPropTypes () {
|
|
|
57921
60629
|
|
|
57922
60630
|
var printWarning = function() {};
|
|
57923
60631
|
|
|
57924
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
60632
|
+
if (process$1.env.NODE_ENV !== 'production') {
|
|
57925
60633
|
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
57926
60634
|
var loggedTypeFailures = {};
|
|
57927
60635
|
var has = requireHas();
|
|
@@ -57952,7 +60660,7 @@ function requireCheckPropTypes () {
|
|
|
57952
60660
|
* @private
|
|
57953
60661
|
*/
|
|
57954
60662
|
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
57955
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
60663
|
+
if (process$1.env.NODE_ENV !== 'production') {
|
|
57956
60664
|
for (var typeSpecName in typeSpecs) {
|
|
57957
60665
|
if (has(typeSpecs, typeSpecName)) {
|
|
57958
60666
|
var error;
|
|
@@ -58007,7 +60715,7 @@ function requireCheckPropTypes () {
|
|
|
58007
60715
|
* @private
|
|
58008
60716
|
*/
|
|
58009
60717
|
checkPropTypes.resetWarningCache = function() {
|
|
58010
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
60718
|
+
if (process$1.env.NODE_ENV !== 'production') {
|
|
58011
60719
|
loggedTypeFailures = {};
|
|
58012
60720
|
}
|
|
58013
60721
|
};
|
|
@@ -58016,13 +60724,6 @@ function requireCheckPropTypes () {
|
|
|
58016
60724
|
return checkPropTypes_1;
|
|
58017
60725
|
}
|
|
58018
60726
|
|
|
58019
|
-
/**
|
|
58020
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
58021
|
-
*
|
|
58022
|
-
* This source code is licensed under the MIT license found in the
|
|
58023
|
-
* LICENSE file in the root directory of this source tree.
|
|
58024
|
-
*/
|
|
58025
|
-
|
|
58026
60727
|
var factoryWithTypeCheckers;
|
|
58027
60728
|
var hasRequiredFactoryWithTypeCheckers;
|
|
58028
60729
|
|
|
@@ -58039,7 +60740,7 @@ function requireFactoryWithTypeCheckers () {
|
|
|
58039
60740
|
|
|
58040
60741
|
var printWarning = function() {};
|
|
58041
60742
|
|
|
58042
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
60743
|
+
if (process$1.env.NODE_ENV !== 'production') {
|
|
58043
60744
|
printWarning = function(text) {
|
|
58044
60745
|
var message = 'Warning: ' + text;
|
|
58045
60746
|
if (typeof console !== 'undefined') {
|
|
@@ -58192,7 +60893,7 @@ function requireFactoryWithTypeCheckers () {
|
|
|
58192
60893
|
PropTypeError.prototype = Error.prototype;
|
|
58193
60894
|
|
|
58194
60895
|
function createChainableTypeChecker(validate) {
|
|
58195
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
60896
|
+
if (process$1.env.NODE_ENV !== 'production') {
|
|
58196
60897
|
var manualPropTypeCallCache = {};
|
|
58197
60898
|
var manualPropTypeWarningCount = 0;
|
|
58198
60899
|
}
|
|
@@ -58210,7 +60911,7 @@ function requireFactoryWithTypeCheckers () {
|
|
|
58210
60911
|
);
|
|
58211
60912
|
err.name = 'Invariant Violation';
|
|
58212
60913
|
throw err;
|
|
58213
|
-
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
|
60914
|
+
} else if (process$1.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
|
58214
60915
|
// Old behavior for people using React.PropTypes
|
|
58215
60916
|
var cacheKey = componentName + ':' + propName;
|
|
58216
60917
|
if (
|
|
@@ -58332,7 +61033,7 @@ function requireFactoryWithTypeCheckers () {
|
|
|
58332
61033
|
|
|
58333
61034
|
function createEnumTypeChecker(expectedValues) {
|
|
58334
61035
|
if (!Array.isArray(expectedValues)) {
|
|
58335
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
61036
|
+
if (process$1.env.NODE_ENV !== 'production') {
|
|
58336
61037
|
if (arguments.length > 1) {
|
|
58337
61038
|
printWarning(
|
|
58338
61039
|
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
|
@@ -58390,7 +61091,7 @@ function requireFactoryWithTypeCheckers () {
|
|
|
58390
61091
|
|
|
58391
61092
|
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
58392
61093
|
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
58393
|
-
process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
|
61094
|
+
process$1.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
|
58394
61095
|
return emptyFunctionThatReturnsNull;
|
|
58395
61096
|
}
|
|
58396
61097
|
|
|
@@ -58705,14 +61406,7 @@ function requireFactoryWithThrowingShims () {
|
|
|
58705
61406
|
return factoryWithThrowingShims;
|
|
58706
61407
|
}
|
|
58707
61408
|
|
|
58708
|
-
|
|
58709
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
58710
|
-
*
|
|
58711
|
-
* This source code is licensed under the MIT license found in the
|
|
58712
|
-
* LICENSE file in the root directory of this source tree.
|
|
58713
|
-
*/
|
|
58714
|
-
|
|
58715
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
61409
|
+
if (process$1.env.NODE_ENV !== 'production') {
|
|
58716
61410
|
var ReactIs = requireReactIs();
|
|
58717
61411
|
|
|
58718
61412
|
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
@@ -71002,5 +73696,5 @@ function undefine(value) {
|
|
|
71002
73696
|
return value;
|
|
71003
73697
|
}
|
|
71004
73698
|
|
|
71005
|
-
export { Accent, Button$1 as Button, Checkbox, CoordinatesFormat, CoordinatesInput, CustomSearch, DataTable, DatePicker, DateRangePicker, Dialog, Dropdown, ExclamationPoint, Field$2 as Field, FieldError, Fieldset, FormikCheckbox, FormikCoordinatesInput, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikNumberInput, FormikSearch, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, Level, MapMenuDialog, Message, MultiCheckbox, MultiRadio, MultiSelect, MultiZoneEditor, NewWindow, NewWindowContext, NotificationEvent, Notifier, NumberInput, OPENLAYERS_PROJECTION, OnlyFontGlobalStyle, Search, Select, SideMenu, SimpleTable, SingleTag, Size, THEME, TableWithSelectableRows, Tag, TagBullet, TagGroup, TextInput, Textarea, ThemeProvider, WSG84_PROJECTION, cleanString, coordinatesAreDistinct, customDayjs, getCoordinates, getLocalizedDayjs, getOptionsFromIdAndName, getOptionsFromLabelledEnum, getPseudoRandomString, getUtcizedDayjs, isArray, isDefined, isNumeric, isObject, logSoftError, normalizeString, nullify, pluralize, stopMouseEventPropagation, undefine, useClickOutsideEffect, useFieldControl, useForceUpdate, useKey, useNewWindow, usePrevious };
|
|
73699
|
+
export { Accent, Button$1 as Button, Checkbox, CoordinatesFormat, CoordinatesInput, CustomSearch, DataTable, DatePicker, DateRangePicker, Dialog, Dropdown, ExclamationPoint, Field$2 as Field, FieldError, Fieldset, FormikCheckbox, FormikCoordinatesInput, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikNumberInput, FormikSearch, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, Level, MapMenuDialog, Message, MultiCheckbox, MultiRadio, MultiSelect, MultiZoneEditor, NewWindow, NewWindowContext, NotificationEvent, Notifier, NumberInput, OPENLAYERS_PROJECTION, OnlyFontGlobalStyle, Search, Select, SideMenu, SimpleTable, SingleTag, Size, THEME, TableWithSelectableRows, Tag, TagBullet, TagGroup, TextInput, Textarea, ThemeProvider, WSG84_PROJECTION, cleanString, coordinatesAreDistinct, customDayjs, getCoordinates, getHashFromCollection, getLocalizedDayjs, getOptionsFromIdAndName, getOptionsFromLabelledEnum, getPseudoRandomString, getUtcizedDayjs, isArray, isDefined, isNumeric, isObject, logSoftError, normalizeString, nullify, pluralize, stopMouseEventPropagation, undefine, useClickOutsideEffect, useFieldControl, useForceUpdate, useKey, useNewWindow, usePrevious };
|
|
71006
73700
|
//# sourceMappingURL=index.js.map
|