@lightsoft/js-sdk 1.0.0 → 1.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/dist/index.d.ts +262 -2
- package/dist/index.js +2728 -223
- package/dist/index.umd.js +925 -231
- package/dist/rebuild.d.ts +4 -0
- package/dist/rebuild.js +236 -0
- package/dist/rebuild.umd.js +245 -0
- package/dist/types/enums/api.d.ts +61 -0
- package/dist/types/enums/index.d.ts +23 -0
- package/dist/types/index.d.ts +4 -3
- package/dist/types/reg-exp/index.d.ts +12 -0
- package/dist/types/types/api.d.ts +16 -0
- package/dist/types/types/index.d.ts +32 -0
- package/dist/types/utils/common.d.ts +102 -0
- package/dist/types/utils/index.d.ts +6 -0
- package/dist/types/utils/mask.d.ts +11 -0
- package/dist/types/utils/rebuild.d.ts +3 -0
- package/dist/types/utils/request.d.ts +36 -0
- package/dist/types/utils/tour.d.ts +22 -0
- package/dist/types/utils/vue.d.ts +15 -0
- package/dist/types/utils/ws.d.ts +13 -0
- package/dist/ws-0exRUlFu.js +144 -0
- package/dist/ws-DIZYbi31.js +144 -0
- package/dist/ws.d.ts +14 -0
- package/dist/ws.js +1 -0
- package/dist/ws.umd.js +118 -0
- package/package.json +8 -4
- package/dist/types/enums/index.enum.d.ts +0 -5
- package/dist/types/types/index.interface.d.ts +0 -11
- package/dist/types/uilts/index.d.ts +0 -1
- package/dist/types/uilts/rebuild.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -1,240 +1,2276 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
import { _ as __assign, a as __awaiter, b as __generator } from './ws-DIZYbi31.js';
|
|
2
|
+
export { c as createWebSocket, g as getState, u as useSendMessage, e as useWebSocketClose, d as useWebSocketMessage } from './ws-DIZYbi31.js';
|
|
3
|
+
|
|
4
|
+
var READY_STATE;
|
|
5
|
+
(function (READY_STATE) {
|
|
6
|
+
// 未初始化
|
|
7
|
+
READY_STATE[READY_STATE["UNSENT"] = 0] = "UNSENT";
|
|
8
|
+
// 已打开
|
|
9
|
+
READY_STATE[READY_STATE["OPENED"] = 1] = "OPENED";
|
|
10
|
+
// 已获取响应头
|
|
11
|
+
READY_STATE[READY_STATE["HEADERS_RECEIVED"] = 2] = "HEADERS_RECEIVED";
|
|
12
|
+
// 已加载响应体
|
|
13
|
+
READY_STATE[READY_STATE["LOADING"] = 3] = "LOADING";
|
|
14
|
+
// 已完成
|
|
15
|
+
READY_STATE[READY_STATE["DONE"] = 4] = "DONE";
|
|
16
|
+
})(READY_STATE || (READY_STATE = {}));
|
|
17
|
+
var STATUS_CODE;
|
|
18
|
+
(function (STATUS_CODE) {
|
|
19
|
+
// 2xx 成功
|
|
20
|
+
STATUS_CODE[STATUS_CODE["OK"] = 200] = "OK";
|
|
21
|
+
STATUS_CODE[STATUS_CODE["CREATED"] = 201] = "CREATED";
|
|
22
|
+
STATUS_CODE[STATUS_CODE["ACCEPTED"] = 202] = "ACCEPTED";
|
|
23
|
+
STATUS_CODE[STATUS_CODE["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
24
|
+
// 3xx 重定向
|
|
25
|
+
STATUS_CODE[STATUS_CODE["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
|
|
26
|
+
STATUS_CODE[STATUS_CODE["FOUND"] = 302] = "FOUND";
|
|
27
|
+
STATUS_CODE[STATUS_CODE["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
|
|
28
|
+
// 4xx 客户端错误
|
|
29
|
+
STATUS_CODE[STATUS_CODE["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
30
|
+
STATUS_CODE[STATUS_CODE["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
31
|
+
STATUS_CODE[STATUS_CODE["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
32
|
+
STATUS_CODE[STATUS_CODE["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
33
|
+
// 5xx 服务器错误
|
|
34
|
+
STATUS_CODE[STATUS_CODE["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
35
|
+
STATUS_CODE[STATUS_CODE["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
36
|
+
STATUS_CODE[STATUS_CODE["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
|
|
37
|
+
})(STATUS_CODE || (STATUS_CODE = {}));
|
|
38
|
+
var HTTP_STATUS_MESSAGE;
|
|
39
|
+
(function (HTTP_STATUS_MESSAGE) {
|
|
40
|
+
// 2xx 成功
|
|
41
|
+
HTTP_STATUS_MESSAGE["OK"] = "\u8BF7\u6C42\u6210\u529F";
|
|
42
|
+
HTTP_STATUS_MESSAGE["CREATED"] = "\u521B\u5EFA\u6210\u529F";
|
|
43
|
+
HTTP_STATUS_MESSAGE["ACCEPTED"] = "\u5DF2\u63A5\u6536";
|
|
44
|
+
HTTP_STATUS_MESSAGE["NO_CONTENT"] = "\u65E0\u5185\u5BB9";
|
|
45
|
+
// 3xx 重定向
|
|
46
|
+
HTTP_STATUS_MESSAGE["MOVED_PERMANENTLY"] = "\u5DF2\u6C38\u4E45\u79FB\u52A8";
|
|
47
|
+
HTTP_STATUS_MESSAGE["FOUND"] = "\u5DF2\u627E\u5230";
|
|
48
|
+
HTTP_STATUS_MESSAGE["NOT_MODIFIED"] = "\u672A\u4FEE\u6539";
|
|
49
|
+
// 4xx 客户端错误
|
|
50
|
+
HTTP_STATUS_MESSAGE["BAD_REQUEST"] = "\u8BF7\u6C42\u9519\u8BEF";
|
|
51
|
+
HTTP_STATUS_MESSAGE["UNAUTHORIZED"] = "\u672A\u6388\u6743";
|
|
52
|
+
HTTP_STATUS_MESSAGE["FORBIDDEN"] = "\u7981\u6B62\u8BBF\u95EE";
|
|
53
|
+
HTTP_STATUS_MESSAGE["NOT_FOUND"] = "\u672A\u627E\u5230";
|
|
54
|
+
// 5xx 服务器错误
|
|
55
|
+
HTTP_STATUS_MESSAGE["INTERNAL_SERVER_ERROR"] = "\u670D\u52A1\u5668\u9519\u8BEF";
|
|
56
|
+
HTTP_STATUS_MESSAGE["SERVICE_UNAVAILABLE"] = "\u670D\u52A1\u4E0D\u53EF\u7528";
|
|
57
|
+
HTTP_STATUS_MESSAGE["GATEWAY_TIMEOUT"] = "\u7F51\u5173\u8D85\u65F6";
|
|
58
|
+
})(HTTP_STATUS_MESSAGE || (HTTP_STATUS_MESSAGE = {}));
|
|
59
|
+
var HTTP_METHOD;
|
|
60
|
+
(function (HTTP_METHOD) {
|
|
61
|
+
HTTP_METHOD["GET"] = "GET";
|
|
62
|
+
HTTP_METHOD["POST"] = "POST";
|
|
63
|
+
HTTP_METHOD["PUT"] = "PUT";
|
|
64
|
+
HTTP_METHOD["DELETE"] = "DELETE";
|
|
65
|
+
})(HTTP_METHOD || (HTTP_METHOD = {}));
|
|
66
|
+
var HTTP_HEADER;
|
|
67
|
+
(function (HTTP_HEADER) {
|
|
68
|
+
HTTP_HEADER["CONTENT_TYPE"] = "Content-Type";
|
|
69
|
+
HTTP_HEADER["ACCEPT"] = "Accept";
|
|
70
|
+
HTTP_HEADER["AUTHORIZATION"] = "Authorization";
|
|
71
|
+
})(HTTP_HEADER || (HTTP_HEADER = {}));
|
|
72
|
+
var HTTP_CONTENT_TYPE;
|
|
73
|
+
(function (HTTP_CONTENT_TYPE) {
|
|
74
|
+
HTTP_CONTENT_TYPE["JSON"] = "application/json";
|
|
75
|
+
HTTP_CONTENT_TYPE["FORM_URLENCODED"] = "application/x-www-form-urlencoded";
|
|
76
|
+
HTTP_CONTENT_TYPE["MULTIPART_FORM_DATA"] = "multipart/form-data";
|
|
77
|
+
})(HTTP_CONTENT_TYPE || (HTTP_CONTENT_TYPE = {}));
|
|
78
|
+
var HTTP_STATUS;
|
|
79
|
+
(function (HTTP_STATUS) {
|
|
80
|
+
HTTP_STATUS[HTTP_STATUS["OK"] = 200] = "OK";
|
|
81
|
+
HTTP_STATUS[HTTP_STATUS["CREATED"] = 201] = "CREATED";
|
|
82
|
+
HTTP_STATUS[HTTP_STATUS["ACCEPTED"] = 202] = "ACCEPTED";
|
|
83
|
+
HTTP_STATUS[HTTP_STATUS["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
84
|
+
})(HTTP_STATUS || (HTTP_STATUS = {}));
|
|
85
|
+
|
|
86
|
+
var Request = /** @class */ (function () {
|
|
87
|
+
function Request() {
|
|
88
|
+
this.beforeRequestOptions = {};
|
|
89
|
+
this.xhr = this.create();
|
|
90
|
+
}
|
|
91
|
+
Request.prototype.create = function () {
|
|
92
|
+
if (window.XMLHttpRequest)
|
|
93
|
+
return new XMLHttpRequest();
|
|
94
|
+
else if (window.ActiveXObject)
|
|
95
|
+
return new ActiveXObject('Microsoft.XMLHTTP');
|
|
96
|
+
throw new Error('您的浏览器暂不支持XMLHttpRequest');
|
|
97
|
+
};
|
|
98
|
+
Request.prototype.useState = function (state) {
|
|
99
|
+
switch (state) {
|
|
100
|
+
case 'SUCCESS':
|
|
101
|
+
return this.xhr.readyState === READY_STATE.DONE && this.xhr.status >= 200 && this.xhr.status < 300;
|
|
102
|
+
case 'FAIL':
|
|
103
|
+
return this.xhr.readyState === READY_STATE.DONE && (this.xhr.status < 200 || this.xhr.status >= 300);
|
|
104
|
+
case 'PENDING':
|
|
105
|
+
return this.xhr.readyState < READY_STATE.DONE;
|
|
106
|
+
default:
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
Request.prototype.send = function (type, url, options) {
|
|
111
|
+
if (options === void 0) { options = {}; }
|
|
112
|
+
var _a = this, xhr = _a.xhr, beforeRequestOptions = _a.beforeRequestOptions, beforeResponseCallback = _a.beforeResponseCallback;
|
|
113
|
+
var useState = this.useState.bind(this);
|
|
114
|
+
var transformResponse = this.transformResponse.bind(this);
|
|
115
|
+
return new Promise(function (resolve, reject) {
|
|
116
|
+
xhr.open(type, url, options.async || true);
|
|
117
|
+
var requestOptions = __assign(__assign({}, beforeRequestOptions), options);
|
|
118
|
+
Object.keys(requestOptions.headers || {}).forEach(function (key) {
|
|
119
|
+
var _a;
|
|
120
|
+
xhr.setRequestHeader(key, (_a = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers) === null || _a === void 0 ? void 0 : _a[key]);
|
|
121
|
+
});
|
|
122
|
+
xhr.onreadystatechange = function () {
|
|
123
|
+
var success = useState('SUCCESS');
|
|
124
|
+
var fail = useState('FAIL');
|
|
125
|
+
if (success) {
|
|
126
|
+
beforeResponseCallback
|
|
127
|
+
? beforeResponseCallback(transformResponse(xhr), resolve, reject)
|
|
128
|
+
: resolve(transformResponse(xhr));
|
|
129
|
+
}
|
|
130
|
+
else if (fail) {
|
|
131
|
+
reject(transformResponse(xhr));
|
|
132
|
+
}
|
|
54
133
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if ((_a = item === null || item === void 0 ? void 0 : item.tag) === null || _a === void 0 ? void 0 : _a.includes('</annotation>'))
|
|
58
|
-
annotation = false;
|
|
59
|
-
tags.push(item);
|
|
60
|
-
var prevTag = findStartTag(index, tags);
|
|
61
|
-
prevTag.endIndex = index;
|
|
62
|
-
}
|
|
63
|
-
else if (tag.startsWith('<')) {
|
|
64
|
-
var forMatch = (_b = tag.match($FOR_REGEX)) === null || _b === void 0 ? void 0 : _b[1];
|
|
65
|
-
var ifMatch = (_c = tag.match($IF_REGEX)) === null || _c === void 0 ? void 0 : _c[1];
|
|
66
|
-
var styleMatch = (_d = tag.match($STYLE_REGEX)) === null || _d === void 0 ? void 0 : _d[1];
|
|
67
|
-
var classMatch = (_e = tag.match($CLASS_REGEX)) === null || _e === void 0 ? void 0 : _e[1];
|
|
68
|
-
var item = {
|
|
69
|
-
type: 'node',
|
|
70
|
-
tag: tag.replace($ATTRS_REGEX, '')
|
|
134
|
+
xhr.onerror = function () {
|
|
135
|
+
reject(transformResponse(xhr));
|
|
71
136
|
};
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
137
|
+
if (options.data instanceof FormData) {
|
|
138
|
+
xhr.send(options.data);
|
|
139
|
+
}
|
|
140
|
+
else if (type === 'POST' || type === 'PUT') {
|
|
141
|
+
xhr.send(JSON.stringify(options.data));
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
xhr.send();
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
Request.prototype.transformResponse = function (response) {
|
|
149
|
+
return {
|
|
150
|
+
data: JSON.parse(response.responseText),
|
|
151
|
+
code: response.status,
|
|
152
|
+
message: response.statusText,
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
Request.prototype.transformQuery = function (url, query) {
|
|
156
|
+
var queryData = Object.keys(query || {});
|
|
157
|
+
if (!queryData.length)
|
|
158
|
+
return url;
|
|
159
|
+
var queryString = queryData.map(function (key) {
|
|
160
|
+
return window.encodeURIComponent(key) + '=' + window.encodeURIComponent(query[key]);
|
|
161
|
+
}).join('&');
|
|
162
|
+
url += (url.includes('?') ? '&' : '?') + queryString;
|
|
163
|
+
return url;
|
|
164
|
+
};
|
|
165
|
+
Request.prototype.beforeSend = function (callback) {
|
|
166
|
+
this.beforeRequestOptions = callback();
|
|
167
|
+
};
|
|
168
|
+
Request.prototype.beforeResponse = function (callback) {
|
|
169
|
+
this.beforeResponseCallback = callback;
|
|
170
|
+
};
|
|
171
|
+
Request.prototype.abort = function () {
|
|
172
|
+
this.xhr.abort();
|
|
173
|
+
};
|
|
174
|
+
Request.prototype.get = function (url, query, headers) {
|
|
175
|
+
if (headers === void 0) { headers = {}; }
|
|
176
|
+
var newUrl = this.transformQuery(url, query);
|
|
177
|
+
return this.send('GET', newUrl, { headers: headers });
|
|
178
|
+
};
|
|
179
|
+
Request.prototype.post = function (url, data, headers) {
|
|
180
|
+
if (headers === void 0) { headers = {}; }
|
|
181
|
+
return this.send('POST', url, { data: data, headers: headers });
|
|
182
|
+
};
|
|
183
|
+
Request.prototype.put = function (url, data, headers) {
|
|
184
|
+
if (headers === void 0) { headers = {}; }
|
|
185
|
+
return this.send('PUT', url, { data: data, headers: headers });
|
|
186
|
+
};
|
|
187
|
+
Request.prototype.delete = function (url, data, headers) {
|
|
188
|
+
if (headers === void 0) { headers = {}; }
|
|
189
|
+
return this.send('DELETE', url, { data: data, headers: headers });
|
|
190
|
+
};
|
|
191
|
+
Request.prototype.patch = function (url, data, headers) {
|
|
192
|
+
if (headers === void 0) { headers = {}; }
|
|
193
|
+
return this.send('PATCH', url, { data: data, headers: headers });
|
|
194
|
+
};
|
|
195
|
+
Request.prototype.options = function (url, data, headers) {
|
|
196
|
+
if (headers === void 0) { headers = {}; }
|
|
197
|
+
return this.send('OPTIONS', url, { data: data, headers: headers });
|
|
198
|
+
};
|
|
199
|
+
Request.prototype.head = function (url, data, headers) {
|
|
200
|
+
if (headers === void 0) { headers = {}; }
|
|
201
|
+
return this.send('HEAD', url, { data: data, headers: headers });
|
|
202
|
+
};
|
|
203
|
+
Request.prototype.trace = function (url, data, headers) {
|
|
204
|
+
if (headers === void 0) { headers = {}; }
|
|
205
|
+
return this.send('TRACE', url, { data: data, headers: headers });
|
|
206
|
+
};
|
|
207
|
+
Request.prototype.connect = function (url, data, headers) {
|
|
208
|
+
if (headers === void 0) { headers = {}; }
|
|
209
|
+
return this.send('CONNECT', url, { data: data, headers: headers });
|
|
210
|
+
};
|
|
211
|
+
return Request;
|
|
212
|
+
}());
|
|
213
|
+
var RequestChain = /** @class */ (function () {
|
|
214
|
+
function RequestChain() {
|
|
215
|
+
var args = [];
|
|
216
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
217
|
+
args[_i] = arguments[_i];
|
|
218
|
+
}
|
|
219
|
+
this.fieldList = [{}];
|
|
220
|
+
this.responses = [];
|
|
221
|
+
this.setParams.apply(this, args);
|
|
222
|
+
}
|
|
223
|
+
RequestChain.prototype.getParams = function (type, data, fields) {
|
|
224
|
+
var keys = Object.keys(fields);
|
|
225
|
+
var values = Object.values(fields);
|
|
226
|
+
if (type === 'query') {
|
|
227
|
+
var query = keys.map(function (key, index) {
|
|
228
|
+
return "".concat(key, "=").concat(data[values[index]]);
|
|
229
|
+
}).join('&');
|
|
230
|
+
return query;
|
|
85
231
|
}
|
|
86
232
|
else {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
233
|
+
var body_1 = {};
|
|
234
|
+
keys.forEach(function (key, index) {
|
|
235
|
+
body_1[key] = data[values[index]];
|
|
90
236
|
});
|
|
237
|
+
return body_1;
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
RequestChain.prototype.setParams = function () {
|
|
241
|
+
var args = [];
|
|
242
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
243
|
+
args[_i] = arguments[_i];
|
|
244
|
+
}
|
|
245
|
+
for (var i = 0; i < args.length; i++) {
|
|
246
|
+
var arg = args[i];
|
|
247
|
+
this.fieldList.push(arg);
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
RequestChain.prototype.chain = function (list) {
|
|
251
|
+
var _this = this;
|
|
252
|
+
return list.reduce(function (pre, cur, index) {
|
|
253
|
+
return new Promise(function (resolve, reject) {
|
|
254
|
+
pre().then(function (preRes) {
|
|
255
|
+
var fields = _this.fieldList[index];
|
|
256
|
+
var type = (fields === null || fields === void 0 ? void 0 : fields.query) ? 'query' : 'body';
|
|
257
|
+
var params = _this.getParams(type, preRes, (fields === null || fields === void 0 ? void 0 : fields.query) || fields);
|
|
258
|
+
_this.responses.push(preRes);
|
|
259
|
+
cur(params).then(function (curRes) {
|
|
260
|
+
_this.responses.push(curRes);
|
|
261
|
+
resolve(_this.responses);
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
};
|
|
267
|
+
return RequestChain;
|
|
268
|
+
}());
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* @vue/shared v3.5.18
|
|
272
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
273
|
+
* @license MIT
|
|
274
|
+
**/
|
|
275
|
+
/*! #__NO_SIDE_EFFECTS__ */
|
|
276
|
+
// @__NO_SIDE_EFFECTS__
|
|
277
|
+
function makeMap(str) {
|
|
278
|
+
const map = /* @__PURE__ */ Object.create(null);
|
|
279
|
+
for (const key of str.split(",")) map[key] = 1;
|
|
280
|
+
return (val) => val in map;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const EMPTY_OBJ = !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
|
|
284
|
+
!!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
|
|
285
|
+
const NOOP = () => {
|
|
286
|
+
};
|
|
287
|
+
const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
|
|
288
|
+
(key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
|
289
|
+
const extend = Object.assign;
|
|
290
|
+
const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
291
|
+
const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
|
|
292
|
+
const isArray = Array.isArray;
|
|
293
|
+
const isMap = (val) => toTypeString(val) === "[object Map]";
|
|
294
|
+
const isFunction = (val) => typeof val === "function";
|
|
295
|
+
const isString = (val) => typeof val === "string";
|
|
296
|
+
const isSymbol = (val) => typeof val === "symbol";
|
|
297
|
+
const isObject = (val) => val !== null && typeof val === "object";
|
|
298
|
+
const objectToString = Object.prototype.toString;
|
|
299
|
+
const toTypeString = (value) => objectToString.call(value);
|
|
300
|
+
const toRawType = (value) => {
|
|
301
|
+
return toTypeString(value).slice(8, -1);
|
|
302
|
+
};
|
|
303
|
+
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
304
|
+
const cacheStringFunction = (fn) => {
|
|
305
|
+
const cache = /* @__PURE__ */ Object.create(null);
|
|
306
|
+
return (str) => {
|
|
307
|
+
const hit = cache[str];
|
|
308
|
+
return hit || (cache[str] = fn(str));
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
const capitalize = cacheStringFunction((str) => {
|
|
312
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
313
|
+
});
|
|
314
|
+
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
315
|
+
let _globalThis;
|
|
316
|
+
const getGlobalThis = () => {
|
|
317
|
+
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
function normalizeStyle(value) {
|
|
321
|
+
if (isArray(value)) {
|
|
322
|
+
const res = {};
|
|
323
|
+
for (let i = 0; i < value.length; i++) {
|
|
324
|
+
const item = value[i];
|
|
325
|
+
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
|
|
326
|
+
if (normalized) {
|
|
327
|
+
for (const key in normalized) {
|
|
328
|
+
res[key] = normalized[key];
|
|
91
329
|
}
|
|
92
|
-
|
|
330
|
+
}
|
|
93
331
|
}
|
|
94
|
-
return
|
|
332
|
+
return res;
|
|
333
|
+
} else if (isString(value) || isObject(value)) {
|
|
334
|
+
return value;
|
|
335
|
+
}
|
|
95
336
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
337
|
+
const listDelimiterRE = /;(?![^(]*\))/g;
|
|
338
|
+
const propertyDelimiterRE = /:([^]+)/;
|
|
339
|
+
const styleCommentRE = /\/\*[^]*?\*\//g;
|
|
340
|
+
function parseStringStyle(cssText) {
|
|
341
|
+
const ret = {};
|
|
342
|
+
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
|
|
343
|
+
if (item) {
|
|
344
|
+
const tmp = item.split(propertyDelimiterRE);
|
|
345
|
+
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
return ret;
|
|
108
349
|
}
|
|
109
|
-
function
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
350
|
+
function normalizeClass(value) {
|
|
351
|
+
let res = "";
|
|
352
|
+
if (isString(value)) {
|
|
353
|
+
res = value;
|
|
354
|
+
} else if (isArray(value)) {
|
|
355
|
+
for (let i = 0; i < value.length; i++) {
|
|
356
|
+
const normalized = normalizeClass(value[i]);
|
|
357
|
+
if (normalized) {
|
|
358
|
+
res += normalized + " ";
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
} else if (isObject(value)) {
|
|
362
|
+
for (const name in value) {
|
|
363
|
+
if (value[name]) {
|
|
364
|
+
res += name + " ";
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
return res.trim();
|
|
115
369
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
code += "".concat(operator);
|
|
126
|
-
code += "".concat(rightVariable);
|
|
127
|
-
code += ") {\n";
|
|
128
|
-
return code;
|
|
129
|
-
}
|
|
130
|
-
function styleParse(styleContent) {
|
|
131
|
-
var _a;
|
|
132
|
-
var styleValue = contentParse((_a = styleContent.match($CONTENT_REGEX)) === null || _a === void 0 ? void 0 : _a[0]);
|
|
133
|
-
return styleContent.replace($CONTENT_REGEX, styleValue);
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* @vue/reactivity v3.5.18
|
|
373
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
374
|
+
* @license MIT
|
|
375
|
+
**/
|
|
376
|
+
|
|
377
|
+
function warn(msg, ...args) {
|
|
378
|
+
console.warn(`[Vue warn] ${msg}`, ...args);
|
|
134
379
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
380
|
+
let batchDepth = 0;
|
|
381
|
+
let batchedSub;
|
|
382
|
+
function startBatch() {
|
|
383
|
+
batchDepth++;
|
|
384
|
+
}
|
|
385
|
+
function endBatch() {
|
|
386
|
+
if (--batchDepth > 0) {
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
let error;
|
|
390
|
+
while (batchedSub) {
|
|
391
|
+
let e = batchedSub;
|
|
392
|
+
batchedSub = void 0;
|
|
393
|
+
while (e) {
|
|
394
|
+
const next = e.next;
|
|
395
|
+
e.next = void 0;
|
|
396
|
+
e.flags &= -9;
|
|
397
|
+
if (e.flags & 1) {
|
|
398
|
+
try {
|
|
399
|
+
;
|
|
400
|
+
e.trigger();
|
|
401
|
+
} catch (err) {
|
|
402
|
+
if (!error) error = err;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
e = next;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
if (error) throw error;
|
|
409
|
+
}
|
|
410
|
+
class Dep {
|
|
411
|
+
// TODO isolatedDeclarations "__v_skip"
|
|
412
|
+
constructor(computed) {
|
|
413
|
+
this.computed = computed;
|
|
414
|
+
this.version = 0;
|
|
415
|
+
/**
|
|
416
|
+
* Link between this dep and the current active effect
|
|
417
|
+
*/
|
|
418
|
+
this.activeLink = void 0;
|
|
419
|
+
/**
|
|
420
|
+
* Doubly linked list representing the subscribing effects (tail)
|
|
421
|
+
*/
|
|
422
|
+
this.subs = void 0;
|
|
423
|
+
/**
|
|
424
|
+
* For object property deps cleanup
|
|
425
|
+
*/
|
|
426
|
+
this.map = void 0;
|
|
427
|
+
this.key = void 0;
|
|
428
|
+
/**
|
|
429
|
+
* Subscriber counter
|
|
430
|
+
*/
|
|
431
|
+
this.sc = 0;
|
|
432
|
+
/**
|
|
433
|
+
* @internal
|
|
434
|
+
*/
|
|
435
|
+
this.__v_skip = true;
|
|
436
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
437
|
+
this.subsHead = void 0;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
track(debugInfo) {
|
|
441
|
+
{
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
trigger(debugInfo) {
|
|
446
|
+
this.version++;
|
|
447
|
+
this.notify(debugInfo);
|
|
448
|
+
}
|
|
449
|
+
notify(debugInfo) {
|
|
450
|
+
startBatch();
|
|
451
|
+
try {
|
|
452
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
453
|
+
for (let head = this.subsHead; head; head = head.nextSub) {
|
|
454
|
+
if (head.sub.onTrigger && !(head.sub.flags & 8)) {
|
|
455
|
+
head.sub.onTrigger(
|
|
456
|
+
extend(
|
|
457
|
+
{
|
|
458
|
+
effect: head.sub
|
|
459
|
+
},
|
|
460
|
+
debugInfo
|
|
461
|
+
)
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
for (let link = this.subs; link; link = link.prevSub) {
|
|
467
|
+
if (link.sub.notify()) {
|
|
468
|
+
;
|
|
469
|
+
link.sub.dep.notify();
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
} finally {
|
|
473
|
+
endBatch();
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
478
|
+
const ITERATE_KEY = Symbol(
|
|
479
|
+
!!(process.env.NODE_ENV !== "production") ? "Object iterate" : ""
|
|
480
|
+
);
|
|
481
|
+
const MAP_KEY_ITERATE_KEY = Symbol(
|
|
482
|
+
!!(process.env.NODE_ENV !== "production") ? "Map keys iterate" : ""
|
|
483
|
+
);
|
|
484
|
+
const ARRAY_ITERATE_KEY = Symbol(
|
|
485
|
+
!!(process.env.NODE_ENV !== "production") ? "Array iterate" : ""
|
|
486
|
+
);
|
|
487
|
+
function track(target, type, key) {
|
|
488
|
+
}
|
|
489
|
+
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
490
|
+
const depsMap = targetMap.get(target);
|
|
491
|
+
if (!depsMap) {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
const run = (dep) => {
|
|
495
|
+
if (dep) {
|
|
496
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
497
|
+
dep.trigger({
|
|
498
|
+
target,
|
|
499
|
+
type,
|
|
500
|
+
key,
|
|
501
|
+
newValue,
|
|
502
|
+
oldValue,
|
|
503
|
+
oldTarget
|
|
504
|
+
});
|
|
505
|
+
} else {
|
|
506
|
+
dep.trigger();
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
startBatch();
|
|
511
|
+
if (type === "clear") {
|
|
512
|
+
depsMap.forEach(run);
|
|
513
|
+
} else {
|
|
514
|
+
const targetIsArray = isArray(target);
|
|
515
|
+
const isArrayIndex = targetIsArray && isIntegerKey(key);
|
|
516
|
+
if (targetIsArray && key === "length") {
|
|
517
|
+
const newLength = Number(newValue);
|
|
518
|
+
depsMap.forEach((dep, key2) => {
|
|
519
|
+
if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
|
|
520
|
+
run(dep);
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
} else {
|
|
524
|
+
if (key !== void 0 || depsMap.has(void 0)) {
|
|
525
|
+
run(depsMap.get(key));
|
|
526
|
+
}
|
|
527
|
+
if (isArrayIndex) {
|
|
528
|
+
run(depsMap.get(ARRAY_ITERATE_KEY));
|
|
529
|
+
}
|
|
530
|
+
switch (type) {
|
|
531
|
+
case "add":
|
|
532
|
+
if (!targetIsArray) {
|
|
533
|
+
run(depsMap.get(ITERATE_KEY));
|
|
534
|
+
if (isMap(target)) {
|
|
535
|
+
run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
177
536
|
}
|
|
178
|
-
|
|
179
|
-
|
|
537
|
+
} else if (isArrayIndex) {
|
|
538
|
+
run(depsMap.get("length"));
|
|
539
|
+
}
|
|
540
|
+
break;
|
|
541
|
+
case "delete":
|
|
542
|
+
if (!targetIsArray) {
|
|
543
|
+
run(depsMap.get(ITERATE_KEY));
|
|
544
|
+
if (isMap(target)) {
|
|
545
|
+
run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
180
546
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
547
|
+
}
|
|
548
|
+
break;
|
|
549
|
+
case "set":
|
|
550
|
+
if (isMap(target)) {
|
|
551
|
+
run(depsMap.get(ITERATE_KEY));
|
|
552
|
+
}
|
|
553
|
+
break;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
endBatch();
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
function reactiveReadArray(array) {
|
|
561
|
+
const raw = toRaw(array);
|
|
562
|
+
if (raw === array) return raw;
|
|
563
|
+
return isShallow(array) ? raw : raw.map(toReactive);
|
|
564
|
+
}
|
|
565
|
+
function shallowReadArray(arr) {
|
|
566
|
+
track(arr = toRaw(arr));
|
|
567
|
+
return arr;
|
|
568
|
+
}
|
|
569
|
+
const arrayInstrumentations = {
|
|
570
|
+
__proto__: null,
|
|
571
|
+
[Symbol.iterator]() {
|
|
572
|
+
return iterator(this, Symbol.iterator, toReactive);
|
|
573
|
+
},
|
|
574
|
+
concat(...args) {
|
|
575
|
+
return reactiveReadArray(this).concat(
|
|
576
|
+
...args.map((x) => isArray(x) ? reactiveReadArray(x) : x)
|
|
577
|
+
);
|
|
578
|
+
},
|
|
579
|
+
entries() {
|
|
580
|
+
return iterator(this, "entries", (value) => {
|
|
581
|
+
value[1] = toReactive(value[1]);
|
|
582
|
+
return value;
|
|
583
|
+
});
|
|
584
|
+
},
|
|
585
|
+
every(fn, thisArg) {
|
|
586
|
+
return apply(this, "every", fn, thisArg, void 0, arguments);
|
|
587
|
+
},
|
|
588
|
+
filter(fn, thisArg) {
|
|
589
|
+
return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
|
|
590
|
+
},
|
|
591
|
+
find(fn, thisArg) {
|
|
592
|
+
return apply(this, "find", fn, thisArg, toReactive, arguments);
|
|
593
|
+
},
|
|
594
|
+
findIndex(fn, thisArg) {
|
|
595
|
+
return apply(this, "findIndex", fn, thisArg, void 0, arguments);
|
|
596
|
+
},
|
|
597
|
+
findLast(fn, thisArg) {
|
|
598
|
+
return apply(this, "findLast", fn, thisArg, toReactive, arguments);
|
|
599
|
+
},
|
|
600
|
+
findLastIndex(fn, thisArg) {
|
|
601
|
+
return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
|
|
602
|
+
},
|
|
603
|
+
// flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
|
|
604
|
+
forEach(fn, thisArg) {
|
|
605
|
+
return apply(this, "forEach", fn, thisArg, void 0, arguments);
|
|
606
|
+
},
|
|
607
|
+
includes(...args) {
|
|
608
|
+
return searchProxy(this, "includes", args);
|
|
609
|
+
},
|
|
610
|
+
indexOf(...args) {
|
|
611
|
+
return searchProxy(this, "indexOf", args);
|
|
612
|
+
},
|
|
613
|
+
join(separator) {
|
|
614
|
+
return reactiveReadArray(this).join(separator);
|
|
615
|
+
},
|
|
616
|
+
// keys() iterator only reads `length`, no optimisation required
|
|
617
|
+
lastIndexOf(...args) {
|
|
618
|
+
return searchProxy(this, "lastIndexOf", args);
|
|
619
|
+
},
|
|
620
|
+
map(fn, thisArg) {
|
|
621
|
+
return apply(this, "map", fn, thisArg, void 0, arguments);
|
|
622
|
+
},
|
|
623
|
+
pop() {
|
|
624
|
+
return noTracking(this, "pop");
|
|
625
|
+
},
|
|
626
|
+
push(...args) {
|
|
627
|
+
return noTracking(this, "push", args);
|
|
628
|
+
},
|
|
629
|
+
reduce(fn, ...args) {
|
|
630
|
+
return reduce(this, "reduce", fn, args);
|
|
631
|
+
},
|
|
632
|
+
reduceRight(fn, ...args) {
|
|
633
|
+
return reduce(this, "reduceRight", fn, args);
|
|
634
|
+
},
|
|
635
|
+
shift() {
|
|
636
|
+
return noTracking(this, "shift");
|
|
637
|
+
},
|
|
638
|
+
// slice could use ARRAY_ITERATE but also seems to beg for range tracking
|
|
639
|
+
some(fn, thisArg) {
|
|
640
|
+
return apply(this, "some", fn, thisArg, void 0, arguments);
|
|
641
|
+
},
|
|
642
|
+
splice(...args) {
|
|
643
|
+
return noTracking(this, "splice", args);
|
|
644
|
+
},
|
|
645
|
+
toReversed() {
|
|
646
|
+
return reactiveReadArray(this).toReversed();
|
|
647
|
+
},
|
|
648
|
+
toSorted(comparer) {
|
|
649
|
+
return reactiveReadArray(this).toSorted(comparer);
|
|
650
|
+
},
|
|
651
|
+
toSpliced(...args) {
|
|
652
|
+
return reactiveReadArray(this).toSpliced(...args);
|
|
653
|
+
},
|
|
654
|
+
unshift(...args) {
|
|
655
|
+
return noTracking(this, "unshift", args);
|
|
656
|
+
},
|
|
657
|
+
values() {
|
|
658
|
+
return iterator(this, "values", toReactive);
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
function iterator(self, method, wrapValue) {
|
|
662
|
+
const arr = shallowReadArray(self);
|
|
663
|
+
const iter = arr[method]();
|
|
664
|
+
if (arr !== self && !isShallow(self)) {
|
|
665
|
+
iter._next = iter.next;
|
|
666
|
+
iter.next = () => {
|
|
667
|
+
const result = iter._next();
|
|
668
|
+
if (result.value) {
|
|
669
|
+
result.value = wrapValue(result.value);
|
|
670
|
+
}
|
|
671
|
+
return result;
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
return iter;
|
|
675
|
+
}
|
|
676
|
+
const arrayProto = Array.prototype;
|
|
677
|
+
function apply(self, method, fn, thisArg, wrappedRetFn, args) {
|
|
678
|
+
const arr = shallowReadArray(self);
|
|
679
|
+
const needsWrap = arr !== self && !isShallow(self);
|
|
680
|
+
const methodFn = arr[method];
|
|
681
|
+
if (methodFn !== arrayProto[method]) {
|
|
682
|
+
const result2 = methodFn.apply(self, args);
|
|
683
|
+
return needsWrap ? toReactive(result2) : result2;
|
|
684
|
+
}
|
|
685
|
+
let wrappedFn = fn;
|
|
686
|
+
if (arr !== self) {
|
|
687
|
+
if (needsWrap) {
|
|
688
|
+
wrappedFn = function(item, index) {
|
|
689
|
+
return fn.call(this, toReactive(item), index, self);
|
|
690
|
+
};
|
|
691
|
+
} else if (fn.length > 2) {
|
|
692
|
+
wrappedFn = function(item, index) {
|
|
693
|
+
return fn.call(this, item, index, self);
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
const result = methodFn.call(arr, wrappedFn, thisArg);
|
|
698
|
+
return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
|
|
699
|
+
}
|
|
700
|
+
function reduce(self, method, fn, args) {
|
|
701
|
+
const arr = shallowReadArray(self);
|
|
702
|
+
let wrappedFn = fn;
|
|
703
|
+
if (arr !== self) {
|
|
704
|
+
if (!isShallow(self)) {
|
|
705
|
+
wrappedFn = function(acc, item, index) {
|
|
706
|
+
return fn.call(this, acc, toReactive(item), index, self);
|
|
707
|
+
};
|
|
708
|
+
} else if (fn.length > 3) {
|
|
709
|
+
wrappedFn = function(acc, item, index) {
|
|
710
|
+
return fn.call(this, acc, item, index, self);
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
return arr[method](wrappedFn, ...args);
|
|
715
|
+
}
|
|
716
|
+
function searchProxy(self, method, args) {
|
|
717
|
+
const arr = toRaw(self);
|
|
718
|
+
const res = arr[method](...args);
|
|
719
|
+
if ((res === -1 || res === false) && isProxy(args[0])) {
|
|
720
|
+
args[0] = toRaw(args[0]);
|
|
721
|
+
return arr[method](...args);
|
|
722
|
+
}
|
|
723
|
+
return res;
|
|
724
|
+
}
|
|
725
|
+
function noTracking(self, method, args = []) {
|
|
726
|
+
startBatch();
|
|
727
|
+
const res = toRaw(self)[method].apply(self, args);
|
|
728
|
+
endBatch();
|
|
729
|
+
return res;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
733
|
+
const builtInSymbols = new Set(
|
|
734
|
+
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
|
735
|
+
);
|
|
736
|
+
function hasOwnProperty(key) {
|
|
737
|
+
if (!isSymbol(key)) key = String(key);
|
|
738
|
+
const obj = toRaw(this);
|
|
739
|
+
return obj.hasOwnProperty(key);
|
|
740
|
+
}
|
|
741
|
+
class BaseReactiveHandler {
|
|
742
|
+
constructor(_isReadonly = false, _isShallow = false) {
|
|
743
|
+
this._isReadonly = _isReadonly;
|
|
744
|
+
this._isShallow = _isShallow;
|
|
745
|
+
}
|
|
746
|
+
get(target, key, receiver) {
|
|
747
|
+
if (key === "__v_skip") return target["__v_skip"];
|
|
748
|
+
const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
|
|
749
|
+
if (key === "__v_isReactive") {
|
|
750
|
+
return !isReadonly2;
|
|
751
|
+
} else if (key === "__v_isReadonly") {
|
|
752
|
+
return isReadonly2;
|
|
753
|
+
} else if (key === "__v_isShallow") {
|
|
754
|
+
return isShallow2;
|
|
755
|
+
} else if (key === "__v_raw") {
|
|
756
|
+
if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
|
|
757
|
+
// this means the receiver is a user proxy of the reactive proxy
|
|
758
|
+
Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
|
|
759
|
+
return target;
|
|
760
|
+
}
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
const targetIsArray = isArray(target);
|
|
764
|
+
if (!isReadonly2) {
|
|
765
|
+
let fn;
|
|
766
|
+
if (targetIsArray && (fn = arrayInstrumentations[key])) {
|
|
767
|
+
return fn;
|
|
768
|
+
}
|
|
769
|
+
if (key === "hasOwnProperty") {
|
|
770
|
+
return hasOwnProperty;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
const res = Reflect.get(
|
|
774
|
+
target,
|
|
775
|
+
key,
|
|
776
|
+
// if this is a proxy wrapping a ref, return methods using the raw ref
|
|
777
|
+
// as receiver so that we don't have to call `toRaw` on the ref in all
|
|
778
|
+
// its class methods
|
|
779
|
+
isRef(target) ? target : receiver
|
|
780
|
+
);
|
|
781
|
+
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
782
|
+
return res;
|
|
783
|
+
}
|
|
784
|
+
if (isShallow2) {
|
|
785
|
+
return res;
|
|
786
|
+
}
|
|
787
|
+
if (isRef(res)) {
|
|
788
|
+
return targetIsArray && isIntegerKey(key) ? res : res.value;
|
|
789
|
+
}
|
|
790
|
+
if (isObject(res)) {
|
|
791
|
+
return isReadonly2 ? readonly(res) : reactive(res);
|
|
792
|
+
}
|
|
793
|
+
return res;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
class MutableReactiveHandler extends BaseReactiveHandler {
|
|
797
|
+
constructor(isShallow2 = false) {
|
|
798
|
+
super(false, isShallow2);
|
|
799
|
+
}
|
|
800
|
+
set(target, key, value, receiver) {
|
|
801
|
+
let oldValue = target[key];
|
|
802
|
+
if (!this._isShallow) {
|
|
803
|
+
const isOldValueReadonly = isReadonly(oldValue);
|
|
804
|
+
if (!isShallow(value) && !isReadonly(value)) {
|
|
805
|
+
oldValue = toRaw(oldValue);
|
|
806
|
+
value = toRaw(value);
|
|
807
|
+
}
|
|
808
|
+
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
809
|
+
if (isOldValueReadonly) {
|
|
810
|
+
return false;
|
|
811
|
+
} else {
|
|
812
|
+
oldValue.value = value;
|
|
813
|
+
return true;
|
|
186
814
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
return
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
|
|
818
|
+
const result = Reflect.set(
|
|
819
|
+
target,
|
|
820
|
+
key,
|
|
821
|
+
value,
|
|
822
|
+
isRef(target) ? target : receiver
|
|
823
|
+
);
|
|
824
|
+
if (target === toRaw(receiver)) {
|
|
825
|
+
if (!hadKey) {
|
|
826
|
+
trigger(target, "add", key, value);
|
|
827
|
+
} else if (hasChanged(value, oldValue)) {
|
|
828
|
+
trigger(target, "set", key, value, oldValue);
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
return result;
|
|
832
|
+
}
|
|
833
|
+
deleteProperty(target, key) {
|
|
834
|
+
const hadKey = hasOwn(target, key);
|
|
835
|
+
const oldValue = target[key];
|
|
836
|
+
const result = Reflect.deleteProperty(target, key);
|
|
837
|
+
if (result && hadKey) {
|
|
838
|
+
trigger(target, "delete", key, void 0, oldValue);
|
|
839
|
+
}
|
|
840
|
+
return result;
|
|
841
|
+
}
|
|
842
|
+
has(target, key) {
|
|
843
|
+
const result = Reflect.has(target, key);
|
|
844
|
+
if (!isSymbol(key) || !builtInSymbols.has(key)) ;
|
|
845
|
+
return result;
|
|
846
|
+
}
|
|
847
|
+
ownKeys(target) {
|
|
848
|
+
return Reflect.ownKeys(target);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
class ReadonlyReactiveHandler extends BaseReactiveHandler {
|
|
852
|
+
constructor(isShallow2 = false) {
|
|
853
|
+
super(true, isShallow2);
|
|
854
|
+
}
|
|
855
|
+
set(target, key) {
|
|
856
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
857
|
+
warn(
|
|
858
|
+
`Set operation on key "${String(key)}" failed: target is readonly.`,
|
|
859
|
+
target
|
|
860
|
+
);
|
|
861
|
+
}
|
|
862
|
+
return true;
|
|
863
|
+
}
|
|
864
|
+
deleteProperty(target, key) {
|
|
865
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
866
|
+
warn(
|
|
867
|
+
`Delete operation on key "${String(key)}" failed: target is readonly.`,
|
|
868
|
+
target
|
|
869
|
+
);
|
|
870
|
+
}
|
|
871
|
+
return true;
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
|
|
875
|
+
const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
|
|
876
|
+
|
|
877
|
+
const toShallow = (value) => value;
|
|
878
|
+
const getProto = (v) => Reflect.getPrototypeOf(v);
|
|
879
|
+
function createIterableMethod(method, isReadonly2, isShallow2) {
|
|
880
|
+
return function(...args) {
|
|
881
|
+
const target = this["__v_raw"];
|
|
882
|
+
const rawTarget = toRaw(target);
|
|
883
|
+
const targetIsMap = isMap(rawTarget);
|
|
884
|
+
const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
|
|
885
|
+
const innerIterator = target[method](...args);
|
|
886
|
+
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
|
|
887
|
+
return {
|
|
888
|
+
// iterator protocol
|
|
889
|
+
next() {
|
|
890
|
+
const { value, done } = innerIterator.next();
|
|
891
|
+
return done ? { value, done } : {
|
|
892
|
+
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
|
|
893
|
+
done
|
|
894
|
+
};
|
|
895
|
+
},
|
|
896
|
+
// iterable protocol
|
|
897
|
+
[Symbol.iterator]() {
|
|
898
|
+
return this;
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
};
|
|
902
|
+
}
|
|
903
|
+
function createReadonlyMethod(type) {
|
|
904
|
+
return function(...args) {
|
|
905
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
906
|
+
const key = args[0] ? `on key "${args[0]}" ` : ``;
|
|
907
|
+
warn(
|
|
908
|
+
`${capitalize(type)} operation ${key}failed: target is readonly.`,
|
|
909
|
+
toRaw(this)
|
|
910
|
+
);
|
|
911
|
+
}
|
|
912
|
+
return type === "delete" ? false : type === "clear" ? void 0 : this;
|
|
913
|
+
};
|
|
914
|
+
}
|
|
915
|
+
function createInstrumentations(readonly, shallow) {
|
|
916
|
+
const instrumentations = {
|
|
917
|
+
get(key) {
|
|
918
|
+
const target = this["__v_raw"];
|
|
919
|
+
const rawTarget = toRaw(target);
|
|
920
|
+
const rawKey = toRaw(key);
|
|
921
|
+
const { has } = getProto(rawTarget);
|
|
922
|
+
const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
|
|
923
|
+
if (has.call(rawTarget, key)) {
|
|
924
|
+
return wrap(target.get(key));
|
|
925
|
+
} else if (has.call(rawTarget, rawKey)) {
|
|
926
|
+
return wrap(target.get(rawKey));
|
|
927
|
+
} else if (target !== rawTarget) {
|
|
928
|
+
target.get(key);
|
|
929
|
+
}
|
|
930
|
+
},
|
|
931
|
+
get size() {
|
|
932
|
+
const target = this["__v_raw"];
|
|
933
|
+
!readonly && track(toRaw(target));
|
|
934
|
+
return Reflect.get(target, "size", target);
|
|
935
|
+
},
|
|
936
|
+
has(key) {
|
|
937
|
+
const target = this["__v_raw"];
|
|
938
|
+
toRaw(target);
|
|
939
|
+
const rawKey = toRaw(key);
|
|
940
|
+
return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
|
|
941
|
+
},
|
|
942
|
+
forEach(callback, thisArg) {
|
|
943
|
+
const observed = this;
|
|
944
|
+
const target = observed["__v_raw"];
|
|
945
|
+
toRaw(target);
|
|
946
|
+
const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
|
|
947
|
+
return target.forEach((value, key) => {
|
|
948
|
+
return callback.call(thisArg, wrap(value), wrap(key), observed);
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
extend(
|
|
953
|
+
instrumentations,
|
|
954
|
+
readonly ? {
|
|
955
|
+
add: createReadonlyMethod("add"),
|
|
956
|
+
set: createReadonlyMethod("set"),
|
|
957
|
+
delete: createReadonlyMethod("delete"),
|
|
958
|
+
clear: createReadonlyMethod("clear")
|
|
959
|
+
} : {
|
|
960
|
+
add(value) {
|
|
961
|
+
if (!shallow && !isShallow(value) && !isReadonly(value)) {
|
|
962
|
+
value = toRaw(value);
|
|
963
|
+
}
|
|
964
|
+
const target = toRaw(this);
|
|
965
|
+
const proto = getProto(target);
|
|
966
|
+
const hadKey = proto.has.call(target, value);
|
|
967
|
+
if (!hadKey) {
|
|
968
|
+
target.add(value);
|
|
969
|
+
trigger(target, "add", value, value);
|
|
970
|
+
}
|
|
971
|
+
return this;
|
|
972
|
+
},
|
|
973
|
+
set(key, value) {
|
|
974
|
+
if (!shallow && !isShallow(value) && !isReadonly(value)) {
|
|
975
|
+
value = toRaw(value);
|
|
976
|
+
}
|
|
977
|
+
const target = toRaw(this);
|
|
978
|
+
const { has, get } = getProto(target);
|
|
979
|
+
let hadKey = has.call(target, key);
|
|
980
|
+
if (!hadKey) {
|
|
981
|
+
key = toRaw(key);
|
|
982
|
+
hadKey = has.call(target, key);
|
|
983
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
984
|
+
checkIdentityKeys(target, has, key);
|
|
985
|
+
}
|
|
986
|
+
const oldValue = get.call(target, key);
|
|
987
|
+
target.set(key, value);
|
|
988
|
+
if (!hadKey) {
|
|
989
|
+
trigger(target, "add", key, value);
|
|
990
|
+
} else if (hasChanged(value, oldValue)) {
|
|
991
|
+
trigger(target, "set", key, value, oldValue);
|
|
992
|
+
}
|
|
993
|
+
return this;
|
|
994
|
+
},
|
|
995
|
+
delete(key) {
|
|
996
|
+
const target = toRaw(this);
|
|
997
|
+
const { has, get } = getProto(target);
|
|
998
|
+
let hadKey = has.call(target, key);
|
|
999
|
+
if (!hadKey) {
|
|
1000
|
+
key = toRaw(key);
|
|
1001
|
+
hadKey = has.call(target, key);
|
|
1002
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
1003
|
+
checkIdentityKeys(target, has, key);
|
|
1004
|
+
}
|
|
1005
|
+
const oldValue = get ? get.call(target, key) : void 0;
|
|
1006
|
+
const result = target.delete(key);
|
|
1007
|
+
if (hadKey) {
|
|
1008
|
+
trigger(target, "delete", key, void 0, oldValue);
|
|
1009
|
+
}
|
|
1010
|
+
return result;
|
|
1011
|
+
},
|
|
1012
|
+
clear() {
|
|
1013
|
+
const target = toRaw(this);
|
|
1014
|
+
const hadItems = target.size !== 0;
|
|
1015
|
+
const oldTarget = !!(process.env.NODE_ENV !== "production") ? isMap(target) ? new Map(target) : new Set(target) : void 0;
|
|
1016
|
+
const result = target.clear();
|
|
1017
|
+
if (hadItems) {
|
|
1018
|
+
trigger(
|
|
1019
|
+
target,
|
|
1020
|
+
"clear",
|
|
1021
|
+
void 0,
|
|
1022
|
+
void 0,
|
|
1023
|
+
oldTarget
|
|
1024
|
+
);
|
|
1025
|
+
}
|
|
1026
|
+
return result;
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
);
|
|
1030
|
+
const iteratorMethods = [
|
|
1031
|
+
"keys",
|
|
1032
|
+
"values",
|
|
1033
|
+
"entries",
|
|
1034
|
+
Symbol.iterator
|
|
1035
|
+
];
|
|
1036
|
+
iteratorMethods.forEach((method) => {
|
|
1037
|
+
instrumentations[method] = createIterableMethod(method, readonly, shallow);
|
|
1038
|
+
});
|
|
1039
|
+
return instrumentations;
|
|
1040
|
+
}
|
|
1041
|
+
function createInstrumentationGetter(isReadonly2, shallow) {
|
|
1042
|
+
const instrumentations = createInstrumentations(isReadonly2, shallow);
|
|
1043
|
+
return (target, key, receiver) => {
|
|
1044
|
+
if (key === "__v_isReactive") {
|
|
1045
|
+
return !isReadonly2;
|
|
1046
|
+
} else if (key === "__v_isReadonly") {
|
|
1047
|
+
return isReadonly2;
|
|
1048
|
+
} else if (key === "__v_raw") {
|
|
1049
|
+
return target;
|
|
1050
|
+
}
|
|
1051
|
+
return Reflect.get(
|
|
1052
|
+
hasOwn(instrumentations, key) && key in target ? instrumentations : target,
|
|
1053
|
+
key,
|
|
1054
|
+
receiver
|
|
1055
|
+
);
|
|
1056
|
+
};
|
|
1057
|
+
}
|
|
1058
|
+
const mutableCollectionHandlers = {
|
|
1059
|
+
get: /* @__PURE__ */ createInstrumentationGetter(false, false)
|
|
1060
|
+
};
|
|
1061
|
+
const readonlyCollectionHandlers = {
|
|
1062
|
+
get: /* @__PURE__ */ createInstrumentationGetter(true, false)
|
|
1063
|
+
};
|
|
1064
|
+
function checkIdentityKeys(target, has, key) {
|
|
1065
|
+
const rawKey = toRaw(key);
|
|
1066
|
+
if (rawKey !== key && has.call(target, rawKey)) {
|
|
1067
|
+
const type = toRawType(target);
|
|
1068
|
+
warn(
|
|
1069
|
+
`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`
|
|
1070
|
+
);
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
const reactiveMap = /* @__PURE__ */ new WeakMap();
|
|
1075
|
+
const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
|
|
1076
|
+
const readonlyMap = /* @__PURE__ */ new WeakMap();
|
|
1077
|
+
const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
|
|
1078
|
+
function targetTypeMap(rawType) {
|
|
1079
|
+
switch (rawType) {
|
|
1080
|
+
case "Object":
|
|
1081
|
+
case "Array":
|
|
1082
|
+
return 1 /* COMMON */;
|
|
1083
|
+
case "Map":
|
|
1084
|
+
case "Set":
|
|
1085
|
+
case "WeakMap":
|
|
1086
|
+
case "WeakSet":
|
|
1087
|
+
return 2 /* COLLECTION */;
|
|
1088
|
+
default:
|
|
1089
|
+
return 0 /* INVALID */;
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
function getTargetType(value) {
|
|
1093
|
+
return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));
|
|
1094
|
+
}
|
|
1095
|
+
function reactive(target) {
|
|
1096
|
+
if (isReadonly(target)) {
|
|
1097
|
+
return target;
|
|
1098
|
+
}
|
|
1099
|
+
return createReactiveObject(
|
|
1100
|
+
target,
|
|
1101
|
+
false,
|
|
1102
|
+
mutableHandlers,
|
|
1103
|
+
mutableCollectionHandlers,
|
|
1104
|
+
reactiveMap
|
|
1105
|
+
);
|
|
1106
|
+
}
|
|
1107
|
+
function readonly(target) {
|
|
1108
|
+
return createReactiveObject(
|
|
1109
|
+
target,
|
|
1110
|
+
true,
|
|
1111
|
+
readonlyHandlers,
|
|
1112
|
+
readonlyCollectionHandlers,
|
|
1113
|
+
readonlyMap
|
|
1114
|
+
);
|
|
1115
|
+
}
|
|
1116
|
+
function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
|
|
1117
|
+
if (!isObject(target)) {
|
|
1118
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1119
|
+
warn(
|
|
1120
|
+
`value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(
|
|
1121
|
+
target
|
|
1122
|
+
)}`
|
|
1123
|
+
);
|
|
1124
|
+
}
|
|
1125
|
+
return target;
|
|
1126
|
+
}
|
|
1127
|
+
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
|
|
1128
|
+
return target;
|
|
1129
|
+
}
|
|
1130
|
+
const targetType = getTargetType(target);
|
|
1131
|
+
if (targetType === 0 /* INVALID */) {
|
|
1132
|
+
return target;
|
|
1133
|
+
}
|
|
1134
|
+
const existingProxy = proxyMap.get(target);
|
|
1135
|
+
if (existingProxy) {
|
|
1136
|
+
return existingProxy;
|
|
1137
|
+
}
|
|
1138
|
+
const proxy = new Proxy(
|
|
1139
|
+
target,
|
|
1140
|
+
targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
|
|
1141
|
+
);
|
|
1142
|
+
proxyMap.set(target, proxy);
|
|
1143
|
+
return proxy;
|
|
1144
|
+
}
|
|
1145
|
+
function isReactive(value) {
|
|
1146
|
+
if (isReadonly(value)) {
|
|
1147
|
+
return isReactive(value["__v_raw"]);
|
|
1148
|
+
}
|
|
1149
|
+
return !!(value && value["__v_isReactive"]);
|
|
1150
|
+
}
|
|
1151
|
+
function isReadonly(value) {
|
|
1152
|
+
return !!(value && value["__v_isReadonly"]);
|
|
1153
|
+
}
|
|
1154
|
+
function isShallow(value) {
|
|
1155
|
+
return !!(value && value["__v_isShallow"]);
|
|
1156
|
+
}
|
|
1157
|
+
function isProxy(value) {
|
|
1158
|
+
return value ? !!value["__v_raw"] : false;
|
|
1159
|
+
}
|
|
1160
|
+
function toRaw(observed) {
|
|
1161
|
+
const raw = observed && observed["__v_raw"];
|
|
1162
|
+
return raw ? toRaw(raw) : observed;
|
|
1163
|
+
}
|
|
1164
|
+
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
1165
|
+
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
|
1166
|
+
|
|
1167
|
+
function isRef(r) {
|
|
1168
|
+
return r ? r["__v_isRef"] === true : false;
|
|
1169
|
+
}
|
|
1170
|
+
function ref(value) {
|
|
1171
|
+
return createRef(value, false);
|
|
1172
|
+
}
|
|
1173
|
+
function createRef(rawValue, shallow) {
|
|
1174
|
+
if (isRef(rawValue)) {
|
|
1175
|
+
return rawValue;
|
|
1176
|
+
}
|
|
1177
|
+
return new RefImpl(rawValue, shallow);
|
|
1178
|
+
}
|
|
1179
|
+
class RefImpl {
|
|
1180
|
+
constructor(value, isShallow2) {
|
|
1181
|
+
this.dep = new Dep();
|
|
1182
|
+
this["__v_isRef"] = true;
|
|
1183
|
+
this["__v_isShallow"] = false;
|
|
1184
|
+
this._rawValue = isShallow2 ? value : toRaw(value);
|
|
1185
|
+
this._value = isShallow2 ? value : toReactive(value);
|
|
1186
|
+
this["__v_isShallow"] = isShallow2;
|
|
1187
|
+
}
|
|
1188
|
+
get value() {
|
|
1189
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1190
|
+
this.dep.track({
|
|
1191
|
+
target: this,
|
|
1192
|
+
type: "get",
|
|
1193
|
+
key: "value"
|
|
1194
|
+
});
|
|
1195
|
+
} else {
|
|
1196
|
+
this.dep.track();
|
|
1197
|
+
}
|
|
1198
|
+
return this._value;
|
|
1199
|
+
}
|
|
1200
|
+
set value(newValue) {
|
|
1201
|
+
const oldValue = this._rawValue;
|
|
1202
|
+
const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
|
|
1203
|
+
newValue = useDirectValue ? newValue : toRaw(newValue);
|
|
1204
|
+
if (hasChanged(newValue, oldValue)) {
|
|
1205
|
+
this._rawValue = newValue;
|
|
1206
|
+
this._value = useDirectValue ? newValue : toReactive(newValue);
|
|
1207
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1208
|
+
this.dep.trigger({
|
|
1209
|
+
target: this,
|
|
1210
|
+
type: "set",
|
|
1211
|
+
key: "value",
|
|
1212
|
+
newValue,
|
|
1213
|
+
oldValue
|
|
1214
|
+
});
|
|
1215
|
+
} else {
|
|
1216
|
+
this.dep.trigger();
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* @vue/runtime-core v3.5.18
|
|
1224
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
1225
|
+
* @license MIT
|
|
1226
|
+
**/
|
|
1227
|
+
|
|
1228
|
+
const stack = [];
|
|
1229
|
+
function pushWarningContext(vnode) {
|
|
1230
|
+
stack.push(vnode);
|
|
1231
|
+
}
|
|
1232
|
+
function popWarningContext() {
|
|
1233
|
+
stack.pop();
|
|
1234
|
+
}
|
|
1235
|
+
let isWarning = false;
|
|
1236
|
+
function warn$1(msg, ...args) {
|
|
1237
|
+
if (isWarning) return;
|
|
1238
|
+
isWarning = true;
|
|
1239
|
+
const instance = stack.length ? stack[stack.length - 1].component : null;
|
|
1240
|
+
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
1241
|
+
const trace = getComponentTrace();
|
|
1242
|
+
if (appWarnHandler) {
|
|
1243
|
+
callWithErrorHandling(
|
|
1244
|
+
appWarnHandler,
|
|
1245
|
+
instance,
|
|
1246
|
+
11,
|
|
1247
|
+
[
|
|
1248
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
1249
|
+
msg + args.map((a) => {
|
|
1250
|
+
var _a, _b;
|
|
1251
|
+
return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
|
|
1252
|
+
}).join(""),
|
|
1253
|
+
instance && instance.proxy,
|
|
1254
|
+
trace.map(
|
|
1255
|
+
({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`
|
|
1256
|
+
).join("\n"),
|
|
1257
|
+
trace
|
|
1258
|
+
]
|
|
1259
|
+
);
|
|
1260
|
+
} else {
|
|
1261
|
+
const warnArgs = [`[Vue warn]: ${msg}`, ...args];
|
|
1262
|
+
if (trace.length && // avoid spamming console during tests
|
|
1263
|
+
true) {
|
|
1264
|
+
warnArgs.push(`
|
|
1265
|
+
`, ...formatTrace(trace));
|
|
1266
|
+
}
|
|
1267
|
+
console.warn(...warnArgs);
|
|
1268
|
+
}
|
|
1269
|
+
isWarning = false;
|
|
1270
|
+
}
|
|
1271
|
+
function getComponentTrace() {
|
|
1272
|
+
let currentVNode = stack[stack.length - 1];
|
|
1273
|
+
if (!currentVNode) {
|
|
1274
|
+
return [];
|
|
1275
|
+
}
|
|
1276
|
+
const normalizedStack = [];
|
|
1277
|
+
while (currentVNode) {
|
|
1278
|
+
const last = normalizedStack[0];
|
|
1279
|
+
if (last && last.vnode === currentVNode) {
|
|
1280
|
+
last.recurseCount++;
|
|
1281
|
+
} else {
|
|
1282
|
+
normalizedStack.push({
|
|
1283
|
+
vnode: currentVNode,
|
|
1284
|
+
recurseCount: 0
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1287
|
+
const parentInstance = currentVNode.component && currentVNode.component.parent;
|
|
1288
|
+
currentVNode = parentInstance && parentInstance.vnode;
|
|
1289
|
+
}
|
|
1290
|
+
return normalizedStack;
|
|
1291
|
+
}
|
|
1292
|
+
function formatTrace(trace) {
|
|
1293
|
+
const logs = [];
|
|
1294
|
+
trace.forEach((entry, i) => {
|
|
1295
|
+
logs.push(...i === 0 ? [] : [`
|
|
1296
|
+
`], ...formatTraceEntry(entry));
|
|
1297
|
+
});
|
|
1298
|
+
return logs;
|
|
1299
|
+
}
|
|
1300
|
+
function formatTraceEntry({ vnode, recurseCount }) {
|
|
1301
|
+
const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
|
|
1302
|
+
const isRoot = vnode.component ? vnode.component.parent == null : false;
|
|
1303
|
+
const open = ` at <${formatComponentName(
|
|
1304
|
+
vnode.component,
|
|
1305
|
+
vnode.type,
|
|
1306
|
+
isRoot
|
|
1307
|
+
)}`;
|
|
1308
|
+
const close = `>` + postfix;
|
|
1309
|
+
return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
|
|
1310
|
+
}
|
|
1311
|
+
function formatProps(props) {
|
|
1312
|
+
const res = [];
|
|
1313
|
+
const keys = Object.keys(props);
|
|
1314
|
+
keys.slice(0, 3).forEach((key) => {
|
|
1315
|
+
res.push(...formatProp(key, props[key]));
|
|
1316
|
+
});
|
|
1317
|
+
if (keys.length > 3) {
|
|
1318
|
+
res.push(` ...`);
|
|
1319
|
+
}
|
|
1320
|
+
return res;
|
|
1321
|
+
}
|
|
1322
|
+
function formatProp(key, value, raw) {
|
|
1323
|
+
if (isString(value)) {
|
|
1324
|
+
value = JSON.stringify(value);
|
|
1325
|
+
return raw ? value : [`${key}=${value}`];
|
|
1326
|
+
} else if (typeof value === "number" || typeof value === "boolean" || value == null) {
|
|
1327
|
+
return raw ? value : [`${key}=${value}`];
|
|
1328
|
+
} else if (isRef(value)) {
|
|
1329
|
+
value = formatProp(key, toRaw(value.value), true);
|
|
1330
|
+
return raw ? value : [`${key}=Ref<`, value, `>`];
|
|
1331
|
+
} else if (isFunction(value)) {
|
|
1332
|
+
return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
|
|
1333
|
+
} else {
|
|
1334
|
+
value = toRaw(value);
|
|
1335
|
+
return raw ? value : [`${key}=`, value];
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
const ErrorTypeStrings$1 = {
|
|
1339
|
+
["sp"]: "serverPrefetch hook",
|
|
1340
|
+
["bc"]: "beforeCreate hook",
|
|
1341
|
+
["c"]: "created hook",
|
|
1342
|
+
["bm"]: "beforeMount hook",
|
|
1343
|
+
["m"]: "mounted hook",
|
|
1344
|
+
["bu"]: "beforeUpdate hook",
|
|
1345
|
+
["u"]: "updated",
|
|
1346
|
+
["bum"]: "beforeUnmount hook",
|
|
1347
|
+
["um"]: "unmounted hook",
|
|
1348
|
+
["a"]: "activated hook",
|
|
1349
|
+
["da"]: "deactivated hook",
|
|
1350
|
+
["ec"]: "errorCaptured hook",
|
|
1351
|
+
["rtc"]: "renderTracked hook",
|
|
1352
|
+
["rtg"]: "renderTriggered hook",
|
|
1353
|
+
[0]: "setup function",
|
|
1354
|
+
[1]: "render function",
|
|
1355
|
+
[2]: "watcher getter",
|
|
1356
|
+
[3]: "watcher callback",
|
|
1357
|
+
[4]: "watcher cleanup function",
|
|
1358
|
+
[5]: "native event handler",
|
|
1359
|
+
[6]: "component event handler",
|
|
1360
|
+
[7]: "vnode hook",
|
|
1361
|
+
[8]: "directive hook",
|
|
1362
|
+
[9]: "transition hook",
|
|
1363
|
+
[10]: "app errorHandler",
|
|
1364
|
+
[11]: "app warnHandler",
|
|
1365
|
+
[12]: "ref function",
|
|
1366
|
+
[13]: "async component loader",
|
|
1367
|
+
[14]: "scheduler flush",
|
|
1368
|
+
[15]: "component update",
|
|
1369
|
+
[16]: "app unmount cleanup function"
|
|
1370
|
+
};
|
|
1371
|
+
function callWithErrorHandling(fn, instance, type, args) {
|
|
1372
|
+
try {
|
|
1373
|
+
return args ? fn(...args) : fn();
|
|
1374
|
+
} catch (err) {
|
|
1375
|
+
handleError(err, instance, type);
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
function handleError(err, instance, type, throwInDev = true) {
|
|
1379
|
+
const contextVNode = instance ? instance.vnode : null;
|
|
1380
|
+
const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
|
|
1381
|
+
if (instance) {
|
|
1382
|
+
let cur = instance.parent;
|
|
1383
|
+
const exposedInstance = instance.proxy;
|
|
1384
|
+
const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings$1[type] : `https://vuejs.org/error-reference/#runtime-${type}`;
|
|
1385
|
+
while (cur) {
|
|
1386
|
+
const errorCapturedHooks = cur.ec;
|
|
1387
|
+
if (errorCapturedHooks) {
|
|
1388
|
+
for (let i = 0; i < errorCapturedHooks.length; i++) {
|
|
1389
|
+
if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
|
|
1390
|
+
return;
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
cur = cur.parent;
|
|
1395
|
+
}
|
|
1396
|
+
if (errorHandler) {
|
|
1397
|
+
callWithErrorHandling(errorHandler, null, 10, [
|
|
1398
|
+
err,
|
|
1399
|
+
exposedInstance,
|
|
1400
|
+
errorInfo
|
|
1401
|
+
]);
|
|
1402
|
+
return;
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
|
|
1406
|
+
}
|
|
1407
|
+
function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
|
|
1408
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1409
|
+
const info = ErrorTypeStrings$1[type];
|
|
1410
|
+
if (contextVNode) {
|
|
1411
|
+
pushWarningContext(contextVNode);
|
|
1412
|
+
}
|
|
1413
|
+
warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
|
1414
|
+
if (contextVNode) {
|
|
1415
|
+
popWarningContext();
|
|
1416
|
+
}
|
|
1417
|
+
if (throwInDev) {
|
|
1418
|
+
throw err;
|
|
1419
|
+
} else {
|
|
1420
|
+
console.error(err);
|
|
1421
|
+
}
|
|
1422
|
+
} else if (throwInProd) {
|
|
1423
|
+
throw err;
|
|
1424
|
+
} else {
|
|
1425
|
+
console.error(err);
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
const queue = [];
|
|
1430
|
+
let flushIndex = -1;
|
|
1431
|
+
const pendingPostFlushCbs = [];
|
|
1432
|
+
let activePostFlushCbs = null;
|
|
1433
|
+
let postFlushIndex = 0;
|
|
1434
|
+
const resolvedPromise = /* @__PURE__ */ Promise.resolve();
|
|
1435
|
+
let currentFlushPromise = null;
|
|
1436
|
+
const RECURSION_LIMIT = 100;
|
|
1437
|
+
function findInsertionIndex(id) {
|
|
1438
|
+
let start = flushIndex + 1;
|
|
1439
|
+
let end = queue.length;
|
|
1440
|
+
while (start < end) {
|
|
1441
|
+
const middle = start + end >>> 1;
|
|
1442
|
+
const middleJob = queue[middle];
|
|
1443
|
+
const middleJobId = getId(middleJob);
|
|
1444
|
+
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
1445
|
+
start = middle + 1;
|
|
1446
|
+
} else {
|
|
1447
|
+
end = middle;
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
return start;
|
|
1451
|
+
}
|
|
1452
|
+
function queueJob(job) {
|
|
1453
|
+
if (!(job.flags & 1)) {
|
|
1454
|
+
const jobId = getId(job);
|
|
1455
|
+
const lastJob = queue[queue.length - 1];
|
|
1456
|
+
if (!lastJob || // fast path when the job id is larger than the tail
|
|
1457
|
+
!(job.flags & 2) && jobId >= getId(lastJob)) {
|
|
1458
|
+
queue.push(job);
|
|
1459
|
+
} else {
|
|
1460
|
+
queue.splice(findInsertionIndex(jobId), 0, job);
|
|
1461
|
+
}
|
|
1462
|
+
job.flags |= 1;
|
|
1463
|
+
queueFlush();
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
function queueFlush() {
|
|
1467
|
+
if (!currentFlushPromise) {
|
|
1468
|
+
currentFlushPromise = resolvedPromise.then(flushJobs);
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
function queuePostFlushCb(cb) {
|
|
1472
|
+
if (!isArray(cb)) {
|
|
1473
|
+
if (activePostFlushCbs && cb.id === -1) {
|
|
1474
|
+
activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
|
|
1475
|
+
} else if (!(cb.flags & 1)) {
|
|
1476
|
+
pendingPostFlushCbs.push(cb);
|
|
1477
|
+
cb.flags |= 1;
|
|
1478
|
+
}
|
|
1479
|
+
} else {
|
|
1480
|
+
pendingPostFlushCbs.push(...cb);
|
|
1481
|
+
}
|
|
1482
|
+
queueFlush();
|
|
1483
|
+
}
|
|
1484
|
+
function flushPostFlushCbs(seen) {
|
|
1485
|
+
if (pendingPostFlushCbs.length) {
|
|
1486
|
+
const deduped = [...new Set(pendingPostFlushCbs)].sort(
|
|
1487
|
+
(a, b) => getId(a) - getId(b)
|
|
1488
|
+
);
|
|
1489
|
+
pendingPostFlushCbs.length = 0;
|
|
1490
|
+
if (activePostFlushCbs) {
|
|
1491
|
+
activePostFlushCbs.push(...deduped);
|
|
1492
|
+
return;
|
|
1493
|
+
}
|
|
1494
|
+
activePostFlushCbs = deduped;
|
|
1495
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1496
|
+
seen = seen || /* @__PURE__ */ new Map();
|
|
1497
|
+
}
|
|
1498
|
+
for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
|
|
1499
|
+
const cb = activePostFlushCbs[postFlushIndex];
|
|
1500
|
+
if (!!(process.env.NODE_ENV !== "production") && checkRecursiveUpdates(seen, cb)) {
|
|
1501
|
+
continue;
|
|
1502
|
+
}
|
|
1503
|
+
if (cb.flags & 4) {
|
|
1504
|
+
cb.flags &= -2;
|
|
1505
|
+
}
|
|
1506
|
+
if (!(cb.flags & 8)) cb();
|
|
1507
|
+
cb.flags &= -2;
|
|
1508
|
+
}
|
|
1509
|
+
activePostFlushCbs = null;
|
|
1510
|
+
postFlushIndex = 0;
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
|
|
1514
|
+
function flushJobs(seen) {
|
|
1515
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1516
|
+
seen = seen || /* @__PURE__ */ new Map();
|
|
1517
|
+
}
|
|
1518
|
+
const check = !!(process.env.NODE_ENV !== "production") ? (job) => checkRecursiveUpdates(seen, job) : NOOP;
|
|
1519
|
+
try {
|
|
1520
|
+
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
1521
|
+
const job = queue[flushIndex];
|
|
1522
|
+
if (job && !(job.flags & 8)) {
|
|
1523
|
+
if (!!(process.env.NODE_ENV !== "production") && check(job)) {
|
|
1524
|
+
continue;
|
|
1525
|
+
}
|
|
1526
|
+
if (job.flags & 4) {
|
|
1527
|
+
job.flags &= ~1;
|
|
1528
|
+
}
|
|
1529
|
+
callWithErrorHandling(
|
|
1530
|
+
job,
|
|
1531
|
+
job.i,
|
|
1532
|
+
job.i ? 15 : 14
|
|
1533
|
+
);
|
|
1534
|
+
if (!(job.flags & 4)) {
|
|
1535
|
+
job.flags &= ~1;
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
} finally {
|
|
1540
|
+
for (; flushIndex < queue.length; flushIndex++) {
|
|
1541
|
+
const job = queue[flushIndex];
|
|
1542
|
+
if (job) {
|
|
1543
|
+
job.flags &= -2;
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
flushIndex = -1;
|
|
1547
|
+
queue.length = 0;
|
|
1548
|
+
flushPostFlushCbs(seen);
|
|
1549
|
+
currentFlushPromise = null;
|
|
1550
|
+
if (queue.length || pendingPostFlushCbs.length) {
|
|
1551
|
+
flushJobs(seen);
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
function checkRecursiveUpdates(seen, fn) {
|
|
1556
|
+
const count = seen.get(fn) || 0;
|
|
1557
|
+
if (count > RECURSION_LIMIT) {
|
|
1558
|
+
const instance = fn.i;
|
|
1559
|
+
const componentName = instance && getComponentName(instance.type);
|
|
1560
|
+
handleError(
|
|
1561
|
+
`Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
|
|
1562
|
+
null,
|
|
1563
|
+
10
|
|
1564
|
+
);
|
|
1565
|
+
return true;
|
|
1566
|
+
}
|
|
1567
|
+
seen.set(fn, count + 1);
|
|
1568
|
+
return false;
|
|
1569
|
+
}
|
|
1570
|
+
const hmrDirtyComponents = /* @__PURE__ */ new Map();
|
|
1571
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1572
|
+
getGlobalThis().__VUE_HMR_RUNTIME__ = {
|
|
1573
|
+
createRecord: tryWrap(createRecord),
|
|
1574
|
+
rerender: tryWrap(rerender),
|
|
1575
|
+
reload: tryWrap(reload)
|
|
1576
|
+
};
|
|
1577
|
+
}
|
|
1578
|
+
const map = /* @__PURE__ */ new Map();
|
|
1579
|
+
function createRecord(id, initialDef) {
|
|
1580
|
+
if (map.has(id)) {
|
|
1581
|
+
return false;
|
|
1582
|
+
}
|
|
1583
|
+
map.set(id, {
|
|
1584
|
+
initialDef: normalizeClassComponent(initialDef),
|
|
1585
|
+
instances: /* @__PURE__ */ new Set()
|
|
1586
|
+
});
|
|
1587
|
+
return true;
|
|
1588
|
+
}
|
|
1589
|
+
function normalizeClassComponent(component) {
|
|
1590
|
+
return isClassComponent(component) ? component.__vccOpts : component;
|
|
1591
|
+
}
|
|
1592
|
+
function rerender(id, newRender) {
|
|
1593
|
+
const record = map.get(id);
|
|
1594
|
+
if (!record) {
|
|
1595
|
+
return;
|
|
1596
|
+
}
|
|
1597
|
+
record.initialDef.render = newRender;
|
|
1598
|
+
[...record.instances].forEach((instance) => {
|
|
1599
|
+
if (newRender) {
|
|
1600
|
+
instance.render = newRender;
|
|
1601
|
+
normalizeClassComponent(instance.type).render = newRender;
|
|
1602
|
+
}
|
|
1603
|
+
instance.renderCache = [];
|
|
1604
|
+
instance.update();
|
|
1605
|
+
});
|
|
1606
|
+
}
|
|
1607
|
+
function reload(id, newComp) {
|
|
1608
|
+
const record = map.get(id);
|
|
1609
|
+
if (!record) return;
|
|
1610
|
+
newComp = normalizeClassComponent(newComp);
|
|
1611
|
+
updateComponentDef(record.initialDef, newComp);
|
|
1612
|
+
const instances = [...record.instances];
|
|
1613
|
+
for (let i = 0; i < instances.length; i++) {
|
|
1614
|
+
const instance = instances[i];
|
|
1615
|
+
const oldComp = normalizeClassComponent(instance.type);
|
|
1616
|
+
let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
|
1617
|
+
if (!dirtyInstances) {
|
|
1618
|
+
if (oldComp !== record.initialDef) {
|
|
1619
|
+
updateComponentDef(oldComp, newComp);
|
|
1620
|
+
}
|
|
1621
|
+
hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
|
|
1622
|
+
}
|
|
1623
|
+
dirtyInstances.add(instance);
|
|
1624
|
+
instance.appContext.propsCache.delete(instance.type);
|
|
1625
|
+
instance.appContext.emitsCache.delete(instance.type);
|
|
1626
|
+
instance.appContext.optionsCache.delete(instance.type);
|
|
1627
|
+
if (instance.ceReload) {
|
|
1628
|
+
dirtyInstances.add(instance);
|
|
1629
|
+
instance.ceReload(newComp.styles);
|
|
1630
|
+
dirtyInstances.delete(instance);
|
|
1631
|
+
} else if (instance.parent) {
|
|
1632
|
+
queueJob(() => {
|
|
1633
|
+
instance.parent.update();
|
|
1634
|
+
dirtyInstances.delete(instance);
|
|
1635
|
+
});
|
|
1636
|
+
} else if (instance.appContext.reload) {
|
|
1637
|
+
instance.appContext.reload();
|
|
1638
|
+
} else if (typeof window !== "undefined") {
|
|
1639
|
+
window.location.reload();
|
|
1640
|
+
} else {
|
|
1641
|
+
console.warn(
|
|
1642
|
+
"[HMR] Root or manually mounted instance modified. Full reload required."
|
|
1643
|
+
);
|
|
1644
|
+
}
|
|
1645
|
+
if (instance.root.ce && instance !== instance.root) {
|
|
1646
|
+
instance.root.ce._removeChildStyle(oldComp);
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
queuePostFlushCb(() => {
|
|
1650
|
+
hmrDirtyComponents.clear();
|
|
1651
|
+
});
|
|
1652
|
+
}
|
|
1653
|
+
function updateComponentDef(oldComp, newComp) {
|
|
1654
|
+
extend(oldComp, newComp);
|
|
1655
|
+
for (const key in oldComp) {
|
|
1656
|
+
if (key !== "__file" && !(key in newComp)) {
|
|
1657
|
+
delete oldComp[key];
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
function tryWrap(fn) {
|
|
1662
|
+
return (id, arg) => {
|
|
1663
|
+
try {
|
|
1664
|
+
return fn(id, arg);
|
|
1665
|
+
} catch (e) {
|
|
1666
|
+
console.error(e);
|
|
1667
|
+
console.warn(
|
|
1668
|
+
`[HMR] Something went wrong during Vue component hot-reload. Full reload required.`
|
|
1669
|
+
);
|
|
1670
|
+
}
|
|
1671
|
+
};
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
let devtools$1;
|
|
1675
|
+
let buffer = [];
|
|
1676
|
+
function setDevtoolsHook$1(hook, target) {
|
|
1677
|
+
var _a, _b;
|
|
1678
|
+
devtools$1 = hook;
|
|
1679
|
+
if (devtools$1) {
|
|
1680
|
+
devtools$1.enabled = true;
|
|
1681
|
+
buffer.forEach(({ event, args }) => devtools$1.emit(event, ...args));
|
|
1682
|
+
buffer = [];
|
|
1683
|
+
} else if (
|
|
1684
|
+
// handle late devtools injection - only do this if we are in an actual
|
|
1685
|
+
// browser environment to avoid the timer handle stalling test runner exit
|
|
1686
|
+
// (#4815)
|
|
1687
|
+
typeof window !== "undefined" && // some envs mock window but not fully
|
|
1688
|
+
window.HTMLElement && // also exclude jsdom
|
|
1689
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
1690
|
+
!((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
|
|
1691
|
+
) {
|
|
1692
|
+
const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
|
|
1693
|
+
replay.push((newHook) => {
|
|
1694
|
+
setDevtoolsHook$1(newHook, target);
|
|
1695
|
+
});
|
|
1696
|
+
setTimeout(() => {
|
|
1697
|
+
if (!devtools$1) {
|
|
1698
|
+
target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;
|
|
1699
|
+
buffer = [];
|
|
1700
|
+
}
|
|
1701
|
+
}, 3e3);
|
|
1702
|
+
} else {
|
|
1703
|
+
buffer = [];
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
let currentRenderingInstance = null;
|
|
1708
|
+
let currentScopeId = null;
|
|
1709
|
+
const isTeleport = (type) => type.__isTeleport;
|
|
1710
|
+
function setTransitionHooks(vnode, hooks) {
|
|
1711
|
+
if (vnode.shapeFlag & 6 && vnode.component) {
|
|
1712
|
+
vnode.transition = hooks;
|
|
1713
|
+
setTransitionHooks(vnode.component.subTree, hooks);
|
|
1714
|
+
} else if (vnode.shapeFlag & 128) {
|
|
1715
|
+
vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
|
1716
|
+
vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
1717
|
+
} else {
|
|
1718
|
+
vnode.transition = hooks;
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1722
|
+
getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
|
|
1723
|
+
getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
|
|
1724
|
+
const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
|
1725
|
+
const PublicInstanceProxyHandlers = {
|
|
1726
|
+
};
|
|
1727
|
+
if (!!(process.env.NODE_ENV !== "production") && true) {
|
|
1728
|
+
PublicInstanceProxyHandlers.ownKeys = (target) => {
|
|
1729
|
+
warn$1(
|
|
1730
|
+
`Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`
|
|
1731
|
+
);
|
|
1732
|
+
return Reflect.ownKeys(target);
|
|
1733
|
+
};
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
const internalObjectProto = {};
|
|
1737
|
+
const isInternalObject = (obj) => Object.getPrototypeOf(obj) === internalObjectProto;
|
|
1738
|
+
|
|
1739
|
+
const isSuspense = (type) => type.__isSuspense;
|
|
1740
|
+
|
|
1741
|
+
const Fragment = Symbol.for("v-fgt");
|
|
1742
|
+
const Text = Symbol.for("v-txt");
|
|
1743
|
+
const Comment = Symbol.for("v-cmt");
|
|
1744
|
+
function isVNode(value) {
|
|
1745
|
+
return value ? value.__v_isVNode === true : false;
|
|
1746
|
+
}
|
|
1747
|
+
const createVNodeWithArgsTransform = (...args) => {
|
|
1748
|
+
return _createVNode(
|
|
1749
|
+
...args
|
|
1750
|
+
);
|
|
237
1751
|
};
|
|
1752
|
+
const normalizeKey = ({ key }) => key != null ? key : null;
|
|
1753
|
+
const normalizeRef = ({
|
|
1754
|
+
ref,
|
|
1755
|
+
ref_key,
|
|
1756
|
+
ref_for
|
|
1757
|
+
}) => {
|
|
1758
|
+
if (typeof ref === "number") {
|
|
1759
|
+
ref = "" + ref;
|
|
1760
|
+
}
|
|
1761
|
+
return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
|
|
1762
|
+
};
|
|
1763
|
+
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
|
|
1764
|
+
const vnode = {
|
|
1765
|
+
__v_isVNode: true,
|
|
1766
|
+
__v_skip: true,
|
|
1767
|
+
type,
|
|
1768
|
+
props,
|
|
1769
|
+
key: props && normalizeKey(props),
|
|
1770
|
+
ref: props && normalizeRef(props),
|
|
1771
|
+
scopeId: currentScopeId,
|
|
1772
|
+
slotScopeIds: null,
|
|
1773
|
+
children,
|
|
1774
|
+
component: null,
|
|
1775
|
+
suspense: null,
|
|
1776
|
+
ssContent: null,
|
|
1777
|
+
ssFallback: null,
|
|
1778
|
+
dirs: null,
|
|
1779
|
+
transition: null,
|
|
1780
|
+
el: null,
|
|
1781
|
+
anchor: null,
|
|
1782
|
+
target: null,
|
|
1783
|
+
targetStart: null,
|
|
1784
|
+
targetAnchor: null,
|
|
1785
|
+
staticCount: 0,
|
|
1786
|
+
shapeFlag,
|
|
1787
|
+
patchFlag,
|
|
1788
|
+
dynamicProps,
|
|
1789
|
+
dynamicChildren: null,
|
|
1790
|
+
appContext: null,
|
|
1791
|
+
ctx: currentRenderingInstance
|
|
1792
|
+
};
|
|
1793
|
+
if (needFullChildrenNormalization) {
|
|
1794
|
+
normalizeChildren(vnode, children);
|
|
1795
|
+
if (shapeFlag & 128) {
|
|
1796
|
+
type.normalize(vnode);
|
|
1797
|
+
}
|
|
1798
|
+
} else if (children) {
|
|
1799
|
+
vnode.shapeFlag |= isString(children) ? 8 : 16;
|
|
1800
|
+
}
|
|
1801
|
+
if (!!(process.env.NODE_ENV !== "production") && vnode.key !== vnode.key) {
|
|
1802
|
+
warn$1(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
|
|
1803
|
+
}
|
|
1804
|
+
return vnode;
|
|
1805
|
+
}
|
|
1806
|
+
const createVNode = !!(process.env.NODE_ENV !== "production") ? createVNodeWithArgsTransform : _createVNode;
|
|
1807
|
+
function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
|
|
1808
|
+
if (!type || type === NULL_DYNAMIC_COMPONENT) {
|
|
1809
|
+
if (!!(process.env.NODE_ENV !== "production") && !type) {
|
|
1810
|
+
warn$1(`Invalid vnode type when creating vnode: ${type}.`);
|
|
1811
|
+
}
|
|
1812
|
+
type = Comment;
|
|
1813
|
+
}
|
|
1814
|
+
if (isVNode(type)) {
|
|
1815
|
+
const cloned = cloneVNode(
|
|
1816
|
+
type,
|
|
1817
|
+
props,
|
|
1818
|
+
true
|
|
1819
|
+
/* mergeRef: true */
|
|
1820
|
+
);
|
|
1821
|
+
if (children) {
|
|
1822
|
+
normalizeChildren(cloned, children);
|
|
1823
|
+
}
|
|
1824
|
+
cloned.patchFlag = -2;
|
|
1825
|
+
return cloned;
|
|
1826
|
+
}
|
|
1827
|
+
if (isClassComponent(type)) {
|
|
1828
|
+
type = type.__vccOpts;
|
|
1829
|
+
}
|
|
1830
|
+
if (props) {
|
|
1831
|
+
props = guardReactiveProps(props);
|
|
1832
|
+
let { class: klass, style } = props;
|
|
1833
|
+
if (klass && !isString(klass)) {
|
|
1834
|
+
props.class = normalizeClass(klass);
|
|
1835
|
+
}
|
|
1836
|
+
if (isObject(style)) {
|
|
1837
|
+
if (isProxy(style) && !isArray(style)) {
|
|
1838
|
+
style = extend({}, style);
|
|
1839
|
+
}
|
|
1840
|
+
props.style = normalizeStyle(style);
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0;
|
|
1844
|
+
if (!!(process.env.NODE_ENV !== "production") && shapeFlag & 4 && isProxy(type)) {
|
|
1845
|
+
type = toRaw(type);
|
|
1846
|
+
warn$1(
|
|
1847
|
+
`Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
|
|
1848
|
+
`
|
|
1849
|
+
Component that was made reactive: `,
|
|
1850
|
+
type
|
|
1851
|
+
);
|
|
1852
|
+
}
|
|
1853
|
+
return createBaseVNode(
|
|
1854
|
+
type,
|
|
1855
|
+
props,
|
|
1856
|
+
children,
|
|
1857
|
+
patchFlag,
|
|
1858
|
+
dynamicProps,
|
|
1859
|
+
shapeFlag,
|
|
1860
|
+
isBlockNode,
|
|
1861
|
+
true
|
|
1862
|
+
);
|
|
1863
|
+
}
|
|
1864
|
+
function guardReactiveProps(props) {
|
|
1865
|
+
if (!props) return null;
|
|
1866
|
+
return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
|
|
1867
|
+
}
|
|
1868
|
+
function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false) {
|
|
1869
|
+
const { props, ref, patchFlag, children, transition } = vnode;
|
|
1870
|
+
const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
|
|
1871
|
+
const cloned = {
|
|
1872
|
+
__v_isVNode: true,
|
|
1873
|
+
__v_skip: true,
|
|
1874
|
+
type: vnode.type,
|
|
1875
|
+
props: mergedProps,
|
|
1876
|
+
key: mergedProps && normalizeKey(mergedProps),
|
|
1877
|
+
ref: extraProps && extraProps.ref ? (
|
|
1878
|
+
// #2078 in the case of <component :is="vnode" ref="extra"/>
|
|
1879
|
+
// if the vnode itself already has a ref, cloneVNode will need to merge
|
|
1880
|
+
// the refs so the single vnode can be set on multiple refs
|
|
1881
|
+
mergeRef && ref ? isArray(ref) ? ref.concat(normalizeRef(extraProps)) : [ref, normalizeRef(extraProps)] : normalizeRef(extraProps)
|
|
1882
|
+
) : ref,
|
|
1883
|
+
scopeId: vnode.scopeId,
|
|
1884
|
+
slotScopeIds: vnode.slotScopeIds,
|
|
1885
|
+
children: !!(process.env.NODE_ENV !== "production") && patchFlag === -1 && isArray(children) ? children.map(deepCloneVNode) : children,
|
|
1886
|
+
target: vnode.target,
|
|
1887
|
+
targetStart: vnode.targetStart,
|
|
1888
|
+
targetAnchor: vnode.targetAnchor,
|
|
1889
|
+
staticCount: vnode.staticCount,
|
|
1890
|
+
shapeFlag: vnode.shapeFlag,
|
|
1891
|
+
// if the vnode is cloned with extra props, we can no longer assume its
|
|
1892
|
+
// existing patch flag to be reliable and need to add the FULL_PROPS flag.
|
|
1893
|
+
// note: preserve flag for fragments since they use the flag for children
|
|
1894
|
+
// fast paths only.
|
|
1895
|
+
patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag,
|
|
1896
|
+
dynamicProps: vnode.dynamicProps,
|
|
1897
|
+
dynamicChildren: vnode.dynamicChildren,
|
|
1898
|
+
appContext: vnode.appContext,
|
|
1899
|
+
dirs: vnode.dirs,
|
|
1900
|
+
transition,
|
|
1901
|
+
// These should technically only be non-null on mounted VNodes. However,
|
|
1902
|
+
// they *should* be copied for kept-alive vnodes. So we just always copy
|
|
1903
|
+
// them since them being non-null during a mount doesn't affect the logic as
|
|
1904
|
+
// they will simply be overwritten.
|
|
1905
|
+
component: vnode.component,
|
|
1906
|
+
suspense: vnode.suspense,
|
|
1907
|
+
ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
|
|
1908
|
+
ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
|
1909
|
+
placeholder: vnode.placeholder,
|
|
1910
|
+
el: vnode.el,
|
|
1911
|
+
anchor: vnode.anchor,
|
|
1912
|
+
ctx: vnode.ctx,
|
|
1913
|
+
ce: vnode.ce
|
|
1914
|
+
};
|
|
1915
|
+
if (transition && cloneTransition) {
|
|
1916
|
+
setTransitionHooks(
|
|
1917
|
+
cloned,
|
|
1918
|
+
transition.clone(cloned)
|
|
1919
|
+
);
|
|
1920
|
+
}
|
|
1921
|
+
return cloned;
|
|
1922
|
+
}
|
|
1923
|
+
function deepCloneVNode(vnode) {
|
|
1924
|
+
const cloned = cloneVNode(vnode);
|
|
1925
|
+
if (isArray(vnode.children)) {
|
|
1926
|
+
cloned.children = vnode.children.map(deepCloneVNode);
|
|
1927
|
+
}
|
|
1928
|
+
return cloned;
|
|
1929
|
+
}
|
|
1930
|
+
function createTextVNode(text = " ", flag = 0) {
|
|
1931
|
+
return createVNode(Text, null, text, flag);
|
|
1932
|
+
}
|
|
1933
|
+
function normalizeChildren(vnode, children) {
|
|
1934
|
+
let type = 0;
|
|
1935
|
+
const { shapeFlag } = vnode;
|
|
1936
|
+
if (children == null) {
|
|
1937
|
+
children = null;
|
|
1938
|
+
} else if (isArray(children)) {
|
|
1939
|
+
type = 16;
|
|
1940
|
+
} else if (typeof children === "object") {
|
|
1941
|
+
if (shapeFlag & (1 | 64)) {
|
|
1942
|
+
const slot = children.default;
|
|
1943
|
+
if (slot) {
|
|
1944
|
+
slot._c && (slot._d = false);
|
|
1945
|
+
normalizeChildren(vnode, slot());
|
|
1946
|
+
slot._c && (slot._d = true);
|
|
1947
|
+
}
|
|
1948
|
+
return;
|
|
1949
|
+
} else {
|
|
1950
|
+
type = 32;
|
|
1951
|
+
const slotFlag = children._;
|
|
1952
|
+
if (!slotFlag && !isInternalObject(children)) {
|
|
1953
|
+
children._ctx = currentRenderingInstance;
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
} else if (isFunction(children)) {
|
|
1957
|
+
children = { default: children, _ctx: currentRenderingInstance };
|
|
1958
|
+
type = 32;
|
|
1959
|
+
} else {
|
|
1960
|
+
children = String(children);
|
|
1961
|
+
if (shapeFlag & 64) {
|
|
1962
|
+
type = 16;
|
|
1963
|
+
children = [createTextVNode(children)];
|
|
1964
|
+
} else {
|
|
1965
|
+
type = 8;
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
vnode.children = children;
|
|
1969
|
+
vnode.shapeFlag |= type;
|
|
1970
|
+
}
|
|
1971
|
+
function mergeProps(...args) {
|
|
1972
|
+
const ret = {};
|
|
1973
|
+
for (let i = 0; i < args.length; i++) {
|
|
1974
|
+
const toMerge = args[i];
|
|
1975
|
+
for (const key in toMerge) {
|
|
1976
|
+
if (key === "class") {
|
|
1977
|
+
if (ret.class !== toMerge.class) {
|
|
1978
|
+
ret.class = normalizeClass([ret.class, toMerge.class]);
|
|
1979
|
+
}
|
|
1980
|
+
} else if (key === "style") {
|
|
1981
|
+
ret.style = normalizeStyle([ret.style, toMerge.style]);
|
|
1982
|
+
} else if (isOn(key)) {
|
|
1983
|
+
const existing = ret[key];
|
|
1984
|
+
const incoming = toMerge[key];
|
|
1985
|
+
if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) {
|
|
1986
|
+
ret[key] = existing ? [].concat(existing, incoming) : incoming;
|
|
1987
|
+
}
|
|
1988
|
+
} else if (key !== "") {
|
|
1989
|
+
ret[key] = toMerge[key];
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
return ret;
|
|
1994
|
+
}
|
|
1995
|
+
{
|
|
1996
|
+
const g = getGlobalThis();
|
|
1997
|
+
const registerGlobalSetter = (key, setter) => {
|
|
1998
|
+
let setters;
|
|
1999
|
+
if (!(setters = g[key])) setters = g[key] = [];
|
|
2000
|
+
setters.push(setter);
|
|
2001
|
+
return (v) => {
|
|
2002
|
+
if (setters.length > 1) setters.forEach((set) => set(v));
|
|
2003
|
+
else setters[0](v);
|
|
2004
|
+
};
|
|
2005
|
+
};
|
|
2006
|
+
registerGlobalSetter(
|
|
2007
|
+
`__VUE_INSTANCE_SETTERS__`,
|
|
2008
|
+
(v) => v
|
|
2009
|
+
);
|
|
2010
|
+
registerGlobalSetter(
|
|
2011
|
+
`__VUE_SSR_SETTERS__`,
|
|
2012
|
+
(v) => v
|
|
2013
|
+
);
|
|
2014
|
+
}
|
|
2015
|
+
!!(process.env.NODE_ENV !== "production") ? {
|
|
2016
|
+
} : {
|
|
2017
|
+
};
|
|
2018
|
+
const classifyRE = /(?:^|[-_])(\w)/g;
|
|
2019
|
+
const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
|
|
2020
|
+
function getComponentName(Component, includeInferred = true) {
|
|
2021
|
+
return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
|
|
2022
|
+
}
|
|
2023
|
+
function formatComponentName(instance, Component, isRoot = false) {
|
|
2024
|
+
let name = getComponentName(Component);
|
|
2025
|
+
if (!name && Component.__file) {
|
|
2026
|
+
const match = Component.__file.match(/([^/\\]+)\.\w+$/);
|
|
2027
|
+
if (match) {
|
|
2028
|
+
name = match[1];
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
if (!name && instance && instance.parent) {
|
|
2032
|
+
const inferFromRegistry = (registry) => {
|
|
2033
|
+
for (const key in registry) {
|
|
2034
|
+
if (registry[key] === Component) {
|
|
2035
|
+
return key;
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
};
|
|
2039
|
+
name = inferFromRegistry(
|
|
2040
|
+
instance.components || instance.parent.type.components
|
|
2041
|
+
) || inferFromRegistry(instance.appContext.components);
|
|
2042
|
+
}
|
|
2043
|
+
return name ? classify(name) : isRoot ? `App` : `Anonymous`;
|
|
2044
|
+
}
|
|
2045
|
+
function isClassComponent(value) {
|
|
2046
|
+
return isFunction(value) && "__vccOpts" in value;
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
function initCustomFormatter() {
|
|
2050
|
+
if (!!!(process.env.NODE_ENV !== "production") || typeof window === "undefined") {
|
|
2051
|
+
return;
|
|
2052
|
+
}
|
|
2053
|
+
const vueStyle = { style: "color:#3ba776" };
|
|
2054
|
+
const numberStyle = { style: "color:#1677ff" };
|
|
2055
|
+
const stringStyle = { style: "color:#f5222d" };
|
|
2056
|
+
const keywordStyle = { style: "color:#eb2f96" };
|
|
2057
|
+
const formatter = {
|
|
2058
|
+
__vue_custom_formatter: true,
|
|
2059
|
+
header(obj) {
|
|
2060
|
+
if (!isObject(obj)) {
|
|
2061
|
+
return null;
|
|
2062
|
+
}
|
|
2063
|
+
if (obj.__isVue) {
|
|
2064
|
+
return ["div", vueStyle, `VueInstance`];
|
|
2065
|
+
} else if (isRef(obj)) {
|
|
2066
|
+
const value = obj.value;
|
|
2067
|
+
return [
|
|
2068
|
+
"div",
|
|
2069
|
+
{},
|
|
2070
|
+
["span", vueStyle, genRefFlag(obj)],
|
|
2071
|
+
"<",
|
|
2072
|
+
formatValue(value),
|
|
2073
|
+
`>`
|
|
2074
|
+
];
|
|
2075
|
+
} else if (isReactive(obj)) {
|
|
2076
|
+
return [
|
|
2077
|
+
"div",
|
|
2078
|
+
{},
|
|
2079
|
+
["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
|
|
2080
|
+
"<",
|
|
2081
|
+
formatValue(obj),
|
|
2082
|
+
`>${isReadonly(obj) ? ` (readonly)` : ``}`
|
|
2083
|
+
];
|
|
2084
|
+
} else if (isReadonly(obj)) {
|
|
2085
|
+
return [
|
|
2086
|
+
"div",
|
|
2087
|
+
{},
|
|
2088
|
+
["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
|
|
2089
|
+
"<",
|
|
2090
|
+
formatValue(obj),
|
|
2091
|
+
">"
|
|
2092
|
+
];
|
|
2093
|
+
}
|
|
2094
|
+
return null;
|
|
2095
|
+
},
|
|
2096
|
+
hasBody(obj) {
|
|
2097
|
+
return obj && obj.__isVue;
|
|
2098
|
+
},
|
|
2099
|
+
body(obj) {
|
|
2100
|
+
if (obj && obj.__isVue) {
|
|
2101
|
+
return [
|
|
2102
|
+
"div",
|
|
2103
|
+
{},
|
|
2104
|
+
...formatInstance(obj.$)
|
|
2105
|
+
];
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
};
|
|
2109
|
+
function formatInstance(instance) {
|
|
2110
|
+
const blocks = [];
|
|
2111
|
+
if (instance.type.props && instance.props) {
|
|
2112
|
+
blocks.push(createInstanceBlock("props", toRaw(instance.props)));
|
|
2113
|
+
}
|
|
2114
|
+
if (instance.setupState !== EMPTY_OBJ) {
|
|
2115
|
+
blocks.push(createInstanceBlock("setup", instance.setupState));
|
|
2116
|
+
}
|
|
2117
|
+
if (instance.data !== EMPTY_OBJ) {
|
|
2118
|
+
blocks.push(createInstanceBlock("data", toRaw(instance.data)));
|
|
2119
|
+
}
|
|
2120
|
+
const computed = extractKeys(instance, "computed");
|
|
2121
|
+
if (computed) {
|
|
2122
|
+
blocks.push(createInstanceBlock("computed", computed));
|
|
2123
|
+
}
|
|
2124
|
+
const injected = extractKeys(instance, "inject");
|
|
2125
|
+
if (injected) {
|
|
2126
|
+
blocks.push(createInstanceBlock("injected", injected));
|
|
2127
|
+
}
|
|
2128
|
+
blocks.push([
|
|
2129
|
+
"div",
|
|
2130
|
+
{},
|
|
2131
|
+
[
|
|
2132
|
+
"span",
|
|
2133
|
+
{
|
|
2134
|
+
style: keywordStyle.style + ";opacity:0.66"
|
|
2135
|
+
},
|
|
2136
|
+
"$ (internal): "
|
|
2137
|
+
],
|
|
2138
|
+
["object", { object: instance }]
|
|
2139
|
+
]);
|
|
2140
|
+
return blocks;
|
|
2141
|
+
}
|
|
2142
|
+
function createInstanceBlock(type, target) {
|
|
2143
|
+
target = extend({}, target);
|
|
2144
|
+
if (!Object.keys(target).length) {
|
|
2145
|
+
return ["span", {}];
|
|
2146
|
+
}
|
|
2147
|
+
return [
|
|
2148
|
+
"div",
|
|
2149
|
+
{ style: "line-height:1.25em;margin-bottom:0.6em" },
|
|
2150
|
+
[
|
|
2151
|
+
"div",
|
|
2152
|
+
{
|
|
2153
|
+
style: "color:#476582"
|
|
2154
|
+
},
|
|
2155
|
+
type
|
|
2156
|
+
],
|
|
2157
|
+
[
|
|
2158
|
+
"div",
|
|
2159
|
+
{
|
|
2160
|
+
style: "padding-left:1.25em"
|
|
2161
|
+
},
|
|
2162
|
+
...Object.keys(target).map((key) => {
|
|
2163
|
+
return [
|
|
2164
|
+
"div",
|
|
2165
|
+
{},
|
|
2166
|
+
["span", keywordStyle, key + ": "],
|
|
2167
|
+
formatValue(target[key], false)
|
|
2168
|
+
];
|
|
2169
|
+
})
|
|
2170
|
+
]
|
|
2171
|
+
];
|
|
2172
|
+
}
|
|
2173
|
+
function formatValue(v, asRaw = true) {
|
|
2174
|
+
if (typeof v === "number") {
|
|
2175
|
+
return ["span", numberStyle, v];
|
|
2176
|
+
} else if (typeof v === "string") {
|
|
2177
|
+
return ["span", stringStyle, JSON.stringify(v)];
|
|
2178
|
+
} else if (typeof v === "boolean") {
|
|
2179
|
+
return ["span", keywordStyle, v];
|
|
2180
|
+
} else if (isObject(v)) {
|
|
2181
|
+
return ["object", { object: asRaw ? toRaw(v) : v }];
|
|
2182
|
+
} else {
|
|
2183
|
+
return ["span", stringStyle, String(v)];
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
function extractKeys(instance, type) {
|
|
2187
|
+
const Comp = instance.type;
|
|
2188
|
+
if (isFunction(Comp)) {
|
|
2189
|
+
return;
|
|
2190
|
+
}
|
|
2191
|
+
const extracted = {};
|
|
2192
|
+
for (const key in instance.ctx) {
|
|
2193
|
+
if (isKeyOfType(Comp, key, type)) {
|
|
2194
|
+
extracted[key] = instance.ctx[key];
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
return extracted;
|
|
2198
|
+
}
|
|
2199
|
+
function isKeyOfType(Comp, key, type) {
|
|
2200
|
+
const opts = Comp[type];
|
|
2201
|
+
if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
|
|
2202
|
+
return true;
|
|
2203
|
+
}
|
|
2204
|
+
if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
|
|
2205
|
+
return true;
|
|
2206
|
+
}
|
|
2207
|
+
if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
|
|
2208
|
+
return true;
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
function genRefFlag(v) {
|
|
2212
|
+
if (isShallow(v)) {
|
|
2213
|
+
return `ShallowRef`;
|
|
2214
|
+
}
|
|
2215
|
+
if (v.effect) {
|
|
2216
|
+
return `ComputedRef`;
|
|
2217
|
+
}
|
|
2218
|
+
return `Ref`;
|
|
2219
|
+
}
|
|
2220
|
+
if (window.devtoolsFormatters) {
|
|
2221
|
+
window.devtoolsFormatters.push(formatter);
|
|
2222
|
+
} else {
|
|
2223
|
+
window.devtoolsFormatters = [formatter];
|
|
2224
|
+
}
|
|
2225
|
+
}
|
|
2226
|
+
!!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
|
|
2227
|
+
!!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
|
|
2228
|
+
!!(process.env.NODE_ENV !== "production") || true ? setDevtoolsHook$1 : NOOP;
|
|
2229
|
+
|
|
2230
|
+
/**
|
|
2231
|
+
* vue v3.5.18
|
|
2232
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
2233
|
+
* @license MIT
|
|
2234
|
+
**/
|
|
2235
|
+
|
|
2236
|
+
function initDev() {
|
|
2237
|
+
{
|
|
2238
|
+
initCustomFormatter();
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2243
|
+
initDev();
|
|
2244
|
+
}
|
|
2245
|
+
|
|
2246
|
+
/**
|
|
2247
|
+
*
|
|
2248
|
+
* @param {number} num 倒计时时间
|
|
2249
|
+
* @param {string} text 按钮文本
|
|
2250
|
+
* @returns { object } countdownText 倒计时文本 isDisabled 是否禁用 send 发送验证码方法
|
|
2251
|
+
* @description 发送验证码倒计时
|
|
2252
|
+
*/
|
|
2253
|
+
function useCountDown(num, text) {
|
|
2254
|
+
if (text === void 0) { text = '发送验证码'; }
|
|
2255
|
+
var countdownNum = ref(num);
|
|
2256
|
+
var countdownText = ref(text);
|
|
2257
|
+
var disabled = ref(false);
|
|
2258
|
+
var send = function () {
|
|
2259
|
+
countdownText.value = "".concat(countdownNum.value, "s");
|
|
2260
|
+
disabled.value = true;
|
|
2261
|
+
var timer = setInterval(function () {
|
|
2262
|
+
countdownNum.value--;
|
|
2263
|
+
countdownText.value = "".concat(countdownNum.value, "s");
|
|
2264
|
+
if (countdownNum.value === 0) {
|
|
2265
|
+
clearInterval(timer);
|
|
2266
|
+
countdownNum.value = num;
|
|
2267
|
+
countdownText.value = text;
|
|
2268
|
+
disabled.value = false;
|
|
2269
|
+
}
|
|
2270
|
+
}, 1000);
|
|
2271
|
+
};
|
|
2272
|
+
return { countdownText: countdownText, disabled: disabled, send: send };
|
|
2273
|
+
}
|
|
238
2274
|
|
|
239
2275
|
var RecordType;
|
|
240
2276
|
(function (RecordType) {
|
|
@@ -242,5 +2278,474 @@ var RecordType;
|
|
|
242
2278
|
RecordType["VIDEO"] = "video";
|
|
243
2279
|
RecordType["SCREEN"] = "screen";
|
|
244
2280
|
})(RecordType || (RecordType = {}));
|
|
2281
|
+
var LOGIN_TYPE;
|
|
2282
|
+
(function (LOGIN_TYPE) {
|
|
2283
|
+
LOGIN_TYPE["CODE"] = "CODE";
|
|
2284
|
+
LOGIN_TYPE["ACCOUNT"] = "ACCOUNT";
|
|
2285
|
+
})(LOGIN_TYPE || (LOGIN_TYPE = {}));
|
|
2286
|
+
var LENGTH_LIMIT;
|
|
2287
|
+
(function (LENGTH_LIMIT) {
|
|
2288
|
+
LENGTH_LIMIT[LENGTH_LIMIT["MIN_11"] = 11] = "MIN_11";
|
|
2289
|
+
LENGTH_LIMIT[LENGTH_LIMIT["MAX_11"] = 11] = "MAX_11";
|
|
2290
|
+
LENGTH_LIMIT[LENGTH_LIMIT["MIN_18"] = 18] = "MIN_18";
|
|
2291
|
+
LENGTH_LIMIT[LENGTH_LIMIT["MAX_18"] = 18] = "MAX_18";
|
|
2292
|
+
LENGTH_LIMIT[LENGTH_LIMIT["MIN_15"] = 15] = "MIN_15";
|
|
2293
|
+
LENGTH_LIMIT[LENGTH_LIMIT["MAX_15"] = 15] = "MAX_15";
|
|
2294
|
+
})(LENGTH_LIMIT || (LENGTH_LIMIT = {}));
|
|
2295
|
+
// 节点基础类型
|
|
2296
|
+
var HAS_FEILD;
|
|
2297
|
+
(function (HAS_FEILD) {
|
|
2298
|
+
HAS_FEILD["LABEL"] = "label";
|
|
2299
|
+
HAS_FEILD["VALUE"] = "value";
|
|
2300
|
+
HAS_FEILD["CHILDREN"] = "children";
|
|
2301
|
+
HAS_FEILD["LEAF"] = "leaf";
|
|
2302
|
+
})(HAS_FEILD || (HAS_FEILD = {}));
|
|
2303
|
+
|
|
2304
|
+
function allToString(obj, splitter) {
|
|
2305
|
+
var k;
|
|
2306
|
+
for (k in obj) {
|
|
2307
|
+
var item = obj[k];
|
|
2308
|
+
if (Array.isArray(item))
|
|
2309
|
+
obj[k] = item.join(splitter);
|
|
2310
|
+
}
|
|
2311
|
+
return obj;
|
|
2312
|
+
}
|
|
2313
|
+
/**
|
|
2314
|
+
* 对象数组转为字符串
|
|
2315
|
+
* @param {object} obj 目标对象
|
|
2316
|
+
* @param {string | string[]} keys 键名
|
|
2317
|
+
* @param {string} splitter 分隔符
|
|
2318
|
+
*/
|
|
2319
|
+
function objectArrayToString(obj, keys, splitter) {
|
|
2320
|
+
var _a;
|
|
2321
|
+
var newObj = __assign({}, obj);
|
|
2322
|
+
if (keys === '$all')
|
|
2323
|
+
return allToString(newObj, splitter);
|
|
2324
|
+
var k = typeof keys === 'string' ? [keys] : keys;
|
|
2325
|
+
for (var i = 0; i < k.length; i++) {
|
|
2326
|
+
var key = k[i];
|
|
2327
|
+
var value = (_a = newObj[key]) === null || _a === void 0 ? void 0 : _a.join(splitter);
|
|
2328
|
+
newObj[key] = value;
|
|
2329
|
+
}
|
|
2330
|
+
return newObj;
|
|
2331
|
+
}
|
|
2332
|
+
/**
|
|
2333
|
+
* 防抖
|
|
2334
|
+
* @param {Function} fn 回调函数
|
|
2335
|
+
* @param {number} delay 延迟时间
|
|
2336
|
+
*/
|
|
2337
|
+
function debounce(fn, delay) {
|
|
2338
|
+
var time = null;
|
|
2339
|
+
return function (value) {
|
|
2340
|
+
if (time !== null) {
|
|
2341
|
+
clearTimeout(time);
|
|
2342
|
+
}
|
|
2343
|
+
time = setTimeout(function () {
|
|
2344
|
+
fn === null || fn === void 0 ? void 0 : fn(value);
|
|
2345
|
+
}, delay);
|
|
2346
|
+
};
|
|
2347
|
+
}
|
|
2348
|
+
/**
|
|
2349
|
+
*
|
|
2350
|
+
* 判断是否移动端
|
|
2351
|
+
* @return {boolean}
|
|
2352
|
+
*/
|
|
2353
|
+
function isMobileDevice() {
|
|
2354
|
+
return /android|iphone|ipad|ipod|ios/i.test(navigator.userAgent);
|
|
2355
|
+
}
|
|
2356
|
+
/**
|
|
2357
|
+
* 节流
|
|
2358
|
+
* @param {Function} fn 回调函数
|
|
2359
|
+
* @param {number} delay 延迟时间
|
|
2360
|
+
*/
|
|
2361
|
+
function throttle(fn, delay) {
|
|
2362
|
+
var time = null;
|
|
2363
|
+
return function (value) {
|
|
2364
|
+
if (time !== null) {
|
|
2365
|
+
clearTimeout(time);
|
|
2366
|
+
}
|
|
2367
|
+
time = setTimeout(function () {
|
|
2368
|
+
fn === null || fn === void 0 ? void 0 : fn(value);
|
|
2369
|
+
}, delay);
|
|
2370
|
+
};
|
|
2371
|
+
}
|
|
2372
|
+
/**
|
|
2373
|
+
* 深度合并对象
|
|
2374
|
+
* @param target 目标对象
|
|
2375
|
+
* @param source 源对象
|
|
2376
|
+
*/
|
|
2377
|
+
function deepMerge(target, source) {
|
|
2378
|
+
for (var key in source) {
|
|
2379
|
+
if (source[key] instanceof Object) {
|
|
2380
|
+
target[key] = deepMerge(target[key], source[key]);
|
|
2381
|
+
}
|
|
2382
|
+
else {
|
|
2383
|
+
target[key] = source[key];
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
return target;
|
|
2387
|
+
}
|
|
2388
|
+
/**
|
|
2389
|
+
* input类型验证
|
|
2390
|
+
*/
|
|
2391
|
+
var InputLegalityValidate = /** @class */ (function () {
|
|
2392
|
+
function InputLegalityValidate() {
|
|
2393
|
+
this._phoneReg = /^1[3-9]\d{9}$/;
|
|
2394
|
+
this._mailReg = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
|
|
2395
|
+
this._idCardReg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}([\dX])$)/i;
|
|
2396
|
+
}
|
|
2397
|
+
/**
|
|
2398
|
+
* 验证手机号
|
|
2399
|
+
* @param phone 手机号
|
|
2400
|
+
*/
|
|
2401
|
+
InputLegalityValidate.prototype.phone = function (phone) {
|
|
2402
|
+
return this._phoneReg.test(phone);
|
|
2403
|
+
};
|
|
2404
|
+
/**
|
|
2405
|
+
* 验证邮箱
|
|
2406
|
+
* @param email 手机号
|
|
2407
|
+
*/
|
|
2408
|
+
InputLegalityValidate.prototype.email = function (email) {
|
|
2409
|
+
return this._mailReg.test(email);
|
|
2410
|
+
};
|
|
2411
|
+
/**
|
|
2412
|
+
* 验证身份证
|
|
2413
|
+
* @param idCard 身份证号
|
|
2414
|
+
*/
|
|
2415
|
+
InputLegalityValidate.prototype.idCard = function (idCard) {
|
|
2416
|
+
return this._idCardReg.test(idCard);
|
|
2417
|
+
};
|
|
2418
|
+
return InputLegalityValidate;
|
|
2419
|
+
}());
|
|
2420
|
+
/**
|
|
2421
|
+
* input长度验证
|
|
2422
|
+
*/
|
|
2423
|
+
var InputLengthValidate = /** @class */ (function () {
|
|
2424
|
+
function InputLengthValidate() {
|
|
2425
|
+
var _this = this;
|
|
2426
|
+
this.validators = {
|
|
2427
|
+
// 修改 validators 的 key 类型
|
|
2428
|
+
MIN_11: function (value) { return value.length >= LENGTH_LIMIT.MIN_11; },
|
|
2429
|
+
MAX_11: function (value) { return value.length <= LENGTH_LIMIT.MAX_11; },
|
|
2430
|
+
MIN_18: function (value) { return value.length >= LENGTH_LIMIT.MIN_18; },
|
|
2431
|
+
MAX_18: function (value) { return value.length <= LENGTH_LIMIT.MAX_18; },
|
|
2432
|
+
MIN_15: function (value) { return value.length >= LENGTH_LIMIT.MIN_15; },
|
|
2433
|
+
MAX_15: function (value) { return value.length <= LENGTH_LIMIT.MAX_15; },
|
|
2434
|
+
};
|
|
2435
|
+
var _loop_1 = function (key) {
|
|
2436
|
+
if (Number.isNaN(Number(key))) {
|
|
2437
|
+
var prefix = key.slice(0, 3);
|
|
2438
|
+
var num = Number.parseInt(key.slice(4), 10);
|
|
2439
|
+
var funcName = "".concat(prefix).concat(num);
|
|
2440
|
+
this_1[funcName] = function (value) { return _this.checkLength(value, key); }; // 传递 key 而不是 limit
|
|
2441
|
+
}
|
|
2442
|
+
};
|
|
2443
|
+
var this_1 = this;
|
|
2444
|
+
for (var key in LENGTH_LIMIT) {
|
|
2445
|
+
_loop_1(key);
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
InputLengthValidate.prototype.checkLength = function (value, key) {
|
|
2449
|
+
// 修改 limit 参数类型
|
|
2450
|
+
return this.validators[key](value); // 使用 key 获取 validator
|
|
2451
|
+
};
|
|
2452
|
+
InputLengthValidate.prototype.maxLength = function (value, limit) {
|
|
2453
|
+
if (value.length > limit) {
|
|
2454
|
+
return value.slice(0, limit);
|
|
2455
|
+
}
|
|
2456
|
+
return value;
|
|
2457
|
+
};
|
|
2458
|
+
// 新增方法:限制最大长度
|
|
2459
|
+
InputLengthValidate.prototype.limitLength = function (value, limit) {
|
|
2460
|
+
return this.maxLength(value, limit);
|
|
2461
|
+
};
|
|
2462
|
+
return InputLengthValidate;
|
|
2463
|
+
}());
|
|
2464
|
+
/**
|
|
2465
|
+
* 检查值是否为空
|
|
2466
|
+
* @param value 要检查的值
|
|
2467
|
+
* @return {boolean} 如果值为空返回 true,否则返回 false
|
|
2468
|
+
*/
|
|
2469
|
+
function isNull(value) {
|
|
2470
|
+
return (value === 'null'
|
|
2471
|
+
|| value === null
|
|
2472
|
+
|| value === 'undefined'
|
|
2473
|
+
|| value === undefined
|
|
2474
|
+
|| value === ''
|
|
2475
|
+
|| value === ' '
|
|
2476
|
+
|| value === '0'
|
|
2477
|
+
|| value === 0
|
|
2478
|
+
|| value === 'false'
|
|
2479
|
+
|| value === false);
|
|
2480
|
+
}
|
|
2481
|
+
var dataHandler = /** @class */ (function () {
|
|
2482
|
+
// 构造函数,接收三个参数:fields,node,mapping
|
|
2483
|
+
function dataHandler(fields, node, mapping) {
|
|
2484
|
+
// 将参数fields赋值给实例变量this.fields
|
|
2485
|
+
this.fields = fields;
|
|
2486
|
+
// 将参数node赋值给实例变量this.node
|
|
2487
|
+
this.node = node;
|
|
2488
|
+
this.mapping = mapping;
|
|
2489
|
+
}
|
|
2490
|
+
// 处理过程
|
|
2491
|
+
dataHandler.prototype.processNode = function (node) {
|
|
2492
|
+
var _this = this;
|
|
2493
|
+
Object.values(HAS_FEILD).forEach(function (field) {
|
|
2494
|
+
if (!(field in node)) {
|
|
2495
|
+
var sourceField = Object.keys(_this.mapping).find(function (key) { return _this.mapping[key] === field; });
|
|
2496
|
+
if (!sourceField) {
|
|
2497
|
+
switch (field) {
|
|
2498
|
+
case HAS_FEILD.LABEL:
|
|
2499
|
+
node[field] = node[_this.mapping.label] || '';
|
|
2500
|
+
break;
|
|
2501
|
+
case HAS_FEILD.VALUE:
|
|
2502
|
+
node[field] = node[_this.mapping.value] || '';
|
|
2503
|
+
break;
|
|
2504
|
+
case HAS_FEILD.CHILDREN:
|
|
2505
|
+
node[field] = _this.mapping.children;
|
|
2506
|
+
break;
|
|
2507
|
+
case HAS_FEILD.LEAF:
|
|
2508
|
+
node[field] = _this.mapping.leaf;
|
|
2509
|
+
break;
|
|
2510
|
+
default:
|
|
2511
|
+
node[field] = null;
|
|
2512
|
+
break;
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2516
|
+
});
|
|
2517
|
+
return node;
|
|
2518
|
+
};
|
|
2519
|
+
// 递归
|
|
2520
|
+
dataHandler.prototype.processAllNodes = function (node) {
|
|
2521
|
+
var _this = this;
|
|
2522
|
+
var processedNode = this.processNode(node);
|
|
2523
|
+
if (processedNode[this.fields.CHILDREN] && Array.isArray(processedNode[this.fields.CHILDREN])) {
|
|
2524
|
+
processedNode[this.fields.CHILDREN] = processedNode[this.fields.CHILDREN].map(function (child) {
|
|
2525
|
+
return _this.processAllNodes(child);
|
|
2526
|
+
});
|
|
2527
|
+
}
|
|
2528
|
+
return processedNode;
|
|
2529
|
+
};
|
|
2530
|
+
// getter
|
|
2531
|
+
dataHandler.prototype.getProcessedData = function () {
|
|
2532
|
+
return this.processAllNodes(this.node);
|
|
2533
|
+
};
|
|
2534
|
+
return dataHandler;
|
|
2535
|
+
}());
|
|
2536
|
+
/**
|
|
2537
|
+
* @param node 节点
|
|
2538
|
+
* @param childPath 子节点路径
|
|
2539
|
+
* @returns 构建节点路径的辅助函数
|
|
2540
|
+
*/
|
|
2541
|
+
function buildPath(node, childPath) {
|
|
2542
|
+
var path = node.deptName + (childPath ? " -> ".concat(childPath) : '');
|
|
2543
|
+
return path;
|
|
2544
|
+
}
|
|
2545
|
+
/**
|
|
2546
|
+
* @param data 树形数据
|
|
2547
|
+
* @param targetDeptCode 子节点DeptCode
|
|
2548
|
+
* @returns 查找叶子节点并返回路径
|
|
2549
|
+
*/
|
|
2550
|
+
function findTreeDataNode(data, targetDeptCode) {
|
|
2551
|
+
for (var _i = 0, data_1 = data; _i < data_1.length; _i++) {
|
|
2552
|
+
var node = data_1[_i];
|
|
2553
|
+
// 如果当前节点的 deptCode 符合目标值
|
|
2554
|
+
if (node.deptCode === targetDeptCode) {
|
|
2555
|
+
return buildPath(node);
|
|
2556
|
+
}
|
|
2557
|
+
// 递归查找子节点
|
|
2558
|
+
var childPath = findTreeDataNode(node.cldOrgDepts, targetDeptCode);
|
|
2559
|
+
if (childPath) {
|
|
2560
|
+
return buildPath(node, childPath);
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2563
|
+
return null; // 如果没有找到,返回 null
|
|
2564
|
+
}
|
|
2565
|
+
/**
|
|
2566
|
+
* @param dept 树形数据
|
|
2567
|
+
* @param queryString 子节点DeptCode
|
|
2568
|
+
* @param results 查找结果集
|
|
2569
|
+
*/
|
|
2570
|
+
function findTreeDataNodeName(dept, queryString, results) {
|
|
2571
|
+
if (dept.deptName.includes(queryString)) {
|
|
2572
|
+
results.push(dept);
|
|
2573
|
+
}
|
|
2574
|
+
// 如果有子部门,递归查找
|
|
2575
|
+
if (dept.cldOrgDepts && dept.cldOrgDepts.length > 0) {
|
|
2576
|
+
for (var _i = 0, _a = dept.cldOrgDepts; _i < _a.length; _i++) {
|
|
2577
|
+
var child = _a[_i];
|
|
2578
|
+
findTreeDataNodeName(child, queryString, results);
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
|
|
2583
|
+
var Mask = /** @class */ (function () {
|
|
2584
|
+
function Mask(selectors, opacity) {
|
|
2585
|
+
if (opacity === void 0) { opacity = 0.3; }
|
|
2586
|
+
this.task = [];
|
|
2587
|
+
this.selectors = [];
|
|
2588
|
+
this.opacity = 0.3;
|
|
2589
|
+
this.elementIndex = 0;
|
|
2590
|
+
this.selectors = selectors;
|
|
2591
|
+
this.opacity = opacity;
|
|
2592
|
+
}
|
|
2593
|
+
Mask.prototype.start = function () {
|
|
2594
|
+
var _this = this;
|
|
2595
|
+
this.task.reduce(function (pre, cur, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
2596
|
+
return __generator(this, function (_a) {
|
|
2597
|
+
switch (_a.label) {
|
|
2598
|
+
case 0: return [4 /*yield*/, pre];
|
|
2599
|
+
case 1:
|
|
2600
|
+
_a.sent();
|
|
2601
|
+
return [4 /*yield*/, new Promise(function (resolve) {
|
|
2602
|
+
cur.callback(resolve, index);
|
|
2603
|
+
})];
|
|
2604
|
+
case 2:
|
|
2605
|
+
_a.sent();
|
|
2606
|
+
this.close();
|
|
2607
|
+
return [2 /*return*/];
|
|
2608
|
+
}
|
|
2609
|
+
});
|
|
2610
|
+
}); }, Promise.resolve());
|
|
2611
|
+
};
|
|
2612
|
+
Mask.prototype.process = function (handle) {
|
|
2613
|
+
var _this = this;
|
|
2614
|
+
this.task.push({
|
|
2615
|
+
callback: function (resolve, index) {
|
|
2616
|
+
_this.elementIndex = index;
|
|
2617
|
+
_this.open();
|
|
2618
|
+
handle(resolve, index, document.querySelector(_this.selectors[index]));
|
|
2619
|
+
}
|
|
2620
|
+
});
|
|
2621
|
+
return this;
|
|
2622
|
+
};
|
|
2623
|
+
Mask.prototype.open = function (element) {
|
|
2624
|
+
if ((element === null || element === void 0 ? void 0 : element.nodeType) === Node.ELEMENT_NODE)
|
|
2625
|
+
this.selectors.push(element);
|
|
2626
|
+
var currentElement = document.querySelector(this.selectors[this.elementIndex]);
|
|
2627
|
+
if (!currentElement)
|
|
2628
|
+
return;
|
|
2629
|
+
currentElement.style.position = 'relative';
|
|
2630
|
+
currentElement.style.boxShadow = "1px 1px 0 100vw rgba(0, 0, 0, ".concat(this.opacity, ")");
|
|
2631
|
+
};
|
|
2632
|
+
Mask.prototype.close = function () {
|
|
2633
|
+
var currentElement = document.querySelector(this.selectors[this.elementIndex]);
|
|
2634
|
+
currentElement.style.removeProperty('position');
|
|
2635
|
+
currentElement.style.removeProperty('box-shadow');
|
|
2636
|
+
};
|
|
2637
|
+
return Mask;
|
|
2638
|
+
}());
|
|
2639
|
+
|
|
2640
|
+
var Tour = /** @class */ (function () {
|
|
2641
|
+
function Tour(selectors) {
|
|
2642
|
+
this.selectors = [];
|
|
2643
|
+
this.elementIndex = 0;
|
|
2644
|
+
this.tourTargetElement = null;
|
|
2645
|
+
this.tourElement = null;
|
|
2646
|
+
this.tourElementContentTemplate = "\n <style>\n .tour-content-title {\n font-size: 16px;\n font-weight: 500;\n }\n\n .tour-buttons {\n display: flex;\n justify-content: end;\n margin-top: 14px;\n }\n\n .tour-prev, .tour-next {\n padding: 4px;\n min-width: 40px;\n text-align: center;\n border: 1px solid #000;\n border-radius: 4px;\n cursor: pointer;\n }\n\n .tour-next {\n margin-left: 6px;\n }\n </style>\n <div class=\"tour-content\">\n <p class=\"tour-content-title\">\n <$title>\n </p>\n <p class=\"tour-content-text\">\n <$text>\n </p>\n </div>\n <div class=\"tour-buttons\">\n <div class=\"tour-prev\">prev</div>\n <div class=\"tour-next\"><$next></div>\n </div>\n ";
|
|
2647
|
+
this.placeholder = {
|
|
2648
|
+
title: '<$title>',
|
|
2649
|
+
text: '<$text>',
|
|
2650
|
+
next: '<$next>',
|
|
2651
|
+
};
|
|
2652
|
+
this.config = {
|
|
2653
|
+
prev: '.tour-prev',
|
|
2654
|
+
next: '.tour-next',
|
|
2655
|
+
nextText: 'next',
|
|
2656
|
+
closeText: 'close',
|
|
2657
|
+
};
|
|
2658
|
+
this.selectors = selectors;
|
|
2659
|
+
this.tourTargetElement = document.createElement('div');
|
|
2660
|
+
this.tourElement = document.createElement('div');
|
|
2661
|
+
}
|
|
2662
|
+
Tour.prototype.setPlaceholder = function (placeholder) {
|
|
2663
|
+
this.placeholder = placeholder;
|
|
2664
|
+
};
|
|
2665
|
+
Tour.prototype.setContentTemplate = function (template) {
|
|
2666
|
+
this.tourElementContentTemplate = template;
|
|
2667
|
+
};
|
|
2668
|
+
Tour.prototype.setConfig = function (config) {
|
|
2669
|
+
this.config = __assign(__assign({}, this.config), config);
|
|
2670
|
+
};
|
|
2671
|
+
Tour.prototype.start = function () {
|
|
2672
|
+
var elementName = this.selectors[this.elementIndex].el;
|
|
2673
|
+
var element = document.querySelector(elementName);
|
|
2674
|
+
if (element instanceof HTMLElement)
|
|
2675
|
+
this.layout(element);
|
|
2676
|
+
};
|
|
2677
|
+
Tour.prototype.layout = function (element) {
|
|
2678
|
+
var _this = this;
|
|
2679
|
+
var rect = element === null || element === void 0 ? void 0 : element.getBoundingClientRect();
|
|
2680
|
+
var tourTargetElement = this.tourTargetElement;
|
|
2681
|
+
var tourElement = this.tourElement;
|
|
2682
|
+
if (!tourTargetElement || !tourElement)
|
|
2683
|
+
return;
|
|
2684
|
+
tourTargetElement.style.padding = '4px';
|
|
2685
|
+
tourTargetElement.style.position = 'fixed';
|
|
2686
|
+
tourTargetElement.style.top = "".concat((rect === null || rect === void 0 ? void 0 : rect.top) - 4, "px");
|
|
2687
|
+
tourTargetElement.style.left = "".concat((rect === null || rect === void 0 ? void 0 : rect.left) - 4, "px");
|
|
2688
|
+
tourTargetElement.style.width = "".concat(rect === null || rect === void 0 ? void 0 : rect.width, "px");
|
|
2689
|
+
tourTargetElement.style.height = "".concat(rect === null || rect === void 0 ? void 0 : rect.height, "px");
|
|
2690
|
+
tourTargetElement.style.zIndex = '60';
|
|
2691
|
+
tourTargetElement.style.boxShadow = "1px 1px 0 1000vw rgba(0, 0, 0, 0.3)";
|
|
2692
|
+
document.body.appendChild(tourTargetElement);
|
|
2693
|
+
tourElement.style.padding = '16px';
|
|
2694
|
+
tourElement.style.position = 'fixed';
|
|
2695
|
+
tourElement.style.width = "200px";
|
|
2696
|
+
tourElement.style.backgroundColor = '#fff';
|
|
2697
|
+
tourElement.style.borderRadius = '4px';
|
|
2698
|
+
tourElement.style.zIndex = '62';
|
|
2699
|
+
tourElement.innerHTML = this.tourElementContentTemplate
|
|
2700
|
+
.replace(this.placeholder.title, this.selectors[this.elementIndex].title)
|
|
2701
|
+
.replace(this.placeholder.text, this.selectors[this.elementIndex].text)
|
|
2702
|
+
.replace(this.placeholder.next, this.elementIndex === this.selectors.length - 1 ? this.config.closeText : this.config.nextText);
|
|
2703
|
+
var prevButton = tourElement.querySelector(this.config.prev);
|
|
2704
|
+
var nextButton = tourElement.querySelector(this.config.next);
|
|
2705
|
+
prevButton === null || prevButton === void 0 ? void 0 : prevButton.addEventListener('click', function () {
|
|
2706
|
+
_this.elementIndex--;
|
|
2707
|
+
if (_this.elementIndex < 0)
|
|
2708
|
+
_this.elementIndex = _this.selectors.length - 1;
|
|
2709
|
+
_this.start();
|
|
2710
|
+
});
|
|
2711
|
+
nextButton === null || nextButton === void 0 ? void 0 : nextButton.addEventListener('click', function () {
|
|
2712
|
+
_this.elementIndex++;
|
|
2713
|
+
if (_this.elementIndex > _this.selectors.length - 1) {
|
|
2714
|
+
_this.elementIndex = 0;
|
|
2715
|
+
_this.close();
|
|
2716
|
+
return;
|
|
2717
|
+
}
|
|
2718
|
+
_this.start();
|
|
2719
|
+
});
|
|
2720
|
+
document.body.appendChild(tourElement);
|
|
2721
|
+
if (rect.bottom + 14 + tourElement.offsetHeight >= document.documentElement.clientHeight)
|
|
2722
|
+
tourElement.style.top = "".concat((rect === null || rect === void 0 ? void 0 : rect.top) - tourElement.offsetHeight - 14, "px");
|
|
2723
|
+
else
|
|
2724
|
+
tourElement.style.top = "".concat((rect === null || rect === void 0 ? void 0 : rect.bottom) + 14, "px");
|
|
2725
|
+
if (rect.left + tourElement.offsetWidth >= document.documentElement.clientWidth)
|
|
2726
|
+
tourElement.style.left = "".concat((rect === null || rect === void 0 ? void 0 : rect.left) - tourElement.offsetWidth - 14, "px");
|
|
2727
|
+
else
|
|
2728
|
+
tourElement.style.left = "".concat((rect === null || rect === void 0 ? void 0 : rect.left) + 14, "px");
|
|
2729
|
+
};
|
|
2730
|
+
Tour.prototype.close = function () {
|
|
2731
|
+
var tourElement = this.tourElement;
|
|
2732
|
+
document.body.removeChild(tourElement);
|
|
2733
|
+
document.body.removeChild(this.tourTargetElement);
|
|
2734
|
+
};
|
|
2735
|
+
return Tour;
|
|
2736
|
+
}());
|
|
2737
|
+
|
|
2738
|
+
/**
|
|
2739
|
+
* 匹配中文字母数字
|
|
2740
|
+
*/
|
|
2741
|
+
var ZN_LETTER_NUMBER = /^[\u4E00-\u9FA5\w]+$/;
|
|
2742
|
+
/**
|
|
2743
|
+
* 匹配 IP
|
|
2744
|
+
*/
|
|
2745
|
+
var IP = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d{1,2})$/;
|
|
2746
|
+
/**
|
|
2747
|
+
* 匹配手机号
|
|
2748
|
+
*/
|
|
2749
|
+
var PHONE = /^1[3-9]\d{9}$/;
|
|
245
2750
|
|
|
246
|
-
export { RecordType };
|
|
2751
|
+
export { HAS_FEILD, IP, InputLegalityValidate, InputLengthValidate, LENGTH_LIMIT, LOGIN_TYPE, Mask, PHONE, RecordType, Request, RequestChain, Tour, ZN_LETTER_NUMBER, dataHandler, debounce, deepMerge, findTreeDataNode, findTreeDataNodeName, isMobileDevice, isNull, objectArrayToString, throttle, useCountDown };
|