attaform 0.27.6 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/dist/abstract.d.mts +5 -4
  2. package/dist/abstract.mjs +4 -3
  3. package/dist/chunks/fingerprint.mjs +1 -2
  4. package/dist/chunks/fingerprint2.mjs +2 -3
  5. package/dist/dev/abstract.mjs +4 -0
  6. package/dist/{chunks → dev/chunks}/dev-key-collision-warnings.mjs +0 -1
  7. package/dist/{chunks → dev/chunks}/devtools.mjs +5 -6
  8. package/dist/{chunks/fingerprint.cjs → dev/chunks/fingerprint.mjs} +7 -10
  9. package/dist/{chunks/fingerprint2.cjs → dev/chunks/fingerprint2.mjs} +32 -35
  10. package/dist/dev/directive.mjs +1 -0
  11. package/dist/dev/history.mjs +89 -0
  12. package/dist/dev/index.mjs +5 -0
  13. package/dist/dev/runtime/plugins/attaform.mjs +40 -0
  14. package/dist/dev/shared/attaform-dev.A-TpJW0B.mjs +207 -0
  15. package/dist/dev/shared/attaform-dev.BO-71R54.mjs +820 -0
  16. package/dist/{shared/attaform.D6tk90Rc.cjs → dev/shared/attaform-dev.BgM6FdtA.mjs} +324 -73
  17. package/dist/dev/shared/attaform-dev.ButTkwHd.mjs +375 -0
  18. package/dist/{shared/attaform.BJGA_UOS.mjs → dev/shared/attaform-dev.BxfsuwBR.mjs} +8 -1
  19. package/dist/{shared/attaform.nMaz2C5P.mjs → dev/shared/attaform-dev.D8aoKb89.mjs} +190 -400
  20. package/dist/dev/shared/attaform-dev.DD5m2W51.mjs +220 -0
  21. package/dist/{shared/attaform.CKH2lGdL.mjs → dev/shared/attaform-dev.DHuydLAC.mjs} +3867 -4731
  22. package/dist/{shared/attaform.DYEr28Pt.mjs → dev/shared/attaform-dev.DrzObAZo.mjs} +6 -7
  23. package/dist/{shared/attaform.B1ZYt2Li.mjs → dev/shared/attaform-dev.q6UutkCx.mjs} +274 -672
  24. package/dist/dev/zod-v3.mjs +17 -0
  25. package/dist/dev/zod-v4.mjs +16 -0
  26. package/dist/dev/zod.mjs +5 -0
  27. package/dist/directive.d.mts +20 -0
  28. package/dist/directive.mjs +1 -0
  29. package/dist/esbuild.mjs +0 -1
  30. package/dist/history.d.mts +59 -0
  31. package/dist/history.mjs +89 -0
  32. package/dist/index.d.mts +14 -6
  33. package/dist/index.mjs +5 -4
  34. package/dist/nuxt.d.mts +10 -10
  35. package/dist/nuxt.mjs +5 -2
  36. package/dist/rollup.mjs +0 -1
  37. package/dist/rspack.d.mts +6 -1
  38. package/dist/rspack.mjs +0 -1
  39. package/dist/runtime/components/AttaformDevtoolsPanel.vue +9 -8
  40. package/dist/runtime/plugins/attaform.mjs +1 -2
  41. package/dist/shared/{attaform.CoR4mWfv.mjs → attaform.B0dKL8ST.mjs} +309 -46
  42. package/dist/shared/{attaform.Cs2Rbdlo.mjs → attaform.BK0cgu2K.mjs} +123 -140
  43. package/dist/shared/{attaform.B9Wyhfro.cjs → attaform.BndjUUYX.mjs} +11 -16
  44. package/dist/shared/{attaform.CQN9R62B.cjs → attaform.BxfsuwBR.mjs} +9 -4
  45. package/dist/shared/attaform.C2MVyuxC.mjs +811 -0
  46. package/dist/shared/{attaform.Fp3sCrVs.d.ts → attaform.CIWLMY-R.d.mts} +2 -2
  47. package/dist/shared/attaform.CZMAYwSK.mjs +6383 -0
  48. package/dist/shared/attaform.CZYt_5N_.mjs +207 -0
  49. package/dist/shared/{attaform.DniawQLP.d.cts → attaform.CsoeRi3P.d.mts} +490 -98
  50. package/dist/shared/attaform.Cvao8bW5.mjs +358 -0
  51. package/dist/shared/attaform.D0x-qSXm.mjs +197 -0
  52. package/dist/shared/{attaform.D8kliaKw.cjs → attaform.D1fnTifF.mjs} +279 -692
  53. package/dist/shared/{attaform.CHlJLAiv.d.mts → attaform.DDtqHYv1.d.mts} +155 -184
  54. package/dist/shared/{attaform.Biytrv0-.cjs → attaform.DffRL5pP.mjs} +215 -547
  55. package/dist/shared/attaform.DhnPb6nK.mjs +0 -1
  56. package/dist/shared/attaform.KvlEedlF.mjs +0 -1
  57. package/dist/shared/attaform.axHXVQO7.d.mts +44 -0
  58. package/dist/shared/attaform.v0fQtWyA.mjs +0 -1
  59. package/dist/transforms.d.mts +0 -22
  60. package/dist/transforms.mjs +1 -2
  61. package/dist/vite.d.mts +30 -9
  62. package/dist/vite.mjs +27 -4
  63. package/dist/webpack.d.mts +6 -1
  64. package/dist/webpack.mjs +0 -1
  65. package/dist/zod-v3.d.mts +13 -6
  66. package/dist/zod-v3.mjs +17 -4
  67. package/dist/zod-v4.d.mts +19 -26
  68. package/dist/zod-v4.mjs +16 -4
  69. package/dist/zod.d.mts +4 -3
  70. package/dist/zod.mjs +5 -4
  71. package/package.json +38 -20
  72. package/skills/attaform/SKILL.md +6 -2
  73. package/skills/attaform/references/custom-components.md +7 -2
  74. package/skills/attaform/references/errors.md +8 -3
  75. package/skills/attaform/references/saving.md +77 -0
  76. package/skills/attaform/references/wizards.md +10 -8
  77. package/dist/abstract.cjs +0 -48
  78. package/dist/abstract.cjs.map +0 -1
  79. package/dist/abstract.d.cts +0 -42
  80. package/dist/abstract.d.ts +0 -42
  81. package/dist/abstract.mjs.map +0 -1
  82. package/dist/chunks/dev-key-collision-warnings.cjs +0 -25
  83. package/dist/chunks/dev-key-collision-warnings.cjs.map +0 -1
  84. package/dist/chunks/dev-key-collision-warnings.mjs.map +0 -1
  85. package/dist/chunks/devtools.cjs +0 -157
  86. package/dist/chunks/devtools.cjs.map +0 -1
  87. package/dist/chunks/devtools.mjs.map +0 -1
  88. package/dist/chunks/fingerprint.cjs.map +0 -1
  89. package/dist/chunks/fingerprint.mjs.map +0 -1
  90. package/dist/chunks/fingerprint2.cjs.map +0 -1
  91. package/dist/chunks/fingerprint2.mjs.map +0 -1
  92. package/dist/esbuild.cjs +0 -28
  93. package/dist/esbuild.cjs.map +0 -1
  94. package/dist/esbuild.d.cts +0 -56
  95. package/dist/esbuild.d.ts +0 -56
  96. package/dist/esbuild.mjs.map +0 -1
  97. package/dist/index.cjs +0 -51
  98. package/dist/index.cjs.map +0 -1
  99. package/dist/index.d.cts +0 -249
  100. package/dist/index.d.ts +0 -249
  101. package/dist/index.mjs.map +0 -1
  102. package/dist/nuxt.cjs +0 -84
  103. package/dist/nuxt.cjs.map +0 -1
  104. package/dist/nuxt.d.cts +0 -66
  105. package/dist/nuxt.d.ts +0 -66
  106. package/dist/nuxt.mjs.map +0 -1
  107. package/dist/rollup.cjs +0 -24
  108. package/dist/rollup.cjs.map +0 -1
  109. package/dist/rollup.d.cts +0 -35
  110. package/dist/rollup.d.ts +0 -35
  111. package/dist/rollup.mjs.map +0 -1
  112. package/dist/rspack.cjs +0 -10
  113. package/dist/rspack.cjs.map +0 -1
  114. package/dist/rspack.d.cts +0 -40
  115. package/dist/rspack.d.ts +0 -40
  116. package/dist/rspack.mjs.map +0 -1
  117. package/dist/runtime/components/AttaformDevtoolsPanel.vue.d.ts +0 -7
  118. package/dist/runtime/components/DevtoolsValueTree.vue.d.ts +0 -35
  119. package/dist/runtime/plugins/attaform.cjs +0 -43
  120. package/dist/runtime/plugins/attaform.cjs.map +0 -1
  121. package/dist/runtime/plugins/attaform.d.cts +0 -5
  122. package/dist/runtime/plugins/attaform.d.ts +0 -5
  123. package/dist/runtime/plugins/attaform.mjs.map +0 -1
  124. package/dist/shared/attaform.B1ZYt2Li.mjs.map +0 -1
  125. package/dist/shared/attaform.B9Wyhfro.cjs.map +0 -1
  126. package/dist/shared/attaform.BGDV42hI.d.cts +0 -232
  127. package/dist/shared/attaform.BJGA_UOS.mjs.map +0 -1
  128. package/dist/shared/attaform.Biytrv0-.cjs.map +0 -1
  129. package/dist/shared/attaform.Bn0IzhD_.cjs +0 -800
  130. package/dist/shared/attaform.Bn0IzhD_.cjs.map +0 -1
  131. package/dist/shared/attaform.C9fPTxjB.d.cts +0 -41
  132. package/dist/shared/attaform.C9fPTxjB.d.ts +0 -41
  133. package/dist/shared/attaform.CKH2lGdL.mjs.map +0 -1
  134. package/dist/shared/attaform.CQN9R62B.cjs.map +0 -1
  135. package/dist/shared/attaform.CoR4mWfv.mjs.map +0 -1
  136. package/dist/shared/attaform.Cs2Rbdlo.mjs.map +0 -1
  137. package/dist/shared/attaform.D6tk90Rc.cjs.map +0 -1
  138. package/dist/shared/attaform.D8kliaKw.cjs.map +0 -1
  139. package/dist/shared/attaform.DLknk9nF.d.mts +0 -232
  140. package/dist/shared/attaform.DMxM2kol.mjs +0 -1275
  141. package/dist/shared/attaform.DMxM2kol.mjs.map +0 -1
  142. package/dist/shared/attaform.DRUT703x.d.cts +0 -56
  143. package/dist/shared/attaform.DRUT703x.d.ts +0 -56
  144. package/dist/shared/attaform.DYEr28Pt.mjs.map +0 -1
  145. package/dist/shared/attaform.DdQN7sgN.cjs +0 -1302
  146. package/dist/shared/attaform.DdQN7sgN.cjs.map +0 -1
  147. package/dist/shared/attaform.DhnPb6nK.mjs.map +0 -1
  148. package/dist/shared/attaform.DniawQLP.d.mts +0 -4763
  149. package/dist/shared/attaform.DniawQLP.d.ts +0 -4763
  150. package/dist/shared/attaform.DoQm_Vkd.cjs +0 -58
  151. package/dist/shared/attaform.DoQm_Vkd.cjs.map +0 -1
  152. package/dist/shared/attaform.DrvMscNX.cjs +0 -7697
  153. package/dist/shared/attaform.DrvMscNX.cjs.map +0 -1
  154. package/dist/shared/attaform.F2Q8iv38.d.ts +0 -2494
  155. package/dist/shared/attaform.FmqKO1Ex.d.cts +0 -2494
  156. package/dist/shared/attaform.KvlEedlF.mjs.map +0 -1
  157. package/dist/shared/attaform.RaTzp1WF.cjs +0 -26
  158. package/dist/shared/attaform.RaTzp1WF.cjs.map +0 -1
  159. package/dist/shared/attaform.nMaz2C5P.mjs.map +0 -1
  160. package/dist/shared/attaform.v0fQtWyA.mjs.map +0 -1
  161. package/dist/shared/attaform.yUrz7C2z.cjs +0 -29
  162. package/dist/shared/attaform.yUrz7C2z.cjs.map +0 -1
  163. package/dist/transforms.cjs +0 -12
  164. package/dist/transforms.cjs.map +0 -1
  165. package/dist/transforms.d.cts +0 -73
  166. package/dist/transforms.d.ts +0 -73
  167. package/dist/transforms.mjs.map +0 -1
  168. package/dist/vite.cjs +0 -363
  169. package/dist/vite.cjs.map +0 -1
  170. package/dist/vite.d.cts +0 -133
  171. package/dist/vite.d.ts +0 -133
  172. package/dist/vite.mjs.map +0 -1
  173. package/dist/webpack.cjs +0 -10
  174. package/dist/webpack.cjs.map +0 -1
  175. package/dist/webpack.d.cts +0 -37
  176. package/dist/webpack.d.ts +0 -37
  177. package/dist/webpack.mjs.map +0 -1
  178. package/dist/zod-v3.cjs +0 -53
  179. package/dist/zod-v3.cjs.map +0 -1
  180. package/dist/zod-v3.d.cts +0 -246
  181. package/dist/zod-v3.d.ts +0 -246
  182. package/dist/zod-v3.mjs.map +0 -1
  183. package/dist/zod-v4.cjs +0 -55
  184. package/dist/zod-v4.cjs.map +0 -1
  185. package/dist/zod-v4.d.cts +0 -172
  186. package/dist/zod-v4.d.ts +0 -172
  187. package/dist/zod-v4.mjs.map +0 -1
  188. package/dist/zod.cjs +0 -51
  189. package/dist/zod.cjs.map +0 -1
  190. package/dist/zod.d.cts +0 -7
  191. package/dist/zod.d.ts +0 -7
  192. package/dist/zod.mjs.map +0 -1
@@ -0,0 +1,375 @@
1
+ import { m as mapSegmentKeys, f as pathsEqual, i as isPathPrefix } from './attaform-dev.A-TpJW0B.mjs';
2
+
3
+ const DEFAULT_FIELD_VALIDATION_DEBOUNCE_MS = 0;
4
+ const DEFAULT_HISTORY_MAX_SNAPSHOTS = 128;
5
+ const RESERVED_KEY_PREFIX = "__atta:";
6
+ const ANONYMOUS_FORM_KEY_PREFIX = `${RESERVED_KEY_PREFIX}anon:`;
7
+ const ANONYMOUS_WIZARD_KEY_PREFIX = `${RESERVED_KEY_PREFIX}anon-wizard:`;
8
+ const DEFAULT_MAX_RECURSION_DEPTH = 64;
9
+ function normalizeNumericOption(config) {
10
+ const { value, source, allowInfinity, min, defaultValue } = config;
11
+ if (allowInfinity && value === Infinity) return Infinity;
12
+ if (typeof value !== "number" || Number.isNaN(value) || value === Infinity || value === -Infinity) {
13
+ {
14
+ const acceptedDescription = allowInfinity ? "a non-negative integer or Infinity" : "a non-negative finite integer";
15
+ console.warn(
16
+ `[attaform] ${source} must be ${acceptedDescription}; got ${String(value)}. Falling back to ${String(defaultValue)}.`
17
+ );
18
+ }
19
+ return defaultValue;
20
+ }
21
+ return Math.max(min, Math.floor(value));
22
+ }
23
+ function pickDefined(bag) {
24
+ const out = {};
25
+ for (const key of Object.keys(bag)) {
26
+ if (bag[key] !== void 0) out[key] = bag[key];
27
+ }
28
+ return out;
29
+ }
30
+
31
+ const reported = /* @__PURE__ */ new Set() ;
32
+ function report(site, err) {
33
+ if (reported === null || reported.has(site)) return;
34
+ reported.add(site);
35
+ const advice = site === "default-factory" ? "a `.default(() => ...)` factory threw. Attaform used `undefined` for that field's initial value." : site === "catch-factory" ? "a `.catch(() => ...)` fallback threw. Attaform used `undefined` for that value." : "a `z.lazy(() => ...)` factory threw. Attaform stopped descending at that node, so paths below it will not resolve.";
36
+ console.error(
37
+ `[attaform] ${advice} A function inside your schema must not throw; wrap your own try/catch if the failure is recoverable. Original error:`,
38
+ err
39
+ );
40
+ }
41
+ function callConsumerSchemaFn(fn, fallback, site) {
42
+ try {
43
+ return fn();
44
+ } catch (err) {
45
+ report(site, err);
46
+ return fallback;
47
+ }
48
+ }
49
+ function readConsumerProp(obj, key) {
50
+ try {
51
+ return obj[key];
52
+ } catch {
53
+ return void 0;
54
+ }
55
+ }
56
+ function consumerKeys(obj) {
57
+ try {
58
+ return Object.keys(obj);
59
+ } catch {
60
+ return [];
61
+ }
62
+ }
63
+ function readConsumerIndex(arr, i) {
64
+ try {
65
+ return arr[i];
66
+ } catch {
67
+ return void 0;
68
+ }
69
+ }
70
+ function consumerSymbolKeys(obj) {
71
+ try {
72
+ return Object.getOwnPropertySymbols(obj);
73
+ } catch {
74
+ return [];
75
+ }
76
+ }
77
+ function consumerHas(obj, key) {
78
+ try {
79
+ return key in obj;
80
+ } catch {
81
+ return false;
82
+ }
83
+ }
84
+
85
+ function safeAssign(target, key, value) {
86
+ if (key === "__proto__") {
87
+ Object.defineProperty(target, key, {
88
+ value,
89
+ writable: true,
90
+ enumerable: true,
91
+ configurable: true
92
+ });
93
+ return;
94
+ }
95
+ target[key] = value;
96
+ }
97
+ function isShadowedKey(key) {
98
+ return key in Object.prototype;
99
+ }
100
+ function safeOwnRead(target, key) {
101
+ if (isShadowedKey(key)) {
102
+ const desc = Object.getOwnPropertyDescriptor(target, key);
103
+ if (desc === void 0) return void 0;
104
+ return "value" in desc ? desc.value : readConsumerProp(target, key);
105
+ }
106
+ return readConsumerProp(target, key);
107
+ }
108
+ function safeOwnHas(target, key) {
109
+ try {
110
+ return Object.prototype.hasOwnProperty.call(target, key);
111
+ } catch {
112
+ return false;
113
+ }
114
+ }
115
+ function spreadConsumerRecord(src) {
116
+ try {
117
+ return { ...src };
118
+ } catch {
119
+ const out = {};
120
+ for (const key of Object.keys(src)) {
121
+ safeAssign(out, key, readConsumerProp(src, key));
122
+ }
123
+ return out;
124
+ }
125
+ }
126
+ function copyConsumerArray(src) {
127
+ try {
128
+ return src.slice();
129
+ } catch {
130
+ const out = new Array(src.length);
131
+ for (let i = 0; i < src.length; i++) out[i] = readConsumerIndex(src, i);
132
+ return out;
133
+ }
134
+ }
135
+
136
+ function isDescendable(value) {
137
+ if (value === null || typeof value !== "object") return false;
138
+ if (Array.isArray(value)) return true;
139
+ if (value instanceof Map) return mapSegmentKeys(value) !== null;
140
+ const proto = Object.getPrototypeOf(value);
141
+ return proto === null || proto === Object.prototype;
142
+ }
143
+ function appendSegment(prefix, segment) {
144
+ const next = new Array(prefix.length + 1);
145
+ for (let i = 0; i < prefix.length; i++) {
146
+ const s = prefix[i];
147
+ next[i] = s;
148
+ }
149
+ next[prefix.length] = segment;
150
+ return next;
151
+ }
152
+ function diffAndApply(oldValue, newValue, prefix, visit) {
153
+ if (Object.is(oldValue, newValue)) return;
154
+ const oldIsDescendable = isDescendable(oldValue);
155
+ const newIsDescendable = isDescendable(newValue);
156
+ if (oldValue === void 0 && newIsDescendable) {
157
+ walkNewDescendable(newValue, prefix, visit);
158
+ return;
159
+ }
160
+ if (oldIsDescendable && newValue === void 0) {
161
+ walkOldDescendable(oldValue, prefix, visit);
162
+ return;
163
+ }
164
+ if (oldIsDescendable && newIsDescendable) {
165
+ const oldIsMap = oldValue instanceof Map;
166
+ const newIsMap = newValue instanceof Map;
167
+ if (oldIsMap && newIsMap) {
168
+ diffMapsLockstep(oldValue, newValue, prefix, visit);
169
+ return;
170
+ }
171
+ if (oldIsMap !== newIsMap) {
172
+ visit({ kind: "changed", path: prefix, oldValue, newValue });
173
+ return;
174
+ }
175
+ const oldIsArray = Array.isArray(oldValue);
176
+ const newIsArray = Array.isArray(newValue);
177
+ if (oldIsArray && newIsArray) {
178
+ diffArraysLockstep(oldValue, newValue, prefix, visit);
179
+ return;
180
+ }
181
+ if (!oldIsArray && !newIsArray) {
182
+ diffObjectsLockstep(
183
+ oldValue,
184
+ newValue,
185
+ prefix,
186
+ visit
187
+ );
188
+ return;
189
+ }
190
+ visit({ kind: "changed", path: prefix, oldValue, newValue });
191
+ return;
192
+ }
193
+ if (oldIsDescendable && !newIsDescendable) {
194
+ visit({ kind: "changed", path: prefix, oldValue, newValue });
195
+ return;
196
+ }
197
+ if (!oldIsDescendable && newIsDescendable) {
198
+ visit({ kind: "changed", path: prefix, oldValue, newValue });
199
+ return;
200
+ }
201
+ if (oldValue === void 0) {
202
+ visit({ kind: "added", path: prefix, newValue });
203
+ return;
204
+ }
205
+ if (newValue === void 0) {
206
+ visit({ kind: "removed", path: prefix, oldValue });
207
+ return;
208
+ }
209
+ visit({ kind: "changed", path: prefix, oldValue, newValue });
210
+ }
211
+ function walkNewDescendable(newValue, prefix, visit) {
212
+ if (Array.isArray(newValue)) {
213
+ for (let i = 0; i < newValue.length; i++) {
214
+ diffAndApply(void 0, readConsumerIndex(newValue, i), appendSegment(prefix, i), visit);
215
+ }
216
+ } else if (newValue instanceof Map) {
217
+ for (const [key, entry] of newValue) {
218
+ diffAndApply(void 0, entry, appendSegment(prefix, key), visit);
219
+ }
220
+ } else {
221
+ const rec = newValue;
222
+ for (const k of consumerKeys(rec)) {
223
+ diffAndApply(void 0, readConsumerProp(rec, k), appendSegment(prefix, k), visit);
224
+ }
225
+ }
226
+ }
227
+ function walkOldDescendable(oldValue, prefix, visit) {
228
+ if (Array.isArray(oldValue)) {
229
+ for (let i = 0; i < oldValue.length; i++) {
230
+ diffAndApply(readConsumerIndex(oldValue, i), void 0, appendSegment(prefix, i), visit);
231
+ }
232
+ } else if (oldValue instanceof Map) {
233
+ for (const [key, entry] of oldValue) {
234
+ diffAndApply(entry, void 0, appendSegment(prefix, key), visit);
235
+ }
236
+ } else {
237
+ const rec = oldValue;
238
+ for (const k of consumerKeys(rec)) {
239
+ diffAndApply(readConsumerProp(rec, k), void 0, appendSegment(prefix, k), visit);
240
+ }
241
+ }
242
+ }
243
+ function diffMapsLockstep(oldMap, newMap, prefix, visit) {
244
+ for (const [key, entry] of newMap) {
245
+ diffAndApply(oldMap.get(key), entry, appendSegment(prefix, key), visit);
246
+ }
247
+ for (const [key, entry] of oldMap) {
248
+ if (newMap.has(key)) continue;
249
+ diffAndApply(entry, void 0, appendSegment(prefix, key), visit);
250
+ }
251
+ }
252
+ function diffArraysLockstep(oldArr, newArr, prefix, visit) {
253
+ const max = Math.max(oldArr.length, newArr.length);
254
+ for (let i = 0; i < max; i++) {
255
+ diffAndApply(
256
+ readConsumerIndex(oldArr, i),
257
+ readConsumerIndex(newArr, i),
258
+ appendSegment(prefix, i),
259
+ visit
260
+ );
261
+ }
262
+ }
263
+ function diffObjectsLockstep(oldRec, newRec, prefix, visit) {
264
+ const seen = /* @__PURE__ */ new Set();
265
+ for (const k of consumerKeys(oldRec)) {
266
+ seen.add(k);
267
+ diffAndApply(
268
+ readConsumerProp(oldRec, k),
269
+ readConsumerProp(newRec, k),
270
+ appendSegment(prefix, k),
271
+ visit
272
+ );
273
+ }
274
+ for (const k of consumerKeys(newRec)) {
275
+ if (seen.has(k)) continue;
276
+ diffAndApply(
277
+ readConsumerProp(oldRec, k),
278
+ readConsumerProp(newRec, k),
279
+ appendSegment(prefix, k),
280
+ visit
281
+ );
282
+ }
283
+ }
284
+ function applyChangedKeys(target, source, arrayOpPath, currentPath, patches) {
285
+ if (!isDescendable(target) || !isDescendable(source)) return false;
286
+ if (target instanceof Map || source instanceof Map) return false;
287
+ const targetIsArray = Array.isArray(target);
288
+ const sourceIsArray = Array.isArray(source);
289
+ if (targetIsArray !== sourceIsArray) return false;
290
+ const depth = currentPath.length;
291
+ const changedFirstSegments = /* @__PURE__ */ new Set();
292
+ for (const patch of patches) {
293
+ if (patch.path.length === depth) return false;
294
+ changedFirstSegments.add(patch.path[depth]);
295
+ }
296
+ if (targetIsArray) {
297
+ const t = target;
298
+ const s = source;
299
+ if (arrayOpPath === null || pathsEqual(currentPath, arrayOpPath)) {
300
+ if (t.length > s.length) t.length = s.length;
301
+ for (const idx of changedFirstSegments) {
302
+ const i = typeof idx === "number" ? idx : Number(idx);
303
+ if (i >= s.length) continue;
304
+ t[i] = s[i];
305
+ }
306
+ } else {
307
+ for (const idx of changedFirstSegments) {
308
+ const i = typeof idx === "number" ? idx : Number(idx);
309
+ if (i >= s.length) continue;
310
+ const childPath = appendSegment(currentPath, i);
311
+ const curEl = t[i];
312
+ const nextEl = s[i];
313
+ if (isPathPrefix(childPath, arrayOpPath) && isDescendable(curEl) && isDescendable(nextEl) && applyChangedKeys(
314
+ curEl,
315
+ nextEl,
316
+ arrayOpPath,
317
+ childPath,
318
+ patches.filter((p) => isPathPrefix(childPath, p.path))
319
+ )) {
320
+ continue;
321
+ }
322
+ t[i] = nextEl;
323
+ }
324
+ }
325
+ } else {
326
+ const t = target;
327
+ const s = source;
328
+ const sourceKeys = new Set(Object.keys(s));
329
+ for (const k of Object.keys(t)) {
330
+ if (!sourceKeys.has(k)) delete t[k];
331
+ }
332
+ for (const k of changedFirstSegments) {
333
+ const key = String(k);
334
+ const nextVal = safeOwnRead(s, key);
335
+ if (arrayOpPath !== null) {
336
+ const curVal = safeOwnRead(t, key);
337
+ const childPath = appendSegment(currentPath, key);
338
+ if (isDescendable(curVal) && isDescendable(nextVal) && applyChangedKeys(
339
+ curVal,
340
+ nextVal,
341
+ arrayOpPath,
342
+ childPath,
343
+ patches.filter((p) => isPathPrefix(childPath, p.path))
344
+ )) {
345
+ continue;
346
+ }
347
+ }
348
+ safeAssign(t, key, nextVal);
349
+ }
350
+ }
351
+ return true;
352
+ }
353
+ function structuralSnapshot(value) {
354
+ if (!isDescendable(value)) return value;
355
+ if (value instanceof Map) {
356
+ const out2 = /* @__PURE__ */ new Map();
357
+ for (const [k, v] of value) out2.set(k, structuralSnapshot(v));
358
+ return out2;
359
+ }
360
+ if (Array.isArray(value)) {
361
+ const out2 = new Array(value.length);
362
+ for (let i = 0; i < value.length; i++) {
363
+ out2[i] = structuralSnapshot(value[i]);
364
+ }
365
+ return out2;
366
+ }
367
+ const src = value;
368
+ const out = {};
369
+ for (const k of Object.keys(src)) {
370
+ safeAssign(out, k, structuralSnapshot(safeOwnRead(src, k)));
371
+ }
372
+ return out;
373
+ }
374
+
375
+ export { ANONYMOUS_FORM_KEY_PREFIX as A, DEFAULT_HISTORY_MAX_SNAPSHOTS as D, RESERVED_KEY_PREFIX as R, safeOwnRead as a, safeAssign as b, callConsumerSchemaFn as c, consumerHas as d, safeOwnHas as e, spreadConsumerRecord as f, copyConsumerArray as g, consumerKeys as h, isShadowedKey as i, readConsumerProp as j, diffAndApply as k, DEFAULT_FIELD_VALIDATION_DEBOUNCE_MS as l, consumerSymbolKeys as m, normalizeNumericOption as n, applyChangedKeys as o, pickDefined as p, DEFAULT_MAX_RECURSION_DEPTH as q, readConsumerIndex as r, structuralSnapshot as s, ANONYMOUS_WIZARD_KEY_PREFIX as t };
@@ -24,6 +24,14 @@ function canonicalStringify(value, seen = /* @__PURE__ */ new WeakSet()) {
24
24
  try {
25
25
  if (value instanceof Date) return `date:${value.getTime()}`;
26
26
  if (value instanceof RegExp) return `regex:${String(value)}`;
27
+ if (value instanceof Map) {
28
+ const entries2 = [...value].map(([k, v]) => `${canonicalStringify(k, seen)}=>${canonicalStringify(v, seen)}`).sort();
29
+ return `map:[${entries2.join(",")}]`;
30
+ }
31
+ if (value instanceof Set) {
32
+ const members = [...value].map((v) => canonicalStringify(v, seen)).sort();
33
+ return `set:[${members.join(",")}]`;
34
+ }
27
35
  const entries = Object.entries(obj).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([k, v]) => `${JSON.stringify(k)}:${canonicalStringify(v, seen)}`);
28
36
  return `{${entries.join(",")}}`;
29
37
  } finally {
@@ -34,4 +42,3 @@ function canonicalStringify(value, seen = /* @__PURE__ */ new WeakSet()) {
34
42
  }
35
43
 
36
44
  export { canonicalStringify as c };
37
- //# sourceMappingURL=attaform.BJGA_UOS.mjs.map