@openleaf-editor/core 0.1.0-beta.1 → 0.1.0-beta.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 (58) hide show
  1. package/dist/autolink.d.ts +12 -0
  2. package/dist/autolink.d.ts.map +1 -0
  3. package/dist/autolink.js +98 -0
  4. package/dist/autolink.js.map +1 -0
  5. package/dist/commands.d.ts +69 -2
  6. package/dist/commands.d.ts.map +1 -1
  7. package/dist/commands.js +464 -18
  8. package/dist/commands.js.map +1 -1
  9. package/dist/css.d.ts +61 -9
  10. package/dist/css.d.ts.map +1 -1
  11. package/dist/css.js +315 -13
  12. package/dist/css.js.map +1 -1
  13. package/dist/embed.d.ts +52 -0
  14. package/dist/embed.d.ts.map +1 -0
  15. package/dist/embed.js +116 -0
  16. package/dist/embed.js.map +1 -0
  17. package/dist/extensions.d.ts.map +1 -1
  18. package/dist/extensions.js +22 -15
  19. package/dist/extensions.js.map +1 -1
  20. package/dist/formats.d.ts +44 -0
  21. package/dist/formats.d.ts.map +1 -0
  22. package/dist/formats.js +111 -0
  23. package/dist/formats.js.map +1 -0
  24. package/dist/index.d.ts +9 -3
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +14 -6
  27. package/dist/index.js.map +1 -1
  28. package/dist/keymap.d.ts.map +1 -1
  29. package/dist/keymap.js +6 -3
  30. package/dist/keymap.js.map +1 -1
  31. package/dist/noneditable.d.ts +14 -0
  32. package/dist/noneditable.d.ts.map +1 -0
  33. package/dist/noneditable.js +93 -0
  34. package/dist/noneditable.js.map +1 -0
  35. package/dist/preserve.d.ts +45 -0
  36. package/dist/preserve.d.ts.map +1 -1
  37. package/dist/preserve.js +113 -34
  38. package/dist/preserve.js.map +1 -1
  39. package/dist/schema.d.ts.map +1 -1
  40. package/dist/schema.js +211 -60
  41. package/dist/schema.js.map +1 -1
  42. package/dist/structure.d.ts +44 -0
  43. package/dist/structure.d.ts.map +1 -0
  44. package/dist/structure.js +379 -0
  45. package/dist/structure.js.map +1 -0
  46. package/dist/tables.d.ts +13 -0
  47. package/dist/tables.d.ts.map +1 -1
  48. package/dist/tables.js +224 -19
  49. package/dist/tables.js.map +1 -1
  50. package/dist/tokens.d.ts +28 -0
  51. package/dist/tokens.d.ts.map +1 -0
  52. package/dist/tokens.js +68 -0
  53. package/dist/tokens.js.map +1 -0
  54. package/dist/visual-aids.d.ts +10 -0
  55. package/dist/visual-aids.d.ts.map +1 -0
  56. package/dist/visual-aids.js +61 -0
  57. package/dist/visual-aids.js.map +1 -0
  58. package/package.json +3 -2
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Honour `contenteditable="false"` on stored markup.
3
+ *
4
+ * The attribute already round-trips as carried residue. Without this plugin the
5
+ * browser will often still let a caret in, and ProseMirror will then "correct"
6
+ * the typing on the next transaction -- which looks like the editor eating
7
+ * keystrokes. Filtering those transactions, and marking the node in the view,
8
+ * is what makes a locked region actually locked.
9
+ */
10
+ import { Plugin, PluginKey } from 'prosemirror-state';
11
+ import { Decoration, DecorationSet } from 'prosemirror-view';
12
+ import { CARRIED_ATTR } from './extensions.js';
13
+ const key = new PluginKey('openleaf-noneditable');
14
+ export function isNonEditableNode(node) {
15
+ const carried = node.attrs[CARRIED_ATTR];
16
+ const value = carried?.['contenteditable'];
17
+ return Boolean(value && value.toLowerCase() === 'false');
18
+ }
19
+ /** True when a change sits *inside* a locked node, not when the node itself is deleted. */
20
+ function editsLockedInterior(doc, start, end) {
21
+ // Clamped rather than trusted. A throw from here escapes `filterTransaction`
22
+ // and takes the whole transaction with it, so one bad range does not read as
23
+ // "this edit is not allowed" -- it reads as the editor ignoring the command.
24
+ const from = Math.max(0, Math.min(start, doc.content.size));
25
+ const to = Math.max(from, Math.min(end, doc.content.size));
26
+ let blocked = false;
27
+ doc.nodesBetween(from, to, (node, pos) => {
28
+ if (!isNonEditableNode(node))
29
+ return true;
30
+ const start = pos;
31
+ const end = pos + node.nodeSize;
32
+ if (from > start && to < end)
33
+ blocked = true;
34
+ return false;
35
+ });
36
+ return blocked;
37
+ }
38
+ export function nonEditablePlugin() {
39
+ return new Plugin({
40
+ key,
41
+ /**
42
+ * Refuse a transaction that edits the inside of a locked node.
43
+ *
44
+ * Each step's map reports positions in the document *that step* applied to,
45
+ * which for every step after the first is not `state.doc`. Reading the
46
+ * original document with those coordinates walks off the end of it as soon
47
+ * as a transaction has more than one step and the earlier ones grow the
48
+ * document -- `nodesBetween` then throws, the throw escapes here, and
49
+ * ProseMirror drops the transaction. The symptom was a toolbar button doing
50
+ * nothing at all: inserting a table column after inserting a row produces
51
+ * exactly that shape, and the error was swallowed by the toolbar's guard.
52
+ *
53
+ * So each range is mapped back through the steps before it first.
54
+ */
55
+ filterTransaction(tr, state) {
56
+ if (!tr.docChanged)
57
+ return true;
58
+ let blocked = false;
59
+ for (let i = 0; i < tr.steps.length; i += 1) {
60
+ if (blocked)
61
+ break;
62
+ const step = tr.steps[i];
63
+ if (!step)
64
+ continue;
65
+ const back = tr.mapping.slice(0, i).invert();
66
+ step.getMap().forEach((start, end) => {
67
+ if (blocked)
68
+ return;
69
+ if (editsLockedInterior(state.doc, back.map(start, -1), back.map(end, 1))) {
70
+ blocked = true;
71
+ }
72
+ });
73
+ }
74
+ return !blocked;
75
+ },
76
+ props: {
77
+ decorations(state) {
78
+ const decorations = [];
79
+ state.doc.descendants((node, pos) => {
80
+ if (!isNonEditableNode(node))
81
+ return true;
82
+ decorations.push(Decoration.node(pos, pos + node.nodeSize, {
83
+ class: 'ol-noneditable',
84
+ contenteditable: 'false',
85
+ }));
86
+ return false;
87
+ });
88
+ return DecorationSet.create(state.doc, decorations);
89
+ },
90
+ },
91
+ });
92
+ }
93
+ //# sourceMappingURL=noneditable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noneditable.js","sourceRoot":"","sources":["../src/noneditable.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,mBA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AAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;oBAClC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC;wBAAE,OAAO,IAAI,CAAA;oBACzC,WAAW,CAAC,IAAI,CACd,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC,QAAQ,EAAE;wBACxC,KAAK,EAAE,gBAAgB;wBACvB,eAAe,EAAE,OAAO;qBACzB,CAAC,CACH,CAAA;oBACD,OAAO,KAAK,CAAA;gBACd,CAAC,CAAC,CAAA;gBACF,OAAO,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;YACrD,CAAC;SACF;KACF,CAAC,CAAA;AACJ,CAAC"}
@@ -27,6 +27,34 @@
27
27
  * and is preserved intact.
28
28
  */
29
29
  import type { NodeSpec } from 'prosemirror-model';
30
+ /**
31
+ * `<source>` and `<track>`: media children the schema stores as markup rather
32
+ * than as nodes, so they do not count as content when deciding what to keep.
33
+ *
34
+ * Lives here because this module owns the "keep it whole or claim it" decision,
35
+ * and `structure.ts` asks the same question when it reads a media element.
36
+ */
37
+ export declare const MEDIA_FURNITURE_TAGS: ReadonlySet<string>;
38
+ /**
39
+ * True when a media element holds content its node cannot carry.
40
+ *
41
+ * Video and audio are atoms whose only modelled children are `<source>` and
42
+ * `<track>`, so fallback content -- "Download <a href=...>the video</a>", shown
43
+ * by a browser that cannot play the file -- has nowhere to live on the node.
44
+ */
45
+ export declare function hasMediaFallback(el: Element): boolean;
46
+ /**
47
+ * Scrub markup before it is stored for preservation.
48
+ *
49
+ * Preserving an element verbatim means preserving its attributes verbatim, and
50
+ * `<div class="callout" onclick="steal()">` is not something an author needs
51
+ * kept. Works on a clone so the live parse tree is untouched.
52
+ *
53
+ * Exported because the table schema stores `<caption>` and `<colgroup>` the same
54
+ * way, for the same reason, and a second scrubber that drifted from this one
55
+ * would be a hole in exactly the code path that exists to close holes.
56
+ */
57
+ export declare function scrub(el: Element): string;
30
58
  /**
31
59
  * True when this element can be unwrapped without losing information.
32
60
  *
@@ -39,6 +67,23 @@ import type { NodeSpec } from 'prosemirror-model';
39
67
  export declare function isLosslesslyUnwrappable(el: Element): boolean;
40
68
  /** Run `fn` with preserved-node serialization targeting this Document. */
41
69
  export declare function withSerializationDocument<T>(doc: Document, fn: () => T): T;
70
+ /**
71
+ * True while `serializeHtml` is running.
72
+ *
73
+ * A node whose `toDOM` needs to render differently for the editor than for the
74
+ * saved HTML has no other way to tell which one it is building. The table spec
75
+ * needs exactly that: a preserved `<caption>` must be `contenteditable="false"`
76
+ * on screen, because it sits inside the editable area but outside the node's
77
+ * `contentDOM`, and letting a caret into it means typing that ProseMirror will
78
+ * silently revert. That attribute must NOT reach the saved HTML, where it would
79
+ * be our editor scribbling on the author's markup.
80
+ *
81
+ * Stripping it afterwards was the other option and is worse: it cannot tell the
82
+ * attribute it just added from the same attribute in somebody's document -- the
83
+ * collision the preserved-element WeakSet above exists to avoid. Not emitting it
84
+ * at all has no such failure mode.
85
+ */
86
+ export declare function isSerializing(): boolean;
42
87
  /**
43
88
  * The Document that serialization should build into.
44
89
  *
@@ -1 +1 @@
1
- {"version":3,"file":"preserve.d.ts","sourceRoot":"","sources":["../src/preserve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAwGjD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAyC5D;AAoBD,0EAA0E;AAC1E,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAQ1E;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,QAAQ,CAE9C;AAwCD,kFAAkF;AAClF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,GAAG,OAAO,CAK/D;AAeD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,QA4B1B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,QA4B3B,CAAA"}
1
+ {"version":3,"file":"preserve.d.ts","sourceRoot":"","sources":["../src/preserve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AA8CjD;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAAgC,CAAA;AAErF;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAWrD;AA+BD;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,CAwBzC;AA0BD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAkC5D;AAoBD,0EAA0E;AAC1E,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAQ1E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,QAAQ,CAE9C;AAwCD,kFAAkF;AAClF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,GAAG,OAAO,CAK/D;AAeD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,QA8B1B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,QA8B3B,CAAA"}
package/dist/preserve.js CHANGED
@@ -26,7 +26,7 @@
26
26
  * element carries an attribute we cannot represent, it becomes opaque
27
27
  * and is preserved intact.
28
28
  */
29
- import { isFullyModelledStyle } from './css.js';
29
+ import { isFullyModelledStyle, safeLang } from './css.js';
30
30
  import { URL_ATTRIBUTES, isEventHandlerAttribute, isSafeUrl } from './url.js';
31
31
  /**
32
32
  * Elements that are never preserved, and whose contents are discarded with them.
@@ -49,7 +49,6 @@ import { URL_ATTRIBUTES, isEventHandlerAttribute, isSafeUrl } from './url.js';
49
49
  const NEVER_PRESERVE = [
50
50
  'script',
51
51
  'style',
52
- 'iframe',
53
52
  'frame',
54
53
  'frameset',
55
54
  'object',
@@ -69,14 +68,75 @@ const NEVER_PRESERVE = [
69
68
  ];
70
69
  /** Parse rules that drop dangerous elements before any other rule sees them. */
71
70
  const dropRules = NEVER_PRESERVE.map((tag) => ({ tag, ignore: true, priority: 100 }));
71
+ /**
72
+ * `<source>` and `<track>`: media children the schema stores as markup rather
73
+ * than as nodes, so they do not count as content when deciding what to keep.
74
+ *
75
+ * Lives here because this module owns the "keep it whole or claim it" decision,
76
+ * and `structure.ts` asks the same question when it reads a media element.
77
+ */
78
+ export const MEDIA_FURNITURE_TAGS = new Set(['source', 'track']);
79
+ /**
80
+ * True when a media element holds content its node cannot carry.
81
+ *
82
+ * Video and audio are atoms whose only modelled children are `<source>` and
83
+ * `<track>`, so fallback content -- "Download <a href=...>the video</a>", shown
84
+ * by a browser that cannot play the file -- has nowhere to live on the node.
85
+ */
86
+ export function hasMediaFallback(el) {
87
+ for (const child of Array.from(el.childNodes)) {
88
+ if (child.nodeType === 1) {
89
+ if (!MEDIA_FURNITURE_TAGS.has(child.nodeName.toLowerCase()))
90
+ return true;
91
+ continue;
92
+ }
93
+ // Whitespace between the <source> children is layout, not fallback: the
94
+ // element still models cleanly and still round-trips.
95
+ if (child.nodeType === 3 && (child.textContent ?? '').trim() !== '')
96
+ return true;
97
+ }
98
+ return false;
99
+ }
100
+ /**
101
+ * Media whose fallback content the node cannot hold, kept whole.
102
+ *
103
+ * Priority 45 sits below the schema's own rules (50) and above the drop rule
104
+ * (40): a video with a safe `src` is still claimed as a node first, and an
105
+ * unsafe iframe is still dropped rather than preserved, but a `<video>` carrying
106
+ * a download link is preserved instead of being deleted along with it.
107
+ */
108
+ const preserveMediaWithFallback = ['video', 'audio'].map((tag) => ({
109
+ tag,
110
+ priority: 45,
111
+ getAttrs(dom) {
112
+ if (!hasMediaFallback(dom))
113
+ return false;
114
+ return { html: scrub(dom), tag: dom.nodeName.toLowerCase() };
115
+ },
116
+ }));
117
+ /**
118
+ * Media the schema declined. Priority 40 is below the schema's default (50),
119
+ * so an allowlisted iframe or a video with a safe `src` is claimed first;
120
+ * anything left is ignored rather than preserved as an atom. Preserving an
121
+ * arbitrary iframe would be a nested page the author never asked to keep.
122
+ */
123
+ const dropDeclinedMedia = ['iframe', 'video', 'audio'].map((tag) => ({
124
+ tag,
125
+ ignore: true,
126
+ priority: 40,
127
+ }));
72
128
  /**
73
129
  * Scrub markup before it is stored for preservation.
74
130
  *
75
131
  * Preserving an element verbatim means preserving its attributes verbatim, and
76
132
  * `<div class="callout" onclick="steal()">` is not something an author needs
77
133
  * kept. Works on a clone so the live parse tree is untouched.
134
+ *
135
+ * Exported because the table schema stores `<caption>` and `<colgroup>` the same
136
+ * way, for the same reason, and a second scrubber that drifted from this one
137
+ * would be a hole in exactly the code path that exists to close holes.
78
138
  */
79
- function scrub(el) {
139
+ export function scrub(el) {
80
140
  const clone = el.cloneNode(true);
81
141
  const visit = (node) => {
82
142
  for (const child of Array.from(node.children)) {
@@ -137,43 +197,39 @@ export function isLosslesslyUnwrappable(el) {
137
197
  return false;
138
198
  if (el.attributes.length === 0)
139
199
  return true;
140
- /*
141
- * One exception, and it is deliberately the narrowest one that works: a
142
- * `<span>` whose only attribute is a style the colour marks fully model.
143
- *
144
- * Without it, colour is a fidelity regression dressed as a feature. Every
145
- * `<span style="color:#c00">` in an inherited archive is preserved as an
146
- * opaque atom -- a grey card where a sentence used to be, its text
147
- * unselectable and unspellcheckable. Declining the rule here lets the span
148
- * unwrap, and ProseMirror's style rules then re-apply the colour as a mark on
149
- * the text inside, which is both editable and byte-identical on the way out.
150
- *
151
- * `text-align` is not in the accepted set, because unwrapping the element that
152
- * carries it would drop it: it is a property of the block, and the block here
153
- * is somebody else. Two attributes, or one attribute the marks cannot fully
154
- * express, and the element stays preserved exactly as it does today.
155
- */
156
- if (el.attributes.length !== 1 || name !== 'span')
200
+ if (name !== 'span')
157
201
  return false;
158
202
  /*
159
- * Unwrap only if the marks will actually pick the declarations up.
203
+ * A `<span>` whose attributes are fully modelled as marks: colour, font, and
204
+ * `lang`. Without this, those runs become opaque atoms -- a grey card where a
205
+ * sentence used to be. Declining the catch-all lets the span unwrap so the
206
+ * mark rules can re-apply formatting on the text inside.
160
207
  *
161
- * ProseMirror matches mark style rules through the CSSOM, and there are two
162
- * situations where the CSSOM reports nothing for a style attribute that is
163
- * plainly there: the declaration is invalid, and -- the one that matters -- a
164
- * Content-Security-Policy with no `unsafe-inline` in `style-src`, under which
165
- * the browser leaves the attribute in the DOM and refuses to parse it.
208
+ * Any other attribute, or a style the marks cannot fully express, and the
209
+ * element stays preserved exactly as it does today.
166
210
  *
167
- * Unwrapping in that case destroys the colour: the span goes, no mark replaces
168
- * it, and the author's red text is black on the next save. An empty CSSOM is
169
- * therefore a reason to leave the element to the preservation layer, where it
170
- * stays verbatim and uneditable -- exactly what happened before colour was
171
- * modelled at all. Degrading to the old behaviour is acceptable; losing content
172
- * is not.
211
+ * ProseMirror matches mark style rules through the CSSOM. Under a CSP with
212
+ * no `unsafe-inline` in `style-src`, the browser leaves the attribute in the
213
+ * DOM and refuses to parse it, so unwrapping would destroy the formatting.
214
+ * An empty CSSOM is therefore a reason to leave the element to the
215
+ * preservation layer.
173
216
  */
174
- if (el.style?.length === 0)
217
+ for (const attr of Array.from(el.attributes)) {
218
+ if (attr.name === 'lang') {
219
+ if (safeLang(attr.value) === null)
220
+ return false;
221
+ continue;
222
+ }
223
+ if (attr.name === 'style') {
224
+ if (el.style?.length === 0)
225
+ return false;
226
+ if (!isFullyModelledStyle(attr.value))
227
+ return false;
228
+ continue;
229
+ }
175
230
  return false;
176
- return isFullyModelledStyle(el.getAttribute('style'));
231
+ }
232
+ return true;
177
233
  }
178
234
  /** Rebuild a DOM element from stored markup. `<template>` is used because
179
235
  * its parsing context permits otherwise-illegal fragments such as a bare
@@ -202,6 +258,25 @@ export function withSerializationDocument(doc, fn) {
202
258
  serializationDocument = previous;
203
259
  }
204
260
  }
261
+ /**
262
+ * True while `serializeHtml` is running.
263
+ *
264
+ * A node whose `toDOM` needs to render differently for the editor than for the
265
+ * saved HTML has no other way to tell which one it is building. The table spec
266
+ * needs exactly that: a preserved `<caption>` must be `contenteditable="false"`
267
+ * on screen, because it sits inside the editable area but outside the node's
268
+ * `contentDOM`, and letting a caret into it means typing that ProseMirror will
269
+ * silently revert. That attribute must NOT reach the saved HTML, where it would
270
+ * be our editor scribbling on the author's markup.
271
+ *
272
+ * Stripping it afterwards was the other option and is worse: it cannot tell the
273
+ * attribute it just added from the same attribute in somebody's document -- the
274
+ * collision the preserved-element WeakSet above exists to avoid. Not emitting it
275
+ * at all has no such failure mode.
276
+ */
277
+ export function isSerializing() {
278
+ return serializationDocument !== undefined;
279
+ }
205
280
  /**
206
281
  * The Document that serialization should build into.
207
282
  *
@@ -281,6 +356,8 @@ export const unknownBlock = {
281
356
  },
282
357
  parseDOM: [
283
358
  ...dropRules,
359
+ ...preserveMediaWithFallback,
360
+ ...dropDeclinedMedia,
284
361
  {
285
362
  tag: '*',
286
363
  // Lowest priority: every real rule in the schema gets first refusal.
@@ -316,6 +393,8 @@ export const unknownInline = {
316
393
  },
317
394
  parseDOM: [
318
395
  ...dropRules,
396
+ ...preserveMediaWithFallback,
397
+ ...dropDeclinedMedia,
319
398
  {
320
399
  tag: '*',
321
400
  // Higher than unknownBlock's catch-all: inline gets first refusal so
@@ -1 +1 @@
1
- {"version":3,"file":"preserve.js","sourceRoot":"","sources":["../src/preserve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;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":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAkC,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAiExG,6DAA6D;AAC7D,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAmL9C,CAAA;AAED,2BAA2B;AAC3B,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAoI9C,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,wBAAqD,CAAA"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAkC,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAiJxG,6DAA6D;AAC7D,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CA4L9C,CAAA;AAED,2BAA2B;AAC3B,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAsN9C,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,wBAAqD,CAAA"}