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