document-model 1.1.0-debug.2 → 1.1.0-experimental.2

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 (140) hide show
  1. package/dist/browser/cjs/document-model.js +1 -21
  2. package/dist/browser/cjs/document.js +1 -15
  3. package/dist/browser/cjs/index.js +1 -18
  4. package/dist/browser/cjs/internal/index-DLodkpOq.js +22 -0
  5. package/dist/browser/cjs/internal/index-azT4DEce.js +1 -0
  6. package/dist/browser/cjs/internal/object-CMr-_AP8.js +25 -0
  7. package/dist/browser/es/document-model.js +15 -16
  8. package/dist/browser/es/document.js +9 -10
  9. package/dist/browser/es/index.js +11 -13
  10. package/dist/browser/es/internal/index-BzNpRs2a.js +44 -0
  11. package/dist/browser/es/internal/index-CL_1ivGq.js +2104 -0
  12. package/dist/browser/es/internal/object-FFc9n_3I.js +2789 -0
  13. package/dist/browser/src/document/object.d.ts +35 -0
  14. package/dist/browser/src/document/types.d.ts +6 -0
  15. package/dist/browser/src/document/utils/base.d.ts +5 -4
  16. package/dist/browser/src/document/utils/document-helpers.d.ts +1 -1
  17. package/dist/browser/src/document/utils/index.d.ts +1 -1
  18. package/dist/node/cjs/document-model.js +1 -25
  19. package/dist/node/cjs/document.js +1 -19
  20. package/dist/node/cjs/index.js +1 -22
  21. package/dist/node/cjs/internal/index-CPeTtUsk.js +22 -0
  22. package/dist/node/cjs/internal/index-CTavCc1t.js +1 -0
  23. package/dist/node/cjs/internal/object-DhI24-1e.js +20 -0
  24. package/dist/node/es/document-model.js +14 -15
  25. package/dist/node/es/document.js +9 -10
  26. package/dist/node/es/index.js +11 -13
  27. package/dist/node/es/internal/index-8lUz8qED.js +44 -0
  28. package/dist/node/es/internal/index-A880In4b.js +2108 -0
  29. package/dist/node/es/internal/object-C9n9Ijnt.js +1687 -0
  30. package/dist/node/src/document/object.d.ts +35 -0
  31. package/dist/node/src/document/types.d.ts +6 -0
  32. package/dist/node/src/document/utils/base.d.ts +5 -4
  33. package/dist/node/src/document/utils/document-helpers.d.ts +1 -1
  34. package/dist/node/src/document/utils/index.d.ts +1 -1
  35. package/package.json +1 -1
  36. package/CHANGELOG.md +0 -19
  37. package/dist/browser/cjs/document-model.js.map +0 -1
  38. package/dist/browser/cjs/document.js.map +0 -1
  39. package/dist/browser/cjs/index.js.map +0 -1
  40. package/dist/browser/cjs/internal/index-CaJbS06G.js +0 -2339
  41. package/dist/browser/cjs/internal/index-CaJbS06G.js.map +0 -1
  42. package/dist/browser/cjs/internal/index-kKIg6qNB.js +0 -44
  43. package/dist/browser/cjs/internal/index-kKIg6qNB.js.map +0 -1
  44. package/dist/browser/cjs/internal/object-B6dSDhtS.js +0 -4109
  45. package/dist/browser/cjs/internal/object-B6dSDhtS.js.map +0 -1
  46. package/dist/browser/es/document-model.js.map +0 -1
  47. package/dist/browser/es/document.js.map +0 -1
  48. package/dist/browser/es/index.js.map +0 -1
  49. package/dist/browser/es/internal/index-B1lQN59e.js +0 -2340
  50. package/dist/browser/es/internal/index-B1lQN59e.js.map +0 -1
  51. package/dist/browser/es/internal/index-Bu0CkmrW.js +0 -45
  52. package/dist/browser/es/internal/index-Bu0CkmrW.js.map +0 -1
  53. package/dist/browser/es/internal/object-9mR1JlXD.js +0 -4110
  54. package/dist/browser/es/internal/object-9mR1JlXD.js.map +0 -1
  55. package/dist/node/cjs/document-model.js.map +0 -1
  56. package/dist/node/cjs/document.js.map +0 -1
  57. package/dist/node/cjs/index.js.map +0 -1
  58. package/dist/node/cjs/internal/index-AqiVmL0w.js +0 -44
  59. package/dist/node/cjs/internal/index-AqiVmL0w.js.map +0 -1
  60. package/dist/node/cjs/internal/index-ajqhOWQ1.js +0 -2343
  61. package/dist/node/cjs/internal/index-ajqhOWQ1.js.map +0 -1
  62. package/dist/node/cjs/internal/object-D_9h7jBN.js +0 -2111
  63. package/dist/node/cjs/internal/object-D_9h7jBN.js.map +0 -1
  64. package/dist/node/es/document-model.js.map +0 -1
  65. package/dist/node/es/document.js.map +0 -1
  66. package/dist/node/es/index.js.map +0 -1
  67. package/dist/node/es/internal/index-Bh_09edy.js +0 -2344
  68. package/dist/node/es/internal/index-Bh_09edy.js.map +0 -1
  69. package/dist/node/es/internal/index-s6NFw7Kq.js +0 -45
  70. package/dist/node/es/internal/index-s6NFw7Kq.js.map +0 -1
  71. package/dist/node/es/internal/object-CbITi4iq.js +0 -2112
  72. package/dist/node/es/internal/object-CbITi4iq.js.map +0 -1
  73. package/dist/src/document/actions/creators.d.ts +0 -47
  74. package/dist/src/document/actions/index.d.ts +0 -14
  75. package/dist/src/document/actions/types.d.ts +0 -15
  76. package/dist/src/document/index.d.ts +0 -6
  77. package/dist/src/document/object.d.ts +0 -1175
  78. package/dist/src/document/reducer.d.ts +0 -43
  79. package/dist/src/document/schema/index.d.ts +0 -2
  80. package/dist/src/document/schema/types.d.ts +0 -176
  81. package/dist/src/document/schema/zod.d.ts +0 -113
  82. package/dist/src/document/signal.d.ts +0 -29
  83. package/dist/src/document/types.d.ts +0 -249
  84. package/dist/src/document/utils/base.d.ts +0 -85
  85. package/dist/src/document/utils/document-helpers.d.ts +0 -53
  86. package/dist/src/document/utils/file.d.ts +0 -48
  87. package/dist/src/document/utils/index.d.ts +0 -5
  88. package/dist/src/document/utils/node.d.ts +0 -9
  89. package/dist/src/document/utils/validation.d.ts +0 -2
  90. package/dist/src/document-model/custom/reducers/header.d.ts +0 -2
  91. package/dist/src/document-model/custom/reducers/module.d.ts +0 -2
  92. package/dist/src/document-model/custom/reducers/operation-error.d.ts +0 -2
  93. package/dist/src/document-model/custom/reducers/operation-example.d.ts +0 -2
  94. package/dist/src/document-model/custom/reducers/operation.d.ts +0 -2
  95. package/dist/src/document-model/custom/reducers/state.d.ts +0 -2
  96. package/dist/src/document-model/custom/reducers/versioning.d.ts +0 -7
  97. package/dist/src/document-model/custom/utils.d.ts +0 -7
  98. package/dist/src/document-model/gen/actions.d.ts +0 -15
  99. package/dist/src/document-model/gen/creators.d.ts +0 -7
  100. package/dist/src/document-model/gen/document-model.d.ts +0 -2
  101. package/dist/src/document-model/gen/header/actions.d.ts +0 -9
  102. package/dist/src/document-model/gen/header/creators.d.ts +0 -8
  103. package/dist/src/document-model/gen/header/object.d.ts +0 -12
  104. package/dist/src/document-model/gen/header/operations.d.ts +0 -10
  105. package/dist/src/document-model/gen/index.d.ts +0 -5
  106. package/dist/src/document-model/gen/module/actions.d.ts +0 -8
  107. package/dist/src/document-model/gen/module/creators.d.ts +0 -7
  108. package/dist/src/document-model/gen/module/object.d.ts +0 -11
  109. package/dist/src/document-model/gen/module/operations.d.ts +0 -9
  110. package/dist/src/document-model/gen/object.d.ts +0 -28
  111. package/dist/src/document-model/gen/operation/actions.d.ts +0 -13
  112. package/dist/src/document-model/gen/operation/creators.d.ts +0 -12
  113. package/dist/src/document-model/gen/operation/object.d.ts +0 -16
  114. package/dist/src/document-model/gen/operation/operations.d.ts +0 -14
  115. package/dist/src/document-model/gen/operation-error/actions.d.ts +0 -10
  116. package/dist/src/document-model/gen/operation-error/creators.d.ts +0 -9
  117. package/dist/src/document-model/gen/operation-error/object.d.ts +0 -13
  118. package/dist/src/document-model/gen/operation-error/operations.d.ts +0 -11
  119. package/dist/src/document-model/gen/operation-example/actions.d.ts +0 -7
  120. package/dist/src/document-model/gen/operation-example/creators.d.ts +0 -6
  121. package/dist/src/document-model/gen/operation-example/object.d.ts +0 -10
  122. package/dist/src/document-model/gen/operation-example/operations.d.ts +0 -8
  123. package/dist/src/document-model/gen/reducer.d.ts +0 -5
  124. package/dist/src/document-model/gen/schema/index.d.ts +0 -2
  125. package/dist/src/document-model/gen/schema/types.d.ts +0 -453
  126. package/dist/src/document-model/gen/schema/zod.d.ts +0 -453
  127. package/dist/src/document-model/gen/state/actions.d.ts +0 -9
  128. package/dist/src/document-model/gen/state/creators.d.ts +0 -8
  129. package/dist/src/document-model/gen/state/object.d.ts +0 -12
  130. package/dist/src/document-model/gen/state/operations.d.ts +0 -10
  131. package/dist/src/document-model/gen/types.d.ts +0 -8
  132. package/dist/src/document-model/gen/utils.d.ts +0 -6
  133. package/dist/src/document-model/gen/versioning/actions.d.ts +0 -8
  134. package/dist/src/document-model/gen/versioning/creators.d.ts +0 -7
  135. package/dist/src/document-model/gen/versioning/object.d.ts +0 -11
  136. package/dist/src/document-model/gen/versioning/operations.d.ts +0 -9
  137. package/dist/src/document-model/index.d.ts +0 -80
  138. package/dist/src/index.d.ts +0 -25
  139. package/dist/vite.config.d.ts +0 -2
  140. package/dist/vitest.config.d.ts +0 -2
@@ -0,0 +1,2108 @@
1
+ var Rt = Object.defineProperty;
2
+ var xt = (t, e, r) => e in t ? Rt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var Ee = (t, e, r) => (xt(t, typeof e != "symbol" ? e + "" : e, r), r);
4
+ import { c as At, i as Mt, a as Dt, b as Nt, s as Lt, d as Pt, l as Ct, e as jt, f as a, B as c, g as yt, h as wt } from "./object-C9n9Ijnt.js";
5
+ import "immer";
6
+ import "jszip";
7
+ import "crypto";
8
+ import "fs";
9
+ import "https";
10
+ import "path";
11
+ import { z as o } from "zod";
12
+ const kt = new RegExp("([\\p{Ll}\\d])(\\p{Lu})", "gu"), Ut = new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu"), vt = new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d", "u"), Ft = /[^\p{L}\d]+/giu, he = "$1\0$2", Oe = "";
13
+ function Se(t) {
14
+ let e = t.trim();
15
+ e = e.replace(kt, he).replace(Ut, he), e = e.replace(Ft, "\0");
16
+ let r = 0, n = e.length;
17
+ for (; e.charAt(r) === "\0"; )
18
+ r++;
19
+ if (r === n)
20
+ return [];
21
+ for (; e.charAt(n - 1) === "\0"; )
22
+ n--;
23
+ return e.slice(r, n).split(/\0/g);
24
+ }
25
+ function $t(t) {
26
+ const e = Se(t);
27
+ for (let r = 0; r < e.length; r++) {
28
+ const n = e[r], i = vt.exec(n);
29
+ if (i) {
30
+ const s = i.index + (i[1] ?? i[2]).length;
31
+ e.splice(r, 1, n.slice(0, s), n.slice(s));
32
+ }
33
+ }
34
+ return e;
35
+ }
36
+ function ge(t, e) {
37
+ const [r, n, i] = Wt(t, e), s = Vt(e == null ? void 0 : e.locale), l = Xt(e == null ? void 0 : e.locale), u = e != null && e.mergeAmbiguousCharacters ? Ht(s, l) : Gt(s, l);
38
+ return r + n.map(u).join((e == null ? void 0 : e.delimiter) ?? "") + i;
39
+ }
40
+ function Vt(t) {
41
+ return t === !1 ? (e) => e.toLowerCase() : (e) => e.toLocaleLowerCase(t);
42
+ }
43
+ function Xt(t) {
44
+ return t === !1 ? (e) => e.toUpperCase() : (e) => e.toLocaleUpperCase(t);
45
+ }
46
+ function Ht(t, e) {
47
+ return (r) => `${e(r[0])}${t(r.slice(1))}`;
48
+ }
49
+ function Gt(t, e) {
50
+ return (r, n) => {
51
+ const i = r[0];
52
+ return (n > 0 && i >= "0" && i <= "9" ? "_" + i : e(i)) + t(r.slice(1));
53
+ };
54
+ }
55
+ function Wt(t, e = {}) {
56
+ const r = e.split ?? (e.separateNumbers ? $t : Se), n = e.prefixCharacters ?? Oe, i = e.suffixCharacters ?? Oe;
57
+ let s = 0, l = t.length;
58
+ for (; s < t.length; ) {
59
+ const u = t.charAt(s);
60
+ if (!n.includes(u))
61
+ break;
62
+ s++;
63
+ }
64
+ for (; l > s; ) {
65
+ const u = l - 1, Tt = t.charAt(u);
66
+ if (!i.includes(Tt))
67
+ break;
68
+ l = u;
69
+ }
70
+ return [
71
+ t.slice(0, s),
72
+ r(t.slice(s, l)),
73
+ t.slice(l)
74
+ ];
75
+ }
76
+ function fe(t, e = !1) {
77
+ const r = [];
78
+ if (e && t === "")
79
+ return r;
80
+ try {
81
+ const n = JSON.parse(t);
82
+ !e && !Object.keys(n).length && r.push({
83
+ message: "Initial state cannot be empty",
84
+ details: {
85
+ initialState: t
86
+ }
87
+ });
88
+ } catch {
89
+ r.push({
90
+ message: "Invalid initial state",
91
+ details: {
92
+ initialState: t
93
+ }
94
+ });
95
+ }
96
+ return r;
97
+ }
98
+ function be(t, e, r = "", n = !0) {
99
+ const i = [];
100
+ if (!n && !t)
101
+ return i.push({
102
+ message: "State schema is required",
103
+ details: {
104
+ schema: t
105
+ }
106
+ }), i;
107
+ if (n && !t)
108
+ return i;
109
+ const s = `type ${ge(e)}${ge(r)}State`;
110
+ return t.includes(s) || i.push({
111
+ message: `Invalid state schema name. Expected ${s}`,
112
+ details: {
113
+ schema: t
114
+ }
115
+ }), i;
116
+ }
117
+ function _e(t) {
118
+ const e = [];
119
+ t.length || e.push({
120
+ message: "Modules are required",
121
+ details: {
122
+ modules: t
123
+ }
124
+ });
125
+ const r = t.reduce(
126
+ (n, i) => [...n, ...T(i)],
127
+ []
128
+ );
129
+ return [...e, ...r];
130
+ }
131
+ function T(t) {
132
+ const e = [];
133
+ t.name || e.push({
134
+ message: "Module name is required",
135
+ details: {
136
+ module: t
137
+ }
138
+ }), t.operations.length || e.push({
139
+ message: "Module operations are required",
140
+ details: {
141
+ module: t
142
+ }
143
+ });
144
+ const r = t.operations.reduce(
145
+ (n, i) => [...n, ...R(i)],
146
+ []
147
+ );
148
+ return [...e, ...r];
149
+ }
150
+ function R(t) {
151
+ const e = [];
152
+ return t.name || e.push({
153
+ message: "Operation name is required",
154
+ details: {
155
+ operation: t
156
+ }
157
+ }), t.schema || e.push({
158
+ message: "Operation schema is required",
159
+ details: {
160
+ operation: t
161
+ }
162
+ }), e;
163
+ }
164
+ const Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
165
+ __proto__: null,
166
+ validateInitialState: fe,
167
+ validateModule: T,
168
+ validateModuleOperation: R,
169
+ validateModules: _e,
170
+ validateStateSchemaName: be
171
+ }, Symbol.toStringTag, { value: "Module" })), Ie = {
172
+ id: "powerhouse/document-model",
173
+ name: "DocumentModel",
174
+ extension: "phdm",
175
+ description: "The Powerhouse Document Model describes the state and operations of a document type.",
176
+ author: {
177
+ name: "Powerhouse",
178
+ website: "https://www.powerhouse.inc/"
179
+ },
180
+ specifications: [
181
+ {
182
+ version: 1,
183
+ changeLog: [],
184
+ modules: [
185
+ {
186
+ name: "header",
187
+ operations: [
188
+ {
189
+ name: "SetModelName",
190
+ id: "",
191
+ description: "",
192
+ schema: "",
193
+ template: "",
194
+ reducer: "",
195
+ examples: [],
196
+ errors: [],
197
+ scope: "global"
198
+ },
199
+ {
200
+ name: "SetModelId",
201
+ id: "",
202
+ description: "",
203
+ schema: "",
204
+ template: "",
205
+ reducer: "",
206
+ examples: [],
207
+ errors: [],
208
+ scope: "global"
209
+ },
210
+ {
211
+ name: "SetModelExtension",
212
+ id: "",
213
+ description: "",
214
+ schema: "",
215
+ template: "",
216
+ reducer: "",
217
+ examples: [],
218
+ errors: [],
219
+ scope: "global"
220
+ },
221
+ {
222
+ name: "SetModelDescription",
223
+ id: "",
224
+ description: "",
225
+ schema: "",
226
+ template: "",
227
+ reducer: "",
228
+ examples: [],
229
+ errors: [],
230
+ scope: "global"
231
+ },
232
+ {
233
+ name: "SetAuthorName",
234
+ id: "",
235
+ description: "",
236
+ schema: "",
237
+ template: "",
238
+ reducer: "",
239
+ examples: [],
240
+ errors: [],
241
+ scope: "global"
242
+ },
243
+ {
244
+ name: "SetAuthorWebsite",
245
+ id: "",
246
+ description: "",
247
+ schema: "",
248
+ template: "",
249
+ reducer: "",
250
+ examples: [],
251
+ errors: [],
252
+ scope: "global"
253
+ }
254
+ ],
255
+ id: "",
256
+ description: ""
257
+ },
258
+ {
259
+ name: "versioning",
260
+ operations: [
261
+ {
262
+ name: "AddChangeLogItem",
263
+ id: "",
264
+ description: "",
265
+ schema: "",
266
+ template: "",
267
+ reducer: "",
268
+ examples: [],
269
+ errors: [],
270
+ scope: "global"
271
+ },
272
+ {
273
+ name: "UpdateChangeLogItem",
274
+ id: "",
275
+ description: "",
276
+ schema: "",
277
+ template: "",
278
+ reducer: "",
279
+ examples: [],
280
+ errors: [],
281
+ scope: "global"
282
+ },
283
+ {
284
+ name: "DeleteChangeLogItem",
285
+ id: "",
286
+ description: "",
287
+ schema: "",
288
+ template: "",
289
+ reducer: "",
290
+ examples: [],
291
+ errors: [],
292
+ scope: "global"
293
+ },
294
+ {
295
+ name: "ReorderChangeLogItems",
296
+ id: "",
297
+ description: "",
298
+ schema: "",
299
+ template: "",
300
+ reducer: "",
301
+ examples: [],
302
+ errors: [],
303
+ scope: "global"
304
+ },
305
+ {
306
+ name: "ReleaseNewVersion",
307
+ schema: null,
308
+ id: "",
309
+ description: "",
310
+ template: "",
311
+ reducer: "",
312
+ examples: [],
313
+ errors: [],
314
+ scope: "global"
315
+ }
316
+ ],
317
+ id: "",
318
+ description: ""
319
+ },
320
+ {
321
+ name: "module",
322
+ operations: [
323
+ {
324
+ name: "AddModule",
325
+ id: "",
326
+ description: "",
327
+ schema: "",
328
+ template: "",
329
+ reducer: "",
330
+ examples: [],
331
+ errors: [],
332
+ scope: "global"
333
+ },
334
+ {
335
+ name: "SetModuleName",
336
+ id: "",
337
+ description: "",
338
+ schema: "",
339
+ template: "",
340
+ reducer: "",
341
+ examples: [],
342
+ errors: [],
343
+ scope: "global"
344
+ },
345
+ {
346
+ name: "SetModuleDescription",
347
+ id: "",
348
+ description: "",
349
+ schema: "",
350
+ template: "",
351
+ reducer: "",
352
+ examples: [],
353
+ errors: [],
354
+ scope: "global"
355
+ },
356
+ {
357
+ name: "DeleteModule",
358
+ id: "",
359
+ description: "",
360
+ schema: "",
361
+ template: "",
362
+ reducer: "",
363
+ examples: [],
364
+ errors: [],
365
+ scope: "global"
366
+ },
367
+ {
368
+ name: "ReorderModules",
369
+ id: "",
370
+ description: "",
371
+ schema: "",
372
+ template: "",
373
+ reducer: "",
374
+ examples: [],
375
+ errors: [],
376
+ scope: "global"
377
+ }
378
+ ],
379
+ id: "",
380
+ description: ""
381
+ },
382
+ {
383
+ name: "operation-error",
384
+ operations: [
385
+ {
386
+ name: "AddOperationError",
387
+ id: "",
388
+ description: "",
389
+ schema: "",
390
+ template: "",
391
+ reducer: "",
392
+ examples: [],
393
+ errors: [],
394
+ scope: "global"
395
+ },
396
+ {
397
+ name: "SetOperationErrorCode",
398
+ id: "",
399
+ description: "",
400
+ schema: "",
401
+ template: "",
402
+ reducer: "",
403
+ examples: [],
404
+ errors: [],
405
+ scope: "global"
406
+ },
407
+ {
408
+ name: "SetOperationErrorName",
409
+ id: "",
410
+ description: "",
411
+ schema: "",
412
+ template: "",
413
+ reducer: "",
414
+ examples: [],
415
+ errors: [],
416
+ scope: "global"
417
+ },
418
+ {
419
+ name: "SetOperationErrorDescription",
420
+ id: "",
421
+ description: "",
422
+ schema: "",
423
+ template: "",
424
+ reducer: "",
425
+ examples: [],
426
+ errors: [],
427
+ scope: "global"
428
+ },
429
+ {
430
+ name: "SetOperationErrorTemplate",
431
+ id: "",
432
+ description: "",
433
+ schema: "",
434
+ template: "",
435
+ reducer: "",
436
+ examples: [],
437
+ errors: [],
438
+ scope: "global"
439
+ },
440
+ {
441
+ name: "DeleteOperationError",
442
+ id: "",
443
+ description: "",
444
+ schema: "",
445
+ template: "",
446
+ reducer: "",
447
+ examples: [],
448
+ errors: [],
449
+ scope: "global"
450
+ },
451
+ {
452
+ name: "ReorderOperationErrors",
453
+ id: "",
454
+ description: "",
455
+ schema: "",
456
+ template: "",
457
+ reducer: "",
458
+ examples: [],
459
+ errors: [],
460
+ scope: "global"
461
+ }
462
+ ],
463
+ id: "",
464
+ description: ""
465
+ },
466
+ {
467
+ name: "operation-example",
468
+ operations: [
469
+ {
470
+ name: "AddOperationExample",
471
+ id: "",
472
+ description: "",
473
+ schema: "",
474
+ template: "",
475
+ reducer: "",
476
+ examples: [],
477
+ errors: [],
478
+ scope: "global"
479
+ },
480
+ {
481
+ name: "UpdateOperationExample",
482
+ id: "",
483
+ description: "",
484
+ schema: "",
485
+ template: "",
486
+ reducer: "",
487
+ examples: [],
488
+ errors: [],
489
+ scope: "global"
490
+ },
491
+ {
492
+ name: "DeleteOperationExample",
493
+ id: "",
494
+ description: "",
495
+ schema: "",
496
+ template: "",
497
+ reducer: "",
498
+ examples: [],
499
+ errors: [],
500
+ scope: "global"
501
+ },
502
+ {
503
+ name: "ReorderOperationExamples",
504
+ id: "",
505
+ description: "",
506
+ schema: "",
507
+ template: "",
508
+ reducer: "",
509
+ examples: [],
510
+ errors: [],
511
+ scope: "global"
512
+ }
513
+ ],
514
+ id: "",
515
+ description: ""
516
+ },
517
+ {
518
+ name: "operation",
519
+ operations: [
520
+ {
521
+ name: "AddOperation",
522
+ id: "",
523
+ description: "",
524
+ schema: "",
525
+ template: "",
526
+ reducer: "",
527
+ examples: [],
528
+ errors: [],
529
+ scope: "global"
530
+ },
531
+ {
532
+ name: "SetOperationName",
533
+ id: "",
534
+ description: "",
535
+ schema: "",
536
+ template: "",
537
+ reducer: "",
538
+ examples: [],
539
+ errors: [],
540
+ scope: "global"
541
+ },
542
+ {
543
+ name: "SetOperationSchema",
544
+ id: "",
545
+ description: "",
546
+ schema: "",
547
+ template: "",
548
+ reducer: "",
549
+ examples: [],
550
+ errors: [],
551
+ scope: "global"
552
+ },
553
+ {
554
+ name: "SetOperationDescription",
555
+ id: "",
556
+ description: "",
557
+ schema: "",
558
+ template: "",
559
+ reducer: "",
560
+ examples: [],
561
+ errors: [],
562
+ scope: "global"
563
+ },
564
+ {
565
+ name: "SetOperationTemplate",
566
+ id: "",
567
+ description: "",
568
+ schema: "",
569
+ template: "",
570
+ reducer: "",
571
+ examples: [],
572
+ errors: [],
573
+ scope: "global"
574
+ },
575
+ {
576
+ name: "SetOperationReducer",
577
+ id: "",
578
+ description: "",
579
+ schema: "",
580
+ template: "",
581
+ reducer: "",
582
+ examples: [],
583
+ errors: [],
584
+ scope: "global"
585
+ },
586
+ {
587
+ name: "MoveOperation",
588
+ id: "",
589
+ description: "",
590
+ schema: "",
591
+ template: "",
592
+ reducer: "",
593
+ examples: [],
594
+ errors: [],
595
+ scope: "global"
596
+ },
597
+ {
598
+ name: "DeleteOperation",
599
+ id: "",
600
+ description: "",
601
+ schema: "",
602
+ template: "",
603
+ reducer: "",
604
+ examples: [],
605
+ errors: [],
606
+ scope: "global"
607
+ },
608
+ {
609
+ name: "ReorderModuleOperations",
610
+ id: "",
611
+ description: "",
612
+ schema: "",
613
+ template: "",
614
+ reducer: "",
615
+ examples: [],
616
+ errors: [],
617
+ scope: "global"
618
+ }
619
+ ],
620
+ id: "",
621
+ description: ""
622
+ },
623
+ {
624
+ name: "state",
625
+ operations: [
626
+ {
627
+ name: "SetStateSchema",
628
+ id: "",
629
+ description: "",
630
+ schema: "",
631
+ template: "",
632
+ reducer: "",
633
+ examples: [],
634
+ errors: [],
635
+ scope: "global"
636
+ },
637
+ {
638
+ name: "SetInitialState",
639
+ id: "",
640
+ description: "",
641
+ schema: "",
642
+ template: "",
643
+ reducer: "",
644
+ examples: [],
645
+ errors: [],
646
+ scope: "global"
647
+ },
648
+ {
649
+ name: "AddStateExample",
650
+ id: "",
651
+ description: "",
652
+ schema: "",
653
+ template: "",
654
+ reducer: "",
655
+ examples: [],
656
+ errors: [],
657
+ scope: "global"
658
+ },
659
+ {
660
+ name: "UpdateStateExample",
661
+ id: "",
662
+ description: "",
663
+ schema: "",
664
+ template: "",
665
+ reducer: "",
666
+ examples: [],
667
+ errors: [],
668
+ scope: "global"
669
+ },
670
+ {
671
+ name: "DeleteStateExample",
672
+ id: "",
673
+ description: "",
674
+ schema: "",
675
+ template: "",
676
+ reducer: "",
677
+ examples: [],
678
+ errors: [],
679
+ scope: "global"
680
+ },
681
+ {
682
+ name: "ReorderStateExamples",
683
+ id: "",
684
+ description: "",
685
+ schema: "",
686
+ template: "",
687
+ reducer: "",
688
+ examples: [],
689
+ errors: [],
690
+ scope: "global"
691
+ }
692
+ ],
693
+ id: "",
694
+ description: ""
695
+ }
696
+ ],
697
+ state: {
698
+ global: {
699
+ schema: "",
700
+ initialValue: `{
701
+ "id": "",
702
+ "name": "",
703
+ "extension": "",
704
+ "description": "",
705
+ "author": {
706
+ "name": "",
707
+ "website": ""
708
+ },
709
+ "specifications": [
710
+ {
711
+ "version": 1,
712
+ "changeLog": [],
713
+ "state": {
714
+ "schema": "",
715
+ "initialValue": "",
716
+ "examples": []
717
+ },
718
+ "modules": []
719
+ }
720
+ ]
721
+ }`,
722
+ examples: []
723
+ },
724
+ local: {
725
+ schema: "",
726
+ initialValue: "{}",
727
+ examples: []
728
+ }
729
+ }
730
+ }
731
+ ]
732
+ }, Te = (t) => t != null, zt = o.any().refine((t) => Te(t));
733
+ function x() {
734
+ return o.object({
735
+ __typename: o.literal("AddChangeLogItemInput").optional(),
736
+ content: o.string(),
737
+ id: o.string(),
738
+ insertBefore: o.string().nullable()
739
+ });
740
+ }
741
+ function A() {
742
+ return o.object({
743
+ description: o.string().nullish(),
744
+ id: o.string(),
745
+ name: o.string()
746
+ });
747
+ }
748
+ function M() {
749
+ return o.object({
750
+ errorCode: o.string().nullish(),
751
+ errorDescription: o.string().nullish(),
752
+ errorName: o.string().nullish(),
753
+ errorTemplate: o.string().nullish(),
754
+ id: o.string(),
755
+ operationId: o.string()
756
+ });
757
+ }
758
+ function D() {
759
+ return o.object({
760
+ example: o.string(),
761
+ id: o.string(),
762
+ operationId: o.string()
763
+ });
764
+ }
765
+ function N() {
766
+ return o.object({
767
+ description: o.string().nullish(),
768
+ id: o.string(),
769
+ moduleId: o.string(),
770
+ name: o.string(),
771
+ reducer: o.string().nullish(),
772
+ schema: o.string().nullish(),
773
+ template: o.string().nullish(),
774
+ scope: _().nullish()
775
+ });
776
+ }
777
+ function L() {
778
+ return o.object({
779
+ scope: o.string(),
780
+ example: o.string(),
781
+ id: o.string(),
782
+ insertBefore: o.string().nullish()
783
+ });
784
+ }
785
+ function Re() {
786
+ return o.object({
787
+ __typename: o.literal("Author").optional(),
788
+ name: o.string(),
789
+ website: o.string().nullable()
790
+ });
791
+ }
792
+ function P() {
793
+ return o.object({
794
+ __typename: o.literal("CodeExample").optional(),
795
+ id: o.string(),
796
+ value: o.string()
797
+ });
798
+ }
799
+ function C() {
800
+ return o.object({
801
+ __typename: o.literal("DeleteChangeLogItemInput").optional(),
802
+ id: o.string()
803
+ });
804
+ }
805
+ function j() {
806
+ return o.object({
807
+ id: o.string()
808
+ });
809
+ }
810
+ function y() {
811
+ return o.object({
812
+ id: o.string()
813
+ });
814
+ }
815
+ function w() {
816
+ return o.object({
817
+ id: o.string()
818
+ });
819
+ }
820
+ function k() {
821
+ return o.object({
822
+ id: o.string()
823
+ });
824
+ }
825
+ function U() {
826
+ return o.object({
827
+ scope: o.string(),
828
+ id: o.string()
829
+ });
830
+ }
831
+ function _() {
832
+ return o.literal("global").or(o.literal("local"));
833
+ }
834
+ function qt() {
835
+ return o.union([
836
+ x(),
837
+ A(),
838
+ M(),
839
+ D(),
840
+ N(),
841
+ L(),
842
+ C(),
843
+ j(),
844
+ y(),
845
+ w(),
846
+ k(),
847
+ U(),
848
+ v(),
849
+ F(),
850
+ $(),
851
+ V(),
852
+ X(),
853
+ H(),
854
+ G(),
855
+ W(),
856
+ B(),
857
+ z(),
858
+ q(),
859
+ J(),
860
+ K(),
861
+ Q(),
862
+ Y(),
863
+ Z(),
864
+ ee(),
865
+ te(),
866
+ re(),
867
+ oe(),
868
+ ne(),
869
+ ie(),
870
+ se(),
871
+ ae(),
872
+ pe(),
873
+ le(),
874
+ ce(),
875
+ de(),
876
+ ue()
877
+ ]);
878
+ }
879
+ function Jt() {
880
+ return o.object({
881
+ __typename: o.literal("DocumentModelState").optional(),
882
+ author: Re(),
883
+ description: o.string(),
884
+ extension: o.string(),
885
+ id: o.string(),
886
+ name: o.string(),
887
+ specifications: o.array(xe())
888
+ });
889
+ }
890
+ function xe() {
891
+ return o.object({
892
+ __typename: o.literal("DocumentSpecification").optional(),
893
+ changeLog: o.array(o.string()),
894
+ modules: o.array(Ae()),
895
+ state: Le(),
896
+ version: o.number()
897
+ });
898
+ }
899
+ function Ae() {
900
+ return o.object({
901
+ __typename: o.literal("Module").optional(),
902
+ description: o.string().nullable(),
903
+ id: o.string(),
904
+ name: o.string(),
905
+ operations: o.array(Me())
906
+ });
907
+ }
908
+ function v() {
909
+ return o.object({
910
+ newModuleId: o.string(),
911
+ operationId: o.string()
912
+ });
913
+ }
914
+ function Me() {
915
+ return o.object({
916
+ __typename: o.literal("Operation").optional(),
917
+ description: o.string().nullable(),
918
+ errors: o.array(De()),
919
+ examples: o.array(P()),
920
+ id: o.string(),
921
+ name: o.string().nullable(),
922
+ reducer: o.string().nullable(),
923
+ schema: o.string().nullable(),
924
+ template: o.string().nullable(),
925
+ scope: _()
926
+ });
927
+ }
928
+ function De() {
929
+ return o.object({
930
+ __typename: o.literal("OperationError").optional(),
931
+ code: o.string().nullable(),
932
+ description: o.string().nullable(),
933
+ id: o.string(),
934
+ name: o.string().nullable(),
935
+ template: o.string().nullable()
936
+ });
937
+ }
938
+ function F() {
939
+ return o.object({
940
+ __typename: o.literal("ReorderChangeLogItemsInput").optional(),
941
+ order: o.array(o.string())
942
+ });
943
+ }
944
+ function $() {
945
+ return o.object({
946
+ moduleId: o.string(),
947
+ order: o.array(o.string())
948
+ });
949
+ }
950
+ function V() {
951
+ return o.object({
952
+ order: o.array(o.string())
953
+ });
954
+ }
955
+ function X() {
956
+ return o.object({
957
+ operationId: o.string(),
958
+ order: o.array(o.string())
959
+ });
960
+ }
961
+ function H() {
962
+ return o.object({
963
+ operationId: o.string(),
964
+ order: o.array(o.string())
965
+ });
966
+ }
967
+ function G() {
968
+ return o.object({
969
+ scope: o.string(),
970
+ order: o.array(o.string())
971
+ });
972
+ }
973
+ function W() {
974
+ return o.object({
975
+ authorName: o.string()
976
+ });
977
+ }
978
+ function B() {
979
+ return o.object({
980
+ authorWebsite: o.string()
981
+ });
982
+ }
983
+ function z() {
984
+ return o.object({
985
+ scope: o.string(),
986
+ initialValue: o.string()
987
+ });
988
+ }
989
+ function q() {
990
+ return o.object({
991
+ description: o.string()
992
+ });
993
+ }
994
+ function J() {
995
+ return o.object({
996
+ extension: o.string()
997
+ });
998
+ }
999
+ function K() {
1000
+ return o.object({
1001
+ id: o.string()
1002
+ });
1003
+ }
1004
+ function Q() {
1005
+ return o.object({
1006
+ name: o.string()
1007
+ });
1008
+ }
1009
+ function Y() {
1010
+ return o.object({
1011
+ description: o.string().nullish(),
1012
+ id: o.string()
1013
+ });
1014
+ }
1015
+ function Z() {
1016
+ return o.object({
1017
+ id: o.string(),
1018
+ name: o.string().nullish()
1019
+ });
1020
+ }
1021
+ function ee() {
1022
+ return o.object({
1023
+ description: o.string().nullish(),
1024
+ id: o.string()
1025
+ });
1026
+ }
1027
+ function te() {
1028
+ return o.object({
1029
+ errorCode: o.string().nullish(),
1030
+ id: o.string()
1031
+ });
1032
+ }
1033
+ function re() {
1034
+ return o.object({
1035
+ errorDescription: o.string().nullish(),
1036
+ id: o.string()
1037
+ });
1038
+ }
1039
+ function oe() {
1040
+ return o.object({
1041
+ errorName: o.string().nullish(),
1042
+ id: o.string()
1043
+ });
1044
+ }
1045
+ function ne() {
1046
+ return o.object({
1047
+ errorTemplate: o.string().nullish(),
1048
+ id: o.string()
1049
+ });
1050
+ }
1051
+ function ie() {
1052
+ return o.object({
1053
+ id: o.string(),
1054
+ name: o.string().nullish()
1055
+ });
1056
+ }
1057
+ function Ne() {
1058
+ return o.object({
1059
+ id: o.string(),
1060
+ scope: _()
1061
+ });
1062
+ }
1063
+ function se() {
1064
+ return o.object({
1065
+ id: o.string(),
1066
+ reducer: o.string().nullish()
1067
+ });
1068
+ }
1069
+ function ae() {
1070
+ return o.object({
1071
+ id: o.string(),
1072
+ schema: o.string().nullish()
1073
+ });
1074
+ }
1075
+ function pe() {
1076
+ return o.object({
1077
+ id: o.string(),
1078
+ template: o.string().nullish()
1079
+ });
1080
+ }
1081
+ function le() {
1082
+ return o.object({
1083
+ scope: o.string(),
1084
+ schema: o.string()
1085
+ });
1086
+ }
1087
+ function I() {
1088
+ return o.object({
1089
+ __typename: o.literal("State").optional(),
1090
+ examples: o.array(P()),
1091
+ initialValue: o.string(),
1092
+ schema: o.string()
1093
+ });
1094
+ }
1095
+ function Le() {
1096
+ return o.object({
1097
+ global: I(),
1098
+ local: I()
1099
+ });
1100
+ }
1101
+ function ce() {
1102
+ return o.object({
1103
+ __typename: o.literal("UpdateChangeLogItemInput").optional(),
1104
+ id: o.string(),
1105
+ newContent: o.string()
1106
+ });
1107
+ }
1108
+ function de() {
1109
+ return o.object({
1110
+ example: o.string(),
1111
+ id: o.string()
1112
+ });
1113
+ }
1114
+ function ue() {
1115
+ return o.object({
1116
+ scope: o.string(),
1117
+ id: o.string(),
1118
+ newExample: o.string()
1119
+ });
1120
+ }
1121
+ const Kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1122
+ __proto__: null,
1123
+ AddChangeLogItemInputSchema: x,
1124
+ AddModuleInputSchema: A,
1125
+ AddOperationErrorInputSchema: M,
1126
+ AddOperationExampleInputSchema: D,
1127
+ AddOperationInputSchema: N,
1128
+ AddStateExampleInputSchema: L,
1129
+ AuthorSchema: Re,
1130
+ CodeExampleSchema: P,
1131
+ DeleteChangeLogItemInputSchema: C,
1132
+ DeleteModuleInputSchema: j,
1133
+ DeleteOperationErrorInputSchema: y,
1134
+ DeleteOperationExampleInputSchema: w,
1135
+ DeleteOperationInputSchema: k,
1136
+ DeleteStateExampleInputSchema: U,
1137
+ DocumentModelInputSchema: qt,
1138
+ DocumentModelStateSchema: Jt,
1139
+ DocumentSpecificationSchema: xe,
1140
+ ModuleSchema: Ae,
1141
+ MoveOperationInputSchema: v,
1142
+ OperationErrorSchema: De,
1143
+ OperationSchema: Me,
1144
+ OperationScopeSchema: _,
1145
+ ReorderChangeLogItemsInputSchema: F,
1146
+ ReorderModuleOperationsInputSchema: $,
1147
+ ReorderModulesInputSchema: V,
1148
+ ReorderOperationErrorsInputSchema: X,
1149
+ ReorderOperationExamplesInputSchema: H,
1150
+ ReorderStateExamplesInputSchema: G,
1151
+ ScopeStateSchema: Le,
1152
+ SetAuthorNameInputSchema: W,
1153
+ SetAuthorWebsiteInputSchema: B,
1154
+ SetInitialStateInputSchema: z,
1155
+ SetModelDescriptionInputSchema: q,
1156
+ SetModelExtensionInputSchema: J,
1157
+ SetModelIdInputSchema: K,
1158
+ SetModelNameInputSchema: Q,
1159
+ SetModuleDescriptionInputSchema: Y,
1160
+ SetModuleNameInputSchema: Z,
1161
+ SetOperationDescriptionInputSchema: ee,
1162
+ SetOperationErrorCodeInputSchema: te,
1163
+ SetOperationErrorDescriptionInputSchema: re,
1164
+ SetOperationErrorNameInputSchema: oe,
1165
+ SetOperationErrorTemplateInputSchema: ne,
1166
+ SetOperationNameInputSchema: ie,
1167
+ SetOperationReducerInputSchema: se,
1168
+ SetOperationSchemaInputSchema: ae,
1169
+ SetOperationScopeInputSchema: Ne,
1170
+ SetOperationTemplateInputSchema: pe,
1171
+ SetStateSchemaInputSchema: le,
1172
+ StateSchema: I,
1173
+ UpdateChangeLogItemInputSchema: ce,
1174
+ UpdateOperationExampleInputSchema: de,
1175
+ UpdateStateExampleInputSchema: ue,
1176
+ definedNonNullAnySchema: zt,
1177
+ isDefinedNonNullAny: Te
1178
+ }, Symbol.toStringTag, { value: "Module" })), m = {
1179
+ setModelNameOperation(t, e) {
1180
+ t.name = e.input.name;
1181
+ },
1182
+ setModelIdOperation(t, e) {
1183
+ t.id = e.input.id;
1184
+ },
1185
+ setModelExtensionOperation(t, e) {
1186
+ t.extension = e.input.extension;
1187
+ },
1188
+ setModelDescriptionOperation(t, e) {
1189
+ t.description = e.input.description;
1190
+ },
1191
+ setAuthorNameOperation(t, e) {
1192
+ t.author = t.author || { name: "", website: null }, t.author.name = e.input.authorName;
1193
+ },
1194
+ setAuthorWebsiteOperation(t, e) {
1195
+ t.author = t.author || { name: "", website: null }, t.author.website = e.input.authorWebsite;
1196
+ }
1197
+ }, O = {
1198
+ addChangeLogItemOperation(t, e) {
1199
+ throw new Error(
1200
+ 'Reducer "addChangeLogItemOperation" not yet implemented'
1201
+ );
1202
+ },
1203
+ updateChangeLogItemOperation(t, e) {
1204
+ throw new Error(
1205
+ 'Reducer "updateChangeLogItemOperation" not yet implemented'
1206
+ );
1207
+ },
1208
+ deleteChangeLogItemOperation(t, e) {
1209
+ throw new Error(
1210
+ 'Reducer "deleteChangeLogItemOperation" not yet implemented'
1211
+ );
1212
+ },
1213
+ reorderChangeLogItemsOperation(t, e) {
1214
+ throw new Error(
1215
+ 'Reducer "reorderChangeLogItemsOperation" not yet implemented'
1216
+ );
1217
+ },
1218
+ releaseNewVersionOperation(t, e) {
1219
+ throw new Error(
1220
+ 'Reducer "releaseNewVersionOperation" not yet implemented'
1221
+ );
1222
+ }
1223
+ }, Qt = (t) => {
1224
+ const e = {};
1225
+ return t.forEach((r, n) => e[r] = n), (r, n) => (e[n.id] || 999999) - (e[r.id] || 999999);
1226
+ }, g = {
1227
+ addModuleOperation(t, e) {
1228
+ t.specifications[t.specifications.length - 1].modules.push({
1229
+ id: e.input.id,
1230
+ name: e.input.name,
1231
+ description: e.input.description || "",
1232
+ operations: []
1233
+ });
1234
+ },
1235
+ setModuleNameOperation(t, e) {
1236
+ const r = t.specifications[t.specifications.length - 1];
1237
+ for (let n = 0; n < r.modules.length; n++)
1238
+ r.modules[n].id === e.input.id && (r.modules[n].name = e.input.name || "");
1239
+ },
1240
+ setModuleDescriptionOperation(t, e) {
1241
+ const r = t.specifications[t.specifications.length - 1];
1242
+ for (let n = 0; n < r.modules.length; n++)
1243
+ r.modules[n].id === e.input.id && (r.modules[n].description = e.input.description || "");
1244
+ },
1245
+ deleteModuleOperation(t, e) {
1246
+ const r = t.specifications[t.specifications.length - 1];
1247
+ r.modules = r.modules.filter(
1248
+ (n) => n.id != e.input.id
1249
+ );
1250
+ },
1251
+ reorderModulesOperation(t, e) {
1252
+ t.specifications[t.specifications.length - 1].modules.sort(Qt(e.input.order));
1253
+ }
1254
+ }, Yt = (t) => {
1255
+ const e = {};
1256
+ return t.forEach((r, n) => e[r] = n), (r, n) => (e[n.id] || 999999) - (e[r.id] || 999999);
1257
+ }, d = {
1258
+ addOperationErrorOperation(t, e) {
1259
+ const r = t.specifications[t.specifications.length - 1];
1260
+ for (let n = 0; n < r.modules.length; n++)
1261
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1262
+ r.modules[n].operations[i].id == e.input.operationId && r.modules[n].operations[i].errors.push({
1263
+ id: e.input.id,
1264
+ name: e.input.errorName || "",
1265
+ code: e.input.errorCode || "",
1266
+ description: e.input.errorDescription || "",
1267
+ template: e.input.errorTemplate || ""
1268
+ });
1269
+ },
1270
+ setOperationErrorCodeOperation(t, e) {
1271
+ const r = t.specifications[t.specifications.length - 1];
1272
+ for (let n = 0; n < r.modules.length; n++)
1273
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1274
+ for (let s = 0; s < r.modules[n].operations[i].errors.length; s++)
1275
+ r.modules[n].operations[i].errors[s].id == e.input.id && (r.modules[n].operations[i].errors[s].code = e.input.errorCode || "");
1276
+ },
1277
+ setOperationErrorNameOperation(t, e) {
1278
+ const r = t.specifications[t.specifications.length - 1];
1279
+ for (let n = 0; n < r.modules.length; n++)
1280
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1281
+ for (let s = 0; s < r.modules[n].operations[i].errors.length; s++)
1282
+ r.modules[n].operations[i].errors[s].id == e.input.id && (r.modules[n].operations[i].errors[s].name = e.input.errorName || "");
1283
+ },
1284
+ setOperationErrorDescriptionOperation(t, e) {
1285
+ const r = t.specifications[t.specifications.length - 1];
1286
+ for (let n = 0; n < r.modules.length; n++)
1287
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1288
+ for (let s = 0; s < r.modules[n].operations[i].errors.length; s++)
1289
+ r.modules[n].operations[i].errors[s].id == e.input.id && (r.modules[n].operations[i].errors[s].description = e.input.errorDescription || "");
1290
+ },
1291
+ setOperationErrorTemplateOperation(t, e) {
1292
+ const r = t.specifications[t.specifications.length - 1];
1293
+ for (let n = 0; n < r.modules.length; n++)
1294
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1295
+ for (let s = 0; s < r.modules[n].operations[i].errors.length; s++)
1296
+ r.modules[n].operations[i].errors[s].id == e.input.id && (r.modules[n].operations[i].errors[s].template = e.input.errorTemplate || "");
1297
+ },
1298
+ deleteOperationErrorOperation(t, e) {
1299
+ const r = t.specifications[t.specifications.length - 1];
1300
+ for (let n = 0; n < r.modules.length; n++)
1301
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1302
+ r.modules[n].operations[i].errors = r.modules[n].operations[i].errors.filter((s) => s.id != e.input.id);
1303
+ },
1304
+ reorderOperationErrorsOperation(t, e) {
1305
+ const r = t.specifications[t.specifications.length - 1];
1306
+ for (let n = 0; n < r.modules.length; n++)
1307
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1308
+ r.modules[n].operations[i].id == e.input.operationId && r.modules[n].operations[i].errors.sort(
1309
+ Yt(e.input.order)
1310
+ );
1311
+ }
1312
+ }, Zt = (t) => {
1313
+ const e = {};
1314
+ return t.forEach((r, n) => e[r] = n), (r, n) => (e[n.id] || 999999) - (e[r.id] || 999999);
1315
+ }, b = {
1316
+ addOperationExampleOperation(t, e) {
1317
+ const r = t.specifications[t.specifications.length - 1];
1318
+ for (let n = 0; n < r.modules.length; n++)
1319
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1320
+ r.modules[n].operations[i].id == e.input.operationId && r.modules[n].operations[i].examples.push({
1321
+ id: e.input.id,
1322
+ value: e.input.example
1323
+ });
1324
+ },
1325
+ updateOperationExampleOperation(t, e) {
1326
+ const r = t.specifications[t.specifications.length - 1];
1327
+ for (let n = 0; n < r.modules.length; n++)
1328
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1329
+ for (let s = 0; s < r.modules[n].operations[i].examples.length; s++)
1330
+ r.modules[n].operations[i].examples[s].id == e.input.id && (r.modules[n].operations[i].examples[s].value = e.input.example);
1331
+ },
1332
+ deleteOperationExampleOperation(t, e) {
1333
+ const r = t.specifications[t.specifications.length - 1];
1334
+ for (let n = 0; n < r.modules.length; n++)
1335
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1336
+ r.modules[n].operations[i].examples = r.modules[n].operations[i].examples.filter(
1337
+ (s) => s.id != e.input.id
1338
+ );
1339
+ },
1340
+ reorderOperationExamplesOperation(t, e) {
1341
+ const r = t.specifications[t.specifications.length - 1];
1342
+ for (let n = 0; n < r.modules.length; n++)
1343
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1344
+ r.modules[n].operations[i].id == e.input.operationId && r.modules[n].operations[i].examples.sort(
1345
+ Zt(e.input.order)
1346
+ );
1347
+ }
1348
+ }, er = (t) => {
1349
+ const e = {};
1350
+ return t.forEach((r, n) => e[r] = n), (r, n) => (e[n.id] || 999999) - (e[r.id] || 999999);
1351
+ }, p = {
1352
+ addOperationOperation(t, e) {
1353
+ const r = t.specifications[t.specifications.length - 1];
1354
+ for (let n = 0; n < r.modules.length; n++)
1355
+ r.modules[n].id == e.input.moduleId && r.modules[n].operations.push({
1356
+ id: e.input.id,
1357
+ name: e.input.name,
1358
+ description: e.input.description || "",
1359
+ schema: e.input.schema || "",
1360
+ template: e.input.template || e.input.description || "",
1361
+ reducer: e.input.reducer || "",
1362
+ errors: [],
1363
+ examples: [],
1364
+ scope: e.input.scope || "global"
1365
+ });
1366
+ },
1367
+ setOperationNameOperation(t, e) {
1368
+ const r = t.specifications[t.specifications.length - 1];
1369
+ for (let n = 0; n < r.modules.length; n++)
1370
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1371
+ r.modules[n].operations[i].id == e.input.id && (r.modules[n].operations[i].name = e.input.name || "");
1372
+ },
1373
+ setOperationScopeOperation(t, e) {
1374
+ const r = t.specifications[t.specifications.length - 1];
1375
+ for (let n = 0; n < r.modules.length; n++)
1376
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1377
+ r.modules[n].operations[i].id == e.input.id && (r.modules[n].operations[i].scope = e.input.scope || "global");
1378
+ },
1379
+ setOperationSchemaOperation(t, e) {
1380
+ const r = t.specifications[t.specifications.length - 1];
1381
+ for (let n = 0; n < r.modules.length; n++)
1382
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1383
+ r.modules[n].operations[i].id == e.input.id && (r.modules[n].operations[i].schema = e.input.schema || "");
1384
+ },
1385
+ setOperationDescriptionOperation(t, e) {
1386
+ const r = t.specifications[t.specifications.length - 1];
1387
+ for (let n = 0; n < r.modules.length; n++)
1388
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1389
+ r.modules[n].operations[i].id == e.input.id && (r.modules[n].operations[i].description = e.input.description || "");
1390
+ },
1391
+ setOperationTemplateOperation(t, e) {
1392
+ const r = t.specifications[t.specifications.length - 1];
1393
+ for (let n = 0; n < r.modules.length; n++)
1394
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1395
+ r.modules[n].operations[i].id == e.input.id && (r.modules[n].operations[i].template = e.input.template || "");
1396
+ },
1397
+ setOperationReducerOperation(t, e) {
1398
+ const r = t.specifications[t.specifications.length - 1];
1399
+ for (let n = 0; n < r.modules.length; n++)
1400
+ for (let i = 0; i < r.modules[n].operations.length; i++)
1401
+ r.modules[n].operations[i].id == e.input.id && (r.modules[n].operations[i].reducer = e.input.reducer || "");
1402
+ },
1403
+ moveOperationOperation(t, e) {
1404
+ const r = [], n = t.specifications[t.specifications.length - 1];
1405
+ for (let i = 0; i < n.modules.length; i++)
1406
+ n.modules[i].operations = n.modules[i].operations.filter((s) => s.id == e.input.operationId ? (r.push(s), !1) : !0);
1407
+ for (let i = 0; i < n.modules.length; i++)
1408
+ n.modules[i].id == e.input.newModuleId && n.modules[i].operations.push(...r);
1409
+ },
1410
+ deleteOperationOperation(t, e) {
1411
+ const r = t.specifications[t.specifications.length - 1];
1412
+ for (let n = 0; n < r.modules.length; n++)
1413
+ r.modules[n].operations = r.modules[n].operations.filter((i) => i.id != e.input.id);
1414
+ },
1415
+ reorderModuleOperationsOperation(t, e) {
1416
+ const r = t.specifications[t.specifications.length - 1];
1417
+ for (let n = 0; n < r.modules.length; n++)
1418
+ r.modules[n].id == e.input.moduleId && r.modules[n].operations.sort(
1419
+ er(e.input.order)
1420
+ );
1421
+ }
1422
+ }, tr = (t) => {
1423
+ const e = {};
1424
+ return t.forEach((r, n) => e[r] = n), (r, n) => (e[n.id] || 999999) - (e[r.id] || 999999);
1425
+ }, E = {
1426
+ setStateSchemaOperation(t, e) {
1427
+ const r = t.specifications[t.specifications.length - 1];
1428
+ if (Object.keys(r.state).includes(e.input.scope))
1429
+ r.state[e.input.scope].schema = e.input.schema;
1430
+ else
1431
+ throw new Error(`Invalid scope: ${e.input.scope}`);
1432
+ },
1433
+ setInitialStateOperation(t, e) {
1434
+ const r = t.specifications[t.specifications.length - 1];
1435
+ if (Object.keys(r.state).includes(e.input.scope))
1436
+ r.state[e.input.scope].initialValue = e.input.initialValue;
1437
+ else
1438
+ throw new Error(`Invalid scope: ${e.input.scope}`);
1439
+ },
1440
+ addStateExampleOperation(t, e) {
1441
+ const r = t.specifications[t.specifications.length - 1];
1442
+ if (Object.keys(r.state).includes(e.input.scope))
1443
+ r.state[e.input.scope].examples.push({
1444
+ id: e.input.id,
1445
+ value: e.input.example
1446
+ });
1447
+ else
1448
+ throw new Error(`Invalid scope: ${e.input.scope}`);
1449
+ },
1450
+ updateStateExampleOperation(t, e) {
1451
+ const r = t.specifications[t.specifications.length - 1];
1452
+ if (!Object.keys(r.state).includes(e.input.scope))
1453
+ throw new Error(`Invalid scope: ${e.input.scope}`);
1454
+ const n = r.state[e.input.scope].examples;
1455
+ for (let i = 0; i < n.length; i++)
1456
+ n[i].id == e.input.id && (n[i].value = e.input.newExample);
1457
+ },
1458
+ deleteStateExampleOperation(t, e) {
1459
+ const r = t.specifications[t.specifications.length - 1];
1460
+ if (Object.keys(r.state).includes(e.input.scope))
1461
+ r.state[e.input.scope].examples = r.state[e.input.scope].examples.filter((n) => n.id != e.input.id);
1462
+ else
1463
+ throw new Error(`Invalid scope: ${e.input.scope}`);
1464
+ },
1465
+ reorderStateExamplesOperation(t, e) {
1466
+ const r = t.specifications[t.specifications.length - 1];
1467
+ if (Object.keys(r.state).includes(e.input.scope))
1468
+ r.state[e.input.scope].examples.sort(tr(e.input.order));
1469
+ else
1470
+ throw new Error(`Invalid scope: ${e.input.scope}`);
1471
+ }
1472
+ }, rr = (t, e) => {
1473
+ if (Mt(e))
1474
+ return t;
1475
+ switch (e.type) {
1476
+ case "SET_MODEL_NAME":
1477
+ Q().parse(e.input), m.setModelNameOperation(t.global, e);
1478
+ break;
1479
+ case "SET_MODEL_ID":
1480
+ K().parse(e.input), m.setModelIdOperation(t.global, e);
1481
+ break;
1482
+ case "SET_MODEL_EXTENSION":
1483
+ J().parse(e.input), m.setModelExtensionOperation(t.global, e);
1484
+ break;
1485
+ case "SET_MODEL_DESCRIPTION":
1486
+ q().parse(e.input), m.setModelDescriptionOperation(t.global, e);
1487
+ break;
1488
+ case "SET_AUTHOR_NAME":
1489
+ W().parse(e.input), m.setAuthorNameOperation(t.global, e);
1490
+ break;
1491
+ case "SET_AUTHOR_WEBSITE":
1492
+ B().parse(e.input), m.setAuthorWebsiteOperation(t.global, e);
1493
+ break;
1494
+ case "ADD_CHANGE_LOG_ITEM":
1495
+ x().parse(e.input), O.addChangeLogItemOperation(t.global, e);
1496
+ break;
1497
+ case "UPDATE_CHANGE_LOG_ITEM":
1498
+ ce().parse(e.input), O.updateChangeLogItemOperation(
1499
+ t.global,
1500
+ e
1501
+ );
1502
+ break;
1503
+ case "DELETE_CHANGE_LOG_ITEM":
1504
+ C().parse(e.input), O.deleteChangeLogItemOperation(
1505
+ t.global,
1506
+ e
1507
+ );
1508
+ break;
1509
+ case "REORDER_CHANGE_LOG_ITEMS":
1510
+ F().parse(e.input), O.reorderChangeLogItemsOperation(
1511
+ t.global,
1512
+ e
1513
+ );
1514
+ break;
1515
+ case "RELEASE_NEW_VERSION":
1516
+ if (Object.keys(e.input).length > 0)
1517
+ throw new Error(
1518
+ "Expected empty input for action RELEASE_NEW_VERSION"
1519
+ );
1520
+ O.releaseNewVersionOperation(t.global, e);
1521
+ break;
1522
+ case "ADD_MODULE":
1523
+ A().parse(e.input), g.addModuleOperation(t.global, e);
1524
+ break;
1525
+ case "SET_MODULE_NAME":
1526
+ Z().parse(e.input), g.setModuleNameOperation(t.global, e);
1527
+ break;
1528
+ case "SET_MODULE_DESCRIPTION":
1529
+ Y().parse(e.input), g.setModuleDescriptionOperation(t.global, e);
1530
+ break;
1531
+ case "DELETE_MODULE":
1532
+ j().parse(e.input), g.deleteModuleOperation(t.global, e);
1533
+ break;
1534
+ case "REORDER_MODULES":
1535
+ V().parse(e.input), g.reorderModulesOperation(t.global, e);
1536
+ break;
1537
+ case "ADD_OPERATION_ERROR":
1538
+ M().parse(e.input), d.addOperationErrorOperation(
1539
+ t.global,
1540
+ e
1541
+ );
1542
+ break;
1543
+ case "SET_OPERATION_ERROR_CODE":
1544
+ te().parse(e.input), d.setOperationErrorCodeOperation(
1545
+ t.global,
1546
+ e
1547
+ );
1548
+ break;
1549
+ case "SET_OPERATION_ERROR_NAME":
1550
+ oe().parse(e.input), d.setOperationErrorNameOperation(
1551
+ t.global,
1552
+ e
1553
+ );
1554
+ break;
1555
+ case "SET_OPERATION_ERROR_DESCRIPTION":
1556
+ re().parse(e.input), d.setOperationErrorDescriptionOperation(
1557
+ t.global,
1558
+ e
1559
+ );
1560
+ break;
1561
+ case "SET_OPERATION_ERROR_TEMPLATE":
1562
+ ne().parse(e.input), d.setOperationErrorTemplateOperation(
1563
+ t.global,
1564
+ e
1565
+ );
1566
+ break;
1567
+ case "DELETE_OPERATION_ERROR":
1568
+ y().parse(e.input), d.deleteOperationErrorOperation(
1569
+ t.global,
1570
+ e
1571
+ );
1572
+ break;
1573
+ case "REORDER_OPERATION_ERRORS":
1574
+ X().parse(e.input), d.reorderOperationErrorsOperation(
1575
+ t.global,
1576
+ e
1577
+ );
1578
+ break;
1579
+ case "ADD_OPERATION_EXAMPLE":
1580
+ D().parse(e.input), b.addOperationExampleOperation(
1581
+ t.global,
1582
+ e
1583
+ );
1584
+ break;
1585
+ case "UPDATE_OPERATION_EXAMPLE":
1586
+ de().parse(e.input), b.updateOperationExampleOperation(
1587
+ t.global,
1588
+ e
1589
+ );
1590
+ break;
1591
+ case "DELETE_OPERATION_EXAMPLE":
1592
+ w().parse(e.input), b.deleteOperationExampleOperation(
1593
+ t.global,
1594
+ e
1595
+ );
1596
+ break;
1597
+ case "REORDER_OPERATION_EXAMPLES":
1598
+ H().parse(e.input), b.reorderOperationExamplesOperation(
1599
+ t.global,
1600
+ e
1601
+ );
1602
+ break;
1603
+ case "ADD_OPERATION":
1604
+ N().parse(e.input), p.addOperationOperation(t.global, e);
1605
+ break;
1606
+ case "SET_OPERATION_NAME":
1607
+ ie().parse(e.input), p.setOperationNameOperation(t.global, e);
1608
+ break;
1609
+ case "SET_OPERATION_SCOPE":
1610
+ Ne().parse(e.input), p.setOperationScopeOperation(t.global, e);
1611
+ break;
1612
+ case "SET_OPERATION_SCHEMA":
1613
+ ae().parse(e.input), p.setOperationSchemaOperation(t.global, e);
1614
+ break;
1615
+ case "SET_OPERATION_DESCRIPTION":
1616
+ ee().parse(e.input), p.setOperationDescriptionOperation(
1617
+ t.global,
1618
+ e
1619
+ );
1620
+ break;
1621
+ case "SET_OPERATION_TEMPLATE":
1622
+ pe().parse(e.input), p.setOperationTemplateOperation(
1623
+ t.global,
1624
+ e
1625
+ );
1626
+ break;
1627
+ case "SET_OPERATION_REDUCER":
1628
+ se().parse(e.input), p.setOperationReducerOperation(t.global, e);
1629
+ break;
1630
+ case "MOVE_OPERATION":
1631
+ v().parse(e.input), p.moveOperationOperation(t.global, e);
1632
+ break;
1633
+ case "DELETE_OPERATION":
1634
+ k().parse(e.input), p.deleteOperationOperation(t.global, e);
1635
+ break;
1636
+ case "REORDER_MODULE_OPERATIONS":
1637
+ $().parse(e.input), p.reorderModuleOperationsOperation(
1638
+ t.global,
1639
+ e
1640
+ );
1641
+ break;
1642
+ case "SET_STATE_SCHEMA":
1643
+ le().parse(e.input), E.setStateSchemaOperation(t.global, e);
1644
+ break;
1645
+ case "SET_INITIAL_STATE":
1646
+ z().parse(e.input), E.setInitialStateOperation(t.global, e);
1647
+ break;
1648
+ case "ADD_STATE_EXAMPLE":
1649
+ L().parse(e.input), E.addStateExampleOperation(t.global, e);
1650
+ break;
1651
+ case "UPDATE_STATE_EXAMPLE":
1652
+ ue().parse(e.input), E.updateStateExampleOperation(t.global, e);
1653
+ break;
1654
+ case "DELETE_STATE_EXAMPLE":
1655
+ U().parse(e.input), E.deleteStateExampleOperation(t.global, e);
1656
+ break;
1657
+ case "REORDER_STATE_EXAMPLES":
1658
+ G().parse(e.input), E.reorderStateExamplesOperation(t.global, e);
1659
+ break;
1660
+ default:
1661
+ return t;
1662
+ }
1663
+ }, f = At(rr), or = {
1664
+ id: "",
1665
+ name: "",
1666
+ extension: "",
1667
+ description: "",
1668
+ author: {
1669
+ name: "",
1670
+ website: ""
1671
+ },
1672
+ specifications: [
1673
+ {
1674
+ version: 1,
1675
+ changeLog: [],
1676
+ state: {
1677
+ global: {
1678
+ schema: "",
1679
+ initialValue: "",
1680
+ examples: []
1681
+ },
1682
+ local: {
1683
+ schema: "",
1684
+ initialValue: "",
1685
+ examples: []
1686
+ }
1687
+ },
1688
+ modules: []
1689
+ }
1690
+ ]
1691
+ }, nr = {}, S = {
1692
+ fileExtension: "phdm",
1693
+ createState(t) {
1694
+ return {
1695
+ global: { ...or, ...t == null ? void 0 : t.global },
1696
+ local: { ...nr, ...t == null ? void 0 : t.local }
1697
+ };
1698
+ },
1699
+ createExtendedState(t) {
1700
+ return Dt(
1701
+ { ...t, documentType: "powerhouse/document-model" },
1702
+ S.createState
1703
+ );
1704
+ },
1705
+ createDocument(t) {
1706
+ return Nt(
1707
+ S.createExtendedState(t),
1708
+ S.createState
1709
+ );
1710
+ },
1711
+ saveToFile(t, e, r) {
1712
+ return Lt(t, e, "phdm", r);
1713
+ },
1714
+ saveToFileHandle(t, e) {
1715
+ return Pt(t, e);
1716
+ },
1717
+ loadFromFile(t) {
1718
+ return Ct(t, f);
1719
+ },
1720
+ loadFromInput(t) {
1721
+ return jt(t, f);
1722
+ }
1723
+ }, Pe = (t) => a(
1724
+ "SET_MODEL_NAME",
1725
+ { ...t }
1726
+ ), Ce = (t) => a(
1727
+ "SET_MODEL_ID",
1728
+ { ...t }
1729
+ ), je = (t) => a(
1730
+ "SET_MODEL_EXTENSION",
1731
+ { ...t }
1732
+ ), ye = (t) => a(
1733
+ "SET_MODEL_DESCRIPTION",
1734
+ { ...t }
1735
+ ), we = (t) => a(
1736
+ "SET_AUTHOR_NAME",
1737
+ { ...t }
1738
+ ), ke = (t) => a(
1739
+ "SET_AUTHOR_WEBSITE",
1740
+ { ...t }
1741
+ );
1742
+ class ir extends c {
1743
+ setModelName(e, r) {
1744
+ return this.dispatch(Pe(e), r);
1745
+ }
1746
+ setModelId(e, r) {
1747
+ return this.dispatch(Ce(e), r);
1748
+ }
1749
+ setModelExtension(e, r) {
1750
+ return this.dispatch(je(e), r);
1751
+ }
1752
+ setModelDescription(e, r) {
1753
+ return this.dispatch(ye(e), r);
1754
+ }
1755
+ setAuthorName(e, r) {
1756
+ return this.dispatch(we(e), r);
1757
+ }
1758
+ setAuthorWebsite(e, r) {
1759
+ return this.dispatch(ke(e), r);
1760
+ }
1761
+ }
1762
+ const Ue = (t) => a(
1763
+ "ADD_CHANGE_LOG_ITEM",
1764
+ { ...t }
1765
+ ), ve = (t) => a(
1766
+ "UPDATE_CHANGE_LOG_ITEM",
1767
+ { ...t }
1768
+ ), Fe = (t) => a(
1769
+ "DELETE_CHANGE_LOG_ITEM",
1770
+ { ...t }
1771
+ ), $e = (t) => a(
1772
+ "REORDER_CHANGE_LOG_ITEMS",
1773
+ { ...t }
1774
+ ), Ve = () => a(
1775
+ "RELEASE_NEW_VERSION"
1776
+ );
1777
+ class sr extends c {
1778
+ addChangeLogItem(e, r) {
1779
+ return this.dispatch(Ue(e), r);
1780
+ }
1781
+ updateChangeLogItem(e, r) {
1782
+ return this.dispatch(ve(e), r);
1783
+ }
1784
+ deleteChangeLogItem(e, r) {
1785
+ return this.dispatch(Fe(e), r);
1786
+ }
1787
+ reorderChangeLogItems(e, r) {
1788
+ return this.dispatch($e(e), r);
1789
+ }
1790
+ releaseNewVersion(e) {
1791
+ return this.dispatch(Ve(), e);
1792
+ }
1793
+ }
1794
+ const Xe = (t) => a(
1795
+ "ADD_MODULE",
1796
+ { ...t }
1797
+ ), He = (t) => a(
1798
+ "SET_MODULE_NAME",
1799
+ { ...t }
1800
+ ), Ge = (t) => a(
1801
+ "SET_MODULE_DESCRIPTION",
1802
+ { ...t }
1803
+ ), We = (t) => a(
1804
+ "DELETE_MODULE",
1805
+ { ...t }
1806
+ ), Be = (t) => a(
1807
+ "REORDER_MODULES",
1808
+ { ...t }
1809
+ );
1810
+ class ar extends c {
1811
+ addModule(e, r) {
1812
+ return this.dispatch(Xe(e), r);
1813
+ }
1814
+ setModuleName(e, r) {
1815
+ return this.dispatch(He(e), r);
1816
+ }
1817
+ setModuleDescription(e, r) {
1818
+ return this.dispatch(Ge(e), r);
1819
+ }
1820
+ deleteModule(e, r) {
1821
+ return this.dispatch(We(e), r);
1822
+ }
1823
+ reorderModules(e, r) {
1824
+ return this.dispatch(Be(e), r);
1825
+ }
1826
+ }
1827
+ const ze = (t) => a(
1828
+ "ADD_OPERATION_ERROR",
1829
+ { ...t }
1830
+ ), qe = (t) => a(
1831
+ "SET_OPERATION_ERROR_CODE",
1832
+ { ...t }
1833
+ ), Je = (t) => a(
1834
+ "SET_OPERATION_ERROR_NAME",
1835
+ { ...t }
1836
+ ), Ke = (t) => a(
1837
+ "SET_OPERATION_ERROR_DESCRIPTION",
1838
+ { ...t }
1839
+ ), Qe = (t) => a(
1840
+ "SET_OPERATION_ERROR_TEMPLATE",
1841
+ { ...t }
1842
+ ), Ye = (t) => a(
1843
+ "DELETE_OPERATION_ERROR",
1844
+ { ...t }
1845
+ ), Ze = (t) => a(
1846
+ "REORDER_OPERATION_ERRORS",
1847
+ { ...t }
1848
+ );
1849
+ class pr extends c {
1850
+ addOperationError(e, r) {
1851
+ return this.dispatch(ze(e), r);
1852
+ }
1853
+ setOperationErrorCode(e, r) {
1854
+ return this.dispatch(qe(e), r);
1855
+ }
1856
+ setOperationErrorName(e, r) {
1857
+ return this.dispatch(Je(e), r);
1858
+ }
1859
+ setOperationErrorDescription(e, r) {
1860
+ return this.dispatch(Ke(e), r);
1861
+ }
1862
+ setOperationErrorTemplate(e, r) {
1863
+ return this.dispatch(Qe(e), r);
1864
+ }
1865
+ deleteOperationError(e, r) {
1866
+ return this.dispatch(Ye(e), r);
1867
+ }
1868
+ reorderOperationErrors(e, r) {
1869
+ return this.dispatch(Ze(e), r);
1870
+ }
1871
+ }
1872
+ const et = (t) => a(
1873
+ "ADD_OPERATION_EXAMPLE",
1874
+ { ...t }
1875
+ ), tt = (t) => a(
1876
+ "UPDATE_OPERATION_EXAMPLE",
1877
+ { ...t }
1878
+ ), rt = (t) => a(
1879
+ "DELETE_OPERATION_EXAMPLE",
1880
+ { ...t }
1881
+ ), ot = (t) => a(
1882
+ "REORDER_OPERATION_EXAMPLES",
1883
+ { ...t }
1884
+ );
1885
+ class lr extends c {
1886
+ addOperationExample(e, r) {
1887
+ return this.dispatch(et(e), r);
1888
+ }
1889
+ updateOperationExample(e, r) {
1890
+ return this.dispatch(tt(e), r);
1891
+ }
1892
+ deleteOperationExample(e, r) {
1893
+ return this.dispatch(rt(e), r);
1894
+ }
1895
+ reorderOperationExamples(e, r) {
1896
+ return this.dispatch(ot(e), r);
1897
+ }
1898
+ }
1899
+ const nt = (t) => a(
1900
+ "ADD_OPERATION",
1901
+ { ...t }
1902
+ ), it = (t) => a(
1903
+ "SET_OPERATION_NAME",
1904
+ { ...t }
1905
+ ), st = (t) => a(
1906
+ "SET_OPERATION_SCOPE",
1907
+ { ...t }
1908
+ ), at = (t) => a(
1909
+ "SET_OPERATION_SCHEMA",
1910
+ { ...t }
1911
+ ), pt = (t) => a(
1912
+ "SET_OPERATION_DESCRIPTION",
1913
+ { ...t }
1914
+ ), lt = (t) => a(
1915
+ "SET_OPERATION_TEMPLATE",
1916
+ { ...t }
1917
+ ), ct = (t) => a(
1918
+ "SET_OPERATION_REDUCER",
1919
+ { ...t }
1920
+ ), dt = (t) => a(
1921
+ "MOVE_OPERATION",
1922
+ { ...t }
1923
+ ), ut = (t) => a(
1924
+ "DELETE_OPERATION",
1925
+ { ...t }
1926
+ ), mt = (t) => a(
1927
+ "REORDER_MODULE_OPERATIONS",
1928
+ { ...t }
1929
+ );
1930
+ class cr extends c {
1931
+ addOperation(e, r) {
1932
+ return this.dispatch(nt(e), r);
1933
+ }
1934
+ setOperationName(e, r) {
1935
+ return this.dispatch(it(e), r);
1936
+ }
1937
+ setOperationScope(e, r) {
1938
+ return this.dispatch(st(e), r);
1939
+ }
1940
+ setOperationSchema(e, r) {
1941
+ return this.dispatch(at(e), r);
1942
+ }
1943
+ setOperationDescription(e, r) {
1944
+ return this.dispatch(pt(e), r);
1945
+ }
1946
+ setOperationTemplate(e, r) {
1947
+ return this.dispatch(lt(e), r);
1948
+ }
1949
+ setOperationReducer(e, r) {
1950
+ return this.dispatch(ct(e), r);
1951
+ }
1952
+ moveOperation(e, r) {
1953
+ return this.dispatch(dt(e), r);
1954
+ }
1955
+ deleteOperation(e, r) {
1956
+ return this.dispatch(ut(e), r);
1957
+ }
1958
+ reorderModuleOperations(e, r) {
1959
+ return this.dispatch(mt(e), r);
1960
+ }
1961
+ }
1962
+ const Et = (t) => a(
1963
+ "SET_STATE_SCHEMA",
1964
+ { ...t }
1965
+ ), ht = (t) => a(
1966
+ "SET_INITIAL_STATE",
1967
+ { ...t }
1968
+ ), Ot = (t) => a(
1969
+ "ADD_STATE_EXAMPLE",
1970
+ { ...t }
1971
+ ), gt = (t) => a(
1972
+ "UPDATE_STATE_EXAMPLE",
1973
+ { ...t }
1974
+ ), St = (t) => a(
1975
+ "DELETE_STATE_EXAMPLE",
1976
+ { ...t }
1977
+ ), ft = (t) => a(
1978
+ "REORDER_STATE_EXAMPLES",
1979
+ { ...t }
1980
+ );
1981
+ class dr extends c {
1982
+ setStateSchema(e, r) {
1983
+ return this.dispatch(Et(e), r);
1984
+ }
1985
+ setInitialState(e, r) {
1986
+ return this.dispatch(ht(e), r);
1987
+ }
1988
+ addStateExample(e, r) {
1989
+ return this.dispatch(Ot(e), r);
1990
+ }
1991
+ updateStateExample(e, r) {
1992
+ return this.dispatch(gt(e), r);
1993
+ }
1994
+ deleteStateExample(e, r) {
1995
+ return this.dispatch(St(e), r);
1996
+ }
1997
+ reorderStateExamples(e, r) {
1998
+ return this.dispatch(ft(e), r);
1999
+ }
2000
+ }
2001
+ var h;
2002
+ let me = (h = class extends c {
2003
+ constructor(e, r) {
2004
+ super(f, S.createDocument(e), r);
2005
+ }
2006
+ saveToFile(e, r) {
2007
+ return super.saveToFile(e, h.fileExtension, r);
2008
+ }
2009
+ loadFromFile(e) {
2010
+ return super.loadFromFile(e);
2011
+ }
2012
+ static async fromFile(e) {
2013
+ const r = new this();
2014
+ return await r.loadFromFile(e), r;
2015
+ }
2016
+ }, Ee(h, "fileExtension", "phdm"), h);
2017
+ yt(me, [
2018
+ ir,
2019
+ sr,
2020
+ ar,
2021
+ pr,
2022
+ lr,
2023
+ cr,
2024
+ dr
2025
+ ]);
2026
+ const ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2027
+ __proto__: null,
2028
+ addChangeLogItem: Ue,
2029
+ addModule: Xe,
2030
+ addOperation: nt,
2031
+ addOperationError: ze,
2032
+ addOperationExample: et,
2033
+ addStateExample: Ot,
2034
+ deleteChangeLogItem: Fe,
2035
+ deleteModule: We,
2036
+ deleteOperation: ut,
2037
+ deleteOperationError: Ye,
2038
+ deleteOperationExample: rt,
2039
+ deleteStateExample: St,
2040
+ moveOperation: dt,
2041
+ releaseNewVersion: Ve,
2042
+ reorderChangeLogItems: $e,
2043
+ reorderModuleOperations: mt,
2044
+ reorderModules: Be,
2045
+ reorderOperationErrors: Ze,
2046
+ reorderOperationExamples: ot,
2047
+ reorderStateExamples: ft,
2048
+ setAuthorName: we,
2049
+ setAuthorWebsite: ke,
2050
+ setInitialState: ht,
2051
+ setModelDescription: ye,
2052
+ setModelExtension: je,
2053
+ setModelId: Ce,
2054
+ setModelName: Pe,
2055
+ setModuleDescription: Ge,
2056
+ setModuleName: He,
2057
+ setOperationDescription: pt,
2058
+ setOperationErrorCode: qe,
2059
+ setOperationErrorDescription: Ke,
2060
+ setOperationErrorName: Je,
2061
+ setOperationErrorTemplate: Qe,
2062
+ setOperationName: it,
2063
+ setOperationReducer: ct,
2064
+ setOperationSchema: at,
2065
+ setOperationScope: st,
2066
+ setOperationTemplate: lt,
2067
+ setStateSchema: Et,
2068
+ updateChangeLogItem: ve,
2069
+ updateOperationExample: tt,
2070
+ updateStateExample: gt
2071
+ }, Symbol.toStringTag, { value: "Module" })), bt = me, _t = { ...S, ...Bt }, It = { ...wt, ...ur }, mr = {
2072
+ Document: bt,
2073
+ reducer: f,
2074
+ actions: It,
2075
+ utils: _t,
2076
+ documentModel: Ie
2077
+ }, Tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2078
+ __proto__: null,
2079
+ Document: bt,
2080
+ DocumentModel: me,
2081
+ actions: It,
2082
+ documentModel: Ie,
2083
+ module: mr,
2084
+ reducer: f,
2085
+ utils: _t,
2086
+ validateInitialState: fe,
2087
+ validateModule: T,
2088
+ validateModuleOperation: R,
2089
+ validateModules: _e,
2090
+ validateStateSchemaName: be,
2091
+ z: Kt
2092
+ }, Symbol.toStringTag, { value: "Module" }));
2093
+ export {
2094
+ Tr as D,
2095
+ me as a,
2096
+ bt as b,
2097
+ It as c,
2098
+ Ie as d,
2099
+ be as e,
2100
+ _e as f,
2101
+ T as g,
2102
+ R as h,
2103
+ mr as m,
2104
+ f as r,
2105
+ _t as u,
2106
+ fe as v,
2107
+ Kt as z
2108
+ };