@domql/state 3.6.4 → 3.6.6

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.
@@ -4,6 +4,9 @@ var DomqlState = (() => {
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __esm = (fn, res) => function __init() {
8
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
+ };
7
10
  var __export = (target, all) => {
8
11
  for (var name in all)
9
12
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -18,621 +21,788 @@ var DomqlState = (() => {
18
21
  };
19
22
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
23
 
21
- // index.js
22
- var index_exports = {};
23
- __export(index_exports, {
24
- add: () => add,
25
- apply: () => apply,
26
- applyFunction: () => applyFunction,
27
- applyInitialState: () => applyInitialState,
28
- applyReplace: () => applyReplace,
29
- applyStateMethods: () => applyStateMethods,
30
- clean: () => clean,
31
- createState: () => createState,
32
- destroy: () => destroy,
33
- getByPath: () => getByPath,
34
- hoistStateUpdate: () => hoistStateUpdate,
35
- keys: () => keys,
36
- parentUpdate: () => parentUpdate,
37
- parse: () => parse,
38
- quietReplace: () => quietReplace,
39
- quietUpdate: () => quietUpdate,
40
- remove: () => remove,
41
- removeByPath: () => removeByPath,
42
- removePathCollection: () => removePathCollection,
43
- replace: () => replace,
44
- reset: () => reset,
45
- rootUpdate: () => rootUpdate,
46
- set: () => set,
47
- setByPath: () => setByPath,
48
- setPathCollection: () => setPathCollection,
49
- toggle: () => toggle,
50
- updateState: () => updateState,
51
- values: () => values
52
- });
53
-
54
24
  // ../utils/dist/esm/globals.js
55
- var window = globalThis;
56
- var document2 = window.document;
25
+ var window2, document2;
26
+ var init_globals = __esm({
27
+ "../utils/dist/esm/globals.js"() {
28
+ window2 = globalThis;
29
+ document2 = window2.document;
30
+ }
31
+ });
57
32
 
58
33
  // ../utils/dist/esm/node.js
59
- var isNode = (obj) => {
60
- return (typeof Node === "object" ? obj instanceof window.Node : obj && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string") || false;
61
- };
62
- var isHtmlElement = (obj) => {
63
- return (typeof HTMLElement === "object" ? obj instanceof window.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string") || false;
64
- };
65
- var isDOMNode = (obj) => {
66
- return typeof window !== "undefined" && (window.Node && obj instanceof window.Node || window.Window && obj instanceof window.Window || obj === window || obj === document);
67
- };
34
+ var isNode, isHtmlElement, isDOMNode;
35
+ var init_node = __esm({
36
+ "../utils/dist/esm/node.js"() {
37
+ init_globals();
38
+ isNode = (obj) => {
39
+ return (typeof Node === "object" ? obj instanceof window2.Node : obj && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string") || false;
40
+ };
41
+ isHtmlElement = (obj) => {
42
+ return (typeof HTMLElement === "object" ? obj instanceof window2.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string") || false;
43
+ };
44
+ isDOMNode = (obj) => {
45
+ return typeof window2 !== "undefined" && (window2.Node && obj instanceof window2.Node || window2.Window && obj instanceof window2.Window || obj === window2 || obj === document);
46
+ };
47
+ }
48
+ });
68
49
 
69
50
  // ../utils/dist/esm/types.js
70
- var isObject = (arg) => {
71
- if (arg === null) return false;
72
- return typeof arg === "object" && arg.constructor === Object;
73
- };
74
- var isString = (arg) => typeof arg === "string";
75
- var isNumber = (arg) => typeof arg === "number";
76
- var isFunction = (arg) => typeof arg === "function";
77
- var isBoolean = (arg) => arg === true || arg === false;
78
- var isNull = (arg) => arg === null;
79
- var isArray = (arg) => Array.isArray(arg);
80
- var isDate = (d) => d instanceof Date;
81
- var isObjectLike = (arg) => {
82
- if (arg === null) return false;
83
- return typeof arg === "object";
84
- };
85
- var isDefined = (arg) => arg !== void 0;
86
- var isUndefined = (arg) => arg === void 0;
87
- var TYPES = {
88
- boolean: isBoolean,
89
- array: isArray,
90
- object: isObject,
91
- string: isString,
92
- date: isDate,
93
- number: isNumber,
94
- null: isNull,
95
- function: isFunction,
96
- objectLike: isObjectLike,
97
- node: isNode,
98
- htmlElement: isHtmlElement,
99
- defined: isDefined
100
- };
101
- var is = (arg) => {
102
- return (...args) => args.some((val) => TYPES[val](arg));
103
- };
51
+ var isObject, isString, isNumber, isFunction, isBoolean, isNull, isArray, isDate, isObjectLike, isDefined, isUndefined, TYPES, is;
52
+ var init_types = __esm({
53
+ "../utils/dist/esm/types.js"() {
54
+ init_node();
55
+ isObject = (arg) => {
56
+ if (arg === null) return false;
57
+ return typeof arg === "object" && arg.constructor === Object;
58
+ };
59
+ isString = (arg) => typeof arg === "string";
60
+ isNumber = (arg) => typeof arg === "number";
61
+ isFunction = (arg) => typeof arg === "function";
62
+ isBoolean = (arg) => arg === true || arg === false;
63
+ isNull = (arg) => arg === null;
64
+ isArray = (arg) => Array.isArray(arg);
65
+ isDate = (d) => d instanceof Date;
66
+ isObjectLike = (arg) => {
67
+ if (arg === null) return false;
68
+ return typeof arg === "object";
69
+ };
70
+ isDefined = (arg) => arg !== void 0;
71
+ isUndefined = (arg) => arg === void 0;
72
+ TYPES = {
73
+ boolean: isBoolean,
74
+ array: isArray,
75
+ object: isObject,
76
+ string: isString,
77
+ date: isDate,
78
+ number: isNumber,
79
+ null: isNull,
80
+ function: isFunction,
81
+ objectLike: isObjectLike,
82
+ node: isNode,
83
+ htmlElement: isHtmlElement,
84
+ defined: isDefined
85
+ };
86
+ is = (arg) => {
87
+ return (...args) => args.some((val) => TYPES[val](arg));
88
+ };
89
+ }
90
+ });
104
91
 
105
92
  // ../utils/dist/esm/array.js
106
- var removeFromArray = (arr, index) => {
107
- if (isString(index)) index = parseInt(index);
108
- if (isNumber(index)) {
109
- if (index < 0 || index >= arr.length || isNaN(index)) {
110
- throw new Error("Invalid index");
111
- }
112
- arr.splice(index, 1);
113
- } else {
114
- throw new Error("Invalid index");
93
+ var removeFromArray, unstackArrayOfObjects, addProtoToArray;
94
+ var init_array = __esm({
95
+ "../utils/dist/esm/array.js"() {
96
+ init_object();
97
+ init_types();
98
+ removeFromArray = (arr, index) => {
99
+ if (isString(index)) index = parseInt(index);
100
+ if (isNumber(index)) {
101
+ if (index < 0 || index >= arr.length || isNaN(index)) {
102
+ throw new Error("Invalid index");
103
+ }
104
+ arr.splice(index, 1);
105
+ } else {
106
+ throw new Error("Invalid index");
107
+ }
108
+ return arr;
109
+ };
110
+ unstackArrayOfObjects = (arr, exclude = []) => {
111
+ return arr.reduce(
112
+ (a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
113
+ {}
114
+ );
115
+ };
116
+ addProtoToArray = (state, proto) => {
117
+ for (const key in proto) {
118
+ Object.defineProperty(state, key, {
119
+ value: proto[key],
120
+ enumerable: false,
121
+ // Set this to true if you want the method to appear in for...in loops
122
+ configurable: true,
123
+ // Set this to true if you want to allow redefining/removing the property later
124
+ writable: true
125
+ // Set this to true if you want to allow changing the function later
126
+ });
127
+ }
128
+ };
115
129
  }
116
- return arr;
117
- };
118
- var unstackArrayOfObjects = (arr, exclude = []) => {
119
- return arr.reduce(
120
- (a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
121
- {}
122
- );
123
- };
124
- var addProtoToArray = (state, proto) => {
125
- for (const key in proto) {
126
- Object.defineProperty(state, key, {
127
- value: proto[key],
128
- enumerable: false,
129
- // Set this to true if you want the method to appear in for...in loops
130
- configurable: true,
131
- // Set this to true if you want to allow redefining/removing the property later
132
- writable: true
133
- // Set this to true if you want to allow changing the function later
134
- });
130
+ });
131
+
132
+ // ../utils/dist/esm/string.js
133
+ var init_string = __esm({
134
+ "../utils/dist/esm/string.js"() {
135
135
  }
136
- };
136
+ });
137
137
 
138
138
  // ../utils/dist/esm/keys.js
139
- var STATE_METHODS = /* @__PURE__ */ new Set([
140
- "update",
141
- "parse",
142
- "clean",
143
- "create",
144
- "destroy",
145
- "add",
146
- "toggle",
147
- "remove",
148
- "apply",
149
- "set",
150
- "reset",
151
- "replace",
152
- "quietReplace",
153
- "quietUpdate",
154
- "applyReplace",
155
- "applyFunction",
156
- "keys",
157
- "values",
158
- "ref",
159
- "rootUpdate",
160
- "parentUpdate",
161
- "parent",
162
- "__element",
163
- "__depends",
164
- "__ref",
165
- "__children",
166
- "root",
167
- "setByPath",
168
- "setPathCollection",
169
- "removeByPath",
170
- "removePathCollection",
171
- "getByPath"
172
- ]);
173
- var PROPS_METHODS = /* @__PURE__ */ new Set(["update", "__element"]);
174
- var METHODS = /* @__PURE__ */ new Set([
175
- "set",
176
- "reset",
177
- "update",
178
- "remove",
179
- "updateContent",
180
- "removeContent",
181
- "lookup",
182
- "lookdown",
183
- "lookdownAll",
184
- "getRef",
185
- "getPath",
186
- "setNodeStyles",
187
- "spotByPath",
188
- "keys",
189
- "parse",
190
- "setProps",
191
- "parseDeep",
192
- "variables",
193
- "if",
194
- "log",
195
- "verbose",
196
- "warn",
197
- "error",
198
- "call",
199
- "nextElement",
200
- "previousElement",
201
- "getRootState",
202
- "getRoot",
203
- "getRootData",
204
- "getRootContext",
205
- "getContext",
206
- "getChildren"
207
- ]);
208
- var METHODS_EXL = /* @__PURE__ */ new Set([
209
- "node",
210
- "context",
211
- "extends",
212
- "__element",
213
- "__ref",
214
- ...METHODS,
215
- ...STATE_METHODS,
216
- ...PROPS_METHODS
217
- ]);
139
+ var STATE_METHODS, PROPS_METHODS, METHODS, METHODS_EXL;
140
+ var init_keys = __esm({
141
+ "../utils/dist/esm/keys.js"() {
142
+ STATE_METHODS = /* @__PURE__ */ new Set([
143
+ "update",
144
+ "parse",
145
+ "clean",
146
+ "create",
147
+ "destroy",
148
+ "add",
149
+ "toggle",
150
+ "remove",
151
+ "apply",
152
+ "set",
153
+ "reset",
154
+ "replace",
155
+ "quietReplace",
156
+ "quietUpdate",
157
+ "applyReplace",
158
+ "applyFunction",
159
+ "keys",
160
+ "values",
161
+ "ref",
162
+ "rootUpdate",
163
+ "parentUpdate",
164
+ "parent",
165
+ "__element",
166
+ "__depends",
167
+ "__ref",
168
+ "__children",
169
+ "root",
170
+ "setByPath",
171
+ "setPathCollection",
172
+ "removeByPath",
173
+ "removePathCollection",
174
+ "getByPath"
175
+ ]);
176
+ PROPS_METHODS = /* @__PURE__ */ new Set(["update", "__element"]);
177
+ METHODS = /* @__PURE__ */ new Set([
178
+ "set",
179
+ "reset",
180
+ "update",
181
+ "remove",
182
+ "updateContent",
183
+ "removeContent",
184
+ "lookup",
185
+ "lookdown",
186
+ "lookdownAll",
187
+ "getRef",
188
+ "getPath",
189
+ "setNodeStyles",
190
+ "spotByPath",
191
+ "keys",
192
+ "parse",
193
+ "setProps",
194
+ "parseDeep",
195
+ "variables",
196
+ "if",
197
+ "log",
198
+ "verbose",
199
+ "warn",
200
+ "error",
201
+ "call",
202
+ "nextElement",
203
+ "previousElement",
204
+ "getRootState",
205
+ "getRoot",
206
+ "getRootData",
207
+ "getRootContext",
208
+ "getContext",
209
+ "getQuery",
210
+ "getDB",
211
+ "getChildren"
212
+ ]);
213
+ METHODS_EXL = /* @__PURE__ */ new Set([
214
+ "node",
215
+ "context",
216
+ "extends",
217
+ "__element",
218
+ "__ref",
219
+ ...METHODS,
220
+ ...STATE_METHODS,
221
+ ...PROPS_METHODS
222
+ ]);
223
+ }
224
+ });
218
225
 
219
226
  // ../utils/dist/esm/object.js
220
- var _startsWithDunder = (e) => e.charCodeAt(0) === 95 && e.charCodeAt(1) === 95;
221
- var exec = (param, element, state, context) => {
222
- if (isFunction(param)) {
223
- if (!element) return;
224
- const result = param.call(
225
- element,
226
- element,
227
- state || element.state,
228
- context || element.context
229
- );
230
- if (result && typeof result.then === "function") {
231
- let resolved;
232
- result.then((value) => {
233
- resolved = value;
234
- });
235
- return resolved;
236
- }
237
- return result;
238
- }
239
- return param;
240
- };
241
- var merge = (element, obj, excludeFrom = []) => {
242
- const useSet = excludeFrom instanceof Set;
243
- for (const e in obj) {
244
- if (!Object.prototype.hasOwnProperty.call(obj, e)) continue;
245
- if (_startsWithDunder(e)) continue;
246
- if (useSet ? excludeFrom.has(e) : excludeFrom.includes(e)) continue;
247
- if (element[e] === void 0) {
248
- element[e] = obj[e];
249
- }
250
- }
251
- return element;
252
- };
253
- var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
254
- const useSet = excludeFrom instanceof Set;
255
- for (const e in extend) {
256
- if (!Object.prototype.hasOwnProperty.call(extend, e)) continue;
257
- if (_startsWithDunder(e)) continue;
258
- if (useSet ? excludeFrom.has(e) : excludeFrom.includes(e)) continue;
259
- const elementProp = element[e];
260
- const extendProp = extend[e];
261
- if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
262
- deepMerge(elementProp, extendProp, excludeFrom);
263
- } else if (elementProp === void 0) {
264
- element[e] = extendProp;
265
- }
266
- }
267
- return element;
268
- };
269
- var deepClone = (obj, options = {}) => {
270
- const {
271
- exclude = [],
272
- cleanUndefined = false,
273
- cleanNull = false,
274
- window: targetWindow,
275
- visited = /* @__PURE__ */ new WeakMap(),
276
- handleExtends = false
277
- } = options;
278
- const contentWindow = targetWindow || window || globalThis;
279
- if (!isObjectLike(obj) || isDOMNode(obj)) {
280
- return obj;
281
- }
282
- if (visited.has(obj)) {
283
- return visited.get(obj);
284
- }
285
- const isArr = isArray(obj);
286
- const clone2 = isArr ? [] : {};
287
- visited.set(obj, clone2);
288
- const excludeSet = exclude instanceof Set ? exclude : exclude.length > 3 ? new Set(exclude) : null;
289
- for (const key in obj) {
290
- if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
291
- if (_startsWithDunder(key) || key === "__proto__") continue;
292
- if (excludeSet ? excludeSet.has(key) : exclude.includes(key)) continue;
293
- const value = obj[key];
294
- if (cleanUndefined && value === void 0) continue;
295
- if (cleanNull && value === null) continue;
296
- if (isDOMNode(value)) {
297
- clone2[key] = value;
298
- continue;
299
- }
300
- if (handleExtends && key === "extends" && isArray(value)) {
301
- clone2[key] = unstackArrayOfObjects(value, exclude);
302
- continue;
303
- }
304
- if (isFunction(value) && options.window) {
305
- clone2[key] = contentWindow.eval("(" + value.toString() + ")");
306
- continue;
307
- }
308
- if (isObjectLike(value)) {
309
- clone2[key] = deepClone(value, {
310
- ...options,
311
- visited
312
- });
313
- } else {
314
- clone2[key] = value;
315
- }
316
- }
317
- return clone2;
318
- };
319
- var overwriteShallow = (obj, params, excludeFrom = []) => {
320
- const useSet = excludeFrom instanceof Set;
321
- for (const e in params) {
322
- if (_startsWithDunder(e)) continue;
323
- if (useSet ? excludeFrom.has(e) : excludeFrom.includes(e)) continue;
324
- obj[e] = params[e];
227
+ var _startsWithDunder, merge, deepMerge, deepClone, overwriteShallow, overwriteDeep, removeFromObject, createNestedObject, removeNestedKeyByPath, setInObjectByPath, getInObjectByPath;
228
+ var init_object = __esm({
229
+ "../utils/dist/esm/object.js"() {
230
+ init_globals();
231
+ init_types();
232
+ init_array();
233
+ init_node();
234
+ init_keys();
235
+ _startsWithDunder = (e) => e.charCodeAt(0) === 95 && e.charCodeAt(1) === 95;
236
+ merge = (element, obj, excludeFrom = []) => {
237
+ const useSet = excludeFrom instanceof Set;
238
+ for (const e in obj) {
239
+ if (!Object.prototype.hasOwnProperty.call(obj, e)) continue;
240
+ if (_startsWithDunder(e)) continue;
241
+ if (useSet ? excludeFrom.has(e) : excludeFrom.includes(e)) continue;
242
+ if (element[e] === void 0) {
243
+ element[e] = obj[e];
244
+ }
245
+ }
246
+ return element;
247
+ };
248
+ deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
249
+ const useSet = excludeFrom instanceof Set;
250
+ for (const e in extend) {
251
+ if (!Object.prototype.hasOwnProperty.call(extend, e)) continue;
252
+ if (_startsWithDunder(e)) continue;
253
+ if (useSet ? excludeFrom.has(e) : excludeFrom.includes(e)) continue;
254
+ const elementProp = element[e];
255
+ const extendProp = extend[e];
256
+ if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
257
+ deepMerge(elementProp, extendProp, excludeFrom);
258
+ } else if (elementProp === void 0) {
259
+ element[e] = extendProp;
260
+ }
261
+ }
262
+ return element;
263
+ };
264
+ deepClone = (obj, options = {}) => {
265
+ const {
266
+ exclude = [],
267
+ cleanUndefined = false,
268
+ cleanNull = false,
269
+ window: targetWindow,
270
+ visited = /* @__PURE__ */ new WeakMap(),
271
+ handleExtends = false
272
+ } = options;
273
+ const contentWindow = targetWindow || window2 || globalThis;
274
+ if (!isObjectLike(obj) || isDOMNode(obj)) {
275
+ return obj;
276
+ }
277
+ if (visited.has(obj)) {
278
+ return visited.get(obj);
279
+ }
280
+ const isArr = isArray(obj);
281
+ const clone2 = isArr ? [] : {};
282
+ visited.set(obj, clone2);
283
+ const excludeSet = exclude instanceof Set ? exclude : exclude.length > 3 ? new Set(exclude) : null;
284
+ for (const key in obj) {
285
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
286
+ if (_startsWithDunder(key) || key === "__proto__") continue;
287
+ if (excludeSet ? excludeSet.has(key) : exclude.includes(key)) continue;
288
+ const value = obj[key];
289
+ if (cleanUndefined && value === void 0) continue;
290
+ if (cleanNull && value === null) continue;
291
+ if (isDOMNode(value)) {
292
+ clone2[key] = value;
293
+ continue;
294
+ }
295
+ if (handleExtends && key === "extends" && isArray(value)) {
296
+ clone2[key] = unstackArrayOfObjects(value, exclude);
297
+ continue;
298
+ }
299
+ if (isFunction(value) && options.window) {
300
+ clone2[key] = contentWindow.eval("(" + value.toString() + ")");
301
+ continue;
302
+ }
303
+ if (isObjectLike(value)) {
304
+ clone2[key] = deepClone(value, {
305
+ ...options,
306
+ visited
307
+ });
308
+ } else {
309
+ clone2[key] = value;
310
+ }
311
+ }
312
+ return clone2;
313
+ };
314
+ overwriteShallow = (obj, params, excludeFrom = []) => {
315
+ const useSet = excludeFrom instanceof Set;
316
+ for (const e in params) {
317
+ if (_startsWithDunder(e)) continue;
318
+ if (useSet ? excludeFrom.has(e) : excludeFrom.includes(e)) continue;
319
+ obj[e] = params[e];
320
+ }
321
+ return obj;
322
+ };
323
+ overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
324
+ if (!isObjectLike(obj) || !isObjectLike(params) || isDOMNode(obj) || isDOMNode(params)) {
325
+ return params;
326
+ }
327
+ if (visited.has(obj)) return visited.get(obj);
328
+ visited.set(obj, obj);
329
+ const excl = opts.exclude;
330
+ const exclSet = excl ? excl instanceof Set ? excl : new Set(excl) : null;
331
+ const forcedExclude = !opts.preventForce;
332
+ for (const e in params) {
333
+ if (!Object.prototype.hasOwnProperty.call(params, e)) continue;
334
+ if (exclSet && exclSet.has(e) || forcedExclude && _startsWithDunder(e)) continue;
335
+ const objProp = obj[e];
336
+ const paramsProp = params[e];
337
+ if (isDOMNode(paramsProp)) {
338
+ obj[e] = paramsProp;
339
+ } else if (isObjectLike(objProp) && isObjectLike(paramsProp)) {
340
+ obj[e] = overwriteDeep(objProp, paramsProp, opts, visited);
341
+ } else if (paramsProp !== void 0) {
342
+ obj[e] = paramsProp;
343
+ }
344
+ }
345
+ return obj;
346
+ };
347
+ removeFromObject = (obj, props) => {
348
+ if (props === void 0 || props === null) return obj;
349
+ if (is(props)("string", "number")) {
350
+ delete obj[props];
351
+ } else if (isArray(props)) {
352
+ for (let i = 0; i < props.length; i++) delete obj[props[i]];
353
+ } else {
354
+ throw new Error(
355
+ "Invalid input: props must be a string or an array of strings"
356
+ );
357
+ }
358
+ return obj;
359
+ };
360
+ createNestedObject = (arr, lastValue) => {
361
+ if (arr.length === 0) return lastValue;
362
+ const nestedObject = {};
363
+ let current = nestedObject;
364
+ for (let i = 0; i < arr.length; i++) {
365
+ if (i === arr.length - 1 && lastValue) {
366
+ current[arr[i]] = lastValue;
367
+ } else {
368
+ current[arr[i]] = {};
369
+ current = current[arr[i]];
370
+ }
371
+ }
372
+ return nestedObject;
373
+ };
374
+ removeNestedKeyByPath = (obj, path) => {
375
+ if (!Array.isArray(path)) {
376
+ throw new Error("Path must be an array.");
377
+ }
378
+ let current = obj;
379
+ for (let i = 0; i < path.length - 1; i++) {
380
+ if (current[path[i]] === void 0) return;
381
+ current = current[path[i]];
382
+ }
383
+ const lastKey = path[path.length - 1];
384
+ if (current && Object.prototype.hasOwnProperty.call(current, lastKey)) {
385
+ delete current[lastKey];
386
+ }
387
+ };
388
+ setInObjectByPath = (obj, path, value) => {
389
+ if (!Array.isArray(path)) {
390
+ throw new Error("Path must be an array.");
391
+ }
392
+ let current = obj;
393
+ for (let i = 0; i < path.length - 1; i++) {
394
+ if (!current[path[i]] || typeof current[path[i]] !== "object") {
395
+ current[path[i]] = {};
396
+ }
397
+ current = current[path[i]];
398
+ }
399
+ current[path[path.length - 1]] = value;
400
+ return obj;
401
+ };
402
+ getInObjectByPath = (obj, path) => {
403
+ if (!Array.isArray(path)) {
404
+ throw new Error("Path must be an array.");
405
+ }
406
+ let current = obj;
407
+ for (let i = 0; i < path.length; i++) {
408
+ if (current === void 0 || current === null) {
409
+ return void 0;
410
+ }
411
+ current = current[path[i]];
412
+ }
413
+ return current;
414
+ };
325
415
  }
326
- return obj;
327
- };
328
- var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
329
- if (!isObjectLike(obj) || !isObjectLike(params) || isDOMNode(obj) || isDOMNode(params)) {
330
- return params;
416
+ });
417
+
418
+ // ../utils/dist/esm/key.js
419
+ var init_key = __esm({
420
+ "../utils/dist/esm/key.js"() {
331
421
  }
332
- if (visited.has(obj)) return visited.get(obj);
333
- visited.set(obj, obj);
334
- const excl = opts.exclude;
335
- const exclSet = excl ? excl instanceof Set ? excl : new Set(excl) : null;
336
- const forcedExclude = !opts.preventForce;
337
- for (const e in params) {
338
- if (!Object.prototype.hasOwnProperty.call(params, e)) continue;
339
- if (exclSet && exclSet.has(e) || forcedExclude && _startsWithDunder(e)) continue;
340
- const objProp = obj[e];
341
- const paramsProp = params[e];
342
- if (isDOMNode(paramsProp)) {
343
- obj[e] = paramsProp;
344
- } else if (isObjectLike(objProp) && isObjectLike(paramsProp)) {
345
- obj[e] = overwriteDeep(objProp, paramsProp, opts, visited);
346
- } else if (paramsProp !== void 0) {
347
- obj[e] = paramsProp;
348
- }
422
+ });
423
+
424
+ // ../utils/dist/esm/env.js
425
+ var init_env = __esm({
426
+ "../utils/dist/esm/env.js"() {
349
427
  }
350
- return obj;
351
- };
352
- var removeFromObject = (obj, props) => {
353
- if (props === void 0 || props === null) return obj;
354
- if (is(props)("string", "number")) {
355
- delete obj[props];
356
- } else if (isArray(props)) {
357
- for (let i = 0; i < props.length; i++) delete obj[props[i]];
358
- } else {
359
- throw new Error(
360
- "Invalid input: props must be a string or an array of strings"
361
- );
428
+ });
429
+
430
+ // ../utils/dist/esm/function.js
431
+ var init_function = __esm({
432
+ "../utils/dist/esm/function.js"() {
362
433
  }
363
- return obj;
364
- };
365
- var createNestedObject = (arr, lastValue) => {
366
- if (arr.length === 0) return lastValue;
367
- const nestedObject = {};
368
- let current = nestedObject;
369
- for (let i = 0; i < arr.length; i++) {
370
- if (i === arr.length - 1 && lastValue) {
371
- current[arr[i]] = lastValue;
372
- } else {
373
- current[arr[i]] = {};
374
- current = current[arr[i]];
375
- }
434
+ });
435
+
436
+ // ../utils/dist/esm/if.js
437
+ var init_if = __esm({
438
+ "../utils/dist/esm/if.js"() {
376
439
  }
377
- return nestedObject;
378
- };
379
- var removeNestedKeyByPath = (obj, path) => {
380
- if (!Array.isArray(path)) {
381
- throw new Error("Path must be an array.");
440
+ });
441
+
442
+ // ../utils/dist/esm/log.js
443
+ var init_log = __esm({
444
+ "../utils/dist/esm/log.js"() {
382
445
  }
383
- let current = obj;
384
- for (let i = 0; i < path.length - 1; i++) {
385
- if (current[path[i]] === void 0) return;
386
- current = current[path[i]];
446
+ });
447
+
448
+ // ../utils/dist/esm/cookie.js
449
+ var isMobile;
450
+ var init_cookie = __esm({
451
+ "../utils/dist/esm/cookie.js"() {
452
+ isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
387
453
  }
388
- const lastKey = path[path.length - 1];
389
- if (current && Object.prototype.hasOwnProperty.call(current, lastKey)) {
390
- delete current[lastKey];
454
+ });
455
+
456
+ // ../utils/dist/esm/tags.js
457
+ var init_tags = __esm({
458
+ "../utils/dist/esm/tags.js"() {
391
459
  }
392
- };
393
- var setInObjectByPath = (obj, path, value) => {
394
- if (!Array.isArray(path)) {
395
- throw new Error("Path must be an array.");
460
+ });
461
+
462
+ // ../utils/dist/esm/extends.js
463
+ var init_extends = __esm({
464
+ "../utils/dist/esm/extends.js"() {
396
465
  }
397
- let current = obj;
398
- for (let i = 0; i < path.length - 1; i++) {
399
- if (!current[path[i]] || typeof current[path[i]] !== "object") {
400
- current[path[i]] = {};
401
- }
402
- current = current[path[i]];
466
+ });
467
+
468
+ // ../utils/dist/esm/component.js
469
+ var init_component = __esm({
470
+ "../utils/dist/esm/component.js"() {
403
471
  }
404
- current[path[path.length - 1]] = value;
405
- return obj;
406
- };
407
- var getInObjectByPath = (obj, path) => {
408
- if (!Array.isArray(path)) {
409
- throw new Error("Path must be an array.");
472
+ });
473
+
474
+ // ../utils/dist/esm/props.js
475
+ var init_props = __esm({
476
+ "../utils/dist/esm/props.js"() {
410
477
  }
411
- let current = obj;
412
- for (let i = 0; i < path.length; i++) {
413
- if (current === void 0 || current === null) {
414
- return void 0;
415
- }
416
- current = current[path[i]];
478
+ });
479
+
480
+ // ../utils/dist/esm/element.js
481
+ var init_element = __esm({
482
+ "../utils/dist/esm/element.js"() {
417
483
  }
418
- return current;
419
- };
484
+ });
420
485
 
421
486
  // ../utils/dist/esm/state.js
422
- var checkForStateTypes = (element) => {
423
- const { state: orig, props, __ref: ref } = element;
424
- const state = props?.state || orig;
425
- if (isFunction(state)) {
426
- ref.__state = state;
427
- return exec(state, element);
428
- } else if (is(state)("string", "number")) {
429
- ref.__state = state;
430
- return { value: state };
431
- } else if (state === true) {
432
- ref.__state = element.key;
433
- return {};
434
- } else if (state) {
435
- ref.__hasRootState = true;
436
- return state;
437
- } else {
438
- return false;
439
- }
440
- };
441
- var getRootStateInKey = (stateKey, parentState) => {
442
- if (!stateKey.includes("~/")) return;
443
- const arr = stateKey.split("~/");
444
- if (arr.length > 1) return parentState.root;
445
- };
446
- var getParentStateInKey = (stateKey, parentState) => {
447
- if (!stateKey.includes("../")) return;
448
- const arr = stateKey.split("../");
449
- const arrLength = arr.length - 1;
450
- for (let i = 0; i < arrLength; i++) {
451
- if (!parentState.parent) return null;
452
- parentState = parentState.parent;
453
- }
454
- return parentState;
455
- };
456
- var getChildStateInKey = (stateKey, parentState, options = {}) => {
457
- const arr = isString(stateKey) ? stateKey.split("/") : [stateKey];
458
- const arrLength = arr.length - 1;
459
- for (let i = 0; i < arrLength; i++) {
460
- const childKey = arr[i];
461
- const grandChildKey = arr[i + 1];
462
- if (childKey === "__proto__" || grandChildKey === "__proto__") return;
463
- let childInParent = parentState[childKey];
464
- if (!childInParent) childInParent = parentState[childKey] = {};
465
- if (!childInParent[grandChildKey]) childInParent[grandChildKey] = {};
466
- stateKey = grandChildKey;
467
- parentState = childInParent;
468
- }
469
- if (options.returnParent) return parentState;
470
- return parentState[stateKey];
471
- };
472
- var findInheritedState = (element, parent, options = {}) => {
473
- const ref = element.__ref;
474
- let stateKey = ref.__state;
475
- if (!checkIfInherits(element)) return;
476
- const rootState = getRootStateInKey(stateKey, parent.state);
477
- let parentState = parent.state;
478
- if (rootState) {
479
- parentState = rootState;
480
- stateKey = stateKey.replaceAll("~/", "");
481
- } else {
482
- const findGrandParentState = getParentStateInKey(stateKey, parent.state);
483
- if (findGrandParentState) {
484
- parentState = findGrandParentState;
485
- stateKey = stateKey.replaceAll("../", "");
486
- }
487
- }
488
- if (!parentState) return;
489
- return getChildStateInKey(stateKey, parentState, options);
490
- };
491
- var createInheritedState = (element, parent) => {
492
- const ref = element.__ref;
493
- const inheritedState = findInheritedState(element, parent);
494
- if (inheritedState === void 0) return element.state;
495
- if (is(inheritedState)("object", "array")) {
496
- return deepClone(inheritedState);
497
- } else if (is(inheritedState)("string", "number", "boolean")) {
498
- ref.__stateType = typeof inheritedState;
499
- return { value: inheritedState };
500
- }
501
- console.warn(ref.__state, "is not present. Replacing with", {});
502
- };
503
- var checkIfInherits = (element) => {
504
- const { __ref: ref } = element;
505
- const stateKey = ref?.__state;
506
- if (stateKey && is(stateKey)("number", "string", "boolean")) return true;
507
- return false;
508
- };
509
- var createNestedObjectByKeyPath = (path, value) => {
510
- if (!path) {
511
- return value || {};
512
- }
513
- const keys2 = path.split("/");
514
- const obj = {};
515
- let ref = obj;
516
- const lastIdx = keys2.length - 1;
517
- for (let i = 0; i <= lastIdx; i++) {
518
- ref[keys2[i]] = i === lastIdx ? value || {} : {};
519
- ref = ref[keys2[i]];
520
- }
521
- return obj;
522
- };
523
- var applyDependentState = (element, state) => {
524
- const { __element } = state;
525
- const origState = exec(__element?.state, element);
526
- if (!origState) return;
527
- const dependentState = deepClone(origState, STATE_METHODS);
528
- const newDepends = { [element.key]: dependentState };
529
- const __depends = isObject(origState.__depends) ? { ...origState.__depends, ...newDepends } : newDepends;
530
- if (Array.isArray(origState)) {
531
- addProtoToArray(origState, {
532
- ...Object.getPrototypeOf(origState),
533
- __depends
534
- });
535
- } else {
536
- Object.setPrototypeOf(origState, {
537
- ...Object.getPrototypeOf(origState),
538
- __depends
539
- });
487
+ var checkForStateTypes, getRootStateInKey, getParentStateInKey, getChildStateInKey, findInheritedState, createInheritedState, checkIfInherits, createNestedObjectByKeyPath, applyDependentState, overwriteState;
488
+ var init_state = __esm({
489
+ "../utils/dist/esm/state.js"() {
490
+ init_array();
491
+ init_keys();
492
+ init_object();
493
+ init_types();
494
+ checkForStateTypes = (element) => {
495
+ const { state: orig, props, __ref: ref } = element;
496
+ const state = props?.state || orig;
497
+ if (is(state)("string", "number")) {
498
+ ref.__state = state;
499
+ return { value: state };
500
+ } else if (state === true) {
501
+ ref.__state = element.key;
502
+ return {};
503
+ } else if (state) {
504
+ ref.__hasRootState = true;
505
+ return state;
506
+ } else {
507
+ return false;
508
+ }
509
+ };
510
+ getRootStateInKey = (stateKey, parentState) => {
511
+ if (!stateKey.includes("~/")) return;
512
+ const arr = stateKey.split("~/");
513
+ if (arr.length > 1) return parentState.root;
514
+ };
515
+ getParentStateInKey = (stateKey, parentState) => {
516
+ if (!stateKey.includes("../")) return;
517
+ const arr = stateKey.split("../");
518
+ const arrLength = arr.length - 1;
519
+ for (let i = 0; i < arrLength; i++) {
520
+ if (!parentState.parent) return null;
521
+ parentState = parentState.parent;
522
+ }
523
+ return parentState;
524
+ };
525
+ getChildStateInKey = (stateKey, parentState, options = {}) => {
526
+ const arr = isString(stateKey) ? stateKey.split("/") : [stateKey];
527
+ const arrLength = arr.length - 1;
528
+ for (let i = 0; i < arrLength; i++) {
529
+ const childKey = arr[i];
530
+ const grandChildKey = arr[i + 1];
531
+ if (childKey === "__proto__" || grandChildKey === "__proto__") return;
532
+ let childInParent = parentState[childKey];
533
+ if (!childInParent) childInParent = parentState[childKey] = {};
534
+ if (!childInParent[grandChildKey]) childInParent[grandChildKey] = {};
535
+ stateKey = grandChildKey;
536
+ parentState = childInParent;
537
+ }
538
+ if (options.returnParent) return parentState;
539
+ return parentState[stateKey];
540
+ };
541
+ findInheritedState = (element, parent, options = {}) => {
542
+ const ref = element.__ref;
543
+ let stateKey = ref.__state;
544
+ if (!checkIfInherits(element)) return;
545
+ const rootState = getRootStateInKey(stateKey, parent.state);
546
+ let parentState = parent.state;
547
+ if (rootState) {
548
+ parentState = rootState;
549
+ stateKey = stateKey.replaceAll("~/", "");
550
+ } else {
551
+ const findGrandParentState = getParentStateInKey(stateKey, parent.state);
552
+ if (findGrandParentState) {
553
+ parentState = findGrandParentState;
554
+ stateKey = stateKey.replaceAll("../", "");
555
+ }
556
+ }
557
+ if (!parentState) return;
558
+ return getChildStateInKey(stateKey, parentState, options);
559
+ };
560
+ createInheritedState = (element, parent) => {
561
+ const ref = element.__ref;
562
+ const inheritedState = findInheritedState(element, parent);
563
+ if (inheritedState === void 0) return element.state;
564
+ if (is(inheritedState)("object", "array")) {
565
+ return deepClone(inheritedState);
566
+ } else if (is(inheritedState)("string", "number", "boolean")) {
567
+ ref.__stateType = typeof inheritedState;
568
+ return { value: inheritedState };
569
+ }
570
+ console.warn(ref.__state, "is not present. Replacing with", {});
571
+ };
572
+ checkIfInherits = (element) => {
573
+ const { __ref: ref } = element;
574
+ const stateKey = ref?.__state;
575
+ if (stateKey && is(stateKey)("number", "string", "boolean")) return true;
576
+ return false;
577
+ };
578
+ createNestedObjectByKeyPath = (path, value) => {
579
+ if (!path) {
580
+ return value || {};
581
+ }
582
+ const keys2 = path.split("/");
583
+ const obj = {};
584
+ let ref = obj;
585
+ const lastIdx = keys2.length - 1;
586
+ for (let i = 0; i <= lastIdx; i++) {
587
+ ref[keys2[i]] = i === lastIdx ? value || {} : {};
588
+ ref = ref[keys2[i]];
589
+ }
590
+ return obj;
591
+ };
592
+ applyDependentState = (element, state) => {
593
+ const { __element } = state;
594
+ const origState = __element?.state;
595
+ if (!origState) return;
596
+ const dependentState = deepClone(origState, STATE_METHODS);
597
+ const newDepends = { [element.key]: dependentState };
598
+ const __depends = isObject(origState.__depends) ? { ...origState.__depends, ...newDepends } : newDepends;
599
+ if (Array.isArray(origState)) {
600
+ addProtoToArray(origState, {
601
+ ...Object.getPrototypeOf(origState),
602
+ __depends
603
+ });
604
+ } else {
605
+ Object.setPrototypeOf(origState, {
606
+ ...Object.getPrototypeOf(origState),
607
+ __depends
608
+ });
609
+ }
610
+ return dependentState;
611
+ };
612
+ overwriteState = (state, obj, options = {}) => {
613
+ const { overwrite } = options;
614
+ if (!overwrite) return;
615
+ const shallow = overwrite === "shallow";
616
+ const merge2 = overwrite === "merge";
617
+ if (merge2) {
618
+ deepMerge(state, obj, STATE_METHODS);
619
+ return;
620
+ }
621
+ const overwriteFunc = shallow ? overwriteShallow : overwriteDeep;
622
+ overwriteFunc(state, obj, STATE_METHODS);
623
+ };
540
624
  }
541
- return dependentState;
542
- };
543
- var overwriteState = (state, obj, options = {}) => {
544
- const { overwrite } = options;
545
- if (!overwrite) return;
546
- const shallow = overwrite === "shallow";
547
- const merge2 = overwrite === "merge";
548
- if (merge2) {
549
- deepMerge(state, obj, STATE_METHODS);
550
- return;
625
+ });
626
+
627
+ // ../utils/dist/esm/scope.js
628
+ var init_scope = __esm({
629
+ "../utils/dist/esm/scope.js"() {
551
630
  }
552
- const overwriteFunc = shallow ? overwriteShallow : overwriteDeep;
553
- overwriteFunc(state, obj, STATE_METHODS);
554
- };
631
+ });
555
632
 
556
633
  // ../utils/dist/esm/triggerEvent.js
557
- var getOnOrPropsEvent = (param, element) => {
558
- const onEvent = element.on?.[param];
559
- if (onEvent) return onEvent;
560
- const props = element.props;
561
- if (!props) return;
562
- const propKey = "on" + param.charAt(0).toUpperCase() + param.slice(1);
563
- return props[propKey];
564
- };
565
- var applyEvent = (param, element, state, context, options) => {
566
- if (!isFunction(param)) return;
567
- try {
568
- const result = param.call(
569
- element,
570
- element,
571
- state || element.state,
572
- context || element.context,
573
- options
574
- );
575
- if (result && typeof result.then === "function") {
576
- result.catch((err) => {
634
+ var getOnOrPropsEvent, applyEvent, triggerEventOn, applyEventUpdate, triggerEventOnUpdate;
635
+ var init_triggerEvent = __esm({
636
+ "../utils/dist/esm/triggerEvent.js"() {
637
+ init_types();
638
+ getOnOrPropsEvent = (param, element) => {
639
+ const onEvent = element.on?.[param];
640
+ if (onEvent) return onEvent;
641
+ const props = element.props;
642
+ if (!props) return;
643
+ const propKey = "on" + param.charAt(0).toUpperCase() + param.slice(1);
644
+ return props[propKey];
645
+ };
646
+ applyEvent = (param, element, state, context, options) => {
647
+ if (!isFunction(param)) return;
648
+ try {
649
+ const result = param.call(
650
+ element,
651
+ element,
652
+ state || element.state,
653
+ context || element.context,
654
+ options
655
+ );
656
+ if (result && typeof result.then === "function") {
657
+ result.catch((err) => {
658
+ element.error = err;
659
+ console.error("[DomQL] Async event error:", err);
660
+ });
661
+ }
662
+ return result;
663
+ } catch (err) {
577
664
  element.error = err;
578
- console.error("[DomQL] Async event error:", err);
579
- });
580
- }
581
- return result;
582
- } catch (err) {
583
- element.error = err;
584
- console.error("[DomQL] Event handler error:", err);
585
- if (element.context?.strictMode) throw err;
665
+ console.error("[DomQL] Event handler error:", err);
666
+ if (element.context?.strictMode) throw err;
667
+ }
668
+ };
669
+ triggerEventOn = (param, element, options) => {
670
+ if (!element) {
671
+ throw new Error("Element is required");
672
+ }
673
+ const appliedFunction = getOnOrPropsEvent(param, element);
674
+ if (appliedFunction) {
675
+ const { state, context } = element;
676
+ return applyEvent(appliedFunction, element, state, context, options);
677
+ }
678
+ };
679
+ applyEventUpdate = (param, updatedObj, element, state, context, options) => {
680
+ if (!isFunction(param)) return;
681
+ try {
682
+ const result = param.call(
683
+ element,
684
+ updatedObj,
685
+ element,
686
+ state || element.state,
687
+ context || element.context,
688
+ options
689
+ );
690
+ if (result && typeof result.then === "function") {
691
+ result.catch((err) => {
692
+ element.error = err;
693
+ console.error("[DomQL] Async event update error:", err);
694
+ });
695
+ }
696
+ return result;
697
+ } catch (err) {
698
+ element.error = err;
699
+ console.error("[DomQL] Event update error:", err);
700
+ if (element.context?.strictMode) throw err;
701
+ }
702
+ };
703
+ triggerEventOnUpdate = (param, updatedObj, element, options) => {
704
+ const appliedFunction = getOnOrPropsEvent(param, element);
705
+ if (appliedFunction) {
706
+ const { state, context } = element;
707
+ return applyEventUpdate(
708
+ appliedFunction,
709
+ updatedObj,
710
+ element,
711
+ state,
712
+ context,
713
+ options
714
+ );
715
+ }
716
+ };
586
717
  }
587
- };
588
- var triggerEventOn = (param, element, options) => {
589
- if (!element) {
590
- throw new Error("Element is required");
718
+ });
719
+
720
+ // ../utils/dist/esm/cache.js
721
+ var init_cache = __esm({
722
+ "../utils/dist/esm/cache.js"() {
591
723
  }
592
- const appliedFunction = getOnOrPropsEvent(param, element);
593
- if (appliedFunction) {
594
- const { state, context } = element;
595
- return applyEvent(appliedFunction, element, state, context, options);
724
+ });
725
+
726
+ // ../utils/dist/esm/methods.js
727
+ var init_methods = __esm({
728
+ "../utils/dist/esm/methods.js"() {
596
729
  }
597
- };
598
- var applyEventUpdate = (param, updatedObj, element, state, context, options) => {
599
- if (!isFunction(param)) return;
600
- try {
601
- const result = param.call(
602
- element,
603
- updatedObj,
604
- element,
605
- state || element.state,
606
- context || element.context,
607
- options
608
- );
609
- if (result && typeof result.then === "function") {
610
- result.catch((err) => {
611
- element.error = err;
612
- console.error("[DomQL] Async event update error:", err);
613
- });
614
- }
615
- return result;
616
- } catch (err) {
617
- element.error = err;
618
- console.error("[DomQL] Event update error:", err);
619
- if (element.context?.strictMode) throw err;
730
+ });
731
+
732
+ // ../utils/dist/esm/update.js
733
+ var init_update = __esm({
734
+ "../utils/dist/esm/update.js"() {
620
735
  }
621
- };
622
- var triggerEventOnUpdate = (param, updatedObj, element, options) => {
623
- const appliedFunction = getOnOrPropsEvent(param, element);
624
- if (appliedFunction) {
625
- const { state, context } = element;
626
- return applyEventUpdate(
627
- appliedFunction,
628
- updatedObj,
629
- element,
630
- state,
631
- context,
632
- options
633
- );
736
+ });
737
+
738
+ // ../utils/dist/esm/index.js
739
+ var init_esm = __esm({
740
+ "../utils/dist/esm/index.js"() {
741
+ init_key();
742
+ init_env();
743
+ init_types();
744
+ init_object();
745
+ init_function();
746
+ init_array();
747
+ init_node();
748
+ init_if();
749
+ init_log();
750
+ init_string();
751
+ init_globals();
752
+ init_cookie();
753
+ init_tags();
754
+ init_component();
755
+ init_props();
756
+ init_extends();
757
+ init_element();
758
+ init_state();
759
+ init_keys();
760
+ init_scope();
761
+ init_methods();
762
+ init_cache();
763
+ init_update();
764
+ init_triggerEvent();
634
765
  }
635
- };
766
+ });
767
+
768
+ // index.js
769
+ var index_exports = {};
770
+ __export(index_exports, {
771
+ add: () => add,
772
+ apply: () => apply,
773
+ applyFunction: () => applyFunction,
774
+ applyInitialState: () => applyInitialState,
775
+ applyReplace: () => applyReplace,
776
+ applyStateMethods: () => applyStateMethods,
777
+ clean: () => clean,
778
+ createState: () => createState,
779
+ destroy: () => destroy,
780
+ getByPath: () => getByPath,
781
+ hoistStateUpdate: () => hoistStateUpdate,
782
+ keys: () => keys,
783
+ parentUpdate: () => parentUpdate,
784
+ parse: () => parse,
785
+ quietReplace: () => quietReplace,
786
+ quietUpdate: () => quietUpdate,
787
+ remove: () => remove,
788
+ removeByPath: () => removeByPath,
789
+ removePathCollection: () => removePathCollection,
790
+ replace: () => replace,
791
+ reset: () => reset,
792
+ rootUpdate: () => rootUpdate,
793
+ set: () => set,
794
+ setByPath: () => setByPath,
795
+ setPathCollection: () => setPathCollection,
796
+ toggle: () => toggle,
797
+ updateState: () => updateState,
798
+ values: () => values
799
+ });
800
+
801
+ // create.js
802
+ init_esm();
803
+
804
+ // methods.js
805
+ init_esm();
636
806
 
637
807
  // ../../plugins/report/index.js
638
808
  var ERRORS_REGISTRY = {
@@ -701,12 +871,12 @@ ${element}` : "";
701
871
  };
702
872
 
703
873
  // updateState.js
874
+ init_esm();
704
875
  var STATE_UPDATE_OPTIONS = {
705
876
  overwrite: true,
706
877
  preventHoistElementUpdate: false,
707
878
  updateByState: true,
708
- isHoisted: true,
709
- execStateFunction: true
879
+ isHoisted: true
710
880
  };
711
881
  var updateState = function(obj, options = STATE_UPDATE_OPTIONS) {
712
882
  const state = this;
@@ -753,15 +923,15 @@ ${element}` : "";
753
923
  const passedValue = isStringState ? state.value : obj;
754
924
  const findRootState = getRootStateInKey(stateKey, parent.state);
755
925
  const findGrandParentState = getParentStateInKey(stateKey, parent.state);
756
- const changesValue = createNestedObjectByKeyPath(stateKey, passedValue);
926
+ const cleanKey = stateKey.replaceAll("~/", "").replaceAll("../", "");
927
+ const changesValue = createNestedObjectByKeyPath(cleanKey, passedValue);
757
928
  const targetParent = findRootState || findGrandParentState || parent.state;
758
929
  if (options.replace) overwriteDeep(targetParent, changesValue || value);
759
930
  targetParent.update(changesValue, {
760
- execStateFunction: false,
931
+ ...options,
761
932
  isHoisted: true,
762
933
  preventUpdate: options.preventHoistElementUpdate,
763
- overwrite: !options.replace,
764
- ...options
934
+ overwrite: !options.replace
765
935
  });
766
936
  const hasNotUpdated = options.preventUpdate !== true || !options.preventHoistElementUpdate;
767
937
  if (!options.preventStateUpdateListener && hasNotUpdated) {
@@ -1065,3 +1235,4 @@ ${element}` : "";
1065
1235
  };
1066
1236
  return __toCommonJS(index_exports);
1067
1237
  })();
1238
+ // @preserve-env