@symbo.ls/scratch 2.11.429 → 2.11.438

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.
@@ -166,6 +166,7 @@ var require_node = __commonJS({
166
166
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
167
167
  var node_exports = {};
168
168
  __export2(node_exports, {
169
+ isDOMNode: () => isDOMNode,
169
170
  isHtmlElement: () => isHtmlElement,
170
171
  isNode: () => isNode
171
172
  });
@@ -177,6 +178,9 @@ var require_node = __commonJS({
177
178
  var isHtmlElement = (obj) => {
178
179
  return (typeof HTMLElement === "object" ? obj instanceof import_globals2.window.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string") || false;
179
180
  };
181
+ var isDOMNode = (obj) => {
182
+ return typeof import_globals2.window !== "undefined" && (obj instanceof import_globals2.window.Node || obj instanceof import_globals2.window.Window || obj === import_globals2.window || obj === document);
183
+ };
180
184
  }
181
185
  });
182
186
 
@@ -296,7 +300,6 @@ var require_array = __commonJS({
296
300
  addItemAfterEveryElement: () => addItemAfterEveryElement,
297
301
  arrayContainsOtherArray: () => arrayContainsOtherArray,
298
302
  arraysEqual: () => arraysEqual,
299
- createNestedObject: () => createNestedObject,
300
303
  cutArrayAfterValue: () => cutArrayAfterValue,
301
304
  cutArrayBeforeValue: () => cutArrayBeforeValue,
302
305
  getFrequencyInArray: () => getFrequencyInArray,
@@ -363,22 +366,6 @@ var require_array = __commonJS({
363
366
  }
364
367
  return arr;
365
368
  };
366
- var createNestedObject = (arr, lastValue) => {
367
- const nestedObject = {};
368
- if (arr.length === 0) {
369
- return lastValue;
370
- }
371
- arr.reduce((obj, value, index) => {
372
- if (!obj[value]) {
373
- obj[value] = {};
374
- }
375
- if (index === arr.length - 1 && lastValue) {
376
- obj[value] = lastValue;
377
- }
378
- return obj[value];
379
- }, nestedObject);
380
- return nestedObject;
381
- };
382
369
  var removeValueFromArray = (arr, value) => {
383
370
  const index = arr.indexOf(value);
384
371
  if (index > -1) {
@@ -599,8 +586,8 @@ var require_object = __commonJS({
599
586
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
600
587
  var object_exports = {};
601
588
  __export2(object_exports, {
602
- checkIfKeyIsComponent: () => checkIfKeyIsComponent,
603
589
  clone: () => clone,
590
+ createNestedObject: () => createNestedObject,
604
591
  createObjectWithoutPrototype: () => createObjectWithoutPrototype,
605
592
  deepClone: () => deepClone2,
606
593
  deepCloneExclude: () => deepCloneExclude,
@@ -611,13 +598,12 @@ var require_object = __commonJS({
611
598
  deepMerge: () => deepMerge2,
612
599
  deepStringify: () => deepStringify,
613
600
  detachFunctionsFromObject: () => detachFunctionsFromObject,
601
+ detectInfiniteLoop: () => detectInfiniteLoop,
614
602
  diff: () => diff,
615
603
  diffArrays: () => diffArrays,
616
604
  diffObjects: () => diffObjects,
617
605
  exec: () => exec,
618
606
  flattenRecursive: () => flattenRecursive,
619
- getChildrenComponentsByKey: () => getChildrenComponentsByKey,
620
- getExtendsInElement: () => getExtendsInElement,
621
607
  hasOwnProperty: () => hasOwnProperty,
622
608
  isEmpty: () => isEmpty,
623
609
  isEmptyObject: () => isEmptyObject,
@@ -632,6 +618,7 @@ var require_object = __commonJS({
632
618
  overwriteDeep: () => overwriteDeep,
633
619
  overwriteShallow: () => overwriteShallow,
634
620
  removeFromObject: () => removeFromObject,
621
+ removeNestedKeyByPath: () => removeNestedKeyByPath,
635
622
  stringToObject: () => stringToObject
636
623
  });
637
624
  module2.exports = __toCommonJS2(object_exports);
@@ -639,6 +626,8 @@ var require_object = __commonJS({
639
626
  var import_types = require_types();
640
627
  var import_array = require_array();
641
628
  var import_string = require_string();
629
+ var import_node = require_node();
630
+ var ENV = "development";
642
631
  var exec = (param, element, state, context) => {
643
632
  if ((0, import_types.isFunction)(param)) {
644
633
  return param(
@@ -717,27 +706,28 @@ var require_object = __commonJS({
717
706
  var mergeArrayExclude = (arr, excl = []) => {
718
707
  return arr.reduce((acc, curr) => deepMerge2(acc, deepCloneExclude(curr, excl)), {});
719
708
  };
720
- var deepClone2 = (obj, excludeFrom = [], cleanUndefined = false) => {
721
- const o = (0, import_types.isArray)(obj) ? [] : {};
722
- for (const prop in obj) {
723
- if (!Object.prototype.hasOwnProperty.call(obj, prop))
724
- continue;
725
- if (prop === "__proto__")
726
- continue;
727
- if (excludeFrom.includes(prop) || prop.startsWith("__"))
728
- continue;
729
- let objProp = obj[prop];
730
- if (cleanUndefined && (0, import_types.isUndefined)(objProp))
731
- continue;
732
- if (prop === "extend" && (0, import_types.isArray)(objProp)) {
733
- objProp = (0, import_array.mergeArray)(objProp);
709
+ var deepClone2 = (obj, exclude = [], cleanUndefined = false, visited = /* @__PURE__ */ new WeakMap()) => {
710
+ if (!(0, import_types.isObjectLike)(obj) || (0, import_node.isDOMNode)(obj))
711
+ return obj;
712
+ if (visited.has(obj))
713
+ return visited.get(obj);
714
+ const clone2 = (0, import_types.isArray)(obj) ? [] : {};
715
+ visited.set(obj, clone2);
716
+ for (const key in obj) {
717
+ if (Object.prototype.hasOwnProperty.call(obj, key) && !exclude.includes(key)) {
718
+ const value = obj[key];
719
+ if ((0, import_node.isDOMNode)(value)) {
720
+ clone2[key] = value;
721
+ } else if (key === "extend" && (0, import_types.isArray)(value)) {
722
+ clone2[key] = (0, import_array.mergeArray)(value, exclude);
723
+ } else if ((0, import_types.isObjectLike)(value)) {
724
+ clone2[key] = deepClone2(value, exclude, cleanUndefined, visited);
725
+ } else {
726
+ clone2[key] = value;
727
+ }
734
728
  }
735
- if ((0, import_types.isObjectLike)(objProp)) {
736
- o[prop] = deepClone2(objProp, excludeFrom, cleanUndefined);
737
- } else
738
- o[prop] = objProp;
739
729
  }
740
- return o;
730
+ return clone2;
741
731
  };
742
732
  var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}) => {
743
733
  const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
@@ -749,6 +739,8 @@ var require_object = __commonJS({
749
739
  continue;
750
740
  if ((0, import_types.isObjectLike)(objProp)) {
751
741
  o[prop] = deepCloneWithExtend(objProp, excludeFrom, options);
742
+ } else if ((0, import_types.isFunction)(objProp) && options.window) {
743
+ o[prop] = (options.window || import_globals2.window).eval("(" + objProp.toString() + ")");
752
744
  } else
753
745
  o[prop] = objProp;
754
746
  }
@@ -992,16 +984,23 @@ var require_object = __commonJS({
992
984
  }
993
985
  return obj;
994
986
  };
995
- var overwriteDeep = (obj, params, excludeFrom = []) => {
987
+ var overwriteDeep = (obj, params, excludeFrom = [], visited = /* @__PURE__ */ new WeakMap()) => {
988
+ if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
989
+ return params;
990
+ }
991
+ if (visited.has(obj)) {
992
+ return visited.get(obj);
993
+ }
994
+ visited.set(obj, obj);
996
995
  for (const e in params) {
997
- if (e === "__ref")
998
- continue;
999
- if (excludeFrom.includes(e) || e.startsWith("__"))
996
+ if (e === "__ref" || excludeFrom.includes(e) || e.startsWith("__"))
1000
997
  continue;
1001
998
  const objProp = obj[e];
1002
999
  const paramsProp = params[e];
1003
- if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
1004
- overwriteDeep(objProp, paramsProp);
1000
+ if ((0, import_node.isDOMNode)(paramsProp)) {
1001
+ obj[e] = paramsProp;
1002
+ } else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
1003
+ obj[e] = overwriteDeep(objProp, paramsProp, excludeFrom, visited);
1005
1004
  } else if (paramsProp !== void 0) {
1006
1005
  obj[e] = paramsProp;
1007
1006
  }
@@ -1048,30 +1047,40 @@ var require_object = __commonJS({
1048
1047
  }
1049
1048
  return true;
1050
1049
  };
1051
- var deepContains = (obj1, obj2) => {
1052
- if (typeof obj1 !== typeof obj2) {
1050
+ var deepContains = (obj1, obj2, ignoredKeys = ["node", "__ref"]) => {
1051
+ if (obj1 === obj2)
1052
+ return true;
1053
+ if (!(0, import_types.isObjectLike)(obj1) || !(0, import_types.isObjectLike)(obj2))
1053
1054
  return false;
1054
- }
1055
- if ((0, import_types.isObjectLike)(obj1)) {
1056
- if (Array.isArray(obj1) && Array.isArray(obj2)) {
1057
- if (obj1.length !== obj2.length) {
1055
+ if ((0, import_node.isDOMNode)(obj1) || (0, import_node.isDOMNode)(obj2))
1056
+ return obj1 === obj2;
1057
+ const stack = [[obj1, obj2]];
1058
+ const visited = /* @__PURE__ */ new WeakSet();
1059
+ while (stack.length > 0) {
1060
+ const [current1, current2] = stack.pop();
1061
+ if (visited.has(current1))
1062
+ continue;
1063
+ visited.add(current1);
1064
+ const keys1 = Object.keys(current1).filter((key) => !ignoredKeys.includes(key));
1065
+ const keys2 = Object.keys(current2).filter((key) => !ignoredKeys.includes(key));
1066
+ if (keys1.length !== keys2.length)
1067
+ return false;
1068
+ for (const key of keys1) {
1069
+ if (!Object.prototype.hasOwnProperty.call(current2, key))
1058
1070
  return false;
1059
- }
1060
- for (let i = 0; i < obj1.length; i++) {
1061
- if (!deepContains(obj1[i], obj2[i])) {
1062
- return false;
1063
- }
1064
- }
1065
- } else if ((0, import_types.isObjectLike)(obj1) && obj2 !== null) {
1066
- for (const key in obj1) {
1067
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj2, key);
1068
- if (!hasOwnProperty2 || !deepContains(obj1[key], obj2[key])) {
1071
+ const value1 = current1[key];
1072
+ const value2 = current2[key];
1073
+ if ((0, import_node.isDOMNode)(value1) || (0, import_node.isDOMNode)(value2)) {
1074
+ if (value1 !== value2)
1069
1075
  return false;
1076
+ } else if ((0, import_types.isObjectLike)(value1) && (0, import_types.isObjectLike)(value2)) {
1077
+ if (value1 !== value2) {
1078
+ stack.push([value1, value2]);
1070
1079
  }
1080
+ } else if (value1 !== value2) {
1081
+ return false;
1071
1082
  }
1072
1083
  }
1073
- } else {
1074
- return obj2 === obj1;
1075
1084
  }
1076
1085
  return true;
1077
1086
  };
@@ -1099,53 +1108,60 @@ var require_object = __commonJS({
1099
1108
  }
1100
1109
  return newObj;
1101
1110
  };
1102
- var checkIfKeyIsComponent = (key) => {
1103
- const isFirstKeyString = (0, import_types.isString)(key);
1104
- if (!isFirstKeyString)
1105
- return;
1106
- const firstCharKey = key.slice(0, 1);
1107
- return /^[A-Z]*$/.test(firstCharKey);
1111
+ var createNestedObject = (arr, lastValue) => {
1112
+ const nestedObject = {};
1113
+ if (arr.length === 0) {
1114
+ return lastValue;
1115
+ }
1116
+ arr.reduce((obj, value, index) => {
1117
+ if (!obj[value]) {
1118
+ obj[value] = {};
1119
+ }
1120
+ if (index === arr.length - 1 && lastValue) {
1121
+ obj[value] = lastValue;
1122
+ }
1123
+ return obj[value];
1124
+ }, nestedObject);
1125
+ return nestedObject;
1108
1126
  };
1109
- var getChildrenComponentsByKey = (key, el) => {
1110
- if (key === el.key || el.__ref.__componentKey === key) {
1111
- return el;
1127
+ var removeNestedKeyByPath = (obj, path) => {
1128
+ if (!Array.isArray(path)) {
1129
+ throw new Error("Path must be an array.");
1112
1130
  }
1113
- if (el.extend) {
1114
- const foundString = (0, import_types.isString)(el.extend) && el.extend === key;
1115
- const foundInArray = (0, import_types.isArray)(el.extend) && el.extend.filter((v) => v === key).length;
1116
- if (foundString || foundInArray)
1117
- return el;
1131
+ let current = obj;
1132
+ for (let i = 0; i < path.length - 1; i++) {
1133
+ if (current[path[i]] === void 0) {
1134
+ return;
1135
+ }
1136
+ current = current[path[i]];
1118
1137
  }
1119
- if (el.parent && el.parent.childExtend) {
1120
- const foundString = (0, import_types.isString)(el.parent.childExtend) && el.parent.childExtend === key;
1121
- const foundInArray = (0, import_types.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
1122
- if (foundString || foundInArray)
1123
- return el;
1138
+ const lastKey = path[path.length - 1];
1139
+ if (current && Object.hasOwnProperty.call(current, lastKey)) {
1140
+ delete current[lastKey];
1124
1141
  }
1125
1142
  };
1126
- var getExtendsInElement = (obj) => {
1127
- let result = [];
1128
- function traverse(o) {
1129
- for (const key in o) {
1130
- if (Object.hasOwnProperty.call(o, key)) {
1131
- if (checkIfKeyIsComponent(key)) {
1132
- result.push(key);
1133
- }
1134
- if (key === "extend") {
1135
- if (typeof o[key] === "string") {
1136
- result.push(o[key]);
1137
- } else if (Array.isArray(o[key])) {
1138
- result = result.concat(o[key]);
1139
- }
1140
- }
1141
- if (typeof o[key] === "object" && o[key] !== null) {
1142
- traverse(o[key]);
1143
+ var detectInfiniteLoop = (arr) => {
1144
+ const maxRepeats = 10;
1145
+ let pattern = [];
1146
+ let repeatCount = 0;
1147
+ for (let i = 0; i < arr.length; i++) {
1148
+ if (pattern.length < 2) {
1149
+ pattern.push(arr[i]);
1150
+ } else {
1151
+ if (arr[i] === pattern[i % 2]) {
1152
+ repeatCount++;
1153
+ } else {
1154
+ pattern = [arr[i - 1], arr[i]];
1155
+ repeatCount = 1;
1156
+ }
1157
+ if (repeatCount >= maxRepeats * 2) {
1158
+ if (ENV === "test" || ENV === "development") {
1159
+ console.warn("Warning: Potential infinite loop detected due to repeated sequence:", pattern);
1143
1160
  }
1161
+ return true;
1144
1162
  }
1145
1163
  }
1146
1164
  }
1147
- traverse(obj);
1148
- return result;
1149
1165
  };
1150
1166
  }
1151
1167
  });
@@ -1173,6 +1189,7 @@ var require_function = __commonJS({
1173
1189
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1174
1190
  var function_exports = {};
1175
1191
  __export2(function_exports, {
1192
+ cloneFunction: () => cloneFunction,
1176
1193
  debounce: () => debounce,
1177
1194
  debounceOnContext: () => debounceOnContext,
1178
1195
  isStringFunction: () => isStringFunction,
@@ -1222,6 +1239,17 @@ var require_function = __commonJS({
1222
1239
  const functionRegex = /^((function\s*\([^)]*\)\s*\{[^}]*\})|(\([^)]*\)\s*=>))/;
1223
1240
  return functionRegex.test(inputString);
1224
1241
  };
1242
+ function cloneFunction(fn, win = window) {
1243
+ const temp = function() {
1244
+ return fn.apply(win, arguments);
1245
+ };
1246
+ for (const key in fn) {
1247
+ if (Object.hasOwnProperty.call(fn, key)) {
1248
+ temp[key] = fn[key];
1249
+ }
1250
+ }
1251
+ return temp;
1252
+ }
1225
1253
  }
1226
1254
  });
1227
1255
 
@@ -1491,6 +1519,172 @@ var require_tags = __commonJS({
1491
1519
  }
1492
1520
  });
1493
1521
 
1522
+ // ../../../domql/packages/utils/dist/cjs/component.js
1523
+ var require_component = __commonJS({
1524
+ "../../../domql/packages/utils/dist/cjs/component.js"(exports, module2) {
1525
+ "use strict";
1526
+ var __defProp2 = Object.defineProperty;
1527
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1528
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
1529
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1530
+ var __export2 = (target, all) => {
1531
+ for (var name in all)
1532
+ __defProp2(target, name, { get: all[name], enumerable: true });
1533
+ };
1534
+ var __copyProps2 = (to, from, except, desc) => {
1535
+ if (from && typeof from === "object" || typeof from === "function") {
1536
+ for (let key of __getOwnPropNames2(from))
1537
+ if (!__hasOwnProp2.call(to, key) && key !== except)
1538
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1539
+ }
1540
+ return to;
1541
+ };
1542
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
1543
+ var component_exports = {};
1544
+ __export2(component_exports, {
1545
+ addAdditionalExtend: () => addAdditionalExtend,
1546
+ applyComponentFromContext: () => applyComponentFromContext,
1547
+ applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
1548
+ checkIfKeyIsComponent: () => checkIfKeyIsComponent,
1549
+ checkIfKeyIsProperty: () => checkIfKeyIsProperty,
1550
+ extendizeByKey: () => extendizeByKey,
1551
+ getChildrenComponentsByKey: () => getChildrenComponentsByKey,
1552
+ getExtendsInElement: () => getExtendsInElement,
1553
+ hasVariantProp: () => hasVariantProp,
1554
+ isVariant: () => isVariant
1555
+ });
1556
+ module2.exports = __toCommonJS2(component_exports);
1557
+ var import__ = require_cjs();
1558
+ var ENV = "development";
1559
+ var checkIfKeyIsComponent = (key) => {
1560
+ const isFirstKeyString = (0, import__.isString)(key);
1561
+ if (!isFirstKeyString)
1562
+ return;
1563
+ const firstCharKey = key.slice(0, 1);
1564
+ return /^[A-Z]*$/.test(firstCharKey);
1565
+ };
1566
+ var checkIfKeyIsProperty = (key) => {
1567
+ const isFirstKeyString = (0, import__.isString)(key);
1568
+ if (!isFirstKeyString)
1569
+ return;
1570
+ const firstCharKey = key.slice(0, 1);
1571
+ return /^[a-z]*$/.test(firstCharKey);
1572
+ };
1573
+ var addAdditionalExtend = (newExtend, element) => {
1574
+ const { extend: elementExtend } = element;
1575
+ const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
1576
+ const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
1577
+ const extend = (0, import__.joinArrays)(receivedArray, originalArray);
1578
+ return { ...element, extend };
1579
+ };
1580
+ var extendizeByKey = (element, parent, key) => {
1581
+ const { context } = parent;
1582
+ const { tag, extend, props, attr, state, childExtend, childProps, on, if: condition, data } = element;
1583
+ const hasComponentAttrs = extend || childExtend || props || state || on || condition || attr || data;
1584
+ const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
1585
+ const isExtendKeyComponent = context && context.components[extendFromKey];
1586
+ if (element === isExtendKeyComponent)
1587
+ return element;
1588
+ else if (!hasComponentAttrs || childProps) {
1589
+ return {
1590
+ extend: extendFromKey,
1591
+ tag,
1592
+ props: { ...element }
1593
+ };
1594
+ } else if (!extend || extend === true) {
1595
+ return {
1596
+ ...element,
1597
+ tag,
1598
+ extend: extendFromKey
1599
+ };
1600
+ } else if (extend) {
1601
+ return addAdditionalExtend(extendFromKey, element);
1602
+ } else if ((0, import__.isFunction)(element)) {
1603
+ return {
1604
+ extend: extendFromKey,
1605
+ tag,
1606
+ props: { ...(0, import__.exec)(element, parent) }
1607
+ };
1608
+ }
1609
+ };
1610
+ var applyKeyComponentAsExtend = (element, parent, key) => {
1611
+ return extendizeByKey(element, parent, key) || element;
1612
+ };
1613
+ var applyComponentFromContext = (element, parent, options) => {
1614
+ const { context } = element;
1615
+ if (!context || !context.components)
1616
+ return;
1617
+ const { components } = context;
1618
+ const { extend } = element;
1619
+ const execExtend = (0, import__.exec)(extend, element);
1620
+ if ((0, import__.isString)(execExtend)) {
1621
+ const componentExists = components[execExtend] || components["smbls." + execExtend];
1622
+ if (componentExists)
1623
+ element.extend = componentExists;
1624
+ else {
1625
+ if ((ENV === "test" || ENV === "development") && options.verbose) {
1626
+ console.warn(execExtend, "is not in library", components, element);
1627
+ console.warn("replacing with ", {});
1628
+ }
1629
+ element.extend = {};
1630
+ }
1631
+ }
1632
+ };
1633
+ var isVariant = (param) => {
1634
+ if (!(0, import__.isString)(param))
1635
+ return;
1636
+ const firstCharKey = param.slice(0, 1);
1637
+ return firstCharKey === ".";
1638
+ };
1639
+ var hasVariantProp = (element) => {
1640
+ const { props } = element;
1641
+ if ((0, import__.isObject)(props) && (0, import__.isString)(props.variant))
1642
+ return true;
1643
+ };
1644
+ var getChildrenComponentsByKey = (key, el) => {
1645
+ if (key === el.key || el.__ref.__componentKey === key) {
1646
+ return el;
1647
+ }
1648
+ if (el.extend) {
1649
+ const foundString = (0, import__.isString)(el.extend) && el.extend === key;
1650
+ const foundInArray = (0, import__.isArray)(el.extend) && el.extend.filter((v) => v === key).length;
1651
+ if (foundString || foundInArray)
1652
+ return el;
1653
+ }
1654
+ if (el.parent && el.parent.childExtend) {
1655
+ const foundString = (0, import__.isString)(el.parent.childExtend) && el.parent.childExtend === key;
1656
+ const foundInArray = (0, import__.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
1657
+ if (foundString || foundInArray)
1658
+ return el;
1659
+ }
1660
+ };
1661
+ var getExtendsInElement = (obj) => {
1662
+ let result = [];
1663
+ function traverse(o) {
1664
+ for (const key in o) {
1665
+ if (Object.hasOwnProperty.call(o, key)) {
1666
+ if (checkIfKeyIsComponent(key)) {
1667
+ result.push(key);
1668
+ }
1669
+ if (key === "extend") {
1670
+ if (typeof o[key] === "string") {
1671
+ result.push(o[key]);
1672
+ } else if (Array.isArray(o[key])) {
1673
+ result = result.concat(o[key]);
1674
+ }
1675
+ }
1676
+ if (typeof o[key] === "object" && o[key] !== null) {
1677
+ traverse(o[key]);
1678
+ }
1679
+ }
1680
+ }
1681
+ }
1682
+ traverse(obj);
1683
+ return result;
1684
+ };
1685
+ }
1686
+ });
1687
+
1494
1688
  // ../../../domql/packages/utils/dist/cjs/index.js
1495
1689
  var require_cjs = __commonJS({
1496
1690
  "../../../domql/packages/utils/dist/cjs/index.js"(exports, module2) {
@@ -1523,6 +1717,7 @@ var require_cjs = __commonJS({
1523
1717
  __reExport(utils_exports, require_globals(), module2.exports);
1524
1718
  __reExport(utils_exports, require_cookie(), module2.exports);
1525
1719
  __reExport(utils_exports, require_tags(), module2.exports);
1720
+ __reExport(utils_exports, require_component(), module2.exports);
1526
1721
  }
1527
1722
  });
1528
1723
 
@@ -1725,6 +1920,7 @@ var require_cjs3 = __commonJS({
1725
1920
  var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
1726
1921
  var node_exports = {};
1727
1922
  __export22(node_exports, {
1923
+ isDOMNode: () => isDOMNode,
1728
1924
  isHtmlElement: () => isHtmlElement,
1729
1925
  isNode: () => isNode
1730
1926
  });
@@ -1736,6 +1932,9 @@ var require_cjs3 = __commonJS({
1736
1932
  var isHtmlElement = (obj) => {
1737
1933
  return (typeof HTMLElement === "object" ? obj instanceof import_globals2.window.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string") || false;
1738
1934
  };
1935
+ var isDOMNode = (obj) => {
1936
+ return typeof import_globals2.window !== "undefined" && (obj instanceof import_globals2.window.Node || obj instanceof import_globals2.window.Window || obj === import_globals2.window || obj === document);
1937
+ };
1739
1938
  }
1740
1939
  });
1741
1940
  var require_types2 = __commonJS2({
@@ -1851,7 +2050,6 @@ var require_cjs3 = __commonJS({
1851
2050
  addItemAfterEveryElement: () => addItemAfterEveryElement,
1852
2051
  arrayContainsOtherArray: () => arrayContainsOtherArray,
1853
2052
  arraysEqual: () => arraysEqual,
1854
- createNestedObject: () => createNestedObject,
1855
2053
  cutArrayAfterValue: () => cutArrayAfterValue,
1856
2054
  cutArrayBeforeValue: () => cutArrayBeforeValue,
1857
2055
  getFrequencyInArray: () => getFrequencyInArray,
@@ -1897,10 +2095,10 @@ var require_cjs3 = __commonJS({
1897
2095
  return [].concat(...arrays);
1898
2096
  };
1899
2097
  var mergeArray = (arr, excludeFrom = []) => {
1900
- return arr.reduce((a, c) => (0, import_object.deepMerge)(a, (0, import_object.deepClone)(c, excludeFrom), excludeFrom), {});
2098
+ return arr.reduce((a, c) => (0, import_object.deepMerge)(a, (0, import_object.deepCloneWithExtend)(c, excludeFrom), excludeFrom), {});
1901
2099
  };
1902
2100
  var mergeAndCloneIfArray = (obj) => {
1903
- return (0, import_types.isArray)(obj) ? mergeArray(obj) : (0, import_object.deepClone)(obj);
2101
+ return (0, import_types.isArray)(obj) ? mergeArray(obj) : (0, import_object.deepCloneWithExtend)(obj);
1904
2102
  };
1905
2103
  var cutArrayBeforeValue = (arr, value) => {
1906
2104
  const index = arr.indexOf(value);
@@ -1918,22 +2116,6 @@ var require_cjs3 = __commonJS({
1918
2116
  }
1919
2117
  return arr;
1920
2118
  };
1921
- var createNestedObject = (arr, lastValue) => {
1922
- const nestedObject = {};
1923
- if (arr.length === 0) {
1924
- return lastValue;
1925
- }
1926
- arr.reduce((obj, value, index) => {
1927
- if (!obj[value]) {
1928
- obj[value] = {};
1929
- }
1930
- if (index === arr.length - 1 && lastValue) {
1931
- obj[value] = lastValue;
1932
- }
1933
- return obj[value];
1934
- }, nestedObject);
1935
- return nestedObject;
1936
- };
1937
2119
  var removeValueFromArray = (arr, value) => {
1938
2120
  const index = arr.indexOf(value);
1939
2121
  if (index > -1) {
@@ -2004,6 +2186,8 @@ var require_cjs3 = __commonJS({
2004
2186
  __export22(string_exports, {
2005
2187
  customDecodeURIComponent: () => customDecodeURIComponent,
2006
2188
  customEncodeURIComponent: () => customEncodeURIComponent,
2189
+ decodeNewlines: () => decodeNewlines,
2190
+ encodeNewlines: () => encodeNewlines,
2007
2191
  findKeyPosition: () => findKeyPosition,
2008
2192
  lowercaseFirstLetter: () => lowercaseFirstLetter,
2009
2193
  replaceLiteralsWithObjectFields: () => replaceLiteralsWithObjectFields,
@@ -2107,6 +2291,12 @@ var require_cjs3 = __commonJS({
2107
2291
  return char;
2108
2292
  });
2109
2293
  };
2294
+ var encodeNewlines = (str) => {
2295
+ return str.split("\n").join("/////n").split("`").join("/////tilde").split("$").join("/////dlrsgn");
2296
+ };
2297
+ var decodeNewlines = (encodedStr) => {
2298
+ return encodedStr.split("/////n").join("\n").split("/////tilde").join("`").split("/////dlrsgn").join("$");
2299
+ };
2110
2300
  var customEncodeURIComponent = (str) => {
2111
2301
  return str.split("").map((char) => {
2112
2302
  if (/[^a-zA-Z0-9\s]/.test(char)) {
@@ -2142,8 +2332,8 @@ var require_cjs3 = __commonJS({
2142
2332
  var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
2143
2333
  var object_exports = {};
2144
2334
  __export22(object_exports, {
2145
- checkIfKeyIsComponent: () => checkIfKeyIsComponent,
2146
2335
  clone: () => clone,
2336
+ createNestedObject: () => createNestedObject,
2147
2337
  createObjectWithoutPrototype: () => createObjectWithoutPrototype,
2148
2338
  deepClone: () => deepClone2,
2149
2339
  deepCloneExclude: () => deepCloneExclude,
@@ -2154,13 +2344,12 @@ var require_cjs3 = __commonJS({
2154
2344
  deepMerge: () => deepMerge2,
2155
2345
  deepStringify: () => deepStringify,
2156
2346
  detachFunctionsFromObject: () => detachFunctionsFromObject,
2347
+ detectInfiniteLoop: () => detectInfiniteLoop,
2157
2348
  diff: () => diff,
2158
2349
  diffArrays: () => diffArrays,
2159
2350
  diffObjects: () => diffObjects,
2160
2351
  exec: () => exec,
2161
2352
  flattenRecursive: () => flattenRecursive,
2162
- getChildrenComponentsByKey: () => getChildrenComponentsByKey,
2163
- getExtendsInElement: () => getExtendsInElement,
2164
2353
  hasOwnProperty: () => hasOwnProperty,
2165
2354
  isEmpty: () => isEmpty,
2166
2355
  isEmptyObject: () => isEmptyObject,
@@ -2175,6 +2364,7 @@ var require_cjs3 = __commonJS({
2175
2364
  overwriteDeep: () => overwriteDeep,
2176
2365
  overwriteShallow: () => overwriteShallow,
2177
2366
  removeFromObject: () => removeFromObject,
2367
+ removeNestedKeyByPath: () => removeNestedKeyByPath,
2178
2368
  stringToObject: () => stringToObject
2179
2369
  });
2180
2370
  module22.exports = __toCommonJS22(object_exports);
@@ -2182,6 +2372,8 @@ var require_cjs3 = __commonJS({
2182
2372
  var import_types = require_types2();
2183
2373
  var import_array = require_array2();
2184
2374
  var import_string = require_string2();
2375
+ var import_node = require_node2();
2376
+ var ENV = "development";
2185
2377
  var exec = (param, element, state, context) => {
2186
2378
  if ((0, import_types.isFunction)(param)) {
2187
2379
  return param(
@@ -2260,27 +2452,28 @@ var require_cjs3 = __commonJS({
2260
2452
  var mergeArrayExclude = (arr, excl = []) => {
2261
2453
  return arr.reduce((acc, curr) => deepMerge2(acc, deepCloneExclude(curr, excl)), {});
2262
2454
  };
2263
- var deepClone2 = (obj, excludeFrom = [], cleanUndefined = false) => {
2264
- const o = (0, import_types.isArray)(obj) ? [] : {};
2265
- for (const prop in obj) {
2266
- if (!Object.prototype.hasOwnProperty.call(obj, prop))
2267
- continue;
2268
- if (prop === "__proto__")
2269
- continue;
2270
- if (excludeFrom.includes(prop) || prop.startsWith("__"))
2271
- continue;
2272
- let objProp = obj[prop];
2273
- if (cleanUndefined && (0, import_types.isUndefined)(objProp))
2274
- continue;
2275
- if (prop === "extend" && (0, import_types.isArray)(objProp)) {
2276
- objProp = (0, import_array.mergeArray)(objProp);
2455
+ var deepClone2 = (obj, exclude = [], cleanUndefined = false, visited = /* @__PURE__ */ new WeakMap()) => {
2456
+ if (!(0, import_types.isObjectLike)(obj) || (0, import_node.isDOMNode)(obj))
2457
+ return obj;
2458
+ if (visited.has(obj))
2459
+ return visited.get(obj);
2460
+ const clone2 = (0, import_types.isArray)(obj) ? [] : {};
2461
+ visited.set(obj, clone2);
2462
+ for (const key in obj) {
2463
+ if (Object.prototype.hasOwnProperty.call(obj, key) && !exclude.includes(key)) {
2464
+ const value = obj[key];
2465
+ if ((0, import_node.isDOMNode)(value)) {
2466
+ clone2[key] = value;
2467
+ } else if (key === "extend" && (0, import_types.isArray)(value)) {
2468
+ clone2[key] = (0, import_array.mergeArray)(value, exclude);
2469
+ } else if ((0, import_types.isObjectLike)(value)) {
2470
+ clone2[key] = deepClone2(value, exclude, cleanUndefined, visited);
2471
+ } else {
2472
+ clone2[key] = value;
2473
+ }
2277
2474
  }
2278
- if ((0, import_types.isObjectLike)(objProp)) {
2279
- o[prop] = deepClone2(objProp, excludeFrom, cleanUndefined);
2280
- } else
2281
- o[prop] = objProp;
2282
2475
  }
2283
- return o;
2476
+ return clone2;
2284
2477
  };
2285
2478
  var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}) => {
2286
2479
  const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
@@ -2292,6 +2485,8 @@ var require_cjs3 = __commonJS({
2292
2485
  continue;
2293
2486
  if ((0, import_types.isObjectLike)(objProp)) {
2294
2487
  o[prop] = deepCloneWithExtend(objProp, excludeFrom, options);
2488
+ } else if ((0, import_types.isFunction)(objProp) && options.window) {
2489
+ o[prop] = (options.window || import_globals2.window).eval("(" + objProp.toString() + ")");
2295
2490
  } else
2296
2491
  o[prop] = objProp;
2297
2492
  }
@@ -2535,16 +2730,23 @@ var require_cjs3 = __commonJS({
2535
2730
  }
2536
2731
  return obj;
2537
2732
  };
2538
- var overwriteDeep = (obj, params, excludeFrom = []) => {
2733
+ var overwriteDeep = (obj, params, excludeFrom = [], visited = /* @__PURE__ */ new WeakMap()) => {
2734
+ if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
2735
+ return params;
2736
+ }
2737
+ if (visited.has(obj)) {
2738
+ return visited.get(obj);
2739
+ }
2740
+ visited.set(obj, obj);
2539
2741
  for (const e in params) {
2540
- if (e === "__proto__")
2541
- continue;
2542
- if (excludeFrom.includes(e) || e.startsWith("__"))
2742
+ if (e === "__ref" || excludeFrom.includes(e) || e.startsWith("__"))
2543
2743
  continue;
2544
2744
  const objProp = obj[e];
2545
2745
  const paramsProp = params[e];
2546
- if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
2547
- overwriteDeep(objProp, paramsProp);
2746
+ if ((0, import_node.isDOMNode)(paramsProp)) {
2747
+ obj[e] = paramsProp;
2748
+ } else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
2749
+ obj[e] = overwriteDeep(objProp, paramsProp, excludeFrom, visited);
2548
2750
  } else if (paramsProp !== void 0) {
2549
2751
  obj[e] = paramsProp;
2550
2752
  }
@@ -2591,30 +2793,40 @@ var require_cjs3 = __commonJS({
2591
2793
  }
2592
2794
  return true;
2593
2795
  };
2594
- var deepContains = (obj1, obj2) => {
2595
- if (typeof obj1 !== typeof obj2) {
2796
+ var deepContains = (obj1, obj2, ignoredKeys = ["node", "__ref"]) => {
2797
+ if (obj1 === obj2)
2798
+ return true;
2799
+ if (!(0, import_types.isObjectLike)(obj1) || !(0, import_types.isObjectLike)(obj2))
2596
2800
  return false;
2597
- }
2598
- if ((0, import_types.isObjectLike)(obj1)) {
2599
- if (Array.isArray(obj1) && Array.isArray(obj2)) {
2600
- if (obj1.length !== obj2.length) {
2801
+ if ((0, import_node.isDOMNode)(obj1) || (0, import_node.isDOMNode)(obj2))
2802
+ return obj1 === obj2;
2803
+ const stack = [[obj1, obj2]];
2804
+ const visited = /* @__PURE__ */ new WeakSet();
2805
+ while (stack.length > 0) {
2806
+ const [current1, current2] = stack.pop();
2807
+ if (visited.has(current1))
2808
+ continue;
2809
+ visited.add(current1);
2810
+ const keys1 = Object.keys(current1).filter((key) => !ignoredKeys.includes(key));
2811
+ const keys2 = Object.keys(current2).filter((key) => !ignoredKeys.includes(key));
2812
+ if (keys1.length !== keys2.length)
2813
+ return false;
2814
+ for (const key of keys1) {
2815
+ if (!Object.prototype.hasOwnProperty.call(current2, key))
2601
2816
  return false;
2602
- }
2603
- for (let i = 0; i < obj1.length; i++) {
2604
- if (!deepContains(obj1[i], obj2[i])) {
2605
- return false;
2606
- }
2607
- }
2608
- } else if ((0, import_types.isObjectLike)(obj1) && obj2 !== null) {
2609
- for (const key in obj1) {
2610
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj2, key);
2611
- if (!hasOwnProperty2 || !deepContains(obj1[key], obj2[key])) {
2817
+ const value1 = current1[key];
2818
+ const value2 = current2[key];
2819
+ if ((0, import_node.isDOMNode)(value1) || (0, import_node.isDOMNode)(value2)) {
2820
+ if (value1 !== value2)
2612
2821
  return false;
2822
+ } else if ((0, import_types.isObjectLike)(value1) && (0, import_types.isObjectLike)(value2)) {
2823
+ if (value1 !== value2) {
2824
+ stack.push([value1, value2]);
2613
2825
  }
2826
+ } else if (value1 !== value2) {
2827
+ return false;
2614
2828
  }
2615
2829
  }
2616
- } else {
2617
- return obj2 === obj1;
2618
2830
  }
2619
2831
  return true;
2620
2832
  };
@@ -2642,53 +2854,60 @@ var require_cjs3 = __commonJS({
2642
2854
  }
2643
2855
  return newObj;
2644
2856
  };
2645
- var checkIfKeyIsComponent = (key) => {
2646
- const isFirstKeyString = (0, import_types.isString)(key);
2647
- if (!isFirstKeyString)
2648
- return;
2649
- const firstCharKey = key.slice(0, 1);
2650
- return /^[A-Z]*$/.test(firstCharKey);
2857
+ var createNestedObject = (arr, lastValue) => {
2858
+ const nestedObject = {};
2859
+ if (arr.length === 0) {
2860
+ return lastValue;
2861
+ }
2862
+ arr.reduce((obj, value, index) => {
2863
+ if (!obj[value]) {
2864
+ obj[value] = {};
2865
+ }
2866
+ if (index === arr.length - 1 && lastValue) {
2867
+ obj[value] = lastValue;
2868
+ }
2869
+ return obj[value];
2870
+ }, nestedObject);
2871
+ return nestedObject;
2651
2872
  };
2652
- var getChildrenComponentsByKey = (key, el) => {
2653
- if (key === el.key || el.__ref.__componentKey === key) {
2654
- return el;
2873
+ var removeNestedKeyByPath = (obj, path) => {
2874
+ if (!Array.isArray(path)) {
2875
+ throw new Error("Path must be an array.");
2655
2876
  }
2656
- if (el.extend) {
2657
- const foundString = (0, import_types.isString)(el.extend) && el.extend === key;
2658
- const foundInArray = (0, import_types.isArray)(el.extend) && el.extend.filter((v) => v === key).length;
2659
- if (foundString || foundInArray)
2660
- return el;
2877
+ let current = obj;
2878
+ for (let i = 0; i < path.length - 1; i++) {
2879
+ if (current[path[i]] === void 0) {
2880
+ return;
2881
+ }
2882
+ current = current[path[i]];
2661
2883
  }
2662
- if (el.parent && el.parent.childExtend) {
2663
- const foundString = (0, import_types.isString)(el.parent.childExtend) && el.parent.childExtend === key;
2664
- const foundInArray = (0, import_types.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
2665
- if (foundString || foundInArray)
2666
- return el;
2884
+ const lastKey = path[path.length - 1];
2885
+ if (current && Object.hasOwnProperty.call(current, lastKey)) {
2886
+ delete current[lastKey];
2667
2887
  }
2668
2888
  };
2669
- var getExtendsInElement = (obj) => {
2670
- let result = [];
2671
- function traverse(o) {
2672
- for (const key in o) {
2673
- if (Object.hasOwnProperty.call(o, key)) {
2674
- if (checkIfKeyIsComponent(key)) {
2675
- result.push(key);
2676
- }
2677
- if (key === "extend") {
2678
- if (typeof o[key] === "string") {
2679
- result.push(o[key]);
2680
- } else if (Array.isArray(o[key])) {
2681
- result = result.concat(o[key]);
2682
- }
2683
- }
2684
- if (typeof o[key] === "object" && o[key] !== null) {
2685
- traverse(o[key]);
2889
+ var detectInfiniteLoop = (arr) => {
2890
+ const maxRepeats = 10;
2891
+ let pattern = [];
2892
+ let repeatCount = 0;
2893
+ for (let i = 0; i < arr.length; i++) {
2894
+ if (pattern.length < 2) {
2895
+ pattern.push(arr[i]);
2896
+ } else {
2897
+ if (arr[i] === pattern[i % 2]) {
2898
+ repeatCount++;
2899
+ } else {
2900
+ pattern = [arr[i - 1], arr[i]];
2901
+ repeatCount = 1;
2902
+ }
2903
+ if (repeatCount >= maxRepeats * 2) {
2904
+ if (ENV === "test" || ENV === "development") {
2905
+ console.warn("Warning: Potential infinite loop detected due to repeated sequence:", pattern);
2686
2906
  }
2907
+ return true;
2687
2908
  }
2688
2909
  }
2689
2910
  }
2690
- traverse(obj);
2691
- return result;
2692
2911
  };
2693
2912
  }
2694
2913
  });
@@ -2714,6 +2933,7 @@ var require_cjs3 = __commonJS({
2714
2933
  var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
2715
2934
  var function_exports = {};
2716
2935
  __export22(function_exports, {
2936
+ cloneFunction: () => cloneFunction,
2717
2937
  debounce: () => debounce,
2718
2938
  debounceOnContext: () => debounceOnContext,
2719
2939
  isStringFunction: () => isStringFunction,
@@ -2763,6 +2983,17 @@ var require_cjs3 = __commonJS({
2763
2983
  const functionRegex = /^((function\s*\([^)]*\)\s*\{[^}]*\})|(\([^)]*\)\s*=>))/;
2764
2984
  return functionRegex.test(inputString);
2765
2985
  };
2986
+ function cloneFunction(fn, win = window) {
2987
+ const temp = function() {
2988
+ return fn.apply(win, arguments);
2989
+ };
2990
+ for (const key in fn) {
2991
+ if (Object.hasOwnProperty.call(fn, key)) {
2992
+ temp[key] = fn[key];
2993
+ }
2994
+ }
2995
+ return temp;
2996
+ }
2766
2997
  }
2767
2998
  });
2768
2999
  var require_log2 = __commonJS2({
@@ -3025,6 +3256,170 @@ var require_cjs3 = __commonJS({
3025
3256
  var isValidHtmlTag = (arg) => HTML_TAGS.body.includes(arg);
3026
3257
  }
3027
3258
  });
3259
+ var require_component2 = __commonJS2({
3260
+ "../../../domql/packages/utils/dist/cjs/component.js"(exports2, module22) {
3261
+ "use strict";
3262
+ var __defProp22 = Object.defineProperty;
3263
+ var __getOwnPropDesc22 = Object.getOwnPropertyDescriptor;
3264
+ var __getOwnPropNames22 = Object.getOwnPropertyNames;
3265
+ var __hasOwnProp22 = Object.prototype.hasOwnProperty;
3266
+ var __export22 = (target, all) => {
3267
+ for (var name in all)
3268
+ __defProp22(target, name, { get: all[name], enumerable: true });
3269
+ };
3270
+ var __copyProps22 = (to, from, except, desc) => {
3271
+ if (from && typeof from === "object" || typeof from === "function") {
3272
+ for (let key of __getOwnPropNames22(from))
3273
+ if (!__hasOwnProp22.call(to, key) && key !== except)
3274
+ __defProp22(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc22(from, key)) || desc.enumerable });
3275
+ }
3276
+ return to;
3277
+ };
3278
+ var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
3279
+ var component_exports = {};
3280
+ __export22(component_exports, {
3281
+ addAdditionalExtend: () => addAdditionalExtend,
3282
+ applyComponentFromContext: () => applyComponentFromContext,
3283
+ applyKeyComponentAsExtend: () => applyKeyComponentAsExtend,
3284
+ checkIfKeyIsComponent: () => checkIfKeyIsComponent,
3285
+ checkIfKeyIsProperty: () => checkIfKeyIsProperty,
3286
+ extendizeByKey: () => extendizeByKey,
3287
+ getChildrenComponentsByKey: () => getChildrenComponentsByKey,
3288
+ getExtendsInElement: () => getExtendsInElement,
3289
+ hasVariantProp: () => hasVariantProp,
3290
+ isVariant: () => isVariant
3291
+ });
3292
+ module22.exports = __toCommonJS22(component_exports);
3293
+ var import__ = require_cjs4();
3294
+ var ENV = "development";
3295
+ var checkIfKeyIsComponent = (key) => {
3296
+ const isFirstKeyString = (0, import__.isString)(key);
3297
+ if (!isFirstKeyString)
3298
+ return;
3299
+ const firstCharKey = key.slice(0, 1);
3300
+ return /^[A-Z]*$/.test(firstCharKey);
3301
+ };
3302
+ var checkIfKeyIsProperty = (key) => {
3303
+ const isFirstKeyString = (0, import__.isString)(key);
3304
+ if (!isFirstKeyString)
3305
+ return;
3306
+ const firstCharKey = key.slice(0, 1);
3307
+ return /^[a-z]*$/.test(firstCharKey);
3308
+ };
3309
+ var addAdditionalExtend = (newExtend, element) => {
3310
+ const { extend: elementExtend } = element;
3311
+ const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
3312
+ const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
3313
+ const extend = (0, import__.joinArrays)(receivedArray, originalArray);
3314
+ return { ...element, extend };
3315
+ };
3316
+ var extendizeByKey = (element, parent, key) => {
3317
+ const { context } = parent;
3318
+ const { tag, extend, props, attr, state, childExtend, childProps, on, if: condition, data } = element;
3319
+ const hasComponentAttrs = extend || childExtend || props || state || on || condition || attr || data;
3320
+ const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
3321
+ const isExtendKeyComponent = context && context.components[extendFromKey];
3322
+ if (element === isExtendKeyComponent)
3323
+ return element;
3324
+ else if (!hasComponentAttrs || childProps) {
3325
+ return {
3326
+ extend: extendFromKey,
3327
+ tag,
3328
+ props: { ...element }
3329
+ };
3330
+ } else if (!extend || extend === true) {
3331
+ return {
3332
+ ...element,
3333
+ tag,
3334
+ extend: extendFromKey
3335
+ };
3336
+ } else if (extend) {
3337
+ return addAdditionalExtend(extendFromKey, element);
3338
+ } else if ((0, import__.isFunction)(element)) {
3339
+ return {
3340
+ extend: extendFromKey,
3341
+ tag,
3342
+ props: { ...(0, import__.exec)(element, parent) }
3343
+ };
3344
+ }
3345
+ };
3346
+ var applyKeyComponentAsExtend = (element, parent, key) => {
3347
+ return extendizeByKey(element, parent, key) || element;
3348
+ };
3349
+ var applyComponentFromContext = (element, parent, options) => {
3350
+ const { context } = element;
3351
+ if (!context || !context.components)
3352
+ return;
3353
+ const { components } = context;
3354
+ const { extend } = element;
3355
+ const execExtend = (0, import__.exec)(extend, element);
3356
+ if ((0, import__.isString)(execExtend)) {
3357
+ const componentExists = components[execExtend] || components["smbls." + execExtend];
3358
+ if (componentExists)
3359
+ element.extend = componentExists;
3360
+ else {
3361
+ if ((ENV === "test" || ENV === "development") && options.verbose) {
3362
+ console.warn(execExtend, "is not in library", components, element);
3363
+ console.warn("replacing with ", {});
3364
+ }
3365
+ element.extend = {};
3366
+ }
3367
+ }
3368
+ };
3369
+ var isVariant = (param) => {
3370
+ if (!(0, import__.isString)(param))
3371
+ return;
3372
+ const firstCharKey = param.slice(0, 1);
3373
+ return firstCharKey === ".";
3374
+ };
3375
+ var hasVariantProp = (element) => {
3376
+ const { props } = element;
3377
+ if ((0, import__.isObject)(props) && (0, import__.isString)(props.variant))
3378
+ return true;
3379
+ };
3380
+ var getChildrenComponentsByKey = (key, el) => {
3381
+ if (key === el.key || el.__ref.__componentKey === key) {
3382
+ return el;
3383
+ }
3384
+ if (el.extend) {
3385
+ const foundString = (0, import__.isString)(el.extend) && el.extend === key;
3386
+ const foundInArray = (0, import__.isArray)(el.extend) && el.extend.filter((v) => v === key).length;
3387
+ if (foundString || foundInArray)
3388
+ return el;
3389
+ }
3390
+ if (el.parent && el.parent.childExtend) {
3391
+ const foundString = (0, import__.isString)(el.parent.childExtend) && el.parent.childExtend === key;
3392
+ const foundInArray = (0, import__.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
3393
+ if (foundString || foundInArray)
3394
+ return el;
3395
+ }
3396
+ };
3397
+ var getExtendsInElement = (obj) => {
3398
+ let result = [];
3399
+ function traverse(o) {
3400
+ for (const key in o) {
3401
+ if (Object.hasOwnProperty.call(o, key)) {
3402
+ if (checkIfKeyIsComponent(key)) {
3403
+ result.push(key);
3404
+ }
3405
+ if (key === "extend") {
3406
+ if (typeof o[key] === "string") {
3407
+ result.push(o[key]);
3408
+ } else if (Array.isArray(o[key])) {
3409
+ result = result.concat(o[key]);
3410
+ }
3411
+ }
3412
+ if (typeof o[key] === "object" && o[key] !== null) {
3413
+ traverse(o[key]);
3414
+ }
3415
+ }
3416
+ }
3417
+ }
3418
+ traverse(obj);
3419
+ return result;
3420
+ };
3421
+ }
3422
+ });
3028
3423
  var require_cjs4 = __commonJS2({
3029
3424
  "../../../domql/packages/utils/dist/cjs/index.js"(exports2, module22) {
3030
3425
  "use strict";
@@ -3056,11 +3451,13 @@ var require_cjs3 = __commonJS({
3056
3451
  __reExport(utils_exports, require_globals2(), module22.exports);
3057
3452
  __reExport(utils_exports, require_cookie2(), module22.exports);
3058
3453
  __reExport(utils_exports, require_tags2(), module22.exports);
3454
+ __reExport(utils_exports, require_component2(), module22.exports);
3059
3455
  }
3060
3456
  });
3061
3457
  var src_exports = {};
3062
3458
  __export2(src_exports, {
3063
3459
  arrayzeValue: () => arrayzeValue,
3460
+ copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
3064
3461
  copyStringToClipboard: () => copyStringToClipboard,
3065
3462
  fibonacciNumberByIndex: () => fibonacciNumberByIndex,
3066
3463
  findClosestNumber: () => findClosestNumber,
@@ -3070,7 +3467,9 @@ var require_cjs3 = __commonJS({
3070
3467
  loadCssFile: () => loadCssFile,
3071
3468
  loadJavascript: () => loadJavascript,
3072
3469
  loadJavascriptFile: () => loadJavascriptFile,
3470
+ loadJavascriptFileEmbedSync: () => loadJavascriptFileEmbedSync,
3073
3471
  loadJavascriptFileSync: () => loadJavascriptFileSync,
3472
+ registerFrameListener: () => registerFrameListener,
3074
3473
  removeChars: () => removeChars,
3075
3474
  toCamelCase: () => toCamelCase,
3076
3475
  toDashCase: () => toDashCase2,
@@ -3143,7 +3542,27 @@ var require_cjs3 = __commonJS({
3143
3542
  }
3144
3543
  });
3145
3544
  };
3146
- var loadJavascriptFileSync = (FILE_URL, doc = document, fallback, type = "text/javascript") => {
3545
+ var loadJavascriptFileSync = (fileUrl, doc = document, type = "text/javascript") => {
3546
+ return new Promise((resolve, reject) => {
3547
+ const scriptEle = doc.createElement("script");
3548
+ scriptEle.type = type;
3549
+ scriptEle.src = fileUrl;
3550
+ const blocker = doc.createElement("div");
3551
+ blocker.style.cssText = "position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(255,255,255,0.8);z-index:9999;";
3552
+ doc.body.appendChild(blocker);
3553
+ scriptEle.onload = () => {
3554
+ console.log(`Successfully loaded: ${fileUrl}`);
3555
+ doc.body.removeChild(blocker);
3556
+ resolve();
3557
+ };
3558
+ scriptEle.onerror = () => {
3559
+ doc.body.removeChild(blocker);
3560
+ reject(new Error(`Failed to load: ${fileUrl}`));
3561
+ };
3562
+ doc.body.appendChild(scriptEle);
3563
+ });
3564
+ };
3565
+ var loadJavascriptFileEmbedSync = (FILE_URL, doc = document, fallback, type = "text/javascript") => {
3147
3566
  const xhr = new window.XMLHttpRequest();
3148
3567
  xhr.open("GET", FILE_URL, false);
3149
3568
  xhr.send();
@@ -3188,15 +3607,29 @@ var require_cjs3 = __commonJS({
3188
3607
  }
3189
3608
  };
3190
3609
  var isPhoto = (format) => ["jpeg", "gif", "jpg", "png", "tiff", "woff"].includes(format);
3191
- var copyStringToClipboard = (str) => {
3192
- const el = document.createElement("textarea");
3193
- el.value = str;
3194
- el.setAttribute("readonly", "");
3195
- el.style = { position: "absolute", left: "-9999px" };
3196
- document.body.appendChild(el);
3197
- el.select();
3198
- document.execCommand("copy");
3199
- document.body.removeChild(el);
3610
+ var registerFrameListener = (el) => {
3611
+ const { __ref: ref } = el;
3612
+ const { frameListeners } = ref.root.data;
3613
+ if (frameListeners && !frameListeners.has(el)) {
3614
+ frameListeners.add(el);
3615
+ }
3616
+ };
3617
+ var copyStringToClipboard = async (str) => {
3618
+ try {
3619
+ await navigator.clipboard.writeText(str);
3620
+ } catch (err) {
3621
+ console.warn("Failed to copy text: ", err);
3622
+ }
3623
+ };
3624
+ var copyJavaScriptToClipboard = async (jsCode) => {
3625
+ try {
3626
+ const blob = new Blob([jsCode], { type: "text/javascript" });
3627
+ const clipboardItem = new window.ClipboardItem({ "text/plain": blob });
3628
+ await navigator.clipboard.write([clipboardItem]);
3629
+ console.log("JavaScript code copied to clipboard as text/javascript");
3630
+ } catch (err) {
3631
+ console.error("Failed to copy JavaScript code: ", err);
3632
+ }
3200
3633
  };
3201
3634
  var removeChars = (str) => {
3202
3635
  return str.replace(/[^a-zA-Z0-9_]/g, "");
@@ -3410,9 +3843,11 @@ var BREAKPOINTS = {
3410
3843
  mobileXS: 375
3411
3844
  };
3412
3845
  var DEVICES = {
3846
+ screenXXL: [2560, 1440],
3847
+ screenXL: [2240, 1260],
3413
3848
  screenL: [1920, 1024],
3414
3849
  screenM: [1680, 1024],
3415
- screenS: [1440, 978],
3850
+ screenS: [1440, 720],
3416
3851
  tabletL: [1366, 926],
3417
3852
  tabletM: [1280, 768],
3418
3853
  tabletS: [1024, 768],
@@ -3636,7 +4071,7 @@ var getMediaColor = (value, globalTheme, config) => {
3636
4071
  const obj = {};
3637
4072
  for (const mediaName in val) {
3638
4073
  const query = CONFIG2.MEDIA[mediaName.slice(1)];
3639
- const media = `@media screen and ${query}`;
4074
+ const media = "@media " + (query === "print" ? `${query}` : `screen and ${query}`);
3640
4075
  obj[media] = getColor(value, mediaName, config);
3641
4076
  }
3642
4077
  return obj;