@symbo.ls/scratch 2.11.504 → 2.11.514

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -34,3844 +34,59 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
34
34
  var require_cjs = __commonJS({
35
35
  "../../node_modules/@domql/globals/dist/cjs/index.js"(exports, module2) {
36
36
  "use strict";
37
- var __defProp2 = Object.defineProperty;
37
+ var __defProp3 = Object.defineProperty;
38
38
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
39
39
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
40
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
40
+ var __hasOwnProp3 = Object.prototype.hasOwnProperty;
41
41
  var __export2 = (target, all) => {
42
42
  for (var name in all)
43
- __defProp2(target, name, { get: all[name], enumerable: true });
43
+ __defProp3(target, name, { get: all[name], enumerable: true });
44
44
  };
45
45
  var __copyProps2 = (to, from, except, desc) => {
46
46
  if (from && typeof from === "object" || typeof from === "function") {
47
47
  for (let key of __getOwnPropNames2(from))
48
- if (!__hasOwnProp2.call(to, key) && key !== except)
49
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
48
+ if (!__hasOwnProp3.call(to, key) && key !== except)
49
+ __defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
50
50
  }
51
51
  return to;
52
52
  };
53
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
53
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
54
54
  var globals_exports = {};
55
55
  __export2(globals_exports, {
56
- document: () => document4,
56
+ document: () => document5,
57
57
  global: () => global,
58
58
  self: () => self,
59
- window: () => window3
59
+ window: () => window4
60
60
  });
61
61
  module2.exports = __toCommonJS2(globals_exports);
62
62
  var global = globalThis;
63
63
  var self = globalThis;
64
- var window3 = globalThis;
65
- var document4 = window3.document;
66
- }
67
- });
68
-
69
- // ../../node_modules/@domql/utils/dist/cjs/key.js
70
- var require_key = __commonJS({
71
- "../../node_modules/@domql/utils/dist/cjs/key.js"(exports, module2) {
72
- "use strict";
73
- var __defProp2 = Object.defineProperty;
74
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
75
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
76
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
77
- var __export2 = (target, all) => {
78
- for (var name in all)
79
- __defProp2(target, name, { get: all[name], enumerable: true });
80
- };
81
- var __copyProps2 = (to, from, except, desc) => {
82
- if (from && typeof from === "object" || typeof from === "function") {
83
- for (let key of __getOwnPropNames2(from))
84
- if (!__hasOwnProp2.call(to, key) && key !== except)
85
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
86
- }
87
- return to;
88
- };
89
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
90
- var key_exports = {};
91
- __export2(key_exports, {
92
- createSnapshotId: () => createSnapshotId,
93
- generateKey: () => generateKey
94
- });
95
- module2.exports = __toCommonJS2(key_exports);
96
- var generateKey = /* @__PURE__ */ function() {
97
- let index = 0;
98
- function newId() {
99
- index++;
100
- return index;
101
- }
102
- return newId;
103
- }();
104
- var createSnapshotId = generateKey;
105
- }
106
- });
107
-
108
- // ../../node_modules/@domql/utils/dist/cjs/env.js
109
- var require_env = __commonJS({
110
- "../../node_modules/@domql/utils/dist/cjs/env.js"(exports, module2) {
111
- "use strict";
112
- var __defProp2 = Object.defineProperty;
113
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
114
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
115
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
116
- var __export2 = (target, all) => {
117
- for (var name in all)
118
- __defProp2(target, name, { get: all[name], enumerable: true });
119
- };
120
- var __copyProps2 = (to, from, except, desc) => {
121
- if (from && typeof from === "object" || typeof from === "function") {
122
- for (let key of __getOwnPropNames2(from))
123
- if (!__hasOwnProp2.call(to, key) && key !== except)
124
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
125
- }
126
- return to;
127
- };
128
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
129
- var env_exports = {};
130
- __export2(env_exports, {
131
- NODE_ENV: () => NODE_ENV,
132
- getNev: () => getNev,
133
- isDevelopment: () => isDevelopment,
134
- isProduction: () => isProduction,
135
- isTest: () => isTest
136
- });
137
- module2.exports = __toCommonJS2(env_exports);
138
- var NODE_ENV = "development";
139
- var isProduction = (env = NODE_ENV) => env === "production" || env === "prod" || env !== "development" && env !== "dev" && env !== "test";
140
- var isTest = (env = NODE_ENV) => env === "test";
141
- var isDevelopment = (env = NODE_ENV) => env === "development" || env === "dev";
142
- var getNev = (key, env = NODE_ENV) => env[key];
143
- }
144
- });
145
-
146
- // ../../node_modules/@domql/utils/dist/cjs/globals.js
147
- var require_globals = __commonJS({
148
- "../../node_modules/@domql/utils/dist/cjs/globals.js"(exports, module2) {
149
- "use strict";
150
- var __defProp2 = Object.defineProperty;
151
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
152
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
153
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
154
- var __export2 = (target, all) => {
155
- for (var name in all)
156
- __defProp2(target, name, { get: all[name], enumerable: true });
157
- };
158
- var __copyProps2 = (to, from, except, desc) => {
159
- if (from && typeof from === "object" || typeof from === "function") {
160
- for (let key of __getOwnPropNames2(from))
161
- if (!__hasOwnProp2.call(to, key) && key !== except)
162
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
163
- }
164
- return to;
165
- };
166
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
167
- var globals_exports = {};
168
- __export2(globals_exports, {
169
- document: () => document4,
170
- global: () => global,
171
- self: () => self,
172
- window: () => window3
173
- });
174
- module2.exports = __toCommonJS2(globals_exports);
175
- var global = globalThis;
176
- var self = globalThis;
177
- var window3 = globalThis;
178
- var document4 = window3.document;
179
- }
180
- });
181
-
182
- // ../../node_modules/@domql/utils/dist/cjs/node.js
183
- var require_node = __commonJS({
184
- "../../node_modules/@domql/utils/dist/cjs/node.js"(exports, module2) {
185
- "use strict";
186
- var __defProp2 = Object.defineProperty;
187
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
188
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
189
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
190
- var __export2 = (target, all) => {
191
- for (var name in all)
192
- __defProp2(target, name, { get: all[name], enumerable: true });
193
- };
194
- var __copyProps2 = (to, from, except, desc) => {
195
- if (from && typeof from === "object" || typeof from === "function") {
196
- for (let key of __getOwnPropNames2(from))
197
- if (!__hasOwnProp2.call(to, key) && key !== except)
198
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
199
- }
200
- return to;
201
- };
202
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
203
- var node_exports = {};
204
- __export2(node_exports, {
205
- isDOMNode: () => isDOMNode,
206
- isHtmlElement: () => isHtmlElement,
207
- isNode: () => isNode
208
- });
209
- module2.exports = __toCommonJS2(node_exports);
210
- var import_globals3 = require_globals();
211
- var isNode = (obj) => {
212
- return (typeof Node === "object" ? obj instanceof import_globals3.window.Node : obj && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string") || false;
213
- };
214
- var isHtmlElement = (obj) => {
215
- return (typeof HTMLElement === "object" ? obj instanceof import_globals3.window.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string") || false;
216
- };
217
- var isDOMNode = (obj) => {
218
- return typeof import_globals3.window !== "undefined" && (obj instanceof import_globals3.window.Node || obj instanceof import_globals3.window.Window || obj === import_globals3.window || obj === document);
219
- };
220
- }
221
- });
222
-
223
- // ../../node_modules/@domql/utils/dist/cjs/types.js
224
- var require_types = __commonJS({
225
- "../../node_modules/@domql/utils/dist/cjs/types.js"(exports, module2) {
226
- "use strict";
227
- var __defProp2 = Object.defineProperty;
228
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
229
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
230
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
231
- var __export2 = (target, all) => {
232
- for (var name in all)
233
- __defProp2(target, name, { get: all[name], enumerable: true });
234
- };
235
- var __copyProps2 = (to, from, except, desc) => {
236
- if (from && typeof from === "object" || typeof from === "function") {
237
- for (let key of __getOwnPropNames2(from))
238
- if (!__hasOwnProp2.call(to, key) && key !== except)
239
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
240
- }
241
- return to;
242
- };
243
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
244
- var types_exports = {};
245
- __export2(types_exports, {
246
- TYPES: () => TYPES,
247
- is: () => is,
248
- isArray: () => isArray7,
249
- isBoolean: () => isBoolean,
250
- isDate: () => isDate,
251
- isDefined: () => isDefined2,
252
- isFunction: () => isFunction2,
253
- isNot: () => isNot,
254
- isNull: () => isNull2,
255
- isNumber: () => isNumber2,
256
- isObject: () => isObject7,
257
- isObjectLike: () => isObjectLike3,
258
- isString: () => isString9,
259
- isUndefined: () => isUndefined2
260
- });
261
- module2.exports = __toCommonJS2(types_exports);
262
- var import_node = require_node();
263
- var isObject7 = (arg) => {
264
- if (arg === null)
265
- return false;
266
- return typeof arg === "object" && arg.constructor === Object;
267
- };
268
- var isString9 = (arg) => typeof arg === "string";
269
- var isNumber2 = (arg) => typeof arg === "number";
270
- var isFunction2 = (arg) => typeof arg === "function";
271
- var isBoolean = (arg) => arg === true || arg === false;
272
- var isNull2 = (arg) => arg === null;
273
- var isArray7 = (arg) => Array.isArray(arg);
274
- var isDate = (d) => d instanceof Date;
275
- var isObjectLike3 = (arg) => {
276
- if (arg === null)
277
- return false;
278
- return typeof arg === "object";
279
- };
280
- var isDefined2 = (arg) => {
281
- return isObject7(arg) || isObjectLike3(arg) || isString9(arg) || isNumber2(arg) || isFunction2(arg) || isArray7(arg) || isObjectLike3(arg) || isBoolean(arg) || isDate(arg) || isNull2(arg);
282
- };
283
- var isUndefined2 = (arg) => {
284
- return arg === void 0;
285
- };
286
- var TYPES = {
287
- boolean: isBoolean,
288
- array: isArray7,
289
- object: isObject7,
290
- string: isString9,
291
- date: isDate,
292
- number: isNumber2,
293
- null: isNull2,
294
- function: isFunction2,
295
- objectLike: isObjectLike3,
296
- node: import_node.isNode,
297
- htmlElement: import_node.isHtmlElement,
298
- defined: isDefined2
299
- };
300
- var is = (arg) => {
301
- return (...args) => {
302
- return args.map((val) => TYPES[val](arg)).filter((v) => v).length > 0;
303
- };
304
- };
305
- var isNot = (arg) => {
306
- return (...args) => {
307
- return args.map((val) => TYPES[val](arg)).filter((v) => v).length === 0;
308
- };
309
- };
310
- }
311
- });
312
-
313
- // ../../node_modules/@domql/utils/dist/cjs/array.js
314
- var require_array = __commonJS({
315
- "../../node_modules/@domql/utils/dist/cjs/array.js"(exports, module2) {
316
- "use strict";
317
- var __defProp2 = Object.defineProperty;
318
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
319
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
320
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
321
- var __export2 = (target, all) => {
322
- for (var name in all)
323
- __defProp2(target, name, { get: all[name], enumerable: true });
324
- };
325
- var __copyProps2 = (to, from, except, desc) => {
326
- if (from && typeof from === "object" || typeof from === "function") {
327
- for (let key of __getOwnPropNames2(from))
328
- if (!__hasOwnProp2.call(to, key) && key !== except)
329
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
330
- }
331
- return to;
332
- };
333
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
334
- var array_exports = {};
335
- __export2(array_exports, {
336
- addItemAfterEveryElement: () => addItemAfterEveryElement,
337
- arrayContainsOtherArray: () => arrayContainsOtherArray,
338
- arraysEqual: () => arraysEqual,
339
- checkIfStringIsInArray: () => checkIfStringIsInArray,
340
- cutArrayAfterValue: () => cutArrayAfterValue,
341
- cutArrayBeforeValue: () => cutArrayBeforeValue,
342
- filterArrays: () => filterArrays,
343
- filterArraysFast: () => filterArraysFast,
344
- getFrequencyInArray: () => getFrequencyInArray,
345
- joinArrays: () => joinArrays,
346
- mergeAndCloneIfArray: () => mergeAndCloneIfArray,
347
- mergeArray: () => mergeArray,
348
- removeFromArray: () => removeFromArray,
349
- removeValueFromArray: () => removeValueFromArray,
350
- removeValueFromArrayAll: () => removeValueFromArrayAll,
351
- reorderArrayByValues: () => reorderArrayByValues,
352
- swapItemsInArray: () => swapItemsInArray
353
- });
354
- module2.exports = __toCommonJS2(array_exports);
355
- var import_object = require_object();
356
- var import_types = require_types();
357
- var arrayContainsOtherArray = (arr1, arr2) => {
358
- return arr2.every((val) => arr1.includes(val));
359
- };
360
- var getFrequencyInArray = (arr, value) => {
361
- return arr.reduce((count, currentValue) => {
362
- return currentValue === value ? count + 1 : count;
363
- }, 0);
364
- };
365
- var removeFromArray = (arr, index) => {
366
- if ((0, import_types.isString)(index))
367
- index = parseInt(index);
368
- if ((0, import_types.isNumber)(index)) {
369
- if (index < 0 || index >= arr.length || isNaN(index)) {
370
- throw new Error("Invalid index");
371
- }
372
- arr.splice(index, 1);
373
- } else if ((0, import_types.isArray)(index)) {
374
- index.forEach((idx) => removeFromArray(arr, idx));
375
- } else {
376
- throw new Error("Invalid index");
377
- }
378
- return arr;
379
- };
380
- var swapItemsInArray = (arr, i, j) => {
381
- [arr[i], arr[j]] = [arr[j], arr[i]];
382
- };
383
- var joinArrays = (...arrays) => {
384
- return [].concat(...arrays);
385
- };
386
- var mergeArray = (arr, exclude = []) => {
387
- return arr.reduce((a, c) => (0, import_object.deepMerge)(a, (0, import_object.deepClone)(c, { exclude }), exclude), {});
388
- };
389
- var mergeAndCloneIfArray = (obj) => {
390
- return (0, import_types.isArray)(obj) ? mergeArray(obj) : (0, import_object.deepClone)(obj);
391
- };
392
- var cutArrayBeforeValue = (arr, value) => {
393
- const index = arr.indexOf(value);
394
- if (index !== -1) {
395
- return arr.slice(0, index);
396
- }
397
- return arr;
398
- };
399
- var cutArrayAfterValue = (arr, value) => {
400
- if (!(0, import_types.isArray)(arr))
401
- return;
402
- const index = arr.indexOf(value);
403
- if (index !== -1) {
404
- return arr.slice(index + 1);
405
- }
406
- return arr;
407
- };
408
- var removeValueFromArray = (arr, value) => {
409
- const index = arr.indexOf(value);
410
- if (index > -1) {
411
- const newArray = [...arr];
412
- newArray.splice(index, 1);
413
- return newArray;
414
- }
415
- return arr;
416
- };
417
- var removeValueFromArrayAll = (arr, value) => {
418
- return arr.filter((item) => item !== value);
419
- };
420
- var addItemAfterEveryElement = (array, item) => {
421
- const result = [];
422
- for (let i = 0; i < array.length; i++) {
423
- result.push(array[i]);
424
- if (i < array.length - 1) {
425
- result.push(item);
426
- }
427
- }
428
- return result;
429
- };
430
- var reorderArrayByValues = (array, valueToMove, insertBeforeValue) => {
431
- const newArray = [...array];
432
- const indexToMove = newArray.indexOf(valueToMove);
433
- const indexToInsertBefore = newArray.indexOf(insertBeforeValue);
434
- if (indexToMove !== -1 && indexToInsertBefore !== -1) {
435
- const removedItem = newArray.splice(indexToMove, 1)[0];
436
- const insertIndex = indexToInsertBefore < indexToMove ? indexToInsertBefore : indexToInsertBefore + 1;
437
- newArray.splice(insertIndex, 0, removedItem);
438
- }
439
- return newArray;
440
- };
441
- var arraysEqual = (arr1, arr2) => {
442
- if (arr1.length !== arr2.length) {
443
- return false;
444
- }
445
- for (let i = 0; i < arr1.length; i++) {
446
- if (arr1[i] !== arr2[i]) {
447
- return false;
448
- }
449
- }
450
- return true;
451
- };
452
- var filterArrays = (sourceArr, excludeArr) => {
453
- return sourceArr.filter((item) => !excludeArr.includes(item));
454
- };
455
- var filterArraysFast = (sourceArr, excludeArr) => {
456
- const excludeSet = new Set(excludeArr);
457
- return sourceArr.filter((item) => !excludeSet.has(item));
458
- };
459
- var checkIfStringIsInArray = (string, arr) => {
460
- if (!string)
461
- return;
462
- return arr.filter((v) => string.includes(v)).length;
463
- };
464
- }
465
- });
466
-
467
- // ../../node_modules/@domql/utils/dist/cjs/string.js
468
- var require_string = __commonJS({
469
- "../../node_modules/@domql/utils/dist/cjs/string.js"(exports, module2) {
470
- "use strict";
471
- var __defProp2 = Object.defineProperty;
472
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
473
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
474
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
475
- var __export2 = (target, all) => {
476
- for (var name in all)
477
- __defProp2(target, name, { get: all[name], enumerable: true });
478
- };
479
- var __copyProps2 = (to, from, except, desc) => {
480
- if (from && typeof from === "object" || typeof from === "function") {
481
- for (let key of __getOwnPropNames2(from))
482
- if (!__hasOwnProp2.call(to, key) && key !== except)
483
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
484
- }
485
- return to;
486
- };
487
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
488
- var string_exports = {};
489
- __export2(string_exports, {
490
- customDecodeURIComponent: () => customDecodeURIComponent,
491
- customEncodeURIComponent: () => customEncodeURIComponent,
492
- decodeNewlines: () => decodeNewlines,
493
- encodeNewlines: () => encodeNewlines,
494
- findKeyPosition: () => findKeyPosition,
495
- lowercaseFirstLetter: () => lowercaseFirstLetter,
496
- replaceLiteralsWithObjectFields: () => replaceLiteralsWithObjectFields,
497
- replaceOctalEscapeSequences: () => replaceOctalEscapeSequences,
498
- stringIncludesAny: () => stringIncludesAny,
499
- trimStringFromSymbols: () => trimStringFromSymbols
500
- });
501
- module2.exports = __toCommonJS2(string_exports);
502
- var stringIncludesAny = (str, characters) => {
503
- for (const char of characters) {
504
- if (str.includes(char)) {
505
- return true;
506
- }
507
- }
508
- return false;
509
- };
510
- var trimStringFromSymbols = (str, characters) => {
511
- const pattern = new RegExp(`[${characters.join("\\")}]`, "g");
512
- return str.replace(pattern, "");
513
- };
514
- var brackRegex = {
515
- 2: /\{\{\s*((?:\.\.\/)+)?([^}\s]+)\s*\}\}/g,
516
- 3: /\{\{\{\s*((?:\.\.\/)+)?([^}\s]+)\s*\}\}\}/g
517
- };
518
- function replaceLiteralsWithObjectFields(str, options = {}, forcedState) {
519
- if (!str.includes(options.bracketsLength === 3 ? "{{{" : "{{"))
520
- return str;
521
- const reg = brackRegex[options.bracketsLength || 2];
522
- const obj = forcedState || this.state || {};
523
- return str.replace(reg, (_, parentPath, variable) => {
524
- if (parentPath) {
525
- const parentLevels = parentPath.match(options.bracketsLength === 3 ? /\.\.\.\//g : /\.\.\//g).length;
526
- let parentState = obj;
527
- for (let i = 0; i < parentLevels; i++) {
528
- parentState = parentState.parent;
529
- if (!parentState) {
530
- return "";
531
- }
532
- }
533
- const value = parentState[variable.trim()];
534
- return value !== void 0 ? `${value}` : "";
535
- } else {
536
- const value = obj[variable.trim()];
537
- return value !== void 0 ? `${value}` : "";
538
- }
539
- });
540
- }
541
- var lowercaseFirstLetter = (inputString) => {
542
- return `${inputString.charAt(0).toLowerCase()}${inputString.slice(1)}`;
543
- };
544
- var findKeyPosition = (str, key) => {
545
- const lines = str.split("\n");
546
- let startLineNumber = -1;
547
- let endLineNumber = -1;
548
- let startColumn = -1;
549
- let endColumn = -1;
550
- const keyPattern = new RegExp(`\\b${key}\\b\\s*:\\s*`);
551
- let braceCount = 0;
552
- let foundKey = false;
553
- for (let i = 0; i < lines.length; i++) {
554
- if (keyPattern.test(lines[i]) && !foundKey) {
555
- foundKey = true;
556
- startLineNumber = i + 1;
557
- startColumn = lines[i].indexOf(key) + 1;
558
- if (lines[i].includes("{}")) {
559
- endLineNumber = startLineNumber;
560
- endColumn = lines[i].indexOf("{}") + 3;
561
- break;
562
- }
563
- const line = lines[i].slice(startColumn + key.length);
564
- if (line.includes("{") || line.includes("[")) {
565
- braceCount = 1;
566
- } else {
567
- endLineNumber = i + 1;
568
- endColumn = lines[i].length + 1;
569
- break;
570
- }
571
- } else if (foundKey) {
572
- braceCount += (lines[i].match(/{/g) || []).length;
573
- braceCount += (lines[i].match(/\[/g) || []).length;
574
- braceCount -= (lines[i].match(/}/g) || []).length;
575
- braceCount -= (lines[i].match(/]/g) || []).length;
576
- if (braceCount === 0) {
577
- endLineNumber = i + 1;
578
- endColumn = lines[i].lastIndexOf("}") !== -1 ? lines[i].lastIndexOf("}") + 2 : lines[i].length + 1;
579
- break;
580
- }
581
- }
582
- }
583
- return {
584
- startColumn,
585
- endColumn,
586
- startLineNumber,
587
- endLineNumber
588
- };
589
- };
590
- var replaceOctalEscapeSequences = (str) => {
591
- const octalRegex = /\\([0-7]{1,3})/g;
592
- return str.replace(octalRegex, (match, p1) => {
593
- const octalValue = parseInt(p1, 8);
594
- const char = String.fromCharCode(octalValue);
595
- return char;
596
- });
597
- };
598
- var encodeNewlines = (str) => {
599
- return str.split("\n").join("/////n").split("`").join("/////tilde").split("$").join("/////dlrsgn");
600
- };
601
- var decodeNewlines = (encodedStr) => {
602
- return encodedStr.split("/////n").join("\n").split("/////tilde").join("`").split("/////dlrsgn").join("$");
603
- };
604
- var customEncodeURIComponent = (str) => {
605
- return str.split("").map((char) => {
606
- if (/[^a-zA-Z0-9\s]/.test(char)) {
607
- return "%" + char.charCodeAt(0).toString(16).toUpperCase();
608
- }
609
- return char;
610
- }).join("");
611
- };
612
- var customDecodeURIComponent = (encodedStr) => {
613
- return encodedStr.replace(/%[0-9A-Fa-f]{2}/g, (match) => String.fromCharCode(parseInt(match.slice(1), 16)));
614
- };
615
- }
616
- });
617
-
618
- // ../../node_modules/@domql/utils/dist/cjs/object.js
619
- var require_object = __commonJS({
620
- "../../node_modules/@domql/utils/dist/cjs/object.js"(exports, module2) {
621
- "use strict";
622
- var __defProp2 = Object.defineProperty;
623
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
624
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
625
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
626
- var __export2 = (target, all) => {
627
- for (var name in all)
628
- __defProp2(target, name, { get: all[name], enumerable: true });
629
- };
630
- var __copyProps2 = (to, from, except, desc) => {
631
- if (from && typeof from === "object" || typeof from === "function") {
632
- for (let key of __getOwnPropNames2(from))
633
- if (!__hasOwnProp2.call(to, key) && key !== except)
634
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
635
- }
636
- return to;
637
- };
638
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
639
- var object_exports = {};
640
- __export2(object_exports, {
641
- clone: () => clone,
642
- createNestedObject: () => createNestedObject,
643
- createObjectWithoutPrototype: () => createObjectWithoutPrototype,
644
- deepClone: () => deepClone2,
645
- deepContains: () => deepContains,
646
- deepDestringify: () => deepDestringify,
647
- deepDiff: () => deepDiff,
648
- deepMerge: () => deepMerge3,
649
- deepStringify: () => deepStringify,
650
- deepStringifyWithMaxDepth: () => deepStringifyWithMaxDepth,
651
- detachFunctionsFromObject: () => detachFunctionsFromObject,
652
- detectInfiniteLoop: () => detectInfiniteLoop,
653
- diff: () => diff,
654
- diffArrays: () => diffArrays,
655
- diffObjects: () => diffObjects,
656
- excludeKeysFromObject: () => excludeKeysFromObject,
657
- exec: () => exec,
658
- flattenRecursive: () => flattenRecursive,
659
- hasOwnProperty: () => hasOwnProperty,
660
- isCyclic: () => isCyclic,
661
- isEmpty: () => isEmpty,
662
- isEmptyObject: () => isEmptyObject,
663
- isEqualDeep: () => isEqualDeep,
664
- makeObjectWithoutPrototype: () => makeObjectWithoutPrototype,
665
- map: () => map,
666
- merge: () => merge5,
667
- mergeArrayExclude: () => mergeArrayExclude,
668
- mergeIfExisted: () => mergeIfExisted,
669
- objectToString: () => objectToString,
670
- overwrite: () => overwrite,
671
- overwriteDeep: () => overwriteDeep2,
672
- overwriteShallow: () => overwriteShallow,
673
- removeFromObject: () => removeFromObject,
674
- removeNestedKeyByPath: () => removeNestedKeyByPath,
675
- stringToObject: () => stringToObject
676
- });
677
- module2.exports = __toCommonJS2(object_exports);
678
- var import_globals3 = require_globals();
679
- var import_types = require_types();
680
- var import_array = require_array();
681
- var import_string = require_string();
682
- var import_node = require_node();
683
- var ENV2 = "development";
684
- var exec = (param, element, state, context) => {
685
- if ((0, import_types.isFunction)(param)) {
686
- return param.call(
687
- element,
688
- element,
689
- state || element.state,
690
- context || element.context
691
- );
692
- }
693
- return param;
694
- };
695
- var map = (obj, extention, element) => {
696
- for (const e in extention) {
697
- obj[e] = exec(extention[e], element);
698
- }
699
- };
700
- var merge5 = (element, obj, excludeFrom = []) => {
701
- for (const e in obj) {
702
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, e);
703
- if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
704
- continue;
705
- const elementProp = element[e];
706
- const objProp = obj[e];
707
- if (elementProp === void 0) {
708
- element[e] = objProp;
709
- }
710
- }
711
- return element;
712
- };
713
- var deepMerge3 = (element, extend, excludeFrom = []) => {
714
- for (const e in extend) {
715
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
716
- if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
717
- continue;
718
- const elementProp = element[e];
719
- const extendProp = extend[e];
720
- if ((0, import_types.isObjectLike)(elementProp) && (0, import_types.isObjectLike)(extendProp)) {
721
- deepMerge3(elementProp, extendProp, excludeFrom);
722
- } else if (elementProp === void 0) {
723
- element[e] = extendProp;
724
- }
725
- }
726
- return element;
727
- };
728
- var clone = (obj, excludeFrom = []) => {
729
- const o = {};
730
- for (const prop in obj) {
731
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, prop);
732
- if (!hasOwnProperty2 || excludeFrom.includes(prop) || prop.startsWith("__"))
733
- continue;
734
- o[prop] = obj[prop];
735
- }
736
- return o;
737
- };
738
- var mergeArrayExclude = (arr, exclude = []) => {
739
- return arr.reduce((acc, curr) => deepMerge3(acc, deepClone2(curr, { exclude })), {});
740
- };
741
- var deepClone2 = (obj, options = {}) => {
742
- const {
743
- exclude = [],
744
- cleanUndefined = false,
745
- cleanNull = false,
746
- window: targetWindow,
747
- visited = /* @__PURE__ */ new WeakMap(),
748
- handleExtend = false
749
- } = options;
750
- if (!(0, import_types.isObjectLike)(obj) || (0, import_node.isDOMNode)(obj)) {
751
- return obj;
752
- }
753
- if (visited.has(obj)) {
754
- return visited.get(obj);
755
- }
756
- const clone2 = targetWindow ? (0, import_types.isArray)(obj) ? new targetWindow.Array() : new targetWindow.Object() : (0, import_types.isArray)(obj) ? [] : {};
757
- visited.set(obj, clone2);
758
- for (const key in obj) {
759
- if (!Object.prototype.hasOwnProperty.call(obj, key))
760
- continue;
761
- if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
762
- continue;
763
- const value = obj[key];
764
- if (cleanUndefined && (0, import_types.isUndefined)(value) || cleanNull && (0, import_types.isNull)(value))
765
- continue;
766
- if ((0, import_node.isDOMNode)(value)) {
767
- clone2[key] = value;
768
- continue;
769
- }
770
- if (handleExtend && key === "extend" && (0, import_types.isArray)(value)) {
771
- clone2[key] = (0, import_array.mergeArray)(value, exclude);
772
- continue;
773
- }
774
- if ((0, import_types.isFunction)(value) && targetWindow) {
775
- clone2[key] = targetWindow.eval("(" + value.toString() + ")");
776
- continue;
777
- }
778
- if ((0, import_types.isObjectLike)(value)) {
779
- clone2[key] = deepClone2(value, {
780
- ...options,
781
- visited
782
- });
783
- } else {
784
- clone2[key] = value;
785
- }
786
- }
787
- return clone2;
788
- };
789
- var deepStringify = (obj, stringified = {}) => {
790
- var _a, _b;
791
- if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
792
- (obj.__element || ((_a = obj.parent) == null ? void 0 : _a.__element)).warn("Trying to clone element or state at", obj);
793
- obj = (_b = obj.parse) == null ? void 0 : _b.call(obj);
794
- }
795
- for (const prop in obj) {
796
- const objProp = obj[prop];
797
- if ((0, import_types.isFunction)(objProp)) {
798
- stringified[prop] = objProp.toString();
799
- } else if ((0, import_types.isObject)(objProp)) {
800
- stringified[prop] = {};
801
- deepStringify(objProp, stringified[prop]);
802
- } else if ((0, import_types.isArray)(objProp)) {
803
- stringified[prop] = [];
804
- objProp.forEach((v, i) => {
805
- if ((0, import_types.isObject)(v)) {
806
- stringified[prop][i] = {};
807
- deepStringify(v, stringified[prop][i]);
808
- } else if ((0, import_types.isFunction)(v)) {
809
- stringified[prop][i] = v.toString();
810
- } else {
811
- stringified[prop][i] = v;
812
- }
813
- });
814
- } else {
815
- stringified[prop] = objProp;
816
- }
817
- }
818
- return stringified;
819
- };
820
- var MAX_DEPTH = 100;
821
- var deepStringifyWithMaxDepth = (obj, stringified = {}, depth = 0, path = "") => {
822
- if (depth > MAX_DEPTH) {
823
- console.warn(`Maximum depth exceeded at path: ${path}. Possible circular reference.`);
824
- return "[MAX_DEPTH_EXCEEDED]";
825
- }
826
- for (const prop in obj) {
827
- const currentPath = path ? `${path}.${prop}` : prop;
828
- const objProp = obj[prop];
829
- if ((0, import_types.isFunction)(objProp)) {
830
- stringified[prop] = objProp.toString();
831
- } else if ((0, import_types.isObject)(objProp)) {
832
- stringified[prop] = {};
833
- deepStringifyWithMaxDepth(objProp, stringified[prop], depth + 1, currentPath);
834
- } else if ((0, import_types.isArray)(objProp)) {
835
- stringified[prop] = [];
836
- objProp.forEach((v, i) => {
837
- const itemPath = `${currentPath}[${i}]`;
838
- if ((0, import_types.isObject)(v)) {
839
- stringified[prop][i] = {};
840
- deepStringifyWithMaxDepth(v, stringified[prop][i], depth + 1, itemPath);
841
- } else if ((0, import_types.isFunction)(v)) {
842
- stringified[prop][i] = v.toString();
843
- } else {
844
- stringified[prop][i] = v;
845
- }
846
- });
847
- } else {
848
- stringified[prop] = objProp;
849
- }
850
- }
851
- return stringified;
852
- };
853
- var objectToString = (obj = {}, indent = 0) => {
854
- if (obj === null || typeof obj !== "object") {
855
- return String(obj);
856
- }
857
- if (Object.keys(obj).length === 0) {
858
- return "{}";
859
- }
860
- const spaces = " ".repeat(indent);
861
- let str = "{\n";
862
- for (const [key, value] of Object.entries(obj)) {
863
- const keyNotAllowdChars = (0, import_string.stringIncludesAny)(key, ["&", "*", "-", ":", "%", "{", "}", ">", "<", "@", ".", "/", "!", " "]);
864
- const stringedKey = keyNotAllowdChars ? `'${key}'` : key;
865
- str += `${spaces} ${stringedKey}: `;
866
- if ((0, import_types.isArray)(value)) {
867
- str += "[\n";
868
- for (const element of value) {
869
- if ((0, import_types.isObjectLike)(element) && element !== null) {
870
- str += `${spaces} ${objectToString(element, indent + 2)},
871
- `;
872
- } else if ((0, import_types.isString)(element)) {
873
- str += `${spaces} '${element}',
874
- `;
875
- } else {
876
- str += `${spaces} ${element},
877
- `;
878
- }
879
- }
880
- str += `${spaces} ]`;
881
- } else if ((0, import_types.isObjectLike)(value)) {
882
- str += objectToString(value, indent + 1);
883
- } else if ((0, import_types.isString)(value)) {
884
- str += (0, import_string.stringIncludesAny)(value, ["\n", "'"]) ? `\`${value}\`` : `'${value}'`;
885
- } else {
886
- str += value;
887
- }
888
- str += ",\n";
889
- }
890
- str += `${spaces}}`;
891
- return str;
892
- };
893
- var detachFunctionsFromObject = (obj, detached = {}) => {
894
- for (const prop in obj) {
895
- const objProp = obj[prop];
896
- if ((0, import_types.isFunction)(objProp))
897
- continue;
898
- else if ((0, import_types.isObject)(objProp)) {
899
- detached[prop] = {};
900
- deepStringify(objProp, detached[prop]);
901
- } else if ((0, import_types.isArray)(objProp)) {
902
- detached[prop] = [];
903
- objProp.forEach((v, i) => {
904
- if ((0, import_types.isFunction)(v))
905
- return;
906
- if ((0, import_types.isObject)(v)) {
907
- detached[prop][i] = {};
908
- detachFunctionsFromObject(v, detached[prop][i]);
909
- } else {
910
- detached[prop][i] = v;
911
- }
912
- });
913
- } else {
914
- detached[prop] = objProp;
915
- }
916
- }
917
- return detached;
918
- };
919
- var deepDestringify = (obj, destringified = {}) => {
920
- for (const prop in obj) {
921
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, prop);
922
- if (!hasOwnProperty2)
923
- continue;
924
- const objProp = obj[prop];
925
- if ((0, import_types.isString)(objProp)) {
926
- if ((objProp.includes("(){") || objProp.includes("() {") || objProp.includes("=>") || objProp.startsWith("()") || objProp.startsWith("async") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
927
- try {
928
- const evalProp = import_globals3.window.eval(`(${objProp})`);
929
- destringified[prop] = evalProp;
930
- } catch (e) {
931
- if (e)
932
- destringified[prop] = objProp;
933
- }
934
- } else {
935
- destringified[prop] = objProp;
936
- }
937
- } else if ((0, import_types.isArray)(objProp)) {
938
- destringified[prop] = [];
939
- objProp.forEach((arrProp) => {
940
- if ((0, import_types.isString)(arrProp)) {
941
- if (arrProp.includes("=>") || arrProp.includes("function") || arrProp.startsWith("(")) {
942
- try {
943
- const evalProp = import_globals3.window.eval(`(${arrProp})`);
944
- destringified[prop].push(evalProp);
945
- } catch (e) {
946
- if (e)
947
- destringified[prop].push(arrProp);
948
- }
949
- } else {
950
- destringified[prop].push(arrProp);
951
- }
952
- } else if ((0, import_types.isObject)(arrProp)) {
953
- destringified[prop].push(deepDestringify(arrProp));
954
- } else {
955
- destringified[prop].push(arrProp);
956
- }
957
- });
958
- } else if ((0, import_types.isObject)(objProp)) {
959
- destringified[prop] = deepDestringify(objProp, destringified[prop]);
960
- } else {
961
- destringified[prop] = objProp;
962
- }
963
- }
964
- return destringified;
965
- };
966
- var stringToObject = (str, opts = { verbose: true }) => {
967
- try {
968
- return str ? import_globals3.window.eval("(" + str + ")") : {};
969
- } catch (e) {
970
- if (opts.verbose)
971
- console.warn(e);
972
- }
973
- };
974
- var diffObjects = (original, objToDiff, cache) => {
975
- for (const e in objToDiff) {
976
- if (e === "ref")
977
- continue;
978
- const originalProp = original[e];
979
- const objToDiffProp = objToDiff[e];
980
- if ((0, import_types.isObject)(originalProp) && (0, import_types.isObject)(objToDiffProp)) {
981
- cache[e] = {};
982
- diff(originalProp, objToDiffProp, cache[e]);
983
- } else if (objToDiffProp !== void 0) {
984
- cache[e] = objToDiffProp;
985
- }
986
- }
987
- return cache;
988
- };
989
- var diffArrays = (original, objToDiff, cache) => {
990
- if (original.length !== objToDiff.length) {
991
- cache = objToDiff;
992
- } else {
993
- const diffArr = [];
994
- for (let i = 0; i < original.length; i++) {
995
- const diffObj = diff(original[i], objToDiff[i]);
996
- if (Object.keys(diffObj).length > 0) {
997
- diffArr.push(diffObj);
998
- }
999
- }
1000
- if (diffArr.length > 0) {
1001
- cache = diffArr;
1002
- }
1003
- }
1004
- return cache;
1005
- };
1006
- var diff = (original, objToDiff, cache = {}) => {
1007
- if ((0, import_types.isArray)(original) && (0, import_types.isArray)(objToDiff)) {
1008
- cache = [];
1009
- diffArrays(original, objToDiff, cache);
1010
- } else {
1011
- diffObjects(original, objToDiff, cache);
1012
- }
1013
- return cache;
1014
- };
1015
- var hasOwnProperty = (o, ...args) => Object.prototype.hasOwnProperty.call(o, ...args);
1016
- var isEmpty = (o) => Object.keys(o).length === 0;
1017
- var isEmptyObject = (o) => (0, import_types.isObject)(o) && isEmpty(o);
1018
- var makeObjectWithoutPrototype = () => /* @__PURE__ */ Object.create(null);
1019
- var deepDiff = (lhs, rhs) => {
1020
- if (lhs === rhs)
1021
- return {};
1022
- if (!(0, import_types.isObjectLike)(lhs) || !(0, import_types.isObjectLike)(rhs))
1023
- return rhs;
1024
- const deletedValues = Object.keys(lhs).reduce((acc, key) => {
1025
- if (!hasOwnProperty(rhs, key)) {
1026
- acc[key] = void 0;
1027
- }
1028
- return acc;
1029
- }, makeObjectWithoutPrototype());
1030
- if ((0, import_types.isDate)(lhs) || (0, import_types.isDate)(rhs)) {
1031
- if (lhs.valueOf() === rhs.valueOf())
1032
- return {};
1033
- return rhs;
1034
- }
1035
- return Object.keys(rhs).reduce((acc, key) => {
1036
- if (!hasOwnProperty(lhs, key)) {
1037
- acc[key] = rhs[key];
1038
- return acc;
1039
- }
1040
- const difference = diff(lhs[key], rhs[key]);
1041
- if (isEmptyObject(difference) && !(0, import_types.isDate)(difference) && (isEmptyObject(lhs[key]) || !isEmptyObject(rhs[key]))) {
1042
- return acc;
1043
- }
1044
- acc[key] = difference;
1045
- return acc;
1046
- }, deletedValues);
1047
- };
1048
- var overwrite = (element, params, opts = {}) => {
1049
- const { __ref: ref } = element;
1050
- const excl = opts.exclude || [];
1051
- const allowUnderscore = opts.preventUnderscore;
1052
- const preventCaching = opts.preventCaching;
1053
- for (const e in params) {
1054
- if (excl.includes(e) || !allowUnderscore && e.startsWith("__"))
1055
- continue;
1056
- const elementProp = element[e];
1057
- const paramsProp = params[e];
1058
- if (paramsProp !== void 0) {
1059
- element[e] = paramsProp;
1060
- if (ref && !preventCaching) {
1061
- ref.__cache[e] = elementProp;
1062
- }
1063
- if ((0, import_types.isObject)(opts.diff)) {
1064
- diff[e] = elementProp;
1065
- }
1066
- }
1067
- }
1068
- return element;
1069
- };
1070
- var overwriteShallow = (obj, params, excludeFrom = []) => {
1071
- for (const e in params) {
1072
- if (excludeFrom.includes(e) || e.startsWith("__"))
1073
- continue;
1074
- obj[e] = params[e];
1075
- }
1076
- return obj;
1077
- };
1078
- var overwriteDeep2 = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
1079
- const excl = opts.exclude || [];
1080
- const forcedExclude = opts.preventForce ? [] : ["node", "window"];
1081
- if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
1082
- return params;
1083
- }
1084
- if (visited.has(obj))
1085
- return visited.get(obj);
1086
- visited.set(obj, obj);
1087
- for (const e in params) {
1088
- if (!Object.hasOwnProperty.call(params, e))
1089
- continue;
1090
- if (excl.includes(e) || forcedExclude && e.startsWith("__"))
1091
- continue;
1092
- const objProp = obj[e];
1093
- const paramsProp = params[e];
1094
- if ((0, import_node.isDOMNode)(paramsProp)) {
1095
- obj[e] = paramsProp;
1096
- } else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
1097
- obj[e] = overwriteDeep2(objProp, paramsProp, opts, visited);
1098
- } else if (paramsProp !== void 0) {
1099
- obj[e] = paramsProp;
1100
- }
1101
- }
1102
- return obj;
1103
- };
1104
- var mergeIfExisted = (a, b) => {
1105
- if ((0, import_types.isObjectLike)(a) && (0, import_types.isObjectLike)(b))
1106
- return deepMerge3(a, b);
1107
- return a || b;
1108
- };
1109
- var flattenRecursive = (param, prop, stack = []) => {
1110
- const objectized = (0, import_array.mergeAndCloneIfArray)(param);
1111
- stack.push(objectized);
1112
- const extendOfExtend = objectized[prop];
1113
- if (extendOfExtend)
1114
- flattenRecursive(extendOfExtend, prop, stack);
1115
- delete objectized[prop];
1116
- return stack;
1117
- };
1118
- var isEqualDeep = (param, element, visited = /* @__PURE__ */ new Set()) => {
1119
- if (typeof param !== "object" || typeof element !== "object" || param === null || element === null) {
1120
- return param === element;
1121
- }
1122
- if (visited.has(param) || visited.has(element)) {
1123
- return true;
1124
- }
1125
- visited.add(param);
1126
- visited.add(element);
1127
- const keysParam = Object.keys(param);
1128
- const keysElement = Object.keys(element);
1129
- if (keysParam.length !== keysElement.length) {
1130
- return false;
1131
- }
1132
- for (const key of keysParam) {
1133
- if (!keysElement.includes(key)) {
1134
- return false;
1135
- }
1136
- const paramProp = param[key];
1137
- const elementProp = element[key];
1138
- if (!isEqualDeep(paramProp, elementProp, visited)) {
1139
- return false;
1140
- }
1141
- }
1142
- return true;
1143
- };
1144
- var deepContains = (obj1, obj2, ignoredKeys = ["node", "__ref"]) => {
1145
- if (obj1 === obj2)
1146
- return true;
1147
- if (!(0, import_types.isObjectLike)(obj1) || !(0, import_types.isObjectLike)(obj2))
1148
- return false;
1149
- if ((0, import_node.isDOMNode)(obj1) || (0, import_node.isDOMNode)(obj2))
1150
- return obj1 === obj2;
1151
- const stack = [[obj1, obj2]];
1152
- const visited = /* @__PURE__ */ new WeakSet();
1153
- while (stack.length > 0) {
1154
- const [current1, current2] = stack.pop();
1155
- if (visited.has(current1))
1156
- continue;
1157
- visited.add(current1);
1158
- const keys1 = Object.keys(current1).filter((key) => !ignoredKeys.includes(key));
1159
- const keys2 = Object.keys(current2).filter((key) => !ignoredKeys.includes(key));
1160
- if (keys1.length !== keys2.length)
1161
- return false;
1162
- for (const key of keys1) {
1163
- if (!Object.prototype.hasOwnProperty.call(current2, key))
1164
- return false;
1165
- const value1 = current1[key];
1166
- const value2 = current2[key];
1167
- if ((0, import_node.isDOMNode)(value1) || (0, import_node.isDOMNode)(value2)) {
1168
- if (value1 !== value2)
1169
- return false;
1170
- } else if ((0, import_types.isObjectLike)(value1) && (0, import_types.isObjectLike)(value2)) {
1171
- if (value1 !== value2) {
1172
- stack.push([value1, value2]);
1173
- }
1174
- } else if (value1 !== value2) {
1175
- return false;
1176
- }
1177
- }
1178
- }
1179
- return true;
1180
- };
1181
- var removeFromObject = (obj, props) => {
1182
- if (props === void 0 || props === null)
1183
- return obj;
1184
- if ((0, import_types.is)(props)("string", "number")) {
1185
- delete obj[props];
1186
- } else if ((0, import_types.isArray)(props)) {
1187
- props.forEach((prop) => delete obj[prop]);
1188
- } else {
1189
- throw new Error("Invalid input: props must be a string or an array of strings");
1190
- }
1191
- return obj;
1192
- };
1193
- var createObjectWithoutPrototype = (obj) => {
1194
- if (obj === null || typeof obj !== "object") {
1195
- return obj;
1196
- }
1197
- const newObj = /* @__PURE__ */ Object.create(null);
1198
- for (const key in obj) {
1199
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
1200
- newObj[key] = createObjectWithoutPrototype(obj[key]);
1201
- }
1202
- }
1203
- return newObj;
1204
- };
1205
- var createNestedObject = (arr, lastValue) => {
1206
- const nestedObject = {};
1207
- if (arr.length === 0) {
1208
- return lastValue;
1209
- }
1210
- arr.reduce((obj, value, index) => {
1211
- if (!obj[value]) {
1212
- obj[value] = {};
1213
- }
1214
- if (index === arr.length - 1 && lastValue) {
1215
- obj[value] = lastValue;
1216
- }
1217
- return obj[value];
1218
- }, nestedObject);
1219
- return nestedObject;
1220
- };
1221
- var removeNestedKeyByPath = (obj, path) => {
1222
- if (!Array.isArray(path)) {
1223
- throw new Error("Path must be an array.");
1224
- }
1225
- let current = obj;
1226
- for (let i = 0; i < path.length - 1; i++) {
1227
- if (current[path[i]] === void 0) {
1228
- return;
1229
- }
1230
- current = current[path[i]];
1231
- }
1232
- const lastKey = path[path.length - 1];
1233
- if (current && Object.hasOwnProperty.call(current, lastKey)) {
1234
- delete current[lastKey];
1235
- }
1236
- };
1237
- var detectInfiniteLoop = (arr) => {
1238
- const maxRepeats = 10;
1239
- let pattern = [];
1240
- let repeatCount = 0;
1241
- for (let i = 0; i < arr.length; i++) {
1242
- if (pattern.length < 2) {
1243
- pattern.push(arr[i]);
1244
- } else {
1245
- if (arr[i] === pattern[i % 2]) {
1246
- repeatCount++;
1247
- } else {
1248
- pattern = [arr[i - 1], arr[i]];
1249
- repeatCount = 1;
1250
- }
1251
- if (repeatCount >= maxRepeats * 2) {
1252
- if (ENV2 === "test" || ENV2 === "development") {
1253
- console.warn("Warning: Potential infinite loop detected due to repeated sequence:", pattern);
1254
- }
1255
- return true;
1256
- }
1257
- }
1258
- }
1259
- };
1260
- var isCyclic = (obj) => {
1261
- const seenObjects = [];
1262
- function detect(obj2) {
1263
- if (obj2 && typeof obj2 === "object") {
1264
- if (seenObjects.indexOf(obj2) !== -1) {
1265
- return true;
1266
- }
1267
- seenObjects.push(obj2);
1268
- for (const key in obj2) {
1269
- if (Object.hasOwnProperty.call(obj2, key) && detect(obj2[key])) {
1270
- console.log(obj2, "cycle at " + key);
1271
- return true;
1272
- }
1273
- }
1274
- }
1275
- return false;
1276
- }
1277
- return detect(obj);
1278
- };
1279
- var excludeKeysFromObject = (obj, excludedKeys) => {
1280
- const result = { ...obj };
1281
- excludedKeys.forEach((key) => delete result[key]);
1282
- return result;
1283
- };
1284
- }
1285
- });
1286
-
1287
- // ../../node_modules/@domql/utils/dist/cjs/function.js
1288
- var require_function = __commonJS({
1289
- "../../node_modules/@domql/utils/dist/cjs/function.js"(exports, module2) {
1290
- "use strict";
1291
- var __defProp2 = Object.defineProperty;
1292
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1293
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
1294
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1295
- var __export2 = (target, all) => {
1296
- for (var name in all)
1297
- __defProp2(target, name, { get: all[name], enumerable: true });
1298
- };
1299
- var __copyProps2 = (to, from, except, desc) => {
1300
- if (from && typeof from === "object" || typeof from === "function") {
1301
- for (let key of __getOwnPropNames2(from))
1302
- if (!__hasOwnProp2.call(to, key) && key !== except)
1303
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1304
- }
1305
- return to;
1306
- };
1307
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1308
- var function_exports = {};
1309
- __export2(function_exports, {
1310
- cloneFunction: () => cloneFunction,
1311
- debounce: () => debounce,
1312
- debounceOnContext: () => debounceOnContext,
1313
- isStringFunction: () => isStringFunction,
1314
- memoize: () => memoize
1315
- });
1316
- module2.exports = __toCommonJS2(function_exports);
1317
- function debounce(func, wait, immediate) {
1318
- let timeout;
1319
- return function() {
1320
- const context = this;
1321
- const args = arguments;
1322
- const later = function() {
1323
- timeout = null;
1324
- if (!immediate)
1325
- func.apply(context, args);
1326
- };
1327
- const callNow = immediate && !timeout;
1328
- clearTimeout(timeout);
1329
- timeout = setTimeout(later, wait);
1330
- if (callNow)
1331
- func.apply(context, args);
1332
- };
1333
- }
1334
- var debounceOnContext = (element, func, timeout = 300) => {
1335
- let timer;
1336
- return (...args) => {
1337
- clearTimeout(timer);
1338
- timer = setTimeout(() => {
1339
- func.apply(element, args);
1340
- }, timeout);
1341
- };
1342
- };
1343
- var memoize = (fn) => {
1344
- const cache = {};
1345
- return (...args) => {
1346
- const n = args[0];
1347
- if (n in cache) {
1348
- return cache[n];
1349
- } else {
1350
- const result = fn(n);
1351
- cache[n] = result;
1352
- return result;
1353
- }
1354
- };
1355
- };
1356
- var isStringFunction = (inputString) => {
1357
- const functionRegex = /^((function\s*\([^)]*\)\s*\{[^}]*\})|(\([^)]*\)\s*=>))/;
1358
- return functionRegex.test(inputString);
1359
- };
1360
- function cloneFunction(fn, win = window) {
1361
- const temp = function() {
1362
- return fn.apply(win, arguments);
1363
- };
1364
- for (const key in fn) {
1365
- if (Object.hasOwnProperty.call(fn, key)) {
1366
- temp[key] = fn[key];
1367
- }
1368
- }
1369
- return temp;
1370
- }
1371
- }
1372
- });
1373
-
1374
- // ../../node_modules/@domql/utils/dist/cjs/log.js
1375
- var require_log = __commonJS({
1376
- "../../node_modules/@domql/utils/dist/cjs/log.js"(exports, module2) {
1377
- "use strict";
1378
- var __defProp2 = Object.defineProperty;
1379
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1380
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
1381
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1382
- var __export2 = (target, all) => {
1383
- for (var name in all)
1384
- __defProp2(target, name, { get: all[name], enumerable: true });
1385
- };
1386
- var __copyProps2 = (to, from, except, desc) => {
1387
- if (from && typeof from === "object" || typeof from === "function") {
1388
- for (let key of __getOwnPropNames2(from))
1389
- if (!__hasOwnProp2.call(to, key) && key !== except)
1390
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1391
- }
1392
- return to;
1393
- };
1394
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1395
- var log_exports = {};
1396
- __export2(log_exports, {
1397
- logGroupIf: () => logGroupIf,
1398
- logIf: () => logIf
1399
- });
1400
- module2.exports = __toCommonJS2(log_exports);
1401
- var logIf = (bool, ...arg) => {
1402
- if (bool)
1403
- arg.map((v) => console.log(v));
1404
- };
1405
- var logGroupIf = (bool, key, ...arg) => {
1406
- if (bool) {
1407
- console.group(key);
1408
- arg.map((v) => console.log(v));
1409
- console.groupEnd(key);
1410
- }
1411
- };
1412
- }
1413
- });
1414
-
1415
- // ../../node_modules/@domql/utils/dist/cjs/cookie.js
1416
- var require_cookie = __commonJS({
1417
- "../../node_modules/@domql/utils/dist/cjs/cookie.js"(exports, module2) {
1418
- "use strict";
1419
- var __defProp2 = Object.defineProperty;
1420
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1421
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
1422
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1423
- var __export2 = (target, all) => {
1424
- for (var name in all)
1425
- __defProp2(target, name, { get: all[name], enumerable: true });
1426
- };
1427
- var __copyProps2 = (to, from, except, desc) => {
1428
- if (from && typeof from === "object" || typeof from === "function") {
1429
- for (let key of __getOwnPropNames2(from))
1430
- if (!__hasOwnProp2.call(to, key) && key !== except)
1431
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1432
- }
1433
- return to;
1434
- };
1435
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1436
- var cookie_exports = {};
1437
- __export2(cookie_exports, {
1438
- getCookie: () => getCookie,
1439
- getLocalStorage: () => getLocalStorage,
1440
- isMobile: () => isMobile,
1441
- removeCookie: () => removeCookie,
1442
- setCookie: () => setCookie,
1443
- setLocalStorage: () => setLocalStorage
1444
- });
1445
- module2.exports = __toCommonJS2(cookie_exports);
1446
- var import_types = require_types();
1447
- var import_utils27 = require_cjs2();
1448
- var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
1449
- var setCookie = (cname, cvalue, exdays = 365) => {
1450
- if ((0, import_types.isUndefined)(import_utils27.document) || (0, import_types.isUndefined)(import_utils27.document.cookie))
1451
- return;
1452
- const d = /* @__PURE__ */ new Date();
1453
- d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1e3);
1454
- const expires = `expires=${d.toUTCString()}`;
1455
- import_utils27.document.cookie = `${cname}=${cvalue};${expires};path=/`;
1456
- };
1457
- var getCookie = (cname) => {
1458
- if ((0, import_types.isUndefined)(import_utils27.document) || (0, import_types.isUndefined)(import_utils27.document.cookie))
1459
- return;
1460
- const name = `${cname}=`;
1461
- const decodedCookie = decodeURIComponent(import_utils27.document.cookie);
1462
- const ca = decodedCookie.split(";");
1463
- for (let i = 0; i < ca.length; i++) {
1464
- let c = ca[i];
1465
- while (c.charAt(0) === " ")
1466
- c = c.substring(1);
1467
- if (c.indexOf(name) === 0)
1468
- return c.substring(name.length, c.length);
1469
- }
1470
- return "";
1471
- };
1472
- var removeCookie = (cname) => {
1473
- if ((0, import_types.isUndefined)(import_utils27.document) || (0, import_types.isUndefined)(import_utils27.document.cookie))
1474
- return;
1475
- import_utils27.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
1476
- };
1477
- function getLocalStorage(key) {
1478
- let savedJSON;
1479
- if (window.localStorage) {
1480
- try {
1481
- savedJSON = JSON.parse(window.localStorage.getItem(key));
1482
- } catch (e) {
1483
- }
1484
- }
1485
- if (typeof savedJSON !== "undefined") {
1486
- return savedJSON;
1487
- }
1488
- }
1489
- function setLocalStorage(key, data) {
1490
- if (data && window.localStorage) {
1491
- if (typeof data === "object") {
1492
- window.localStorage.setItem(key, JSON.stringify(data));
1493
- } else {
1494
- window.localStorage.setItem(key, data);
1495
- }
1496
- }
1497
- }
1498
- }
1499
- });
1500
-
1501
- // ../../node_modules/@domql/utils/dist/cjs/tags.js
1502
- var require_tags = __commonJS({
1503
- "../../node_modules/@domql/utils/dist/cjs/tags.js"(exports, module2) {
1504
- "use strict";
1505
- var __defProp2 = Object.defineProperty;
1506
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1507
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
1508
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1509
- var __export2 = (target, all) => {
1510
- for (var name in all)
1511
- __defProp2(target, name, { get: all[name], enumerable: true });
1512
- };
1513
- var __copyProps2 = (to, from, except, desc) => {
1514
- if (from && typeof from === "object" || typeof from === "function") {
1515
- for (let key of __getOwnPropNames2(from))
1516
- if (!__hasOwnProp2.call(to, key) && key !== except)
1517
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1518
- }
1519
- return to;
1520
- };
1521
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1522
- var tags_exports = {};
1523
- __export2(tags_exports, {
1524
- HTML_TAGS: () => HTML_TAGS,
1525
- isValidHtmlTag: () => isValidHtmlTag
1526
- });
1527
- module2.exports = __toCommonJS2(tags_exports);
1528
- var HTML_TAGS = {
1529
- root: [
1530
- "body",
1531
- "html"
1532
- ],
1533
- head: [
1534
- "title",
1535
- "base",
1536
- "meta",
1537
- "style",
1538
- "noscript",
1539
- "script"
1540
- ],
1541
- body: [
1542
- "string",
1543
- "style",
1544
- "fragment",
1545
- "a",
1546
- "abbr",
1547
- "acronym",
1548
- "address",
1549
- "applet",
1550
- "area",
1551
- "article",
1552
- "aside",
1553
- "audio",
1554
- "b",
1555
- "basefont",
1556
- "bdi",
1557
- "bdo",
1558
- "big",
1559
- "blockquote",
1560
- "br",
1561
- "button",
1562
- "canvas",
1563
- "caption",
1564
- "center",
1565
- "cite",
1566
- "code",
1567
- "search",
1568
- "col",
1569
- "colgroup",
1570
- "data",
1571
- "datalist",
1572
- "dd",
1573
- "del",
1574
- "details",
1575
- "dfn",
1576
- "dialog",
1577
- "dir",
1578
- "div",
1579
- "dl",
1580
- "dt",
1581
- "em",
1582
- "embed",
1583
- "fieldset",
1584
- "figcaption",
1585
- "figure",
1586
- "font",
1587
- "footer",
1588
- "form",
1589
- "frame",
1590
- "frameset",
1591
- "h1",
1592
- "h2",
1593
- "h3",
1594
- "h4",
1595
- "h5",
1596
- "h6",
1597
- "head",
1598
- "header",
1599
- "hr",
1600
- "i",
1601
- "iframe",
1602
- "img",
1603
- "input",
1604
- "ins",
1605
- "kbd",
1606
- "label",
1607
- "legend",
1608
- "li",
1609
- "link",
1610
- "main",
1611
- "map",
1612
- "mark",
1613
- "meter",
1614
- "nav",
1615
- "noframes",
1616
- "noscript",
1617
- "object",
1618
- "ol",
1619
- "optgroup",
1620
- "option",
1621
- "output",
1622
- "p",
1623
- "param",
1624
- "picture",
1625
- "pre",
1626
- "progress",
1627
- "hgroup",
1628
- "q",
1629
- "rp",
1630
- "rt",
1631
- "ruby",
1632
- "s",
1633
- "samp",
1634
- "script",
1635
- "section",
1636
- "select",
1637
- "small",
1638
- "source",
1639
- "span",
1640
- "strike",
1641
- "strong",
1642
- "sub",
1643
- "summary",
1644
- "sup",
1645
- "table",
1646
- "tbody",
1647
- "td",
1648
- "template",
1649
- "hgroup",
1650
- "textarea",
1651
- "tfoot",
1652
- "th",
1653
- "thead",
1654
- "time",
1655
- "tr",
1656
- "track",
1657
- "tt",
1658
- "u",
1659
- "ul",
1660
- "var",
1661
- "video",
1662
- "wbr",
1663
- // SVG
1664
- "svg",
1665
- "path"
1666
- ]
1667
- };
1668
- var isValidHtmlTag = (arg) => HTML_TAGS.body.includes(arg);
1669
- }
1670
- });
1671
-
1672
- // ../../node_modules/@domql/utils/dist/cjs/component.js
1673
- var require_component = __commonJS({
1674
- "../../node_modules/@domql/utils/dist/cjs/component.js"(exports, module2) {
1675
- "use strict";
1676
- var __defProp2 = Object.defineProperty;
1677
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1678
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
1679
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1680
- var __export2 = (target, all) => {
1681
- for (var name in all)
1682
- __defProp2(target, name, { get: all[name], enumerable: true });
1683
- };
1684
- var __copyProps2 = (to, from, except, desc) => {
1685
- if (from && typeof from === "object" || typeof from === "function") {
1686
- for (let key of __getOwnPropNames2(from))
1687
- if (!__hasOwnProp2.call(to, key) && key !== except)
1688
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1689
- }
1690
- return to;
1691
- };
1692
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1693
- var component_exports = {};
1694
- __export2(component_exports, {
1695
- addAdditionalExtend: () => addAdditionalExtend,
1696
- addChildrenIfNotInOriginal: () => addChildrenIfNotInOriginal,
1697
- applyComponentFromContext: () => applyComponentFromContext,
1698
- applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
1699
- checkIfKeyIsComponent: () => checkIfKeyIsComponent,
1700
- checkIfKeyIsProperty: () => checkIfKeyIsProperty,
1701
- checkIfSugar: () => checkIfSugar,
1702
- extendizeByKey: () => extendizeByKey,
1703
- extractComponentKeyFromKey: () => extractComponentKeyFromKey,
1704
- getCapitalCaseKeys: () => getCapitalCaseKeys,
1705
- getChildrenComponentsByKey: () => getChildrenComponentsByKey,
1706
- getExtendsInElement: () => getExtendsInElement,
1707
- hasVariantProp: () => hasVariantProp,
1708
- isVariant: () => isVariant,
1709
- setContentKey: () => setContentKey
1710
- });
1711
- module2.exports = __toCommonJS2(component_exports);
1712
- var import__ = require_cjs2();
1713
- var ENV2 = "development";
1714
- var checkIfKeyIsComponent = (key) => {
1715
- const isFirstKeyString = (0, import__.isString)(key);
1716
- if (!isFirstKeyString)
1717
- return;
1718
- const firstCharKey = key.slice(0, 1);
1719
- return /^[A-Z]*$/.test(firstCharKey);
1720
- };
1721
- var checkIfKeyIsProperty = (key) => {
1722
- const isFirstKeyString = (0, import__.isString)(key);
1723
- if (!isFirstKeyString)
1724
- return;
1725
- const firstCharKey = key.slice(0, 1);
1726
- return /^[a-z]*$/.test(firstCharKey);
1727
- };
1728
- var addAdditionalExtend = (newExtend, element) => {
1729
- if (!newExtend)
1730
- return element;
1731
- const { extend: elementExtend } = element;
1732
- const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
1733
- const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
1734
- const extend = (0, import__.joinArrays)(receivedArray, originalArray);
1735
- return { ...element, extend };
1736
- };
1737
- var checkIfSugar = (element, parent, key) => {
1738
- var _a;
1739
- const {
1740
- extend,
1741
- props,
1742
- childExtend,
1743
- extends: extendProps,
1744
- childExtends,
1745
- childProps,
1746
- children,
1747
- on,
1748
- $collection,
1749
- $stateCollection,
1750
- $propsCollection
1751
- } = element;
1752
- const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
1753
- if (hasComponentAttrs && (childProps || extendProps || children || childExtends)) {
1754
- const logErr = (_a = parent || element) == null ? void 0 : _a.error;
1755
- if (logErr)
1756
- logErr.call(element, "Sugar component includes params for builtin components", { verbose: true });
1757
- }
1758
- return !hasComponentAttrs || childProps || extendProps || children || childExtends;
1759
- };
1760
- var extractComponentKeyFromKey = (key) => {
1761
- return key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
1762
- };
1763
- var extendizeByKey = (element, parent, key) => {
1764
- const { context } = parent;
1765
- const { tag, extend, childExtends } = element;
1766
- const isSugar = checkIfSugar(element, parent, key);
1767
- const extendFromKey = extractComponentKeyFromKey(key);
1768
- const isExtendKeyComponent = context && context.components[extendFromKey];
1769
- if (element === isExtendKeyComponent)
1770
- return element;
1771
- else if (isSugar) {
1772
- const newElem = addAdditionalExtend(element.extends, {
1773
- extend: extendFromKey,
1774
- tag,
1775
- props: { ...element }
1776
- });
1777
- if (newElem.props.data) {
1778
- newElem.data = newElem.props.data;
1779
- delete newElem.props.data;
1780
- }
1781
- if (newElem.props.state) {
1782
- newElem.state = newElem.props.state;
1783
- delete newElem.props.state;
1784
- }
1785
- if (newElem.props.attr) {
1786
- newElem.attr = newElem.props.attr;
1787
- delete newElem.props.attr;
1788
- }
1789
- if (newElem.props.if) {
1790
- newElem.if = newElem.props.if;
1791
- delete newElem.props.if;
1792
- }
1793
- if (childExtends)
1794
- newElem.childExtend = childExtends;
1795
- return newElem;
1796
- } else if (!extend || extend === true) {
1797
- return {
1798
- ...element,
1799
- tag,
1800
- extend: extendFromKey
1801
- };
1802
- } else if (extend) {
1803
- return addAdditionalExtend(extendFromKey, element);
1804
- } else if ((0, import__.isFunction)(element)) {
1805
- return {
1806
- extend: extendFromKey,
1807
- tag,
1808
- props: { ...(0, import__.exec)(element, parent) }
1809
- };
1810
- }
1811
- };
1812
- function getCapitalCaseKeys(obj) {
1813
- return Object.keys(obj).filter((key) => /^[A-Z]/.test(key));
1814
- }
1815
- var addChildrenIfNotInOriginal = (element, parent, key) => {
1816
- const childElems = getCapitalCaseKeys(element.props);
1817
- if (!childElems.length)
1818
- return element;
1819
- for (const i in childElems) {
1820
- const childKey = childElems[i];
1821
- const childElem = element[childKey];
1822
- const newChild = element.props[childKey];
1823
- const assignChild = (val) => {
1824
- element[childKey] = val;
1825
- delete element.props[childKey];
1826
- };
1827
- if (newChild == null ? void 0 : newChild.ignoreExtend)
1828
- continue;
1829
- if (newChild === null)
1830
- assignChild(null);
1831
- else if (!childElem)
1832
- assignChild((0, import__.deepClone)(newChild));
1833
- else {
1834
- const isSugarChildElem = checkIfSugar(childElem, parent, key);
1835
- if (isSugarChildElem)
1836
- continue;
1837
- assignChild({
1838
- extend: element[childKey],
1839
- props: newChild
1840
- });
1841
- }
1842
- }
1843
- };
1844
- var applyKeyComponentAsExtend = (element, parent, key) => {
1845
- return extendizeByKey(element, parent, key) || element;
1846
- };
1847
- var applyComponentFromContext = (element, parent, options) => {
1848
- const { context } = element;
1849
- if (!context || !context.components)
1850
- return;
1851
- const { components } = context;
1852
- const { extend } = element;
1853
- const execExtend = (0, import__.exec)(extend, element);
1854
- if ((0, import__.isString)(execExtend)) {
1855
- const componentExists = components[execExtend] || components["smbls." + execExtend];
1856
- if (componentExists)
1857
- element.extend = componentExists;
1858
- else {
1859
- if ((ENV2 === "test" || ENV2 === "development") && options.verbose) {
1860
- console.warn(execExtend, "is not in library", components, element);
1861
- console.warn("replacing with ", {});
1862
- }
1863
- element.extend = {};
1864
- }
1865
- }
1866
- };
1867
- var isVariant = (param) => {
1868
- if (!(0, import__.isString)(param))
1869
- return;
1870
- const firstCharKey = param.slice(0, 1);
1871
- return firstCharKey === ".";
1872
- };
1873
- var hasVariantProp = (element) => {
1874
- const { props } = element;
1875
- if ((0, import__.isObject)(props) && (0, import__.isString)(props.variant))
1876
- return true;
1877
- };
1878
- var getChildrenComponentsByKey = (key, el) => {
1879
- if (key === el.key || el.__ref.__componentKey === key) {
1880
- return el;
1881
- }
1882
- if (el.extend) {
1883
- const foundString = (0, import__.isString)(el.extend) && el.extend === key;
1884
- const foundInArray = (0, import__.isArray)(el.extend) && el.extend.filter((v) => v === key).length;
1885
- if (foundString || foundInArray)
1886
- return el;
1887
- }
1888
- if (el.parent && el.parent.childExtend) {
1889
- const foundString = (0, import__.isString)(el.parent.childExtend) && el.parent.childExtend === key;
1890
- const foundInArray = (0, import__.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
1891
- if (foundString || foundInArray)
1892
- return el;
1893
- }
1894
- };
1895
- var getExtendsInElement = (obj) => {
1896
- let result = [];
1897
- function traverse(o) {
1898
- for (const key in o) {
1899
- if (Object.hasOwnProperty.call(o, key)) {
1900
- if (checkIfKeyIsComponent(key)) {
1901
- result.push(key);
1902
- }
1903
- if (key === "extend" || key === "extends") {
1904
- if (typeof o[key] === "string") {
1905
- result.push(o[key]);
1906
- } else if (Array.isArray(o[key])) {
1907
- result = result.concat(o[key]);
1908
- }
1909
- }
1910
- if (typeof o[key] === "object" && o[key] !== null) {
1911
- traverse(o[key]);
1912
- }
1913
- }
1914
- }
1915
- }
1916
- traverse(obj);
1917
- return result;
1918
- };
1919
- var setContentKey = (el, opts = {}) => {
1920
- const { __ref: ref } = el;
1921
- const contentElementKey = opts.contentElementKey;
1922
- if (contentElementKey !== "content" && contentElementKey !== ref.contentElementKey || !ref.contentElementKey) {
1923
- ref.contentElementKey = contentElementKey || "content";
1924
- } else
1925
- ref.contentElementKey = "content";
1926
- if (contentElementKey !== "content")
1927
- opts.contentElementKey = "content";
1928
- return ref.contentElementKey;
1929
- };
1930
- }
1931
- });
1932
-
1933
- // ../../node_modules/@domql/utils/dist/cjs/index.js
1934
- var require_cjs2 = __commonJS({
1935
- "../../node_modules/@domql/utils/dist/cjs/index.js"(exports, module2) {
1936
- "use strict";
1937
- var __defProp2 = Object.defineProperty;
1938
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1939
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
1940
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1941
- var __copyProps2 = (to, from, except, desc) => {
1942
- if (from && typeof from === "object" || typeof from === "function") {
1943
- for (let key of __getOwnPropNames2(from))
1944
- if (!__hasOwnProp2.call(to, key) && key !== except)
1945
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1946
- }
1947
- return to;
1948
- };
1949
- var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default"));
1950
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1951
- var utils_exports2 = {};
1952
- module2.exports = __toCommonJS2(utils_exports2);
1953
- __reExport(utils_exports2, require_key(), module2.exports);
1954
- __reExport(utils_exports2, require_env(), module2.exports);
1955
- __reExport(utils_exports2, require_types(), module2.exports);
1956
- __reExport(utils_exports2, require_object(), module2.exports);
1957
- __reExport(utils_exports2, require_function(), module2.exports);
1958
- __reExport(utils_exports2, require_array(), module2.exports);
1959
- __reExport(utils_exports2, require_node(), module2.exports);
1960
- __reExport(utils_exports2, require_log(), module2.exports);
1961
- __reExport(utils_exports2, require_string(), module2.exports);
1962
- __reExport(utils_exports2, require_globals(), module2.exports);
1963
- __reExport(utils_exports2, require_cookie(), module2.exports);
1964
- __reExport(utils_exports2, require_tags(), module2.exports);
1965
- __reExport(utils_exports2, require_component(), module2.exports);
64
+ var window4 = globalThis;
65
+ var document5 = window4.document;
1966
66
  }
1967
67
  });
1968
68
 
1969
69
  // ../utils/dist/cjs/index.js
1970
- var require_cjs3 = __commonJS({
70
+ var require_cjs2 = __commonJS({
1971
71
  "../utils/dist/cjs/index.js"(exports, module2) {
1972
72
  "use strict";
1973
- var __create2 = Object.create;
1974
- var __defProp2 = Object.defineProperty;
73
+ var __defProp3 = Object.defineProperty;
1975
74
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1976
75
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
1977
- var __getProtoOf2 = Object.getPrototypeOf;
1978
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1979
- var __commonJS2 = (cb, mod) => function __require() {
1980
- return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
1981
- };
76
+ var __hasOwnProp3 = Object.prototype.hasOwnProperty;
1982
77
  var __export2 = (target, all) => {
1983
78
  for (var name in all)
1984
- __defProp2(target, name, { get: all[name], enumerable: true });
79
+ __defProp3(target, name, { get: all[name], enumerable: true });
1985
80
  };
1986
81
  var __copyProps2 = (to, from, except, desc) => {
1987
82
  if (from && typeof from === "object" || typeof from === "function") {
1988
83
  for (let key of __getOwnPropNames2(from))
1989
- if (!__hasOwnProp2.call(to, key) && key !== except)
1990
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
84
+ if (!__hasOwnProp3.call(to, key) && key !== except)
85
+ __defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1991
86
  }
1992
87
  return to;
1993
88
  };
1994
- var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
1995
- // If the importer is in node compatibility mode or this is not an ESM
1996
- // file that has been converted to a CommonJS file using a Babel-
1997
- // compatible transform (i.e. "__esModule" has not been set), then set
1998
- // "default" to the CommonJS "module.exports" for node compatibility.
1999
- isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
2000
- mod
2001
- ));
2002
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
2003
- var require_key2 = __commonJS2({
2004
- "../../node_modules/@domql/utils/dist/cjs/key.js"(exports2, module22) {
2005
- "use strict";
2006
- var __defProp22 = Object.defineProperty;
2007
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
2008
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
2009
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
2010
- var __export22 = (target, all) => {
2011
- for (var name in all)
2012
- __defProp22(target, name, { get: all[name], enumerable: true });
2013
- };
2014
- var __copyProps22 = (to, from, except, desc) => {
2015
- if (from && typeof from === "object" || typeof from === "function") {
2016
- for (let key of __getOwnPropNames22(from))
2017
- if (!__hasOwnProp22.call(to, key) && key !== except)
2018
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
2019
- }
2020
- return to;
2021
- };
2022
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
2023
- var key_exports = {};
2024
- __export22(key_exports, {
2025
- createSnapshotId: () => createSnapshotId,
2026
- generateKey: () => generateKey
2027
- });
2028
- module22.exports = __toCommonJS22(key_exports);
2029
- var generateKey = /* @__PURE__ */ function() {
2030
- let index = 0;
2031
- function newId() {
2032
- index++;
2033
- return index;
2034
- }
2035
- return newId;
2036
- }();
2037
- var createSnapshotId = generateKey;
2038
- }
2039
- });
2040
- var require_env2 = __commonJS2({
2041
- "../../node_modules/@domql/utils/dist/cjs/env.js"(exports2, module22) {
2042
- "use strict";
2043
- var __defProp22 = Object.defineProperty;
2044
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
2045
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
2046
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
2047
- var __export22 = (target, all) => {
2048
- for (var name in all)
2049
- __defProp22(target, name, { get: all[name], enumerable: true });
2050
- };
2051
- var __copyProps22 = (to, from, except, desc) => {
2052
- if (from && typeof from === "object" || typeof from === "function") {
2053
- for (let key of __getOwnPropNames22(from))
2054
- if (!__hasOwnProp22.call(to, key) && key !== except)
2055
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
2056
- }
2057
- return to;
2058
- };
2059
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
2060
- var env_exports = {};
2061
- __export22(env_exports, {
2062
- NODE_ENV: () => NODE_ENV,
2063
- getNev: () => getNev,
2064
- isDevelopment: () => isDevelopment,
2065
- isProduction: () => isProduction,
2066
- isTest: () => isTest
2067
- });
2068
- module22.exports = __toCommonJS22(env_exports);
2069
- var NODE_ENV = "development";
2070
- var isProduction = (env = NODE_ENV) => env === "production" || env === "prod" || env !== "development" && env !== "dev" && env !== "test";
2071
- var isTest = (env = NODE_ENV) => env === "test";
2072
- var isDevelopment = (env = NODE_ENV) => env === "development" || env === "dev";
2073
- var getNev = (key, env = NODE_ENV) => env[key];
2074
- }
2075
- });
2076
- var require_globals2 = __commonJS2({
2077
- "../../node_modules/@domql/utils/dist/cjs/globals.js"(exports2, module22) {
2078
- "use strict";
2079
- var __defProp22 = Object.defineProperty;
2080
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
2081
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
2082
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
2083
- var __export22 = (target, all) => {
2084
- for (var name in all)
2085
- __defProp22(target, name, { get: all[name], enumerable: true });
2086
- };
2087
- var __copyProps22 = (to, from, except, desc) => {
2088
- if (from && typeof from === "object" || typeof from === "function") {
2089
- for (let key of __getOwnPropNames22(from))
2090
- if (!__hasOwnProp22.call(to, key) && key !== except)
2091
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
2092
- }
2093
- return to;
2094
- };
2095
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
2096
- var globals_exports = {};
2097
- __export22(globals_exports, {
2098
- document: () => document22,
2099
- global: () => global,
2100
- self: () => self,
2101
- window: () => window22
2102
- });
2103
- module22.exports = __toCommonJS22(globals_exports);
2104
- var global = globalThis;
2105
- var self = globalThis;
2106
- var window22 = globalThis;
2107
- var document22 = window22.document;
2108
- }
2109
- });
2110
- var require_node2 = __commonJS2({
2111
- "../../node_modules/@domql/utils/dist/cjs/node.js"(exports2, module22) {
2112
- "use strict";
2113
- var __defProp22 = Object.defineProperty;
2114
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
2115
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
2116
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
2117
- var __export22 = (target, all) => {
2118
- for (var name in all)
2119
- __defProp22(target, name, { get: all[name], enumerable: true });
2120
- };
2121
- var __copyProps22 = (to, from, except, desc) => {
2122
- if (from && typeof from === "object" || typeof from === "function") {
2123
- for (let key of __getOwnPropNames22(from))
2124
- if (!__hasOwnProp22.call(to, key) && key !== except)
2125
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
2126
- }
2127
- return to;
2128
- };
2129
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
2130
- var node_exports = {};
2131
- __export22(node_exports, {
2132
- isDOMNode: () => isDOMNode,
2133
- isHtmlElement: () => isHtmlElement,
2134
- isNode: () => isNode
2135
- });
2136
- module22.exports = __toCommonJS22(node_exports);
2137
- var import_globals3 = require_globals2();
2138
- var isNode = (obj) => {
2139
- return (typeof Node === "object" ? obj instanceof import_globals3.window.Node : obj && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string") || false;
2140
- };
2141
- var isHtmlElement = (obj) => {
2142
- return (typeof HTMLElement === "object" ? obj instanceof import_globals3.window.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string") || false;
2143
- };
2144
- var isDOMNode = (obj) => {
2145
- return typeof import_globals3.window !== "undefined" && (obj instanceof import_globals3.window.Node || obj instanceof import_globals3.window.Window || obj === import_globals3.window || obj === document);
2146
- };
2147
- }
2148
- });
2149
- var require_types2 = __commonJS2({
2150
- "../../node_modules/@domql/utils/dist/cjs/types.js"(exports2, module22) {
2151
- "use strict";
2152
- var __defProp22 = Object.defineProperty;
2153
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
2154
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
2155
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
2156
- var __export22 = (target, all) => {
2157
- for (var name in all)
2158
- __defProp22(target, name, { get: all[name], enumerable: true });
2159
- };
2160
- var __copyProps22 = (to, from, except, desc) => {
2161
- if (from && typeof from === "object" || typeof from === "function") {
2162
- for (let key of __getOwnPropNames22(from))
2163
- if (!__hasOwnProp22.call(to, key) && key !== except)
2164
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
2165
- }
2166
- return to;
2167
- };
2168
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
2169
- var types_exports = {};
2170
- __export22(types_exports, {
2171
- TYPES: () => TYPES,
2172
- is: () => is,
2173
- isArray: () => isArray32,
2174
- isBoolean: () => isBoolean,
2175
- isDate: () => isDate,
2176
- isDefined: () => isDefined2,
2177
- isFunction: () => isFunction2,
2178
- isNot: () => isNot,
2179
- isNull: () => isNull2,
2180
- isNumber: () => isNumber2,
2181
- isObject: () => isObject32,
2182
- isObjectLike: () => isObjectLike3,
2183
- isString: () => isString22,
2184
- isUndefined: () => isUndefined2
2185
- });
2186
- module22.exports = __toCommonJS22(types_exports);
2187
- var import_node = require_node2();
2188
- var isObject32 = (arg) => {
2189
- if (arg === null)
2190
- return false;
2191
- return typeof arg === "object" && arg.constructor === Object;
2192
- };
2193
- var isString22 = (arg) => typeof arg === "string";
2194
- var isNumber2 = (arg) => typeof arg === "number";
2195
- var isFunction2 = (arg) => typeof arg === "function";
2196
- var isBoolean = (arg) => arg === true || arg === false;
2197
- var isNull2 = (arg) => arg === null;
2198
- var isArray32 = (arg) => Array.isArray(arg);
2199
- var isDate = (d) => d instanceof Date;
2200
- var isObjectLike3 = (arg) => {
2201
- if (arg === null)
2202
- return false;
2203
- return typeof arg === "object";
2204
- };
2205
- var isDefined2 = (arg) => {
2206
- return isObject32(arg) || isObjectLike3(arg) || isString22(arg) || isNumber2(arg) || isFunction2(arg) || isArray32(arg) || isObjectLike3(arg) || isBoolean(arg) || isDate(arg) || isNull2(arg);
2207
- };
2208
- var isUndefined2 = (arg) => {
2209
- return arg === void 0;
2210
- };
2211
- var TYPES = {
2212
- boolean: isBoolean,
2213
- array: isArray32,
2214
- object: isObject32,
2215
- string: isString22,
2216
- date: isDate,
2217
- number: isNumber2,
2218
- null: isNull2,
2219
- function: isFunction2,
2220
- objectLike: isObjectLike3,
2221
- node: import_node.isNode,
2222
- htmlElement: import_node.isHtmlElement,
2223
- defined: isDefined2
2224
- };
2225
- var is = (arg) => {
2226
- return (...args) => {
2227
- return args.map((val) => TYPES[val](arg)).filter((v) => v).length > 0;
2228
- };
2229
- };
2230
- var isNot = (arg) => {
2231
- return (...args) => {
2232
- return args.map((val) => TYPES[val](arg)).filter((v) => v).length === 0;
2233
- };
2234
- };
2235
- }
2236
- });
2237
- var require_array2 = __commonJS2({
2238
- "../../node_modules/@domql/utils/dist/cjs/array.js"(exports2, module22) {
2239
- "use strict";
2240
- var __defProp22 = Object.defineProperty;
2241
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
2242
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
2243
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
2244
- var __export22 = (target, all) => {
2245
- for (var name in all)
2246
- __defProp22(target, name, { get: all[name], enumerable: true });
2247
- };
2248
- var __copyProps22 = (to, from, except, desc) => {
2249
- if (from && typeof from === "object" || typeof from === "function") {
2250
- for (let key of __getOwnPropNames22(from))
2251
- if (!__hasOwnProp22.call(to, key) && key !== except)
2252
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
2253
- }
2254
- return to;
2255
- };
2256
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
2257
- var array_exports = {};
2258
- __export22(array_exports, {
2259
- addItemAfterEveryElement: () => addItemAfterEveryElement,
2260
- arrayContainsOtherArray: () => arrayContainsOtherArray,
2261
- arraysEqual: () => arraysEqual,
2262
- checkIfStringIsInArray: () => checkIfStringIsInArray,
2263
- cutArrayAfterValue: () => cutArrayAfterValue,
2264
- cutArrayBeforeValue: () => cutArrayBeforeValue,
2265
- filterArrays: () => filterArrays,
2266
- filterArraysFast: () => filterArraysFast,
2267
- getFrequencyInArray: () => getFrequencyInArray,
2268
- joinArrays: () => joinArrays,
2269
- mergeAndCloneIfArray: () => mergeAndCloneIfArray,
2270
- mergeArray: () => mergeArray,
2271
- removeFromArray: () => removeFromArray,
2272
- removeValueFromArray: () => removeValueFromArray,
2273
- removeValueFromArrayAll: () => removeValueFromArrayAll,
2274
- reorderArrayByValues: () => reorderArrayByValues,
2275
- swapItemsInArray: () => swapItemsInArray
2276
- });
2277
- module22.exports = __toCommonJS22(array_exports);
2278
- var import_object = require_object2();
2279
- var import_types = require_types2();
2280
- var arrayContainsOtherArray = (arr1, arr2) => {
2281
- return arr2.every((val) => arr1.includes(val));
2282
- };
2283
- var getFrequencyInArray = (arr, value) => {
2284
- return arr.reduce((count, currentValue) => {
2285
- return currentValue === value ? count + 1 : count;
2286
- }, 0);
2287
- };
2288
- var removeFromArray = (arr, index) => {
2289
- if ((0, import_types.isString)(index))
2290
- index = parseInt(index);
2291
- if ((0, import_types.isNumber)(index)) {
2292
- if (index < 0 || index >= arr.length || isNaN(index)) {
2293
- throw new Error("Invalid index");
2294
- }
2295
- arr.splice(index, 1);
2296
- } else if ((0, import_types.isArray)(index)) {
2297
- index.forEach((idx) => removeFromArray(arr, idx));
2298
- } else {
2299
- throw new Error("Invalid index");
2300
- }
2301
- return arr;
2302
- };
2303
- var swapItemsInArray = (arr, i, j) => {
2304
- [arr[i], arr[j]] = [arr[j], arr[i]];
2305
- };
2306
- var joinArrays = (...arrays) => {
2307
- return [].concat(...arrays);
2308
- };
2309
- var mergeArray = (arr, exclude = []) => {
2310
- return arr.reduce((a, c) => (0, import_object.deepMerge)(a, (0, import_object.deepClone)(c, { exclude }), exclude), {});
2311
- };
2312
- var mergeAndCloneIfArray = (obj) => {
2313
- return (0, import_types.isArray)(obj) ? mergeArray(obj) : (0, import_object.deepClone)(obj);
2314
- };
2315
- var cutArrayBeforeValue = (arr, value) => {
2316
- const index = arr.indexOf(value);
2317
- if (index !== -1) {
2318
- return arr.slice(0, index);
2319
- }
2320
- return arr;
2321
- };
2322
- var cutArrayAfterValue = (arr, value) => {
2323
- if (!(0, import_types.isArray)(arr))
2324
- return;
2325
- const index = arr.indexOf(value);
2326
- if (index !== -1) {
2327
- return arr.slice(index + 1);
2328
- }
2329
- return arr;
2330
- };
2331
- var removeValueFromArray = (arr, value) => {
2332
- const index = arr.indexOf(value);
2333
- if (index > -1) {
2334
- const newArray = [...arr];
2335
- newArray.splice(index, 1);
2336
- return newArray;
2337
- }
2338
- return arr;
2339
- };
2340
- var removeValueFromArrayAll = (arr, value) => {
2341
- return arr.filter((item) => item !== value);
2342
- };
2343
- var addItemAfterEveryElement = (array, item) => {
2344
- const result = [];
2345
- for (let i = 0; i < array.length; i++) {
2346
- result.push(array[i]);
2347
- if (i < array.length - 1) {
2348
- result.push(item);
2349
- }
2350
- }
2351
- return result;
2352
- };
2353
- var reorderArrayByValues = (array, valueToMove, insertBeforeValue) => {
2354
- const newArray = [...array];
2355
- const indexToMove = newArray.indexOf(valueToMove);
2356
- const indexToInsertBefore = newArray.indexOf(insertBeforeValue);
2357
- if (indexToMove !== -1 && indexToInsertBefore !== -1) {
2358
- const removedItem = newArray.splice(indexToMove, 1)[0];
2359
- const insertIndex = indexToInsertBefore < indexToMove ? indexToInsertBefore : indexToInsertBefore + 1;
2360
- newArray.splice(insertIndex, 0, removedItem);
2361
- }
2362
- return newArray;
2363
- };
2364
- var arraysEqual = (arr1, arr2) => {
2365
- if (arr1.length !== arr2.length) {
2366
- return false;
2367
- }
2368
- for (let i = 0; i < arr1.length; i++) {
2369
- if (arr1[i] !== arr2[i]) {
2370
- return false;
2371
- }
2372
- }
2373
- return true;
2374
- };
2375
- var filterArrays = (sourceArr, excludeArr) => {
2376
- return sourceArr.filter((item) => !excludeArr.includes(item));
2377
- };
2378
- var filterArraysFast = (sourceArr, excludeArr) => {
2379
- const excludeSet = new Set(excludeArr);
2380
- return sourceArr.filter((item) => !excludeSet.has(item));
2381
- };
2382
- var checkIfStringIsInArray = (string, arr) => {
2383
- if (!string)
2384
- return;
2385
- return arr.filter((v) => string.includes(v)).length;
2386
- };
2387
- }
2388
- });
2389
- var require_string2 = __commonJS2({
2390
- "../../node_modules/@domql/utils/dist/cjs/string.js"(exports2, module22) {
2391
- "use strict";
2392
- var __defProp22 = Object.defineProperty;
2393
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
2394
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
2395
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
2396
- var __export22 = (target, all) => {
2397
- for (var name in all)
2398
- __defProp22(target, name, { get: all[name], enumerable: true });
2399
- };
2400
- var __copyProps22 = (to, from, except, desc) => {
2401
- if (from && typeof from === "object" || typeof from === "function") {
2402
- for (let key of __getOwnPropNames22(from))
2403
- if (!__hasOwnProp22.call(to, key) && key !== except)
2404
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
2405
- }
2406
- return to;
2407
- };
2408
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
2409
- var string_exports = {};
2410
- __export22(string_exports, {
2411
- customDecodeURIComponent: () => customDecodeURIComponent,
2412
- customEncodeURIComponent: () => customEncodeURIComponent,
2413
- decodeNewlines: () => decodeNewlines,
2414
- encodeNewlines: () => encodeNewlines,
2415
- findKeyPosition: () => findKeyPosition,
2416
- lowercaseFirstLetter: () => lowercaseFirstLetter,
2417
- replaceLiteralsWithObjectFields: () => replaceLiteralsWithObjectFields,
2418
- replaceOctalEscapeSequences: () => replaceOctalEscapeSequences,
2419
- stringIncludesAny: () => stringIncludesAny,
2420
- trimStringFromSymbols: () => trimStringFromSymbols
2421
- });
2422
- module22.exports = __toCommonJS22(string_exports);
2423
- var stringIncludesAny = (str, characters) => {
2424
- for (const char of characters) {
2425
- if (str.includes(char)) {
2426
- return true;
2427
- }
2428
- }
2429
- return false;
2430
- };
2431
- var trimStringFromSymbols = (str, characters) => {
2432
- const pattern = new RegExp(`[${characters.join("\\")}]`, "g");
2433
- return str.replace(pattern, "");
2434
- };
2435
- var brackRegex = {
2436
- 2: /\{\{\s*((?:\.\.\/)+)?([^}\s]+)\s*\}\}/g,
2437
- 3: /\{\{\{\s*((?:\.\.\/)+)?([^}\s]+)\s*\}\}\}/g
2438
- };
2439
- function replaceLiteralsWithObjectFields(str, options = {}, forcedState) {
2440
- if (!str.includes(options.bracketsLength === 3 ? "{{{" : "{{"))
2441
- return str;
2442
- const reg = brackRegex[options.bracketsLength || 2];
2443
- const obj = forcedState || this.state || {};
2444
- return str.replace(reg, (_, parentPath, variable) => {
2445
- if (parentPath) {
2446
- const parentLevels = parentPath.match(options.bracketsLength === 3 ? /\.\.\.\//g : /\.\.\//g).length;
2447
- let parentState = obj;
2448
- for (let i = 0; i < parentLevels; i++) {
2449
- parentState = parentState.parent;
2450
- if (!parentState) {
2451
- return "";
2452
- }
2453
- }
2454
- const value = parentState[variable.trim()];
2455
- return value !== void 0 ? `${value}` : "";
2456
- } else {
2457
- const value = obj[variable.trim()];
2458
- return value !== void 0 ? `${value}` : "";
2459
- }
2460
- });
2461
- }
2462
- var lowercaseFirstLetter = (inputString) => {
2463
- return `${inputString.charAt(0).toLowerCase()}${inputString.slice(1)}`;
2464
- };
2465
- var findKeyPosition = (str, key) => {
2466
- const lines = str.split("\n");
2467
- let startLineNumber = -1;
2468
- let endLineNumber = -1;
2469
- let startColumn = -1;
2470
- let endColumn = -1;
2471
- const keyPattern = new RegExp(`\\b${key}\\b\\s*:\\s*`);
2472
- let braceCount = 0;
2473
- let foundKey = false;
2474
- for (let i = 0; i < lines.length; i++) {
2475
- if (keyPattern.test(lines[i]) && !foundKey) {
2476
- foundKey = true;
2477
- startLineNumber = i + 1;
2478
- startColumn = lines[i].indexOf(key) + 1;
2479
- if (lines[i].includes("{}")) {
2480
- endLineNumber = startLineNumber;
2481
- endColumn = lines[i].indexOf("{}") + 3;
2482
- break;
2483
- }
2484
- const line = lines[i].slice(startColumn + key.length);
2485
- if (line.includes("{") || line.includes("[")) {
2486
- braceCount = 1;
2487
- } else {
2488
- endLineNumber = i + 1;
2489
- endColumn = lines[i].length + 1;
2490
- break;
2491
- }
2492
- } else if (foundKey) {
2493
- braceCount += (lines[i].match(/{/g) || []).length;
2494
- braceCount += (lines[i].match(/\[/g) || []).length;
2495
- braceCount -= (lines[i].match(/}/g) || []).length;
2496
- braceCount -= (lines[i].match(/]/g) || []).length;
2497
- if (braceCount === 0) {
2498
- endLineNumber = i + 1;
2499
- endColumn = lines[i].lastIndexOf("}") !== -1 ? lines[i].lastIndexOf("}") + 2 : lines[i].length + 1;
2500
- break;
2501
- }
2502
- }
2503
- }
2504
- return {
2505
- startColumn,
2506
- endColumn,
2507
- startLineNumber,
2508
- endLineNumber
2509
- };
2510
- };
2511
- var replaceOctalEscapeSequences = (str) => {
2512
- const octalRegex = /\\([0-7]{1,3})/g;
2513
- return str.replace(octalRegex, (match, p1) => {
2514
- const octalValue = parseInt(p1, 8);
2515
- const char = String.fromCharCode(octalValue);
2516
- return char;
2517
- });
2518
- };
2519
- var encodeNewlines = (str) => {
2520
- return str.split("\n").join("/////n").split("`").join("/////tilde").split("$").join("/////dlrsgn");
2521
- };
2522
- var decodeNewlines = (encodedStr) => {
2523
- return encodedStr.split("/////n").join("\n").split("/////tilde").join("`").split("/////dlrsgn").join("$");
2524
- };
2525
- var customEncodeURIComponent = (str) => {
2526
- return str.split("").map((char) => {
2527
- if (/[^a-zA-Z0-9\s]/.test(char)) {
2528
- return "%" + char.charCodeAt(0).toString(16).toUpperCase();
2529
- }
2530
- return char;
2531
- }).join("");
2532
- };
2533
- var customDecodeURIComponent = (encodedStr) => {
2534
- return encodedStr.replace(/%[0-9A-Fa-f]{2}/g, (match) => String.fromCharCode(parseInt(match.slice(1), 16)));
2535
- };
2536
- }
2537
- });
2538
- var require_object2 = __commonJS2({
2539
- "../../node_modules/@domql/utils/dist/cjs/object.js"(exports2, module22) {
2540
- "use strict";
2541
- var __defProp22 = Object.defineProperty;
2542
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
2543
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
2544
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
2545
- var __export22 = (target, all) => {
2546
- for (var name in all)
2547
- __defProp22(target, name, { get: all[name], enumerable: true });
2548
- };
2549
- var __copyProps22 = (to, from, except, desc) => {
2550
- if (from && typeof from === "object" || typeof from === "function") {
2551
- for (let key of __getOwnPropNames22(from))
2552
- if (!__hasOwnProp22.call(to, key) && key !== except)
2553
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
2554
- }
2555
- return to;
2556
- };
2557
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
2558
- var object_exports = {};
2559
- __export22(object_exports, {
2560
- clone: () => clone,
2561
- createNestedObject: () => createNestedObject,
2562
- createObjectWithoutPrototype: () => createObjectWithoutPrototype,
2563
- deepClone: () => deepClone2,
2564
- deepContains: () => deepContains,
2565
- deepDestringify: () => deepDestringify,
2566
- deepDiff: () => deepDiff,
2567
- deepMerge: () => deepMerge3,
2568
- deepStringify: () => deepStringify,
2569
- deepStringifyWithMaxDepth: () => deepStringifyWithMaxDepth,
2570
- detachFunctionsFromObject: () => detachFunctionsFromObject,
2571
- detectInfiniteLoop: () => detectInfiniteLoop,
2572
- diff: () => diff,
2573
- diffArrays: () => diffArrays,
2574
- diffObjects: () => diffObjects,
2575
- excludeKeysFromObject: () => excludeKeysFromObject,
2576
- exec: () => exec,
2577
- flattenRecursive: () => flattenRecursive,
2578
- hasOwnProperty: () => hasOwnProperty,
2579
- isCyclic: () => isCyclic,
2580
- isEmpty: () => isEmpty,
2581
- isEmptyObject: () => isEmptyObject,
2582
- isEqualDeep: () => isEqualDeep,
2583
- makeObjectWithoutPrototype: () => makeObjectWithoutPrototype,
2584
- map: () => map,
2585
- merge: () => merge5,
2586
- mergeArrayExclude: () => mergeArrayExclude,
2587
- mergeIfExisted: () => mergeIfExisted,
2588
- objectToString: () => objectToString,
2589
- overwrite: () => overwrite,
2590
- overwriteDeep: () => overwriteDeep2,
2591
- overwriteShallow: () => overwriteShallow,
2592
- removeFromObject: () => removeFromObject,
2593
- removeNestedKeyByPath: () => removeNestedKeyByPath,
2594
- stringToObject: () => stringToObject
2595
- });
2596
- module22.exports = __toCommonJS22(object_exports);
2597
- var import_globals3 = require_globals2();
2598
- var import_types = require_types2();
2599
- var import_array = require_array2();
2600
- var import_string = require_string2();
2601
- var import_node = require_node2();
2602
- var ENV2 = "development";
2603
- var exec = (param, element, state, context) => {
2604
- if ((0, import_types.isFunction)(param)) {
2605
- return param.call(
2606
- element,
2607
- element,
2608
- state || element.state,
2609
- context || element.context
2610
- );
2611
- }
2612
- return param;
2613
- };
2614
- var map = (obj, extention, element) => {
2615
- for (const e in extention) {
2616
- obj[e] = exec(extention[e], element);
2617
- }
2618
- };
2619
- var merge5 = (element, obj, excludeFrom = []) => {
2620
- for (const e in obj) {
2621
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, e);
2622
- if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
2623
- continue;
2624
- const elementProp = element[e];
2625
- const objProp = obj[e];
2626
- if (elementProp === void 0) {
2627
- element[e] = objProp;
2628
- }
2629
- }
2630
- return element;
2631
- };
2632
- var deepMerge3 = (element, extend, excludeFrom = []) => {
2633
- for (const e in extend) {
2634
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
2635
- if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
2636
- continue;
2637
- const elementProp = element[e];
2638
- const extendProp = extend[e];
2639
- if ((0, import_types.isObjectLike)(elementProp) && (0, import_types.isObjectLike)(extendProp)) {
2640
- deepMerge3(elementProp, extendProp, excludeFrom);
2641
- } else if (elementProp === void 0) {
2642
- element[e] = extendProp;
2643
- }
2644
- }
2645
- return element;
2646
- };
2647
- var clone = (obj, excludeFrom = []) => {
2648
- const o = {};
2649
- for (const prop in obj) {
2650
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, prop);
2651
- if (!hasOwnProperty2 || excludeFrom.includes(prop) || prop.startsWith("__"))
2652
- continue;
2653
- o[prop] = obj[prop];
2654
- }
2655
- return o;
2656
- };
2657
- var mergeArrayExclude = (arr, exclude = []) => {
2658
- return arr.reduce((acc, curr) => deepMerge3(acc, deepClone2(curr, { exclude })), {});
2659
- };
2660
- var deepClone2 = (obj, options = {}) => {
2661
- const {
2662
- exclude = [],
2663
- cleanUndefined = false,
2664
- cleanNull = false,
2665
- window: targetWindow,
2666
- visited = /* @__PURE__ */ new WeakMap(),
2667
- handleExtend = false
2668
- } = options;
2669
- if (!(0, import_types.isObjectLike)(obj) || (0, import_node.isDOMNode)(obj)) {
2670
- return obj;
2671
- }
2672
- if (visited.has(obj)) {
2673
- return visited.get(obj);
2674
- }
2675
- const clone2 = targetWindow ? (0, import_types.isArray)(obj) ? new targetWindow.Array() : new targetWindow.Object() : (0, import_types.isArray)(obj) ? [] : {};
2676
- visited.set(obj, clone2);
2677
- for (const key in obj) {
2678
- if (!Object.prototype.hasOwnProperty.call(obj, key))
2679
- continue;
2680
- if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
2681
- continue;
2682
- const value = obj[key];
2683
- if (cleanUndefined && (0, import_types.isUndefined)(value) || cleanNull && (0, import_types.isNull)(value))
2684
- continue;
2685
- if ((0, import_node.isDOMNode)(value)) {
2686
- clone2[key] = value;
2687
- continue;
2688
- }
2689
- if (handleExtend && key === "extend" && (0, import_types.isArray)(value)) {
2690
- clone2[key] = (0, import_array.mergeArray)(value, exclude);
2691
- continue;
2692
- }
2693
- if ((0, import_types.isFunction)(value) && targetWindow) {
2694
- clone2[key] = targetWindow.eval("(" + value.toString() + ")");
2695
- continue;
2696
- }
2697
- if ((0, import_types.isObjectLike)(value)) {
2698
- clone2[key] = deepClone2(value, {
2699
- ...options,
2700
- visited
2701
- });
2702
- } else {
2703
- clone2[key] = value;
2704
- }
2705
- }
2706
- return clone2;
2707
- };
2708
- var deepStringify = (obj, stringified = {}) => {
2709
- var _a, _b;
2710
- if (obj.node || obj.__ref || obj.parent || obj.__element || obj.parse) {
2711
- (obj.__element || ((_a = obj.parent) == null ? void 0 : _a.__element)).warn("Trying to clone element or state at", obj);
2712
- obj = (_b = obj.parse) == null ? void 0 : _b.call(obj);
2713
- }
2714
- for (const prop in obj) {
2715
- const objProp = obj[prop];
2716
- if ((0, import_types.isFunction)(objProp)) {
2717
- stringified[prop] = objProp.toString();
2718
- } else if ((0, import_types.isObject)(objProp)) {
2719
- stringified[prop] = {};
2720
- deepStringify(objProp, stringified[prop]);
2721
- } else if ((0, import_types.isArray)(objProp)) {
2722
- stringified[prop] = [];
2723
- objProp.forEach((v, i) => {
2724
- if ((0, import_types.isObject)(v)) {
2725
- stringified[prop][i] = {};
2726
- deepStringify(v, stringified[prop][i]);
2727
- } else if ((0, import_types.isFunction)(v)) {
2728
- stringified[prop][i] = v.toString();
2729
- } else {
2730
- stringified[prop][i] = v;
2731
- }
2732
- });
2733
- } else {
2734
- stringified[prop] = objProp;
2735
- }
2736
- }
2737
- return stringified;
2738
- };
2739
- var MAX_DEPTH = 100;
2740
- var deepStringifyWithMaxDepth = (obj, stringified = {}, depth = 0, path = "") => {
2741
- if (depth > MAX_DEPTH) {
2742
- console.warn(`Maximum depth exceeded at path: ${path}. Possible circular reference.`);
2743
- return "[MAX_DEPTH_EXCEEDED]";
2744
- }
2745
- for (const prop in obj) {
2746
- const currentPath = path ? `${path}.${prop}` : prop;
2747
- const objProp = obj[prop];
2748
- if ((0, import_types.isFunction)(objProp)) {
2749
- stringified[prop] = objProp.toString();
2750
- } else if ((0, import_types.isObject)(objProp)) {
2751
- stringified[prop] = {};
2752
- deepStringifyWithMaxDepth(objProp, stringified[prop], depth + 1, currentPath);
2753
- } else if ((0, import_types.isArray)(objProp)) {
2754
- stringified[prop] = [];
2755
- objProp.forEach((v, i) => {
2756
- const itemPath = `${currentPath}[${i}]`;
2757
- if ((0, import_types.isObject)(v)) {
2758
- stringified[prop][i] = {};
2759
- deepStringifyWithMaxDepth(v, stringified[prop][i], depth + 1, itemPath);
2760
- } else if ((0, import_types.isFunction)(v)) {
2761
- stringified[prop][i] = v.toString();
2762
- } else {
2763
- stringified[prop][i] = v;
2764
- }
2765
- });
2766
- } else {
2767
- stringified[prop] = objProp;
2768
- }
2769
- }
2770
- return stringified;
2771
- };
2772
- var objectToString = (obj = {}, indent = 0) => {
2773
- if (obj === null || typeof obj !== "object") {
2774
- return String(obj);
2775
- }
2776
- if (Object.keys(obj).length === 0) {
2777
- return "{}";
2778
- }
2779
- const spaces = " ".repeat(indent);
2780
- let str = "{\n";
2781
- for (const [key, value] of Object.entries(obj)) {
2782
- const keyNotAllowdChars = (0, import_string.stringIncludesAny)(key, ["&", "*", "-", ":", "%", "{", "}", ">", "<", "@", ".", "/", "!", " "]);
2783
- const stringedKey = keyNotAllowdChars ? `'${key}'` : key;
2784
- str += `${spaces} ${stringedKey}: `;
2785
- if ((0, import_types.isArray)(value)) {
2786
- str += "[\n";
2787
- for (const element of value) {
2788
- if ((0, import_types.isObjectLike)(element) && element !== null) {
2789
- str += `${spaces} ${objectToString(element, indent + 2)},
2790
- `;
2791
- } else if ((0, import_types.isString)(element)) {
2792
- str += `${spaces} '${element}',
2793
- `;
2794
- } else {
2795
- str += `${spaces} ${element},
2796
- `;
2797
- }
2798
- }
2799
- str += `${spaces} ]`;
2800
- } else if ((0, import_types.isObjectLike)(value)) {
2801
- str += objectToString(value, indent + 1);
2802
- } else if ((0, import_types.isString)(value)) {
2803
- str += (0, import_string.stringIncludesAny)(value, ["\n", "'"]) ? `\`${value}\`` : `'${value}'`;
2804
- } else {
2805
- str += value;
2806
- }
2807
- str += ",\n";
2808
- }
2809
- str += `${spaces}}`;
2810
- return str;
2811
- };
2812
- var detachFunctionsFromObject = (obj, detached = {}) => {
2813
- for (const prop in obj) {
2814
- const objProp = obj[prop];
2815
- if ((0, import_types.isFunction)(objProp))
2816
- continue;
2817
- else if ((0, import_types.isObject)(objProp)) {
2818
- detached[prop] = {};
2819
- deepStringify(objProp, detached[prop]);
2820
- } else if ((0, import_types.isArray)(objProp)) {
2821
- detached[prop] = [];
2822
- objProp.forEach((v, i) => {
2823
- if ((0, import_types.isFunction)(v))
2824
- return;
2825
- if ((0, import_types.isObject)(v)) {
2826
- detached[prop][i] = {};
2827
- detachFunctionsFromObject(v, detached[prop][i]);
2828
- } else {
2829
- detached[prop][i] = v;
2830
- }
2831
- });
2832
- } else {
2833
- detached[prop] = objProp;
2834
- }
2835
- }
2836
- return detached;
2837
- };
2838
- var deepDestringify = (obj, destringified = {}) => {
2839
- for (const prop in obj) {
2840
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, prop);
2841
- if (!hasOwnProperty2)
2842
- continue;
2843
- const objProp = obj[prop];
2844
- if ((0, import_types.isString)(objProp)) {
2845
- if ((objProp.includes("(){") || objProp.includes("() {") || objProp.includes("=>") || objProp.startsWith("()") || objProp.startsWith("async") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
2846
- try {
2847
- const evalProp = import_globals3.window.eval(`(${objProp})`);
2848
- destringified[prop] = evalProp;
2849
- } catch (e) {
2850
- if (e)
2851
- destringified[prop] = objProp;
2852
- }
2853
- } else {
2854
- destringified[prop] = objProp;
2855
- }
2856
- } else if ((0, import_types.isArray)(objProp)) {
2857
- destringified[prop] = [];
2858
- objProp.forEach((arrProp) => {
2859
- if ((0, import_types.isString)(arrProp)) {
2860
- if (arrProp.includes("=>") || arrProp.includes("function") || arrProp.startsWith("(")) {
2861
- try {
2862
- const evalProp = import_globals3.window.eval(`(${arrProp})`);
2863
- destringified[prop].push(evalProp);
2864
- } catch (e) {
2865
- if (e)
2866
- destringified[prop].push(arrProp);
2867
- }
2868
- } else {
2869
- destringified[prop].push(arrProp);
2870
- }
2871
- } else if ((0, import_types.isObject)(arrProp)) {
2872
- destringified[prop].push(deepDestringify(arrProp));
2873
- } else {
2874
- destringified[prop].push(arrProp);
2875
- }
2876
- });
2877
- } else if ((0, import_types.isObject)(objProp)) {
2878
- destringified[prop] = deepDestringify(objProp, destringified[prop]);
2879
- } else {
2880
- destringified[prop] = objProp;
2881
- }
2882
- }
2883
- return destringified;
2884
- };
2885
- var stringToObject = (str, opts = { verbose: true }) => {
2886
- try {
2887
- return str ? import_globals3.window.eval("(" + str + ")") : {};
2888
- } catch (e) {
2889
- if (opts.verbose)
2890
- console.warn(e);
2891
- }
2892
- };
2893
- var diffObjects = (original, objToDiff, cache) => {
2894
- for (const e in objToDiff) {
2895
- if (e === "ref")
2896
- continue;
2897
- const originalProp = original[e];
2898
- const objToDiffProp = objToDiff[e];
2899
- if ((0, import_types.isObject)(originalProp) && (0, import_types.isObject)(objToDiffProp)) {
2900
- cache[e] = {};
2901
- diff(originalProp, objToDiffProp, cache[e]);
2902
- } else if (objToDiffProp !== void 0) {
2903
- cache[e] = objToDiffProp;
2904
- }
2905
- }
2906
- return cache;
2907
- };
2908
- var diffArrays = (original, objToDiff, cache) => {
2909
- if (original.length !== objToDiff.length) {
2910
- cache = objToDiff;
2911
- } else {
2912
- const diffArr = [];
2913
- for (let i = 0; i < original.length; i++) {
2914
- const diffObj = diff(original[i], objToDiff[i]);
2915
- if (Object.keys(diffObj).length > 0) {
2916
- diffArr.push(diffObj);
2917
- }
2918
- }
2919
- if (diffArr.length > 0) {
2920
- cache = diffArr;
2921
- }
2922
- }
2923
- return cache;
2924
- };
2925
- var diff = (original, objToDiff, cache = {}) => {
2926
- if ((0, import_types.isArray)(original) && (0, import_types.isArray)(objToDiff)) {
2927
- cache = [];
2928
- diffArrays(original, objToDiff, cache);
2929
- } else {
2930
- diffObjects(original, objToDiff, cache);
2931
- }
2932
- return cache;
2933
- };
2934
- var hasOwnProperty = (o, ...args) => Object.prototype.hasOwnProperty.call(o, ...args);
2935
- var isEmpty = (o) => Object.keys(o).length === 0;
2936
- var isEmptyObject = (o) => (0, import_types.isObject)(o) && isEmpty(o);
2937
- var makeObjectWithoutPrototype = () => /* @__PURE__ */ Object.create(null);
2938
- var deepDiff = (lhs, rhs) => {
2939
- if (lhs === rhs)
2940
- return {};
2941
- if (!(0, import_types.isObjectLike)(lhs) || !(0, import_types.isObjectLike)(rhs))
2942
- return rhs;
2943
- const deletedValues = Object.keys(lhs).reduce((acc, key) => {
2944
- if (!hasOwnProperty(rhs, key)) {
2945
- acc[key] = void 0;
2946
- }
2947
- return acc;
2948
- }, makeObjectWithoutPrototype());
2949
- if ((0, import_types.isDate)(lhs) || (0, import_types.isDate)(rhs)) {
2950
- if (lhs.valueOf() === rhs.valueOf())
2951
- return {};
2952
- return rhs;
2953
- }
2954
- return Object.keys(rhs).reduce((acc, key) => {
2955
- if (!hasOwnProperty(lhs, key)) {
2956
- acc[key] = rhs[key];
2957
- return acc;
2958
- }
2959
- const difference = diff(lhs[key], rhs[key]);
2960
- if (isEmptyObject(difference) && !(0, import_types.isDate)(difference) && (isEmptyObject(lhs[key]) || !isEmptyObject(rhs[key]))) {
2961
- return acc;
2962
- }
2963
- acc[key] = difference;
2964
- return acc;
2965
- }, deletedValues);
2966
- };
2967
- var overwrite = (element, params, opts = {}) => {
2968
- const { __ref: ref } = element;
2969
- const excl = opts.exclude || [];
2970
- const allowUnderscore = opts.preventUnderscore;
2971
- const preventCaching = opts.preventCaching;
2972
- for (const e in params) {
2973
- if (excl.includes(e) || !allowUnderscore && e.startsWith("__"))
2974
- continue;
2975
- const elementProp = element[e];
2976
- const paramsProp = params[e];
2977
- if (paramsProp !== void 0) {
2978
- element[e] = paramsProp;
2979
- if (ref && !preventCaching) {
2980
- ref.__cache[e] = elementProp;
2981
- }
2982
- if ((0, import_types.isObject)(opts.diff)) {
2983
- diff[e] = elementProp;
2984
- }
2985
- }
2986
- }
2987
- return element;
2988
- };
2989
- var overwriteShallow = (obj, params, excludeFrom = []) => {
2990
- for (const e in params) {
2991
- if (excludeFrom.includes(e) || e.startsWith("__"))
2992
- continue;
2993
- obj[e] = params[e];
2994
- }
2995
- return obj;
2996
- };
2997
- var overwriteDeep2 = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
2998
- const excl = opts.exclude || [];
2999
- const forcedExclude = opts.preventForce ? [] : ["node", "window"];
3000
- if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
3001
- return params;
3002
- }
3003
- if (visited.has(obj))
3004
- return visited.get(obj);
3005
- visited.set(obj, obj);
3006
- for (const e in params) {
3007
- if (!Object.hasOwnProperty.call(params, e))
3008
- continue;
3009
- if (excl.includes(e) || forcedExclude && e.startsWith("__"))
3010
- continue;
3011
- const objProp = obj[e];
3012
- const paramsProp = params[e];
3013
- if ((0, import_node.isDOMNode)(paramsProp)) {
3014
- obj[e] = paramsProp;
3015
- } else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
3016
- obj[e] = overwriteDeep2(objProp, paramsProp, opts, visited);
3017
- } else if (paramsProp !== void 0) {
3018
- obj[e] = paramsProp;
3019
- }
3020
- }
3021
- return obj;
3022
- };
3023
- var mergeIfExisted = (a, b) => {
3024
- if ((0, import_types.isObjectLike)(a) && (0, import_types.isObjectLike)(b))
3025
- return deepMerge3(a, b);
3026
- return a || b;
3027
- };
3028
- var flattenRecursive = (param, prop, stack = []) => {
3029
- const objectized = (0, import_array.mergeAndCloneIfArray)(param);
3030
- stack.push(objectized);
3031
- const extendOfExtend = objectized[prop];
3032
- if (extendOfExtend)
3033
- flattenRecursive(extendOfExtend, prop, stack);
3034
- delete objectized[prop];
3035
- return stack;
3036
- };
3037
- var isEqualDeep = (param, element, visited = /* @__PURE__ */ new Set()) => {
3038
- if (typeof param !== "object" || typeof element !== "object" || param === null || element === null) {
3039
- return param === element;
3040
- }
3041
- if (visited.has(param) || visited.has(element)) {
3042
- return true;
3043
- }
3044
- visited.add(param);
3045
- visited.add(element);
3046
- const keysParam = Object.keys(param);
3047
- const keysElement = Object.keys(element);
3048
- if (keysParam.length !== keysElement.length) {
3049
- return false;
3050
- }
3051
- for (const key of keysParam) {
3052
- if (!keysElement.includes(key)) {
3053
- return false;
3054
- }
3055
- const paramProp = param[key];
3056
- const elementProp = element[key];
3057
- if (!isEqualDeep(paramProp, elementProp, visited)) {
3058
- return false;
3059
- }
3060
- }
3061
- return true;
3062
- };
3063
- var deepContains = (obj1, obj2, ignoredKeys = ["node", "__ref"]) => {
3064
- if (obj1 === obj2)
3065
- return true;
3066
- if (!(0, import_types.isObjectLike)(obj1) || !(0, import_types.isObjectLike)(obj2))
3067
- return false;
3068
- if ((0, import_node.isDOMNode)(obj1) || (0, import_node.isDOMNode)(obj2))
3069
- return obj1 === obj2;
3070
- const stack = [[obj1, obj2]];
3071
- const visited = /* @__PURE__ */ new WeakSet();
3072
- while (stack.length > 0) {
3073
- const [current1, current2] = stack.pop();
3074
- if (visited.has(current1))
3075
- continue;
3076
- visited.add(current1);
3077
- const keys1 = Object.keys(current1).filter((key) => !ignoredKeys.includes(key));
3078
- const keys2 = Object.keys(current2).filter((key) => !ignoredKeys.includes(key));
3079
- if (keys1.length !== keys2.length)
3080
- return false;
3081
- for (const key of keys1) {
3082
- if (!Object.prototype.hasOwnProperty.call(current2, key))
3083
- return false;
3084
- const value1 = current1[key];
3085
- const value2 = current2[key];
3086
- if ((0, import_node.isDOMNode)(value1) || (0, import_node.isDOMNode)(value2)) {
3087
- if (value1 !== value2)
3088
- return false;
3089
- } else if ((0, import_types.isObjectLike)(value1) && (0, import_types.isObjectLike)(value2)) {
3090
- if (value1 !== value2) {
3091
- stack.push([value1, value2]);
3092
- }
3093
- } else if (value1 !== value2) {
3094
- return false;
3095
- }
3096
- }
3097
- }
3098
- return true;
3099
- };
3100
- var removeFromObject = (obj, props) => {
3101
- if (props === void 0 || props === null)
3102
- return obj;
3103
- if ((0, import_types.is)(props)("string", "number")) {
3104
- delete obj[props];
3105
- } else if ((0, import_types.isArray)(props)) {
3106
- props.forEach((prop) => delete obj[prop]);
3107
- } else {
3108
- throw new Error("Invalid input: props must be a string or an array of strings");
3109
- }
3110
- return obj;
3111
- };
3112
- var createObjectWithoutPrototype = (obj) => {
3113
- if (obj === null || typeof obj !== "object") {
3114
- return obj;
3115
- }
3116
- const newObj = /* @__PURE__ */ Object.create(null);
3117
- for (const key in obj) {
3118
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
3119
- newObj[key] = createObjectWithoutPrototype(obj[key]);
3120
- }
3121
- }
3122
- return newObj;
3123
- };
3124
- var createNestedObject = (arr, lastValue) => {
3125
- const nestedObject = {};
3126
- if (arr.length === 0) {
3127
- return lastValue;
3128
- }
3129
- arr.reduce((obj, value, index) => {
3130
- if (!obj[value]) {
3131
- obj[value] = {};
3132
- }
3133
- if (index === arr.length - 1 && lastValue) {
3134
- obj[value] = lastValue;
3135
- }
3136
- return obj[value];
3137
- }, nestedObject);
3138
- return nestedObject;
3139
- };
3140
- var removeNestedKeyByPath = (obj, path) => {
3141
- if (!Array.isArray(path)) {
3142
- throw new Error("Path must be an array.");
3143
- }
3144
- let current = obj;
3145
- for (let i = 0; i < path.length - 1; i++) {
3146
- if (current[path[i]] === void 0) {
3147
- return;
3148
- }
3149
- current = current[path[i]];
3150
- }
3151
- const lastKey = path[path.length - 1];
3152
- if (current && Object.hasOwnProperty.call(current, lastKey)) {
3153
- delete current[lastKey];
3154
- }
3155
- };
3156
- var detectInfiniteLoop = (arr) => {
3157
- const maxRepeats = 10;
3158
- let pattern = [];
3159
- let repeatCount = 0;
3160
- for (let i = 0; i < arr.length; i++) {
3161
- if (pattern.length < 2) {
3162
- pattern.push(arr[i]);
3163
- } else {
3164
- if (arr[i] === pattern[i % 2]) {
3165
- repeatCount++;
3166
- } else {
3167
- pattern = [arr[i - 1], arr[i]];
3168
- repeatCount = 1;
3169
- }
3170
- if (repeatCount >= maxRepeats * 2) {
3171
- if (ENV2 === "test" || ENV2 === "development") {
3172
- console.warn("Warning: Potential infinite loop detected due to repeated sequence:", pattern);
3173
- }
3174
- return true;
3175
- }
3176
- }
3177
- }
3178
- };
3179
- var isCyclic = (obj) => {
3180
- const seenObjects = [];
3181
- function detect(obj2) {
3182
- if (obj2 && typeof obj2 === "object") {
3183
- if (seenObjects.indexOf(obj2) !== -1) {
3184
- return true;
3185
- }
3186
- seenObjects.push(obj2);
3187
- for (const key in obj2) {
3188
- if (Object.hasOwnProperty.call(obj2, key) && detect(obj2[key])) {
3189
- console.log(obj2, "cycle at " + key);
3190
- return true;
3191
- }
3192
- }
3193
- }
3194
- return false;
3195
- }
3196
- return detect(obj);
3197
- };
3198
- var excludeKeysFromObject = (obj, excludedKeys) => {
3199
- const result = { ...obj };
3200
- excludedKeys.forEach((key) => delete result[key]);
3201
- return result;
3202
- };
3203
- }
3204
- });
3205
- var require_function2 = __commonJS2({
3206
- "../../node_modules/@domql/utils/dist/cjs/function.js"(exports2, module22) {
3207
- "use strict";
3208
- var __defProp22 = Object.defineProperty;
3209
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
3210
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
3211
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
3212
- var __export22 = (target, all) => {
3213
- for (var name in all)
3214
- __defProp22(target, name, { get: all[name], enumerable: true });
3215
- };
3216
- var __copyProps22 = (to, from, except, desc) => {
3217
- if (from && typeof from === "object" || typeof from === "function") {
3218
- for (let key of __getOwnPropNames22(from))
3219
- if (!__hasOwnProp22.call(to, key) && key !== except)
3220
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
3221
- }
3222
- return to;
3223
- };
3224
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
3225
- var function_exports = {};
3226
- __export22(function_exports, {
3227
- cloneFunction: () => cloneFunction,
3228
- debounce: () => debounce,
3229
- debounceOnContext: () => debounceOnContext,
3230
- isStringFunction: () => isStringFunction,
3231
- memoize: () => memoize
3232
- });
3233
- module22.exports = __toCommonJS22(function_exports);
3234
- function debounce(func, wait, immediate) {
3235
- let timeout;
3236
- return function() {
3237
- const context = this;
3238
- const args = arguments;
3239
- const later = function() {
3240
- timeout = null;
3241
- if (!immediate)
3242
- func.apply(context, args);
3243
- };
3244
- const callNow = immediate && !timeout;
3245
- clearTimeout(timeout);
3246
- timeout = setTimeout(later, wait);
3247
- if (callNow)
3248
- func.apply(context, args);
3249
- };
3250
- }
3251
- var debounceOnContext = (element, func, timeout = 300) => {
3252
- let timer;
3253
- return (...args) => {
3254
- clearTimeout(timer);
3255
- timer = setTimeout(() => {
3256
- func.apply(element, args);
3257
- }, timeout);
3258
- };
3259
- };
3260
- var memoize = (fn) => {
3261
- const cache = {};
3262
- return (...args) => {
3263
- const n = args[0];
3264
- if (n in cache) {
3265
- return cache[n];
3266
- } else {
3267
- const result = fn(n);
3268
- cache[n] = result;
3269
- return result;
3270
- }
3271
- };
3272
- };
3273
- var isStringFunction = (inputString) => {
3274
- const functionRegex = /^((function\s*\([^)]*\)\s*\{[^}]*\})|(\([^)]*\)\s*=>))/;
3275
- return functionRegex.test(inputString);
3276
- };
3277
- function cloneFunction(fn, win = window) {
3278
- const temp = function() {
3279
- return fn.apply(win, arguments);
3280
- };
3281
- for (const key in fn) {
3282
- if (Object.hasOwnProperty.call(fn, key)) {
3283
- temp[key] = fn[key];
3284
- }
3285
- }
3286
- return temp;
3287
- }
3288
- }
3289
- });
3290
- var require_log2 = __commonJS2({
3291
- "../../node_modules/@domql/utils/dist/cjs/log.js"(exports2, module22) {
3292
- "use strict";
3293
- var __defProp22 = Object.defineProperty;
3294
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
3295
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
3296
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
3297
- var __export22 = (target, all) => {
3298
- for (var name in all)
3299
- __defProp22(target, name, { get: all[name], enumerable: true });
3300
- };
3301
- var __copyProps22 = (to, from, except, desc) => {
3302
- if (from && typeof from === "object" || typeof from === "function") {
3303
- for (let key of __getOwnPropNames22(from))
3304
- if (!__hasOwnProp22.call(to, key) && key !== except)
3305
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
3306
- }
3307
- return to;
3308
- };
3309
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
3310
- var log_exports = {};
3311
- __export22(log_exports, {
3312
- logGroupIf: () => logGroupIf,
3313
- logIf: () => logIf
3314
- });
3315
- module22.exports = __toCommonJS22(log_exports);
3316
- var logIf = (bool, ...arg) => {
3317
- if (bool)
3318
- arg.map((v) => console.log(v));
3319
- };
3320
- var logGroupIf = (bool, key, ...arg) => {
3321
- if (bool) {
3322
- console.group(key);
3323
- arg.map((v) => console.log(v));
3324
- console.groupEnd(key);
3325
- }
3326
- };
3327
- }
3328
- });
3329
- var require_cookie2 = __commonJS2({
3330
- "../../node_modules/@domql/utils/dist/cjs/cookie.js"(exports2, module22) {
3331
- "use strict";
3332
- var __defProp22 = Object.defineProperty;
3333
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
3334
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
3335
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
3336
- var __export22 = (target, all) => {
3337
- for (var name in all)
3338
- __defProp22(target, name, { get: all[name], enumerable: true });
3339
- };
3340
- var __copyProps22 = (to, from, except, desc) => {
3341
- if (from && typeof from === "object" || typeof from === "function") {
3342
- for (let key of __getOwnPropNames22(from))
3343
- if (!__hasOwnProp22.call(to, key) && key !== except)
3344
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
3345
- }
3346
- return to;
3347
- };
3348
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
3349
- var cookie_exports = {};
3350
- __export22(cookie_exports, {
3351
- getCookie: () => getCookie,
3352
- getLocalStorage: () => getLocalStorage,
3353
- isMobile: () => isMobile,
3354
- removeCookie: () => removeCookie,
3355
- setCookie: () => setCookie,
3356
- setLocalStorage: () => setLocalStorage
3357
- });
3358
- module22.exports = __toCommonJS22(cookie_exports);
3359
- var import_types = require_types2();
3360
- var import_utils32 = require_cjs4();
3361
- var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
3362
- var setCookie = (cname, cvalue, exdays = 365) => {
3363
- if ((0, import_types.isUndefined)(import_utils32.document) || (0, import_types.isUndefined)(import_utils32.document.cookie))
3364
- return;
3365
- const d = /* @__PURE__ */ new Date();
3366
- d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1e3);
3367
- const expires = `expires=${d.toUTCString()}`;
3368
- import_utils32.document.cookie = `${cname}=${cvalue};${expires};path=/`;
3369
- };
3370
- var getCookie = (cname) => {
3371
- if ((0, import_types.isUndefined)(import_utils32.document) || (0, import_types.isUndefined)(import_utils32.document.cookie))
3372
- return;
3373
- const name = `${cname}=`;
3374
- const decodedCookie = decodeURIComponent(import_utils32.document.cookie);
3375
- const ca = decodedCookie.split(";");
3376
- for (let i = 0; i < ca.length; i++) {
3377
- let c = ca[i];
3378
- while (c.charAt(0) === " ")
3379
- c = c.substring(1);
3380
- if (c.indexOf(name) === 0)
3381
- return c.substring(name.length, c.length);
3382
- }
3383
- return "";
3384
- };
3385
- var removeCookie = (cname) => {
3386
- if ((0, import_types.isUndefined)(import_utils32.document) || (0, import_types.isUndefined)(import_utils32.document.cookie))
3387
- return;
3388
- import_utils32.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
3389
- };
3390
- function getLocalStorage(key) {
3391
- let savedJSON;
3392
- if (window.localStorage) {
3393
- try {
3394
- savedJSON = JSON.parse(window.localStorage.getItem(key));
3395
- } catch (e) {
3396
- }
3397
- }
3398
- if (typeof savedJSON !== "undefined") {
3399
- return savedJSON;
3400
- }
3401
- }
3402
- function setLocalStorage(key, data) {
3403
- if (data && window.localStorage) {
3404
- if (typeof data === "object") {
3405
- window.localStorage.setItem(key, JSON.stringify(data));
3406
- } else {
3407
- window.localStorage.setItem(key, data);
3408
- }
3409
- }
3410
- }
3411
- }
3412
- });
3413
- var require_tags2 = __commonJS2({
3414
- "../../node_modules/@domql/utils/dist/cjs/tags.js"(exports2, module22) {
3415
- "use strict";
3416
- var __defProp22 = Object.defineProperty;
3417
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
3418
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
3419
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
3420
- var __export22 = (target, all) => {
3421
- for (var name in all)
3422
- __defProp22(target, name, { get: all[name], enumerable: true });
3423
- };
3424
- var __copyProps22 = (to, from, except, desc) => {
3425
- if (from && typeof from === "object" || typeof from === "function") {
3426
- for (let key of __getOwnPropNames22(from))
3427
- if (!__hasOwnProp22.call(to, key) && key !== except)
3428
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
3429
- }
3430
- return to;
3431
- };
3432
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
3433
- var tags_exports = {};
3434
- __export22(tags_exports, {
3435
- HTML_TAGS: () => HTML_TAGS,
3436
- isValidHtmlTag: () => isValidHtmlTag
3437
- });
3438
- module22.exports = __toCommonJS22(tags_exports);
3439
- var HTML_TAGS = {
3440
- root: [
3441
- "body",
3442
- "html"
3443
- ],
3444
- head: [
3445
- "title",
3446
- "base",
3447
- "meta",
3448
- "style",
3449
- "noscript",
3450
- "script"
3451
- ],
3452
- body: [
3453
- "string",
3454
- "style",
3455
- "fragment",
3456
- "a",
3457
- "abbr",
3458
- "acronym",
3459
- "address",
3460
- "applet",
3461
- "area",
3462
- "article",
3463
- "aside",
3464
- "audio",
3465
- "b",
3466
- "basefont",
3467
- "bdi",
3468
- "bdo",
3469
- "big",
3470
- "blockquote",
3471
- "br",
3472
- "button",
3473
- "canvas",
3474
- "caption",
3475
- "center",
3476
- "cite",
3477
- "code",
3478
- "search",
3479
- "col",
3480
- "colgroup",
3481
- "data",
3482
- "datalist",
3483
- "dd",
3484
- "del",
3485
- "details",
3486
- "dfn",
3487
- "dialog",
3488
- "dir",
3489
- "div",
3490
- "dl",
3491
- "dt",
3492
- "em",
3493
- "embed",
3494
- "fieldset",
3495
- "figcaption",
3496
- "figure",
3497
- "font",
3498
- "footer",
3499
- "form",
3500
- "frame",
3501
- "frameset",
3502
- "h1",
3503
- "h2",
3504
- "h3",
3505
- "h4",
3506
- "h5",
3507
- "h6",
3508
- "head",
3509
- "header",
3510
- "hr",
3511
- "i",
3512
- "iframe",
3513
- "img",
3514
- "input",
3515
- "ins",
3516
- "kbd",
3517
- "label",
3518
- "legend",
3519
- "li",
3520
- "link",
3521
- "main",
3522
- "map",
3523
- "mark",
3524
- "meter",
3525
- "nav",
3526
- "noframes",
3527
- "noscript",
3528
- "object",
3529
- "ol",
3530
- "optgroup",
3531
- "option",
3532
- "output",
3533
- "p",
3534
- "param",
3535
- "picture",
3536
- "pre",
3537
- "progress",
3538
- "hgroup",
3539
- "q",
3540
- "rp",
3541
- "rt",
3542
- "ruby",
3543
- "s",
3544
- "samp",
3545
- "script",
3546
- "section",
3547
- "select",
3548
- "small",
3549
- "source",
3550
- "span",
3551
- "strike",
3552
- "strong",
3553
- "sub",
3554
- "summary",
3555
- "sup",
3556
- "table",
3557
- "tbody",
3558
- "td",
3559
- "template",
3560
- "hgroup",
3561
- "textarea",
3562
- "tfoot",
3563
- "th",
3564
- "thead",
3565
- "time",
3566
- "tr",
3567
- "track",
3568
- "tt",
3569
- "u",
3570
- "ul",
3571
- "var",
3572
- "video",
3573
- "wbr",
3574
- // SVG
3575
- "svg",
3576
- "path"
3577
- ]
3578
- };
3579
- var isValidHtmlTag = (arg) => HTML_TAGS.body.includes(arg);
3580
- }
3581
- });
3582
- var require_component2 = __commonJS2({
3583
- "../../node_modules/@domql/utils/dist/cjs/component.js"(exports2, module22) {
3584
- "use strict";
3585
- var __defProp22 = Object.defineProperty;
3586
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
3587
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
3588
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
3589
- var __export22 = (target, all) => {
3590
- for (var name in all)
3591
- __defProp22(target, name, { get: all[name], enumerable: true });
3592
- };
3593
- var __copyProps22 = (to, from, except, desc) => {
3594
- if (from && typeof from === "object" || typeof from === "function") {
3595
- for (let key of __getOwnPropNames22(from))
3596
- if (!__hasOwnProp22.call(to, key) && key !== except)
3597
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
3598
- }
3599
- return to;
3600
- };
3601
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
3602
- var component_exports = {};
3603
- __export22(component_exports, {
3604
- addAdditionalExtend: () => addAdditionalExtend,
3605
- addChildrenIfNotInOriginal: () => addChildrenIfNotInOriginal,
3606
- applyComponentFromContext: () => applyComponentFromContext,
3607
- applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
3608
- checkIfKeyIsComponent: () => checkIfKeyIsComponent,
3609
- checkIfKeyIsProperty: () => checkIfKeyIsProperty,
3610
- checkIfSugar: () => checkIfSugar,
3611
- extendizeByKey: () => extendizeByKey,
3612
- extractComponentKeyFromKey: () => extractComponentKeyFromKey,
3613
- getCapitalCaseKeys: () => getCapitalCaseKeys,
3614
- getChildrenComponentsByKey: () => getChildrenComponentsByKey,
3615
- getExtendsInElement: () => getExtendsInElement,
3616
- hasVariantProp: () => hasVariantProp,
3617
- isVariant: () => isVariant,
3618
- setContentKey: () => setContentKey
3619
- });
3620
- module22.exports = __toCommonJS22(component_exports);
3621
- var import__ = require_cjs4();
3622
- var ENV2 = "development";
3623
- var checkIfKeyIsComponent = (key) => {
3624
- const isFirstKeyString = (0, import__.isString)(key);
3625
- if (!isFirstKeyString)
3626
- return;
3627
- const firstCharKey = key.slice(0, 1);
3628
- return /^[A-Z]*$/.test(firstCharKey);
3629
- };
3630
- var checkIfKeyIsProperty = (key) => {
3631
- const isFirstKeyString = (0, import__.isString)(key);
3632
- if (!isFirstKeyString)
3633
- return;
3634
- const firstCharKey = key.slice(0, 1);
3635
- return /^[a-z]*$/.test(firstCharKey);
3636
- };
3637
- var addAdditionalExtend = (newExtend, element) => {
3638
- if (!newExtend)
3639
- return element;
3640
- const { extend: elementExtend } = element;
3641
- const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
3642
- const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
3643
- const extend = (0, import__.joinArrays)(receivedArray, originalArray);
3644
- return { ...element, extend };
3645
- };
3646
- var checkIfSugar = (element, parent, key) => {
3647
- var _a;
3648
- const {
3649
- extend,
3650
- props,
3651
- childExtend,
3652
- extends: extendProps,
3653
- childExtends,
3654
- childProps,
3655
- children,
3656
- on,
3657
- $collection,
3658
- $stateCollection,
3659
- $propsCollection
3660
- } = element;
3661
- const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection;
3662
- if (hasComponentAttrs && (childProps || extendProps || children || childExtends)) {
3663
- const logErr = (_a = parent || element) == null ? void 0 : _a.error;
3664
- if (logErr)
3665
- logErr.call(element, "Sugar component includes params for builtin components", { verbose: true });
3666
- }
3667
- return !hasComponentAttrs || childProps || extendProps || children || childExtends;
3668
- };
3669
- var extractComponentKeyFromKey = (key) => {
3670
- return key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
3671
- };
3672
- var extendizeByKey = (element, parent, key) => {
3673
- const { context } = parent;
3674
- const { tag, extend, childExtends } = element;
3675
- const isSugar = checkIfSugar(element, parent, key);
3676
- const extendFromKey = extractComponentKeyFromKey(key);
3677
- const isExtendKeyComponent = context && context.components[extendFromKey];
3678
- if (element === isExtendKeyComponent)
3679
- return element;
3680
- else if (isSugar) {
3681
- const newElem = addAdditionalExtend(element.extends, {
3682
- extend: extendFromKey,
3683
- tag,
3684
- props: { ...element }
3685
- });
3686
- if (newElem.props.data) {
3687
- newElem.data = newElem.props.data;
3688
- delete newElem.props.data;
3689
- }
3690
- if (newElem.props.state) {
3691
- newElem.state = newElem.props.state;
3692
- delete newElem.props.state;
3693
- }
3694
- if (newElem.props.attr) {
3695
- newElem.attr = newElem.props.attr;
3696
- delete newElem.props.attr;
3697
- }
3698
- if (newElem.props.if) {
3699
- newElem.if = newElem.props.if;
3700
- delete newElem.props.if;
3701
- }
3702
- if (childExtends)
3703
- newElem.childExtend = childExtends;
3704
- return newElem;
3705
- } else if (!extend || extend === true) {
3706
- return {
3707
- ...element,
3708
- tag,
3709
- extend: extendFromKey
3710
- };
3711
- } else if (extend) {
3712
- return addAdditionalExtend(extendFromKey, element);
3713
- } else if ((0, import__.isFunction)(element)) {
3714
- return {
3715
- extend: extendFromKey,
3716
- tag,
3717
- props: { ...(0, import__.exec)(element, parent) }
3718
- };
3719
- }
3720
- };
3721
- function getCapitalCaseKeys(obj) {
3722
- return Object.keys(obj).filter((key) => /^[A-Z]/.test(key));
3723
- }
3724
- var addChildrenIfNotInOriginal = (element, parent, key) => {
3725
- const childElems = getCapitalCaseKeys(element.props);
3726
- if (!childElems.length)
3727
- return element;
3728
- for (const i in childElems) {
3729
- const childKey = childElems[i];
3730
- const childElem = element[childKey];
3731
- const newChild = element.props[childKey];
3732
- const assignChild = (val) => {
3733
- element[childKey] = val;
3734
- delete element.props[childKey];
3735
- };
3736
- if (newChild == null ? void 0 : newChild.ignoreExtend)
3737
- continue;
3738
- if (newChild === null)
3739
- assignChild(null);
3740
- else if (!childElem)
3741
- assignChild((0, import__.deepClone)(newChild));
3742
- else {
3743
- const isSugarChildElem = checkIfSugar(childElem, parent, key);
3744
- if (isSugarChildElem)
3745
- continue;
3746
- assignChild({
3747
- extend: element[childKey],
3748
- props: newChild
3749
- });
3750
- }
3751
- }
3752
- };
3753
- var applyKeyComponentAsExtend = (element, parent, key) => {
3754
- return extendizeByKey(element, parent, key) || element;
3755
- };
3756
- var applyComponentFromContext = (element, parent, options) => {
3757
- const { context } = element;
3758
- if (!context || !context.components)
3759
- return;
3760
- const { components } = context;
3761
- const { extend } = element;
3762
- const execExtend = (0, import__.exec)(extend, element);
3763
- if ((0, import__.isString)(execExtend)) {
3764
- const componentExists = components[execExtend] || components["smbls." + execExtend];
3765
- if (componentExists)
3766
- element.extend = componentExists;
3767
- else {
3768
- if ((ENV2 === "test" || ENV2 === "development") && options.verbose) {
3769
- console.warn(execExtend, "is not in library", components, element);
3770
- console.warn("replacing with ", {});
3771
- }
3772
- element.extend = {};
3773
- }
3774
- }
3775
- };
3776
- var isVariant = (param) => {
3777
- if (!(0, import__.isString)(param))
3778
- return;
3779
- const firstCharKey = param.slice(0, 1);
3780
- return firstCharKey === ".";
3781
- };
3782
- var hasVariantProp = (element) => {
3783
- const { props } = element;
3784
- if ((0, import__.isObject)(props) && (0, import__.isString)(props.variant))
3785
- return true;
3786
- };
3787
- var getChildrenComponentsByKey = (key, el) => {
3788
- if (key === el.key || el.__ref.__componentKey === key) {
3789
- return el;
3790
- }
3791
- if (el.extend) {
3792
- const foundString = (0, import__.isString)(el.extend) && el.extend === key;
3793
- const foundInArray = (0, import__.isArray)(el.extend) && el.extend.filter((v) => v === key).length;
3794
- if (foundString || foundInArray)
3795
- return el;
3796
- }
3797
- if (el.parent && el.parent.childExtend) {
3798
- const foundString = (0, import__.isString)(el.parent.childExtend) && el.parent.childExtend === key;
3799
- const foundInArray = (0, import__.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
3800
- if (foundString || foundInArray)
3801
- return el;
3802
- }
3803
- };
3804
- var getExtendsInElement = (obj) => {
3805
- let result = [];
3806
- function traverse(o) {
3807
- for (const key in o) {
3808
- if (Object.hasOwnProperty.call(o, key)) {
3809
- if (checkIfKeyIsComponent(key)) {
3810
- result.push(key);
3811
- }
3812
- if (key === "extend" || key === "extends") {
3813
- if (typeof o[key] === "string") {
3814
- result.push(o[key]);
3815
- } else if (Array.isArray(o[key])) {
3816
- result = result.concat(o[key]);
3817
- }
3818
- }
3819
- if (typeof o[key] === "object" && o[key] !== null) {
3820
- traverse(o[key]);
3821
- }
3822
- }
3823
- }
3824
- }
3825
- traverse(obj);
3826
- return result;
3827
- };
3828
- var setContentKey = (el, opts = {}) => {
3829
- const { __ref: ref } = el;
3830
- const contentElementKey = opts.contentElementKey;
3831
- if (contentElementKey !== "content" && contentElementKey !== ref.contentElementKey || !ref.contentElementKey) {
3832
- ref.contentElementKey = contentElementKey || "content";
3833
- } else
3834
- ref.contentElementKey = "content";
3835
- if (contentElementKey !== "content")
3836
- opts.contentElementKey = "content";
3837
- return ref.contentElementKey;
3838
- };
3839
- }
3840
- });
3841
- var require_cjs4 = __commonJS2({
3842
- "../../node_modules/@domql/utils/dist/cjs/index.js"(exports2, module22) {
3843
- "use strict";
3844
- var __defProp22 = Object.defineProperty;
3845
- var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
3846
- var __getOwnPropNames22 = Object.getOwnPropertyNames;
3847
- var __hasOwnProp22 = Object.prototype.hasOwnProperty;
3848
- var __copyProps22 = (to, from, except, desc) => {
3849
- if (from && typeof from === "object" || typeof from === "function") {
3850
- for (let key of __getOwnPropNames22(from))
3851
- if (!__hasOwnProp22.call(to, key) && key !== except)
3852
- __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
3853
- }
3854
- return to;
3855
- };
3856
- var __reExport = (target, mod, secondTarget) => (__copyProps22(target, mod, "default"), secondTarget && __copyProps22(secondTarget, mod, "default"));
3857
- var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
3858
- var utils_exports2 = {};
3859
- module22.exports = __toCommonJS22(utils_exports2);
3860
- __reExport(utils_exports2, require_key2(), module22.exports);
3861
- __reExport(utils_exports2, require_env2(), module22.exports);
3862
- __reExport(utils_exports2, require_types2(), module22.exports);
3863
- __reExport(utils_exports2, require_object2(), module22.exports);
3864
- __reExport(utils_exports2, require_function2(), module22.exports);
3865
- __reExport(utils_exports2, require_array2(), module22.exports);
3866
- __reExport(utils_exports2, require_node2(), module22.exports);
3867
- __reExport(utils_exports2, require_log2(), module22.exports);
3868
- __reExport(utils_exports2, require_string2(), module22.exports);
3869
- __reExport(utils_exports2, require_globals2(), module22.exports);
3870
- __reExport(utils_exports2, require_cookie2(), module22.exports);
3871
- __reExport(utils_exports2, require_tags2(), module22.exports);
3872
- __reExport(utils_exports2, require_component2(), module22.exports);
3873
- }
3874
- });
89
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
3875
90
  var src_exports2 = {};
3876
91
  __export2(src_exports2, {
3877
92
  arrayzeValue: () => arrayzeValue3,
@@ -3887,7 +102,6 @@ var require_cjs3 = __commonJS({
3887
102
  loadJavascriptFile: () => loadJavascriptFile,
3888
103
  loadJavascriptFileEmbedSync: () => loadJavascriptFileEmbedSync,
3889
104
  loadJavascriptFileSync: () => loadJavascriptFileSync,
3890
- registerFrameListener: () => registerFrameListener,
3891
105
  removeChars: () => removeChars,
3892
106
  toCamelCase: () => toCamelCase2,
3893
107
  toDashCase: () => toDashCase2,
@@ -3896,7 +110,17 @@ var require_cjs3 = __commonJS({
3896
110
  toggleFullscreen: () => toggleFullscreen
3897
111
  });
3898
112
  module2.exports = __toCommonJS2(src_exports2);
3899
- var import_utils27 = __toESM2(require_cjs4(), 1);
113
+ var window22 = globalThis;
114
+ var document22 = window22.document;
115
+ var isObject2 = (arg) => {
116
+ if (arg === null)
117
+ return false;
118
+ return typeof arg === "object" && arg.constructor === Object;
119
+ };
120
+ var isString2 = (arg) => typeof arg === "string";
121
+ var isNumber2 = (arg) => typeof arg === "number";
122
+ var isArray2 = (arg) => Array.isArray(arg);
123
+ var isMobile2 = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
3900
124
  async function toggleFullscreen(opts) {
3901
125
  if (!document.fullscreenElement) {
3902
126
  try {
@@ -3908,15 +132,14 @@ var require_cjs3 = __commonJS({
3908
132
  await document.exitFullscreen();
3909
133
  }
3910
134
  }
3911
- var import_utils28 = __toESM2(require_cjs4(), 1);
3912
135
  var findClosestNumber = (number, arr) => {
3913
- return ((0, import_utils28.isArray)(arr) ? arr : Object.values(arr)).reduce((prev, curr) => {
136
+ return (isArray2(arr) ? arr : Object.values(arr)).reduce((prev, curr) => {
3914
137
  return Math.abs(curr - number) < Math.abs(prev - number) ? curr : prev;
3915
138
  });
3916
139
  };
3917
140
  var findClosestNumberInFactory = (val, factory) => {
3918
141
  val = parseFloat(val);
3919
- if ((0, import_utils28.isObject)(factory))
142
+ if (isObject2(factory))
3920
143
  factory = Object.values(factory);
3921
144
  return findClosestNumber(val, factory);
3922
145
  };
@@ -4025,13 +248,6 @@ var require_cjs3 = __commonJS({
4025
248
  }
4026
249
  };
4027
250
  var isPhoto = (format) => ["jpeg", "gif", "jpg", "png", "tiff", "woff"].includes(format);
4028
- var registerFrameListener = (el) => {
4029
- const { __ref: ref } = el;
4030
- const { frameListeners } = ref.root.data;
4031
- if (frameListeners && !frameListeners.has(el)) {
4032
- frameListeners.add(el);
4033
- }
4034
- };
4035
251
  var copyStringToClipboard = async (str) => {
4036
252
  try {
4037
253
  await navigator.clipboard.writeText(str);
@@ -4071,13 +287,13 @@ var require_cjs3 = __commonJS({
4071
287
  return result.charAt(0).toUpperCase() + result.slice(1);
4072
288
  };
4073
289
  var arrayzeValue3 = (val) => {
4074
- if ((0, import_utils27.isArray)(val))
290
+ if (isArray2(val))
4075
291
  return val;
4076
- if ((0, import_utils27.isString)(val))
292
+ if (isString2(val))
4077
293
  return val.split(" ");
4078
- if ((0, import_utils27.isObject)(val))
294
+ if (isObject2(val))
4079
295
  return Object.values(val);
4080
- if ((0, import_utils27.isNumber)(val))
296
+ if (isNumber2(val))
4081
297
  return [val];
4082
298
  };
4083
299
  }
@@ -4266,8 +482,173 @@ var isScalingUnit = (unit) => {
4266
482
  };
4267
483
 
4268
484
  // src/utils/color.js
4269
- var import_globals = __toESM(require_cjs(), 1);
4270
- var import_utils = __toESM(require_cjs2(), 1);
485
+ var import_globals4 = __toESM(require_cjs(), 1);
486
+
487
+ // ../../../domql/packages/utils/dist/esm/globals.js
488
+ var window2 = globalThis;
489
+ var document2 = window2.document;
490
+
491
+ // ../../../domql/packages/utils/dist/esm/node.js
492
+ var isDOMNode = (obj) => {
493
+ return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
494
+ };
495
+
496
+ // ../../../domql/packages/utils/dist/esm/types.js
497
+ var isObject = (arg) => {
498
+ if (arg === null)
499
+ return false;
500
+ return typeof arg === "object" && arg.constructor === Object;
501
+ };
502
+ var isString = (arg) => typeof arg === "string";
503
+ var isNumber = (arg) => typeof arg === "number";
504
+ var isFunction = (arg) => typeof arg === "function";
505
+ var isBoolean = (arg) => arg === true || arg === false;
506
+ var isNull = (arg) => arg === null;
507
+ var isArray = (arg) => Array.isArray(arg);
508
+ var isDate = (d) => d instanceof Date;
509
+ var isObjectLike = (arg) => {
510
+ if (arg === null)
511
+ return false;
512
+ return typeof arg === "object";
513
+ };
514
+ var isDefined = (arg) => {
515
+ return isObject(arg) || isObjectLike(arg) || isString(arg) || isNumber(arg) || isFunction(arg) || isArray(arg) || isObjectLike(arg) || isBoolean(arg) || isDate(arg) || isNull(arg);
516
+ };
517
+ var isUndefined = (arg) => {
518
+ return arg === void 0;
519
+ };
520
+
521
+ // ../../../domql/packages/utils/dist/esm/array.js
522
+ var mergeArray = (arr, exclude = []) => {
523
+ return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
524
+ };
525
+
526
+ // ../../../domql/packages/utils/dist/esm/object.js
527
+ var __defProp2 = Object.defineProperty;
528
+ var __defProps = Object.defineProperties;
529
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
530
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
531
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
532
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
533
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
534
+ var __spreadValues = (a, b) => {
535
+ for (var prop in b || (b = {}))
536
+ if (__hasOwnProp2.call(b, prop))
537
+ __defNormalProp(a, prop, b[prop]);
538
+ if (__getOwnPropSymbols)
539
+ for (var prop of __getOwnPropSymbols(b)) {
540
+ if (__propIsEnum.call(b, prop))
541
+ __defNormalProp(a, prop, b[prop]);
542
+ }
543
+ return a;
544
+ };
545
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
546
+ var merge = (element, obj, excludeFrom = []) => {
547
+ for (const e in obj) {
548
+ const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, e);
549
+ if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
550
+ continue;
551
+ const elementProp = element[e];
552
+ const objProp = obj[e];
553
+ if (elementProp === void 0) {
554
+ element[e] = objProp;
555
+ }
556
+ }
557
+ return element;
558
+ };
559
+ var deepMerge = (element, extend, excludeFrom = []) => {
560
+ for (const e in extend) {
561
+ const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
562
+ if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
563
+ continue;
564
+ const elementProp = element[e];
565
+ const extendProp = extend[e];
566
+ if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
567
+ deepMerge(elementProp, extendProp, excludeFrom);
568
+ } else if (elementProp === void 0) {
569
+ element[e] = extendProp;
570
+ }
571
+ }
572
+ return element;
573
+ };
574
+ var deepClone = (obj, options = {}) => {
575
+ const {
576
+ exclude = [],
577
+ cleanUndefined = false,
578
+ cleanNull = false,
579
+ window: targetWindow,
580
+ visited = /* @__PURE__ */ new WeakMap(),
581
+ handleExtend = false
582
+ } = options;
583
+ if (!isObjectLike(obj) || isDOMNode(obj)) {
584
+ return obj;
585
+ }
586
+ if (visited.has(obj)) {
587
+ return visited.get(obj);
588
+ }
589
+ const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
590
+ visited.set(obj, clone2);
591
+ for (const key in obj) {
592
+ if (!Object.prototype.hasOwnProperty.call(obj, key))
593
+ continue;
594
+ if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
595
+ continue;
596
+ const value = obj[key];
597
+ if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
598
+ continue;
599
+ if (isDOMNode(value)) {
600
+ clone2[key] = value;
601
+ continue;
602
+ }
603
+ if (handleExtend && key === "extend" && isArray(value)) {
604
+ clone2[key] = mergeArray(value, exclude);
605
+ continue;
606
+ }
607
+ if (isFunction(value) && targetWindow) {
608
+ clone2[key] = targetWindow.eval("(" + value.toString() + ")");
609
+ continue;
610
+ }
611
+ if (isObjectLike(value)) {
612
+ clone2[key] = deepClone(value, __spreadProps(__spreadValues({}, options), {
613
+ visited
614
+ }));
615
+ } else {
616
+ clone2[key] = value;
617
+ }
618
+ }
619
+ return clone2;
620
+ };
621
+ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
622
+ const excl = opts.exclude || [];
623
+ const forcedExclude = opts.preventForce ? [] : ["node", "window"];
624
+ if (!isObjectLike(obj) || !isObjectLike(params) || isDOMNode(obj) || isDOMNode(params)) {
625
+ return params;
626
+ }
627
+ if (visited.has(obj))
628
+ return visited.get(obj);
629
+ visited.set(obj, obj);
630
+ for (const e in params) {
631
+ if (!Object.hasOwnProperty.call(params, e))
632
+ continue;
633
+ if (excl.includes(e) || forcedExclude && e.startsWith("__"))
634
+ continue;
635
+ const objProp = obj[e];
636
+ const paramsProp = params[e];
637
+ if (isDOMNode(paramsProp)) {
638
+ obj[e] = paramsProp;
639
+ } else if (isObjectLike(objProp) && isObjectLike(paramsProp)) {
640
+ obj[e] = overwriteDeep(objProp, paramsProp, opts, visited);
641
+ } else if (paramsProp !== void 0) {
642
+ obj[e] = paramsProp;
643
+ }
644
+ }
645
+ return obj;
646
+ };
647
+
648
+ // ../../../domql/packages/utils/dist/esm/cookie.js
649
+ var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
650
+
651
+ // src/utils/color.js
4271
652
  var ENV = "development";
4272
653
  var colorStringToRgbaArray = (color) => {
4273
654
  if (color === "")
@@ -4286,21 +667,21 @@ var colorStringToRgbaArray = (color) => {
4286
667
  ];
4287
668
  }
4288
669
  if (color.indexOf("rgb") === -1) {
4289
- if (import_globals.document && import_globals.window) {
4290
- const elem = import_globals.document.body.appendChild(import_globals.document.createElement("fictum"));
670
+ if (import_globals4.document && import_globals4.window) {
671
+ const elem = import_globals4.document.body.appendChild(import_globals4.document.createElement("fictum"));
4291
672
  const flag = "rgb(1, 2, 3)";
4292
673
  elem.style.color = flag;
4293
674
  if (elem.style.color !== flag) {
4294
- import_globals.document.body.removeChild(elem);
675
+ import_globals4.document.body.removeChild(elem);
4295
676
  return;
4296
677
  }
4297
678
  elem.style.color = color;
4298
679
  if (elem.style.color === flag || elem.style.color === "") {
4299
- import_globals.document.body.removeChild(elem);
680
+ import_globals4.document.body.removeChild(elem);
4300
681
  return [0, 0, 0, 0];
4301
682
  }
4302
- color = import_globals.window.getComputedStyle(elem).color;
4303
- import_globals.document.body.removeChild(elem);
683
+ color = import_globals4.window.getComputedStyle(elem).color;
684
+ import_globals4.document.body.removeChild(elem);
4304
685
  }
4305
686
  }
4306
687
  if (color.indexOf("rgb") === 0) {
@@ -4399,11 +780,11 @@ var opacify = (color, opacity) => {
4399
780
  return `rgba(${arr})`;
4400
781
  };
4401
782
  var getRgbTone = (rgb, tone) => {
4402
- if ((0, import_utils.isString)(rgb) && rgb.includes("rgb"))
783
+ if (isString(rgb) && rgb.includes("rgb"))
4403
784
  rgb = colorStringToRgbaArray(rgb).join(", ");
4404
- if ((0, import_utils.isString)(rgb))
785
+ if (isString(rgb))
4405
786
  rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
4406
- if ((0, import_utils.isNumber)(tone))
787
+ if (isNumber(tone))
4407
788
  tone += "";
4408
789
  const toHex = rgbArrayToHex(rgb);
4409
790
  const abs = tone.slice(0, 1);
@@ -4472,11 +853,7 @@ var getFontFaceString = (LIBRARY) => {
4472
853
  };
4473
854
 
4474
855
  // src/utils/sequence.js
4475
- var import_utils3 = __toESM(require_cjs2(), 1);
4476
- var import_utils4 = __toESM(require_cjs3(), 1);
4477
-
4478
- // src/factory.js
4479
- var import_utils2 = __toESM(require_cjs2(), 1);
856
+ var import_utils4 = __toESM(require_cjs2(), 1);
4480
857
 
4481
858
  // src/defaultConfig/index.js
4482
859
  var defaultConfig_exports = {};
@@ -4690,13 +1067,13 @@ var CONFIG = {
4690
1067
  CSS_VARS,
4691
1068
  ...void 0 || defaultConfig_exports
4692
1069
  };
4693
- var cachedConfig = (0, import_utils2.deepClone)(CONFIG);
1070
+ var cachedConfig = deepClone(CONFIG);
4694
1071
  var FACTORY = {
4695
1072
  active: "0",
4696
1073
  0: CONFIG
4697
1074
  };
4698
1075
  var activateConfig = (def) => {
4699
- if ((0, import_utils2.isDefined)(def)) {
1076
+ if (isDefined(def)) {
4700
1077
  FACTORY.active = def;
4701
1078
  }
4702
1079
  return FACTORY[def || FACTORY.active];
@@ -4705,10 +1082,10 @@ var getActiveConfig = (def) => {
4705
1082
  return FACTORY[def || FACTORY.active] || CONFIG;
4706
1083
  };
4707
1084
  var setActiveConfig = (newConfig) => {
4708
- if (!(0, import_utils2.isObject)(newConfig))
1085
+ if (!isObject(newConfig))
4709
1086
  return;
4710
1087
  FACTORY.active = "1";
4711
- FACTORY["1"] = (0, import_utils2.deepMerge)(newConfig, (0, import_utils2.deepClone)(cachedConfig));
1088
+ FACTORY["1"] = deepMerge(newConfig, deepClone(cachedConfig));
4712
1089
  return newConfig;
4713
1090
  };
4714
1091
 
@@ -4854,7 +1231,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
4854
1231
  unit = UNIT2.default,
4855
1232
  useVariable
4856
1233
  } = sequenceProps;
4857
- if ((0, import_utils3.isString)(value) && value.slice(0, 2) === "--")
1234
+ if (isString(value) && value.slice(0, 2) === "--")
4858
1235
  return `var(${value})`;
4859
1236
  const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
4860
1237
  const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
@@ -4921,11 +1298,10 @@ var findHeadings = (propertyNames) => {
4921
1298
  };
4922
1299
 
4923
1300
  // src/utils/var.js
4924
- var import_utils5 = __toESM(require_cjs2(), 1);
4925
1301
  var setVariables = (result, key) => {
4926
1302
  const CONFIG2 = getActiveConfig();
4927
1303
  const { CSS_VARS: CSS_VARS2 } = CONFIG2;
4928
- if ((0, import_utils5.isObjectLike)(result.value)) {
1304
+ if (isObjectLike(result.value)) {
4929
1305
  } else {
4930
1306
  CSS_VARS2[result.var] = result.value;
4931
1307
  }
@@ -5000,7 +1376,6 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
5000
1376
  };
5001
1377
 
5002
1378
  // src/utils/sprite.js
5003
- var import_utils6 = __toESM(require_cjs2(), 1);
5004
1379
  var generateSprite = (icons) => {
5005
1380
  const CONFIG2 = getActiveConfig();
5006
1381
  let sprite = "";
@@ -5015,7 +1390,7 @@ var generateSprite = (icons) => {
5015
1390
  };
5016
1391
  var parseRootAttributes = (htmlString) => {
5017
1392
  const val = htmlString.default || htmlString;
5018
- if (!(0, import_utils6.isString)(val)) {
1393
+ if (!isString(val)) {
5019
1394
  return console.warn(`parseRootAttributes: ${val} is not a string`);
5020
1395
  }
5021
1396
  const match = val.match(/<svg\s+(.*?)>/);
@@ -5035,7 +1410,7 @@ var replaceIdsAndUrls = (code, key) => {
5035
1410
  const urlRegex = /url\(#([^)]*)\)/g;
5036
1411
  const matches = code.match(/id="([^"]*)"/g);
5037
1412
  let replacedCode = code;
5038
- if ((0, import_utils6.isArray)(matches)) {
1413
+ if (isArray(matches)) {
5039
1414
  matches.forEach(() => {
5040
1415
  const randomKey = Math.floor(Math.random() * 1e5);
5041
1416
  replacedCode = code.replace(idRegex, `id="${key}-${randomKey}"`).replace(urlRegex, `url(#${key}-${randomKey})`);
@@ -5094,10 +1469,9 @@ __export(system_exports, {
5094
1469
  });
5095
1470
 
5096
1471
  // src/system/color.js
5097
- var import_utils7 = __toESM(require_cjs2(), 1);
5098
1472
  var getColor = (value, key, config) => {
5099
1473
  const CONFIG2 = config || getActiveConfig();
5100
- if (!(0, import_utils7.isString)(value)) {
1474
+ if (!isString(value)) {
5101
1475
  if (CONFIG2.verbose)
5102
1476
  console.warn(value, "- type for color is not valid");
5103
1477
  return;
@@ -5106,7 +1480,7 @@ var getColor = (value, key, config) => {
5106
1480
  return `var(${value})`;
5107
1481
  if (key && value[key])
5108
1482
  value = value[key];
5109
- const [name, alpha, tone] = (0, import_utils7.isArray)(value) ? value : value.split(" ");
1483
+ const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
5110
1484
  const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
5111
1485
  let val = COLOR2[name] || GRADIENT2[name];
5112
1486
  if (!val) {
@@ -5138,17 +1512,17 @@ var getMediaColor = (value, globalTheme, config) => {
5138
1512
  const CONFIG2 = config || getActiveConfig();
5139
1513
  if (!globalTheme)
5140
1514
  globalTheme = CONFIG2.globalTheme;
5141
- if (!(0, import_utils7.isString)(value)) {
1515
+ if (!isString(value)) {
5142
1516
  if (CONFIG2.verbose)
5143
1517
  console.warn(value, "- type for color is not valid");
5144
1518
  return;
5145
1519
  }
5146
1520
  if (value.slice(0, 2) === "--")
5147
1521
  return `var(${value})`;
5148
- const [name] = (0, import_utils7.isArray)(value) ? value : value.split(" ");
1522
+ const [name] = isArray(value) ? value : value.split(" ");
5149
1523
  const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
5150
1524
  const val = COLOR2[name] || GRADIENT2[name];
5151
- const isObj = (0, import_utils7.isObject)(val);
1525
+ const isObj = isObject(val);
5152
1526
  if (isObj && val.value)
5153
1527
  return getColor(value, `@${globalTheme}`, config);
5154
1528
  else if (isObj) {
@@ -5171,7 +1545,7 @@ var getMediaColor = (value, globalTheme, config) => {
5171
1545
  };
5172
1546
  var setColor = (val, key, suffix) => {
5173
1547
  const CONFIG2 = getActiveConfig();
5174
- if ((0, import_utils7.isString)(val) && val.slice(0, 2) === "--") {
1548
+ if (isString(val) && val.slice(0, 2) === "--") {
5175
1549
  val = getColor(val.slice(2));
5176
1550
  if (!(val.includes("rgb") || val.includes("var") || val.includes("#"))) {
5177
1551
  if (CONFIG2.verbose)
@@ -5179,13 +1553,13 @@ var setColor = (val, key, suffix) => {
5179
1553
  val = val.split(" ")[0];
5180
1554
  }
5181
1555
  }
5182
- if ((0, import_utils7.isArray)(val)) {
1556
+ if (isArray(val)) {
5183
1557
  return {
5184
1558
  "@light": setColor(val[0], key, "light"),
5185
1559
  "@dark": setColor(val[1], key, "dark")
5186
1560
  };
5187
1561
  }
5188
- if ((0, import_utils7.isObject)(val)) {
1562
+ if (isObject(val)) {
5189
1563
  const obj = {};
5190
1564
  for (const variant in val) {
5191
1565
  obj[variant] = setColor(
@@ -5214,15 +1588,15 @@ var setColor = (val, key, suffix) => {
5214
1588
  };
5215
1589
  var setGradient = (val, key, suffix) => {
5216
1590
  const CONFIG2 = getActiveConfig();
5217
- if ((0, import_utils7.isString)(val) && val.slice(0, 2) === "--")
1591
+ if (isString(val) && val.slice(0, 2) === "--")
5218
1592
  val = getColor(val.slice(2));
5219
- if ((0, import_utils7.isArray)(val)) {
1593
+ if (isArray(val)) {
5220
1594
  return {
5221
1595
  "@light": setGradient(val[0], key, "light"),
5222
1596
  "@dark": setGradient(val[0], key, "dark")
5223
1597
  };
5224
1598
  }
5225
- if ((0, import_utils7.isObject)(val)) {
1599
+ if (isObject(val)) {
5226
1600
  const obj = {};
5227
1601
  for (const variant in val)
5228
1602
  obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
@@ -5239,7 +1613,6 @@ var setGradient = (val, key, suffix) => {
5239
1613
  };
5240
1614
 
5241
1615
  // src/system/theme.js
5242
- var import_utils9 = __toESM(require_cjs2(), 1);
5243
1616
  var setThemeValue = (theme) => {
5244
1617
  const value = {};
5245
1618
  const { state, media, helpers, ...rest } = theme;
@@ -5262,7 +1635,7 @@ var getTheme = (value, modifier) => {
5262
1635
  if (CONFIG2.useVariable)
5263
1636
  return getMediaTheme(value, modifier);
5264
1637
  const { THEME: THEME2 } = CONFIG2;
5265
- if ((0, import_utils9.isString)(value)) {
1638
+ if (isString(value)) {
5266
1639
  const [theme, subtheme] = value.split(" ");
5267
1640
  const isOurTheme = THEME2[theme];
5268
1641
  if (isOurTheme) {
@@ -5271,7 +1644,7 @@ var getTheme = (value, modifier) => {
5271
1644
  value = [theme, subtheme || modifier];
5272
1645
  }
5273
1646
  }
5274
- if ((0, import_utils9.isObjectLike)(value) && value[1]) {
1647
+ if (isObjectLike(value) && value[1]) {
5275
1648
  const themeName = value[0];
5276
1649
  const subThemeName = value[1];
5277
1650
  const { helpers, media, state } = THEME2[themeName];
@@ -5281,11 +1654,11 @@ var getTheme = (value, modifier) => {
5281
1654
  return getThemeValue(helpers[subThemeName]);
5282
1655
  if (state && state[subThemeName])
5283
1656
  return getThemeValue(state[subThemeName]);
5284
- } else if ((0, import_utils9.isObject)(value))
1657
+ } else if (isObject(value))
5285
1658
  return setThemeValue(value);
5286
1659
  };
5287
1660
  var setInverseTheme = (theme, variant, value) => {
5288
- if ((0, import_utils9.isObject)(variant)) {
1661
+ if (isObject(variant)) {
5289
1662
  theme.variants.inverse.value = setThemeValue(variant);
5290
1663
  } else if (variant === true) {
5291
1664
  const { color, background } = value;
@@ -5300,7 +1673,7 @@ var setInverseTheme = (theme, variant, value) => {
5300
1673
  var setPseudo = (theme, key, variant, themeValue) => {
5301
1674
  const result = getTheme(variant);
5302
1675
  themeValue[`&:${key}`] = result;
5303
- if ((0, import_utils9.isObject)(variant) && !variant.value)
1676
+ if (isObject(variant) && !variant.value)
5304
1677
  variant.value = result;
5305
1678
  };
5306
1679
  var setSelectors = (theme, value) => {
@@ -5318,7 +1691,7 @@ var setSelectors = (theme, value) => {
5318
1691
  var setPrefersScheme = (theme, key, variant, themeValue) => {
5319
1692
  const result = getTheme(variant);
5320
1693
  themeValue[`@media (prefers-color-scheme: ${key})`] = result;
5321
- if ((0, import_utils9.isObject)(variant) && !variant.value)
1694
+ if (isObject(variant) && !variant.value)
5322
1695
  variant.value = result;
5323
1696
  };
5324
1697
  var setMedia = (theme, value) => {
@@ -5344,7 +1717,7 @@ var setHelpers = (theme, value) => {
5344
1717
  const keys = Object.keys(helpers);
5345
1718
  keys.map((key) => {
5346
1719
  const helper = helpers[key];
5347
- if ((0, import_utils9.isString)(helper))
1720
+ if (isString(helper))
5348
1721
  helpers[key] = CONFIG2.THEME[helper];
5349
1722
  else
5350
1723
  getThemeValue(helpers[key]);
@@ -5368,7 +1741,7 @@ var setMediaTheme = (val, key, suffix, prefers) => {
5368
1741
  const CONFIG2 = getActiveConfig();
5369
1742
  const { CSS_VARS: CSS_VARS2 } = CONFIG2;
5370
1743
  const theme = { value: val };
5371
- if ((0, import_utils9.isObjectLike)(val)) {
1744
+ if (isObjectLike(val)) {
5372
1745
  for (const param in val) {
5373
1746
  const symb = param.slice(0, 1);
5374
1747
  const value = val[param];
@@ -5396,7 +1769,7 @@ var setMediaTheme = (val, key, suffix, prefers) => {
5396
1769
  };
5397
1770
  }
5398
1771
  }
5399
- if ((0, import_utils9.isString)(val) && val.slice(0, 2) === "--") {
1772
+ if (isString(val) && val.slice(0, 2) === "--") {
5400
1773
  const { THEME: THEME2 } = CONFIG2;
5401
1774
  const value = THEME2[val.slice(2)];
5402
1775
  const getReferenced = getMediaTheme(value, prefers);
@@ -5409,7 +1782,7 @@ var recursiveTheme = (val) => {
5409
1782
  const obj = {};
5410
1783
  for (const param in val) {
5411
1784
  const symb = param.slice(0, 1);
5412
- if ((0, import_utils9.isObjectLike)(val[param])) {
1785
+ if (isObjectLike(val[param])) {
5413
1786
  if (symb === "@") {
5414
1787
  const query = CONFIG2.MEDIA[param.slice(1)];
5415
1788
  const media = "@media " + (query === "print" ? `${query}` : `screen and ${query}`);
@@ -5429,25 +1802,25 @@ var findModifierFromArray = (val, modifierArray) => {
5429
1802
  return val;
5430
1803
  };
5431
1804
  var findModifier = (val, modifier) => {
5432
- if ((0, import_utils9.isArray)(modifier))
1805
+ if (isArray(modifier))
5433
1806
  return findModifierFromArray(val, modifier);
5434
- else if ((0, import_utils9.isString)(modifier) && val[modifier])
1807
+ else if (isString(modifier) && val[modifier])
5435
1808
  return val[modifier];
5436
1809
  else
5437
1810
  return val;
5438
1811
  };
5439
1812
  var getMediaTheme = (value, modifier) => {
5440
1813
  const activeConfig = getActiveConfig();
5441
- if ((0, import_utils9.isString)(value) && value.slice(0, 2) === "--") {
1814
+ if (isString(value) && value.slice(0, 2) === "--") {
5442
1815
  value = getMediaTheme(value.slice(2));
5443
1816
  }
5444
- if (!value || !(0, import_utils9.isString)(value)) {
1817
+ if (!value || !isString(value)) {
5445
1818
  if (activeConfig.verbose) {
5446
1819
  console.warn(`${value} - Theme is not a string`);
5447
1820
  }
5448
1821
  return;
5449
1822
  }
5450
- const [themeName, ...themeModifiers] = (0, import_utils9.isArray)(value) ? value : value.split(" ");
1823
+ const [themeName, ...themeModifiers] = isArray(value) ? value : value.split(" ");
5451
1824
  let themeValue = activeConfig.THEME[themeName];
5452
1825
  if (themeValue && (themeModifiers || modifier)) {
5453
1826
  themeValue = findModifier(themeValue, themeModifiers.length ? themeModifiers : modifier);
@@ -5457,11 +1830,10 @@ var getMediaTheme = (value, modifier) => {
5457
1830
  };
5458
1831
 
5459
1832
  // src/system/font.js
5460
- var import_utils10 = __toESM(require_cjs2(), 1);
5461
- var import_utils11 = __toESM(require_cjs3(), 1);
1833
+ var import_utils11 = __toESM(require_cjs2(), 1);
5462
1834
  var setFont = (val, key) => {
5463
1835
  const CSSvar = `--font-${key}`;
5464
- if (!val || (0, import_utils10.isArray)(val) && !val[0])
1836
+ if (!val || isArray(val) && !val[0])
5465
1837
  return;
5466
1838
  const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
5467
1839
  return { var: CSSvar, value: val, fontFace };
@@ -5477,7 +1849,7 @@ var setFontFamily = (val, key) => {
5477
1849
  let { value, type } = val;
5478
1850
  if (val.isDefault)
5479
1851
  FONT_FAMILY2.default = key;
5480
- if ((0, import_utils10.isObject)(value))
1852
+ if (isObject(value))
5481
1853
  value = (0, import_utils11.arrayzeValue)(value);
5482
1854
  const CSSvar = `--font-family-${key}`;
5483
1855
  const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
@@ -5485,7 +1857,6 @@ var setFontFamily = (val, key) => {
5485
1857
  };
5486
1858
 
5487
1859
  // src/system/typography.js
5488
- var import_utils13 = __toESM(require_cjs2(), 1);
5489
1860
  var runThroughMedia = (FACTORY2) => {
5490
1861
  const CONFIG2 = getActiveConfig();
5491
1862
  const { TYPOGRAPHY: TYPOGRAPHY2, MEDIA: MEDIA2 } = CONFIG2;
@@ -5505,7 +1876,7 @@ var runThroughMedia = (FACTORY2) => {
5505
1876
  h1Matches,
5506
1877
  unit
5507
1878
  } = FACTORY2;
5508
- (0, import_utils13.merge)(mediaValue, {
1879
+ merge(mediaValue, {
5509
1880
  type,
5510
1881
  base,
5511
1882
  ratio,
@@ -5523,7 +1894,7 @@ var runThroughMedia = (FACTORY2) => {
5523
1894
  applyMediaSequenceVars(FACTORY2, prop);
5524
1895
  continue;
5525
1896
  }
5526
- (0, import_utils13.merge)(mediaValue, {
1897
+ merge(mediaValue, {
5527
1898
  sequence: {},
5528
1899
  scales: {},
5529
1900
  templates: {},
@@ -5571,8 +1942,7 @@ var getFontSizeByKey = (value) => {
5571
1942
  };
5572
1943
 
5573
1944
  // src/system/spacing.js
5574
- var import_utils15 = __toESM(require_cjs3(), 1);
5575
- var import_utils16 = __toESM(require_cjs2(), 1);
1945
+ var import_utils15 = __toESM(require_cjs2(), 1);
5576
1946
  var runThroughMedia2 = (FACTORY2) => {
5577
1947
  for (const prop in FACTORY2) {
5578
1948
  const mediaProps = FACTORY2[prop];
@@ -5588,7 +1958,7 @@ var runThroughMedia2 = (FACTORY2) => {
5588
1958
  h1Matches,
5589
1959
  unit
5590
1960
  } = FACTORY2;
5591
- (0, import_utils16.merge)(mediaProps, {
1961
+ merge(mediaProps, {
5592
1962
  type,
5593
1963
  base,
5594
1964
  ratio,
@@ -5622,11 +1992,11 @@ var getSequence = (sequenceProps) => {
5622
1992
  };
5623
1993
  var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
5624
1994
  const sequence = getSequence(sequenceProps);
5625
- if ((0, import_utils16.isString)(value) && (value.includes("calc") || value.includes("var"))) {
1995
+ if (isString(value) && (value.includes("calc") || value.includes("var"))) {
5626
1996
  return { [propertyName]: value };
5627
1997
  }
5628
1998
  const stack = (0, import_utils15.arrayzeValue)(value);
5629
- if (!(0, import_utils16.isArray)(stack))
1999
+ if (!isArray(stack))
5630
2000
  return;
5631
2001
  if (stack.length > 1) {
5632
2002
  let suffix = "";
@@ -5661,7 +2031,7 @@ var getSpacingBasedOnRatio = (props, propertyName, val) => {
5661
2031
  let sequenceProps = SPACING2[spacingRatio];
5662
2032
  if (!sequenceProps) {
5663
2033
  const { type, base, range, subSequence } = SPACING2;
5664
- sequenceProps = SPACING2[spacingRatio] = (0, import_utils16.merge)({
2034
+ sequenceProps = SPACING2[spacingRatio] = merge({
5665
2035
  ratio: spacingRatio,
5666
2036
  type: type + "-" + spacingRatio,
5667
2037
  unit,
@@ -5684,16 +2054,15 @@ var getSpacingBasedOnRatio = (props, propertyName, val) => {
5684
2054
  };
5685
2055
 
5686
2056
  // src/system/shadow.js
5687
- var import_utils18 = __toESM(require_cjs2(), 1);
5688
2057
  var setShadow = (value, key, suffix, prefers) => {
5689
2058
  const CONFIG2 = getActiveConfig();
5690
- if ((0, import_utils18.isArray)(value)) {
2059
+ if (isArray(value)) {
5691
2060
  return {
5692
2061
  "@light": setShadow(value[0], key, "light"),
5693
2062
  "@dark": setShadow(value[1], key, "dark")
5694
2063
  };
5695
2064
  }
5696
- if ((0, import_utils18.isObject)(value)) {
2065
+ if (isObject(value)) {
5697
2066
  const obj = {};
5698
2067
  for (const variant in value) {
5699
2068
  obj[variant] = setShadow(
@@ -5704,7 +2073,7 @@ var setShadow = (value, key, suffix, prefers) => {
5704
2073
  }
5705
2074
  return obj;
5706
2075
  }
5707
- if ((0, import_utils18.isString)(value) && value.includes(",")) {
2076
+ if (isString(value) && value.includes(",")) {
5708
2077
  value = value.split(",").map((v) => {
5709
2078
  v = v.trim();
5710
2079
  if (v.startsWith("--"))
@@ -5732,17 +2101,17 @@ var getShadow = (value, globalTheme) => {
5732
2101
  const CONFIG2 = getActiveConfig();
5733
2102
  if (!globalTheme)
5734
2103
  globalTheme = CONFIG2.globalTheme;
5735
- if (!(0, import_utils18.isString)(value)) {
2104
+ if (!isString(value)) {
5736
2105
  if (CONFIG2.verbose)
5737
2106
  console.warn(value, "- type for color is not valid");
5738
2107
  return;
5739
2108
  }
5740
2109
  if (value.slice(0, 2) === "--")
5741
2110
  return `var(${value})`;
5742
- const [name] = (0, import_utils18.isArray)(value) ? value : value.split(" ");
2111
+ const [name] = isArray(value) ? value : value.split(" ");
5743
2112
  const { SHADOW: SHADOW2 } = CONFIG2;
5744
2113
  const val = SHADOW2[name];
5745
- const isObj = (0, import_utils18.isObject)(val);
2114
+ const isObj = isObject(val);
5746
2115
  if (!val) {
5747
2116
  if (CONFIG2.verbose)
5748
2117
  console.warn("Can't find color ", name);
@@ -5771,7 +2140,7 @@ var getShadow = (value, globalTheme) => {
5771
2140
  };
5772
2141
 
5773
2142
  // src/system/timing.js
5774
- var import_utils19 = __toESM(require_cjs3(), 1);
2143
+ var import_utils19 = __toESM(require_cjs2(), 1);
5775
2144
  var applyTimingSequence = () => {
5776
2145
  const CONFIG2 = getActiveConfig();
5777
2146
  const { TIMING: TIMING2 } = CONFIG2;
@@ -5794,11 +2163,10 @@ var getTimingByKey = (value, property = "timing") => {
5794
2163
  };
5795
2164
 
5796
2165
  // src/system/document.js
5797
- var import_utils21 = __toESM(require_cjs2(), 1);
5798
2166
  var applyDocument = () => {
5799
2167
  const CONFIG2 = getActiveConfig();
5800
2168
  const { DOCUMENT: DOCUMENT2, FONT_FAMILY: FONT_FAMILY2, THEME: THEME2, TYPOGRAPHY: TYPOGRAPHY2 } = CONFIG2;
5801
- return (0, import_utils21.merge)(DOCUMENT2, {
2169
+ return merge(DOCUMENT2, {
5802
2170
  theme: THEME2.document,
5803
2171
  fontFamily: getDefaultOrFirstKey(FONT_FAMILY2),
5804
2172
  fontSize: TYPOGRAPHY2.base,
@@ -5807,9 +2175,9 @@ var applyDocument = () => {
5807
2175
  };
5808
2176
 
5809
2177
  // src/system/svg.js
5810
- var import_globals2 = __toESM(require_cjs(), 1);
2178
+ var import_globals5 = __toESM(require_cjs(), 1);
5811
2179
  var DEF_OPTIONS = {
5812
- document: import_globals2.document
2180
+ document: import_globals5.document
5813
2181
  };
5814
2182
  var setSVG = (val, key) => {
5815
2183
  const CONFIG2 = getActiveConfig();
@@ -5846,9 +2214,9 @@ var appendSvgIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
5846
2214
  appendSVG(lib, options);
5847
2215
  };
5848
2216
  var createSVGSpriteElement = (options = { isRoot: true }) => {
5849
- if (!import_globals2.document || !import_globals2.document.createElementNS)
2217
+ if (!import_globals5.document || !import_globals5.document.createElementNS)
5850
2218
  return;
5851
- const svgElem = import_globals2.document.createElementNS("http://www.w3.org/2000/svg", "svg");
2219
+ const svgElem = import_globals5.document.createElementNS("http://www.w3.org/2000/svg", "svg");
5852
2220
  if (options.isRoot) {
5853
2221
  svgElem.setAttribute("aria-hidden", "true");
5854
2222
  svgElem.setAttribute("width", "0");
@@ -5860,7 +2228,7 @@ var createSVGSpriteElement = (options = { isRoot: true }) => {
5860
2228
  };
5861
2229
  var appendSVG = (lib, options = DEF_OPTIONS) => {
5862
2230
  const CONFIG2 = getActiveConfig();
5863
- const doc = options.document || import_globals2.document;
2231
+ const doc = options.document || import_globals5.document;
5864
2232
  if (!doc || !doc.documentElement) {
5865
2233
  if (CONFIG2.verbose) {
5866
2234
  console.warn("To append SVG sprites it should be run in browser environment");
@@ -5883,7 +2251,6 @@ var appendSVG = (lib, options = DEF_OPTIONS) => {
5883
2251
  };
5884
2252
 
5885
2253
  // src/system/reset.js
5886
- var import_utils24 = __toESM(require_cjs2(), 1);
5887
2254
  var applyReset = (reset = {}) => {
5888
2255
  const CONFIG2 = getActiveConfig();
5889
2256
  const { RESET: RESET2, TYPOGRAPHY: TYPOGRAPHY2, DOCUMENT: DOCUMENT2 } = CONFIG2;
@@ -5905,8 +2272,8 @@ var applyReset = (reset = {}) => {
5905
2272
  const { body, ...templates } = TYPOGRAPHY2.templates;
5906
2273
  const globalTheme = CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {};
5907
2274
  if (RESET2.html)
5908
- (0, import_utils24.overwriteDeep)(RESET2.html, globalTheme);
5909
- return (0, import_utils24.deepMerge)((0, import_utils24.merge)(RESET2, reset), {
2275
+ overwriteDeep(RESET2.html, globalTheme);
2276
+ return deepMerge(merge(RESET2, reset), {
5910
2277
  html: {
5911
2278
  position: "absolute",
5912
2279
  // overflow: 'hidden',
@@ -5945,7 +2312,6 @@ var applyReset = (reset = {}) => {
5945
2312
  };
5946
2313
 
5947
2314
  // src/transforms/index.js
5948
- var import_utils25 = __toESM(require_cjs2(), 1);
5949
2315
  var isBorderStyle = (str) => [
5950
2316
  "none",
5951
2317
  "hidden",
@@ -5993,7 +2359,7 @@ var transformBoxShadow = (shadows, globalTheme) => shadows.split("|").map((shado
5993
2359
  return `var(${v})`;
5994
2360
  if (getColor(v).length > 2) {
5995
2361
  const color = getMediaColor(v, globalTheme);
5996
- if ((0, import_utils25.isObject)(color))
2362
+ if (isObject(color))
5997
2363
  return Object.values(color).filter((v2) => v2.includes(": " + globalTheme))[0];
5998
2364
  return color;
5999
2365
  }
@@ -6021,7 +2387,7 @@ var transformBackgroundImage = (backgroundImage, globalTheme) => {
6021
2387
  return v;
6022
2388
  }).join(" ");
6023
2389
  };
6024
- var transfromGap = (gap) => (0, import_utils25.isString)(gap) && gap.split(" ").map((v) => getSpacingByKey(v, "gap").gap).join(" ");
2390
+ var transfromGap = (gap) => isString(gap) && gap.split(" ").map((v) => getSpacingByKey(v, "gap").gap).join(" ");
6025
2391
  var transformTransition = (transition) => {
6026
2392
  const arr = transition.split(" ");
6027
2393
  if (!arr.length)
@@ -6039,7 +2405,7 @@ var transformTransition = (transition) => {
6039
2405
  }).join(" ");
6040
2406
  };
6041
2407
  var transformDuration = (duration, props, propertyName) => {
6042
- if (!(0, import_utils25.isString)(duration))
2408
+ if (!isString(duration))
6043
2409
  return;
6044
2410
  return duration.split(",").map((v) => getTimingByKey(v).timing || v).join(",");
6045
2411
  };
@@ -6055,11 +2421,11 @@ var checkIfBoxSize = (propertyName) => {
6055
2421
  };
6056
2422
  var transformSize = (propertyName, val, props = {}, opts = {}) => {
6057
2423
  let value = val || props[propertyName];
6058
- if ((0, import_utils25.isUndefined)(value) && (0, import_utils25.isNull)(value))
2424
+ if (isUndefined(value) && isNull(value))
6059
2425
  return;
6060
2426
  const shouldScaleBoxSize = props.scaleBoxSize;
6061
2427
  const isBoxSize = checkIfBoxSize(propertyName);
6062
- if (!shouldScaleBoxSize && isBoxSize && (0, import_utils25.isString)(value)) {
2428
+ if (!shouldScaleBoxSize && isBoxSize && isString(value)) {
6063
2429
  value = value.split(" ").map((v) => {
6064
2430
  const isSingleLetter = v.length < 3 && /[A-Z]/.test(v);
6065
2431
  const hasUnits = ["%", "vw", "vh", "ch"].some((unit) => value.includes(unit));
@@ -6081,9 +2447,8 @@ var transformSizeRatio = (propertyName, props) => {
6081
2447
  };
6082
2448
 
6083
2449
  // src/set.js
6084
- var import_utils26 = __toESM(require_cjs2(), 1);
6085
2450
  var setCases = (val, key) => {
6086
- if ((0, import_utils26.isFunction)(val))
2451
+ if (isFunction(val))
6087
2452
  return val();
6088
2453
  return val;
6089
2454
  };
@@ -6115,9 +2480,14 @@ var setValue = (FACTORY_NAME, value, key) => {
6115
2480
  const factoryName = FACTORY_NAME.toLowerCase();
6116
2481
  const FACTORY2 = CONFIG2[FACTORY_NAME];
6117
2482
  if (VALUE_TRANSFORMERS[factoryName]) {
6118
- const result = VALUE_TRANSFORMERS[factoryName](value, key);
6119
- FACTORY2[key] = result;
6120
- return FACTORY2;
2483
+ try {
2484
+ const result = VALUE_TRANSFORMERS[factoryName](value, key);
2485
+ FACTORY2[key] = result;
2486
+ return FACTORY2;
2487
+ } catch (error) {
2488
+ if (CONFIG2.verbose)
2489
+ console.warn("Error setting", factoryName, "value", value, key, error);
2490
+ }
6121
2491
  }
6122
2492
  if (CONFIG2.verbose)
6123
2493
  console.warn("Can not find", factoryName, "method in scratch");