@digipair/skill-web-inputs 0.91.0-0 → 0.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.d.ts +1 -0
- package/index.cjs.js +3944 -0
- package/index.esm.js +3934 -0
- package/libs/skill-web-inputs/src/lib/input-dom-attribute.element.d.ts +11 -0
- package/libs/skill-web-inputs/src/lib/input-element.element.d.ts +17 -0
- package/libs/skill-web-inputs/src/lib/input-fetch.element.d.ts +11 -0
- package/libs/skill-web-inputs/src/lib/input-file.element.d.ts +15 -0
- package/libs/skill-web-inputs/src/lib/input-hidden.element.d.ts +6 -0
- package/libs/skill-web-inputs/src/lib/input-json.element.d.ts +15 -0
- package/libs/skill-web-inputs/src/lib/input-text.element.d.ts +15 -0
- package/libs/skill-web-inputs/src/lib/tools/css-selector.d.ts +1 -0
- package/package.json +5 -21
- package/.swcrc +0 -28
- package/README.md +0 -7
- package/eslint.config.mjs +0 -22
- package/rollup.config.cjs +0 -28
- package/src/lib/input-dom-attribute.element.ts +0 -45
- package/src/lib/input-element.element.ts +0 -189
- package/src/lib/input-fetch.element.ts +0 -38
- package/src/lib/input-file.element.ts +0 -101
- package/src/lib/input-hidden.element.ts +0 -15
- package/src/lib/input-json.element.ts +0 -101
- package/src/lib/input-text.element.ts +0 -101
- package/src/lib/skill-web-inputs.spec.ts +0 -7
- package/src/lib/tools/css-selector.ts +0 -12
- package/tsconfig.json +0 -13
- package/tsconfig.lib.json +0 -19
- /package/{src/index.d.ts → index.d.ts} +0 -0
- /package/{src/index.ts → libs/skill-web-inputs/src/index.d.ts} +0 -0
- /package/{src/lib/skill-web-inputs.ts → libs/skill-web-inputs/src/lib/skill-web-inputs.d.ts} +0 -0
- /package/{src/schema.fr.json → schema.fr.json} +0 -0
- /package/{src/schema.json → schema.json} +0 -0
package/index.cjs.js
ADDED
|
@@ -0,0 +1,3944 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
function __decorate(decorators, target, key, desc) {
|
|
6
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8
|
+
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
+
}
|
|
11
|
+
function __metadata(metadataKey, metadataValue) {
|
|
12
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
13
|
+
}
|
|
14
|
+
typeof SuppressedError === "function" ? SuppressedError : function _SuppressedError(error, suppressed, message) {
|
|
15
|
+
var e = new Error(message);
|
|
16
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @license
|
|
21
|
+
* Copyright 2019 Google LLC
|
|
22
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
+
*/ function _class_call_check$3(instance, Constructor) {
|
|
24
|
+
if (!(instance instanceof Constructor)) {
|
|
25
|
+
throw new TypeError("Cannot call a class as a function");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function _defineProperties$3(target, props) {
|
|
29
|
+
for(var i = 0; i < props.length; i++){
|
|
30
|
+
var descriptor = props[i];
|
|
31
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
32
|
+
descriptor.configurable = true;
|
|
33
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
34
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function _create_class$3(Constructor, protoProps, staticProps) {
|
|
38
|
+
if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
|
|
39
|
+
if (staticProps) _defineProperties$3(Constructor, staticProps);
|
|
40
|
+
return Constructor;
|
|
41
|
+
}
|
|
42
|
+
function _instanceof$2(left, right) {
|
|
43
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
44
|
+
return !!right[Symbol.hasInstance](left);
|
|
45
|
+
} else {
|
|
46
|
+
return left instanceof right;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
var t$2 = globalThis, e$2 = t$2.ShadowRoot && (void 0 === t$2.ShadyCSS || t$2.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$1 = Symbol(), o$3 = new WeakMap;
|
|
50
|
+
var n$3 = /*#__PURE__*/ function() {
|
|
51
|
+
function n(t, e, o) {
|
|
52
|
+
_class_call_check$3(this, n);
|
|
53
|
+
if (this._$cssResult$ = !0, o !== s$1) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
54
|
+
this.cssText = t, this.t = e;
|
|
55
|
+
}
|
|
56
|
+
_create_class$3(n, [
|
|
57
|
+
{
|
|
58
|
+
key: "styleSheet",
|
|
59
|
+
get: function get() {
|
|
60
|
+
var t = this.o;
|
|
61
|
+
var s = this.t;
|
|
62
|
+
if (e$2 && void 0 === t) {
|
|
63
|
+
var e1 = void 0 !== s && 1 === s.length;
|
|
64
|
+
e1 && (t = o$3.get(s)), void 0 === t && ((this.o = t = new CSSStyleSheet).replaceSync(this.cssText), e1 && o$3.set(s, t));
|
|
65
|
+
}
|
|
66
|
+
return t;
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
key: "toString",
|
|
71
|
+
value: function toString() {
|
|
72
|
+
return this.cssText;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
]);
|
|
76
|
+
return n;
|
|
77
|
+
}();
|
|
78
|
+
var r$5 = function(t) {
|
|
79
|
+
return new n$3("string" == typeof t ? t : t + "", void 0, s$1);
|
|
80
|
+
}, i$3 = function(t) {
|
|
81
|
+
for(var _len = arguments.length, e = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
82
|
+
e[_key - 1] = arguments[_key];
|
|
83
|
+
}
|
|
84
|
+
var o = 1 === t.length ? t[0] : e.reduce(function(e, s, o) {
|
|
85
|
+
return e + function(t) {
|
|
86
|
+
if (!0 === t._$cssResult$) return t.cssText;
|
|
87
|
+
if ("number" == typeof t) return t;
|
|
88
|
+
throw Error("Value passed to 'css' function must be a 'css' function result: " + t + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
89
|
+
}(s) + t[o + 1];
|
|
90
|
+
}, t[0]);
|
|
91
|
+
return new n$3(o, t, s$1);
|
|
92
|
+
}, S$1 = function(s, o) {
|
|
93
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
94
|
+
if (e$2) s.adoptedStyleSheets = o.map(function(t) {
|
|
95
|
+
return _instanceof$2(t, CSSStyleSheet) ? t : t.styleSheet;
|
|
96
|
+
});
|
|
97
|
+
else try {
|
|
98
|
+
for(var _iterator = o[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
99
|
+
var e1 = _step.value;
|
|
100
|
+
var _$o = document.createElement("style"), n = t$2.litNonce;
|
|
101
|
+
void 0 !== n && _$o.setAttribute("nonce", n), _$o.textContent = e1.cssText, s.appendChild(_$o);
|
|
102
|
+
}
|
|
103
|
+
} catch (err) {
|
|
104
|
+
_didIteratorError = true;
|
|
105
|
+
_iteratorError = err;
|
|
106
|
+
} finally{
|
|
107
|
+
try {
|
|
108
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
109
|
+
_iterator.return();
|
|
110
|
+
}
|
|
111
|
+
} finally{
|
|
112
|
+
if (_didIteratorError) {
|
|
113
|
+
throw _iteratorError;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}, c$2 = e$2 ? function(t) {
|
|
118
|
+
return t;
|
|
119
|
+
} : function(t) {
|
|
120
|
+
return _instanceof$2(t, CSSStyleSheet) ? function(t) {
|
|
121
|
+
var e = "";
|
|
122
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
123
|
+
try {
|
|
124
|
+
for(var _iterator = t.cssRules[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
125
|
+
var s = _step.value;
|
|
126
|
+
e += s.cssText;
|
|
127
|
+
}
|
|
128
|
+
} catch (err) {
|
|
129
|
+
_didIteratorError = true;
|
|
130
|
+
_iteratorError = err;
|
|
131
|
+
} finally{
|
|
132
|
+
try {
|
|
133
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
134
|
+
_iterator.return();
|
|
135
|
+
}
|
|
136
|
+
} finally{
|
|
137
|
+
if (_didIteratorError) {
|
|
138
|
+
throw _iteratorError;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return r$5(e);
|
|
143
|
+
}(t) : t;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
function _array_like_to_array$a(arr, len) {
|
|
147
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
148
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
149
|
+
return arr2;
|
|
150
|
+
}
|
|
151
|
+
function _array_with_holes$3(arr) {
|
|
152
|
+
if (Array.isArray(arr)) return arr;
|
|
153
|
+
}
|
|
154
|
+
function _array_without_holes$9(arr) {
|
|
155
|
+
if (Array.isArray(arr)) return _array_like_to_array$a(arr);
|
|
156
|
+
}
|
|
157
|
+
function _assert_this_initialized$2(self) {
|
|
158
|
+
if (self === void 0) {
|
|
159
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
160
|
+
}
|
|
161
|
+
return self;
|
|
162
|
+
}
|
|
163
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
164
|
+
try {
|
|
165
|
+
var info = gen[key](arg);
|
|
166
|
+
var value = info.value;
|
|
167
|
+
} catch (error) {
|
|
168
|
+
reject(error);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (info.done) {
|
|
172
|
+
resolve(value);
|
|
173
|
+
} else {
|
|
174
|
+
Promise.resolve(value).then(_next, _throw);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function _async_to_generator(fn) {
|
|
178
|
+
return function() {
|
|
179
|
+
var self = this, args = arguments;
|
|
180
|
+
return new Promise(function(resolve, reject) {
|
|
181
|
+
var gen = fn.apply(self, args);
|
|
182
|
+
function _next(value) {
|
|
183
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
184
|
+
}
|
|
185
|
+
function _throw(err) {
|
|
186
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
187
|
+
}
|
|
188
|
+
_next(undefined);
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function _class_call_check$2(instance, Constructor) {
|
|
193
|
+
if (!(instance instanceof Constructor)) {
|
|
194
|
+
throw new TypeError("Cannot call a class as a function");
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function _construct(Parent, args, Class) {
|
|
198
|
+
if (_is_native_reflect_construct$2()) {
|
|
199
|
+
_construct = Reflect.construct;
|
|
200
|
+
} else {
|
|
201
|
+
_construct = function construct(Parent, args, Class) {
|
|
202
|
+
var a = [
|
|
203
|
+
null
|
|
204
|
+
];
|
|
205
|
+
a.push.apply(a, args);
|
|
206
|
+
var Constructor = Function.bind.apply(Parent, a);
|
|
207
|
+
var instance = new Constructor();
|
|
208
|
+
if (Class) _set_prototype_of$2(instance, Class.prototype);
|
|
209
|
+
return instance;
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
return _construct.apply(null, arguments);
|
|
213
|
+
}
|
|
214
|
+
function _defineProperties$2(target, props) {
|
|
215
|
+
for(var i = 0; i < props.length; i++){
|
|
216
|
+
var descriptor = props[i];
|
|
217
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
218
|
+
descriptor.configurable = true;
|
|
219
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
220
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function _create_class$2(Constructor, protoProps, staticProps) {
|
|
224
|
+
if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
|
|
225
|
+
if (staticProps) _defineProperties$2(Constructor, staticProps);
|
|
226
|
+
return Constructor;
|
|
227
|
+
}
|
|
228
|
+
function _get_prototype_of$2(o) {
|
|
229
|
+
_get_prototype_of$2 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
230
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
231
|
+
};
|
|
232
|
+
return _get_prototype_of$2(o);
|
|
233
|
+
}
|
|
234
|
+
function _inherits$2(subClass, superClass) {
|
|
235
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
236
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
237
|
+
}
|
|
238
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
239
|
+
constructor: {
|
|
240
|
+
value: subClass,
|
|
241
|
+
writable: true,
|
|
242
|
+
configurable: true
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
if (superClass) _set_prototype_of$2(subClass, superClass);
|
|
246
|
+
}
|
|
247
|
+
function _is_native_function(fn) {
|
|
248
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
249
|
+
}
|
|
250
|
+
function _iterable_to_array$9(iter) {
|
|
251
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
252
|
+
}
|
|
253
|
+
function _iterable_to_array_limit$2(arr, i) {
|
|
254
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
255
|
+
if (_i == null) return;
|
|
256
|
+
var _arr = [];
|
|
257
|
+
var _n = true;
|
|
258
|
+
var _d = false;
|
|
259
|
+
var _s, _e;
|
|
260
|
+
try {
|
|
261
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
262
|
+
_arr.push(_s.value);
|
|
263
|
+
if (i && _arr.length === i) break;
|
|
264
|
+
}
|
|
265
|
+
} catch (err) {
|
|
266
|
+
_d = true;
|
|
267
|
+
_e = err;
|
|
268
|
+
} finally{
|
|
269
|
+
try {
|
|
270
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
271
|
+
} finally{
|
|
272
|
+
if (_d) throw _e;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return _arr;
|
|
276
|
+
}
|
|
277
|
+
function _non_iterable_rest$3() {
|
|
278
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
279
|
+
}
|
|
280
|
+
function _non_iterable_spread$9() {
|
|
281
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
282
|
+
}
|
|
283
|
+
function _possible_constructor_return$2(self, call) {
|
|
284
|
+
if (call && (_type_of$3(call) === "object" || typeof call === "function")) {
|
|
285
|
+
return call;
|
|
286
|
+
}
|
|
287
|
+
return _assert_this_initialized$2(self);
|
|
288
|
+
}
|
|
289
|
+
function _set_prototype_of$2(o, p) {
|
|
290
|
+
_set_prototype_of$2 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
291
|
+
o.__proto__ = p;
|
|
292
|
+
return o;
|
|
293
|
+
};
|
|
294
|
+
return _set_prototype_of$2(o, p);
|
|
295
|
+
}
|
|
296
|
+
function _sliced_to_array$2(arr, i) {
|
|
297
|
+
return _array_with_holes$3(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$a(arr, i) || _non_iterable_rest$3();
|
|
298
|
+
}
|
|
299
|
+
function _to_consumable_array$9(arr) {
|
|
300
|
+
return _array_without_holes$9(arr) || _iterable_to_array$9(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$9();
|
|
301
|
+
}
|
|
302
|
+
function _type_of$3(obj) {
|
|
303
|
+
"@swc/helpers - typeof";
|
|
304
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
305
|
+
}
|
|
306
|
+
function _unsupported_iterable_to_array$a(o, minLen) {
|
|
307
|
+
if (!o) return;
|
|
308
|
+
if (typeof o === "string") return _array_like_to_array$a(o, minLen);
|
|
309
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
310
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
311
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
312
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
|
|
313
|
+
}
|
|
314
|
+
function _wrap_native_super(Class) {
|
|
315
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
316
|
+
_wrap_native_super = function wrapNativeSuper(Class) {
|
|
317
|
+
if (Class === null || !_is_native_function(Class)) return Class;
|
|
318
|
+
if (typeof Class !== "function") {
|
|
319
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
320
|
+
}
|
|
321
|
+
if (typeof _cache !== "undefined") {
|
|
322
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
323
|
+
_cache.set(Class, Wrapper);
|
|
324
|
+
}
|
|
325
|
+
function Wrapper() {
|
|
326
|
+
return _construct(Class, arguments, _get_prototype_of$2(this).constructor);
|
|
327
|
+
}
|
|
328
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
329
|
+
constructor: {
|
|
330
|
+
value: Wrapper,
|
|
331
|
+
enumerable: false,
|
|
332
|
+
writable: true,
|
|
333
|
+
configurable: true
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
return _set_prototype_of$2(Wrapper, Class);
|
|
337
|
+
};
|
|
338
|
+
return _wrap_native_super(Class);
|
|
339
|
+
}
|
|
340
|
+
function _is_native_reflect_construct$2() {
|
|
341
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
342
|
+
if (Reflect.construct.sham) return false;
|
|
343
|
+
if (typeof Proxy === "function") return true;
|
|
344
|
+
try {
|
|
345
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
346
|
+
return true;
|
|
347
|
+
} catch (e) {
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
function _create_super$2(Derived) {
|
|
352
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct$2();
|
|
353
|
+
return function _createSuperInternal() {
|
|
354
|
+
var Super = _get_prototype_of$2(Derived), result;
|
|
355
|
+
if (hasNativeReflectConstruct) {
|
|
356
|
+
var NewTarget = _get_prototype_of$2(this).constructor;
|
|
357
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
358
|
+
} else {
|
|
359
|
+
result = Super.apply(this, arguments);
|
|
360
|
+
}
|
|
361
|
+
return _possible_constructor_return$2(this, result);
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
function _ts_generator$1(thisArg, body) {
|
|
365
|
+
var f, y, t, g, _ = {
|
|
366
|
+
label: 0,
|
|
367
|
+
sent: function() {
|
|
368
|
+
if (t[0] & 1) throw t[1];
|
|
369
|
+
return t[1];
|
|
370
|
+
},
|
|
371
|
+
trys: [],
|
|
372
|
+
ops: []
|
|
373
|
+
};
|
|
374
|
+
return g = {
|
|
375
|
+
next: verb(0),
|
|
376
|
+
"throw": verb(1),
|
|
377
|
+
"return": verb(2)
|
|
378
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
379
|
+
return this;
|
|
380
|
+
}), g;
|
|
381
|
+
function verb(n) {
|
|
382
|
+
return function(v) {
|
|
383
|
+
return step([
|
|
384
|
+
n,
|
|
385
|
+
v
|
|
386
|
+
]);
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
function step(op) {
|
|
390
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
391
|
+
while(_)try {
|
|
392
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
393
|
+
if (y = 0, t) op = [
|
|
394
|
+
op[0] & 2,
|
|
395
|
+
t.value
|
|
396
|
+
];
|
|
397
|
+
switch(op[0]){
|
|
398
|
+
case 0:
|
|
399
|
+
case 1:
|
|
400
|
+
t = op;
|
|
401
|
+
break;
|
|
402
|
+
case 4:
|
|
403
|
+
_.label++;
|
|
404
|
+
return {
|
|
405
|
+
value: op[1],
|
|
406
|
+
done: false
|
|
407
|
+
};
|
|
408
|
+
case 5:
|
|
409
|
+
_.label++;
|
|
410
|
+
y = op[1];
|
|
411
|
+
op = [
|
|
412
|
+
0
|
|
413
|
+
];
|
|
414
|
+
continue;
|
|
415
|
+
case 7:
|
|
416
|
+
op = _.ops.pop();
|
|
417
|
+
_.trys.pop();
|
|
418
|
+
continue;
|
|
419
|
+
default:
|
|
420
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
421
|
+
_ = 0;
|
|
422
|
+
continue;
|
|
423
|
+
}
|
|
424
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
425
|
+
_.label = op[1];
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
429
|
+
_.label = t[1];
|
|
430
|
+
t = op;
|
|
431
|
+
break;
|
|
432
|
+
}
|
|
433
|
+
if (t && _.label < t[2]) {
|
|
434
|
+
_.label = t[2];
|
|
435
|
+
_.ops.push(op);
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
438
|
+
if (t[2]) _.ops.pop();
|
|
439
|
+
_.trys.pop();
|
|
440
|
+
continue;
|
|
441
|
+
}
|
|
442
|
+
op = body.call(thisArg, _);
|
|
443
|
+
} catch (e) {
|
|
444
|
+
op = [
|
|
445
|
+
6,
|
|
446
|
+
e
|
|
447
|
+
];
|
|
448
|
+
y = 0;
|
|
449
|
+
} finally{
|
|
450
|
+
f = t = 0;
|
|
451
|
+
}
|
|
452
|
+
if (op[0] & 5) throw op[1];
|
|
453
|
+
return {
|
|
454
|
+
value: op[0] ? op[1] : void 0,
|
|
455
|
+
done: true
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
var _Symbol, _a, _a1;
|
|
460
|
+
/**
|
|
461
|
+
* @license
|
|
462
|
+
* Copyright 2017 Google LLC
|
|
463
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
464
|
+
*/ var i$2 = Object.is, e$1 = Object.defineProperty, r$4 = Object.getOwnPropertyDescriptor, h$1 = Object.getOwnPropertyNames, o$2 = Object.getOwnPropertySymbols, n$2 = Object.getPrototypeOf, a$1 = globalThis, c$1 = a$1.trustedTypes, l$1 = c$1 ? c$1.emptyScript : "", p$1 = a$1.reactiveElementPolyfillSupport, d$1 = function(t, s) {
|
|
465
|
+
return t;
|
|
466
|
+
}, u$1 = {
|
|
467
|
+
toAttribute: function toAttribute(t, s) {
|
|
468
|
+
switch(s){
|
|
469
|
+
case Boolean:
|
|
470
|
+
t = t ? l$1 : null;
|
|
471
|
+
break;
|
|
472
|
+
case Object:
|
|
473
|
+
case Array:
|
|
474
|
+
t = null == t ? t : JSON.stringify(t);
|
|
475
|
+
}
|
|
476
|
+
return t;
|
|
477
|
+
},
|
|
478
|
+
fromAttribute: function fromAttribute(t, s) {
|
|
479
|
+
var i = t;
|
|
480
|
+
switch(s){
|
|
481
|
+
case Boolean:
|
|
482
|
+
i = null !== t;
|
|
483
|
+
break;
|
|
484
|
+
case Number:
|
|
485
|
+
i = null === t ? null : Number(t);
|
|
486
|
+
break;
|
|
487
|
+
case Object:
|
|
488
|
+
case Array:
|
|
489
|
+
try {
|
|
490
|
+
i = JSON.parse(t);
|
|
491
|
+
} catch (t) {
|
|
492
|
+
i = null;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
return i;
|
|
496
|
+
}
|
|
497
|
+
}, f$1 = function(t, s) {
|
|
498
|
+
return !i$2(t, s);
|
|
499
|
+
}, y$1 = {
|
|
500
|
+
attribute: !0,
|
|
501
|
+
type: String,
|
|
502
|
+
converter: u$1,
|
|
503
|
+
reflect: !1,
|
|
504
|
+
hasChanged: f$1
|
|
505
|
+
};
|
|
506
|
+
var _metadata, _litPropertyMetadata;
|
|
507
|
+
(_metadata = (_Symbol = Symbol).metadata) !== null && _metadata !== void 0 ? _metadata : _Symbol.metadata = Symbol("metadata"), (_litPropertyMetadata = (_a = a$1).litPropertyMetadata) !== null && _litPropertyMetadata !== void 0 ? _litPropertyMetadata : _a.litPropertyMetadata = new WeakMap;
|
|
508
|
+
var b = /*#__PURE__*/ function(HTMLElement1) {
|
|
509
|
+
_inherits$2(b, HTMLElement1);
|
|
510
|
+
var _super = _create_super$2(b);
|
|
511
|
+
function b() {
|
|
512
|
+
_class_call_check$2(this, b);
|
|
513
|
+
var _this;
|
|
514
|
+
_this = _super.call(this), _this._$Ep = void 0, _this.isUpdatePending = !1, _this.hasUpdated = !1, _this._$Em = null, _this._$Ev();
|
|
515
|
+
return _possible_constructor_return$2(_this);
|
|
516
|
+
}
|
|
517
|
+
_create_class$2(b, [
|
|
518
|
+
{
|
|
519
|
+
key: "_$Ev",
|
|
520
|
+
value: function _$Ev() {
|
|
521
|
+
var _this = this;
|
|
522
|
+
var _this_constructor_l;
|
|
523
|
+
this._$ES = new Promise(function(t) {
|
|
524
|
+
return _this.enableUpdating = t;
|
|
525
|
+
}), this._$AL = new Map, this._$E_(), this.requestUpdate(), (_this_constructor_l = this.constructor.l) === null || _this_constructor_l === void 0 ? void 0 : _this_constructor_l.forEach(function(t) {
|
|
526
|
+
return t(_this);
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
key: "addController",
|
|
532
|
+
value: function addController(t) {
|
|
533
|
+
var _t_hostConnected;
|
|
534
|
+
var _this__$EO;
|
|
535
|
+
((_this__$EO = this._$EO) !== null && _this__$EO !== void 0 ? _this__$EO : this._$EO = new Set).add(t), void 0 !== this.renderRoot && this.isConnected && ((_t_hostConnected = t.hostConnected) === null || _t_hostConnected === void 0 ? void 0 : _t_hostConnected.call(t));
|
|
536
|
+
}
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
key: "removeController",
|
|
540
|
+
value: function removeController(t) {
|
|
541
|
+
var _this__$EO;
|
|
542
|
+
(_this__$EO = this._$EO) === null || _this__$EO === void 0 ? void 0 : _this__$EO.delete(t);
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
key: "_$E_",
|
|
547
|
+
value: function _$E_() {
|
|
548
|
+
var t = new Map, s = this.constructor.elementProperties;
|
|
549
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
550
|
+
try {
|
|
551
|
+
for(var _iterator = s.keys()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
552
|
+
var i = _step.value;
|
|
553
|
+
this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]);
|
|
554
|
+
}
|
|
555
|
+
} catch (err) {
|
|
556
|
+
_didIteratorError = true;
|
|
557
|
+
_iteratorError = err;
|
|
558
|
+
} finally{
|
|
559
|
+
try {
|
|
560
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
561
|
+
_iterator.return();
|
|
562
|
+
}
|
|
563
|
+
} finally{
|
|
564
|
+
if (_didIteratorError) {
|
|
565
|
+
throw _iteratorError;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
t.size > 0 && (this._$Ep = t);
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
key: "createRenderRoot",
|
|
574
|
+
value: function createRenderRoot() {
|
|
575
|
+
var _this_shadowRoot;
|
|
576
|
+
var t = (_this_shadowRoot = this.shadowRoot) !== null && _this_shadowRoot !== void 0 ? _this_shadowRoot : this.attachShadow(this.constructor.shadowRootOptions);
|
|
577
|
+
return S$1(t, this.constructor.elementStyles), t;
|
|
578
|
+
}
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
key: "connectedCallback",
|
|
582
|
+
value: function connectedCallback() {
|
|
583
|
+
var _this__$EO;
|
|
584
|
+
var _this_renderRoot;
|
|
585
|
+
(_this_renderRoot = this.renderRoot) !== null && _this_renderRoot !== void 0 ? _this_renderRoot : this.renderRoot = this.createRenderRoot(), this.enableUpdating(!0), (_this__$EO = this._$EO) === null || _this__$EO === void 0 ? void 0 : _this__$EO.forEach(function(t) {
|
|
586
|
+
var _t_hostConnected;
|
|
587
|
+
return (_t_hostConnected = t.hostConnected) === null || _t_hostConnected === void 0 ? void 0 : _t_hostConnected.call(t);
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
key: "enableUpdating",
|
|
593
|
+
value: function enableUpdating(t) {}
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
key: "disconnectedCallback",
|
|
597
|
+
value: function disconnectedCallback() {
|
|
598
|
+
var _this__$EO;
|
|
599
|
+
(_this__$EO = this._$EO) === null || _this__$EO === void 0 ? void 0 : _this__$EO.forEach(function(t) {
|
|
600
|
+
var _t_hostDisconnected;
|
|
601
|
+
return (_t_hostDisconnected = t.hostDisconnected) === null || _t_hostDisconnected === void 0 ? void 0 : _t_hostDisconnected.call(t);
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
key: "attributeChangedCallback",
|
|
607
|
+
value: function attributeChangedCallback(t, s, i) {
|
|
608
|
+
this._$AK(t, i);
|
|
609
|
+
}
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
key: "_$EC",
|
|
613
|
+
value: function _$EC(t, s) {
|
|
614
|
+
var i = this.constructor.elementProperties.get(t), e = this.constructor._$Eu(t, i);
|
|
615
|
+
if (void 0 !== e && !0 === i.reflect) {
|
|
616
|
+
var _i_converter;
|
|
617
|
+
var r = (void 0 !== ((_i_converter = i.converter) === null || _i_converter === void 0 ? void 0 : _i_converter.toAttribute) ? i.converter : u$1).toAttribute(s, i.type);
|
|
618
|
+
this._$Em = t, null == r ? this.removeAttribute(e) : this.setAttribute(e, r), this._$Em = null;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
key: "_$AK",
|
|
624
|
+
value: function _$AK(t, s) {
|
|
625
|
+
var i = this.constructor, e = i._$Eh.get(t);
|
|
626
|
+
if (void 0 !== e && this._$Em !== e) {
|
|
627
|
+
var _t_converter;
|
|
628
|
+
var _$t = i.getPropertyOptions(e), r = "function" == typeof _$t.converter ? {
|
|
629
|
+
fromAttribute: _$t.converter
|
|
630
|
+
} : void 0 !== ((_t_converter = _$t.converter) === null || _t_converter === void 0 ? void 0 : _t_converter.fromAttribute) ? _$t.converter : u$1;
|
|
631
|
+
this._$Em = e, this[e] = r.fromAttribute(s, _$t.type), this._$Em = null;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
key: "requestUpdate",
|
|
637
|
+
value: function requestUpdate(t, s, i) {
|
|
638
|
+
if (void 0 !== t) {
|
|
639
|
+
var _i_hasChanged;
|
|
640
|
+
if (i !== null && i !== void 0 ? i : i = this.constructor.getPropertyOptions(t), !((_i_hasChanged = i.hasChanged) !== null && _i_hasChanged !== void 0 ? _i_hasChanged : f$1)(this[t], s)) return;
|
|
641
|
+
this.P(t, s, i);
|
|
642
|
+
}
|
|
643
|
+
!1 === this.isUpdatePending && (this._$ES = this._$ET());
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
key: "P",
|
|
648
|
+
value: function P(t, s, i) {
|
|
649
|
+
var _this__$Ej;
|
|
650
|
+
this._$AL.has(t) || this._$AL.set(t, s), !0 === i.reflect && this._$Em !== t && ((_this__$Ej = this._$Ej) !== null && _this__$Ej !== void 0 ? _this__$Ej : this._$Ej = new Set).add(t);
|
|
651
|
+
}
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
key: "_$ET",
|
|
655
|
+
value: function _$ET() {
|
|
656
|
+
var _this = this;
|
|
657
|
+
return _async_to_generator(function() {
|
|
658
|
+
var t, _$t, _tmp;
|
|
659
|
+
return _ts_generator$1(this, function(_state) {
|
|
660
|
+
switch(_state.label){
|
|
661
|
+
case 0:
|
|
662
|
+
_this.isUpdatePending = !0;
|
|
663
|
+
_state.label = 1;
|
|
664
|
+
case 1:
|
|
665
|
+
_state.trys.push([
|
|
666
|
+
1,
|
|
667
|
+
3,
|
|
668
|
+
,
|
|
669
|
+
4
|
|
670
|
+
]);
|
|
671
|
+
return [
|
|
672
|
+
4,
|
|
673
|
+
_this._$ES
|
|
674
|
+
];
|
|
675
|
+
case 2:
|
|
676
|
+
_state.sent();
|
|
677
|
+
return [
|
|
678
|
+
3,
|
|
679
|
+
4
|
|
680
|
+
];
|
|
681
|
+
case 3:
|
|
682
|
+
t = _state.sent();
|
|
683
|
+
Promise.reject(t);
|
|
684
|
+
return [
|
|
685
|
+
3,
|
|
686
|
+
4
|
|
687
|
+
];
|
|
688
|
+
case 4:
|
|
689
|
+
_$t = _this.scheduleUpdate();
|
|
690
|
+
_tmp = null != _$t;
|
|
691
|
+
if (!_tmp) return [
|
|
692
|
+
3,
|
|
693
|
+
6
|
|
694
|
+
];
|
|
695
|
+
return [
|
|
696
|
+
4,
|
|
697
|
+
_$t
|
|
698
|
+
];
|
|
699
|
+
case 5:
|
|
700
|
+
_tmp = _state.sent();
|
|
701
|
+
_state.label = 6;
|
|
702
|
+
case 6:
|
|
703
|
+
return [
|
|
704
|
+
2,
|
|
705
|
+
(!_this.isUpdatePending)
|
|
706
|
+
];
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
})();
|
|
710
|
+
}
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
key: "scheduleUpdate",
|
|
714
|
+
value: function scheduleUpdate() {
|
|
715
|
+
return this.performUpdate();
|
|
716
|
+
}
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
key: "performUpdate",
|
|
720
|
+
value: function performUpdate() {
|
|
721
|
+
if (!this.isUpdatePending) return;
|
|
722
|
+
if (!this.hasUpdated) {
|
|
723
|
+
var _this_renderRoot;
|
|
724
|
+
if ((_this_renderRoot = this.renderRoot) !== null && _this_renderRoot !== void 0 ? _this_renderRoot : this.renderRoot = this.createRenderRoot(), this._$Ep) {
|
|
725
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
726
|
+
try {
|
|
727
|
+
for(var _iterator = this._$Ep[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
728
|
+
var _step_value = _sliced_to_array$2(_step.value, 2), t = _step_value[0], _$s = _step_value[1];
|
|
729
|
+
this[t] = _$s;
|
|
730
|
+
}
|
|
731
|
+
} catch (err) {
|
|
732
|
+
_didIteratorError = true;
|
|
733
|
+
_iteratorError = err;
|
|
734
|
+
} finally{
|
|
735
|
+
try {
|
|
736
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
737
|
+
_iterator.return();
|
|
738
|
+
}
|
|
739
|
+
} finally{
|
|
740
|
+
if (_didIteratorError) {
|
|
741
|
+
throw _iteratorError;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
this._$Ep = void 0;
|
|
746
|
+
}
|
|
747
|
+
var t1 = this.constructor.elementProperties;
|
|
748
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
749
|
+
if (t1.size > 0) try {
|
|
750
|
+
for(var _iterator1 = t1[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
751
|
+
var _step_value1 = _sliced_to_array$2(_step1.value, 2), _$s1 = _step_value1[0], i = _step_value1[1];
|
|
752
|
+
!0 !== i.wrapped || this._$AL.has(_$s1) || void 0 === this[_$s1] || this.P(_$s1, this[_$s1], i);
|
|
753
|
+
}
|
|
754
|
+
} catch (err) {
|
|
755
|
+
_didIteratorError1 = true;
|
|
756
|
+
_iteratorError1 = err;
|
|
757
|
+
} finally{
|
|
758
|
+
try {
|
|
759
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
760
|
+
_iterator1.return();
|
|
761
|
+
}
|
|
762
|
+
} finally{
|
|
763
|
+
if (_didIteratorError1) {
|
|
764
|
+
throw _iteratorError1;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
var t2 = !1;
|
|
770
|
+
var _$s2 = this._$AL;
|
|
771
|
+
try {
|
|
772
|
+
var _this__$EO;
|
|
773
|
+
t2 = this.shouldUpdate(_$s2), t2 ? (this.willUpdate(_$s2), (_this__$EO = this._$EO) === null || _this__$EO === void 0 ? void 0 : _this__$EO.forEach(function(t) {
|
|
774
|
+
var _t_hostUpdate;
|
|
775
|
+
return (_t_hostUpdate = t.hostUpdate) === null || _t_hostUpdate === void 0 ? void 0 : _t_hostUpdate.call(t);
|
|
776
|
+
}), this.update(_$s2)) : this._$EU();
|
|
777
|
+
} catch (s) {
|
|
778
|
+
throw t2 = !1, this._$EU(), s;
|
|
779
|
+
}
|
|
780
|
+
t2 && this._$AE(_$s2);
|
|
781
|
+
}
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
key: "willUpdate",
|
|
785
|
+
value: function willUpdate(t) {}
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
key: "_$AE",
|
|
789
|
+
value: function _$AE(t) {
|
|
790
|
+
var _this__$EO;
|
|
791
|
+
(_this__$EO = this._$EO) === null || _this__$EO === void 0 ? void 0 : _this__$EO.forEach(function(t) {
|
|
792
|
+
var _t_hostUpdated;
|
|
793
|
+
return (_t_hostUpdated = t.hostUpdated) === null || _t_hostUpdated === void 0 ? void 0 : _t_hostUpdated.call(t);
|
|
794
|
+
}), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
|
|
795
|
+
}
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
key: "_$EU",
|
|
799
|
+
value: function _$EU() {
|
|
800
|
+
this._$AL = new Map, this.isUpdatePending = !1;
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
key: "updateComplete",
|
|
805
|
+
get: function get() {
|
|
806
|
+
return this.getUpdateComplete();
|
|
807
|
+
}
|
|
808
|
+
},
|
|
809
|
+
{
|
|
810
|
+
key: "getUpdateComplete",
|
|
811
|
+
value: function getUpdateComplete() {
|
|
812
|
+
return this._$ES;
|
|
813
|
+
}
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
key: "shouldUpdate",
|
|
817
|
+
value: function shouldUpdate(t) {
|
|
818
|
+
return !0;
|
|
819
|
+
}
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
key: "update",
|
|
823
|
+
value: function update(t) {
|
|
824
|
+
var _this = this;
|
|
825
|
+
this._$Ej && (this._$Ej = this._$Ej.forEach(function(t) {
|
|
826
|
+
return _this._$EC(t, _this[t]);
|
|
827
|
+
})), this._$EU();
|
|
828
|
+
}
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
key: "updated",
|
|
832
|
+
value: function updated(t) {}
|
|
833
|
+
},
|
|
834
|
+
{
|
|
835
|
+
key: "firstUpdated",
|
|
836
|
+
value: function firstUpdated(t) {}
|
|
837
|
+
}
|
|
838
|
+
], [
|
|
839
|
+
{
|
|
840
|
+
key: "addInitializer",
|
|
841
|
+
value: function addInitializer(t) {
|
|
842
|
+
var _this_l;
|
|
843
|
+
this._$Ei(), ((_this_l = this.l) !== null && _this_l !== void 0 ? _this_l : this.l = []).push(t);
|
|
844
|
+
}
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
key: "observedAttributes",
|
|
848
|
+
get: function get() {
|
|
849
|
+
return this.finalize(), this._$Eh && _to_consumable_array$9(this._$Eh.keys());
|
|
850
|
+
}
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
key: "createProperty",
|
|
854
|
+
value: function createProperty(t) {
|
|
855
|
+
var s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : y$1;
|
|
856
|
+
if (s.state && (s.attribute = !1), this._$Ei(), this.elementProperties.set(t, s), !s.noAccessor) {
|
|
857
|
+
var i = Symbol(), r = this.getPropertyDescriptor(t, i, s);
|
|
858
|
+
void 0 !== r && e$1(this.prototype, t, r);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
key: "getPropertyDescriptor",
|
|
864
|
+
value: function getPropertyDescriptor(t, s, i) {
|
|
865
|
+
var _r;
|
|
866
|
+
var _ref = (_r = r$4(this.prototype, t)) !== null && _r !== void 0 ? _r : {
|
|
867
|
+
get: function get() {
|
|
868
|
+
return this[s];
|
|
869
|
+
},
|
|
870
|
+
set: function set(t) {
|
|
871
|
+
this[s] = t;
|
|
872
|
+
}
|
|
873
|
+
}, e = _ref.get, h = _ref.set;
|
|
874
|
+
return {
|
|
875
|
+
get: function get() {
|
|
876
|
+
return e === null || e === void 0 ? void 0 : e.call(this);
|
|
877
|
+
},
|
|
878
|
+
set: function set(s) {
|
|
879
|
+
var r = e === null || e === void 0 ? void 0 : e.call(this);
|
|
880
|
+
h.call(this, s), this.requestUpdate(t, r, i);
|
|
881
|
+
},
|
|
882
|
+
configurable: !0,
|
|
883
|
+
enumerable: !0
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
key: "getPropertyOptions",
|
|
889
|
+
value: function getPropertyOptions(t) {
|
|
890
|
+
var _this_elementProperties_get;
|
|
891
|
+
return (_this_elementProperties_get = this.elementProperties.get(t)) !== null && _this_elementProperties_get !== void 0 ? _this_elementProperties_get : y$1;
|
|
892
|
+
}
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
key: "_$Ei",
|
|
896
|
+
value: function _$Ei() {
|
|
897
|
+
if (this.hasOwnProperty(d$1("elementProperties"))) return;
|
|
898
|
+
var t = n$2(this);
|
|
899
|
+
t.finalize(), void 0 !== t.l && (this.l = _to_consumable_array$9(t.l)), this.elementProperties = new Map(t.elementProperties);
|
|
900
|
+
}
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
key: "finalize",
|
|
904
|
+
value: function finalize() {
|
|
905
|
+
if (this.hasOwnProperty(d$1("finalized"))) return;
|
|
906
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(d$1("properties"))) {
|
|
907
|
+
var t = this.properties, s = _to_consumable_array$9(h$1(t)).concat(_to_consumable_array$9(o$2(t)));
|
|
908
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
909
|
+
try {
|
|
910
|
+
for(var _iterator = s[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
911
|
+
var i = _step.value;
|
|
912
|
+
this.createProperty(i, t[i]);
|
|
913
|
+
}
|
|
914
|
+
} catch (err) {
|
|
915
|
+
_didIteratorError = true;
|
|
916
|
+
_iteratorError = err;
|
|
917
|
+
} finally{
|
|
918
|
+
try {
|
|
919
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
920
|
+
_iterator.return();
|
|
921
|
+
}
|
|
922
|
+
} finally{
|
|
923
|
+
if (_didIteratorError) {
|
|
924
|
+
throw _iteratorError;
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
var t1 = this[Symbol.metadata];
|
|
930
|
+
if (null !== t1) {
|
|
931
|
+
var s1 = litPropertyMetadata.get(t1);
|
|
932
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
933
|
+
if (void 0 !== s1) try {
|
|
934
|
+
for(var _iterator1 = s1[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
935
|
+
var _step_value = _sliced_to_array$2(_step1.value, 2), t2 = _step_value[0], i1 = _step_value[1];
|
|
936
|
+
this.elementProperties.set(t2, i1);
|
|
937
|
+
}
|
|
938
|
+
} catch (err) {
|
|
939
|
+
_didIteratorError1 = true;
|
|
940
|
+
_iteratorError1 = err;
|
|
941
|
+
} finally{
|
|
942
|
+
try {
|
|
943
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
944
|
+
_iterator1.return();
|
|
945
|
+
}
|
|
946
|
+
} finally{
|
|
947
|
+
if (_didIteratorError1) {
|
|
948
|
+
throw _iteratorError1;
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
this._$Eh = new Map;
|
|
954
|
+
var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
|
|
955
|
+
try {
|
|
956
|
+
for(var _iterator2 = this.elementProperties[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
|
|
957
|
+
var _step_value1 = _sliced_to_array$2(_step2.value, 2), t3 = _step_value1[0], s2 = _step_value1[1];
|
|
958
|
+
var i2 = this._$Eu(t3, s2);
|
|
959
|
+
void 0 !== i2 && this._$Eh.set(i2, t3);
|
|
960
|
+
}
|
|
961
|
+
} catch (err) {
|
|
962
|
+
_didIteratorError2 = true;
|
|
963
|
+
_iteratorError2 = err;
|
|
964
|
+
} finally{
|
|
965
|
+
try {
|
|
966
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
967
|
+
_iterator2.return();
|
|
968
|
+
}
|
|
969
|
+
} finally{
|
|
970
|
+
if (_didIteratorError2) {
|
|
971
|
+
throw _iteratorError2;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
this.elementStyles = this.finalizeStyles(this.styles);
|
|
976
|
+
}
|
|
977
|
+
},
|
|
978
|
+
{
|
|
979
|
+
key: "finalizeStyles",
|
|
980
|
+
value: function finalizeStyles(s) {
|
|
981
|
+
var i = [];
|
|
982
|
+
if (Array.isArray(s)) {
|
|
983
|
+
var e = new Set(s.flat(1 / 0).reverse());
|
|
984
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
985
|
+
try {
|
|
986
|
+
for(var _iterator = e[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
987
|
+
var _$s = _step.value;
|
|
988
|
+
i.unshift(c$2(_$s));
|
|
989
|
+
}
|
|
990
|
+
} catch (err) {
|
|
991
|
+
_didIteratorError = true;
|
|
992
|
+
_iteratorError = err;
|
|
993
|
+
} finally{
|
|
994
|
+
try {
|
|
995
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
996
|
+
_iterator.return();
|
|
997
|
+
}
|
|
998
|
+
} finally{
|
|
999
|
+
if (_didIteratorError) {
|
|
1000
|
+
throw _iteratorError;
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
} else void 0 !== s && i.push(c$2(s));
|
|
1005
|
+
return i;
|
|
1006
|
+
}
|
|
1007
|
+
},
|
|
1008
|
+
{
|
|
1009
|
+
key: "_$Eu",
|
|
1010
|
+
value: function _$Eu(t, s) {
|
|
1011
|
+
var i = s.attribute;
|
|
1012
|
+
return !1 === i ? void 0 : "string" == typeof i ? i : "string" == typeof t ? t.toLowerCase() : void 0;
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
]);
|
|
1016
|
+
return b;
|
|
1017
|
+
}(_wrap_native_super(HTMLElement));
|
|
1018
|
+
var _reactiveElementVersions;
|
|
1019
|
+
b.elementStyles = [], b.shadowRootOptions = {
|
|
1020
|
+
mode: "open"
|
|
1021
|
+
}, b[d$1("elementProperties")] = new Map, b[d$1("finalized")] = new Map, p$1 === null || p$1 === void 0 ? void 0 : p$1({
|
|
1022
|
+
ReactiveElement: b
|
|
1023
|
+
}), ((_reactiveElementVersions = (_a1 = a$1).reactiveElementVersions) !== null && _reactiveElementVersions !== void 0 ? _reactiveElementVersions : _a1.reactiveElementVersions = []).push("2.0.4");
|
|
1024
|
+
|
|
1025
|
+
/**
|
|
1026
|
+
* @license
|
|
1027
|
+
* Copyright 2017 Google LLC
|
|
1028
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1029
|
+
*/ function _array_like_to_array$9(arr, len) {
|
|
1030
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
1031
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
1032
|
+
return arr2;
|
|
1033
|
+
}
|
|
1034
|
+
function _array_with_holes$2(arr) {
|
|
1035
|
+
if (Array.isArray(arr)) return arr;
|
|
1036
|
+
}
|
|
1037
|
+
function _array_without_holes$8(arr) {
|
|
1038
|
+
if (Array.isArray(arr)) return _array_like_to_array$9(arr);
|
|
1039
|
+
}
|
|
1040
|
+
function _assert_this_initialized$1(self) {
|
|
1041
|
+
if (self === void 0) {
|
|
1042
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1043
|
+
}
|
|
1044
|
+
return self;
|
|
1045
|
+
}
|
|
1046
|
+
function _class_call_check$1(instance, Constructor) {
|
|
1047
|
+
if (!(instance instanceof Constructor)) {
|
|
1048
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
function _defineProperties$1(target, props) {
|
|
1052
|
+
for(var i = 0; i < props.length; i++){
|
|
1053
|
+
var descriptor = props[i];
|
|
1054
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1055
|
+
descriptor.configurable = true;
|
|
1056
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1057
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
function _create_class$1(Constructor, protoProps, staticProps) {
|
|
1061
|
+
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
|
1062
|
+
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
|
1063
|
+
return Constructor;
|
|
1064
|
+
}
|
|
1065
|
+
function _get_prototype_of$1(o) {
|
|
1066
|
+
_get_prototype_of$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
1067
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
1068
|
+
};
|
|
1069
|
+
return _get_prototype_of$1(o);
|
|
1070
|
+
}
|
|
1071
|
+
function _inherits$1(subClass, superClass) {
|
|
1072
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
1073
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
1074
|
+
}
|
|
1075
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
1076
|
+
constructor: {
|
|
1077
|
+
value: subClass,
|
|
1078
|
+
writable: true,
|
|
1079
|
+
configurable: true
|
|
1080
|
+
}
|
|
1081
|
+
});
|
|
1082
|
+
if (superClass) _set_prototype_of$1(subClass, superClass);
|
|
1083
|
+
}
|
|
1084
|
+
function _iterable_to_array$8(iter) {
|
|
1085
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
1086
|
+
}
|
|
1087
|
+
function _iterable_to_array_limit$1(arr, i) {
|
|
1088
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1089
|
+
if (_i == null) return;
|
|
1090
|
+
var _arr = [];
|
|
1091
|
+
var _n = true;
|
|
1092
|
+
var _d = false;
|
|
1093
|
+
var _s, _e;
|
|
1094
|
+
try {
|
|
1095
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
1096
|
+
_arr.push(_s.value);
|
|
1097
|
+
if (i && _arr.length === i) break;
|
|
1098
|
+
}
|
|
1099
|
+
} catch (err) {
|
|
1100
|
+
_d = true;
|
|
1101
|
+
_e = err;
|
|
1102
|
+
} finally{
|
|
1103
|
+
try {
|
|
1104
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
1105
|
+
} finally{
|
|
1106
|
+
if (_d) throw _e;
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
return _arr;
|
|
1110
|
+
}
|
|
1111
|
+
function _non_iterable_rest$2() {
|
|
1112
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1113
|
+
}
|
|
1114
|
+
function _non_iterable_spread$8() {
|
|
1115
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1116
|
+
}
|
|
1117
|
+
function _possible_constructor_return$1(self, call) {
|
|
1118
|
+
if (call && (_type_of$2(call) === "object" || typeof call === "function")) {
|
|
1119
|
+
return call;
|
|
1120
|
+
}
|
|
1121
|
+
return _assert_this_initialized$1(self);
|
|
1122
|
+
}
|
|
1123
|
+
function _set_prototype_of$1(o, p) {
|
|
1124
|
+
_set_prototype_of$1 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
1125
|
+
o.__proto__ = p;
|
|
1126
|
+
return o;
|
|
1127
|
+
};
|
|
1128
|
+
return _set_prototype_of$1(o, p);
|
|
1129
|
+
}
|
|
1130
|
+
function _sliced_to_array$1(arr, i) {
|
|
1131
|
+
return _array_with_holes$2(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$9(arr, i) || _non_iterable_rest$2();
|
|
1132
|
+
}
|
|
1133
|
+
function _to_consumable_array$8(arr) {
|
|
1134
|
+
return _array_without_holes$8(arr) || _iterable_to_array$8(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$8();
|
|
1135
|
+
}
|
|
1136
|
+
function _type_of$2(obj) {
|
|
1137
|
+
"@swc/helpers - typeof";
|
|
1138
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
1139
|
+
}
|
|
1140
|
+
function _unsupported_iterable_to_array$9(o, minLen) {
|
|
1141
|
+
if (!o) return;
|
|
1142
|
+
if (typeof o === "string") return _array_like_to_array$9(o, minLen);
|
|
1143
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1144
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1145
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
1146
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
|
|
1147
|
+
}
|
|
1148
|
+
function _is_native_reflect_construct$1() {
|
|
1149
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
1150
|
+
if (Reflect.construct.sham) return false;
|
|
1151
|
+
if (typeof Proxy === "function") return true;
|
|
1152
|
+
try {
|
|
1153
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
1154
|
+
return true;
|
|
1155
|
+
} catch (e) {
|
|
1156
|
+
return false;
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
function _create_super$1(Derived) {
|
|
1160
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct$1();
|
|
1161
|
+
return function _createSuperInternal() {
|
|
1162
|
+
var Super = _get_prototype_of$1(Derived), result;
|
|
1163
|
+
if (hasNativeReflectConstruct) {
|
|
1164
|
+
var NewTarget = _get_prototype_of$1(this).constructor;
|
|
1165
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
1166
|
+
} else {
|
|
1167
|
+
result = Super.apply(this, arguments);
|
|
1168
|
+
}
|
|
1169
|
+
return _possible_constructor_return$1(this, result);
|
|
1170
|
+
};
|
|
1171
|
+
}
|
|
1172
|
+
var _t;
|
|
1173
|
+
var t$1 = globalThis, i$1 = t$1.trustedTypes, s = i$1 ? i$1.createPolicy("lit-html", {
|
|
1174
|
+
createHTML: function(t) {
|
|
1175
|
+
return t;
|
|
1176
|
+
}
|
|
1177
|
+
}) : void 0, e = "$lit$", h = "lit$".concat(Math.random().toFixed(9).slice(2), "$"), o$1 = "?" + h, n$1 = "<".concat(o$1, ">"), r$3 = document, l = function() {
|
|
1178
|
+
return r$3.createComment("");
|
|
1179
|
+
}, c = function(t) {
|
|
1180
|
+
return null === t || "object" != typeof t && "function" != typeof t;
|
|
1181
|
+
}, a = Array.isArray, u = function(t) {
|
|
1182
|
+
return a(t) || "function" == typeof (t === null || t === void 0 ? void 0 : t[Symbol.iterator]);
|
|
1183
|
+
}, d = "[ \n\f\r]", f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v = /-->/g, _ = />/g, m = RegExp(">|".concat(d, "(?:([^\\s\"'>=/]+)(").concat(d, "*=").concat(d, "*(?:[^ \n\f\r\"'`<>=]|(\"|')|))|$)"), "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y = function(t) {
|
|
1184
|
+
return function(i) {
|
|
1185
|
+
for(var _len = arguments.length, s = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
1186
|
+
s[_key - 1] = arguments[_key];
|
|
1187
|
+
}
|
|
1188
|
+
return {
|
|
1189
|
+
_$litType$: t,
|
|
1190
|
+
strings: i,
|
|
1191
|
+
values: s
|
|
1192
|
+
};
|
|
1193
|
+
};
|
|
1194
|
+
}, x = y(1), T = Symbol.for("lit-noChange"), E = Symbol.for("lit-nothing"), A = new WeakMap, C = r$3.createTreeWalker(r$3, 129);
|
|
1195
|
+
function P(t, i) {
|
|
1196
|
+
if (!a(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
1197
|
+
return void 0 !== s ? s.createHTML(i) : i;
|
|
1198
|
+
}
|
|
1199
|
+
var V = function(t, i) {
|
|
1200
|
+
var s = t.length - 1, o = [];
|
|
1201
|
+
var r, l = 2 === i ? "<svg>" : 3 === i ? "<math>" : "", c = f;
|
|
1202
|
+
for(var _$i = 0; _$i < s; _$i++){
|
|
1203
|
+
var s1 = t[_$i];
|
|
1204
|
+
var a = void 0, u = void 0, d = -1, y = 0;
|
|
1205
|
+
for(; y < s1.length && (c.lastIndex = y, u = c.exec(s1), null !== u);)y = c.lastIndex, c === f ? "!--" === u[1] ? c = v : void 0 !== u[1] ? c = _ : void 0 !== u[2] ? ($.test(u[2]) && (r = RegExp("</" + u[2], "g")), c = m) : void 0 !== u[3] && (c = m) : c === m ? ">" === u[0] ? (c = r !== null && r !== void 0 ? r : f, d = -1) : void 0 === u[1] ? d = -2 : (d = c.lastIndex - u[2].length, a = u[1], c = void 0 === u[3] ? m : '"' === u[3] ? g : p) : c === g || c === p ? c = m : c === v || c === _ ? c = f : (c = m, r = void 0);
|
|
1206
|
+
var x = c === m && t[_$i + 1].startsWith("/>") ? " " : "";
|
|
1207
|
+
l += c === f ? s1 + n$1 : d >= 0 ? (o.push(a), s1.slice(0, d) + e + s1.slice(d) + h + x) : s1 + h + (-2 === d ? _$i : x);
|
|
1208
|
+
}
|
|
1209
|
+
return [
|
|
1210
|
+
P(t, l + (t[s] || "<?>") + (2 === i ? "</svg>" : 3 === i ? "</math>" : "")),
|
|
1211
|
+
o
|
|
1212
|
+
];
|
|
1213
|
+
};
|
|
1214
|
+
var N = /*#__PURE__*/ function() {
|
|
1215
|
+
function N(param, n) {
|
|
1216
|
+
var t = param.strings, s = param._$litType$;
|
|
1217
|
+
_class_call_check$1(this, N);
|
|
1218
|
+
var r;
|
|
1219
|
+
this.parts = [];
|
|
1220
|
+
var c = 0, a = 0;
|
|
1221
|
+
var u = t.length - 1, d = this.parts, _V = _sliced_to_array$1(V(t, s), 2), f = _V[0], v = _V[1];
|
|
1222
|
+
if (this.el = N.createElement(f, n), C.currentNode = this.el.content, 2 === s || 3 === s) {
|
|
1223
|
+
var _t;
|
|
1224
|
+
var t1 = this.el.content.firstChild;
|
|
1225
|
+
(_t = t1).replaceWith.apply(_t, _to_consumable_array$8(t1.childNodes));
|
|
1226
|
+
}
|
|
1227
|
+
for(; null !== (r = C.nextNode()) && d.length < u;){
|
|
1228
|
+
if (1 === r.nodeType) {
|
|
1229
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1230
|
+
if (r.hasAttributes()) try {
|
|
1231
|
+
for(var _iterator = r.getAttributeNames()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1232
|
+
var t2 = _step.value;
|
|
1233
|
+
if (t2.endsWith(e)) {
|
|
1234
|
+
var i1 = v[a++], s1 = r.getAttribute(t2).split(h), e1 = /([.?@])?(.*)/.exec(i1);
|
|
1235
|
+
d.push({
|
|
1236
|
+
type: 1,
|
|
1237
|
+
index: c,
|
|
1238
|
+
name: e1[2],
|
|
1239
|
+
strings: s1,
|
|
1240
|
+
ctor: "." === e1[1] ? H : "?" === e1[1] ? I : "@" === e1[1] ? L : k
|
|
1241
|
+
}), r.removeAttribute(t2);
|
|
1242
|
+
} else t2.startsWith(h) && (d.push({
|
|
1243
|
+
type: 6,
|
|
1244
|
+
index: c
|
|
1245
|
+
}), r.removeAttribute(t2));
|
|
1246
|
+
}
|
|
1247
|
+
} catch (err) {
|
|
1248
|
+
_didIteratorError = true;
|
|
1249
|
+
_iteratorError = err;
|
|
1250
|
+
} finally{
|
|
1251
|
+
try {
|
|
1252
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1253
|
+
_iterator.return();
|
|
1254
|
+
}
|
|
1255
|
+
} finally{
|
|
1256
|
+
if (_didIteratorError) {
|
|
1257
|
+
throw _iteratorError;
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
if ($.test(r.tagName)) {
|
|
1262
|
+
var t3 = r.textContent.split(h), s2 = t3.length - 1;
|
|
1263
|
+
if (s2 > 0) {
|
|
1264
|
+
r.textContent = i$1 ? i$1.emptyScript : "";
|
|
1265
|
+
for(var i2 = 0; i2 < s2; i2++)r.append(t3[i2], l()), C.nextNode(), d.push({
|
|
1266
|
+
type: 2,
|
|
1267
|
+
index: ++c
|
|
1268
|
+
});
|
|
1269
|
+
r.append(t3[s2], l());
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
} else if (8 === r.nodeType) if (r.data === o$1) d.push({
|
|
1273
|
+
type: 2,
|
|
1274
|
+
index: c
|
|
1275
|
+
});
|
|
1276
|
+
else {
|
|
1277
|
+
var t4 = -1;
|
|
1278
|
+
for(; -1 !== (t4 = r.data.indexOf(h, t4 + 1));)d.push({
|
|
1279
|
+
type: 7,
|
|
1280
|
+
index: c
|
|
1281
|
+
}), t4 += h.length - 1;
|
|
1282
|
+
}
|
|
1283
|
+
c++;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
_create_class$1(N, null, [
|
|
1287
|
+
{
|
|
1288
|
+
key: "createElement",
|
|
1289
|
+
value: function createElement(t, i) {
|
|
1290
|
+
var s = r$3.createElement("template");
|
|
1291
|
+
return s.innerHTML = t, s;
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
]);
|
|
1295
|
+
return N;
|
|
1296
|
+
}();
|
|
1297
|
+
function S(t, i) {
|
|
1298
|
+
var s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : t, e = arguments.length > 3 ? arguments[3] : void 0;
|
|
1299
|
+
var _s__$Co, _h__$AO;
|
|
1300
|
+
var _s;
|
|
1301
|
+
if (i === T) return i;
|
|
1302
|
+
var h = void 0 !== e ? (_s__$Co = s._$Co) === null || _s__$Co === void 0 ? void 0 : _s__$Co[e] : s._$Cl;
|
|
1303
|
+
var o = c(i) ? void 0 : i._$litDirective$;
|
|
1304
|
+
var __$Co;
|
|
1305
|
+
return (h === null || h === void 0 ? void 0 : h.constructor) !== o && (h === null || h === void 0 ? void 0 : (_h__$AO = h._$AO) === null || _h__$AO === void 0 ? void 0 : _h__$AO.call(h, !1), void 0 === o ? h = void 0 : (h = new o(t), h._$AT(t, s, e)), void 0 !== e ? ((__$Co = (_s = s)._$Co) !== null && __$Co !== void 0 ? __$Co : _s._$Co = [])[e] = h : s._$Cl = h), void 0 !== h && (i = S(t, h._$AS(t, i.values), h, e)), i;
|
|
1306
|
+
}
|
|
1307
|
+
var M = /*#__PURE__*/ function() {
|
|
1308
|
+
function M(t, i) {
|
|
1309
|
+
_class_call_check$1(this, M);
|
|
1310
|
+
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = i;
|
|
1311
|
+
}
|
|
1312
|
+
_create_class$1(M, [
|
|
1313
|
+
{
|
|
1314
|
+
key: "parentNode",
|
|
1315
|
+
get: function get() {
|
|
1316
|
+
return this._$AM.parentNode;
|
|
1317
|
+
}
|
|
1318
|
+
},
|
|
1319
|
+
{
|
|
1320
|
+
key: "_$AU",
|
|
1321
|
+
get: function get() {
|
|
1322
|
+
return this._$AM._$AU;
|
|
1323
|
+
}
|
|
1324
|
+
},
|
|
1325
|
+
{
|
|
1326
|
+
key: "u",
|
|
1327
|
+
value: function u(t) {
|
|
1328
|
+
var _t_creationScope;
|
|
1329
|
+
var _this__$AD = this._$AD, _this__$AD_el = _this__$AD.el, i = _this__$AD_el.content, s = _this__$AD.parts, e = ((_t_creationScope = t === null || t === void 0 ? void 0 : t.creationScope) !== null && _t_creationScope !== void 0 ? _t_creationScope : r$3).importNode(i, !0);
|
|
1330
|
+
C.currentNode = e;
|
|
1331
|
+
var h = C.nextNode(), o = 0, n = 0, l = s[0];
|
|
1332
|
+
for(; void 0 !== l;){
|
|
1333
|
+
if (o === l.index) {
|
|
1334
|
+
var i1 = void 0;
|
|
1335
|
+
2 === l.type ? i1 = new R(h, h.nextSibling, this, t) : 1 === l.type ? i1 = new l.ctor(h, l.name, l.strings, this, t) : 6 === l.type && (i1 = new z(h, this, t)), this._$AV.push(i1), l = s[++n];
|
|
1336
|
+
}
|
|
1337
|
+
o !== (l === null || l === void 0 ? void 0 : l.index) && (h = C.nextNode(), o++);
|
|
1338
|
+
}
|
|
1339
|
+
return C.currentNode = r$3, e;
|
|
1340
|
+
}
|
|
1341
|
+
},
|
|
1342
|
+
{
|
|
1343
|
+
key: "p",
|
|
1344
|
+
value: function p(t) {
|
|
1345
|
+
var i = 0;
|
|
1346
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1347
|
+
try {
|
|
1348
|
+
for(var _iterator = this._$AV[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1349
|
+
var s = _step.value;
|
|
1350
|
+
void 0 !== s && (void 0 !== s.strings ? (s._$AI(t, s, i), i += s.strings.length - 2) : s._$AI(t[i])), i++;
|
|
1351
|
+
}
|
|
1352
|
+
} catch (err) {
|
|
1353
|
+
_didIteratorError = true;
|
|
1354
|
+
_iteratorError = err;
|
|
1355
|
+
} finally{
|
|
1356
|
+
try {
|
|
1357
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1358
|
+
_iterator.return();
|
|
1359
|
+
}
|
|
1360
|
+
} finally{
|
|
1361
|
+
if (_didIteratorError) {
|
|
1362
|
+
throw _iteratorError;
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
]);
|
|
1369
|
+
return M;
|
|
1370
|
+
}();
|
|
1371
|
+
var R = /*#__PURE__*/ function() {
|
|
1372
|
+
function R(t, i, s, e) {
|
|
1373
|
+
_class_call_check$1(this, R);
|
|
1374
|
+
var _e_isConnected;
|
|
1375
|
+
this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA = t, this._$AB = i, this._$AM = s, this.options = e, this._$Cv = (_e_isConnected = e === null || e === void 0 ? void 0 : e.isConnected) !== null && _e_isConnected !== void 0 ? _e_isConnected : !0;
|
|
1376
|
+
}
|
|
1377
|
+
_create_class$1(R, [
|
|
1378
|
+
{
|
|
1379
|
+
key: "_$AU",
|
|
1380
|
+
get: function get() {
|
|
1381
|
+
var _this__$AM;
|
|
1382
|
+
var _this__$AM__$AU;
|
|
1383
|
+
return (_this__$AM__$AU = (_this__$AM = this._$AM) === null || _this__$AM === void 0 ? void 0 : _this__$AM._$AU) !== null && _this__$AM__$AU !== void 0 ? _this__$AM__$AU : this._$Cv;
|
|
1384
|
+
}
|
|
1385
|
+
},
|
|
1386
|
+
{
|
|
1387
|
+
key: "parentNode",
|
|
1388
|
+
get: function get() {
|
|
1389
|
+
var t = this._$AA.parentNode;
|
|
1390
|
+
var i = this._$AM;
|
|
1391
|
+
return void 0 !== i && 11 === (t === null || t === void 0 ? void 0 : t.nodeType) && (t = i.parentNode), t;
|
|
1392
|
+
}
|
|
1393
|
+
},
|
|
1394
|
+
{
|
|
1395
|
+
key: "startNode",
|
|
1396
|
+
get: function get() {
|
|
1397
|
+
return this._$AA;
|
|
1398
|
+
}
|
|
1399
|
+
},
|
|
1400
|
+
{
|
|
1401
|
+
key: "endNode",
|
|
1402
|
+
get: function get() {
|
|
1403
|
+
return this._$AB;
|
|
1404
|
+
}
|
|
1405
|
+
},
|
|
1406
|
+
{
|
|
1407
|
+
key: "_$AI",
|
|
1408
|
+
value: function _$AI(t) {
|
|
1409
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this;
|
|
1410
|
+
t = S(this, t, i), c(t) ? t === E || null == t || "" === t ? (this._$AH !== E && this._$AR(), this._$AH = E) : t !== this._$AH && t !== T && this._(t) : void 0 !== t._$litType$ ? this.$(t) : void 0 !== t.nodeType ? this.T(t) : u(t) ? this.k(t) : this._(t);
|
|
1411
|
+
}
|
|
1412
|
+
},
|
|
1413
|
+
{
|
|
1414
|
+
key: "O",
|
|
1415
|
+
value: function O(t) {
|
|
1416
|
+
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
1417
|
+
}
|
|
1418
|
+
},
|
|
1419
|
+
{
|
|
1420
|
+
key: "T",
|
|
1421
|
+
value: function T(t) {
|
|
1422
|
+
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
1423
|
+
}
|
|
1424
|
+
},
|
|
1425
|
+
{
|
|
1426
|
+
key: "_",
|
|
1427
|
+
value: function _(t) {
|
|
1428
|
+
this._$AH !== E && c(this._$AH) ? this._$AA.nextSibling.data = t : this.T(r$3.createTextNode(t)), this._$AH = t;
|
|
1429
|
+
}
|
|
1430
|
+
},
|
|
1431
|
+
{
|
|
1432
|
+
key: "$",
|
|
1433
|
+
value: function $(t) {
|
|
1434
|
+
var _this__$AH;
|
|
1435
|
+
var i = t.values, s = t._$litType$, e = "number" == typeof s ? this._$AC(t) : (void 0 === s.el && (s.el = N.createElement(P(s.h, s.h[0]), this.options)), s);
|
|
1436
|
+
if (((_this__$AH = this._$AH) === null || _this__$AH === void 0 ? void 0 : _this__$AH._$AD) === e) this._$AH.p(i);
|
|
1437
|
+
else {
|
|
1438
|
+
var _$t = new M(e, this), s1 = _$t.u(this.options);
|
|
1439
|
+
_$t.p(i), this.T(s1), this._$AH = _$t;
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
},
|
|
1443
|
+
{
|
|
1444
|
+
key: "_$AC",
|
|
1445
|
+
value: function _$AC(t) {
|
|
1446
|
+
var i = A.get(t.strings);
|
|
1447
|
+
return void 0 === i && A.set(t.strings, i = new N(t)), i;
|
|
1448
|
+
}
|
|
1449
|
+
},
|
|
1450
|
+
{
|
|
1451
|
+
key: "k",
|
|
1452
|
+
value: function k(t) {
|
|
1453
|
+
a(this._$AH) || (this._$AH = [], this._$AR());
|
|
1454
|
+
var i = this._$AH;
|
|
1455
|
+
var s, e = 0;
|
|
1456
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1457
|
+
try {
|
|
1458
|
+
for(var _iterator = t[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1459
|
+
var h = _step.value;
|
|
1460
|
+
e === i.length ? i.push(s = new R(this.O(l()), this.O(l()), this, this.options)) : s = i[e], s._$AI(h), e++;
|
|
1461
|
+
}
|
|
1462
|
+
} catch (err) {
|
|
1463
|
+
_didIteratorError = true;
|
|
1464
|
+
_iteratorError = err;
|
|
1465
|
+
} finally{
|
|
1466
|
+
try {
|
|
1467
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1468
|
+
_iterator.return();
|
|
1469
|
+
}
|
|
1470
|
+
} finally{
|
|
1471
|
+
if (_didIteratorError) {
|
|
1472
|
+
throw _iteratorError;
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
e < i.length && (this._$AR(s && s._$AB.nextSibling, e), i.length = e);
|
|
1477
|
+
}
|
|
1478
|
+
},
|
|
1479
|
+
{
|
|
1480
|
+
key: "_$AR",
|
|
1481
|
+
value: function _$AR() {
|
|
1482
|
+
var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this._$AA.nextSibling, i = arguments.length > 1 ? arguments[1] : void 0;
|
|
1483
|
+
var _this__$AP, _this;
|
|
1484
|
+
for((_this__$AP = (_this = this)._$AP) === null || _this__$AP === void 0 ? void 0 : _this__$AP.call(_this, !1, !0, i); t && t !== this._$AB;){
|
|
1485
|
+
var i1 = t.nextSibling;
|
|
1486
|
+
t.remove(), t = i1;
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
},
|
|
1490
|
+
{
|
|
1491
|
+
key: "setConnected",
|
|
1492
|
+
value: function setConnected(t) {
|
|
1493
|
+
var _this__$AP, _this;
|
|
1494
|
+
void 0 === this._$AM && (this._$Cv = t, (_this__$AP = (_this = this)._$AP) === null || _this__$AP === void 0 ? void 0 : _this__$AP.call(_this, t));
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
]);
|
|
1498
|
+
return R;
|
|
1499
|
+
}();
|
|
1500
|
+
var k = /*#__PURE__*/ function() {
|
|
1501
|
+
function k(t, i, s, e, h) {
|
|
1502
|
+
_class_call_check$1(this, k);
|
|
1503
|
+
this.type = 1, this._$AH = E, this._$AN = void 0, this.element = t, this.name = i, this._$AM = e, this.options = h, s.length > 2 || "" !== s[0] || "" !== s[1] ? (this._$AH = Array(s.length - 1).fill(new String), this.strings = s) : this._$AH = E;
|
|
1504
|
+
}
|
|
1505
|
+
_create_class$1(k, [
|
|
1506
|
+
{
|
|
1507
|
+
key: "tagName",
|
|
1508
|
+
get: function get() {
|
|
1509
|
+
return this.element.tagName;
|
|
1510
|
+
}
|
|
1511
|
+
},
|
|
1512
|
+
{
|
|
1513
|
+
key: "_$AU",
|
|
1514
|
+
get: function get() {
|
|
1515
|
+
return this._$AM._$AU;
|
|
1516
|
+
}
|
|
1517
|
+
},
|
|
1518
|
+
{
|
|
1519
|
+
key: "_$AI",
|
|
1520
|
+
value: function _$AI(t) {
|
|
1521
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this, s = arguments.length > 2 ? arguments[2] : void 0, e = arguments.length > 3 ? arguments[3] : void 0;
|
|
1522
|
+
var h = this.strings;
|
|
1523
|
+
var o = !1;
|
|
1524
|
+
if (void 0 === h) t = S(this, t, i, 0), o = !c(t) || t !== this._$AH && t !== T, o && (this._$AH = t);
|
|
1525
|
+
else {
|
|
1526
|
+
var e1 = t;
|
|
1527
|
+
var n, r;
|
|
1528
|
+
for(t = h[0], n = 0; n < h.length - 1; n++)r = S(this, e1[s + n], i, n), r === T && (r = this._$AH[n]), o || (o = !c(r) || r !== this._$AH[n]), r === E ? t = E : t !== E && (t += (r !== null && r !== void 0 ? r : "") + h[n + 1]), this._$AH[n] = r;
|
|
1529
|
+
}
|
|
1530
|
+
o && !e && this.j(t);
|
|
1531
|
+
}
|
|
1532
|
+
},
|
|
1533
|
+
{
|
|
1534
|
+
key: "j",
|
|
1535
|
+
value: function j(t) {
|
|
1536
|
+
t === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t !== null && t !== void 0 ? t : "");
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
]);
|
|
1540
|
+
return k;
|
|
1541
|
+
}();
|
|
1542
|
+
var H = /*#__PURE__*/ function(k) {
|
|
1543
|
+
_inherits$1(H, k);
|
|
1544
|
+
var _super = _create_super$1(H);
|
|
1545
|
+
function H() {
|
|
1546
|
+
_class_call_check$1(this, H);
|
|
1547
|
+
var _this;
|
|
1548
|
+
_this = _super.call.apply(_super, [
|
|
1549
|
+
this
|
|
1550
|
+
].concat(Array.prototype.slice.call(arguments))), _this.type = 3;
|
|
1551
|
+
return _possible_constructor_return$1(_this);
|
|
1552
|
+
}
|
|
1553
|
+
_create_class$1(H, [
|
|
1554
|
+
{
|
|
1555
|
+
key: "j",
|
|
1556
|
+
value: function j(t) {
|
|
1557
|
+
this.element[this.name] = t === E ? void 0 : t;
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
]);
|
|
1561
|
+
return H;
|
|
1562
|
+
}(k);
|
|
1563
|
+
var I = /*#__PURE__*/ function(k) {
|
|
1564
|
+
_inherits$1(I, k);
|
|
1565
|
+
var _super = _create_super$1(I);
|
|
1566
|
+
function I() {
|
|
1567
|
+
_class_call_check$1(this, I);
|
|
1568
|
+
var _this;
|
|
1569
|
+
_this = _super.call.apply(_super, [
|
|
1570
|
+
this
|
|
1571
|
+
].concat(Array.prototype.slice.call(arguments))), _this.type = 4;
|
|
1572
|
+
return _possible_constructor_return$1(_this);
|
|
1573
|
+
}
|
|
1574
|
+
_create_class$1(I, [
|
|
1575
|
+
{
|
|
1576
|
+
key: "j",
|
|
1577
|
+
value: function j(t) {
|
|
1578
|
+
this.element.toggleAttribute(this.name, !!t && t !== E);
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
]);
|
|
1582
|
+
return I;
|
|
1583
|
+
}(k);
|
|
1584
|
+
var L = /*#__PURE__*/ function(k) {
|
|
1585
|
+
_inherits$1(L, k);
|
|
1586
|
+
var _super = _create_super$1(L);
|
|
1587
|
+
function L(t, i, s, e, h) {
|
|
1588
|
+
_class_call_check$1(this, L);
|
|
1589
|
+
var _this;
|
|
1590
|
+
_this = _super.call(this, t, i, s, e, h), _this.type = 5;
|
|
1591
|
+
return _possible_constructor_return$1(_this);
|
|
1592
|
+
}
|
|
1593
|
+
_create_class$1(L, [
|
|
1594
|
+
{
|
|
1595
|
+
key: "_$AI",
|
|
1596
|
+
value: function _$AI(t) {
|
|
1597
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this;
|
|
1598
|
+
var _S;
|
|
1599
|
+
if ((t = (_S = S(this, t, i, 0)) !== null && _S !== void 0 ? _S : E) === T) return;
|
|
1600
|
+
var s = this._$AH, e = t === E && s !== E || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, h = t !== E && (s === E || e);
|
|
1601
|
+
e && this.element.removeEventListener(this.name, this, s), h && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
1602
|
+
}
|
|
1603
|
+
},
|
|
1604
|
+
{
|
|
1605
|
+
key: "handleEvent",
|
|
1606
|
+
value: function handleEvent(t) {
|
|
1607
|
+
var _this_options;
|
|
1608
|
+
var _this_options_host;
|
|
1609
|
+
"function" == typeof this._$AH ? this._$AH.call((_this_options_host = (_this_options = this.options) === null || _this_options === void 0 ? void 0 : _this_options.host) !== null && _this_options_host !== void 0 ? _this_options_host : this.element, t) : this._$AH.handleEvent(t);
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
]);
|
|
1613
|
+
return L;
|
|
1614
|
+
}(k);
|
|
1615
|
+
var z = /*#__PURE__*/ function() {
|
|
1616
|
+
function z(t, i, s) {
|
|
1617
|
+
_class_call_check$1(this, z);
|
|
1618
|
+
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = i, this.options = s;
|
|
1619
|
+
}
|
|
1620
|
+
_create_class$1(z, [
|
|
1621
|
+
{
|
|
1622
|
+
key: "_$AU",
|
|
1623
|
+
get: function get() {
|
|
1624
|
+
return this._$AM._$AU;
|
|
1625
|
+
}
|
|
1626
|
+
},
|
|
1627
|
+
{
|
|
1628
|
+
key: "_$AI",
|
|
1629
|
+
value: function _$AI(t) {
|
|
1630
|
+
S(this, t);
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
]);
|
|
1634
|
+
return z;
|
|
1635
|
+
}();
|
|
1636
|
+
var j = t$1.litHtmlPolyfillSupport;
|
|
1637
|
+
var _litHtmlVersions;
|
|
1638
|
+
j === null || j === void 0 ? void 0 : j(N, R), ((_litHtmlVersions = (_t = t$1).litHtmlVersions) !== null && _litHtmlVersions !== void 0 ? _litHtmlVersions : _t.litHtmlVersions = []).push("3.2.1");
|
|
1639
|
+
var B = function(t, i, s) {
|
|
1640
|
+
var _s_renderBefore;
|
|
1641
|
+
var e = (_s_renderBefore = s === null || s === void 0 ? void 0 : s.renderBefore) !== null && _s_renderBefore !== void 0 ? _s_renderBefore : i;
|
|
1642
|
+
var h = e._$litPart$;
|
|
1643
|
+
if (void 0 === h) {
|
|
1644
|
+
var _s_renderBefore1;
|
|
1645
|
+
var _$t = (_s_renderBefore1 = s === null || s === void 0 ? void 0 : s.renderBefore) !== null && _s_renderBefore1 !== void 0 ? _s_renderBefore1 : null;
|
|
1646
|
+
e._$litPart$ = h = new R(i.insertBefore(l(), _$t), _$t, void 0, s !== null && s !== void 0 ? s : {});
|
|
1647
|
+
}
|
|
1648
|
+
return h._$AI(t), h;
|
|
1649
|
+
};
|
|
1650
|
+
|
|
1651
|
+
function _assert_this_initialized(self) {
|
|
1652
|
+
if (self === void 0) {
|
|
1653
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1654
|
+
}
|
|
1655
|
+
return self;
|
|
1656
|
+
}
|
|
1657
|
+
function _class_call_check(instance, Constructor) {
|
|
1658
|
+
if (!(instance instanceof Constructor)) {
|
|
1659
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
function _defineProperties(target, props) {
|
|
1663
|
+
for(var i = 0; i < props.length; i++){
|
|
1664
|
+
var descriptor = props[i];
|
|
1665
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1666
|
+
descriptor.configurable = true;
|
|
1667
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1668
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
1672
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
1673
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
1674
|
+
return Constructor;
|
|
1675
|
+
}
|
|
1676
|
+
function _get(target, property, receiver) {
|
|
1677
|
+
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
1678
|
+
_get = Reflect.get;
|
|
1679
|
+
} else {
|
|
1680
|
+
_get = function get(target, property, receiver) {
|
|
1681
|
+
var base = _super_prop_base(target, property);
|
|
1682
|
+
if (!base) return;
|
|
1683
|
+
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
1684
|
+
if (desc.get) {
|
|
1685
|
+
return desc.get.call(receiver || target);
|
|
1686
|
+
}
|
|
1687
|
+
return desc.value;
|
|
1688
|
+
};
|
|
1689
|
+
}
|
|
1690
|
+
return _get(target, property, receiver || target);
|
|
1691
|
+
}
|
|
1692
|
+
function _get_prototype_of(o) {
|
|
1693
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
1694
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
1695
|
+
};
|
|
1696
|
+
return _get_prototype_of(o);
|
|
1697
|
+
}
|
|
1698
|
+
function _inherits(subClass, superClass) {
|
|
1699
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
1700
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
1701
|
+
}
|
|
1702
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
1703
|
+
constructor: {
|
|
1704
|
+
value: subClass,
|
|
1705
|
+
writable: true,
|
|
1706
|
+
configurable: true
|
|
1707
|
+
}
|
|
1708
|
+
});
|
|
1709
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
1710
|
+
}
|
|
1711
|
+
function _possible_constructor_return(self, call) {
|
|
1712
|
+
if (call && (_type_of$1(call) === "object" || typeof call === "function")) {
|
|
1713
|
+
return call;
|
|
1714
|
+
}
|
|
1715
|
+
return _assert_this_initialized(self);
|
|
1716
|
+
}
|
|
1717
|
+
function _set_prototype_of(o, p) {
|
|
1718
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
1719
|
+
o.__proto__ = p;
|
|
1720
|
+
return o;
|
|
1721
|
+
};
|
|
1722
|
+
return _set_prototype_of(o, p);
|
|
1723
|
+
}
|
|
1724
|
+
function _super_prop_base(object, property) {
|
|
1725
|
+
while(!Object.prototype.hasOwnProperty.call(object, property)){
|
|
1726
|
+
object = _get_prototype_of(object);
|
|
1727
|
+
if (object === null) break;
|
|
1728
|
+
}
|
|
1729
|
+
return object;
|
|
1730
|
+
}
|
|
1731
|
+
function _type_of$1(obj) {
|
|
1732
|
+
"@swc/helpers - typeof";
|
|
1733
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
1734
|
+
}
|
|
1735
|
+
function _is_native_reflect_construct() {
|
|
1736
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
1737
|
+
if (Reflect.construct.sham) return false;
|
|
1738
|
+
if (typeof Proxy === "function") return true;
|
|
1739
|
+
try {
|
|
1740
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
1741
|
+
return true;
|
|
1742
|
+
} catch (e) {
|
|
1743
|
+
return false;
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
function _create_super(Derived) {
|
|
1747
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
1748
|
+
return function _createSuperInternal() {
|
|
1749
|
+
var Super = _get_prototype_of(Derived), result;
|
|
1750
|
+
if (hasNativeReflectConstruct) {
|
|
1751
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
1752
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
1753
|
+
} else {
|
|
1754
|
+
result = Super.apply(this, arguments);
|
|
1755
|
+
}
|
|
1756
|
+
return _possible_constructor_return(this, result);
|
|
1757
|
+
};
|
|
1758
|
+
}
|
|
1759
|
+
var _globalThis_litElementHydrateSupport, _globalThis;
|
|
1760
|
+
var _globalThis1;
|
|
1761
|
+
/**
|
|
1762
|
+
* @license
|
|
1763
|
+
* Copyright 2017 Google LLC
|
|
1764
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1765
|
+
*/ var r$2 = /*#__PURE__*/ function(t) {
|
|
1766
|
+
_inherits(r, t);
|
|
1767
|
+
var _super = _create_super(r);
|
|
1768
|
+
function r() {
|
|
1769
|
+
_class_call_check(this, r);
|
|
1770
|
+
var _this;
|
|
1771
|
+
_this = _super.call.apply(_super, [
|
|
1772
|
+
this
|
|
1773
|
+
].concat(Array.prototype.slice.call(arguments))), _this.renderOptions = {
|
|
1774
|
+
host: _assert_this_initialized(_this)
|
|
1775
|
+
}, _this._$Do = void 0;
|
|
1776
|
+
return _possible_constructor_return(_this);
|
|
1777
|
+
}
|
|
1778
|
+
_create_class(r, [
|
|
1779
|
+
{
|
|
1780
|
+
key: "createRenderRoot",
|
|
1781
|
+
value: function createRenderRoot() {
|
|
1782
|
+
var _this_renderOptions;
|
|
1783
|
+
var _$t = _get(_get_prototype_of(r.prototype), "createRenderRoot", this).call(this);
|
|
1784
|
+
var _renderBefore;
|
|
1785
|
+
return (_renderBefore = (_this_renderOptions = this.renderOptions).renderBefore) !== null && _renderBefore !== void 0 ? _renderBefore : _this_renderOptions.renderBefore = _$t.firstChild, _$t;
|
|
1786
|
+
}
|
|
1787
|
+
},
|
|
1788
|
+
{
|
|
1789
|
+
key: "update",
|
|
1790
|
+
value: function update(t) {
|
|
1791
|
+
var s = this.render();
|
|
1792
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), _get(_get_prototype_of(r.prototype), "update", this).call(this, t), this._$Do = B(s, this.renderRoot, this.renderOptions);
|
|
1793
|
+
}
|
|
1794
|
+
},
|
|
1795
|
+
{
|
|
1796
|
+
key: "connectedCallback",
|
|
1797
|
+
value: function connectedCallback() {
|
|
1798
|
+
var _this__$Do;
|
|
1799
|
+
_get(_get_prototype_of(r.prototype), "connectedCallback", this).call(this), (_this__$Do = this._$Do) === null || _this__$Do === void 0 ? void 0 : _this__$Do.setConnected(!0);
|
|
1800
|
+
}
|
|
1801
|
+
},
|
|
1802
|
+
{
|
|
1803
|
+
key: "disconnectedCallback",
|
|
1804
|
+
value: function disconnectedCallback() {
|
|
1805
|
+
var _this__$Do;
|
|
1806
|
+
_get(_get_prototype_of(r.prototype), "disconnectedCallback", this).call(this), (_this__$Do = this._$Do) === null || _this__$Do === void 0 ? void 0 : _this__$Do.setConnected(!1);
|
|
1807
|
+
}
|
|
1808
|
+
},
|
|
1809
|
+
{
|
|
1810
|
+
key: "render",
|
|
1811
|
+
value: function render() {
|
|
1812
|
+
return T;
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
]);
|
|
1816
|
+
return r;
|
|
1817
|
+
}(b);
|
|
1818
|
+
r$2._$litElement$ = !0, r$2["finalized"] = !0, (_globalThis_litElementHydrateSupport = (_globalThis = globalThis).litElementHydrateSupport) === null || _globalThis_litElementHydrateSupport === void 0 ? void 0 : _globalThis_litElementHydrateSupport.call(_globalThis, {
|
|
1819
|
+
LitElement: r$2
|
|
1820
|
+
});
|
|
1821
|
+
var i = globalThis.litElementPolyfillSupport;
|
|
1822
|
+
i === null || i === void 0 ? void 0 : i({
|
|
1823
|
+
LitElement: r$2
|
|
1824
|
+
});
|
|
1825
|
+
var _litElementVersions;
|
|
1826
|
+
((_litElementVersions = (_globalThis1 = globalThis).litElementVersions) !== null && _litElementVersions !== void 0 ? _litElementVersions : _globalThis1.litElementVersions = []).push("4.1.1");
|
|
1827
|
+
|
|
1828
|
+
/**
|
|
1829
|
+
* @license
|
|
1830
|
+
* Copyright 2017 Google LLC
|
|
1831
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1832
|
+
*/ var t = function(t) {
|
|
1833
|
+
return function(e, o) {
|
|
1834
|
+
void 0 !== o ? o.addInitializer(function() {
|
|
1835
|
+
customElements.define(t, e);
|
|
1836
|
+
}) : customElements.define(t, e);
|
|
1837
|
+
};
|
|
1838
|
+
};
|
|
1839
|
+
|
|
1840
|
+
function _define_property$2(obj, key, value) {
|
|
1841
|
+
if (key in obj) {
|
|
1842
|
+
Object.defineProperty(obj, key, {
|
|
1843
|
+
value: value,
|
|
1844
|
+
enumerable: true,
|
|
1845
|
+
configurable: true,
|
|
1846
|
+
writable: true
|
|
1847
|
+
});
|
|
1848
|
+
} else {
|
|
1849
|
+
obj[key] = value;
|
|
1850
|
+
}
|
|
1851
|
+
return obj;
|
|
1852
|
+
}
|
|
1853
|
+
function _object_spread$1(target) {
|
|
1854
|
+
for(var i = 1; i < arguments.length; i++){
|
|
1855
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
1856
|
+
var ownKeys = Object.keys(source);
|
|
1857
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
1858
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
1859
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
1860
|
+
}));
|
|
1861
|
+
}
|
|
1862
|
+
ownKeys.forEach(function(key) {
|
|
1863
|
+
_define_property$2(target, key, source[key]);
|
|
1864
|
+
});
|
|
1865
|
+
}
|
|
1866
|
+
return target;
|
|
1867
|
+
}
|
|
1868
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
1869
|
+
var keys = Object.keys(object);
|
|
1870
|
+
if (Object.getOwnPropertySymbols) {
|
|
1871
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
1872
|
+
if (enumerableOnly) {
|
|
1873
|
+
symbols = symbols.filter(function(sym) {
|
|
1874
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1877
|
+
keys.push.apply(keys, symbols);
|
|
1878
|
+
}
|
|
1879
|
+
return keys;
|
|
1880
|
+
}
|
|
1881
|
+
function _object_spread_props$1(target, source) {
|
|
1882
|
+
source = source != null ? source : {};
|
|
1883
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
1884
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
1885
|
+
} else {
|
|
1886
|
+
ownKeys$1(Object(source)).forEach(function(key) {
|
|
1887
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1888
|
+
});
|
|
1889
|
+
}
|
|
1890
|
+
return target;
|
|
1891
|
+
}
|
|
1892
|
+
/**
|
|
1893
|
+
* @license
|
|
1894
|
+
* Copyright 2017 Google LLC
|
|
1895
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1896
|
+
*/ var o = {
|
|
1897
|
+
attribute: !0,
|
|
1898
|
+
type: String,
|
|
1899
|
+
converter: u$1,
|
|
1900
|
+
reflect: !1,
|
|
1901
|
+
hasChanged: f$1
|
|
1902
|
+
}, r$1 = function() {
|
|
1903
|
+
var _$t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : o, _$e = arguments.length > 1 ? arguments[1] : void 0, r = arguments.length > 2 ? arguments[2] : void 0;
|
|
1904
|
+
var n = r.kind, i = r.metadata;
|
|
1905
|
+
var s = globalThis.litPropertyMetadata.get(i);
|
|
1906
|
+
if (void 0 === s && globalThis.litPropertyMetadata.set(i, s = new Map), s.set(r.name, _$t), "accessor" === n) {
|
|
1907
|
+
var o1 = r.name;
|
|
1908
|
+
return {
|
|
1909
|
+
set: function set(r) {
|
|
1910
|
+
var n = _$e.get.call(this);
|
|
1911
|
+
_$e.set.call(this, r), this.requestUpdate(o1, n, _$t);
|
|
1912
|
+
},
|
|
1913
|
+
init: function init(e) {
|
|
1914
|
+
return void 0 !== e && this.P(o1, void 0, _$t), e;
|
|
1915
|
+
}
|
|
1916
|
+
};
|
|
1917
|
+
}
|
|
1918
|
+
if ("setter" === n) {
|
|
1919
|
+
var o2 = r.name;
|
|
1920
|
+
return function r(r) {
|
|
1921
|
+
var n = this[o2];
|
|
1922
|
+
_$e.call(this, r), this.requestUpdate(o2, n, _$t);
|
|
1923
|
+
};
|
|
1924
|
+
}
|
|
1925
|
+
throw Error("Unsupported decorator location: " + n);
|
|
1926
|
+
};
|
|
1927
|
+
function n(t) {
|
|
1928
|
+
return function(e, o) {
|
|
1929
|
+
return "object" == typeof o ? r$1(t, e, o) : function(t, e, o) {
|
|
1930
|
+
var r = e.hasOwnProperty(o);
|
|
1931
|
+
return e.constructor.createProperty(o, r ? _object_spread_props$1(_object_spread$1({}, t), {
|
|
1932
|
+
wrapped: !0
|
|
1933
|
+
}) : t), r ? Object.getOwnPropertyDescriptor(e, o) : void 0;
|
|
1934
|
+
}(t, e, o);
|
|
1935
|
+
};
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
function _define_property$1(obj, key, value) {
|
|
1939
|
+
if (key in obj) {
|
|
1940
|
+
Object.defineProperty(obj, key, {
|
|
1941
|
+
value: value,
|
|
1942
|
+
enumerable: true,
|
|
1943
|
+
configurable: true,
|
|
1944
|
+
writable: true
|
|
1945
|
+
});
|
|
1946
|
+
} else {
|
|
1947
|
+
obj[key] = value;
|
|
1948
|
+
}
|
|
1949
|
+
return obj;
|
|
1950
|
+
}
|
|
1951
|
+
function _object_spread(target) {
|
|
1952
|
+
for(var i = 1; i < arguments.length; i++){
|
|
1953
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
1954
|
+
var ownKeys = Object.keys(source);
|
|
1955
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
1956
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
1957
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
1958
|
+
}));
|
|
1959
|
+
}
|
|
1960
|
+
ownKeys.forEach(function(key) {
|
|
1961
|
+
_define_property$1(target, key, source[key]);
|
|
1962
|
+
});
|
|
1963
|
+
}
|
|
1964
|
+
return target;
|
|
1965
|
+
}
|
|
1966
|
+
function ownKeys(object, enumerableOnly) {
|
|
1967
|
+
var keys = Object.keys(object);
|
|
1968
|
+
if (Object.getOwnPropertySymbols) {
|
|
1969
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
1970
|
+
if (enumerableOnly) {
|
|
1971
|
+
symbols = symbols.filter(function(sym) {
|
|
1972
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1973
|
+
});
|
|
1974
|
+
}
|
|
1975
|
+
keys.push.apply(keys, symbols);
|
|
1976
|
+
}
|
|
1977
|
+
return keys;
|
|
1978
|
+
}
|
|
1979
|
+
function _object_spread_props(target, source) {
|
|
1980
|
+
source = source != null ? source : {};
|
|
1981
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
1982
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
1983
|
+
} else {
|
|
1984
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
1985
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1986
|
+
});
|
|
1987
|
+
}
|
|
1988
|
+
return target;
|
|
1989
|
+
}
|
|
1990
|
+
/**
|
|
1991
|
+
* @license
|
|
1992
|
+
* Copyright 2017 Google LLC
|
|
1993
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1994
|
+
*/ function r(r) {
|
|
1995
|
+
return n(_object_spread_props(_object_spread({}, r), {
|
|
1996
|
+
state: !0,
|
|
1997
|
+
attribute: !1
|
|
1998
|
+
}));
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
class InputFileElement extends r$2 {
|
|
2002
|
+
get content() {
|
|
2003
|
+
return this._content;
|
|
2004
|
+
}
|
|
2005
|
+
get value() {
|
|
2006
|
+
return this._value;
|
|
2007
|
+
}
|
|
2008
|
+
loadFile() {
|
|
2009
|
+
const input = document.createElement('input');
|
|
2010
|
+
input.type = 'file';
|
|
2011
|
+
input.multiple = this.multiple;
|
|
2012
|
+
input.accept = this.accept;
|
|
2013
|
+
input.onchange = (event)=>{
|
|
2014
|
+
const files = event.target.files;
|
|
2015
|
+
const file = files[0];
|
|
2016
|
+
const reader = new FileReader();
|
|
2017
|
+
reader.readAsDataURL(file);
|
|
2018
|
+
reader.onload = ()=>{
|
|
2019
|
+
this._value = reader.result;
|
|
2020
|
+
this._content = `> ${file.name}`;
|
|
2021
|
+
this.state = 'loaded';
|
|
2022
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
2023
|
+
detail: {
|
|
2024
|
+
value: this.value
|
|
2025
|
+
}
|
|
2026
|
+
}));
|
|
2027
|
+
};
|
|
2028
|
+
};
|
|
2029
|
+
input.click();
|
|
2030
|
+
}
|
|
2031
|
+
render() {
|
|
2032
|
+
return x`
|
|
2033
|
+
<section
|
|
2034
|
+
class="download ${this.state}"
|
|
2035
|
+
@click=${()=>[
|
|
2036
|
+
'unloaded',
|
|
2037
|
+
'loaded'
|
|
2038
|
+
].indexOf(this.state) >= 0 ? this.loadFile() : void 0}
|
|
2039
|
+
>
|
|
2040
|
+
${this.state === 'loaded' ? x` <ui5-icon name="attachment"></ui5-icon>
|
|
2041
|
+
<p>${this.label}<br />${this._content}</p>` : x` <ui5-icon name="add-document"></ui5-icon>
|
|
2042
|
+
<p>${this.label}</p>`}
|
|
2043
|
+
</section>
|
|
2044
|
+
`;
|
|
2045
|
+
}
|
|
2046
|
+
constructor(...args){
|
|
2047
|
+
super(...args);
|
|
2048
|
+
this.label = 'Upload';
|
|
2049
|
+
this.accept = '*';
|
|
2050
|
+
this.multiple = false;
|
|
2051
|
+
this.required = true;
|
|
2052
|
+
this.state = 'unloaded';
|
|
2053
|
+
this._content = 'no file selected';
|
|
2054
|
+
this._value = '';
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
InputFileElement.styles = i$3`
|
|
2058
|
+
.download {
|
|
2059
|
+
padding: 10px 15px;
|
|
2060
|
+
margin-bottom: 10px;
|
|
2061
|
+
line-height: 1.4;
|
|
2062
|
+
border: 1px solid var(--digipair-color-primary, #52dfdb);
|
|
2063
|
+
color: var(--digipair-color-primary, #52dfdb);
|
|
2064
|
+
align-self: flex-start;
|
|
2065
|
+
margin-right: auto;
|
|
2066
|
+
text-align: center;
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
.download ui5-icon {
|
|
2070
|
+
color: var(--digipair-color-secondary, #52dfdb);
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
.download.unloaded ui5-icon {
|
|
2074
|
+
color: var(--digipair-color-primary, #52dfdb);
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
.download p {
|
|
2078
|
+
text-align: center;
|
|
2079
|
+
font-size: 12px;
|
|
2080
|
+
margin: 0;
|
|
2081
|
+
}
|
|
2082
|
+
|
|
2083
|
+
.download.unloaded {
|
|
2084
|
+
cursor: pointer;
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
.download.loaded ui5-icon {
|
|
2088
|
+
float: left;
|
|
2089
|
+
}
|
|
2090
|
+
`;
|
|
2091
|
+
__decorate([
|
|
2092
|
+
n()
|
|
2093
|
+
], InputFileElement.prototype, "label", void 0);
|
|
2094
|
+
__decorate([
|
|
2095
|
+
n()
|
|
2096
|
+
], InputFileElement.prototype, "accept", void 0);
|
|
2097
|
+
__decorate([
|
|
2098
|
+
n()
|
|
2099
|
+
], InputFileElement.prototype, "multiple", void 0);
|
|
2100
|
+
__decorate([
|
|
2101
|
+
n()
|
|
2102
|
+
], InputFileElement.prototype, "required", void 0);
|
|
2103
|
+
__decorate([
|
|
2104
|
+
r()
|
|
2105
|
+
], InputFileElement.prototype, "state", void 0);
|
|
2106
|
+
__decorate([
|
|
2107
|
+
r()
|
|
2108
|
+
], InputFileElement.prototype, "_content", void 0);
|
|
2109
|
+
InputFileElement = __decorate([
|
|
2110
|
+
t('digipair-input-file')
|
|
2111
|
+
], InputFileElement);
|
|
2112
|
+
|
|
2113
|
+
class InputJsonElement extends r$2 {
|
|
2114
|
+
get content() {
|
|
2115
|
+
return this._content;
|
|
2116
|
+
}
|
|
2117
|
+
get value() {
|
|
2118
|
+
return this._value;
|
|
2119
|
+
}
|
|
2120
|
+
loadFile() {
|
|
2121
|
+
const input = document.createElement('input');
|
|
2122
|
+
input.type = 'file';
|
|
2123
|
+
input.multiple = this.multiple;
|
|
2124
|
+
input.accept = this.accept;
|
|
2125
|
+
input.onchange = (event)=>{
|
|
2126
|
+
const files = event.target.files;
|
|
2127
|
+
const file = files[0];
|
|
2128
|
+
const reader = new FileReader();
|
|
2129
|
+
reader.readAsText(file);
|
|
2130
|
+
reader.onload = ()=>{
|
|
2131
|
+
this._value = JSON.parse(reader.result);
|
|
2132
|
+
this._content = `> ${file.name}`;
|
|
2133
|
+
this.state = 'loaded';
|
|
2134
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
2135
|
+
detail: {
|
|
2136
|
+
value: this.value
|
|
2137
|
+
}
|
|
2138
|
+
}));
|
|
2139
|
+
};
|
|
2140
|
+
};
|
|
2141
|
+
input.click();
|
|
2142
|
+
}
|
|
2143
|
+
render() {
|
|
2144
|
+
return x`
|
|
2145
|
+
<section
|
|
2146
|
+
class="download ${this.state}"
|
|
2147
|
+
@click=${()=>[
|
|
2148
|
+
'unloaded',
|
|
2149
|
+
'loaded'
|
|
2150
|
+
].indexOf(this.state) >= 0 ? this.loadFile() : void 0}
|
|
2151
|
+
>
|
|
2152
|
+
${this.state === 'loaded' ? x` <ui5-icon name="attachment"></ui5-icon>
|
|
2153
|
+
<p>${this.label}<br />${this._content}</p>` : x` <ui5-icon name="add-document"></ui5-icon>
|
|
2154
|
+
<p>${this.label}</p>`}
|
|
2155
|
+
</section>
|
|
2156
|
+
`;
|
|
2157
|
+
}
|
|
2158
|
+
constructor(...args){
|
|
2159
|
+
super(...args);
|
|
2160
|
+
this.label = 'Upload';
|
|
2161
|
+
this.accept = '.json';
|
|
2162
|
+
this.multiple = false;
|
|
2163
|
+
this.required = true;
|
|
2164
|
+
this.state = 'unloaded';
|
|
2165
|
+
this._content = 'no file selected';
|
|
2166
|
+
this._value = '';
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
InputJsonElement.styles = i$3`
|
|
2170
|
+
.download {
|
|
2171
|
+
padding: 10px 15px;
|
|
2172
|
+
margin-bottom: 10px;
|
|
2173
|
+
line-height: 1.4;
|
|
2174
|
+
border: 1px solid var(--digipair-color-primary, #52dfdb);
|
|
2175
|
+
color: var(--digipair-color-primary, #52dfdb);
|
|
2176
|
+
align-self: flex-start;
|
|
2177
|
+
margin-right: auto;
|
|
2178
|
+
text-align: center;
|
|
2179
|
+
}
|
|
2180
|
+
|
|
2181
|
+
.download ui5-icon {
|
|
2182
|
+
color: var(--digipair-color-secondary, #52dfdb);
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
.download.unloaded ui5-icon {
|
|
2186
|
+
color: var(--digipair-color-primary, #52dfdb);
|
|
2187
|
+
}
|
|
2188
|
+
|
|
2189
|
+
.download p {
|
|
2190
|
+
text-align: center;
|
|
2191
|
+
font-size: 12px;
|
|
2192
|
+
margin: 0;
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
.download.unloaded {
|
|
2196
|
+
cursor: pointer;
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
.download.loaded ui5-icon {
|
|
2200
|
+
float: left;
|
|
2201
|
+
}
|
|
2202
|
+
`;
|
|
2203
|
+
__decorate([
|
|
2204
|
+
n()
|
|
2205
|
+
], InputJsonElement.prototype, "label", void 0);
|
|
2206
|
+
__decorate([
|
|
2207
|
+
n()
|
|
2208
|
+
], InputJsonElement.prototype, "accept", void 0);
|
|
2209
|
+
__decorate([
|
|
2210
|
+
n()
|
|
2211
|
+
], InputJsonElement.prototype, "multiple", void 0);
|
|
2212
|
+
__decorate([
|
|
2213
|
+
n()
|
|
2214
|
+
], InputJsonElement.prototype, "required", void 0);
|
|
2215
|
+
__decorate([
|
|
2216
|
+
r()
|
|
2217
|
+
], InputJsonElement.prototype, "state", void 0);
|
|
2218
|
+
__decorate([
|
|
2219
|
+
r()
|
|
2220
|
+
], InputJsonElement.prototype, "_content", void 0);
|
|
2221
|
+
InputJsonElement = __decorate([
|
|
2222
|
+
t('digipair-input-json')
|
|
2223
|
+
], InputJsonElement);
|
|
2224
|
+
|
|
2225
|
+
class InputTextElement extends r$2 {
|
|
2226
|
+
get content() {
|
|
2227
|
+
return this._content;
|
|
2228
|
+
}
|
|
2229
|
+
get value() {
|
|
2230
|
+
return this._value;
|
|
2231
|
+
}
|
|
2232
|
+
loadFile() {
|
|
2233
|
+
const input = document.createElement('input');
|
|
2234
|
+
input.type = 'file';
|
|
2235
|
+
input.multiple = this.multiple;
|
|
2236
|
+
input.accept = this.accept;
|
|
2237
|
+
input.onchange = (event)=>{
|
|
2238
|
+
const files = event.target.files;
|
|
2239
|
+
const file = files[0];
|
|
2240
|
+
const reader = new FileReader();
|
|
2241
|
+
reader.readAsText(file);
|
|
2242
|
+
reader.onload = ()=>{
|
|
2243
|
+
this._value = reader.result;
|
|
2244
|
+
this._content = `> ${file.name}`;
|
|
2245
|
+
this.state = 'loaded';
|
|
2246
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
2247
|
+
detail: {
|
|
2248
|
+
value: this.value
|
|
2249
|
+
}
|
|
2250
|
+
}));
|
|
2251
|
+
};
|
|
2252
|
+
};
|
|
2253
|
+
input.click();
|
|
2254
|
+
}
|
|
2255
|
+
render() {
|
|
2256
|
+
return x`
|
|
2257
|
+
<section
|
|
2258
|
+
class="download ${this.state}"
|
|
2259
|
+
@click=${()=>[
|
|
2260
|
+
'unloaded',
|
|
2261
|
+
'loaded'
|
|
2262
|
+
].indexOf(this.state) >= 0 ? this.loadFile() : void 0}
|
|
2263
|
+
>
|
|
2264
|
+
${this.state === 'loaded' ? x` <ui5-icon name="attachment"></ui5-icon>
|
|
2265
|
+
<p>${this.label}<br />${this._content}</p>` : x` <ui5-icon name="add-document"></ui5-icon>
|
|
2266
|
+
<p>${this.label}</p>`}
|
|
2267
|
+
</section>
|
|
2268
|
+
`;
|
|
2269
|
+
}
|
|
2270
|
+
constructor(...args){
|
|
2271
|
+
super(...args);
|
|
2272
|
+
this.label = 'Upload';
|
|
2273
|
+
this.accept = '.txt';
|
|
2274
|
+
this.multiple = false;
|
|
2275
|
+
this.required = true;
|
|
2276
|
+
this.state = 'unloaded';
|
|
2277
|
+
this._content = 'no file selected';
|
|
2278
|
+
this._value = '';
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
InputTextElement.styles = i$3`
|
|
2282
|
+
.download {
|
|
2283
|
+
padding: 10px 15px;
|
|
2284
|
+
margin-bottom: 10px;
|
|
2285
|
+
line-height: 1.4;
|
|
2286
|
+
border: 1px solid var(--digipair-color-primary, #52dfdb);
|
|
2287
|
+
color: var(--digipair-color-primary, #52dfdb);
|
|
2288
|
+
align-self: flex-start;
|
|
2289
|
+
margin-right: auto;
|
|
2290
|
+
text-align: center;
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
.download ui5-icon {
|
|
2294
|
+
color: var(--digipair-color-secondary, #52dfdb);
|
|
2295
|
+
}
|
|
2296
|
+
|
|
2297
|
+
.download.unloaded ui5-icon {
|
|
2298
|
+
color: var(--digipair-color-primary, #52dfdb);
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2301
|
+
.download p {
|
|
2302
|
+
text-align: center;
|
|
2303
|
+
font-size: 12px;
|
|
2304
|
+
margin: 0;
|
|
2305
|
+
}
|
|
2306
|
+
|
|
2307
|
+
.download.unloaded {
|
|
2308
|
+
cursor: pointer;
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
.download.loaded ui5-icon {
|
|
2312
|
+
float: left;
|
|
2313
|
+
}
|
|
2314
|
+
`;
|
|
2315
|
+
__decorate([
|
|
2316
|
+
n()
|
|
2317
|
+
], InputTextElement.prototype, "label", void 0);
|
|
2318
|
+
__decorate([
|
|
2319
|
+
n()
|
|
2320
|
+
], InputTextElement.prototype, "accept", void 0);
|
|
2321
|
+
__decorate([
|
|
2322
|
+
n()
|
|
2323
|
+
], InputTextElement.prototype, "multiple", void 0);
|
|
2324
|
+
__decorate([
|
|
2325
|
+
n()
|
|
2326
|
+
], InputTextElement.prototype, "required", void 0);
|
|
2327
|
+
__decorate([
|
|
2328
|
+
r()
|
|
2329
|
+
], InputTextElement.prototype, "state", void 0);
|
|
2330
|
+
__decorate([
|
|
2331
|
+
r()
|
|
2332
|
+
], InputTextElement.prototype, "_content", void 0);
|
|
2333
|
+
InputTextElement = __decorate([
|
|
2334
|
+
t('digipair-input-text')
|
|
2335
|
+
], InputTextElement);
|
|
2336
|
+
|
|
2337
|
+
class DomAttributeElement extends r$2 {
|
|
2338
|
+
get value() {
|
|
2339
|
+
return this._value;
|
|
2340
|
+
}
|
|
2341
|
+
connectedCallback() {
|
|
2342
|
+
super.connectedCallback();
|
|
2343
|
+
this.initialize();
|
|
2344
|
+
}
|
|
2345
|
+
async initialize() {
|
|
2346
|
+
const element = document.querySelector(this.selector);
|
|
2347
|
+
var _element_this_attribute;
|
|
2348
|
+
const value = (_element_this_attribute = element[this.attribute]) != null ? _element_this_attribute : element.getAttribute(this.attribute);
|
|
2349
|
+
if (!(value instanceof Promise)) {
|
|
2350
|
+
this._value = value;
|
|
2351
|
+
return;
|
|
2352
|
+
}
|
|
2353
|
+
try {
|
|
2354
|
+
this._value = await value;
|
|
2355
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
2356
|
+
detail: {
|
|
2357
|
+
value: this.value
|
|
2358
|
+
}
|
|
2359
|
+
}));
|
|
2360
|
+
} catch (error) {
|
|
2361
|
+
this._value = value;
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2364
|
+
render() {
|
|
2365
|
+
return x``;
|
|
2366
|
+
}
|
|
2367
|
+
constructor(...args){
|
|
2368
|
+
super(...args);
|
|
2369
|
+
this.selector = '';
|
|
2370
|
+
this.attribute = '';
|
|
2371
|
+
this.required = true;
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
__decorate([
|
|
2375
|
+
n()
|
|
2376
|
+
], DomAttributeElement.prototype, "selector", void 0);
|
|
2377
|
+
__decorate([
|
|
2378
|
+
n()
|
|
2379
|
+
], DomAttributeElement.prototype, "attribute", void 0);
|
|
2380
|
+
__decorate([
|
|
2381
|
+
n()
|
|
2382
|
+
], DomAttributeElement.prototype, "required", void 0);
|
|
2383
|
+
DomAttributeElement = __decorate([
|
|
2384
|
+
t('digipair-input-dom-attribute')
|
|
2385
|
+
], DomAttributeElement);
|
|
2386
|
+
|
|
2387
|
+
/**
|
|
2388
|
+
* Guard function that checks if provided `input` is an Element.
|
|
2389
|
+
*/ function isElement(input) {
|
|
2390
|
+
return typeof input === "object" && input !== null && input.nodeType === Node.ELEMENT_NODE;
|
|
2391
|
+
}
|
|
2392
|
+
|
|
2393
|
+
var OPERATOR = {
|
|
2394
|
+
NONE: "",
|
|
2395
|
+
DESCENDANT: " ",
|
|
2396
|
+
CHILD: " > "
|
|
2397
|
+
};
|
|
2398
|
+
var CSS_SELECTOR_TYPE = {
|
|
2399
|
+
id: "id",
|
|
2400
|
+
class: "class",
|
|
2401
|
+
tag: "tag",
|
|
2402
|
+
attribute: "attribute",
|
|
2403
|
+
nthchild: "nthchild",
|
|
2404
|
+
nthoftype: "nthoftype"
|
|
2405
|
+
};
|
|
2406
|
+
|
|
2407
|
+
/**
|
|
2408
|
+
* Checks whether value is one of the enum's values.
|
|
2409
|
+
*/ function isEnumValue(haystack, needle) {
|
|
2410
|
+
return Object.values(haystack).includes(needle);
|
|
2411
|
+
}
|
|
2412
|
+
|
|
2413
|
+
function _array_like_to_array$8(arr, len) {
|
|
2414
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
2415
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
2416
|
+
return arr2;
|
|
2417
|
+
}
|
|
2418
|
+
function _array_without_holes$7(arr) {
|
|
2419
|
+
if (Array.isArray(arr)) return _array_like_to_array$8(arr);
|
|
2420
|
+
}
|
|
2421
|
+
function _iterable_to_array$7(iter) {
|
|
2422
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
2423
|
+
}
|
|
2424
|
+
function _non_iterable_spread$7() {
|
|
2425
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2426
|
+
}
|
|
2427
|
+
function _to_consumable_array$7(arr) {
|
|
2428
|
+
return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$7();
|
|
2429
|
+
}
|
|
2430
|
+
function _unsupported_iterable_to_array$8(o, minLen) {
|
|
2431
|
+
if (!o) return;
|
|
2432
|
+
if (typeof o === "string") return _array_like_to_array$8(o, minLen);
|
|
2433
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2434
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
2435
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
2436
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
|
|
2437
|
+
}
|
|
2438
|
+
var libraryName = "CssSelectorGenerator";
|
|
2439
|
+
/**
|
|
2440
|
+
* Convenient wrapper for `console.warn` using consistent formatting.
|
|
2441
|
+
*/ function showWarning() {
|
|
2442
|
+
var id = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "unknown problem";
|
|
2443
|
+
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
2444
|
+
args[_key - 1] = arguments[_key];
|
|
2445
|
+
}
|
|
2446
|
+
var // eslint-disable-next-line no-console
|
|
2447
|
+
_console;
|
|
2448
|
+
(_console = console).warn.apply(_console, [
|
|
2449
|
+
"".concat(libraryName, ": ").concat(id)
|
|
2450
|
+
].concat(_to_consumable_array$7(args)));
|
|
2451
|
+
}
|
|
2452
|
+
|
|
2453
|
+
function _instanceof$1(left, right) {
|
|
2454
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
2455
|
+
return !!right[Symbol.hasInstance](left);
|
|
2456
|
+
} else {
|
|
2457
|
+
return left instanceof right;
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
function _type_of(obj) {
|
|
2461
|
+
"@swc/helpers - typeof";
|
|
2462
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
2463
|
+
}
|
|
2464
|
+
var DEFAULT_OPTIONS = {
|
|
2465
|
+
selectors: [
|
|
2466
|
+
CSS_SELECTOR_TYPE.id,
|
|
2467
|
+
CSS_SELECTOR_TYPE.class,
|
|
2468
|
+
CSS_SELECTOR_TYPE.tag,
|
|
2469
|
+
CSS_SELECTOR_TYPE.attribute
|
|
2470
|
+
],
|
|
2471
|
+
// if set to true, always include tag name
|
|
2472
|
+
includeTag: false,
|
|
2473
|
+
whitelist: [],
|
|
2474
|
+
blacklist: [],
|
|
2475
|
+
combineWithinSelector: true,
|
|
2476
|
+
combineBetweenSelectors: true,
|
|
2477
|
+
root: null,
|
|
2478
|
+
maxCombinations: Number.POSITIVE_INFINITY,
|
|
2479
|
+
maxCandidates: Number.POSITIVE_INFINITY
|
|
2480
|
+
};
|
|
2481
|
+
/**
|
|
2482
|
+
* Makes sure returned value is a list containing only valid selector types.
|
|
2483
|
+
* @param input
|
|
2484
|
+
*/ function sanitizeSelectorTypes(input) {
|
|
2485
|
+
if (!Array.isArray(input)) {
|
|
2486
|
+
return [];
|
|
2487
|
+
}
|
|
2488
|
+
return input.filter(function(item) {
|
|
2489
|
+
return isEnumValue(CSS_SELECTOR_TYPE, item);
|
|
2490
|
+
});
|
|
2491
|
+
}
|
|
2492
|
+
/**
|
|
2493
|
+
* Checks whether provided value is of type RegExp.
|
|
2494
|
+
*/ function isRegExp(input) {
|
|
2495
|
+
return _instanceof$1(input, RegExp);
|
|
2496
|
+
}
|
|
2497
|
+
/**
|
|
2498
|
+
* Checks whether provided value is usable in whitelist or blacklist.
|
|
2499
|
+
* @param input
|
|
2500
|
+
*/ function isCssSelectorMatch(input) {
|
|
2501
|
+
return [
|
|
2502
|
+
"string",
|
|
2503
|
+
"function"
|
|
2504
|
+
].includes(typeof input === "undefined" ? "undefined" : _type_of(input)) || isRegExp(input);
|
|
2505
|
+
}
|
|
2506
|
+
/**
|
|
2507
|
+
* Converts input to a list of valid values for whitelist or blacklist.
|
|
2508
|
+
*/ function sanitizeCssSelectorMatchList(input) {
|
|
2509
|
+
if (!Array.isArray(input)) {
|
|
2510
|
+
return [];
|
|
2511
|
+
}
|
|
2512
|
+
return input.filter(isCssSelectorMatch);
|
|
2513
|
+
}
|
|
2514
|
+
/**
|
|
2515
|
+
* Checks whether provided value is valid Node.
|
|
2516
|
+
*/ function isNode(input) {
|
|
2517
|
+
return _instanceof$1(input, Node);
|
|
2518
|
+
}
|
|
2519
|
+
/**
|
|
2520
|
+
* Checks whether provided value is valid ParentNode.
|
|
2521
|
+
*/ function isParentNode(input) {
|
|
2522
|
+
var validParentNodeTypes = [
|
|
2523
|
+
Node.DOCUMENT_NODE,
|
|
2524
|
+
Node.DOCUMENT_FRAGMENT_NODE,
|
|
2525
|
+
Node.ELEMENT_NODE
|
|
2526
|
+
];
|
|
2527
|
+
return isNode(input) && validParentNodeTypes.includes(input.nodeType);
|
|
2528
|
+
}
|
|
2529
|
+
/**
|
|
2530
|
+
* Makes sure that the root node in options is valid.
|
|
2531
|
+
*/ function sanitizeRoot(input, element) {
|
|
2532
|
+
if (isParentNode(input)) {
|
|
2533
|
+
if (!input.contains(element)) {
|
|
2534
|
+
showWarning("element root mismatch", "Provided root does not contain the element. This will most likely result in producing a fallback selector using element's real root node. If you plan to use the selector using provided root (e.g. `root.querySelector`), it will not work as intended.");
|
|
2535
|
+
}
|
|
2536
|
+
return input;
|
|
2537
|
+
}
|
|
2538
|
+
var rootNode = element.getRootNode({
|
|
2539
|
+
composed: false
|
|
2540
|
+
});
|
|
2541
|
+
if (isParentNode(rootNode)) {
|
|
2542
|
+
if (rootNode !== document) {
|
|
2543
|
+
showWarning("shadow root inferred", "You did not provide a root and the element is a child of Shadow DOM. This will produce a selector using ShadowRoot as a root. If you plan to use the selector using document as a root (e.g. `document.querySelector`), it will not work as intended.");
|
|
2544
|
+
}
|
|
2545
|
+
return rootNode;
|
|
2546
|
+
}
|
|
2547
|
+
return getRootNode(element);
|
|
2548
|
+
}
|
|
2549
|
+
/**
|
|
2550
|
+
* Makes sure that the output is a number, usable as `maxResults` option in
|
|
2551
|
+
* powerset generator.
|
|
2552
|
+
*/ function sanitizeMaxNumber(input) {
|
|
2553
|
+
return typeof input === "number" ? input : Number.POSITIVE_INFINITY;
|
|
2554
|
+
}
|
|
2555
|
+
/**
|
|
2556
|
+
* Makes sure the options object contains all required keys.
|
|
2557
|
+
*/ function sanitizeOptions(element) {
|
|
2558
|
+
var custom_options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
2559
|
+
var options = Object.assign(Object.assign({}, DEFAULT_OPTIONS), custom_options);
|
|
2560
|
+
return {
|
|
2561
|
+
selectors: sanitizeSelectorTypes(options.selectors),
|
|
2562
|
+
whitelist: sanitizeCssSelectorMatchList(options.whitelist),
|
|
2563
|
+
blacklist: sanitizeCssSelectorMatchList(options.blacklist),
|
|
2564
|
+
root: sanitizeRoot(options.root, element),
|
|
2565
|
+
combineWithinSelector: !!options.combineWithinSelector,
|
|
2566
|
+
combineBetweenSelectors: !!options.combineBetweenSelectors,
|
|
2567
|
+
includeTag: !!options.includeTag,
|
|
2568
|
+
maxCombinations: sanitizeMaxNumber(options.maxCombinations),
|
|
2569
|
+
maxCandidates: sanitizeMaxNumber(options.maxCandidates)
|
|
2570
|
+
};
|
|
2571
|
+
}
|
|
2572
|
+
|
|
2573
|
+
function _array_like_to_array$7(arr, len) {
|
|
2574
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
2575
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
2576
|
+
return arr2;
|
|
2577
|
+
}
|
|
2578
|
+
function _array_with_holes$1(arr) {
|
|
2579
|
+
if (Array.isArray(arr)) return arr;
|
|
2580
|
+
}
|
|
2581
|
+
function _array_without_holes$6(arr) {
|
|
2582
|
+
if (Array.isArray(arr)) return _array_like_to_array$7(arr);
|
|
2583
|
+
}
|
|
2584
|
+
function _iterable_to_array$6(iter) {
|
|
2585
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
2586
|
+
}
|
|
2587
|
+
function _non_iterable_rest$1() {
|
|
2588
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2589
|
+
}
|
|
2590
|
+
function _non_iterable_spread$6() {
|
|
2591
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2592
|
+
}
|
|
2593
|
+
function _to_array(arr) {
|
|
2594
|
+
return _array_with_holes$1(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_rest$1();
|
|
2595
|
+
}
|
|
2596
|
+
function _to_consumable_array$6(arr) {
|
|
2597
|
+
return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$6();
|
|
2598
|
+
}
|
|
2599
|
+
function _unsupported_iterable_to_array$7(o, minLen) {
|
|
2600
|
+
if (!o) return;
|
|
2601
|
+
if (typeof o === "string") return _array_like_to_array$7(o, minLen);
|
|
2602
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2603
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
2604
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
2605
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
|
|
2606
|
+
}
|
|
2607
|
+
/**
|
|
2608
|
+
* Creates array containing only items included in all input arrays.
|
|
2609
|
+
*/ function getIntersection() {
|
|
2610
|
+
var items = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
2611
|
+
var _items = _to_array(items), tmp = _items[0], firstItem = tmp === void 0 ? [] : tmp, otherItems = _items.slice(1);
|
|
2612
|
+
if (otherItems.length === 0) {
|
|
2613
|
+
return firstItem;
|
|
2614
|
+
}
|
|
2615
|
+
return otherItems.reduce(function(accumulator, currentValue) {
|
|
2616
|
+
return accumulator.filter(function(item) {
|
|
2617
|
+
return currentValue.includes(item);
|
|
2618
|
+
});
|
|
2619
|
+
}, firstItem);
|
|
2620
|
+
}
|
|
2621
|
+
/**
|
|
2622
|
+
* Converts array of arrays into a flat array.
|
|
2623
|
+
*/ function flattenArray(input) {
|
|
2624
|
+
var _instance;
|
|
2625
|
+
return (_instance = []).concat.apply(_instance, _to_consumable_array$6(input));
|
|
2626
|
+
}
|
|
2627
|
+
/**
|
|
2628
|
+
* Convert string that can contain wildcards (asterisks) to RegExp source.
|
|
2629
|
+
*/ function wildcardToRegExp(input) {
|
|
2630
|
+
return input// convert all special characters used by RegExp, except an asterisk
|
|
2631
|
+
.replace(/[|\\{}()[\]^$+?.]/g, "\\$&")// convert asterisk to pattern that matches anything
|
|
2632
|
+
.replace(/\*/g, ".+");
|
|
2633
|
+
}
|
|
2634
|
+
/**
|
|
2635
|
+
* Creates function that will test list of provided matchers against input.
|
|
2636
|
+
* Used for white/blacklist functionality.
|
|
2637
|
+
*/ function createPatternMatcher(list) {
|
|
2638
|
+
var matchFunctions = list.map(function(item) {
|
|
2639
|
+
if (isRegExp(item)) {
|
|
2640
|
+
return function(input) {
|
|
2641
|
+
return item.test(input);
|
|
2642
|
+
};
|
|
2643
|
+
}
|
|
2644
|
+
if (typeof item === "function") {
|
|
2645
|
+
return function(input) {
|
|
2646
|
+
var result = item(input);
|
|
2647
|
+
if (typeof result !== "boolean") {
|
|
2648
|
+
showWarning("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", item);
|
|
2649
|
+
return false;
|
|
2650
|
+
}
|
|
2651
|
+
return result;
|
|
2652
|
+
};
|
|
2653
|
+
}
|
|
2654
|
+
if (typeof item === "string") {
|
|
2655
|
+
var re = new RegExp("^" + wildcardToRegExp(item) + "$");
|
|
2656
|
+
return function(input) {
|
|
2657
|
+
return re.test(input);
|
|
2658
|
+
};
|
|
2659
|
+
}
|
|
2660
|
+
showWarning("pattern matcher invalid", "Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.", item);
|
|
2661
|
+
return function() {
|
|
2662
|
+
return false;
|
|
2663
|
+
};
|
|
2664
|
+
});
|
|
2665
|
+
return function(input) {
|
|
2666
|
+
return matchFunctions.some(function(matchFunction) {
|
|
2667
|
+
return matchFunction(input);
|
|
2668
|
+
});
|
|
2669
|
+
};
|
|
2670
|
+
}
|
|
2671
|
+
|
|
2672
|
+
/**
|
|
2673
|
+
* Check whether element is matched uniquely by selector.
|
|
2674
|
+
*/ function testSelector(elements, selector, root) {
|
|
2675
|
+
var result = Array.from(sanitizeRoot(root, elements[0]).querySelectorAll(selector));
|
|
2676
|
+
return result.length === elements.length && elements.every(function(element) {
|
|
2677
|
+
return result.includes(element);
|
|
2678
|
+
});
|
|
2679
|
+
}
|
|
2680
|
+
/**
|
|
2681
|
+
* Find all parents of a single element.
|
|
2682
|
+
*/ function getElementParents(element, root) {
|
|
2683
|
+
root = root !== null && root !== void 0 ? root : getRootNode(element);
|
|
2684
|
+
var result = [];
|
|
2685
|
+
var parent = element;
|
|
2686
|
+
while(isElement(parent) && parent !== root){
|
|
2687
|
+
result.push(parent);
|
|
2688
|
+
parent = parent.parentElement;
|
|
2689
|
+
}
|
|
2690
|
+
return result;
|
|
2691
|
+
}
|
|
2692
|
+
/**
|
|
2693
|
+
* Find all common parents of elements.
|
|
2694
|
+
*/ function getParents(elements, root) {
|
|
2695
|
+
return getIntersection(elements.map(function(element) {
|
|
2696
|
+
return getElementParents(element, root);
|
|
2697
|
+
}));
|
|
2698
|
+
}
|
|
2699
|
+
/**
|
|
2700
|
+
* Returns root node for given element. This needs to be used because of document-less environments, e.g. jsdom.
|
|
2701
|
+
*/ function getRootNode(element) {
|
|
2702
|
+
// The `:root` selector always returns a parent node. The `null` return value is not applicable here.
|
|
2703
|
+
return element.ownerDocument.querySelector(":root");
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2706
|
+
var SELECTOR_SEPARATOR = ", ";
|
|
2707
|
+
// RegExp that will match invalid patterns that can be used in ID attribute.
|
|
2708
|
+
var INVALID_ID_RE = new RegExp([
|
|
2709
|
+
"^$",
|
|
2710
|
+
"\\s"
|
|
2711
|
+
].join("|"));
|
|
2712
|
+
// RegExp that will match invalid patterns that can be used in class attribute.
|
|
2713
|
+
var INVALID_CLASS_RE = new RegExp([
|
|
2714
|
+
"^$"
|
|
2715
|
+
].join("|"));
|
|
2716
|
+
// Order in which a combined selector is constructed.
|
|
2717
|
+
var SELECTOR_PATTERN = [
|
|
2718
|
+
CSS_SELECTOR_TYPE.nthoftype,
|
|
2719
|
+
CSS_SELECTOR_TYPE.tag,
|
|
2720
|
+
CSS_SELECTOR_TYPE.id,
|
|
2721
|
+
CSS_SELECTOR_TYPE.class,
|
|
2722
|
+
CSS_SELECTOR_TYPE.attribute,
|
|
2723
|
+
CSS_SELECTOR_TYPE.nthchild
|
|
2724
|
+
];
|
|
2725
|
+
|
|
2726
|
+
function _array_like_to_array$6(arr, len) {
|
|
2727
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
2728
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
2729
|
+
return arr2;
|
|
2730
|
+
}
|
|
2731
|
+
function _array_without_holes$5(arr) {
|
|
2732
|
+
if (Array.isArray(arr)) return _array_like_to_array$6(arr);
|
|
2733
|
+
}
|
|
2734
|
+
function _iterable_to_array$5(iter) {
|
|
2735
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
2736
|
+
}
|
|
2737
|
+
function _non_iterable_spread$5() {
|
|
2738
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2739
|
+
}
|
|
2740
|
+
function _to_consumable_array$5(arr) {
|
|
2741
|
+
return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$5();
|
|
2742
|
+
}
|
|
2743
|
+
function _unsupported_iterable_to_array$6(o, minLen) {
|
|
2744
|
+
if (!o) return;
|
|
2745
|
+
if (typeof o === "string") return _array_like_to_array$6(o, minLen);
|
|
2746
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2747
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
2748
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
2749
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
|
|
2750
|
+
}
|
|
2751
|
+
// List of attributes to be ignored. These are handled by different selector types.
|
|
2752
|
+
var attributeBlacklistMatch = createPatternMatcher([
|
|
2753
|
+
"class",
|
|
2754
|
+
"id",
|
|
2755
|
+
// Angular attributes
|
|
2756
|
+
"ng-*"
|
|
2757
|
+
]);
|
|
2758
|
+
/**
|
|
2759
|
+
* Get simplified attribute selector for an element.
|
|
2760
|
+
*/ function attributeNodeToSimplifiedSelector(param) {
|
|
2761
|
+
var name = param.name;
|
|
2762
|
+
return "[".concat(name, "]");
|
|
2763
|
+
}
|
|
2764
|
+
/**
|
|
2765
|
+
* Get attribute selector for an element.
|
|
2766
|
+
*/ function attributeNodeToSelector(param) {
|
|
2767
|
+
var name = param.name, value = param.value;
|
|
2768
|
+
return "[".concat(name, "='").concat(value, "']");
|
|
2769
|
+
}
|
|
2770
|
+
/**
|
|
2771
|
+
* Checks whether an attribute should be used as a selector.
|
|
2772
|
+
*/ function isValidAttributeNode(param, element) {
|
|
2773
|
+
var nodeName = param.nodeName, nodeValue = param.nodeValue;
|
|
2774
|
+
// form input value should not be used as a selector
|
|
2775
|
+
var tagName = element.tagName.toLowerCase();
|
|
2776
|
+
if ([
|
|
2777
|
+
"input",
|
|
2778
|
+
"option"
|
|
2779
|
+
].includes(tagName) && nodeName === "value") {
|
|
2780
|
+
return false;
|
|
2781
|
+
}
|
|
2782
|
+
// ignore Base64-encoded strings as 'src' attribute values (e.g. in tags like img, audio, video, iframe, object, embed).
|
|
2783
|
+
if (nodeName === "src" && (nodeValue === null || nodeValue === void 0 ? void 0 : nodeValue.startsWith("data:"))) {
|
|
2784
|
+
return false;
|
|
2785
|
+
}
|
|
2786
|
+
return !attributeBlacklistMatch(nodeName);
|
|
2787
|
+
}
|
|
2788
|
+
/**
|
|
2789
|
+
* Sanitize all attribute data. We want to do it once, before we start to generate simplified/full selectors from the same data.
|
|
2790
|
+
*/ function sanitizeAttributeData(param) {
|
|
2791
|
+
var nodeName = param.nodeName, nodeValue = param.nodeValue;
|
|
2792
|
+
return {
|
|
2793
|
+
name: sanitizeSelectorItem(nodeName),
|
|
2794
|
+
value: sanitizeSelectorItem(nodeValue !== null && nodeValue !== void 0 ? nodeValue : undefined)
|
|
2795
|
+
};
|
|
2796
|
+
}
|
|
2797
|
+
/**
|
|
2798
|
+
* Get attribute selectors for an element.
|
|
2799
|
+
*/ function getElementAttributeSelectors(element) {
|
|
2800
|
+
var validAttributes = Array.from(element.attributes).filter(function(attributeNode) {
|
|
2801
|
+
return isValidAttributeNode(attributeNode, element);
|
|
2802
|
+
}).map(sanitizeAttributeData);
|
|
2803
|
+
return _to_consumable_array$5(validAttributes.map(attributeNodeToSimplifiedSelector)).concat(_to_consumable_array$5(validAttributes.map(attributeNodeToSelector)));
|
|
2804
|
+
}
|
|
2805
|
+
/**
|
|
2806
|
+
* Get attribute selectors matching all elements.
|
|
2807
|
+
*/ function getAttributeSelectors(elements) {
|
|
2808
|
+
var elementSelectors = elements.map(getElementAttributeSelectors);
|
|
2809
|
+
return getIntersection(elementSelectors);
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2812
|
+
/**
|
|
2813
|
+
* Get class selectors for an element.
|
|
2814
|
+
*/ function getElementClassSelectors(element) {
|
|
2815
|
+
var _a;
|
|
2816
|
+
return ((_a = element.getAttribute("class")) !== null && _a !== void 0 ? _a : "").trim().split(/\s+/).filter(function(item) {
|
|
2817
|
+
return !INVALID_CLASS_RE.test(item);
|
|
2818
|
+
}).map(function(item) {
|
|
2819
|
+
return ".".concat(sanitizeSelectorItem(item));
|
|
2820
|
+
});
|
|
2821
|
+
}
|
|
2822
|
+
/**
|
|
2823
|
+
* Get class selectors matching all elements.
|
|
2824
|
+
*/ function getClassSelectors(elements) {
|
|
2825
|
+
var elementSelectors = elements.map(getElementClassSelectors);
|
|
2826
|
+
return getIntersection(elementSelectors);
|
|
2827
|
+
}
|
|
2828
|
+
|
|
2829
|
+
/**
|
|
2830
|
+
* Get ID selector for an element.
|
|
2831
|
+
* */ function getElementIdSelectors(element) {
|
|
2832
|
+
var _a;
|
|
2833
|
+
var id = (_a = element.getAttribute("id")) !== null && _a !== void 0 ? _a : "";
|
|
2834
|
+
var selector = "#".concat(sanitizeSelectorItem(id));
|
|
2835
|
+
var rootNode = element.getRootNode({
|
|
2836
|
+
composed: false
|
|
2837
|
+
});
|
|
2838
|
+
return !INVALID_ID_RE.test(id) && testSelector([
|
|
2839
|
+
element
|
|
2840
|
+
], selector, rootNode) ? [
|
|
2841
|
+
selector
|
|
2842
|
+
] : [];
|
|
2843
|
+
}
|
|
2844
|
+
/**
|
|
2845
|
+
* Get ID selector for an element.
|
|
2846
|
+
*/ function getIdSelector(elements) {
|
|
2847
|
+
return elements.length === 0 || elements.length > 1 ? [] : getElementIdSelectors(elements[0]);
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2850
|
+
/**
|
|
2851
|
+
* Get nth-child selector for an element.
|
|
2852
|
+
*/ function getElementNthChildSelector(element) {
|
|
2853
|
+
var parent = element.parentNode;
|
|
2854
|
+
if (parent) {
|
|
2855
|
+
var siblings = Array.from(parent.childNodes).filter(isElement);
|
|
2856
|
+
var elementIndex = siblings.indexOf(element);
|
|
2857
|
+
if (elementIndex > -1) {
|
|
2858
|
+
return [
|
|
2859
|
+
":nth-child(".concat(String(elementIndex + 1), ")")
|
|
2860
|
+
];
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
return [];
|
|
2864
|
+
}
|
|
2865
|
+
/**
|
|
2866
|
+
* Get nth-child selector matching all elements.
|
|
2867
|
+
*/ function getNthChildSelector(elements) {
|
|
2868
|
+
return getIntersection(elements.map(getElementNthChildSelector));
|
|
2869
|
+
}
|
|
2870
|
+
|
|
2871
|
+
function _array_like_to_array$5(arr, len) {
|
|
2872
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
2873
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
2874
|
+
return arr2;
|
|
2875
|
+
}
|
|
2876
|
+
function _array_without_holes$4(arr) {
|
|
2877
|
+
if (Array.isArray(arr)) return _array_like_to_array$5(arr);
|
|
2878
|
+
}
|
|
2879
|
+
function _iterable_to_array$4(iter) {
|
|
2880
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
2881
|
+
}
|
|
2882
|
+
function _non_iterable_spread$4() {
|
|
2883
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2884
|
+
}
|
|
2885
|
+
function _to_consumable_array$4(arr) {
|
|
2886
|
+
return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$4();
|
|
2887
|
+
}
|
|
2888
|
+
function _unsupported_iterable_to_array$5(o, minLen) {
|
|
2889
|
+
if (!o) return;
|
|
2890
|
+
if (typeof o === "string") return _array_like_to_array$5(o, minLen);
|
|
2891
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2892
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
2893
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
2894
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
|
|
2895
|
+
}
|
|
2896
|
+
/**
|
|
2897
|
+
* Get tag selector for an element.
|
|
2898
|
+
*/ function getElementTagSelectors(element) {
|
|
2899
|
+
return [
|
|
2900
|
+
sanitizeSelectorItem(element.tagName.toLowerCase())
|
|
2901
|
+
];
|
|
2902
|
+
}
|
|
2903
|
+
/**
|
|
2904
|
+
* Get tag selector for list of elements.
|
|
2905
|
+
*/ function getTagSelector(elements) {
|
|
2906
|
+
var selectors = _to_consumable_array$4(new Set(flattenArray(elements.map(getElementTagSelectors))));
|
|
2907
|
+
return selectors.length === 0 || selectors.length > 1 ? [] : [
|
|
2908
|
+
selectors[0]
|
|
2909
|
+
];
|
|
2910
|
+
}
|
|
2911
|
+
|
|
2912
|
+
/**
|
|
2913
|
+
* Get nth-of-type selector for an element.
|
|
2914
|
+
*/ function getElementNthOfTypeSelector(element) {
|
|
2915
|
+
var tag = getTagSelector([
|
|
2916
|
+
element
|
|
2917
|
+
])[0];
|
|
2918
|
+
var parentElement = element.parentElement;
|
|
2919
|
+
if (parentElement) {
|
|
2920
|
+
var siblings = Array.from(parentElement.children).filter(function(element) {
|
|
2921
|
+
return element.tagName.toLowerCase() === tag;
|
|
2922
|
+
});
|
|
2923
|
+
var elementIndex = siblings.indexOf(element);
|
|
2924
|
+
if (elementIndex > -1) {
|
|
2925
|
+
return [
|
|
2926
|
+
"".concat(tag, ":nth-of-type(").concat(String(elementIndex + 1), ")")
|
|
2927
|
+
];
|
|
2928
|
+
}
|
|
2929
|
+
}
|
|
2930
|
+
return [];
|
|
2931
|
+
}
|
|
2932
|
+
/**
|
|
2933
|
+
* Get Nth-of-type selector matching all elements.
|
|
2934
|
+
*/ function getNthOfTypeSelector(elements) {
|
|
2935
|
+
return getIntersection(elements.map(getElementNthOfTypeSelector));
|
|
2936
|
+
}
|
|
2937
|
+
|
|
2938
|
+
function _array_like_to_array$4(arr, len) {
|
|
2939
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
2940
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
2941
|
+
return arr2;
|
|
2942
|
+
}
|
|
2943
|
+
function _array_without_holes$3(arr) {
|
|
2944
|
+
if (Array.isArray(arr)) return _array_like_to_array$4(arr);
|
|
2945
|
+
}
|
|
2946
|
+
function _iterable_to_array$3(iter) {
|
|
2947
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
2948
|
+
}
|
|
2949
|
+
function _non_iterable_spread$3() {
|
|
2950
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2951
|
+
}
|
|
2952
|
+
function _to_consumable_array$3(arr) {
|
|
2953
|
+
return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$3();
|
|
2954
|
+
}
|
|
2955
|
+
function _unsupported_iterable_to_array$4(o, minLen) {
|
|
2956
|
+
if (!o) return;
|
|
2957
|
+
if (typeof o === "string") return _array_like_to_array$4(o, minLen);
|
|
2958
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2959
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
2960
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
2961
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
|
|
2962
|
+
}
|
|
2963
|
+
function _ts_generator(thisArg, body) {
|
|
2964
|
+
var f, y, t, g, _ = {
|
|
2965
|
+
label: 0,
|
|
2966
|
+
sent: function() {
|
|
2967
|
+
if (t[0] & 1) throw t[1];
|
|
2968
|
+
return t[1];
|
|
2969
|
+
},
|
|
2970
|
+
trys: [],
|
|
2971
|
+
ops: []
|
|
2972
|
+
};
|
|
2973
|
+
return g = {
|
|
2974
|
+
next: verb(0),
|
|
2975
|
+
"throw": verb(1),
|
|
2976
|
+
"return": verb(2)
|
|
2977
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
2978
|
+
return this;
|
|
2979
|
+
}), g;
|
|
2980
|
+
function verb(n) {
|
|
2981
|
+
return function(v) {
|
|
2982
|
+
return step([
|
|
2983
|
+
n,
|
|
2984
|
+
v
|
|
2985
|
+
]);
|
|
2986
|
+
};
|
|
2987
|
+
}
|
|
2988
|
+
function step(op) {
|
|
2989
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
2990
|
+
while(_)try {
|
|
2991
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
2992
|
+
if (y = 0, t) op = [
|
|
2993
|
+
op[0] & 2,
|
|
2994
|
+
t.value
|
|
2995
|
+
];
|
|
2996
|
+
switch(op[0]){
|
|
2997
|
+
case 0:
|
|
2998
|
+
case 1:
|
|
2999
|
+
t = op;
|
|
3000
|
+
break;
|
|
3001
|
+
case 4:
|
|
3002
|
+
_.label++;
|
|
3003
|
+
return {
|
|
3004
|
+
value: op[1],
|
|
3005
|
+
done: false
|
|
3006
|
+
};
|
|
3007
|
+
case 5:
|
|
3008
|
+
_.label++;
|
|
3009
|
+
y = op[1];
|
|
3010
|
+
op = [
|
|
3011
|
+
0
|
|
3012
|
+
];
|
|
3013
|
+
continue;
|
|
3014
|
+
case 7:
|
|
3015
|
+
op = _.ops.pop();
|
|
3016
|
+
_.trys.pop();
|
|
3017
|
+
continue;
|
|
3018
|
+
default:
|
|
3019
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
3020
|
+
_ = 0;
|
|
3021
|
+
continue;
|
|
3022
|
+
}
|
|
3023
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
3024
|
+
_.label = op[1];
|
|
3025
|
+
break;
|
|
3026
|
+
}
|
|
3027
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
3028
|
+
_.label = t[1];
|
|
3029
|
+
t = op;
|
|
3030
|
+
break;
|
|
3031
|
+
}
|
|
3032
|
+
if (t && _.label < t[2]) {
|
|
3033
|
+
_.label = t[2];
|
|
3034
|
+
_.ops.push(op);
|
|
3035
|
+
break;
|
|
3036
|
+
}
|
|
3037
|
+
if (t[2]) _.ops.pop();
|
|
3038
|
+
_.trys.pop();
|
|
3039
|
+
continue;
|
|
3040
|
+
}
|
|
3041
|
+
op = body.call(thisArg, _);
|
|
3042
|
+
} catch (e) {
|
|
3043
|
+
op = [
|
|
3044
|
+
6,
|
|
3045
|
+
e
|
|
3046
|
+
];
|
|
3047
|
+
y = 0;
|
|
3048
|
+
} finally{
|
|
3049
|
+
f = t = 0;
|
|
3050
|
+
}
|
|
3051
|
+
if (op[0] & 5) throw op[1];
|
|
3052
|
+
return {
|
|
3053
|
+
value: op[0] ? op[1] : void 0,
|
|
3054
|
+
done: true
|
|
3055
|
+
};
|
|
3056
|
+
}
|
|
3057
|
+
}
|
|
3058
|
+
function powerSetGenerator() {
|
|
3059
|
+
var input, _ref, _ref_maxResults, maxResults, resultCounter, offsets, result;
|
|
3060
|
+
var _arguments = arguments;
|
|
3061
|
+
return _ts_generator(this, function(_state) {
|
|
3062
|
+
switch(_state.label){
|
|
3063
|
+
case 0:
|
|
3064
|
+
input = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : [], _ref = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, _ref_maxResults = _ref.maxResults, maxResults = _ref_maxResults === void 0 ? Number.POSITIVE_INFINITY : _ref_maxResults;
|
|
3065
|
+
resultCounter = 0;
|
|
3066
|
+
offsets = generateOffsets(1);
|
|
3067
|
+
_state.label = 1;
|
|
3068
|
+
case 1:
|
|
3069
|
+
if (!(offsets.length <= input.length && resultCounter < maxResults)) return [
|
|
3070
|
+
3,
|
|
3071
|
+
3
|
|
3072
|
+
];
|
|
3073
|
+
resultCounter += 1;
|
|
3074
|
+
result = offsets.map(function(offset) {
|
|
3075
|
+
return input[offset];
|
|
3076
|
+
});
|
|
3077
|
+
return [
|
|
3078
|
+
4,
|
|
3079
|
+
result
|
|
3080
|
+
];
|
|
3081
|
+
case 2:
|
|
3082
|
+
_state.sent();
|
|
3083
|
+
offsets = bumpOffsets(offsets, input.length - 1);
|
|
3084
|
+
return [
|
|
3085
|
+
3,
|
|
3086
|
+
1
|
|
3087
|
+
];
|
|
3088
|
+
case 3:
|
|
3089
|
+
return [
|
|
3090
|
+
2
|
|
3091
|
+
];
|
|
3092
|
+
}
|
|
3093
|
+
});
|
|
3094
|
+
}
|
|
3095
|
+
/**
|
|
3096
|
+
* Generates power set of input items.
|
|
3097
|
+
*/ function getPowerSet() {
|
|
3098
|
+
var input = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ref_maxResults = _ref.maxResults, maxResults = _ref_maxResults === void 0 ? Number.POSITIVE_INFINITY : _ref_maxResults;
|
|
3099
|
+
return Array.from(powerSetGenerator(input, {
|
|
3100
|
+
maxResults: maxResults
|
|
3101
|
+
}));
|
|
3102
|
+
}
|
|
3103
|
+
/**
|
|
3104
|
+
* Helper function used by `getPowerSet`. Updates internal pointers.
|
|
3105
|
+
*/ function bumpOffsets() {
|
|
3106
|
+
var offsets = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], maxValue = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
3107
|
+
var size = offsets.length;
|
|
3108
|
+
if (size === 0) {
|
|
3109
|
+
return [];
|
|
3110
|
+
}
|
|
3111
|
+
var result = _to_consumable_array$3(offsets);
|
|
3112
|
+
result[size - 1] += 1;
|
|
3113
|
+
for(var index = size - 1; index >= 0; index--){
|
|
3114
|
+
if (result[index] > maxValue) {
|
|
3115
|
+
if (index === 0) {
|
|
3116
|
+
return generateOffsets(size + 1);
|
|
3117
|
+
} else {
|
|
3118
|
+
result[index - 1]++;
|
|
3119
|
+
result[index] = result[index - 1] + 1;
|
|
3120
|
+
}
|
|
3121
|
+
}
|
|
3122
|
+
}
|
|
3123
|
+
if (result[size - 1] > maxValue) {
|
|
3124
|
+
return generateOffsets(size + 1);
|
|
3125
|
+
}
|
|
3126
|
+
return result;
|
|
3127
|
+
}
|
|
3128
|
+
/**
|
|
3129
|
+
* Generates array of size N, filled with numbers sequence starting from 0.
|
|
3130
|
+
*/ function generateOffsets() {
|
|
3131
|
+
var size = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1;
|
|
3132
|
+
return Array.from(Array(size).keys());
|
|
3133
|
+
}
|
|
3134
|
+
|
|
3135
|
+
/**
|
|
3136
|
+
* Generates cartesian product out of input object.
|
|
3137
|
+
*/ function _array_like_to_array$3(arr, len) {
|
|
3138
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3139
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
3140
|
+
return arr2;
|
|
3141
|
+
}
|
|
3142
|
+
function _array_with_holes(arr) {
|
|
3143
|
+
if (Array.isArray(arr)) return arr;
|
|
3144
|
+
}
|
|
3145
|
+
function _define_property(obj, key, value) {
|
|
3146
|
+
if (key in obj) {
|
|
3147
|
+
Object.defineProperty(obj, key, {
|
|
3148
|
+
value: value,
|
|
3149
|
+
enumerable: true,
|
|
3150
|
+
configurable: true,
|
|
3151
|
+
writable: true
|
|
3152
|
+
});
|
|
3153
|
+
} else {
|
|
3154
|
+
obj[key] = value;
|
|
3155
|
+
}
|
|
3156
|
+
return obj;
|
|
3157
|
+
}
|
|
3158
|
+
function _iterable_to_array_limit(arr, i) {
|
|
3159
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
3160
|
+
if (_i == null) return;
|
|
3161
|
+
var _arr = [];
|
|
3162
|
+
var _n = true;
|
|
3163
|
+
var _d = false;
|
|
3164
|
+
var _s, _e;
|
|
3165
|
+
try {
|
|
3166
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
3167
|
+
_arr.push(_s.value);
|
|
3168
|
+
if (i && _arr.length === i) break;
|
|
3169
|
+
}
|
|
3170
|
+
} catch (err) {
|
|
3171
|
+
_d = true;
|
|
3172
|
+
_e = err;
|
|
3173
|
+
} finally{
|
|
3174
|
+
try {
|
|
3175
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
3176
|
+
} finally{
|
|
3177
|
+
if (_d) throw _e;
|
|
3178
|
+
}
|
|
3179
|
+
}
|
|
3180
|
+
return _arr;
|
|
3181
|
+
}
|
|
3182
|
+
function _non_iterable_rest() {
|
|
3183
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3184
|
+
}
|
|
3185
|
+
function _sliced_to_array(arr, i) {
|
|
3186
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest();
|
|
3187
|
+
}
|
|
3188
|
+
function _unsupported_iterable_to_array$3(o, minLen) {
|
|
3189
|
+
if (!o) return;
|
|
3190
|
+
if (typeof o === "string") return _array_like_to_array$3(o, minLen);
|
|
3191
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3192
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3193
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
3194
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
|
|
3195
|
+
}
|
|
3196
|
+
function getCartesianProduct() {
|
|
3197
|
+
var input = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
3198
|
+
var result = [];
|
|
3199
|
+
Object.entries(input).forEach(function(param) {
|
|
3200
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], values = _param[1];
|
|
3201
|
+
result = values.flatMap(function(value) {
|
|
3202
|
+
if (result.length === 0) {
|
|
3203
|
+
return [
|
|
3204
|
+
_define_property({}, key, value)
|
|
3205
|
+
];
|
|
3206
|
+
} else {
|
|
3207
|
+
return result.map(function(memo) {
|
|
3208
|
+
return Object.assign(Object.assign({}, memo), _define_property({}, key, value));
|
|
3209
|
+
});
|
|
3210
|
+
}
|
|
3211
|
+
});
|
|
3212
|
+
});
|
|
3213
|
+
return result;
|
|
3214
|
+
}
|
|
3215
|
+
|
|
3216
|
+
function _array_like_to_array$2(arr, len) {
|
|
3217
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3218
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
3219
|
+
return arr2;
|
|
3220
|
+
}
|
|
3221
|
+
function _array_without_holes$2(arr) {
|
|
3222
|
+
if (Array.isArray(arr)) return _array_like_to_array$2(arr);
|
|
3223
|
+
}
|
|
3224
|
+
function _instanceof(left, right) {
|
|
3225
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
3226
|
+
return !!right[Symbol.hasInstance](left);
|
|
3227
|
+
} else {
|
|
3228
|
+
return left instanceof right;
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3231
|
+
function _iterable_to_array$2(iter) {
|
|
3232
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
3233
|
+
}
|
|
3234
|
+
function _non_iterable_spread$2() {
|
|
3235
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3236
|
+
}
|
|
3237
|
+
function _to_consumable_array$2(arr) {
|
|
3238
|
+
return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread$2();
|
|
3239
|
+
}
|
|
3240
|
+
function _unsupported_iterable_to_array$2(o, minLen) {
|
|
3241
|
+
if (!o) return;
|
|
3242
|
+
if (typeof o === "string") return _array_like_to_array$2(o, minLen);
|
|
3243
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3244
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3245
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
3246
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
|
|
3247
|
+
}
|
|
3248
|
+
var ESCAPED_COLON = ":".charCodeAt(0).toString(16).toUpperCase();
|
|
3249
|
+
// Square brackets need to be escaped, but eslint has a problem with that.
|
|
3250
|
+
/* eslint-disable-next-line no-useless-escape */ var SPECIAL_CHARACTERS_RE = /[ !"#$%&'()\[\]{|}<>*+,./;=?@^`~\\]/;
|
|
3251
|
+
/**
|
|
3252
|
+
* Escapes special characters used by CSS selector items.
|
|
3253
|
+
*/ function sanitizeSelectorItem() {
|
|
3254
|
+
var input = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
3255
|
+
// This should not be necessary, but just to be sure, let's keep the legacy sanitizer in place, for backwards compatibility.
|
|
3256
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
3257
|
+
return CSS ? CSS.escape(input) : legacySanitizeSelectorItem(input);
|
|
3258
|
+
}
|
|
3259
|
+
/**
|
|
3260
|
+
* Legacy version of escaping utility, originally used for IE11-. Should
|
|
3261
|
+
* probably be replaced by a polyfill:
|
|
3262
|
+
* https://github.com/mathiasbynens/CSS.escape
|
|
3263
|
+
*/ function legacySanitizeSelectorItem() {
|
|
3264
|
+
var input = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
3265
|
+
return input.split("").map(function(character) {
|
|
3266
|
+
if (character === ":") {
|
|
3267
|
+
return "\\".concat(ESCAPED_COLON, " ");
|
|
3268
|
+
}
|
|
3269
|
+
if (SPECIAL_CHARACTERS_RE.test(character)) {
|
|
3270
|
+
return "\\".concat(character);
|
|
3271
|
+
}
|
|
3272
|
+
// needed for backwards compatibility
|
|
3273
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
3274
|
+
return escape(character).replace(/%/g, "\\");
|
|
3275
|
+
}).join("");
|
|
3276
|
+
}
|
|
3277
|
+
var SELECTOR_TYPE_GETTERS = {
|
|
3278
|
+
tag: getTagSelector,
|
|
3279
|
+
id: getIdSelector,
|
|
3280
|
+
class: getClassSelectors,
|
|
3281
|
+
attribute: getAttributeSelectors,
|
|
3282
|
+
nthchild: getNthChildSelector,
|
|
3283
|
+
nthoftype: getNthOfTypeSelector
|
|
3284
|
+
};
|
|
3285
|
+
var ELEMENT_SELECTOR_TYPE_GETTERS = {
|
|
3286
|
+
tag: getElementTagSelectors,
|
|
3287
|
+
id: getElementIdSelectors,
|
|
3288
|
+
class: getElementClassSelectors,
|
|
3289
|
+
attribute: getElementAttributeSelectors,
|
|
3290
|
+
nthchild: getElementNthChildSelector,
|
|
3291
|
+
nthoftype: getElementNthOfTypeSelector
|
|
3292
|
+
};
|
|
3293
|
+
/**
|
|
3294
|
+
* Creates selector of given type for single element.
|
|
3295
|
+
*/ function getElementSelectorsByType(element, selectorType) {
|
|
3296
|
+
return ELEMENT_SELECTOR_TYPE_GETTERS[selectorType](element);
|
|
3297
|
+
}
|
|
3298
|
+
/**
|
|
3299
|
+
* Returns list of selectors of given type for the element.
|
|
3300
|
+
*/ function getSelectorsByType(elements, selector_type) {
|
|
3301
|
+
var getter = SELECTOR_TYPE_GETTERS[selector_type];
|
|
3302
|
+
return getter(elements);
|
|
3303
|
+
}
|
|
3304
|
+
/**
|
|
3305
|
+
* Remove blacklisted selectors from list.
|
|
3306
|
+
*/ function filterSelectors() {
|
|
3307
|
+
var list = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], matchBlacklist = arguments.length > 1 ? arguments[1] : void 0, matchWhitelist = arguments.length > 2 ? arguments[2] : void 0;
|
|
3308
|
+
return list.filter(function(item) {
|
|
3309
|
+
return matchWhitelist(item) || !matchBlacklist(item);
|
|
3310
|
+
});
|
|
3311
|
+
}
|
|
3312
|
+
/**
|
|
3313
|
+
* Prioritise whitelisted selectors in list.
|
|
3314
|
+
*/ function orderSelectors() {
|
|
3315
|
+
var list = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], matchWhitelist = arguments.length > 1 ? arguments[1] : void 0;
|
|
3316
|
+
return list.sort(function(a, b) {
|
|
3317
|
+
var a_is_whitelisted = matchWhitelist(a);
|
|
3318
|
+
var b_is_whitelisted = matchWhitelist(b);
|
|
3319
|
+
if (a_is_whitelisted && !b_is_whitelisted) {
|
|
3320
|
+
return -1;
|
|
3321
|
+
}
|
|
3322
|
+
if (!a_is_whitelisted && b_is_whitelisted) {
|
|
3323
|
+
return 1;
|
|
3324
|
+
}
|
|
3325
|
+
return 0;
|
|
3326
|
+
});
|
|
3327
|
+
}
|
|
3328
|
+
/**
|
|
3329
|
+
* Returns list of unique selectors applicable to given element.
|
|
3330
|
+
*/ function getAllSelectors(elements, root, options) {
|
|
3331
|
+
var selectors_list = getSelectorsList(elements, options);
|
|
3332
|
+
var type_combinations = getTypeCombinations(selectors_list, options);
|
|
3333
|
+
var all_selectors = flattenArray(type_combinations);
|
|
3334
|
+
return _to_consumable_array$2(new Set(all_selectors));
|
|
3335
|
+
}
|
|
3336
|
+
/**
|
|
3337
|
+
* Creates object containing all selector types and their potential values.
|
|
3338
|
+
*/ function getSelectorsList(elements, options) {
|
|
3339
|
+
var blacklist = options.blacklist, whitelist = options.whitelist, combineWithinSelector = options.combineWithinSelector, maxCombinations = options.maxCombinations;
|
|
3340
|
+
var matchBlacklist = createPatternMatcher(blacklist);
|
|
3341
|
+
var matchWhitelist = createPatternMatcher(whitelist);
|
|
3342
|
+
var reducer = function(data, selector_type) {
|
|
3343
|
+
var selectors_by_type = getSelectorsByType(elements, selector_type);
|
|
3344
|
+
var filtered_selectors = filterSelectors(selectors_by_type, matchBlacklist, matchWhitelist);
|
|
3345
|
+
var found_selectors = orderSelectors(filtered_selectors, matchWhitelist);
|
|
3346
|
+
data[selector_type] = combineWithinSelector ? getPowerSet(found_selectors, {
|
|
3347
|
+
maxResults: maxCombinations
|
|
3348
|
+
}) : found_selectors.map(function(item) {
|
|
3349
|
+
return [
|
|
3350
|
+
item
|
|
3351
|
+
];
|
|
3352
|
+
});
|
|
3353
|
+
return data;
|
|
3354
|
+
};
|
|
3355
|
+
return getSelectorsToGet(options).reduce(reducer, {});
|
|
3356
|
+
}
|
|
3357
|
+
/**
|
|
3358
|
+
* Creates list of selector types that we will need to generate the selector.
|
|
3359
|
+
*/ function getSelectorsToGet(options) {
|
|
3360
|
+
var selectors = options.selectors, includeTag = options.includeTag;
|
|
3361
|
+
var selectors_to_get = _to_consumable_array$2(selectors);
|
|
3362
|
+
if (includeTag && !selectors_to_get.includes("tag")) {
|
|
3363
|
+
selectors_to_get.push("tag");
|
|
3364
|
+
}
|
|
3365
|
+
return selectors_to_get;
|
|
3366
|
+
}
|
|
3367
|
+
/**
|
|
3368
|
+
* Adds "tag" to a list, if it does not contain it. Used to modify selectors
|
|
3369
|
+
* list when includeTag option is enabled to make sure all results contain the
|
|
3370
|
+
* TAG part.
|
|
3371
|
+
*/ function addTagTypeIfNeeded(list) {
|
|
3372
|
+
return list.includes(CSS_SELECTOR_TYPE.tag) || list.includes(CSS_SELECTOR_TYPE.nthoftype) ? _to_consumable_array$2(list) : _to_consumable_array$2(list).concat([
|
|
3373
|
+
CSS_SELECTOR_TYPE.tag
|
|
3374
|
+
]);
|
|
3375
|
+
}
|
|
3376
|
+
/**
|
|
3377
|
+
* Generates list of possible selector type combinations.
|
|
3378
|
+
*/ function combineSelectorTypes(options) {
|
|
3379
|
+
var selectors = options.selectors, combineBetweenSelectors = options.combineBetweenSelectors, includeTag = options.includeTag, maxCandidates = options.maxCandidates;
|
|
3380
|
+
var combinations = combineBetweenSelectors ? getPowerSet(selectors, {
|
|
3381
|
+
maxResults: maxCandidates
|
|
3382
|
+
}) : selectors.map(function(item) {
|
|
3383
|
+
return [
|
|
3384
|
+
item
|
|
3385
|
+
];
|
|
3386
|
+
});
|
|
3387
|
+
return includeTag ? combinations.map(addTagTypeIfNeeded) : combinations;
|
|
3388
|
+
}
|
|
3389
|
+
/**
|
|
3390
|
+
* Generates list of combined CSS selectors.
|
|
3391
|
+
*/ function getTypeCombinations(selectors_list, options) {
|
|
3392
|
+
return combineSelectorTypes(options).map(function(item) {
|
|
3393
|
+
return constructSelectors(item, selectors_list);
|
|
3394
|
+
}).filter(function(item) {
|
|
3395
|
+
return item.length > 0;
|
|
3396
|
+
});
|
|
3397
|
+
}
|
|
3398
|
+
/**
|
|
3399
|
+
* Generates all variations of possible selectors from provided data.
|
|
3400
|
+
*/ function constructSelectors(selector_types, selectors_by_type) {
|
|
3401
|
+
var data = {};
|
|
3402
|
+
selector_types.forEach(function(selector_type) {
|
|
3403
|
+
var selector_variants = selectors_by_type[selector_type];
|
|
3404
|
+
if (selector_variants && selector_variants.length > 0) {
|
|
3405
|
+
data[selector_type] = selector_variants;
|
|
3406
|
+
}
|
|
3407
|
+
});
|
|
3408
|
+
var combinations = getCartesianProduct(data);
|
|
3409
|
+
return combinations.map(constructSelector);
|
|
3410
|
+
}
|
|
3411
|
+
/**
|
|
3412
|
+
* Creates selector for given selector type. Combines several parts if needed.
|
|
3413
|
+
*/ function constructSelectorType(selector_type, selectors_data) {
|
|
3414
|
+
return selectors_data[selector_type] ? selectors_data[selector_type].join("") : "";
|
|
3415
|
+
}
|
|
3416
|
+
/**
|
|
3417
|
+
* Converts selector data object to a selector.
|
|
3418
|
+
*/ function constructSelector() {
|
|
3419
|
+
var selectorData = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
3420
|
+
var pattern = _to_consumable_array$2(SELECTOR_PATTERN);
|
|
3421
|
+
// selector "nthoftype" already contains "tag"
|
|
3422
|
+
if (selectorData[CSS_SELECTOR_TYPE.tag] && selectorData[CSS_SELECTOR_TYPE.nthoftype]) {
|
|
3423
|
+
pattern.splice(pattern.indexOf(CSS_SELECTOR_TYPE.tag), 1);
|
|
3424
|
+
}
|
|
3425
|
+
return pattern.map(function(type) {
|
|
3426
|
+
return constructSelectorType(type, selectorData);
|
|
3427
|
+
}).join("");
|
|
3428
|
+
}
|
|
3429
|
+
/**
|
|
3430
|
+
* Generates combinations of child and descendant selectors within root
|
|
3431
|
+
* selector.
|
|
3432
|
+
*/ function generateCandidateCombinations(selectors, rootSelector) {
|
|
3433
|
+
return _to_consumable_array$2(selectors.map(function(selector) {
|
|
3434
|
+
return rootSelector + OPERATOR.DESCENDANT + selector;
|
|
3435
|
+
})).concat(_to_consumable_array$2(selectors.map(function(selector) {
|
|
3436
|
+
return rootSelector + OPERATOR.CHILD + selector;
|
|
3437
|
+
})));
|
|
3438
|
+
}
|
|
3439
|
+
/**
|
|
3440
|
+
* Generates a list of selector candidates that can potentially match target
|
|
3441
|
+
* element.
|
|
3442
|
+
*/ function generateCandidates(selectors, rootSelector) {
|
|
3443
|
+
return rootSelector === "" ? selectors : generateCandidateCombinations(selectors, rootSelector);
|
|
3444
|
+
}
|
|
3445
|
+
/**
|
|
3446
|
+
* Tries to find a unique CSS selector for element within given parent.
|
|
3447
|
+
*/ function getSelectorWithinRoot(elements, root) {
|
|
3448
|
+
var rootSelector = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "", options = arguments.length > 3 ? arguments[3] : void 0;
|
|
3449
|
+
var elementSelectors = getAllSelectors(elements, root, options);
|
|
3450
|
+
var selectorCandidates = generateCandidates(elementSelectors, rootSelector);
|
|
3451
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3452
|
+
try {
|
|
3453
|
+
for(var _iterator = selectorCandidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3454
|
+
var candidateSelector = _step.value;
|
|
3455
|
+
if (testSelector(elements, candidateSelector, root)) {
|
|
3456
|
+
return candidateSelector;
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3459
|
+
} catch (err) {
|
|
3460
|
+
_didIteratorError = true;
|
|
3461
|
+
_iteratorError = err;
|
|
3462
|
+
} finally{
|
|
3463
|
+
try {
|
|
3464
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
3465
|
+
_iterator.return();
|
|
3466
|
+
}
|
|
3467
|
+
} finally{
|
|
3468
|
+
if (_didIteratorError) {
|
|
3469
|
+
throw _iteratorError;
|
|
3470
|
+
}
|
|
3471
|
+
}
|
|
3472
|
+
}
|
|
3473
|
+
return null;
|
|
3474
|
+
}
|
|
3475
|
+
/**
|
|
3476
|
+
* Climbs through parents of the element and tries to find the one that is
|
|
3477
|
+
* identifiable by unique CSS selector.
|
|
3478
|
+
*/ function getClosestIdentifiableParent(elements, root) {
|
|
3479
|
+
var rootSelector = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "", options = arguments.length > 3 ? arguments[3] : void 0;
|
|
3480
|
+
if (elements.length === 0) {
|
|
3481
|
+
return null;
|
|
3482
|
+
}
|
|
3483
|
+
var candidatesList = [
|
|
3484
|
+
elements.length > 1 ? elements : []
|
|
3485
|
+
].concat(_to_consumable_array$2(getParents(elements, root).map(function(element) {
|
|
3486
|
+
return [
|
|
3487
|
+
element
|
|
3488
|
+
];
|
|
3489
|
+
})));
|
|
3490
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3491
|
+
try {
|
|
3492
|
+
for(var _iterator = candidatesList[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3493
|
+
var currentElements = _step.value;
|
|
3494
|
+
var result = getSelectorWithinRoot(currentElements, root, rootSelector, options);
|
|
3495
|
+
if (result) {
|
|
3496
|
+
return {
|
|
3497
|
+
foundElements: currentElements,
|
|
3498
|
+
selector: result
|
|
3499
|
+
};
|
|
3500
|
+
}
|
|
3501
|
+
}
|
|
3502
|
+
} catch (err) {
|
|
3503
|
+
_didIteratorError = true;
|
|
3504
|
+
_iteratorError = err;
|
|
3505
|
+
} finally{
|
|
3506
|
+
try {
|
|
3507
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
3508
|
+
_iterator.return();
|
|
3509
|
+
}
|
|
3510
|
+
} finally{
|
|
3511
|
+
if (_didIteratorError) {
|
|
3512
|
+
throw _iteratorError;
|
|
3513
|
+
}
|
|
3514
|
+
}
|
|
3515
|
+
}
|
|
3516
|
+
return null;
|
|
3517
|
+
}
|
|
3518
|
+
/**
|
|
3519
|
+
* Converts input into list of elements, removing duplicates and non-elements.
|
|
3520
|
+
*/ function sanitizeSelectorNeedle(needle) {
|
|
3521
|
+
if (_instanceof(needle, NodeList) || _instanceof(needle, HTMLCollection)) {
|
|
3522
|
+
needle = Array.from(needle);
|
|
3523
|
+
}
|
|
3524
|
+
var elements = (Array.isArray(needle) ? needle : [
|
|
3525
|
+
needle
|
|
3526
|
+
]).filter(isElement);
|
|
3527
|
+
return _to_consumable_array$2(new Set(elements));
|
|
3528
|
+
}
|
|
3529
|
+
|
|
3530
|
+
function _array_like_to_array$1(arr, len) {
|
|
3531
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3532
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
3533
|
+
return arr2;
|
|
3534
|
+
}
|
|
3535
|
+
function _array_without_holes$1(arr) {
|
|
3536
|
+
if (Array.isArray(arr)) return _array_like_to_array$1(arr);
|
|
3537
|
+
}
|
|
3538
|
+
function _iterable_to_array$1(iter) {
|
|
3539
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
3540
|
+
}
|
|
3541
|
+
function _non_iterable_spread$1() {
|
|
3542
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3543
|
+
}
|
|
3544
|
+
function _to_consumable_array$1(arr) {
|
|
3545
|
+
return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$1(arr) || _non_iterable_spread$1();
|
|
3546
|
+
}
|
|
3547
|
+
function _unsupported_iterable_to_array$1(o, minLen) {
|
|
3548
|
+
if (!o) return;
|
|
3549
|
+
if (typeof o === "string") return _array_like_to_array$1(o, minLen);
|
|
3550
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3551
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3552
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
3553
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
|
|
3554
|
+
}
|
|
3555
|
+
/**
|
|
3556
|
+
* Creates data describing a specific selector.
|
|
3557
|
+
*/ function createElementSelectorData(selector) {
|
|
3558
|
+
return {
|
|
3559
|
+
value: selector,
|
|
3560
|
+
include: false
|
|
3561
|
+
};
|
|
3562
|
+
}
|
|
3563
|
+
/**
|
|
3564
|
+
* Creates data describing an element within CssSelector chain.
|
|
3565
|
+
*/ function createElementData(element, selectorTypes) {
|
|
3566
|
+
var operator = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : OPERATOR.NONE;
|
|
3567
|
+
var selectors = {};
|
|
3568
|
+
selectorTypes.forEach(function(selectorType) {
|
|
3569
|
+
Reflect.set(selectors, selectorType, getElementSelectorsByType(element, selectorType).map(createElementSelectorData));
|
|
3570
|
+
});
|
|
3571
|
+
return {
|
|
3572
|
+
element: element,
|
|
3573
|
+
operator: operator,
|
|
3574
|
+
selectors: selectors
|
|
3575
|
+
};
|
|
3576
|
+
}
|
|
3577
|
+
/**
|
|
3578
|
+
* Constructs selector from element data.
|
|
3579
|
+
*/ function constructElementSelector(param) {
|
|
3580
|
+
var selectors = param.selectors, operator = param.operator;
|
|
3581
|
+
var pattern = _to_consumable_array$1(SELECTOR_PATTERN);
|
|
3582
|
+
// `nthoftype` already contains tag
|
|
3583
|
+
if (selectors[CSS_SELECTOR_TYPE.tag] && selectors[CSS_SELECTOR_TYPE.nthoftype]) {
|
|
3584
|
+
pattern = pattern.filter(function(item) {
|
|
3585
|
+
return item !== CSS_SELECTOR_TYPE.tag;
|
|
3586
|
+
});
|
|
3587
|
+
}
|
|
3588
|
+
var selector = "";
|
|
3589
|
+
pattern.forEach(function(selectorType) {
|
|
3590
|
+
var _a;
|
|
3591
|
+
var selectorsOfType = (_a = selectors[selectorType]) !== null && _a !== void 0 ? _a : [];
|
|
3592
|
+
selectorsOfType.forEach(function(param) {
|
|
3593
|
+
var value = param.value, include = param.include;
|
|
3594
|
+
if (include) {
|
|
3595
|
+
selector += value;
|
|
3596
|
+
}
|
|
3597
|
+
});
|
|
3598
|
+
});
|
|
3599
|
+
return operator + selector;
|
|
3600
|
+
}
|
|
3601
|
+
|
|
3602
|
+
function _array_like_to_array(arr, len) {
|
|
3603
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3604
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
3605
|
+
return arr2;
|
|
3606
|
+
}
|
|
3607
|
+
function _array_without_holes(arr) {
|
|
3608
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
3609
|
+
}
|
|
3610
|
+
function _iterable_to_array(iter) {
|
|
3611
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
3612
|
+
}
|
|
3613
|
+
function _non_iterable_spread() {
|
|
3614
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3615
|
+
}
|
|
3616
|
+
function _to_consumable_array(arr) {
|
|
3617
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
3618
|
+
}
|
|
3619
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
3620
|
+
if (!o) return;
|
|
3621
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
3622
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3623
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3624
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
3625
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
3626
|
+
}
|
|
3627
|
+
/**
|
|
3628
|
+
* Creates fallback selector for single element.
|
|
3629
|
+
*/ function getElementFallbackSelector(element) {
|
|
3630
|
+
var parentElements = getElementParents(element).reverse();
|
|
3631
|
+
var elementsData = parentElements.map(function(element) {
|
|
3632
|
+
var elementData = createElementData(element, [
|
|
3633
|
+
CSS_SELECTOR_TYPE.nthchild
|
|
3634
|
+
], OPERATOR.CHILD);
|
|
3635
|
+
elementData.selectors.nthchild.forEach(function(selectorData) {
|
|
3636
|
+
selectorData.include = true;
|
|
3637
|
+
});
|
|
3638
|
+
return elementData;
|
|
3639
|
+
});
|
|
3640
|
+
return [
|
|
3641
|
+
":root"
|
|
3642
|
+
].concat(_to_consumable_array(elementsData.map(constructElementSelector))).join("");
|
|
3643
|
+
}
|
|
3644
|
+
/**
|
|
3645
|
+
* Creates chain of :nth-child selectors from root to the elements.
|
|
3646
|
+
*/ function getFallbackSelector(elements) {
|
|
3647
|
+
return elements.map(getElementFallbackSelector).join(SELECTOR_SEPARATOR);
|
|
3648
|
+
}
|
|
3649
|
+
|
|
3650
|
+
/**
|
|
3651
|
+
* Generates unique CSS selector for an element.
|
|
3652
|
+
*/ function getCssSelector$1(needle) {
|
|
3653
|
+
var custom_options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
3654
|
+
var _a;
|
|
3655
|
+
var elements = sanitizeSelectorNeedle(needle);
|
|
3656
|
+
var options = sanitizeOptions(elements[0], custom_options);
|
|
3657
|
+
var root = (_a = options.root) !== null && _a !== void 0 ? _a : getRootNode(elements[0]);
|
|
3658
|
+
var partialSelector = "";
|
|
3659
|
+
var currentRoot = root;
|
|
3660
|
+
/**
|
|
3661
|
+
* Utility function to make subsequent calls shorter.
|
|
3662
|
+
*/ function updateIdentifiableParent() {
|
|
3663
|
+
return getClosestIdentifiableParent(elements, currentRoot, partialSelector, options);
|
|
3664
|
+
}
|
|
3665
|
+
var closestIdentifiableParent = updateIdentifiableParent();
|
|
3666
|
+
while(closestIdentifiableParent){
|
|
3667
|
+
var foundElements = closestIdentifiableParent.foundElements, selector = closestIdentifiableParent.selector;
|
|
3668
|
+
if (testSelector(elements, selector, root)) {
|
|
3669
|
+
return selector;
|
|
3670
|
+
}
|
|
3671
|
+
currentRoot = foundElements[0];
|
|
3672
|
+
partialSelector = selector;
|
|
3673
|
+
closestIdentifiableParent = updateIdentifiableParent();
|
|
3674
|
+
}
|
|
3675
|
+
// if failed to find single selector matching all elements, try to find
|
|
3676
|
+
// selector for each standalone element and join them together
|
|
3677
|
+
if (elements.length > 1) {
|
|
3678
|
+
return elements.map(function(element) {
|
|
3679
|
+
return getCssSelector$1(element, options);
|
|
3680
|
+
}).join(SELECTOR_SEPARATOR);
|
|
3681
|
+
}
|
|
3682
|
+
return getFallbackSelector(elements);
|
|
3683
|
+
}
|
|
3684
|
+
|
|
3685
|
+
function unescapeCSS(cssEscapedString) {
|
|
3686
|
+
return cssEscapedString.replace(/\\([0-9A-Fa-f]{1,6})\s?/g, (_match, charCode)=>String.fromCharCode(parseInt(charCode, 16))).replace(/\\/g, '');
|
|
3687
|
+
}
|
|
3688
|
+
function getCssSelector(element, options = {}) {
|
|
3689
|
+
const selector = getCssSelector$1(element, options);
|
|
3690
|
+
return unescapeCSS(selector);
|
|
3691
|
+
}
|
|
3692
|
+
|
|
3693
|
+
class ElementElement extends r$2 {
|
|
3694
|
+
get content() {
|
|
3695
|
+
return this._content;
|
|
3696
|
+
}
|
|
3697
|
+
get value() {
|
|
3698
|
+
return this._value;
|
|
3699
|
+
}
|
|
3700
|
+
loadElement() {
|
|
3701
|
+
const digipairEl = document.querySelector('digipair-chatbot');
|
|
3702
|
+
this.state = 'selecting';
|
|
3703
|
+
digipairEl.closeResult();
|
|
3704
|
+
const unsetCurrentElement = ()=>{
|
|
3705
|
+
document.querySelectorAll('.digipair-input-element-selecting').forEach((el)=>el.classList.remove('digipair-input-element-selecting'));
|
|
3706
|
+
};
|
|
3707
|
+
const keydown = (event)=>{
|
|
3708
|
+
if (event.key === 'Escape' || event.keyCode === 27) {
|
|
3709
|
+
document.removeEventListener('keydown', keydown);
|
|
3710
|
+
document.removeEventListener('click', click);
|
|
3711
|
+
document.removeEventListener('mouseout', mouseout);
|
|
3712
|
+
unsetCurrentElement();
|
|
3713
|
+
this.state = this._value ? 'loaded' : 'unloaded';
|
|
3714
|
+
digipairEl.openResult();
|
|
3715
|
+
}
|
|
3716
|
+
};
|
|
3717
|
+
const click = (event)=>{
|
|
3718
|
+
if (event.target.closest('digipair-chatbot')) {
|
|
3719
|
+
return;
|
|
3720
|
+
}
|
|
3721
|
+
document.removeEventListener('keydown', keydown);
|
|
3722
|
+
document.removeEventListener('click', click);
|
|
3723
|
+
document.removeEventListener('mouseout', mouseout);
|
|
3724
|
+
const selector = document.querySelector('.digipair-input-element-selecting');
|
|
3725
|
+
if (!selector) {
|
|
3726
|
+
this.state = this._value ? 'loaded' : 'unloaded';
|
|
3727
|
+
digipairEl.openResult();
|
|
3728
|
+
return;
|
|
3729
|
+
}
|
|
3730
|
+
this._value = getCssSelector(selector, {
|
|
3731
|
+
blacklist: [
|
|
3732
|
+
'.digipair-input-element-selecting'
|
|
3733
|
+
]
|
|
3734
|
+
});
|
|
3735
|
+
this._content = `> $(${this._value})`;
|
|
3736
|
+
this.state = 'loaded';
|
|
3737
|
+
unsetCurrentElement();
|
|
3738
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
3739
|
+
detail: {
|
|
3740
|
+
value: this.value
|
|
3741
|
+
}
|
|
3742
|
+
}));
|
|
3743
|
+
setTimeout(()=>{
|
|
3744
|
+
digipairEl.openResult();
|
|
3745
|
+
}, 1);
|
|
3746
|
+
};
|
|
3747
|
+
const mouseout = (event)=>{
|
|
3748
|
+
var _event_target_closest;
|
|
3749
|
+
if (event.target.closest('digipair-chatbot')) {
|
|
3750
|
+
return;
|
|
3751
|
+
}
|
|
3752
|
+
unsetCurrentElement();
|
|
3753
|
+
(_event_target_closest = event.target.closest(this.filter)) == null ? void 0 : _event_target_closest.classList.add('digipair-input-element-selecting');
|
|
3754
|
+
this.requestUpdate();
|
|
3755
|
+
};
|
|
3756
|
+
document.addEventListener('keydown', keydown);
|
|
3757
|
+
document.addEventListener('click', click);
|
|
3758
|
+
document.addEventListener('mouseout', mouseout);
|
|
3759
|
+
}
|
|
3760
|
+
addSelectingStyle() {
|
|
3761
|
+
if (document.querySelector('#digipair-input-element-style')) {
|
|
3762
|
+
return;
|
|
3763
|
+
}
|
|
3764
|
+
const style = document.createElement('style');
|
|
3765
|
+
style.setAttribute('id', 'digipair-input-element-style');
|
|
3766
|
+
style.innerHTML = `
|
|
3767
|
+
.digipair-input-element-selecting {
|
|
3768
|
+
border: 1px dashed rgb(153, 153, 153) !important;
|
|
3769
|
+
}
|
|
3770
|
+
`;
|
|
3771
|
+
document.body.append(style);
|
|
3772
|
+
}
|
|
3773
|
+
connectedCallback() {
|
|
3774
|
+
super.connectedCallback();
|
|
3775
|
+
this.addSelectingStyle();
|
|
3776
|
+
if (this.selector) {
|
|
3777
|
+
this._value = this.selector;
|
|
3778
|
+
this._content = `> $(${this.selector})`;
|
|
3779
|
+
this.state = 'loaded';
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
render() {
|
|
3783
|
+
return x`
|
|
3784
|
+
<section
|
|
3785
|
+
class="digipair-input ${this.state}"
|
|
3786
|
+
@click=${()=>[
|
|
3787
|
+
'unloaded',
|
|
3788
|
+
'loaded'
|
|
3789
|
+
].indexOf(this.state) >= 0 ? this.loadElement() : void 0}
|
|
3790
|
+
>
|
|
3791
|
+
${this.state === 'loaded' ? x`
|
|
3792
|
+
<ui5-icon name="attachment"></ui5-icon>
|
|
3793
|
+
<p>${this.label}<br />${this._content}</p>
|
|
3794
|
+
` : this.state === 'selecting' ? x` <ui5-icon name="locate-me"></ui5-icon>
|
|
3795
|
+
<p>
|
|
3796
|
+
${this.label}${document.querySelector('.digipair-input-element-selecting') ? x`<br />$(${getCssSelector(document.querySelector('.digipair-input-element-selecting'), {
|
|
3797
|
+
blacklist: [
|
|
3798
|
+
'.digipair-input-element-selecting'
|
|
3799
|
+
]
|
|
3800
|
+
})})` : E}
|
|
3801
|
+
</p>` : x` <ui5-icon name="add-document"></ui5-icon>
|
|
3802
|
+
<p>${this.label}</p>`}
|
|
3803
|
+
</section>
|
|
3804
|
+
`;
|
|
3805
|
+
}
|
|
3806
|
+
constructor(...args){
|
|
3807
|
+
super(...args);
|
|
3808
|
+
this.label = 'Element';
|
|
3809
|
+
this.selector = '';
|
|
3810
|
+
this.filter = '*';
|
|
3811
|
+
this.required = true;
|
|
3812
|
+
this.state = 'unloaded';
|
|
3813
|
+
this._content = 'aucun element selectionne';
|
|
3814
|
+
this._value = '';
|
|
3815
|
+
}
|
|
3816
|
+
}
|
|
3817
|
+
ElementElement.styles = i$3`
|
|
3818
|
+
.digipair-input {
|
|
3819
|
+
padding: 10px 15px;
|
|
3820
|
+
margin-bottom: 10px;
|
|
3821
|
+
line-height: 1.4;
|
|
3822
|
+
border: 1px solid var(--digipair-color-primary, #52dfdb);
|
|
3823
|
+
color: var(--digipair-color-primary, #52dfdb);
|
|
3824
|
+
align-self: flex-start;
|
|
3825
|
+
margin-right: auto;
|
|
3826
|
+
text-align: center;
|
|
3827
|
+
}
|
|
3828
|
+
|
|
3829
|
+
.digipair-input ui5-icon {
|
|
3830
|
+
color: var(--digipair-color-secondary, #52dfdb);
|
|
3831
|
+
}
|
|
3832
|
+
|
|
3833
|
+
.digipair-input.unloaded ui5-icon {
|
|
3834
|
+
color: var(--digipair-color-primary, #52dfdb);
|
|
3835
|
+
}
|
|
3836
|
+
|
|
3837
|
+
.digipair-input p {
|
|
3838
|
+
text-align: center;
|
|
3839
|
+
font-size: 12px;
|
|
3840
|
+
margin: 0;
|
|
3841
|
+
}
|
|
3842
|
+
|
|
3843
|
+
.digipair-input.unloaded {
|
|
3844
|
+
cursor: pointer;
|
|
3845
|
+
}
|
|
3846
|
+
|
|
3847
|
+
.digipair-input.loaded ui5-icon {
|
|
3848
|
+
float: left;
|
|
3849
|
+
}
|
|
3850
|
+
`;
|
|
3851
|
+
__decorate([
|
|
3852
|
+
n()
|
|
3853
|
+
], ElementElement.prototype, "label", void 0);
|
|
3854
|
+
__decorate([
|
|
3855
|
+
n()
|
|
3856
|
+
], ElementElement.prototype, "selector", void 0);
|
|
3857
|
+
__decorate([
|
|
3858
|
+
n()
|
|
3859
|
+
], ElementElement.prototype, "filter", void 0);
|
|
3860
|
+
__decorate([
|
|
3861
|
+
n()
|
|
3862
|
+
], ElementElement.prototype, "required", void 0);
|
|
3863
|
+
__decorate([
|
|
3864
|
+
r()
|
|
3865
|
+
], ElementElement.prototype, "state", void 0);
|
|
3866
|
+
__decorate([
|
|
3867
|
+
r()
|
|
3868
|
+
], ElementElement.prototype, "_content", void 0);
|
|
3869
|
+
ElementElement = __decorate([
|
|
3870
|
+
t('digipair-input-element')
|
|
3871
|
+
], ElementElement);
|
|
3872
|
+
|
|
3873
|
+
class FetchElement extends r$2 {
|
|
3874
|
+
get value() {
|
|
3875
|
+
return this._value;
|
|
3876
|
+
}
|
|
3877
|
+
connectedCallback() {
|
|
3878
|
+
super.connectedCallback();
|
|
3879
|
+
this.initialize();
|
|
3880
|
+
}
|
|
3881
|
+
async initialize() {
|
|
3882
|
+
const response = await fetch(this.url);
|
|
3883
|
+
if (this.type === 'text') {
|
|
3884
|
+
this._value = await response.text();
|
|
3885
|
+
} else if (this.type === 'json') {
|
|
3886
|
+
this._value = await response.json();
|
|
3887
|
+
}
|
|
3888
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
3889
|
+
detail: {
|
|
3890
|
+
value: this.value
|
|
3891
|
+
}
|
|
3892
|
+
}));
|
|
3893
|
+
}
|
|
3894
|
+
render() {
|
|
3895
|
+
return x``;
|
|
3896
|
+
}
|
|
3897
|
+
constructor(...args){
|
|
3898
|
+
super(...args);
|
|
3899
|
+
this.type = 'json';
|
|
3900
|
+
this.required = true;
|
|
3901
|
+
}
|
|
3902
|
+
}
|
|
3903
|
+
__decorate([
|
|
3904
|
+
n(),
|
|
3905
|
+
__metadata("design:type", String)
|
|
3906
|
+
], FetchElement.prototype, "url", void 0);
|
|
3907
|
+
__decorate([
|
|
3908
|
+
n(),
|
|
3909
|
+
__metadata("design:type", String)
|
|
3910
|
+
], FetchElement.prototype, "type", void 0);
|
|
3911
|
+
__decorate([
|
|
3912
|
+
n()
|
|
3913
|
+
], FetchElement.prototype, "required", void 0);
|
|
3914
|
+
FetchElement = __decorate([
|
|
3915
|
+
t('digipair-input-fetch')
|
|
3916
|
+
], FetchElement);
|
|
3917
|
+
|
|
3918
|
+
class HiddenElement extends r$2 {
|
|
3919
|
+
render() {
|
|
3920
|
+
return x``;
|
|
3921
|
+
}
|
|
3922
|
+
constructor(...args){
|
|
3923
|
+
super(...args);
|
|
3924
|
+
this.value = '';
|
|
3925
|
+
this.required = true;
|
|
3926
|
+
}
|
|
3927
|
+
}
|
|
3928
|
+
__decorate([
|
|
3929
|
+
n()
|
|
3930
|
+
], HiddenElement.prototype, "value", void 0);
|
|
3931
|
+
__decorate([
|
|
3932
|
+
n()
|
|
3933
|
+
], HiddenElement.prototype, "required", void 0);
|
|
3934
|
+
HiddenElement = __decorate([
|
|
3935
|
+
t('digipair-input-hidden')
|
|
3936
|
+
], HiddenElement);
|
|
3937
|
+
|
|
3938
|
+
exports.DomAttributeElement = DomAttributeElement;
|
|
3939
|
+
exports.ElementElement = ElementElement;
|
|
3940
|
+
exports.FetchElement = FetchElement;
|
|
3941
|
+
exports.HiddenElement = HiddenElement;
|
|
3942
|
+
exports.InputFileElement = InputFileElement;
|
|
3943
|
+
exports.InputJsonElement = InputJsonElement;
|
|
3944
|
+
exports.InputTextElement = InputTextElement;
|