@zcrkey/js-utils 0.0.2
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/LICENSE +21 -0
- package/README.md +41 -0
- package/dist/eventCenter.d.ts +59 -0
- package/dist/eventCenter.js +134 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/index.umd.js +1 -0
- package/dist/storage.d.ts +44 -0
- package/dist/storage.js +130 -0
- package/dist/util.d.ts +165 -0
- package/dist/util.js +510 -0
- package/package.json +24 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) zcr[774508556@qq.com]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# @zcrkey/js-utils
|
|
2
|
+
|
|
3
|
+
一个 javascript 实用函数库
|
|
4
|
+
|
|
5
|
+
## 安装和使用
|
|
6
|
+
|
|
7
|
+
在开始之前,你可能需要安装 [yarn](https://github.com/yarnpkg/yarn/) 或者 [pnpm](https://pnpm.io/zh/)。
|
|
8
|
+
|
|
9
|
+
从 yarn 或 npm 或 pnpm 安装并引入
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
$ yarn add @zcrkey/js-utils
|
|
13
|
+
# or
|
|
14
|
+
$ npm install @zcrkey/js-utils --save
|
|
15
|
+
# or
|
|
16
|
+
$ pnpm install @zcrkey/js-utils --save
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
修改 `src/App.js`,引入 @zcrkey/js-utils 。
|
|
21
|
+
|
|
22
|
+
```jsx
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import { CrUtil } from '@zcrkey/js-utils';
|
|
25
|
+
|
|
26
|
+
const App = () => (
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
console.log(CrUtil.trim(' @zcrkey/js-utils '))
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
<div className="App">
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
export default App;
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## LICENSE
|
|
40
|
+
|
|
41
|
+
MIT
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export type TSubscribers = {
|
|
2
|
+
key: string;
|
|
3
|
+
listeners: Array<(...args: any) => void>;
|
|
4
|
+
};
|
|
5
|
+
export type TSubscription = {
|
|
6
|
+
key: string;
|
|
7
|
+
listener: (...args: any) => void;
|
|
8
|
+
remove: () => void;
|
|
9
|
+
};
|
|
10
|
+
export default class CrEventCenter {
|
|
11
|
+
/**
|
|
12
|
+
* 储存订阅者
|
|
13
|
+
*/
|
|
14
|
+
static subscribers: TSubscribers[];
|
|
15
|
+
/**
|
|
16
|
+
* 新增订阅
|
|
17
|
+
*
|
|
18
|
+
* @param {*} key 名称
|
|
19
|
+
* @param {*} listener 执行函数
|
|
20
|
+
* @returns 订阅信息
|
|
21
|
+
* @example
|
|
22
|
+
this.subscription = CrEventCenter.on('名称', (参数) => {});
|
|
23
|
+
*/
|
|
24
|
+
static on(key: string, listener: (...args: any) => void): TSubscription;
|
|
25
|
+
/**
|
|
26
|
+
* 移除订阅
|
|
27
|
+
*
|
|
28
|
+
* @param {*} subscription
|
|
29
|
+
* @param {*} type 'all'
|
|
30
|
+
* @example
|
|
31
|
+
CrEventCenter.off(this.subscription);
|
|
32
|
+
*/
|
|
33
|
+
static off(subscription: TSubscription, type?: 'all'): void;
|
|
34
|
+
/**
|
|
35
|
+
* 派发事件
|
|
36
|
+
*
|
|
37
|
+
* @param {*} key 名称
|
|
38
|
+
* @param {*} args 其余参数
|
|
39
|
+
* @example
|
|
40
|
+
CrEventCenter.emit('名称', 参数数据);
|
|
41
|
+
*/
|
|
42
|
+
static emit(key: string, ...args: any): void;
|
|
43
|
+
/**
|
|
44
|
+
* 查找事件
|
|
45
|
+
*
|
|
46
|
+
* @param {*} key 名称
|
|
47
|
+
* @example
|
|
48
|
+
let subscriber = CrEventCenter.find('名称');
|
|
49
|
+
*/
|
|
50
|
+
static find(key: string): TSubscribers | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* 清理所有事件
|
|
53
|
+
*
|
|
54
|
+
* @memberof CrEventCenter
|
|
55
|
+
* @example
|
|
56
|
+
CrEventCenter.clear();
|
|
57
|
+
*/
|
|
58
|
+
static clear(): void;
|
|
59
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
var CrEventCenter = /*#__PURE__*/function () {
|
|
9
|
+
function CrEventCenter() {
|
|
10
|
+
_classCallCheck(this, CrEventCenter);
|
|
11
|
+
}
|
|
12
|
+
_createClass(CrEventCenter, null, [{
|
|
13
|
+
key: "on",
|
|
14
|
+
value:
|
|
15
|
+
/**
|
|
16
|
+
* 新增订阅
|
|
17
|
+
*
|
|
18
|
+
* @param {*} key 名称
|
|
19
|
+
* @param {*} listener 执行函数
|
|
20
|
+
* @returns 订阅信息
|
|
21
|
+
* @example
|
|
22
|
+
this.subscription = CrEventCenter.on('名称', (参数) => {});
|
|
23
|
+
*/
|
|
24
|
+
function on(key, listener) {
|
|
25
|
+
var _this = this;
|
|
26
|
+
var subscriber = this.subscribers.find(function (item) {
|
|
27
|
+
return item.key == key;
|
|
28
|
+
});
|
|
29
|
+
if (subscriber) {
|
|
30
|
+
subscriber.listeners.push(listener);
|
|
31
|
+
} else {
|
|
32
|
+
this.subscribers.push({
|
|
33
|
+
key: key,
|
|
34
|
+
listeners: [listener]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
var subscription = {
|
|
38
|
+
key: key,
|
|
39
|
+
listener: listener,
|
|
40
|
+
remove: function remove() {
|
|
41
|
+
_this.off(subscription);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return subscription;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 移除订阅
|
|
49
|
+
*
|
|
50
|
+
* @param {*} subscription
|
|
51
|
+
* @param {*} type 'all'
|
|
52
|
+
* @example
|
|
53
|
+
CrEventCenter.off(this.subscription);
|
|
54
|
+
*/
|
|
55
|
+
}, {
|
|
56
|
+
key: "off",
|
|
57
|
+
value: function off(subscription, type) {
|
|
58
|
+
var index = this.subscribers.findIndex(function (item) {
|
|
59
|
+
return item.key == subscription.key;
|
|
60
|
+
});
|
|
61
|
+
if (index > -1) {
|
|
62
|
+
if (type == 'all') {
|
|
63
|
+
this.subscribers.splice(index, 1);
|
|
64
|
+
} else {
|
|
65
|
+
var subscriber = this.subscribers[index];
|
|
66
|
+
var _index = subscriber.listeners.findIndex(function (item) {
|
|
67
|
+
return item == subscription.listener;
|
|
68
|
+
});
|
|
69
|
+
if (_index > -1) {
|
|
70
|
+
subscriber.listeners.splice(_index, 1);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* 派发事件
|
|
78
|
+
*
|
|
79
|
+
* @param {*} key 名称
|
|
80
|
+
* @param {*} args 其余参数
|
|
81
|
+
* @example
|
|
82
|
+
CrEventCenter.emit('名称', 参数数据);
|
|
83
|
+
*/
|
|
84
|
+
}, {
|
|
85
|
+
key: "emit",
|
|
86
|
+
value: function emit(key) {
|
|
87
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
88
|
+
args[_key - 1] = arguments[_key];
|
|
89
|
+
}
|
|
90
|
+
var subscriber = this.subscribers.find(function (item) {
|
|
91
|
+
return item.key == key;
|
|
92
|
+
});
|
|
93
|
+
if (subscriber && subscriber.listeners && subscriber.listeners.length > 0) {
|
|
94
|
+
subscriber.listeners.forEach(function (listener) {
|
|
95
|
+
listener.apply(void 0, args);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* 查找事件
|
|
102
|
+
*
|
|
103
|
+
* @param {*} key 名称
|
|
104
|
+
* @example
|
|
105
|
+
let subscriber = CrEventCenter.find('名称');
|
|
106
|
+
*/
|
|
107
|
+
}, {
|
|
108
|
+
key: "find",
|
|
109
|
+
value: function find(key) {
|
|
110
|
+
return this.subscribers.find(function (item) {
|
|
111
|
+
return item.key == key;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 清理所有事件
|
|
117
|
+
*
|
|
118
|
+
* @memberof CrEventCenter
|
|
119
|
+
* @example
|
|
120
|
+
CrEventCenter.clear();
|
|
121
|
+
*/
|
|
122
|
+
}, {
|
|
123
|
+
key: "clear",
|
|
124
|
+
value: function clear() {
|
|
125
|
+
this.subscribers.length = 0;
|
|
126
|
+
}
|
|
127
|
+
}]);
|
|
128
|
+
return CrEventCenter;
|
|
129
|
+
}();
|
|
130
|
+
/**
|
|
131
|
+
* 储存订阅者
|
|
132
|
+
*/
|
|
133
|
+
_defineProperty(CrEventCenter, "subscribers", []);
|
|
134
|
+
export { CrEventCenter as default };
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return function(){var e={192:function(e,t,r){"use strict";var n=r(898),o=r(610),i=o(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"==typeof r&&i(e,".prototype.")>-1?o(r):r}},610:function(e,t,r){"use strict";var n=r(345),o=r(898),i=r(481),a=r(115),l=o("%Function.prototype.apply%"),c=o("%Function.prototype.call%"),u=o("%Reflect.apply%",!0)||n.call(c,l),p=r(696),f=o("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new a("a function is required");var t=u(n,c,arguments);return i(t,1+f(0,e.length-(arguments.length-1)),!0)};var s=function(){return u(n,l,arguments)};p?p(e.exports,"apply",{value:s}):e.exports.apply=s},270:function(e,t,r){"use strict";var n=r(944).default,o=r(696),i=r(619),a=r(115),l=r(305);e.exports=function(e,t,r){if(!e||"object"!==n(e)&&"function"!=typeof e)throw new a("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!==n(t))throw new a("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new a("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new a("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new a("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new a("`loose`, if provided, must be a boolean");var c=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,p=arguments.length>5?arguments[5]:null,f=arguments.length>6&&arguments[6],s=!!l&&l(e,t);if(o)o(e,t,{configurable:null===p&&s?s.configurable:!p,enumerable:null===c&&s?s.enumerable:!c,value:r,writable:null===u&&s?s.writable:!u});else{if(!f&&(c||u||p))throw new i("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}}},696:function(e,t,r){"use strict";var n=r(898)("%Object.defineProperty%",!0)||!1;if(n)try{n({},"a",{value:1})}catch(e){n=!1}e.exports=n},413:function(e){"use strict";e.exports=EvalError},497:function(e){"use strict";e.exports=Error},313:function(e){"use strict";e.exports=RangeError},98:function(e){"use strict";e.exports=ReferenceError},619:function(e){"use strict";e.exports=SyntaxError},115:function(e){"use strict";e.exports=TypeError},59:function(e){"use strict";e.exports=URIError},206:function(e){"use strict";var t="Function.prototype.bind called on incompatible ",r=Object.prototype.toString,n=Math.max,o="[object Function]",i=function(e,t){for(var r=[],n=0;n<e.length;n+=1)r[n]=e[n];for(var o=0;o<t.length;o+=1)r[o+e.length]=t[o];return r},a=function(e,t){for(var r=[],n=t||0,o=0;n<e.length;n+=1,o+=1)r[o]=e[n];return r},l=function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r};e.exports=function(e){var c=this;if("function"!=typeof c||r.apply(c)!==o)throw new TypeError(t+c);for(var u,p=a(arguments,1),f=function(){if(this instanceof u){var t=c.apply(this,i(p,arguments));return Object(t)===t?t:this}return c.apply(e,i(p,arguments))},s=n(0,c.length-p.length),y=[],d=0;d<s;d++)y[d]="$"+d;if(u=Function("binder","return function ("+l(y,",")+"){ return binder.apply(this,arguments); }")(f),c.prototype){var b=function(){};b.prototype=c.prototype,u.prototype=new b,b.prototype=null}return u}},345:function(e,t,r){"use strict";var n=r(206);e.exports=Function.prototype.bind||n},898:function(e,t,r){"use strict";var n,o=r(944).default,i=r(497),a=r(413),l=r(313),c=r(98),u=r(619),p=r(115),f=r(59),s=Function,y=function(e){try{return s('"use strict"; return ('+e+").constructor;")()}catch(e){}},d=Object.getOwnPropertyDescriptor;if(d)try{d({},"")}catch(e){d=null}var b=function(){throw new p},g=d?function(){try{return b}catch(e){try{return d(arguments,"callee").get}catch(e){return b}}}():b,m=r(561)(),h=r(390)(),v=Object.getPrototypeOf||(h?function(e){return e.__proto__}:null),S={},w="undefined"!=typeof Uint8Array&&v?v(Uint8Array):n,j={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":m&&v?v([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":S,"%AsyncGenerator%":S,"%AsyncGeneratorFunction%":S,"%AsyncIteratorPrototype%":S,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?n:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":i,"%eval%":eval,"%EvalError%":a,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":s,"%GeneratorFunction%":S,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":m&&v?v(v([][Symbol.iterator]())):n,"%JSON%":"object"===("undefined"==typeof JSON?"undefined":o(JSON))?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&m&&v?v((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":l,"%ReferenceError%":c,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&m&&v?v((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":m&&v?v(""[Symbol.iterator]()):n,"%Symbol%":m?Symbol:n,"%SyntaxError%":u,"%ThrowTypeError%":g,"%TypedArray%":w,"%TypeError%":p,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":f,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet};if(v)try{null.error}catch(e){var x=v(v(e));j["%Error.prototype%"]=x}var O=function e(t){var r;if("%AsyncFunction%"===t)r=y("async function () {}");else if("%GeneratorFunction%"===t)r=y("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=y("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&v&&(r=v(o.prototype))}return j[t]=r,r},A={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},P=r(345),E=r(156),I=P.call(Function.call,Array.prototype.concat),k=P.call(Function.apply,Array.prototype.splice),F=P.call(Function.call,String.prototype.replace),_=P.call(Function.call,String.prototype.slice),D=P.call(Function.call,RegExp.prototype.exec),M=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,N=/\\(\\)?/g,R=function(e){var t=_(e,0,1),r=_(e,-1);if("%"===t&&"%"!==r)throw new u("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new u("invalid intrinsic syntax, expected opening `%`");var n=[];return F(e,M,(function(e,t,r,o){n[n.length]=r?F(o,N,"$1"):t||e})),n},T=function(e,t){var r,n=e;if(E(A,n)&&(n="%"+(r=A[n])[0]+"%"),E(j,n)){var o=j[n];if(o===S&&(o=O(n)),void 0===o&&!t)throw new p("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:o}}throw new u("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new p("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new p('"allowMissing" argument must be a boolean');if(null===D(/^%?[^%]*%?$/,e))throw new u("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=R(e),n=r.length>0?r[0]:"",o=T("%"+n+"%",t),i=o.name,a=o.value,l=!1,c=o.alias;c&&(n=c[0],k(r,I([0,1],c)));for(var f=1,s=!0;f<r.length;f+=1){var y=r[f],b=_(y,0,1),g=_(y,-1);if(('"'===b||"'"===b||"`"===b||'"'===g||"'"===g||"`"===g)&&b!==g)throw new u("property names with quotes must have matching quotes");if("constructor"!==y&&s||(l=!0),E(j,i="%"+(n+="."+y)+"%"))a=j[i];else if(null!=a){if(!(y in a)){if(!t)throw new p("base intrinsic for "+e+" exists, but the property is not available.");return}if(d&&f+1>=r.length){var m=d(a,y);a=(s=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:a[y]}else s=E(a,y),a=a[y];s&&!l&&(j[i]=a)}}return a}},305:function(e,t,r){"use strict";var n=r(898)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(e){n=null}e.exports=n},772:function(e,t,r){"use strict";var n=r(696),o=function(){return!!n};o.hasArrayLengthDefineBug=function(){if(!n)return null;try{return 1!==n([],"length",{value:1}).length}catch(e){return!0}},e.exports=o},390:function(e){"use strict";var t={__proto__:null,foo:{}},r=Object;e.exports=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof r)}},561:function(e,t,r){"use strict";var n=r(944).default,o="undefined"!=typeof Symbol&&Symbol,i=r(300);e.exports=function(){return"function"==typeof o&&("function"==typeof Symbol&&("symbol"===n(o("foo"))&&("symbol"===n(Symbol("bar"))&&i())))}},300:function(e,t,r){"use strict";var n=r(944).default;e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"===n(Symbol.iterator))return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var o=Object.getOwnPropertySymbols(e);if(1!==o.length||o[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},156:function(e,t,r){"use strict";var n=Function.prototype.call,o=Object.prototype.hasOwnProperty,i=r(345);e.exports=i.call(n,o)},182:function(e,t,r){var n=r(944).default,o="function"==typeof Map&&Map.prototype,i=Object.getOwnPropertyDescriptor&&o?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,a=o&&i&&"function"==typeof i.get?i.get:null,l=o&&Map.prototype.forEach,c="function"==typeof Set&&Set.prototype,u=Object.getOwnPropertyDescriptor&&c?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,p=c&&u&&"function"==typeof u.get?u.get:null,f=c&&Set.prototype.forEach,s="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,y="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,d="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,b=Boolean.prototype.valueOf,g=Object.prototype.toString,m=Function.prototype.toString,h=String.prototype.match,v=String.prototype.slice,S=String.prototype.replace,w=String.prototype.toUpperCase,j=String.prototype.toLowerCase,x=RegExp.prototype.test,O=Array.prototype.concat,A=Array.prototype.join,P=Array.prototype.slice,E=Math.floor,I="function"==typeof BigInt?BigInt.prototype.valueOf:null,k=Object.getOwnPropertySymbols,F="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?Symbol.prototype.toString:null,_="function"==typeof Symbol&&"object"===n(Symbol.iterator),D="function"==typeof Symbol&&Symbol.toStringTag&&(n(Symbol.toStringTag)===_||"symbol")?Symbol.toStringTag:null,M=Object.prototype.propertyIsEnumerable,N=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function R(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||x.call(/e/,t))return t;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var n=e<0?-E(-e):E(e);if(n!==e){var o=String(n),i=v.call(t,o.length+1);return S.call(o,r,"$&_")+"."+S.call(S.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return S.call(t,r,"$&_")}var T=r(654),C=T.custom,U=$(C)?C:null;function B(e,t,r){var n="double"===(r.quoteStyle||t)?'"':"'";return n+e+n}function L(e){return S.call(String(e),/"/g,""")}function W(e){return!("[object Array]"!==V(e)||D&&"object"===n(e)&&D in e)}function K(e){return!("[object RegExp]"!==V(e)||D&&"object"===n(e)&&D in e)}function $(e){if(_)return e&&"object"===n(e)&&e instanceof Symbol;if("symbol"===n(e))return!0;if(!e||"object"!==n(e)||!F)return!1;try{return F.call(e),!0}catch(e){}return!1}e.exports=function e(t,o,i,c){var u=o||{};if(H(u,"quoteStyle")&&"single"!==u.quoteStyle&&"double"!==u.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(H(u,"maxStringLength")&&("number"==typeof u.maxStringLength?u.maxStringLength<0&&u.maxStringLength!==1/0:null!==u.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var g=!H(u,"customInspect")||u.customInspect;if("boolean"!=typeof g&&"symbol"!==g)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(H(u,"indent")&&null!==u.indent&&"\t"!==u.indent&&!(parseInt(u.indent,10)===u.indent&&u.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(H(u,"numericSeparator")&&"boolean"!=typeof u.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var w=u.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return z(t,u);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var x=String(t);return w?R(t,x):x}if("bigint"==typeof t){var E=String(t)+"n";return w?R(t,E):E}var k=void 0===u.depth?5:u.depth;if(void 0===i&&(i=0),i>=k&&k>0&&"object"===n(t))return W(t)?"[Array]":"[Object]";var C=function(e,t){var r;if("\t"===e.indent)r="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;r=A.call(Array(e.indent+1)," ")}return{base:r,prev:A.call(Array(t+1),r)}}(u,i);if(void 0===c)c=[];else if(q(c,t)>=0)return"[Circular]";function G(t,r,n){if(r&&(c=P.call(c)).push(r),n){var o={depth:u.depth};return H(u,"quoteStyle")&&(o.quoteStyle=u.quoteStyle),e(t,o,i+1,c)}return e(t,u,i+1,c)}if("function"==typeof t&&!K(t)){var J=function(e){if(e.name)return e.name;var t=h.call(m.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null}(t),te=ee(t,G);return"[Function"+(J?": "+J:" (anonymous)")+"]"+(te.length>0?" { "+A.call(te,", ")+" }":"")}if($(t)){var re=_?S.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):F.call(t);return"object"!==n(t)||_?re:Q(re)}if(function(e){if(!e||"object"!==n(e))return!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return!0;return"string"==typeof e.nodeName&&"function"==typeof e.getAttribute}(t)){for(var ne="<"+j.call(String(t.nodeName)),oe=t.attributes||[],ie=0;ie<oe.length;ie++)ne+=" "+oe[ie].name+"="+B(L(oe[ie].value),"double",u);return ne+=">",t.childNodes&&t.childNodes.length&&(ne+="..."),ne+="</"+j.call(String(t.nodeName))+">"}if(W(t)){if(0===t.length)return"[]";var ae=ee(t,G);return C&&!function(e){for(var t=0;t<e.length;t++)if(q(e[t],"\n")>=0)return!1;return!0}(ae)?"["+Z(ae,C)+"]":"[ "+A.call(ae,", ")+" ]"}if(function(e){return!("[object Error]"!==V(e)||D&&"object"===n(e)&&D in e)}(t)){var le=ee(t,G);return"cause"in Error.prototype||!("cause"in t)||M.call(t,"cause")?0===le.length?"["+String(t)+"]":"{ ["+String(t)+"] "+A.call(le,", ")+" }":"{ ["+String(t)+"] "+A.call(O.call("[cause]: "+G(t.cause),le),", ")+" }"}if("object"===n(t)&&g){if(U&&"function"==typeof t[U]&&T)return T(t,{depth:k-i});if("symbol"!==g&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!a||!e||"object"!==n(e))return!1;try{a.call(e);try{p.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var ce=[];return l&&l.call(t,(function(e,r){ce.push(G(r,t,!0)+" => "+G(e,t))})),Y("Map",a.call(t),ce,C)}if(function(e){if(!p||!e||"object"!==n(e))return!1;try{p.call(e);try{a.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var ue=[];return f&&f.call(t,(function(e){ue.push(G(e,t))})),Y("Set",p.call(t),ue,C)}if(function(e){if(!s||!e||"object"!==n(e))return!1;try{s.call(e,s);try{y.call(e,y)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return X("WeakMap");if(function(e){if(!y||!e||"object"!==n(e))return!1;try{y.call(e,y);try{s.call(e,s)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return X("WeakSet");if(function(e){if(!d||!e||"object"!==n(e))return!1;try{return d.call(e),!0}catch(e){}return!1}(t))return X("WeakRef");if(function(e){return!("[object Number]"!==V(e)||D&&"object"===n(e)&&D in e)}(t))return Q(G(Number(t)));if(function(e){if(!e||"object"!==n(e)||!I)return!1;try{return I.call(e),!0}catch(e){}return!1}(t))return Q(G(I.call(t)));if(function(e){return!("[object Boolean]"!==V(e)||D&&"object"===n(e)&&D in e)}(t))return Q(b.call(t));if(function(e){return!("[object String]"!==V(e)||D&&"object"===n(e)&&D in e)}(t))return Q(G(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if(t===r.g)return"{ [object globalThis] }";if(!function(e){return!("[object Date]"!==V(e)||D&&"object"===n(e)&&D in e)}(t)&&!K(t)){var pe=ee(t,G),fe=N?N(t)===Object.prototype:t instanceof Object||t.constructor===Object,se=t instanceof Object?"":"null prototype",ye=!fe&&D&&Object(t)===t&&D in t?v.call(V(t),8,-1):se?"Object":"",de=(fe||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(ye||se?"["+A.call(O.call([],ye||[],se||[]),": ")+"] ":"");return 0===pe.length?de+"{}":C?de+"{"+Z(pe,C)+"}":de+"{ "+A.call(pe,", ")+" }"}return String(t)};var G=Object.prototype.hasOwnProperty||function(e){return e in this};function H(e,t){return G.call(e,t)}function V(e){return g.call(e)}function q(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}function z(e,t){if(e.length>t.maxStringLength){var r=e.length-t.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return z(v.call(e,0,t.maxStringLength),t)+n}return B(S.call(S.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,J),"single",t)}function J(e){var t=e.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return r?"\\"+r:"\\x"+(t<16?"0":"")+w.call(t.toString(16))}function Q(e){return"Object("+e+")"}function X(e){return e+" { ? }"}function Y(e,t,r,n){return e+" ("+t+") {"+(n?Z(r,n):A.call(r,", "))+"}"}function Z(e,t){if(0===e.length)return"";var r="\n"+t.prev+t.base;return r+A.call(e,","+r)+"\n"+t.prev}function ee(e,t){var r=W(e),n=[];if(r){n.length=e.length;for(var o=0;o<e.length;o++)n[o]=H(e,o)?t(e[o],e):""}var i,a="function"==typeof k?k(e):[];if(_){i={};for(var l=0;l<a.length;l++)i["$"+a[l]]=a[l]}for(var c in e)H(e,c)&&(r&&String(Number(c))===c&&c<e.length||_&&i["$"+c]instanceof Symbol||(x.call(/[^\w$]/,c)?n.push(t(c,e)+": "+t(e[c],e)):n.push(c+": "+t(e[c],e))));if("function"==typeof k)for(var u=0;u<a.length;u++)M.call(e,a[u])&&n.push("["+t(a[u])+"]: "+t(e[a[u]],e));return n}},112:function(e){"use strict";var t=String.prototype.replace,r=/%20/g,n="RFC1738",o="RFC3986";e.exports={default:o,formatters:{RFC1738:function(e){return t.call(e,r,"+")},RFC3986:function(e){return String(e)}},RFC1738:n,RFC3986:o}},460:function(e,t,r){"use strict";var n=r(302),o=r(355),i=r(112);e.exports={formats:i,parse:o,stringify:n}},355:function(e,t,r){"use strict";var n=r(133),o=Object.prototype.hasOwnProperty,i=Array.isArray,a={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:n.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},l=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},c=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},u=function(e,t,r,n){if(e){var i=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/g,l=r.depth>0&&/(\[[^[\]]*])/.exec(i),u=l?i.slice(0,l.index):i,p=[];if(u){if(!r.plainObjects&&o.call(Object.prototype,u)&&!r.allowPrototypes)return;p.push(u)}for(var f=0;r.depth>0&&null!==(l=a.exec(i))&&f<r.depth;){if(f+=1,!r.plainObjects&&o.call(Object.prototype,l[1].slice(1,-1))&&!r.allowPrototypes)return;p.push(l[1])}return l&&p.push("["+i.slice(l.index)+"]"),function(e,t,r,n){for(var o=n?t:c(t,r),i=e.length-1;i>=0;--i){var a,l=e[i];if("[]"===l&&r.parseArrays)a=r.allowEmptyArrays&&""===o?[]:[].concat(o);else{a=r.plainObjects?Object.create(null):{};var u="["===l.charAt(0)&&"]"===l.charAt(l.length-1)?l.slice(1,-1):l,p=r.decodeDotInKeys?u.replace(/%2E/g,"."):u,f=parseInt(p,10);r.parseArrays||""!==p?!isNaN(f)&&l!==p&&String(f)===p&&f>=0&&r.parseArrays&&f<=r.arrayLimit?(a=[])[f]=o:"__proto__"!==p&&(a[p]=o):a={0:o}}o=a}return o}(p,t,r,n)}};e.exports=function(e,t){var r=function(e){if(!e)return a;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.decodeDotInKeys&&"boolean"!=typeof e.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?a.charset:e.charset,r=void 0===e.duplicates?a.duplicates:e.duplicates;if("combine"!==r&&"first"!==r&&"last"!==r)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===e.allowDots?!0===e.decodeDotInKeys||a.allowDots:!!e.allowDots,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:a.allowEmptyArrays,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:a.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:a.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:a.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:a.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:a.comma,decodeDotInKeys:"boolean"==typeof e.decodeDotInKeys?e.decodeDotInKeys:a.decodeDotInKeys,decoder:"function"==typeof e.decoder?e.decoder:a.decoder,delimiter:"string"==typeof e.delimiter||n.isRegExp(e.delimiter)?e.delimiter:a.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:a.depth,duplicates:r,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:a.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:a.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:a.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:a.strictNullHandling}}(t);if(""===e||null==e)return r.plainObjects?Object.create(null):{};for(var p="string"==typeof e?function(e,t){var r,u={__proto__:null},p=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,f=t.parameterLimit===1/0?void 0:t.parameterLimit,s=p.split(t.delimiter,f),y=-1,d=t.charset;if(t.charsetSentinel)for(r=0;r<s.length;++r)0===s[r].indexOf("utf8=")&&("utf8=%E2%9C%93"===s[r]?d="utf-8":"utf8=%26%2310003%3B"===s[r]&&(d="iso-8859-1"),y=r,r=s.length);for(r=0;r<s.length;++r)if(r!==y){var b,g,m=s[r],h=m.indexOf("]="),v=-1===h?m.indexOf("="):h+1;-1===v?(b=t.decoder(m,a.decoder,d,"key"),g=t.strictNullHandling?null:""):(b=t.decoder(m.slice(0,v),a.decoder,d,"key"),g=n.maybeMap(c(m.slice(v+1),t),(function(e){return t.decoder(e,a.decoder,d,"value")}))),g&&t.interpretNumericEntities&&"iso-8859-1"===d&&(g=l(g)),m.indexOf("[]=")>-1&&(g=i(g)?[g]:g);var S=o.call(u,b);S&&"combine"===t.duplicates?u[b]=n.combine(u[b],g):S&&"last"!==t.duplicates||(u[b]=g)}return u}(e,r):e,f=r.plainObjects?Object.create(null):{},s=Object.keys(p),y=0;y<s.length;++y){var d=s[y],b=u(d,p[d],r,"string"==typeof e);f=n.merge(f,b,r)}return!0===r.allowSparse?f:n.compact(f)}},302:function(e,t,r){"use strict";var n=r(944).default,o=r(520),i=r(133),a=r(112),l=Object.prototype.hasOwnProperty,c={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},u=Array.isArray,p=Array.prototype.push,f=function(e,t){p.apply(e,u(t)?t:[t])},s=Date.prototype.toISOString,y=a.default,d={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:i.encode,encodeValuesOnly:!1,format:y,formatter:a.formatters[y],indices:!1,serializeDate:function(e){return s.call(e)},skipNulls:!1,strictNullHandling:!1},b={},g=function e(t,r,a,l,c,p,s,y,g,m,h,v,S,w,j,x,O,A){for(var P,E=t,I=A,k=0,F=!1;void 0!==(I=I.get(b))&&!F;){var _=I.get(t);if(k+=1,void 0!==_){if(_===k)throw new RangeError("Cyclic object value");F=!0}void 0===I.get(b)&&(k=0)}if("function"==typeof m?E=m(r,E):E instanceof Date?E=S(E):"comma"===a&&u(E)&&(E=i.maybeMap(E,(function(e){return e instanceof Date?S(e):e}))),null===E){if(p)return g&&!x?g(r,d.encoder,O,"key",w):r;E=""}if("string"==typeof(P=E)||"number"==typeof P||"boolean"==typeof P||"symbol"===n(P)||"bigint"==typeof P||i.isBuffer(E))return g?[j(x?r:g(r,d.encoder,O,"key",w))+"="+j(g(E,d.encoder,O,"value",w))]:[j(r)+"="+j(String(E))];var D,M=[];if(void 0===E)return M;if("comma"===a&&u(E))x&&g&&(E=i.maybeMap(E,g)),D=[{value:E.length>0?E.join(",")||null:void 0}];else if(u(m))D=m;else{var N=Object.keys(E);D=h?N.sort(h):N}var R=y?r.replace(/\./g,"%2E"):r,T=l&&u(E)&&1===E.length?R+"[]":R;if(c&&u(E)&&0===E.length)return T+"[]";for(var C=0;C<D.length;++C){var U=D[C],B="object"===n(U)&&void 0!==U.value?U.value:E[U];if(!s||null!==B){var L=v&&y?U.replace(/\./g,"%2E"):U,W=u(E)?"function"==typeof a?a(T,L):T:T+(v?"."+L:"["+L+"]");A.set(t,k);var K=o();K.set(b,A),f(M,e(B,W,a,l,c,p,s,y,"comma"===a&&x&&u(E)?null:g,m,h,v,S,w,j,x,O,K))}}return M};e.exports=function(e,t){var r,i=e,p=function(e){if(!e)return d;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.encodeDotInKeys&&"boolean"!=typeof e.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||d.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=a.default;if(void 0!==e.format){if(!l.call(a.formatters,e.format))throw new TypeError("Unknown format option provided.");r=e.format}var n,o=a.formatters[r],i=d.filter;if(("function"==typeof e.filter||u(e.filter))&&(i=e.filter),n=e.arrayFormat in c?e.arrayFormat:"indices"in e?e.indices?"indices":"repeat":d.arrayFormat,"commaRoundTrip"in e&&"boolean"!=typeof e.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var p=void 0===e.allowDots?!0===e.encodeDotInKeys||d.allowDots:!!e.allowDots;return{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:d.addQueryPrefix,allowDots:p,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:d.allowEmptyArrays,arrayFormat:n,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:d.charsetSentinel,commaRoundTrip:e.commaRoundTrip,delimiter:void 0===e.delimiter?d.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:d.encode,encodeDotInKeys:"boolean"==typeof e.encodeDotInKeys?e.encodeDotInKeys:d.encodeDotInKeys,encoder:"function"==typeof e.encoder?e.encoder:d.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:d.encodeValuesOnly,filter:i,format:r,formatter:o,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:d.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:d.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:d.strictNullHandling}}(t);"function"==typeof p.filter?i=(0,p.filter)("",i):u(p.filter)&&(r=p.filter);var s=[];if("object"!==n(i)||null===i)return"";var y=c[p.arrayFormat],b="comma"===y&&p.commaRoundTrip;r||(r=Object.keys(i)),p.sort&&r.sort(p.sort);for(var m=o(),h=0;h<r.length;++h){var v=r[h];p.skipNulls&&null===i[v]||f(s,g(i[v],v,y,b,p.allowEmptyArrays,p.strictNullHandling,p.skipNulls,p.encodeDotInKeys,p.encode?p.encoder:null,p.filter,p.sort,p.allowDots,p.serializeDate,p.format,p.formatter,p.encodeValuesOnly,p.charset,m))}var S=s.join(p.delimiter),w=!0===p.addQueryPrefix?"?":"";return p.charsetSentinel&&("iso-8859-1"===p.charset?w+="utf8=%26%2310003%3B&":w+="utf8=%E2%9C%93&"),S.length>0?w+S:""}},133:function(e,t,r){"use strict";var n=r(944).default,o=r(112),i=Object.prototype.hasOwnProperty,a=Array.isArray,l=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),c=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(r[n]=e[n]);return r},u=1024;e.exports={arrayToObject:c,assign:function(e,t){return Object.keys(t).reduce((function(e,r){return e[r]=t[r],e}),e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],o=0;o<t.length;++o)for(var i=t[o],l=i.obj[i.prop],c=Object.keys(l),u=0;u<c.length;++u){var p=c[u],f=l[p];"object"===n(f)&&null!==f&&-1===r.indexOf(f)&&(t.push({obj:l,prop:p}),r.push(f))}return function(e){for(;e.length>1;){var t=e.pop(),r=t.obj[t.prop];if(a(r)){for(var n=[],o=0;o<r.length;++o)void 0!==r[o]&&n.push(r[o]);t.obj[t.prop]=n}}}(t),e},decode:function(e,t,r){var n=e.replace(/\+/g," ");if("iso-8859-1"===r)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(e){return n}},encode:function(e,t,r,i,a){if(0===e.length)return e;var c=e;if("symbol"===n(e)?c=Symbol.prototype.toString.call(e):"string"!=typeof e&&(c=String(e)),"iso-8859-1"===r)return escape(c).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var p="",f=0;f<c.length;f+=u){for(var s=c.length>=u?c.slice(f,f+u):c,y=[],d=0;d<s.length;++d){var b=s.charCodeAt(d);45===b||46===b||95===b||126===b||b>=48&&b<=57||b>=65&&b<=90||b>=97&&b<=122||a===o.RFC1738&&(40===b||41===b)?y[y.length]=s.charAt(d):b<128?y[y.length]=l[b]:b<2048?y[y.length]=l[192|b>>6]+l[128|63&b]:b<55296||b>=57344?y[y.length]=l[224|b>>12]+l[128|b>>6&63]+l[128|63&b]:(d+=1,b=65536+((1023&b)<<10|1023&s.charCodeAt(d)),y[y.length]=l[240|b>>18]+l[128|b>>12&63]+l[128|b>>6&63]+l[128|63&b])}p+=y.join("")}return p},isBuffer:function(e){return!(!e||"object"!==n(e))&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(a(e)){for(var r=[],n=0;n<e.length;n+=1)r.push(t(e[n]));return r}return t(e)},merge:function e(t,r,o){if(!r)return t;if("object"!==n(r)){if(a(t))t.push(r);else{if(!t||"object"!==n(t))return[t,r];(o&&(o.plainObjects||o.allowPrototypes)||!i.call(Object.prototype,r))&&(t[r]=!0)}return t}if(!t||"object"!==n(t))return[t].concat(r);var l=t;return a(t)&&!a(r)&&(l=c(t,o)),a(t)&&a(r)?(r.forEach((function(r,a){if(i.call(t,a)){var l=t[a];l&&"object"===n(l)&&r&&"object"===n(r)?t[a]=e(l,r,o):t.push(r)}else t[a]=r})),t):Object.keys(r).reduce((function(t,n){var a=r[n];return i.call(t,n)?t[n]=e(t[n],a,o):t[n]=a,t}),l)}}},481:function(e,t,r){"use strict";var n=r(898),o=r(270),i=r(772)(),a=r(305),l=r(115),c=n("%Math.floor%");e.exports=function(e,t){if("function"!=typeof e)throw new l("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||c(t)!==t)throw new l("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],n=!0,u=!0;if("length"in e&&a){var p=a(e,"length");p&&!p.configurable&&(n=!1),p&&!p.writable&&(u=!1)}return(n||u||!r)&&(i?o(e,"length",t,!0,!0):o(e,"length",t)),e}},520:function(e,t,r){"use strict";var n=r(944).default,o=r(898),i=r(192),a=r(182),l=r(115),c=o("%WeakMap%",!0),u=o("%Map%",!0),p=i("WeakMap.prototype.get",!0),f=i("WeakMap.prototype.set",!0),s=i("WeakMap.prototype.has",!0),y=i("Map.prototype.get",!0),d=i("Map.prototype.set",!0),b=i("Map.prototype.has",!0),g=function(e,t){for(var r,n=e;null!==(r=n.next);n=r)if(r.key===t)return n.next=r.next,r.next=e.next,e.next=r,r};e.exports=function(){var e,t,r,o={assert:function(e){if(!o.has(e))throw new l("Side channel does not contain "+a(e))},get:function(o){if(c&&o&&("object"===n(o)||"function"==typeof o)){if(e)return p(e,o)}else if(u){if(t)return y(t,o)}else if(r)return function(e,t){var r=g(e,t);return r&&r.value}(r,o)},has:function(o){if(c&&o&&("object"===n(o)||"function"==typeof o)){if(e)return s(e,o)}else if(u){if(t)return b(t,o)}else if(r)return function(e,t){return!!g(e,t)}(r,o);return!1},set:function(o,i){c&&o&&("object"===n(o)||"function"==typeof o)?(e||(e=new c),f(e,o,i)):u?(t||(t=new u),d(t,o,i)):(r||(r={key:{},next:null}),function(e,t,r){var n=g(e,t);n?n.value=r:e.next={key:t,next:e.next,value:r}}(r,o,i))}};return o}},654:function(){},317:function(e){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n},e.exports.__esModule=!0,e.exports.default=e.exports},180:function(e){e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports},786:function(e,t,r){var n=r(317);e.exports=function(e){if(Array.isArray(e))return n(e)},e.exports.__esModule=!0,e.exports.default=e.exports},486:function(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},702:function(e,t,r){var n=r(281);function o(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,n(o.key),o)}}e.exports=function(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},143:function(e,t,r){var n=r(281);e.exports=function(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},682:function(e){e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},249:function(e){e.exports=function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,l=[],c=!0,u=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(l.push(n.value),l.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}},e.exports.__esModule=!0,e.exports.default=e.exports},20:function(e){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},114:function(e){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},118:function(e,t,r){var n=r(143);function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}e.exports=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e},e.exports.__esModule=!0,e.exports.default=e.exports},925:function(e,t,r){var n=r(180),o=r(249),i=r(508),a=r(20);e.exports=function(e,t){return n(e)||o(e,t)||i(e,t)||a()},e.exports.__esModule=!0,e.exports.default=e.exports},44:function(e,t,r){var n=r(786),o=r(682),i=r(508),a=r(114);e.exports=function(e){return n(e)||o(e)||i(e)||a()},e.exports.__esModule=!0,e.exports.default=e.exports},224:function(e,t,r){var n=r(944).default;e.exports=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},281:function(e,t,r){var n=r(944).default,o=r(224);e.exports=function(e){var t=o(e,"string");return"symbol"==n(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},944:function(e){function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},508:function(e,t,r){var n=r(317);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return function(){"use strict";r.r(n),r.d(n,{CrEventCenter:function(){return c},CrStorage:function(){return u},CrUtil:function(){return S}});var e=r(486),t=r.n(e),o=r(702),i=r.n(o),a=r(143),l=r.n(a),c=function(){function e(){t()(this,e)}return i()(e,null,[{key:"on",value:function(e,t){var r=this,n=this.subscribers.find((function(t){return t.key==e}));n?n.listeners.push(t):this.subscribers.push({key:e,listeners:[t]});var o={key:e,listener:t,remove:function(){r.off(o)}};return o}},{key:"off",value:function(e,t){var r=this.subscribers.findIndex((function(t){return t.key==e.key}));if(r>-1)if("all"==t)this.subscribers.splice(r,1);else{var n=this.subscribers[r],o=n.listeners.findIndex((function(t){return t==e.listener}));o>-1&&n.listeners.splice(o,1)}}},{key:"emit",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var o=this.subscribers.find((function(t){return t.key==e}));o&&o.listeners&&o.listeners.length>0&&o.listeners.forEach((function(e){e.apply(void 0,r)}))}},{key:"find",value:function(e){return this.subscribers.find((function(t){return t.key==e}))}},{key:"clear",value:function(){this.subscribers.length=0}}]),e}();l()(c,"subscribers",[]);var u=function(){function e(){t()(this,e)}return i()(e,null,[{key:"setLocalItem",value:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(t){console.warn("setLocalItem:".concat(e,":").concat(t))}}},{key:"getLocalItem",value:function(e){var t=localStorage.getItem(e);if(!t)return null;if("undefined"===t)return null;try{return JSON.parse(t)}catch(t){return console.warn("getLocalItem:".concat(e,":").concat(t)),null}}},{key:"removeLocalItem",value:function(e){localStorage.removeItem(e)}},{key:"clearLocal",value:function(){localStorage.clear()}},{key:"setSessionItem",value:function(e,t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch(t){console.warn("setSessionItem:".concat(e,":").concat(t))}}},{key:"getSessionItem",value:function(e){var t=sessionStorage.getItem(e);if(!t)return null;if("undefined"===t)return null;try{return JSON.parse(t)}catch(t){return console.warn("getSessionItem:".concat(e,":").concat(t)),null}}},{key:"removeSessionItem",value:function(e){sessionStorage.removeItem(e)}},{key:"clearSession",value:function(){sessionStorage.clear()}}]),e}(),p=r(925),f=r.n(p),s=r(44),y=r.n(s),d=r(118),b=r.n(d),g=r(944),m=r.n(g),h=r(460),v=r.n(h),S=function(){function e(){t()(this,e)}return i()(e,null,[{key:"isArray",value:function(e){return Array.isArray(e)}},{key:"isObject",value:function(t){return"object"===m()(t)&&null!==t&&!e.isArray(t)}},{key:"isEmptyObject",value:function(e){return 0===Object.keys(e).length&&e.constructor===Object}},{key:"isObjectPropertiesAllEmpty",value:function(e){return Object.keys(e).every((function(t){var r=e[t];return null==r||""===r||0===r&&"number"==typeof r||isNaN(r)}))}},{key:"isDate",value:function(e){return"[object Date]"===Object.prototype.toString.call(e)}},{key:"isString",value:function(e){return"[object String]"===Object.prototype.toString.call(e)}},{key:"isNumber",value:function(e){return"number"==typeof e&&!isNaN(e)}},{key:"isFile",value:function(e){return"[object File]"===Object.prototype.toString.call(e)}},{key:"isBoolean",value:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)}},{key:"trim",value:function(e){return(e+"").replace(/(^[\s\n\t]+|[\s\n\t]+$)/g,"")}},{key:"getArrayDimension",value:function(t){if(!e.isArray(t))return 0;for(var r=0,n=0;n<t.length;n++){var o=e.getArrayDimension(t[n]);r=Math.max(r,o)}return r+1}},{key:"deepCopy",value:function(t){var r;if(e.isArray(t)){r=[];for(var n=0,o=t.length;n<o;n++)e.isArray(t[n])||e.isObject(t[n])?r.push(e.deepCopy(t[n])):r.push(t[n])}else if(e.isObject(t))for(var i in r={},t)e.isArray(t[i])||e.isObject(t[i])?r[i]=e.deepCopy(t[i]):r[i]=t[i];else r=t;return r}},{key:"listToTreeData",value:function(t,r){var n=Object.assign({idField:"id",pidField:"parentId",childrenField:"children",isDeepCopy:!1,getData:function(e){return e}},r);n.isDeepCopy&&(t=e.deepCopy(t));var o=[],i={};return t.forEach((function(e){o.push(n.getData(e)),i[e[n.idField]]=e})),o.filter((function(e){var t=o.filter((function(t){return e[n.idField]==t[n.pidField]}));return null!=t&&t.length>0&&(e[n.childrenField]=t),0==e[n.pidField]||null==e[n.pidField]||null==e[n.pidField]||!i[e[n.pidField]]}))}},{key:"treeDataToListData",value:function(t){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,o=Object.assign({idField:"id",pidField:"parentId",childrenField:"children",isDeepCopy:!1},n),i=[],a=0;a<t.length;a++){var l=t[a],c=b()({},l);if(c[o.pidField]=r,delete c[o.childrenField],i.push(c),l[o.childrenField]){var u,p=this.treeDataToListData(l[o.childrenField],c[o.idField],n);(u=i).push.apply(u,y()(p))}}return o.isDeepCopy&&(i=e.deepCopy(i)),i}},{key:"getParentNodes",value:function(e,t,r){var n=Object.assign({valueField:"value",idField:"id",pidField:"parentId",getData:function(e){return e}},r);if(!(e&&e.length>0&&t))return[];var o=n.idField,i=n.pidField,a=n.valueField,l=[],c=e.find((function(e){return e[a]==t}));if(c)for(l.push(n.getData(c));c&&c[i];){var u=e.find((function(e){return e[o]==c[i]}));u&&l.push(n.getData(u)),c=u}return l.reverse(),l}},{key:"paramsSerializer",value:function(e,t){return Object.assign({isFilterNonNull:!1},t).isFilterNonNull&&(e=Object.fromEntries(Object.entries(e).filter((function(e){var t=f()(e,2),r=(t[0],t[1]);return!(null==r||""===r)})))),v().stringify(e)}},{key:"paramsParse",value:function(e,t){var r={},n=Object.assign({ignoreQueryPrefix:!0},t);return e&&(r=v().parse(e,n)),r}},{key:"compareVersion",value:function(t,r){for(var n=e.trim(t).split("."),o=e.trim(r).split("."),i=Math.max(t.length,r.length);n.length<i;)n.push("0");for(;o.length<i;)o.push("0");for(var a=0;a<i;a++){var l=parseInt(n[a]),c=parseInt(o[a]);if(l>c)return 1;if(l<c)return-1}return 0}},{key:"getDataNameByIds",value:function(e,t,r){var n=Object.assign({sep:"、",idField:"id",nameField:"name"},r),o="";return t&&t.length>0&&(o=t.map((function(t){var r=e.find((function(e){return e[n.idField]==t}));return r?r[n.nameField]:""})).join(n.sep)),o}},{key:"appendHtmlTagAttr",value:function(e,t,r,n){var o=new RegExp("(<".concat(t,"\\s+)([^>]*?)([^>]*>)"),"g"),i=e.replace(o,(function(e,o,i,a){if(new RegExp("".concat(r,'="(.*?)"'),"g").exec(e)){var l=new RegExp("(<".concat(t,"\\s+)([^>]*?)").concat(r,'="(.*)"([^>]*>)'),"g");return e.replace(l,(function(e,t,o,i,a){return t+o+"".concat(r,'="').concat(i," ").concat(n,'"')+a}))}return o+"".concat(r,'="').concat(n,'" ')+a}));return i=i.replace(new RegExp("<".concat(t,">"),"g"),"<".concat(t," ").concat(r,'="').concat(n,'">'))}},{key:"compareDataDiff",value:function(t,r){var n={};return function t(r,o,i){if(e.isArray(o)&&e.isArray(i)){var a=o.length-i.length;if(0!==a)if(n[r]="modified",a>0)for(var l=i.length;l<o.length;l++)n["".concat(r,"[").concat(l,"]")]="removed";else for(var c=o.length;c<i.length;c++)n["".concat(r,"[").concat(c,"]")]="added";else for(var u=0;u<o.length;u++)t("".concat(r,"[").concat(u,"]"),o[u],i[u])}else if(e.isObject(o)&&e.isObject(i)){for(var p in o){var f=r?"".concat(r,".").concat(p):p;Object.prototype.hasOwnProperty.call(o,p)&&!(p in i)?n[f]="removed":Object.prototype.hasOwnProperty.call(i,p)&&t(f,o[p],i[p])}for(var s in i){var y=r?"".concat(r,".").concat(s):s;Object.prototype.hasOwnProperty.call(i,s)&&!(s in o)&&(n[y]="added")}}else o!==i&&(n[r]="modified")}("",t,r),n}}]),e}()}(),n}()}));
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export default class CrStorage {
|
|
2
|
+
/**
|
|
3
|
+
* 设置本地存储
|
|
4
|
+
* @param key
|
|
5
|
+
* @param data
|
|
6
|
+
*/
|
|
7
|
+
static setLocalItem(key: string, data: any): void;
|
|
8
|
+
/**
|
|
9
|
+
* 获取本地存储
|
|
10
|
+
* @param key
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
static getLocalItem<T = any>(key: string): T | null;
|
|
14
|
+
/**
|
|
15
|
+
* 清除某个本地存储
|
|
16
|
+
* @param key
|
|
17
|
+
*/
|
|
18
|
+
static removeLocalItem(key: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* 清除所有本地存储
|
|
21
|
+
*/
|
|
22
|
+
static clearLocal(): void;
|
|
23
|
+
/**
|
|
24
|
+
* 设置会话存储
|
|
25
|
+
* @param key
|
|
26
|
+
* @param data
|
|
27
|
+
*/
|
|
28
|
+
static setSessionItem(key: string, data: any): void;
|
|
29
|
+
/**
|
|
30
|
+
* 获取会话存储
|
|
31
|
+
* @param key
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
static getSessionItem<T = any>(key: string): T | null;
|
|
35
|
+
/**
|
|
36
|
+
* 清除某个会话存储
|
|
37
|
+
* @param key
|
|
38
|
+
*/
|
|
39
|
+
static removeSessionItem(key: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* 清除所有会话存储
|
|
42
|
+
*/
|
|
43
|
+
static clearSession(): void;
|
|
44
|
+
}
|
package/dist/storage.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
var CrStorage = /*#__PURE__*/function () {
|
|
8
|
+
function CrStorage() {
|
|
9
|
+
_classCallCheck(this, CrStorage);
|
|
10
|
+
}
|
|
11
|
+
_createClass(CrStorage, null, [{
|
|
12
|
+
key: "setLocalItem",
|
|
13
|
+
value:
|
|
14
|
+
/**
|
|
15
|
+
* 设置本地存储
|
|
16
|
+
* @param key
|
|
17
|
+
* @param data
|
|
18
|
+
*/
|
|
19
|
+
function setLocalItem(key, data) {
|
|
20
|
+
try {
|
|
21
|
+
localStorage.setItem(key, JSON.stringify(data));
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.warn("setLocalItem:".concat(key, ":").concat(error));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 获取本地存储
|
|
29
|
+
* @param key
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
}, {
|
|
33
|
+
key: "getLocalItem",
|
|
34
|
+
value: function getLocalItem(key) {
|
|
35
|
+
var str = localStorage.getItem(key);
|
|
36
|
+
if (str) {
|
|
37
|
+
if (str === 'undefined') {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
return JSON.parse(str);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.warn("getLocalItem:".concat(key, ":").concat(error));
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 清除某个本地存储
|
|
53
|
+
* @param key
|
|
54
|
+
*/
|
|
55
|
+
}, {
|
|
56
|
+
key: "removeLocalItem",
|
|
57
|
+
value: function removeLocalItem(key) {
|
|
58
|
+
localStorage.removeItem(key);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 清除所有本地存储
|
|
63
|
+
*/
|
|
64
|
+
}, {
|
|
65
|
+
key: "clearLocal",
|
|
66
|
+
value: function clearLocal() {
|
|
67
|
+
localStorage.clear();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 设置会话存储
|
|
72
|
+
* @param key
|
|
73
|
+
* @param data
|
|
74
|
+
*/
|
|
75
|
+
}, {
|
|
76
|
+
key: "setSessionItem",
|
|
77
|
+
value: function setSessionItem(key, data) {
|
|
78
|
+
try {
|
|
79
|
+
sessionStorage.setItem(key, JSON.stringify(data));
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.warn("setSessionItem:".concat(key, ":").concat(error));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 获取会话存储
|
|
87
|
+
* @param key
|
|
88
|
+
* @returns
|
|
89
|
+
*/
|
|
90
|
+
}, {
|
|
91
|
+
key: "getSessionItem",
|
|
92
|
+
value: function getSessionItem(key) {
|
|
93
|
+
var str = sessionStorage.getItem(key);
|
|
94
|
+
if (str) {
|
|
95
|
+
if (str === 'undefined') {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
return JSON.parse(str);
|
|
100
|
+
} catch (error) {
|
|
101
|
+
console.warn("getSessionItem:".concat(key, ":").concat(error));
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* 清除某个会话存储
|
|
111
|
+
* @param key
|
|
112
|
+
*/
|
|
113
|
+
}, {
|
|
114
|
+
key: "removeSessionItem",
|
|
115
|
+
value: function removeSessionItem(key) {
|
|
116
|
+
sessionStorage.removeItem(key);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* 清除所有会话存储
|
|
121
|
+
*/
|
|
122
|
+
}, {
|
|
123
|
+
key: "clearSession",
|
|
124
|
+
value: function clearSession() {
|
|
125
|
+
sessionStorage.clear();
|
|
126
|
+
}
|
|
127
|
+
}]);
|
|
128
|
+
return CrStorage;
|
|
129
|
+
}();
|
|
130
|
+
export { CrStorage as default };
|
package/dist/util.d.ts
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
export default class CrUtil {
|
|
2
|
+
/**
|
|
3
|
+
* 判断是否为数组
|
|
4
|
+
* @param value
|
|
5
|
+
* @returns boolean
|
|
6
|
+
*/
|
|
7
|
+
static isArray<T = any>(value: any): value is T[];
|
|
8
|
+
/**
|
|
9
|
+
* 判断是否为对象
|
|
10
|
+
* @param value
|
|
11
|
+
* @returns boolean
|
|
12
|
+
*/
|
|
13
|
+
static isObject<T = any>(value: T): value is T extends Array<any> ? never : T;
|
|
14
|
+
/**
|
|
15
|
+
* 判断是否为空对象
|
|
16
|
+
* @param value
|
|
17
|
+
* @returns boolean
|
|
18
|
+
*/
|
|
19
|
+
static isEmptyObject(value: object): value is Record<string | number, never>;
|
|
20
|
+
/**
|
|
21
|
+
* 判断是否对象的属性是否全部为空
|
|
22
|
+
* @param value
|
|
23
|
+
* @returns boolean
|
|
24
|
+
*/
|
|
25
|
+
static isObjectPropertiesAllEmpty(value: Record<string | number, any>): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* 判断是否为日期
|
|
28
|
+
* @param value
|
|
29
|
+
* @returns boolean
|
|
30
|
+
*/
|
|
31
|
+
static isDate(value: any): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* 判断是否为字符串
|
|
34
|
+
* @param value
|
|
35
|
+
* @returns boolean
|
|
36
|
+
*/
|
|
37
|
+
static isString(value: any): value is string;
|
|
38
|
+
/**
|
|
39
|
+
* 判断是否为数字
|
|
40
|
+
* @param value
|
|
41
|
+
* @returns boolean
|
|
42
|
+
*/
|
|
43
|
+
static isNumber(value: any): value is number;
|
|
44
|
+
/**
|
|
45
|
+
* 判断是否为文件 File
|
|
46
|
+
* @param value
|
|
47
|
+
* @returns boolean
|
|
48
|
+
*/
|
|
49
|
+
static isFile(value: any): value is File;
|
|
50
|
+
/**
|
|
51
|
+
* 判断是否为 Boolean
|
|
52
|
+
* @param value
|
|
53
|
+
* @returns boolean
|
|
54
|
+
*/
|
|
55
|
+
static isBoolean(value: any): value is boolean;
|
|
56
|
+
/**
|
|
57
|
+
* 去掉字符串前后所有空格
|
|
58
|
+
* @param str
|
|
59
|
+
* @returns string
|
|
60
|
+
*/
|
|
61
|
+
static trim(str: string): string;
|
|
62
|
+
/**
|
|
63
|
+
* 获取数组为几维数组
|
|
64
|
+
* @param arr
|
|
65
|
+
* @returns number
|
|
66
|
+
*/
|
|
67
|
+
static getArrayDimension(arr: any[]): number;
|
|
68
|
+
/**
|
|
69
|
+
* 深拷贝
|
|
70
|
+
* @param target
|
|
71
|
+
* @returns
|
|
72
|
+
*/
|
|
73
|
+
static deepCopy<T = any>(target: T): T;
|
|
74
|
+
/**
|
|
75
|
+
* 列表数据转树型数据
|
|
76
|
+
* @param listData
|
|
77
|
+
* @param settings
|
|
78
|
+
* @returns
|
|
79
|
+
*/
|
|
80
|
+
static listToTreeData(listData: any[], settings?: {
|
|
81
|
+
idField?: string;
|
|
82
|
+
pidField?: string;
|
|
83
|
+
childrenField?: string;
|
|
84
|
+
isDeepCopy?: boolean;
|
|
85
|
+
getData?: (item: any) => any;
|
|
86
|
+
}): any[];
|
|
87
|
+
/**
|
|
88
|
+
* 树型数据转列表数据
|
|
89
|
+
* @param treeData
|
|
90
|
+
* @param settings
|
|
91
|
+
* @returns
|
|
92
|
+
*/
|
|
93
|
+
static treeDataToListData(treeData: any[], pid?: string | number, settings?: {
|
|
94
|
+
childrenField?: string;
|
|
95
|
+
idField?: string;
|
|
96
|
+
pidField?: string;
|
|
97
|
+
isDeepCopy?: boolean;
|
|
98
|
+
}): any[];
|
|
99
|
+
/**
|
|
100
|
+
* 获取所有父级数据(包含自身)
|
|
101
|
+
* @param listData
|
|
102
|
+
* @param value
|
|
103
|
+
* @param settings
|
|
104
|
+
* @returns
|
|
105
|
+
*/
|
|
106
|
+
static getParentNodes<T, R extends Record<string, any>>(listData: R[], value: number | string, settings?: {
|
|
107
|
+
valueField?: string;
|
|
108
|
+
idField?: string;
|
|
109
|
+
pidField?: string;
|
|
110
|
+
getData?: (item: R) => T;
|
|
111
|
+
}): T[];
|
|
112
|
+
/**
|
|
113
|
+
* 参数序列化
|
|
114
|
+
* @param params {a:'1',b:{},c:[]}
|
|
115
|
+
* @returns
|
|
116
|
+
*/
|
|
117
|
+
static paramsSerializer(params: Record<string, any>, settings?: {
|
|
118
|
+
isFilterNonNull: boolean;
|
|
119
|
+
}): string;
|
|
120
|
+
/**
|
|
121
|
+
* 参数解析
|
|
122
|
+
* @param {*} str
|
|
123
|
+
* @param {*} settings
|
|
124
|
+
* @returns
|
|
125
|
+
*/
|
|
126
|
+
static paramsParse(str: string, settings?: {
|
|
127
|
+
ignoreQueryPrefix: boolean;
|
|
128
|
+
}): {};
|
|
129
|
+
/**
|
|
130
|
+
* 版本号比较
|
|
131
|
+
* @param v1
|
|
132
|
+
* @param v2
|
|
133
|
+
* @returns number
|
|
134
|
+
* @description v1大于v2(1)、v1小于v2(-1)、v1等于v2(0)
|
|
135
|
+
*/
|
|
136
|
+
static compareVersion(v1: string, v2: string): number;
|
|
137
|
+
/**
|
|
138
|
+
* 根据 ids 获取相对应的数据名称
|
|
139
|
+
* @param data
|
|
140
|
+
* @param ids
|
|
141
|
+
* @param settings
|
|
142
|
+
* @returns string
|
|
143
|
+
*/
|
|
144
|
+
static getDataNameByIds<T extends Record<string, any>>(data: T[], ids: (string | number)[], settings?: {
|
|
145
|
+
sep?: string;
|
|
146
|
+
nameField?: string;
|
|
147
|
+
idField?: string;
|
|
148
|
+
}): string;
|
|
149
|
+
/**
|
|
150
|
+
* 追加html标签属性值
|
|
151
|
+
* @param htmlStr
|
|
152
|
+
* @param tagName
|
|
153
|
+
* @param attrName
|
|
154
|
+
* @param newAttrValue
|
|
155
|
+
* @returns string
|
|
156
|
+
*/
|
|
157
|
+
static appendHtmlTagAttr(htmlStr: string, tagName: string, attrName: string, newAttrValue: string): string;
|
|
158
|
+
/**
|
|
159
|
+
* 比较数据差异
|
|
160
|
+
* @param data1
|
|
161
|
+
* @param data2
|
|
162
|
+
* @returns
|
|
163
|
+
*/
|
|
164
|
+
static compareDataDiff(data1: any, data2: any): Record<string, "added" | "removed" | "modified">;
|
|
165
|
+
}
|
package/dist/util.js
ADDED
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
4
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
5
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
15
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
16
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
17
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
19
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
|
+
import Qs from 'qs';
|
|
21
|
+
var CrUtil = /*#__PURE__*/function () {
|
|
22
|
+
function CrUtil() {
|
|
23
|
+
_classCallCheck(this, CrUtil);
|
|
24
|
+
}
|
|
25
|
+
_createClass(CrUtil, null, [{
|
|
26
|
+
key: "isArray",
|
|
27
|
+
value:
|
|
28
|
+
/**
|
|
29
|
+
* 判断是否为数组
|
|
30
|
+
* @param value
|
|
31
|
+
* @returns boolean
|
|
32
|
+
*/
|
|
33
|
+
function isArray(value) {
|
|
34
|
+
return Array.isArray(value);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 判断是否为对象
|
|
39
|
+
* @param value
|
|
40
|
+
* @returns boolean
|
|
41
|
+
*/
|
|
42
|
+
}, {
|
|
43
|
+
key: "isObject",
|
|
44
|
+
value: function isObject(value) {
|
|
45
|
+
return _typeof(value) === 'object' && value !== null && !CrUtil.isArray(value);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 判断是否为空对象
|
|
50
|
+
* @param value
|
|
51
|
+
* @returns boolean
|
|
52
|
+
*/
|
|
53
|
+
}, {
|
|
54
|
+
key: "isEmptyObject",
|
|
55
|
+
value: function isEmptyObject(value) {
|
|
56
|
+
return Object.keys(value).length === 0 && value.constructor === Object;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 判断是否对象的属性是否全部为空
|
|
61
|
+
* @param value
|
|
62
|
+
* @returns boolean
|
|
63
|
+
*/
|
|
64
|
+
}, {
|
|
65
|
+
key: "isObjectPropertiesAllEmpty",
|
|
66
|
+
value: function isObjectPropertiesAllEmpty(value) {
|
|
67
|
+
return Object.keys(value).every(function (key) {
|
|
68
|
+
var _value = value[key];
|
|
69
|
+
return _value === undefined || _value === null || _value === '' || _value === 0 && typeof _value === 'number' || isNaN(_value);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 判断是否为日期
|
|
75
|
+
* @param value
|
|
76
|
+
* @returns boolean
|
|
77
|
+
*/
|
|
78
|
+
}, {
|
|
79
|
+
key: "isDate",
|
|
80
|
+
value: function isDate(value) {
|
|
81
|
+
return Object.prototype.toString.call(value) === '[object Date]';
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* 判断是否为字符串
|
|
86
|
+
* @param value
|
|
87
|
+
* @returns boolean
|
|
88
|
+
*/
|
|
89
|
+
}, {
|
|
90
|
+
key: "isString",
|
|
91
|
+
value: function isString(value) {
|
|
92
|
+
return Object.prototype.toString.call(value) === '[object String]';
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 判断是否为数字
|
|
97
|
+
* @param value
|
|
98
|
+
* @returns boolean
|
|
99
|
+
*/
|
|
100
|
+
}, {
|
|
101
|
+
key: "isNumber",
|
|
102
|
+
value: function isNumber(value) {
|
|
103
|
+
return typeof value === 'number' && !isNaN(value);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* 判断是否为文件 File
|
|
108
|
+
* @param value
|
|
109
|
+
* @returns boolean
|
|
110
|
+
*/
|
|
111
|
+
}, {
|
|
112
|
+
key: "isFile",
|
|
113
|
+
value: function isFile(value) {
|
|
114
|
+
return Object.prototype.toString.call(value) === '[object File]';
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* 判断是否为 Boolean
|
|
119
|
+
* @param value
|
|
120
|
+
* @returns boolean
|
|
121
|
+
*/
|
|
122
|
+
}, {
|
|
123
|
+
key: "isBoolean",
|
|
124
|
+
value: function isBoolean(value) {
|
|
125
|
+
return Object.prototype.toString.call(value) === '[object Boolean]';
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* 去掉字符串前后所有空格
|
|
130
|
+
* @param str
|
|
131
|
+
* @returns string
|
|
132
|
+
*/
|
|
133
|
+
}, {
|
|
134
|
+
key: "trim",
|
|
135
|
+
value: function trim(str) {
|
|
136
|
+
return (str + '').replace(/(^[\s\n\t]+|[\s\n\t]+$)/g, '');
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* 获取数组为几维数组
|
|
141
|
+
* @param arr
|
|
142
|
+
* @returns number
|
|
143
|
+
*/
|
|
144
|
+
}, {
|
|
145
|
+
key: "getArrayDimension",
|
|
146
|
+
value: function getArrayDimension(arr) {
|
|
147
|
+
// 如果不是一个数组,返回 0
|
|
148
|
+
if (!CrUtil.isArray(arr)) return 0;
|
|
149
|
+
|
|
150
|
+
// 找到数组中的最大维度
|
|
151
|
+
var maxDimension = 0;
|
|
152
|
+
for (var i = 0; i < arr.length; i++) {
|
|
153
|
+
var dimension = CrUtil.getArrayDimension(arr[i]);
|
|
154
|
+
maxDimension = Math.max(maxDimension, dimension);
|
|
155
|
+
}
|
|
156
|
+
// 返回最大维度加1,代表当前层数
|
|
157
|
+
return maxDimension + 1;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* 深拷贝
|
|
162
|
+
* @param target
|
|
163
|
+
* @returns
|
|
164
|
+
*/
|
|
165
|
+
}, {
|
|
166
|
+
key: "deepCopy",
|
|
167
|
+
value: function deepCopy(target) {
|
|
168
|
+
var _target;
|
|
169
|
+
if (CrUtil.isArray(target)) {
|
|
170
|
+
_target = [];
|
|
171
|
+
for (var i = 0, len = target.length; i < len; i++) {
|
|
172
|
+
if (CrUtil.isArray(target[i]) || CrUtil.isObject(target[i])) {
|
|
173
|
+
_target.push(CrUtil.deepCopy(target[i]));
|
|
174
|
+
} else {
|
|
175
|
+
_target.push(target[i]);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
} else if (CrUtil.isObject(target)) {
|
|
179
|
+
_target = {};
|
|
180
|
+
for (var _i in target) {
|
|
181
|
+
if (CrUtil.isArray(target[_i]) || CrUtil.isObject(target[_i])) {
|
|
182
|
+
_target[_i] = CrUtil.deepCopy(target[_i]);
|
|
183
|
+
} else {
|
|
184
|
+
_target[_i] = target[_i];
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
} else {
|
|
188
|
+
_target = target;
|
|
189
|
+
}
|
|
190
|
+
return _target;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* 列表数据转树型数据
|
|
195
|
+
* @param listData
|
|
196
|
+
* @param settings
|
|
197
|
+
* @returns
|
|
198
|
+
*/
|
|
199
|
+
}, {
|
|
200
|
+
key: "listToTreeData",
|
|
201
|
+
value: function listToTreeData(listData, settings) {
|
|
202
|
+
var options = Object.assign({
|
|
203
|
+
idField: 'id',
|
|
204
|
+
pidField: 'parentId',
|
|
205
|
+
childrenField: 'children',
|
|
206
|
+
isDeepCopy: false,
|
|
207
|
+
getData: function getData(item) {
|
|
208
|
+
return item;
|
|
209
|
+
}
|
|
210
|
+
}, settings);
|
|
211
|
+
if (options.isDeepCopy) {
|
|
212
|
+
listData = CrUtil.deepCopy(listData);
|
|
213
|
+
}
|
|
214
|
+
var _listData = [];
|
|
215
|
+
var itemMap = {};
|
|
216
|
+
listData.forEach(function (item) {
|
|
217
|
+
_listData.push(options.getData(item));
|
|
218
|
+
itemMap[item[options.idField]] = item;
|
|
219
|
+
});
|
|
220
|
+
var treeData = _listData.filter(function (item) {
|
|
221
|
+
// 获取子级数据
|
|
222
|
+
var itemArray = _listData.filter(function (child) {
|
|
223
|
+
return item[options.idField] == child[options.pidField];
|
|
224
|
+
});
|
|
225
|
+
if (itemArray != null && itemArray.length > 0) {
|
|
226
|
+
// 如果存在子级,则给父级添加一个children属性,并赋值
|
|
227
|
+
item[options.childrenField] = itemArray;
|
|
228
|
+
}
|
|
229
|
+
// 返回第一层
|
|
230
|
+
return item[options.pidField] == 0 || item[options.pidField] == null || item[options.pidField] == undefined || !itemMap[item[options.pidField]];
|
|
231
|
+
});
|
|
232
|
+
return treeData;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* 树型数据转列表数据
|
|
237
|
+
* @param treeData
|
|
238
|
+
* @param settings
|
|
239
|
+
* @returns
|
|
240
|
+
*/
|
|
241
|
+
}, {
|
|
242
|
+
key: "treeDataToListData",
|
|
243
|
+
value: function treeDataToListData(treeData) {
|
|
244
|
+
var pid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
245
|
+
var settings = arguments.length > 2 ? arguments[2] : undefined;
|
|
246
|
+
var options = Object.assign({
|
|
247
|
+
idField: 'id',
|
|
248
|
+
pidField: 'parentId',
|
|
249
|
+
childrenField: 'children',
|
|
250
|
+
isDeepCopy: false
|
|
251
|
+
}, settings);
|
|
252
|
+
var listData = [];
|
|
253
|
+
for (var i = 0; i < treeData.length; i++) {
|
|
254
|
+
var node = treeData[i];
|
|
255
|
+
var _item = _objectSpread({}, node);
|
|
256
|
+
_item[options.pidField] = pid;
|
|
257
|
+
delete _item[options.childrenField];
|
|
258
|
+
listData.push(_item);
|
|
259
|
+
if (node[options.childrenField]) {
|
|
260
|
+
var _listData2;
|
|
261
|
+
var childrenList = this.treeDataToListData(node[options.childrenField], _item[options.idField], settings);
|
|
262
|
+
(_listData2 = listData).push.apply(_listData2, _toConsumableArray(childrenList));
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (options.isDeepCopy) {
|
|
266
|
+
listData = CrUtil.deepCopy(listData);
|
|
267
|
+
}
|
|
268
|
+
return listData;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* 获取所有父级数据(包含自身)
|
|
273
|
+
* @param listData
|
|
274
|
+
* @param value
|
|
275
|
+
* @param settings
|
|
276
|
+
* @returns
|
|
277
|
+
*/
|
|
278
|
+
}, {
|
|
279
|
+
key: "getParentNodes",
|
|
280
|
+
value: function getParentNodes(listData, value, settings) {
|
|
281
|
+
var options = Object.assign({
|
|
282
|
+
valueField: 'value',
|
|
283
|
+
idField: 'id',
|
|
284
|
+
pidField: 'parentId',
|
|
285
|
+
getData: function getData(item) {
|
|
286
|
+
return item;
|
|
287
|
+
}
|
|
288
|
+
}, settings);
|
|
289
|
+
if (!(listData && listData.length > 0) || !value) {
|
|
290
|
+
return [];
|
|
291
|
+
}
|
|
292
|
+
var idField = options.idField;
|
|
293
|
+
var pidField = options.pidField;
|
|
294
|
+
var valueField = options.valueField;
|
|
295
|
+
var nodes = [];
|
|
296
|
+
var node = listData.find(function (item) {
|
|
297
|
+
return item[valueField] == value;
|
|
298
|
+
});
|
|
299
|
+
if (node) {
|
|
300
|
+
nodes.push(options.getData(node));
|
|
301
|
+
while (node && node[pidField]) {
|
|
302
|
+
var parentOption = listData.find(
|
|
303
|
+
// eslint-disable-next-line @typescript-eslint/no-loop-func
|
|
304
|
+
function (item) {
|
|
305
|
+
return item[idField] == node[pidField];
|
|
306
|
+
});
|
|
307
|
+
if (parentOption) {
|
|
308
|
+
nodes.push(options.getData(parentOption));
|
|
309
|
+
}
|
|
310
|
+
node = parentOption;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
nodes.reverse();
|
|
314
|
+
return nodes;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* 参数序列化
|
|
319
|
+
* @param params {a:'1',b:{},c:[]}
|
|
320
|
+
* @returns
|
|
321
|
+
*/
|
|
322
|
+
}, {
|
|
323
|
+
key: "paramsSerializer",
|
|
324
|
+
value: function paramsSerializer(params, settings) {
|
|
325
|
+
var options = Object.assign({
|
|
326
|
+
isFilterNonNull: false
|
|
327
|
+
}, settings);
|
|
328
|
+
if (options.isFilterNonNull) {
|
|
329
|
+
params = Object.fromEntries(Object.entries(params).filter(function (_ref) {
|
|
330
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
331
|
+
k = _ref2[0],
|
|
332
|
+
v = _ref2[1];
|
|
333
|
+
return !(v === null || v === undefined || v === '');
|
|
334
|
+
}));
|
|
335
|
+
}
|
|
336
|
+
return Qs.stringify(params);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* 参数解析
|
|
341
|
+
* @param {*} str
|
|
342
|
+
* @param {*} settings
|
|
343
|
+
* @returns
|
|
344
|
+
*/
|
|
345
|
+
}, {
|
|
346
|
+
key: "paramsParse",
|
|
347
|
+
value: function paramsParse(str, settings) {
|
|
348
|
+
var obj = {};
|
|
349
|
+
var option = Object.assign({
|
|
350
|
+
ignoreQueryPrefix: true
|
|
351
|
+
}, settings);
|
|
352
|
+
if (str) {
|
|
353
|
+
obj = Qs.parse(str, option);
|
|
354
|
+
}
|
|
355
|
+
return obj;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* 版本号比较
|
|
360
|
+
* @param v1
|
|
361
|
+
* @param v2
|
|
362
|
+
* @returns number
|
|
363
|
+
* @description v1大于v2(1)、v1小于v2(-1)、v1等于v2(0)
|
|
364
|
+
*/
|
|
365
|
+
}, {
|
|
366
|
+
key: "compareVersion",
|
|
367
|
+
value: function compareVersion(v1, v2) {
|
|
368
|
+
var v1Arr = CrUtil.trim(v1).split('.');
|
|
369
|
+
var v2Arr = CrUtil.trim(v2).split('.');
|
|
370
|
+
var len = Math.max(v1.length, v2.length);
|
|
371
|
+
while (v1Arr.length < len) {
|
|
372
|
+
v1Arr.push('0');
|
|
373
|
+
}
|
|
374
|
+
while (v2Arr.length < len) {
|
|
375
|
+
v2Arr.push('0');
|
|
376
|
+
}
|
|
377
|
+
for (var i = 0; i < len; i++) {
|
|
378
|
+
var num1 = parseInt(v1Arr[i]);
|
|
379
|
+
var num2 = parseInt(v2Arr[i]);
|
|
380
|
+
if (num1 > num2) {
|
|
381
|
+
return 1;
|
|
382
|
+
} else if (num1 < num2) {
|
|
383
|
+
return -1;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
return 0;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* 根据 ids 获取相对应的数据名称
|
|
391
|
+
* @param data
|
|
392
|
+
* @param ids
|
|
393
|
+
* @param settings
|
|
394
|
+
* @returns string
|
|
395
|
+
*/
|
|
396
|
+
}, {
|
|
397
|
+
key: "getDataNameByIds",
|
|
398
|
+
value: function getDataNameByIds(data, ids, settings) {
|
|
399
|
+
var options = Object.assign({
|
|
400
|
+
sep: '、',
|
|
401
|
+
idField: 'id',
|
|
402
|
+
nameField: 'name'
|
|
403
|
+
}, settings);
|
|
404
|
+
var str = '';
|
|
405
|
+
if (ids && ids.length > 0) {
|
|
406
|
+
str = ids.map(function (id) {
|
|
407
|
+
var item = data.find(function (item) {
|
|
408
|
+
return item[options.idField] == id;
|
|
409
|
+
});
|
|
410
|
+
if (item) {
|
|
411
|
+
return item[options.nameField];
|
|
412
|
+
} else {
|
|
413
|
+
return '';
|
|
414
|
+
}
|
|
415
|
+
}).join(options.sep);
|
|
416
|
+
}
|
|
417
|
+
return str;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* 追加html标签属性值
|
|
422
|
+
* @param htmlStr
|
|
423
|
+
* @param tagName
|
|
424
|
+
* @param attrName
|
|
425
|
+
* @param newAttrValue
|
|
426
|
+
* @returns string
|
|
427
|
+
*/
|
|
428
|
+
}, {
|
|
429
|
+
key: "appendHtmlTagAttr",
|
|
430
|
+
value: function appendHtmlTagAttr(htmlStr, tagName, attrName, newAttrValue) {
|
|
431
|
+
var regex = new RegExp("(<".concat(tagName, "\\s+)([^>]*?)([^>]*>)"), 'g');
|
|
432
|
+
var replacedHtml = htmlStr.replace(regex, function (match, p1, p2, p3) {
|
|
433
|
+
var _regex = new RegExp("".concat(attrName, "=\"(.*?)\""), 'g');
|
|
434
|
+
if (_regex.exec(match)) {
|
|
435
|
+
var __regex = new RegExp("(<".concat(tagName, "\\s+)([^>]*?)").concat(attrName, "=\"(.*)\"([^>]*>)"), 'g');
|
|
436
|
+
return match.replace(__regex, function (_match, _p1, _p2, _p3, _p4) {
|
|
437
|
+
return _p1 + _p2 + "".concat(attrName, "=\"").concat(_p3, " ").concat(newAttrValue, "\"") + _p4;
|
|
438
|
+
});
|
|
439
|
+
} else {
|
|
440
|
+
return p1 + "".concat(attrName, "=\"").concat(newAttrValue, "\" ") + p3;
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
replacedHtml = replacedHtml.replace(new RegExp("<".concat(tagName, ">"), 'g'), "<".concat(tagName, " ").concat(attrName, "=\"").concat(newAttrValue, "\">"));
|
|
444
|
+
return replacedHtml;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* 比较数据差异
|
|
449
|
+
* @param data1
|
|
450
|
+
* @param data2
|
|
451
|
+
* @returns
|
|
452
|
+
*/
|
|
453
|
+
}, {
|
|
454
|
+
key: "compareDataDiff",
|
|
455
|
+
value: function compareDataDiff(data1, data2) {
|
|
456
|
+
var diffFieldSet = {};
|
|
457
|
+
var compare = function compare(path, o1, o2) {
|
|
458
|
+
if (CrUtil.isArray(o1) && CrUtil.isArray(o2)) {
|
|
459
|
+
// 如果两者都是数组,比较它们的长度和内容
|
|
460
|
+
var lengthDiff = o1.length - o2.length;
|
|
461
|
+
if (lengthDiff !== 0) {
|
|
462
|
+
// 数组长度不同
|
|
463
|
+
diffFieldSet[path] = 'modified';
|
|
464
|
+
if (lengthDiff > 0) {
|
|
465
|
+
// o1比o2长,所以o1中有多余的元素
|
|
466
|
+
for (var i = o2.length; i < o1.length; i++) {
|
|
467
|
+
diffFieldSet["".concat(path, "[").concat(i, "]")] = 'removed'; // 只在o1中存在
|
|
468
|
+
}
|
|
469
|
+
} else {
|
|
470
|
+
// o2比o1长,所以o2中有新增的元素
|
|
471
|
+
for (var _i2 = o1.length; _i2 < o2.length; _i2++) {
|
|
472
|
+
diffFieldSet["".concat(path, "[").concat(_i2, "]")] = 'added'; // 只在o2中存在
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
} else {
|
|
476
|
+
for (var _i3 = 0; _i3 < o1.length; _i3++) {
|
|
477
|
+
compare("".concat(path, "[").concat(_i3, "]"), o1[_i3], o2[_i3]);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
} else if (CrUtil.isObject(o1) && CrUtil.isObject(o2)) {
|
|
481
|
+
// 如果两者都是对象,遍历它们的属性
|
|
482
|
+
// eslint-disable-next-line guard-for-in
|
|
483
|
+
for (var key in o1) {
|
|
484
|
+
var _path = path ? "".concat(path, ".").concat(key) : key;
|
|
485
|
+
if (Object.prototype.hasOwnProperty.call(o1, key) && !(key in o2)) {
|
|
486
|
+
diffFieldSet[_path] = 'removed'; // 只在o1中存在
|
|
487
|
+
} else if (Object.prototype.hasOwnProperty.call(o2, key)) {
|
|
488
|
+
compare(_path, o1[key], o2[key]);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
// 检查o2中是否存在o1中没有的属性
|
|
492
|
+
// eslint-disable-next-line guard-for-in
|
|
493
|
+
for (var _key in o2) {
|
|
494
|
+
var _path2 = path ? "".concat(path, ".").concat(_key) : _key;
|
|
495
|
+
if (Object.prototype.hasOwnProperty.call(o2, _key) && !(_key in o1)) {
|
|
496
|
+
diffFieldSet[_path2] = 'added'; // 只在o2中存在
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
} else if (o1 !== o2) {
|
|
500
|
+
// 既不是对象也不是数组,直接比较值
|
|
501
|
+
diffFieldSet[path] = 'modified';
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
compare('', data1, data2);
|
|
505
|
+
return diffFieldSet;
|
|
506
|
+
}
|
|
507
|
+
}]);
|
|
508
|
+
return CrUtil;
|
|
509
|
+
}();
|
|
510
|
+
export { CrUtil as default };
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zcrkey/js-utils",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "一个 javascript 实用函数库",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"js"
|
|
7
|
+
],
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"main": "dist/index.umd.js",
|
|
10
|
+
"module": "dist/index.js",
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"qs": "^6.11.2"
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"authors": [
|
|
22
|
+
"zcr[774508556@qq.com]"
|
|
23
|
+
]
|
|
24
|
+
}
|