yamlover 0.3.48 → 0.3.49

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 (38) hide show
  1. package/README.md +38 -18
  2. package/bin/ga4.js +77 -0
  3. package/bin/yamlover.js +56 -18
  4. package/dist/agent-docs/AGENTS.md +86 -51
  5. package/dist/agent-docs/CLAUDE.md +1 -1
  6. package/dist/builtin-taxonomy/$defs/board +1 -1
  7. package/dist/builtin-taxonomy/$defs/bullets +1 -1
  8. package/dist/builtin-taxonomy/$defs/chapter +4 -4
  9. package/dist/builtin-taxonomy/$defs/chunk +1 -1
  10. package/dist/builtin-taxonomy/$defs/config +1 -1
  11. package/dist/builtin-taxonomy/$defs/numbered +1 -1
  12. package/dist/builtin-taxonomy/$defs/table +2 -2
  13. package/dist/builtin-taxonomy/tags/{.yamlover/body.yamlover → .yo/body.yo} +1 -1
  14. package/dist/client/assets/{decoded-Dfxf1BRR.js → decoded-D_YQdg1-.js} +1 -1
  15. package/dist/client/assets/djvu-Di4fPA-J.js +1 -0
  16. package/dist/client/assets/{docx-aCX_2O0_.js → docx-BSduN32X.js} +1 -1
  17. package/dist/client/assets/{heic-8pzTwsCx.js → heic-DOAG7EsW.js} +1 -1
  18. package/dist/client/assets/{imagemap-Bp26n33x.js → imagemap-B8RthxNE.js} +1 -1
  19. package/dist/client/assets/index-Bf2L7I9e.js +752 -0
  20. package/dist/client/assets/index-N41EyNG2.css +1 -0
  21. package/dist/client/assets/{map-Dtw0_sOf.js → map-Cf7ar1_U.js} +1 -1
  22. package/dist/client/assets/openable-CCBlc-Ws.js +4 -0
  23. package/dist/client/assets/{paged-BGVPKMC7.js → paged-bLurvatj.js} +1 -1
  24. package/dist/client/assets/{pdf-eI1AsxuB.js → pdf-D1ox8M9A.js} +2 -2
  25. package/dist/client/assets/{psd-BD_hUWIy.js → psd-AT50x-YR.js} +1 -1
  26. package/dist/client/assets/{spreadsheet-D_yjjR8a.js → spreadsheet-DeQh5CNF.js} +1 -1
  27. package/dist/client/assets/{tiff-BewNDYwu.js → tiff-B3-awhzQ.js} +1 -1
  28. package/dist/client/assets/xyflow-BnuhLJ6X.css +1 -0
  29. package/dist/client/assets/xyflow-DuQ4jjaq.js +23 -0
  30. package/dist/client/index.html +6 -2
  31. package/dist/client/yo-favicon.svg +16 -0
  32. package/dist/server.js +1862 -1018
  33. package/package.json +11 -4
  34. package/dist/client/assets/djvu-BAFaxONw.js +0 -1
  35. package/dist/client/assets/index-BohJjyVY.css +0 -1
  36. package/dist/client/assets/index-DXrtwPKE.js +0 -754
  37. package/dist/client/assets/openable-Banncb36.js +0 -4
  38. /package/dist/builtin-taxonomy/$defs/{.yamlover/meta.yamlover → .yo/meta.yo} +0 -0
@@ -6,9 +6,10 @@ yamlover web UI (`npx yamlover .`) while you read and edit the files on disk. Th
6
6
  tells you how to manipulate these files **correctly** so you don't corrupt the data or break the
7
7
  human's live view.
8
8
 
9
- > This file is self-contained. You do **not** need any other spec to follow it. If the project
10
- > also contains files like `YAMLOVER.md`, `SEPARATOR.md`, `QUERY.md`, or `ANNOTATIONS.md`, those
11
- > are the authoritative, deeper specs consult them for edge cases.
9
+ > This file is self-contained. You do **not** need any other spec to follow it. The full,
10
+ > authoritative spec is the yamlover documentation book (the `docs/` tree of the yamlover
11
+ > project itself the language under `docs/language/`, the document model under
12
+ > `docs/documents/`); consult it for edge cases.
12
13
 
13
14
  ---
14
15
 
@@ -19,13 +20,13 @@ yamlover is a **distinct, YAML-like language** — close to YAML and mostly read
19
20
  document that uses aliases/anchors does **not** round-trip identically. On top of a YAML-style
20
21
  surface it adds a small **pointer layer** so that data forms a graph, not just a tree:
21
22
 
22
- - **`*` pointers** — a value that *refers to* another node (a shared edge, not a copy).
23
+ - **`*` pointers** — a value that *refers to* another node (a ref edge, not a copy).
23
24
  - **`&` path anchors** — declare that "this node also lives over there" (the push side of `*`).
24
25
  - **`!!` tags** — type/schema markers, including inline schema references `!!<…>`.
25
26
 
26
27
  There is a sibling brace surface called **json5p** (`.json5p` files) — the same pointer layer
27
- expressed in JSON5 syntax. Most projects use `.yamlover`; treat `.json5p` as the JSON-flavored
28
- twin (pointers are written as quoted strings, e.g. `*": pets[1]"`).
28
+ expressed in JSON5 syntax. Most projects use `.yo`; treat `.json5p` as the JSON-flavored
29
+ twin (pointers are written as quoted strings, e.g. `*": pets: 1"`).
29
30
 
30
31
  **Important:** because `*` and `&` mean something different than in stock YAML (a `*` is a path
31
32
  pointer, **not** a YAML alias), these files require the yamlover parser. Do not "fix" them with
@@ -37,29 +38,30 @@ a generic YAML formatter — you will destroy the pointers and anchors.
37
38
 
38
39
  Plain YAML forces a node to be **either** a sequence (all `- item`) **or** a mapping (all
39
40
  `key: value`). yamlover unifies them: there is **one ordered container**. Every entry has an
40
- integer **position** (`[0]`, `[1]`, …) and **may also** carry a string key. Keyless (positional)
41
+ integer **position** (0, 1, …) and **may also** carry a string key. Keyless (positional)
41
42
  and keyed entries coexist in one node — this is the default ("omni"):
42
43
 
43
44
  ```yamlover
44
45
  playlist:
45
- - Intro # [0] keyless / positional
46
- - Verse # [1] keyless
47
- title: Greatest Hits # [2], key=title keyed — AND still positioned
48
- - Chorus # [3] keyless
49
- encore: *: pets[0] # [4], key=encore a keyed pointer, still in order
46
+ - Intro # position 0 keyless / positional
47
+ - Verse # position 1 keyless
48
+ title: Greatest Hits # position 2, key=title keyed — AND still positioned
49
+ - Chorus # position 3 keyless
50
+ encore: *: pets: 0 # position 4, key=encore a keyed pointer, still in order
50
51
  ```
51
52
 
52
53
  A node can even carry a **scalar value AND fields at once**:
53
54
 
54
55
  ```yamlover
55
56
  rating: 5 # the node's own scalar value …
56
- - solid # [0] positional field
57
- scale: 10 # [2] keyed field
57
+ - solid # position 0 positional field
58
+ scale: 10 # position 2 keyed field
58
59
  ```
59
60
 
60
- (You may see optional `!!mix` / `!!var` tags marking these shapes. They are **no-op readability
61
- markers** — mixing and scalar-plus-fields are the default. Don't add or remove them to change
62
- meaning; they don't carry any.)
61
+ (You may see an optional `!!mix` tag marking these shapes. It is a **no-op readability marker**
62
+ — mixing and scalar-plus-fields are the default. Don't add or remove it to change meaning; it
63
+ doesn't carry any. `!!yo` — whose deprecated aliases `!!var` / `!!omni` still parse — is a
64
+ DIFFERENT thing and is **semantic**: see §6.)
63
65
 
64
66
  ---
65
67
 
@@ -82,26 +84,45 @@ current: object: path # bare — current scope (si
82
84
  ::: yamlover.inthemoon.net: $defs: tag # ::: — the world (an external project)
83
85
  ```
84
86
 
85
- - `*pets[1]` — bare: a **sibling** named `pets`, position 1.
86
- - `*: pets[0]` — `:` document root.
87
+ - `*pets: 1` — bare: a **sibling** named `pets`, position 1.
88
+ - `*: pets: 0` — `:` document root.
87
89
  - `*:: tags: genre` — `::` this project's root.
88
90
  - `*::: host.example: $defs: tag` — `:::` a world/external reference.
89
91
 
90
- `[n]` addresses by **position** (integer key); a bare word addresses by **string key**. They
91
- chain: `*: pets[1]: name` = root → position 1 → key `name`.
92
+ ### The bare-token rule what a portion means
93
+
94
+ Every portion is typed **by its own form**:
95
+
96
+ - **pure digits** = the integer key, i.e. a **position**: `*: pets: 1: name` = root → position 1
97
+ → key `name`.
98
+ - **a bare `~`** = the **null key** (`~: value`; `: v` is the same entry). The *string* key
99
+ `"null"` is written `null:`.
100
+ - **anything else bare, and any quoted portion** = a **string key**: `: '1'` is the numeric
101
+ string key, `: '~'` the literal tilde.
102
+
103
+ A key whose bare form would read as something else MUST be quoted: empty, pure digits, `~`,
104
+ `-`+digits, or a key containing a space. In a document, a plain `1:` is a **parse error** —
105
+ author `'1':` for the numeric string key.
106
+
107
+ > **The retired bracket index.** The old `[n]` position form (`*pets[1]`) still *reads* — it is
108
+ > a permanent alias — but it is **written never**. Author the bare-integer segment. The one
109
+ > surviving bracket operator is `[.±k]` (a position relative to the pointer's own host). The
110
+ > former `[]` (append) and `[?]` (any position) brackets were REMOVED — both are now the `-`
111
+ > segment: a trailing `: -` on a bookmark appends (§5), and `-` in a query matches any
112
+ > position. A literal `-` key must be quoted (`'-'`).
92
113
 
93
114
  ---
94
115
 
95
116
  ## 4. Pointers `*` (the pull side)
96
117
 
97
- A `*` value dereferences a path to another node and creates a **shared edge** (not a copy):
118
+ A `*` value dereferences a path to another node and creates a **ref edge** (not a copy):
98
119
 
99
120
  ```yamlover
100
121
  humans:
101
122
  - name: Alice
102
- manager: *: pets[1] # Alice.manager IS the node at root → pets → position 1
103
- feline: *pets[1] # bare → a sibling
104
- topDog: *: pets[0] # : → document root
123
+ manager: *: pets: 1 # Alice.manager IS the node at root → pets → position 1
124
+ feline: *pets: 1 # bare → a sibling
125
+ topDog: *: pets: 0 # : → document root
105
126
  ```
106
127
 
107
128
  Pointers are **lazy** and **cycle-safe** — pointing two nodes at each other is fine. Editing the
@@ -118,7 +139,7 @@ target changes everything that points at it.
118
139
  boss: &: chief # this node is ALSO reachable as the document-root key `chief`
119
140
  name: Rex
120
141
  team:
121
- lead: *: chief # same node as `boss` — a shared edge, not a copy
142
+ lead: *: chief # same node as `boss` — a ref edge, not a copy
122
143
  ```
123
144
 
124
145
  Reverse relations are spelled as anchors. `&: parent: child` means "parent holds me as child":
@@ -129,17 +150,20 @@ adam:
129
150
  &: eve: cain # "eve holds me as cain" — the reverse of eve's cain-edge
130
151
  ```
131
152
 
132
- `&: container[]` (trailing `[]`, no index) means **positional membership**: "that container also
153
+ `&: container: -` (a trailing `-` segment) means **positional membership**: "that container also
133
154
  holds me", appended after the container's own entries:
134
155
 
135
156
  ```yamlover
136
157
  fan:
137
158
  name: Bob
138
- &: favorites[] # Bob appends himself to `favorites`
159
+ &: favorites: - # Bob appends himself to `favorites`
139
160
  ```
140
161
 
141
- Anchor paths must be **unambiguous** (no wildcards, no trailing `[n]` position claim)they
142
- create real keys, so they must resolve to exactly one place.
162
+ Anchor paths must be **unambiguous** (no wildcards, no trailing position claim — neither a bare
163
+ integer nor a relative `[.±k]`) — they create real keys, so they must resolve to exactly one
164
+ place. The trailing `-` is an append, not a claim; a `-` anywhere else in an anchor path is
165
+ reserved (a parse error today). The old `&: container[]` bracket spelling was removed and no
166
+ longer parses.
143
167
 
144
168
  > You may encounter the older `~key: *path` back-edge syntax in legacy files. It still parses but
145
169
  > is deprecated; author new reverse edges as `&` anchors.
@@ -148,8 +172,13 @@ create real keys, so they must resolve to exactly one place.
148
172
 
149
173
  ## 6. Tags `!!` and `$defs` schemas
150
174
 
151
- - `!!type` — a YAML-style tag. Common no-op markers: `!!mix`, `!!var` (see §2). `!!set` marks a
152
- container whose membership is by identity (duplicates collapse).
175
+ - `!!type` — a YAML-style tag. `!!mix` is the one no-op marker (see §2). The rest are
176
+ **semantic** and must not be added or dropped casually:
177
+ - `!!set` marks a container whose membership is by identity (duplicates collapse);
178
+ - `!!yo` (deprecated aliases `!!var` / `!!omni`) marks a node as **plain yamlover, exempt
179
+ from the enclosing document's schema** — a *data island*. Inside a structured document (a
180
+ chapter, say) a `!!yo` node is never interpreted by that schema: it is data, drawn by the
181
+ generic renderer.
153
182
  - **Inline schema reference** `!!<…>` binds a node to a reusable schema definition:
154
183
  ```yamlover
155
184
  mychapter: !!<*:: yamlover: $defs: chapter>
@@ -165,15 +194,15 @@ create real keys, so they must resolve to exactly one place.
165
194
 
166
195
  A node can be materialized two ways:
167
196
 
168
- 1. **Single-file concrete** — a whole document in one `.yamlover` (or `.json5p`) file.
197
+ 1. **Single-file concrete** — a whole document in one `.yo` (or `.json5p`) file.
169
198
  2. **Directory concrete** — a directory **is** the node; its files/subdirs are its entries, and
170
- two optional overlay files inside a hidden `.yamlover/` subdir add data and schema:
171
- - `.yamlover/body.yamlover` — **instance** overlay: scalar values, ordering, pointers,
199
+ two optional overlay files inside a hidden `.yo/` subdir add data and schema:
200
+ - `.yo/body.yo` — **instance** overlay: scalar values, ordering, pointers,
172
201
  extra keyed/keyless entries layered onto the directory's contents.
173
- - `.yamlover/meta.yamlover` — **schema** overlay: typing, format, validation.
202
+ - `.yo/meta.yo` — **schema** overlay: typing, format, validation.
174
203
 
175
204
  So to add a pointer or a value "to a folder", you edit (or create) that folder's
176
- `.yamlover/body.yamlover`. Plain files inside the directory are its members; a `.yamlover/`
205
+ `.yo/body.yo`. Plain files inside the directory are its members; a `.yo/`
177
206
  subdir does not appear as a member — it's the overlay.
178
207
 
179
208
  A pure pointer-array body (`- *file1` …) is the ORDER overlay: it grants positions to the
@@ -184,7 +213,7 @@ pure module, an explicit `concrete:` always wins): a directory-concrete parent k
184
213
  directory-concrete; a keyed container child becomes a nested real directory; an untagged
185
214
  keyless (ordinal) container child becomes an order-numbered subdirectory (`item01`,
186
215
  `item02`, …) referenced by a `- *: itemNN` pointer-array element; scalars and tagged containers
187
- (tables, typographical lists) go inline into `body.yamlover`. Title-born subchapter members are
216
+ (tables, typographical lists) go inline into `body.yo`. Title-born subchapter members are
188
217
  numbered too (`01-Введение`). The numbers are COSMETIC listing order — the body pointer-array is
189
218
  the order's data, and an existing member is NEVER renamed: an insert between neighbors slots a
190
219
  sub-number (`item01-1`, `01-1-Новая`). Content inside a file document speaks that file's
@@ -192,12 +221,12 @@ language (a `.json5p` interior never switches to yaml).
192
221
 
193
222
  **Collapse / expand / promotion — the same node, two shapes.** The two concretes are
194
223
  freely interconvertible without changing what the data means: a child stored as
195
- `child.yamlover` (collapsed) and the same child stored as `child/` with a
196
- `.yamlover/body.yamlover` (expanded) are equivalent. Converting a single-file node **into**
224
+ `child.yo` (collapsed) and the same child stored as `child/` with a
225
+ `.yo/body.yo` (expanded) are equivalent. Converting a single-file node **into**
197
226
  a directory is called **directory promotion** (the UI's action; the engine keeps inbound
198
227
  pointers valid across it, like `mv`). If you do it by hand, it is a two-step move: create the
199
- `child/` directory, move the file's contents into `child/.yamlover/body.yamlover` (plus any
200
- members as files), and delete the old `child.yamlover` — then let the engine reindex. Because
228
+ `child/` directory, move the file's contents into `child/.yo/body.yo` (plus any
229
+ members as files), and delete the old `child.yo` — then let the engine reindex. Because
201
230
  it is a move, treat it with the same care as any rename: pointers that addressed the old file
202
231
  path must still resolve (prefer the mediated `mv`/promotion in the UI, which rewrites them —
203
232
  see §10).
@@ -216,9 +245,12 @@ The human marks up documents in the UI. These live **on the target node**, not i
216
245
  ```yamlover
217
246
  yamlover-annotations:
218
247
  - *:: tags: genre: brevity # parameterless
219
- - {description: A math block, tag: *:: tags: topic: math} # parametrized
248
+ - {description: 'A math block', tag: *:: tags: topic: math} # parametrized
220
249
  ```
221
250
 
251
+ (A flow scalar carrying a SPACE must be quoted — an unquoted `A math block` inside `{…}` is a
252
+ parse error.)
253
+
222
254
  Prefer letting the human create these through the UI. If you must touch them by hand, keep the
223
255
  exact key names (`yamlover-fragments`, `yamlover-annotations`) and the tag-pointer form, and do
224
256
  not renumber or reorder fragment slugs.
@@ -253,10 +285,10 @@ pushes the change to the human's browser over a live event stream — so your ed
253
285
  UI within a moment, and theirs appear to you on disk. Work with that, not against it:
254
286
 
255
287
  - **Make small, valid saves.** A half-written file will reindex as broken. Prefer complete edits.
256
- - **NEVER touch `.yamlover/index.db`** (nor its `-wal` / `-shm` companions). It is the server's
288
+ - **NEVER touch `.yo/index.db`** (nor its `-wal` / `-shm` companions). It is the server's
257
289
  generated SQLite index — it regenerates itself from the source files. Editing or deleting it
258
- does nothing useful and can confuse a running server. It is the *only* thing in `.yamlover/`
259
- you must not edit; `body.yamlover` / `meta.yamlover` overlays (§7) are normal editable data.
290
+ does nothing useful and can confuse a running server. It is the *only* thing in `.yo/`
291
+ you must not edit; `body.yo` / `meta.yo` overlays (§7) are normal editable data.
260
292
  - **Renames and moves break inbound pointers.** Other files may point at a node by its path
261
293
  (`*: some: node`). If you move or rename it with a plain `mv`, those pointers dangle. The
262
294
  running server exposes a **mediated move** (`POST /api/mv`) that surgically rewrites inbound
@@ -264,10 +296,11 @@ UI within a moment, and theirs appear to you on disk. Work with that, not agains
264
296
  project for pointers to the old path (`*` followed by the path) and update them too.
265
297
  - **Don't reformat with a generic YAML/JSON tool.** It will mangle `*`, `&`, `!!<…>`, the
266
298
  colon paths, and the mixed keyed/keyless ordering. Edit the text directly and preserve style.
267
- - **Settings live in `.yamlover/settings.yamlover`** at the project root (e.g. where new tags and
299
+ - **Settings live in `.yo/settings.yo`** at the project root (e.g. where new tags and
268
300
  annotations are written). Treat it as configuration; change it only when asked.
269
301
  - **When unsure of a path, query it.** The server answers `GET /api/query?...` using the path
270
- grammar above, and serves the tree at `GET /api/tree` / a node at `GET /api/json?path=:a:b`.
302
+ grammar above, and serves the tree at `GET /api/tree` / a node's yamlover at
303
+ `GET /api/content/a/b` (slash-spelled path; digits are positions, `~` the null key).
271
304
  Use these to confirm a path resolves before you author a pointer to it.
272
305
 
273
306
  ---
@@ -276,15 +309,17 @@ UI within a moment, and theirs appear to you on disk. Work with that, not agains
276
309
 
277
310
  ```yamlover
278
311
  # pointers (pull) — colon paths, the scope ladder
279
- sibling: *pets[1] # current scope, by position
280
- rooted: *: humans[0]: name # document root → position 0 → key name
312
+ sibling: *pets: 1 # current scope, by position (bare digits = the position)
313
+ rooted: *: humans: 0: name # document root → position 0 → key name
314
+ strkey: *: counts: '1' # QUOTED digits = the numeric STRING key
315
+ nullkey: *: doc: ~ # the null key
281
316
  projscope: *:: tags: genre # this project's root
282
317
  world: *::: host.example: $defs: tag
283
318
 
284
319
  # anchors (push) — "I also live there"; real keys; unambiguous only
285
320
  here: &: chief # also at document-root key `chief`
286
321
  rev: &: parent: child # parent holds me as `child`
287
- mem: &: favorites[] # appended member of `favorites`
322
+ mem: &: favorites: - # appended member of `favorites`
288
323
 
289
324
  # tags / schema
290
325
  node: !!<*:: $defs: chapter> # bind a reusable schema
@@ -2,6 +2,6 @@
2
2
 
3
3
  This is a **yamlover** project. The authoring rules, the pointer/anchor syntax, and the rules for
4
4
  safely co-editing the tree while the yamlover web UI is running are in **`AGENTS.md`** — read it
5
- before editing any `.yamlover` / `.json5p` file.
5
+ before editing any `.yo` / `.json5p` file.
6
6
 
7
7
  @AGENTS.md
@@ -1,5 +1,5 @@
1
1
  # $defs/board — marks a DIRECTORY of tasks as an agile/kanban board. Attach it to the directory's
2
- # `.yamlover/body.yamlover` overlay; the `workflow:` ref names which $defs/workflow supplies the
2
+ # `.yo/body.yo` overlay; the `workflow:` ref names which $defs/workflow supplies the
3
3
  # lanes (its states, in order). The board renderer then groups the directory's task members into
4
4
  # those lanes by each task's current state annotation, and a drag between lanes rewrites that
5
5
  # annotation (re-tags the state). format `x-yamlover-board`. Attach with !!<*yamlover:$defs:board>.
@@ -4,7 +4,7 @@
4
4
  # schema applies at ANY depth, until an explicit !!<…> tag switches to something else.
5
5
  # A titled list is a chapter holding a list — no keyed properties here on purpose.
6
6
  # Attach with !!<*yamlover: $defs: bullets>.
7
- # No explicit `format:` — `type: variant` derives x-yamlover-bullets. Spec: ../MARKLOWER.md.
7
+ # No explicit `format:` — `type: variant` derives x-yamlover-bullets. Spec: docs/documents/marklower.
8
8
  type: variant
9
9
  items:
10
10
  anyOf:
@@ -5,15 +5,15 @@
5
5
  #
6
6
  # There is no `chunks` array and no `children` array — prose, media, diagrams, and
7
7
  # subchapters are siblings in ONE ordered stream. Attach it to a yamlover node with the
8
- # tag !!<*yamlover/$defs/chapter>. Spec: ../CHAPTER.md, ../META.md.
8
+ # tag !!<*yamlover/$defs/chapter>. Spec: docs/documents/chapter, docs/meta.
9
9
  #
10
10
  # `type: variant` is the omni node: a scalar self-value (the title, given as `value:`) AND
11
11
  # keyed fields (description) AND positional elements (the body) at once. The body element type
12
12
  # is a union — a chapter OR a chunk; the two are told apart structurally (a chapter is a
13
13
  # container, a chunk is a leaf). A BARE SCALAR body element is therefore both "a chunk" and
14
- # "a title-only subchapter" — the same thing, by design (CHAPTER.md).
14
+ # "a title-only subchapter" — the same thing, by design (docs/documents/chapter).
15
15
  # NOTE: `value` (scalar) + `properties` (keyed) + `items` (ordinal) is the JSON-Schema encoding
16
- # of an omni node's facets; META.md §Vocabulary proposes a native `elements`/`additionalElements`.
16
+ # of an omni node's facets; docs/meta proposes a native `elements`/`additionalElements`.
17
17
  type: variant
18
18
  value: # the self-value — the chapter's TITLE
19
19
  type: string
@@ -25,7 +25,7 @@ properties:
25
25
  items: # the body — a positional sequence, read top to bottom
26
26
  anyOf:
27
27
  - *:: yamlover: $defs: chapter # a nested subchapter (a container) — the recursion
28
- - *:: yamlover: $defs: table # a table — enters only by its EXPLICIT tag (MARKLOWER.md)
28
+ - *:: yamlover: $defs: table # a table — enters only by its EXPLICIT tag (docs/documents/marklower)
29
29
  - *:: yamlover: $defs: bullets # a bullet list — enters only by its explicit tag
30
30
  - *:: yamlover: $defs: numbered # a numbered list — enters only by its explicit tag
31
31
  - *:: yamlover: $defs: chunk # a content block — a leaf
@@ -3,6 +3,6 @@
3
3
  # A chunk is a typed value; its (type, format) selects the renderer. The default is
4
4
  # markdown prose; a chunk overrides type/format/concrete to be a diagram, image, LaTeX,
5
5
  # CSV, a file pointer, etc. `binary` covers image/pdf/… chunks (a `*` pointer to a file).
6
- # Spec: ../CHAPTER.md.
6
+ # Spec: docs/documents/chapter.
7
7
  type: [string, binary]
8
8
  format: text/marklower
@@ -1,4 +1,4 @@
1
- # $defs/config — the project configuration schema for `<root>/.yamlover/settings.yamlover`
1
+ # $defs/config — the project configuration schema for `<root>/.yo/settings.yo`
2
2
  # (settings.ts, IMPORTS.md). Settings are DEFAULTS, never constraints; reading is location-
3
3
  # independent. The format `x-yamlover-config` lets the server render the (hidden but accessible)
4
4
  # config file with the SETTINGS EDITOR — opened by the gear button, in the main pane. Locations are
@@ -4,7 +4,7 @@
4
4
  # schema applies at ANY depth, until an explicit !!<…> tag switches to something else.
5
5
  # A titled list is a chapter holding a list — no keyed properties here on purpose.
6
6
  # Attach with !!<*yamlover: $defs: numbered>.
7
- # No explicit `format:` — `type: variant` derives x-yamlover-numbered. Spec: ../MARKLOWER.md.
7
+ # No explicit `format:` — `type: variant` derives x-yamlover-numbered. Spec: docs/documents/marklower.
8
8
  type: variant
9
9
  items:
10
10
  anyOf:
@@ -8,9 +8,9 @@
8
8
  # sidecar — a proportional column weight (AsciiDoc `cols` style), rendered weight/sum %;
9
9
  # `width` is deliberately schema-untyped (an omni cell must stay a LEAF for shape routing).
10
10
  # A cell that is a `*` pointer to its adjacent previous cell (`*[.-1]` left, `*..[.-1][.]`
11
- # up — relative indexes, URIs.md) declares a MERGED cell: colspan/rowspan. Attach with
11
+ # up — relative indexes, docs/language/pointers/relative-indexes) declares a MERGED cell: colspan/rowspan. Attach with
12
12
  # !!<*yamlover: $defs: table>.
13
- # No explicit `format:` — `type: variant` derives x-yamlover-table. Spec: ../MARKLOWER.md.
13
+ # No explicit `format:` — `type: variant` derives x-yamlover-table. Spec: docs/documents/marklower.
14
14
  type: variant
15
15
  properties:
16
16
  title: # optional caption
@@ -1,5 +1,5 @@
1
1
  # Tag taxonomy: the built-in PALETTE (colors — pure color tags, each with an explicit
2
- # color) plus named tags created from the annotation picker (settings.yamlover:
2
+ # color) plus named tags created from the annotation picker (settings.yo:
3
3
  # tags.location). The palette ships with the yamlover project (::: yamlover.inthemoon.net);
4
4
  # the engine grafts {$defs, tags} as the `yamlover` self-import key into every served
5
5
  # root, so *//yamlover/tags/colors/<name> resolves from any project. Spec: ../$defs/tag.
@@ -1 +1 @@
1
- import{r as f,b as d,j as o}from"./index-DXrtwPKE.js";import{StaticImageChunk as h,PanZoomImage as x}from"./imagemap-Bp26n33x.js";function E({node:t,label:a,decode:s,chunk:e}){const[r,i]=f.useState([]),[g,u]=f.useState(null);return f.useEffect(()=>{let n=!1;const c=[];return i([]),u(null),(async()=>{const l=await fetch(d(t.path)).then(m=>m.arrayBuffer()),p=await s(l);if(!n){for(const m of p)c.push(URL.createObjectURL(m));n||i(c)}})().catch(l=>!n&&u(String(l.message||l))),()=>{n=!0,c.forEach(URL.revokeObjectURL)}},[t.path]),g?o.jsxs("div",{className:"error",children:[a,": ",g]}):r.length?o.jsx(o.Fragment,{children:r.map((n,c)=>e?o.jsx(h,{src:n,path:t.path,onNavigate:e.onNavigate},c):o.jsx(x,{src:n,className:"filemap fileimagemap",fill:r.length===1},c))}):o.jsxs("div",{className:"loading",children:["decoding ",a,"…"]})}async function w(t,a,s){const e=document.createElement("canvas");e.width=a,e.height=s;const r=e.getContext("2d");if(!r)throw new Error("no 2d context");const i=r.createImageData(a,s);return i.data.set(t),r.putImageData(i,0,0),b(e)}function b(t){return new Promise((a,s)=>t.toBlob(e=>e?a(e):s(new Error("canvas export failed")),"image/png"))}export{E as D,b as c,w as r};
1
+ import{r as f,b as d,j as o}from"./index-Bf2L7I9e.js";import{StaticImageChunk as h,PanZoomImage as x}from"./imagemap-B8RthxNE.js";function E({node:t,label:a,decode:s,chunk:e}){const[r,i]=f.useState([]),[g,u]=f.useState(null);return f.useEffect(()=>{let n=!1;const c=[];return i([]),u(null),(async()=>{const l=await fetch(d(t.path)).then(m=>m.arrayBuffer()),p=await s(l);if(!n){for(const m of p)c.push(URL.createObjectURL(m));n||i(c)}})().catch(l=>!n&&u(String(l.message||l))),()=>{n=!0,c.forEach(URL.revokeObjectURL)}},[t.path]),g?o.jsxs("div",{className:"error",children:[a,": ",g]}):r.length?o.jsx(o.Fragment,{children:r.map((n,c)=>e?o.jsx(h,{src:n,path:t.path,onNavigate:e.onNavigate},c):o.jsx(x,{src:n,className:"filemap fileimagemap",fill:r.length===1},c))}):o.jsxs("div",{className:"loading",children:["decoding ",a,"…"]})}async function w(t,a,s){const e=document.createElement("canvas");e.width=a,e.height=s;const r=e.getContext("2d");if(!r)throw new Error("no 2d context");const i=r.createImageData(a,s);return i.data.set(t),r.putImageData(i,0,0),b(e)}function b(t){return new Promise((a,s)=>t.toBlob(e=>e?a(e):s(new Error("canvas export failed")),"image/png"))}export{E as D,b as c,w as r};
@@ -0,0 +1 @@
1
+ import{r as u,u as te,a as ne,e as oe,c as re,D as W,b as se,j as d,f as ae}from"./index-Bf2L7I9e.js";import{u as ce,a as ie}from"./paged-bLurvatj.js";const le=""+new URL("djvu-Ci0lFKxE.js",import.meta.url).href;let X=null;function ue(){return window.DjVu?Promise.resolve(window.DjVu):(X??=new Promise((s,c)=>{const i=document.createElement("script");i.src=le,i.onload=()=>window.DjVu?s(window.DjVu):c(new Error("DjVu failed to load")),i.onerror=()=>c(new Error("could not load djvu.js")),document.head.appendChild(i)}),X)}let v=null,Y=null,_=null;const m=new Map,S=new Map,de=6,Q=1500;async function he(s,c){const i=await ue();return v??=new i.Worker,c!==Y&&(Y=c,m.clear(),S.clear(),_=(async()=>(await v.createDocument(s),Number(await v.doc.getPagesQuantity().run())||0))()),_}async function ge(s,c){const i=Math.max(1,Math.round(s.height*c/s.width)),w=await createImageBitmap(s,{resizeWidth:c,resizeHeight:i,resizeQuality:"medium"}),g=document.createElement("canvas");g.width=c,g.height=i;const x=g.getContext("2d");return x.drawImage(w,0,0),w.close(),x.getImageData(0,0,c,i)}function fe(s){const c=m.get(s);if(c)return m.delete(s),m.set(s,c),Promise.resolve(c);const i=S.get(s);if(i)return i;const w=(async()=>{const[g,x,y,A]=await v.run(v.doc.getPage(s).getImageData(),v.doc.getPage(s).getNormalizedTextZones(),v.doc.getPage(s).getWidth(),v.doc.getPage(s).getHeight()),b=Number(y)||g.width,N=Number(A)||g.height,j={image:b>Q?await ge(g,Q):g,zones:Array.isArray(x)?x:[],w:b,h:N};for(S.delete(s),m.set(s,j);m.size>de;)m.delete(m.keys().next().value);return j})();return S.set(s,w),w}const p=s=>Number(s)||0;function pe({image:s}){const c=u.useRef(null);return u.useLayoutEffect(()=>{const i=c.current;i&&(i.width=s.width,i.height=s.height,i.getContext("2d")?.putImageData(s,0,0))},[s]),d.jsx("canvas",{className:"djvu-page",ref:c})}function xe({node:s}){const c=u.useRef(null),[i,w]=u.useState(0),[g,x]=u.useState(1),[y,A]=u.useState(0),[b,N]=u.useState(null),[f,j]=u.useState(null),[E,B]=u.useState(()=>new Set),[D,P]=u.useState(()=>new Map),T=u.useRef(new Map),V=te(s.path),{openCreate:H,openEdit:Z,palette:q,preview:R}=ne(V,s.path),O=V.annotations.filter(e=>e.selector?.type==="djvu").map(e=>({page:p(e.selector.page)||1,x:p(e.selector.x),y:p(e.selector.y),w:p(e.selector.w),h:p(e.selector.h),title:e.description,color:re(e),ann:oe(e)?e:void 0})),U=R?.color??W;if(R?.selector.type==="djvu"){const e=R.selector;O.push({page:p(e.page)||1,x:p(e.x),y:p(e.y),w:p(e.w),h:p(e.h),color:R.color})}const C=u.useRef(new Map),z=ce(c,()=>{const e=[];for(let n=1;n<=i;n++){const t=C.current.get(n);t&&e.push(t)}return e},i>0&&y>0);ie(c);const F=u.useRef(z);F.current=z,u.useLayoutEffect(()=>{z.restoreAnchor()},[g]),u.useEffect(()=>{const e=c.current;e&&!e.closest(".chunk-body")&&e.focus({preventScroll:!0})},[]),u.useLayoutEffect(()=>{const e=c.current;if(!e)return;const n=new ResizeObserver(([t])=>A(t.contentRect.width));return n.observe(e),()=>n.disconnect()},[]);const k=Math.min(y,1e3)*g;u.useEffect(()=>{const e=c.current;if(!e)return;let n=!1,t=0;const o=a=>{(a.ctrlKey||a.altKey||a.metaKey)&&(a.preventDefault(),n||(F.current.captureAnchor(),n=!0),clearTimeout(t),t=window.setTimeout(()=>n=!1,250),x(h=>Math.min(5,Math.max(.4,h*(a.deltaY<0?1.1:1/1.1)))))};return e.addEventListener("wheel",o,{passive:!1}),()=>{e.removeEventListener("wheel",o),clearTimeout(t)}},[]),u.useEffect(()=>{let e=!1;return w(0),N(null),B(new Set),P(new Map),C.current.clear(),T.current.clear(),(async()=>{const n=await fetch(se(s.path)).then(o=>o.arrayBuffer()),t=await he(n,s.path);e||w(t)})().catch(n=>!e&&N(String(n.message||n))),()=>{e=!0}},[s.path]),u.useEffect(()=>{if(!i)return;const e=new IntersectionObserver(n=>{B(t=>{const o=new Set(t);for(const a of n){const h=Number(a.target.dataset.page);a.isIntersecting?o.add(h):o.delete(h)}return o.size===t.size&&[...o].every(a=>t.has(a))?t:o})},{root:c.current,rootMargin:"2000px 0px"});for(const n of C.current.values())e.observe(n);return()=>e.disconnect()},[i,y>0]),u.useEffect(()=>{let e=!0;return E.forEach(n=>{D.has(n)||fe(n).then(t=>{T.current.set(n,{w:t.w,h:t.h}),e&&P(o=>new Map(o).set(n,t))}).catch(()=>{})}),P(n=>{let t=!1;const o=new Map(n);for(const a of o.keys())E.has(a)||(o.delete(a),t=!0);return t?o:n}),()=>{e=!1}},[E]);const G=()=>{const e=window.getSelection();if(!e||e.isCollapsed||!e.anchorNode)return;const t=(e.anchorNode.nodeType===1?e.anchorNode:e.anchorNode.parentElement)?.closest(".djvu-page-wrap");if(!t||!c.current?.contains(t))return;const o=Number(t.dataset.page),a=t.getBoundingClientRect(),h=a.width/(D.get(o)?.w||1);if(!h)return;const l=e.getRangeAt(0).getBoundingClientRect();l.width<2||l.height<2||H({type:"djvu",page:o,x:Math.round((l.left-a.left)/h),y:Math.round((l.top-a.top)/h),w:Math.round(l.width/h),h:Math.round(l.height/h)},{x:l.left,y:l.bottom+6})},I=(e,n)=>n.getBoundingClientRect().width/(D.get(e)?.w||1),J=(e,n)=>{const t=n.currentTarget.getBoundingClientRect(),o=I(e,n.currentTarget);j({page:e,x0:(n.clientX-t.left)/o,y0:(n.clientY-t.top)/o,x1:(n.clientX-t.left)/o,y1:(n.clientY-t.top)/o})},$=(e,n)=>{const t=n.currentTarget.getBoundingClientRect(),o=I(e,n.currentTarget);j(a=>a&&{...a,x1:(n.clientX-t.left)/o,y1:(n.clientY-t.top)/o})},ee=(e,n)=>{const t=f;if(j(null),!t||t.page!==e)return;const o=I(e,n.currentTarget),a=Math.min(t.x0,t.x1),h=Math.min(t.y0,t.y1),l=Math.abs(t.x1-t.x0),r=Math.abs(t.y1-t.y0);if(l*o<3||r*o<3)return;const M=n.currentTarget.getBoundingClientRect();H({type:"djvu",page:e,x:Math.round(a),y:Math.round(h),w:Math.round(l),h:Math.round(r)},{x:M.left+a*o,y:M.top+(h+r)*o+6})};return b?d.jsxs("div",{className:"error",children:["djvu: ",b]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"filedjvu yo-zoomable",ref:c,tabIndex:0,onMouseUp:G,children:[i===0&&d.jsx("div",{className:"loading",children:"opening djvu…"}),y>0&&Array.from({length:i},(e,n)=>{const t=n+1,o=E.has(t)?D.get(t):void 0,a=T.current.get(t),h=k*(a?a.h/a.w:Math.SQRT2),l=o?k/o.w:0;return d.jsx("div",{className:"djvu-page-wrap","data-page":t,ref:r=>{r?C.current.set(t,r):C.current.delete(t)},style:{width:k,height:o?void 0:h},children:o?d.jsxs(d.Fragment,{children:[d.jsx(pe,{image:o.image}),o.zones.length>0?d.jsx("div",{className:"djvu-textlayer",children:o.zones.map((r,M)=>d.jsx("span",{style:{left:r.x*l,top:r.y*l,width:r.width*l,height:r.height*l,fontSize:r.height*l},children:r.text},M))}):d.jsx("div",{className:"djvu-marquee",onMouseDown:r=>J(t,r),onMouseMove:r=>$(t,r),onMouseUp:r=>ee(t,r),children:f?.page===t&&d.jsx("div",{className:"djvu-region",style:{left:Math.min(f.x0,f.x1)*l,top:Math.min(f.y0,f.y1)*l,width:Math.abs(f.x1-f.x0)*l,height:Math.abs(f.y1-f.y0)*l,borderColor:U,background:U+"2e"}})}),O.filter(r=>r.page===t).map((r,M)=>{const K=r.color||W;return d.jsx("div",{id:r.ann?.fragmentSlug?ae(s.path,r.ann.fragmentSlug):void 0,className:"djvu-region"+(r.ann?" editable":""),title:r.ann?r.title||"click to recolor or delete":r.title,onClick:r.ann?L=>{L.stopPropagation(),Z(r.ann,{x:L.clientX,y:L.clientY})}:void 0,style:{left:r.x*l,top:r.y*l,width:r.w*l,height:r.h*l,borderColor:K,background:K+"2e"}},M)})]}):d.jsx("div",{className:"djvu-placeholder",children:E.has(t)?"decoding…":""})},n)})]}),q]})}export{xe as DjvuView};
@@ -1,4 +1,4 @@
1
- import{g as mi,d as an,j as un,r as Pn,b as yi}from"./index-DXrtwPKE.js";import{c as Tn}from"./_commonjs-dynamic-modules-TDtrdbi3.js";var pt={exports:{}};(function(Je,ln){(function(C){Je.exports=C()})(function(){return function C(ie,k,D){function m(f,s){if(!k[f]){if(!ie[f]){var i=typeof Tn=="function"&&Tn;if(!s&&i)return i(f,!0);if(a)return a(f,!0);var e=new Error("Cannot find module '"+f+"'");throw e.code="MODULE_NOT_FOUND",e}var r=k[f]={exports:{}};ie[f][0].call(r.exports,function(d){var p=ie[f][1][d];return m(p||d)},r,r.exports,C,ie,k,D)}return k[f].exports}for(var a=typeof Tn=="function"&&Tn,g=0;g<D.length;g++)m(D[g]);return m}({1:[function(C,ie,k){var D=C("../../lib/promises");k.Files=m;function m(){function a(g){return D.reject(new Error("could not open external image: '"+g+`'
1
+ import{g as mi,d as an,j as un,r as Pn,b as yi}from"./index-Bf2L7I9e.js";import{c as Tn}from"./_commonjs-dynamic-modules-TDtrdbi3.js";var pt={exports:{}};(function(Je,ln){(function(C){Je.exports=C()})(function(){return function C(ie,k,D){function m(f,s){if(!k[f]){if(!ie[f]){var i=typeof Tn=="function"&&Tn;if(!s&&i)return i(f,!0);if(a)return a(f,!0);var e=new Error("Cannot find module '"+f+"'");throw e.code="MODULE_NOT_FOUND",e}var r=k[f]={exports:{}};ie[f][0].call(r.exports,function(d){var p=ie[f][1][d];return m(p||d)},r,r.exports,C,ie,k,D)}return k[f].exports}for(var a=typeof Tn=="function"&&Tn,g=0;g<D.length;g++)m(D[g]);return m}({1:[function(C,ie,k){var D=C("../../lib/promises");k.Files=m;function m(){function a(g){return D.reject(new Error("could not open external image: '"+g+`'
2
2
  cannot open linked files from a web browser`))}return{read:a}}},{"../../lib/promises":23}],2:[function(C,ie,k){var D=C("../lib/promises"),m=C("../lib/zipfile");k.openZip=a;function a(g){return g.arrayBuffer?D.resolve(m.openArrayBuffer(g.arrayBuffer)):D.reject(new Error("Could not find file in options"))}},{"../lib/promises":23,"../lib/zipfile":40}],3:[function(C,ie,k){var D=C("underscore"),m=C("./promises"),a=C("./documents"),g=C("./styles/html-paths"),f=C("./results"),s=C("./images"),i=C("./html"),e=C("./writers");k.DocumentConverter=r;function r(t){return{convertToHtml:function(n){var b=D.indexBy(n.type===a.types.document?n.comments:[],"commentId"),U=new d(t,b);return U.convertToHtml(n)}}}function d(t,n){var b=1,U=[],M=[];t=D.extend({ignoreEmptyParagraphs:!0},t);var E=t.idPrefix===void 0?"":t.idPrefix,W=t.ignoreEmptyParagraphs,I=g.topLevelElement("p"),R=t.styleMap||[];function A(_){var oe=[],q=ae(_,oe,{}),X=[];h(q,function(l){l.type==="deferred"&&X.push(l)});var x={};return m.mapSeries(X,function(l){return l.value().then(function(v){x[l.id]=v})}).then(function(){function l(S){return u(S,function(O){return O.type==="deferred"?x[O.id]:O.children?[D.extend({},O,{children:l(O.children)})]:[O]})}var v=e.writer({prettyPrint:t.prettyPrint,outputFormat:t.outputFormat});return i.write(v,i.simplify(l(q))),new f.Result(v.asString(),oe)})}function Y(_,oe,q){return u(_,function(X){return ae(X,oe,q)})}function ae(_,oe,q){if(!q)throw new Error("options not set");var X=Le[_.type];return X?X(_,oe,q):[]}function F(_,oe,q){return H(_,oe).wrap(function(){var X=Y(_.children,oe,q);return W?X:[i.forceWrite].concat(X)})}function H(_,oe){var q=V(_);return q?q.to:(_.styleId&&oe.push(y("paragraph",_)),I)}function T(_,oe,q){var X=function(){return Y(_.children,oe,q)},x=[];if(_.highlight!==null){var l=z({type:"highlight",color:_.highlight});l&&x.push(l)}_.isSmallCaps&&x.push($("smallCaps")),_.isAllCaps&&x.push($("allCaps")),_.isStrikethrough&&x.push($("strikethrough","s")),_.isUnderline&&x.push($("underline")),_.verticalAlignment===a.verticalAlignment.subscript&&x.push(g.element("sub",{},{fresh:!1})),_.verticalAlignment===a.verticalAlignment.superscript&&x.push(g.element("sup",{},{fresh:!1})),_.isItalic&&x.push($("italic","em")),_.isBold&&x.push($("bold","strong"));var v=g.empty,S=V(_);return S?v=S.to:_.styleId&&oe.push(y("run",_)),x.push(v),x.forEach(function(O){X=O.wrap.bind(O,X)}),X()}function $(_,oe){var q=z({type:_});return q||(oe?g.element(oe,{},{fresh:!1}):g.empty)}function z(_,oe){var q=V(_);return q?q.to:oe}function V(_){for(var oe=0;oe<R.length;oe++)if(R[oe].from.matches(_))return R[oe]}function re(_){return function(oe,q){return m.attempt(function(){return _(oe,q)}).caught(function(X){return q.push(f.error(X)),[]})}}function K(_){return j(_.noteType,_.noteId)}function le(_){return ee(_.noteType,_.noteId)}function j(_,oe){return ye(_+"-"+oe)}function ee(_,oe){return ye(_+"-ref-"+oe)}function ye(_){return E+_}var ne=g.elements([g.element("table",{},{fresh:!0})]);function he(_,oe,q){return z(_,ne).wrap(function(){return we(_,oe,q)})}function we(_,oe,q){var X=D.findIndex(_.children,function(S){return!S.type===a.types.tableRow||!S.isHeader});X===-1&&(X=_.children.length);var x;if(X===0)x=Y(_.children,oe,D.extend({},q,{isTableHeader:!1}));else{var l=Y(_.children.slice(0,X),oe,D.extend({},q,{isTableHeader:!0})),v=Y(_.children.slice(X),oe,D.extend({},q,{isTableHeader:!1}));x=[i.freshElement("thead",{},l),i.freshElement("tbody",{},v)]}return[i.forceWrite].concat(x)}function _e(_,oe,q){var X=Y(_.children,oe,q);return[i.freshElement("tr",{},[i.forceWrite].concat(X))]}function ve(_,oe,q){var X=q.isTableHeader?"th":"td",x=Y(_.children,oe,q),l={};return _.colSpan!==1&&(l.colspan=_.colSpan.toString()),_.rowSpan!==1&&(l.rowspan=_.rowSpan.toString()),[i.freshElement(X,l,[i.forceWrite].concat(x))]}function De(_,oe,q){return z(_,g.ignore).wrap(function(){var X=n[_.commentId],x=M.length+1,l="["+o(X)+x+"]";return M.push({label:l,comment:X}),[i.freshElement("a",{href:"#"+j("comment",_.commentId),id:ee("comment",_.commentId)},[i.text(l)])]})}function Ce(_,oe,q){var X=_.label,x=_.comment,l=Y(x.body,oe,q).concat([i.nonFreshElement("p",{},[i.text(" "),i.freshElement("a",{href:"#"+ee("comment",x.commentId)},[i.text("↑")])])]);return[i.freshElement("dt",{id:j("comment",x.commentId)},[i.text("Comment "+X)]),i.freshElement("dd",{},l)]}function Se(_,oe,q){return Ne(_).wrap(function(){return[]})}function Ne(_){var oe=V(_);return oe?oe.to:_.breakType==="line"?g.topLevelElement("br"):g.empty}var Le={document:function(_,oe,q){var X=Y(_.children,oe,q),x=U.map(function(v){return _.notes.resolve(v)}),l=Y(x,oe,q);return X.concat([i.freshElement("ol",{},l),i.freshElement("dl",{},u(M,function(v){return Ce(v,oe,q)}))])},paragraph:F,run:T,text:function(_,oe,q){return[i.text(_.value)]},tab:function(_,oe,q){return[i.text(" ")]},hyperlink:function(_,oe,q){var X=_.anchor?"#"+ye(_.anchor):_.href,x={href:X};_.targetFrame!=null&&(x.target=_.targetFrame);var l=Y(_.children,oe,q);return[i.nonFreshElement("a",x,l)]},checkbox:function(_){var oe={type:"checkbox"};return _.checked&&(oe.checked="checked"),[i.freshElement("input",oe)]},bookmarkStart:function(_,oe,q){var X=i.freshElement("a",{id:ye(_.name)},[i.forceWrite]);return[X]},noteReference:function(_,oe,q){U.push(_);var X=i.freshElement("a",{href:"#"+K(_),id:le(_)},[i.text("["+b+++"]")]);return[i.freshElement("sup",{},[X])]},note:function(_,oe,q){var X=Y(_.body,oe,q),x=i.elementWithTag(g.element("p",{},{fresh:!1}),[i.text(" "),i.freshElement("a",{href:"#"+le(_)},[i.text("↑")])]),l=X.concat([x]);return i.freshElement("li",{id:K(_)},l)},commentReference:De,comment:Ce,image:c(re(t.convertImage||s.dataUri)),table:he,tableRow:_e,tableCell:ve,break:Se};return{convertToHtml:A}}var p=1;function c(t){return function(n,b,U){return[{type:"deferred",id:p++,value:function(){return t(n,b,U)}}]}}function y(t,n){return f.warning("Unrecognised "+t+" style: '"+n.styleName+"' (Style ID: "+n.styleId+")")}function u(t,n){return D.flatten(t.map(n),!0)}function h(t,n){t.forEach(function(b){n(b),b.children&&h(b.children,n)})}var o=k.commentAuthorLabel=function(n){return n.authorInitials||""}},{"./documents":4,"./html":18,"./images":20,"./promises":23,"./results":25,"./styles/html-paths":28,"./writers":33,underscore:102}],4:[function(C,ie,k){(function(D){var m=C("underscore"),a=k.types={document:"document",paragraph:"paragraph",run:"run",text:"text",tab:"tab",checkbox:"checkbox",hyperlink:"hyperlink",noteReference:"noteReference",image:"image",note:"note",commentReference:"commentReference",comment:"comment",table:"table",tableRow:"tableRow",tableCell:"tableCell",break:"break",bookmarkStart:"bookmarkStart"};function g(I,R){return R=R||{},{type:a.document,children:I,notes:R.notes||new y({}),comments:R.comments||[]}}function f(I,R){R=R||{};var A=R.indent||{};return{type:a.paragraph,children:I,styleId:R.styleId||null,styleName:R.styleName||null,numbering:R.numbering||null,alignment:R.alignment||null,indent:{start:A.start||null,end:A.end||null,firstLine:A.firstLine||null,hanging:A.hanging||null}}}function s(I,R){return R=R||{},{type:a.run,children:I,styleId:R.styleId||null,styleName:R.styleName||null,isBold:!!R.isBold,isUnderline:!!R.isUnderline,isItalic:!!R.isItalic,isStrikethrough:!!R.isStrikethrough,isAllCaps:!!R.isAllCaps,isSmallCaps:!!R.isSmallCaps,verticalAlignment:R.verticalAlignment||i.baseline,font:R.font||null,fontSize:R.fontSize||null,highlight:R.highlight||null}}var i={baseline:"baseline",superscript:"superscript",subscript:"subscript"};function e(I){return{type:a.text,value:I}}function r(){return{type:a.tab}}function d(I){return{type:a.checkbox,checked:I.checked}}function p(I,R){return{type:a.hyperlink,children:I,href:R.href,anchor:R.anchor,targetFrame:R.targetFrame}}function c(I){return{type:a.noteReference,noteType:I.noteType,noteId:I.noteId}}function y(I){this._notes=m.indexBy(I,function(R){return t(R.noteType,R.noteId)})}y.prototype.resolve=function(I){return this.findNoteByKey(t(I.noteType,I.noteId))},y.prototype.findNoteByKey=function(I){return this._notes[I]||null};function u(I){return{type:a.note,noteType:I.noteType,noteId:I.noteId,body:I.body}}function h(I){return{type:a.commentReference,commentId:I.commentId}}function o(I){return{type:a.comment,commentId:I.commentId,body:I.body,authorName:I.authorName,authorInitials:I.authorInitials}}function t(I,R){return I+"-"+R}function n(I){return{type:a.image,read:function(R){return R?I.readImage(R):I.readImage().then(function(A){return D.from(A)})},readAsArrayBuffer:function(){return I.readImage()},readAsBase64String:function(){return I.readImage("base64")},readAsBuffer:function(){return I.readImage().then(function(R){return D.from(R)})},altText:I.altText,contentType:I.contentType}}function b(I,R){return R=R||{},{type:a.table,children:I,styleId:R.styleId||null,styleName:R.styleName||null}}function U(I,R){return R=R||{},{type:a.tableRow,children:I,isHeader:R.isHeader||!1}}function M(I,R){return R=R||{},{type:a.tableCell,children:I,colSpan:R.colSpan==null?1:R.colSpan,rowSpan:R.rowSpan==null?1:R.rowSpan}}function E(I){return{type:a.break,breakType:I}}function W(I){return{type:a.bookmarkStart,name:I.name}}k.document=k.Document=g,k.paragraph=k.Paragraph=f,k.run=k.Run=s,k.text=k.Text=e,k.tab=k.Tab=r,k.checkbox=k.Checkbox=d,k.Hyperlink=p,k.noteReference=k.NoteReference=c,k.Notes=y,k.Note=u,k.commentReference=h,k.comment=o,k.Image=n,k.Table=b,k.TableRow=U,k.TableCell=M,k.lineBreak=E("line"),k.pageBreak=E("page"),k.columnBreak=E("column"),k.BookmarkStart=W,k.verticalAlignment=i}).call(this,C("buffer").Buffer)},{buffer:83,underscore:102}],5:[function(C,ie,k){k.createBodyReader=r,k._readNumberingProperties=p;var D=C("dingbat-to-unicode"),m=C("underscore"),a=C("../documents"),g=C("../results").Result,f=C("../results").warning,s=C("../xml"),i=C("../transforms"),e=C("./uris");function r(E){return{readXmlElement:function(W){return new d(E).readXmlElement(W)},readXmlElements:function(W){return new d(E).readXmlElements(W)}}}function d(E){var W=[],I=[],R=[],A=E.relationships,Y=E.contentTypes,ae=E.docxFile,F=E.files,H=E.numbering,T=E.styles;function $(ce){var be=ce.map(z);return b(be)}function z(ce){if(ce.type==="element"){var be=X[ce.name];if(be)return be(ce);if(!Object.prototype.hasOwnProperty.call(y,ce.name)){var xe=f("An unrecognised element was ignored: "+ce.name);return u([xe])}}return h()}function V(ce){return ne(ce).map(function(be){return{type:"paragraphProperties",styleId:be.styleId,styleName:be.name,alignment:ce.firstOrEmpty("w:jc").attributes["w:val"],numbering:p(be.styleId,ce.firstOrEmpty("w:numPr"),H),indent:re(ce.firstOrEmpty("w:ind"))}})}function re(ce){return{start:ce.attributes["w:start"]||ce.attributes["w:left"],end:ce.attributes["w:end"]||ce.attributes["w:right"],firstLine:ce.attributes["w:firstLine"],hanging:ce.attributes["w:hanging"]}}function K(ce){return he(ce).map(function(be){var xe=ce.firstOrEmpty("w:sz").attributes["w:val"],Fe=/^[0-9]+$/.test(xe)?parseInt(xe,10)/2:null;return{type:"runProperties",styleId:be.styleId,styleName:be.name,verticalAlignment:ce.firstOrEmpty("w:vertAlign").attributes["w:val"],font:ce.firstOrEmpty("w:rFonts").attributes["w:ascii"],fontSize:Fe,isBold:j(ce.first("w:b")),isUnderline:le(ce.first("w:u")),isItalic:j(ce.first("w:i")),isStrikethrough:j(ce.first("w:strike")),isAllCaps:j(ce.first("w:caps")),isSmallCaps:j(ce.first("w:smallCaps")),highlight:ye(ce.firstOrEmpty("w:highlight").attributes["w:val"])}})}function le(ce){if(ce){var be=ce.attributes["w:val"];return be!==void 0&&be!=="false"&&be!=="0"&&be!=="none"}else return!1}function j(ce){if(ce){var be=ce.attributes["w:val"];return be!=="false"&&be!=="0"}else return!1}function ee(ce){return ce!=="false"&&ce!=="0"}function ye(ce){return!ce||ce==="none"?null:ce}function ne(ce){return _e(ce,"w:pStyle","Paragraph",T.findParagraphStyleById)}function he(ce){return _e(ce,"w:rStyle","Run",T.findCharacterStyleById)}function we(ce){return _e(ce,"w:tblStyle","Table",T.findTableStyleById)}function _e(ce,be,xe,Fe){var ke=[],Me=ce.first(be),Pe=null,Xe=null;if(Me&&(Pe=Me.attributes["w:val"],Pe)){var Ze=Fe(Pe);Ze?Xe=Ze.name:ke.push(Re(xe,Pe))}return t({styleId:Pe,name:Xe},ke)}function ve(ce){var be=ce.attributes["w:fldCharType"];if(be==="begin")W.push({type:"begin",fldChar:ce}),I=[];else if(be==="end"){var xe=W.pop();if(xe.type==="begin"&&(xe=Ce(xe)),xe.type==="checkbox")return o(a.checkbox({checked:xe.checked}))}else if(be==="separate"){var Fe=W.pop(),ke=Ce(Fe);W.push(ke)}return h()}function De(){var ce=m.last(W.filter(function(be){return be.type==="hyperlink"}));return ce?ce.options:null}function Ce(ce){return Se(I.join(""),ce.type==="begin"?ce.fldChar:s.emptyElement)}function Se(ce,be){var xe=/^\s*HYPERLINK\s+(\\l\s+)?(?:"(.*)"|([^\\]\S*))/.exec(ce);if(xe){var Fe=xe[2]===void 0?xe[3]:xe[2],ke=xe[1]===void 0?{href:Fe}:{anchor:Fe};return{type:"hyperlink",options:ke}}var Me=/\s*FORMCHECKBOX\s*/.exec(ce);if(Me){var Pe=be.firstOrEmpty("w:ffData").firstOrEmpty("w:checkBox"),Xe=Pe.first("w:checked"),Ze=Xe==null?j(Pe.first("w:default")):j(Xe);return{type:"checkbox",checked:Ze}}return{type:"unknown"}}function Ne(ce){return I.push(ce.text()),h()}function Le(ce){var be=ce.attributes["w:font"],xe=ce.attributes["w:char"],Fe=D.hex(be,xe);return Fe==null&&/^F0..$/.test(xe)&&(Fe=D.hex(be,xe.substring(2))),Fe==null?u([f("A w:sym element with an unsupported character was ignored: char "+xe+" in font "+be)]):o(new a.Text(Fe.string))}function _(ce){return function(be){var xe=be.attributes["w:id"];return o(new a.NoteReference({noteType:ce,noteId:xe}))}}function oe(ce){return o(a.commentReference({commentId:ce.attributes["w:id"]}))}function q(ce){return $(ce.children)}var X={"w:p":function(ce){var be=ce.firstOrEmpty("w:pPr"),xe=!!be.firstOrEmpty("w:rPr").first("w:del");if(xe)return ce.children.forEach(function(ke){R.push(ke)}),h();var Fe=ce.children;return R.length>0&&(Fe=R.concat(Fe),R=[]),n.map(V(be),$(Fe),function(ke,Me){return new a.Paragraph(Me,ke)}).insertExtra()},"w:r":function(ce){return n.map(K(ce.firstOrEmpty("w:rPr")),$(ce.children),function(be,xe){var Fe=De();return Fe!==null&&(xe=[new a.Hyperlink(xe,Fe)]),new a.Run(xe,be)})},"w:fldChar":ve,"w:instrText":Ne,"w:t":function(ce){return o(new a.Text(ce.text()))},"w:tab":function(ce){return o(new a.Tab)},"w:noBreakHyphen":function(){return o(new a.Text("‑"))},"w:softHyphen":function(ce){return o(new a.Text("­"))},"w:sym":Le,"w:hyperlink":function(ce){var be=ce.attributes["r:id"],xe=ce.attributes["w:anchor"];return $(ce.children).map(function(Fe){function ke(Pe){var Xe=ce.attributes["w:tgtFrame"]||null;return new a.Hyperlink(Fe,m.extend({targetFrame:Xe},Pe))}if(be){var Me=A.findTargetByRelationshipId(be);return xe&&(Me=e.replaceFragment(Me,xe)),ke({href:Me})}else return xe?ke({anchor:xe}):Fe})},"w:tbl":x,"w:tr":v,"w:tc":S,"w:footnoteReference":_("footnote"),"w:endnoteReference":_("endnote"),"w:commentReference":oe,"w:br":function(ce){var be=ce.attributes["w:type"];return be==null||be==="textWrapping"?o(a.lineBreak):be==="page"?o(a.pageBreak):be==="column"?o(a.columnBreak):u([f("Unsupported break type: "+be)])},"w:bookmarkStart":function(ce){var be=ce.attributes["w:name"];return be==="_GoBack"?h():o(new a.BookmarkStart({name:be}))},"mc:AlternateContent":function(ce){return q(ce.firstOrEmpty("mc:Fallback"))},"w:sdt":function(ce){var be=$(ce.firstOrEmpty("w:sdtContent").children);return be.map(function(xe){var Fe=ce.firstOrEmpty("w:sdtPr").first("wordml:checkbox");if(Fe){var ke=Fe.first("wordml:checked"),Me=!!ke&&ee(ke.attributes["wordml:val"]),Pe=a.checkbox({checked:Me}),Xe=!1,Ze=xe.map(i._elementsOfType(a.types.text,function(N){return N.value.length>0&&!Xe?(Xe=!0,Pe):N}));return Xe?Ze:Pe}else return xe})},"w:ins":q,"w:object":q,"w:smartTag":q,"w:drawing":q,"w:pict":function(ce){return q(ce).toExtra()},"v:roundrect":q,"v:shape":q,"v:textbox":q,"w:txbxContent":q,"wp:inline":Z,"wp:anchor":Z,"v:imagedata":Ae,"v:group":q,"v:rect":q};return{readXmlElement:z,readXmlElements:$};function x(ce){var be=l(ce.firstOrEmpty("w:tblPr"));return $(ce.children).flatMap(J).flatMap(function(xe){return be.map(function(Fe){return a.Table(xe,Fe)})})}function l(ce){return we(ce).map(function(be){return{styleId:be.styleId,styleName:be.name}})}function v(ce){var be=ce.firstOrEmpty("w:trPr"),xe=!!be.first("w:del");if(xe)return h();var Fe=!!be.first("w:tblHeader");return $(ce.children).map(function(ke){return a.TableRow(ke,{isHeader:Fe})})}function S(ce){return $(ce.children).map(function(be){var xe=ce.firstOrEmpty("w:tcPr"),Fe=xe.firstOrEmpty("w:gridSpan").attributes["w:val"],ke=Fe?parseInt(Fe,10):1,Me=a.TableCell(be,{colSpan:ke});return Me._vMerge=O(xe),Me})}function O(ce){var be=ce.first("w:vMerge");if(be){var xe=be.attributes["w:val"];return xe==="continue"||!xe}else return null}function J(ce){var be=m.any(ce,function(ke){return ke.type!==a.types.tableRow});if(be)return L(ce),t(ce,[f("unexpected non-row element in table, cell merging may be incorrect")]);var xe=m.any(ce,function(ke){return m.any(ke.children,function(Me){return Me.type!==a.types.tableCell})});if(xe)return L(ce),t(ce,[f("unexpected non-cell element in table row, cell merging may be incorrect")]);var Fe={};return ce.forEach(function(ke){var Me=0;ke.children.forEach(function(Pe){Pe._vMerge&&Fe[Me]?Fe[Me].rowSpan++:(Fe[Me]=Pe,Pe._vMerge=!1),Me+=Pe.colSpan})}),ce.forEach(function(ke){ke.children=ke.children.filter(function(Me){return!Me._vMerge}),ke.children.forEach(function(Me){delete Me._vMerge})}),o(ce)}function L(ce){ce.forEach(function(be){var xe=i.getDescendantsOfType(be,a.types.tableCell);xe.forEach(function(Fe){delete Fe._vMerge})})}function Z(ce){var be=ce.getElementsByTagName("a:graphic").getElementsByTagName("a:graphicData").getElementsByTagName("pic:pic").getElementsByTagName("pic:blipFill").getElementsByTagName("a:blip");return b(be.map(ue.bind(null,ce)))}function ue(ce,be){var xe=ce.firstOrEmpty("wp:docPr"),Fe=xe.attributes,ke=fe(Fe.descr)?Fe.title:Fe.descr,Me=ge(be);return Me===null?u([f("Could not find image file for a:blip element")]):Ee(Me,ke).map(function(Pe){var Xe=xe.firstOrEmpty("a:hlinkClick"),Ze=Xe.attributes["r:id"];if(Ze){var N=A.findTargetByRelationshipId(Ze);return new a.Hyperlink([Pe],{href:N})}else return Pe})}function fe(ce){return ce==null||/^\s*$/.test(ce)}function ge(ce){var be=ce.attributes["r:embed"],xe=ce.attributes["r:link"];if(be)return Be(be);if(xe){var Fe=A.findTargetByRelationshipId(xe);return{path:Fe,read:F.read.bind(F,Fe)}}else return null}function Ae(ce){var be=ce.attributes["r:id"];return be?Ee(Be(be),ce.attributes["o:title"]):u([f("A v:imagedata element without a relationship ID was ignored")])}function Be(ce){var be=e.uriToZipEntryName("word",A.findTargetByRelationshipId(ce));return{path:be,read:ae.read.bind(ae,be)}}function Ee(ce,be){var xe=Y.findContentType(ce.path),Fe=a.Image({readImage:ce.read,altText:be,contentType:xe}),ke=c[xe]?[]:f("Image of type "+xe+" is unlikely to display in web browsers");return t(Fe,ke)}function Re(ce,be){return f(ce+" style with ID "+be+" was referenced but not defined in the document")}}function p(E,W,I){var R=W.firstOrEmpty("w:ilvl").attributes["w:val"],A=W.firstOrEmpty("w:numId").attributes["w:val"];if(R!==void 0&&A!==void 0)return I.findLevel(A,R);if(E!=null){var Y=I.findLevelByParagraphStyleId(E);if(Y!=null)return Y}return A!==void 0?I.findLevel(A,"0"):null}var c={"image/png":!0,"image/gif":!0,"image/jpeg":!0,"image/svg+xml":!0,"image/tiff":!0},y={"office-word:wrap":!0,"v:shadow":!0,"v:shapetype":!0,"w:annotationRef":!0,"w:bookmarkEnd":!0,"w:sectPr":!0,"w:proofErr":!0,"w:lastRenderedPageBreak":!0,"w:commentRangeStart":!0,"w:commentRangeEnd":!0,"w:del":!0,"w:footnoteRef":!0,"w:endnoteRef":!0,"w:pPr":!0,"w:rPr":!0,"w:tblPr":!0,"w:tblGrid":!0,"w:trPr":!0,"w:tcPr":!0};function u(E){return new n(null,null,E)}function h(){return new n(null)}function o(E){return new n(E)}function t(E,W){return new n(E,null,W)}function n(E,W,I){this.value=E||[],this.extra=W||[],this._result=new g({element:this.value,extra:W},I),this.messages=this._result.messages}n.prototype.toExtra=function(){return new n(null,U(this.extra,this.value),this.messages)},n.prototype.insertExtra=function(){var E=this.extra;return E&&E.length?new n(U(this.value,E),null,this.messages):this},n.prototype.map=function(E){var W=this._result.map(function(I){return E(I.element)});return new n(W.value,this.extra,W.messages)},n.prototype.flatMap=function(E){var W=this._result.flatMap(function(I){return E(I.element)._result});return new n(W.value.element,U(this.extra,W.value.extra),W.messages)},n.map=function(E,W,I){return new n(I(E.value,W.value),U(E.extra,W.extra),E.messages.concat(W.messages))};function b(E){var W=g.combine(m.pluck(E,"_result"));return new n(m.flatten(m.pluck(W.value,"element")),m.filter(m.flatten(m.pluck(W.value,"extra")),M),W.messages)}function U(E,W){return m.flatten([E,W])}function M(E){return E}},{"../documents":4,"../results":25,"../transforms":30,"../xml":35,"./uris":16,"dingbat-to-unicode":85,underscore:102}],6:[function(C,ie,k){var D=C("../documents"),m=C("../results").Result;function a(g){function f(i){return m.combine(i.getElementsByTagName("w:comment").map(s))}function s(i){var e=i.attributes["w:id"];function r(d){return(i.attributes[d]||"").trim()||null}return g.readXmlElements(i.children).map(function(d){return D.comment({commentId:e,body:d,authorName:r("w:author"),authorInitials:r("w:initials")})})}return f}k.createCommentsReader=a},{"../documents":4,"../results":25}],7:[function(C,ie,k){k.readContentTypesFromXml=m;var D={png:"png",gif:"gif",jpeg:"jpeg",jpg:"jpeg",tif:"tiff",tiff:"tiff",bmp:"bmp"};k.defaultContentTypes=a({},{});function m(g){var f={},s={};return g.children.forEach(function(i){if(i.name==="content-types:Default"&&(f[i.attributes.Extension]=i.attributes.ContentType),i.name==="content-types:Override"){var e=i.attributes.PartName;e.charAt(0)==="/"&&(e=e.substring(1)),s[e]=i.attributes.ContentType}}),a(s,f)}function a(g,f){return{findContentType:function(s){var i=g[s];if(i)return i;var e=s.split("."),r=e[e.length-1];if(f.hasOwnProperty(r))return f[r];var d=D[r.toLowerCase()];return d?"image/"+d:null}}}},{}],8:[function(C,ie,k){k.DocumentXmlReader=a;var D=C("../documents"),m=C("../results").Result;function a(g){var f=g.bodyReader;function s(i){var e=i.first("w:body");if(e==null)throw new Error("Could not find the body element: are you sure this is a docx file?");var r=f.readXmlElements(e.children).map(function(d){return new D.Document(d,{notes:g.notes,comments:g.comments})});return new m(r.value,r.messages)}return{convertXmlToDocument:s}}},{"../documents":4,"../results":25}],9:[function(C,ie,k){k.read=h,k._findPartPaths=o;var D=C("../promises"),m=C("../documents"),a=C("../results").Result,g=C("../zipfile"),f=C("./office-xml-reader").readXmlFromZipFile,s=C("./body-reader").createBodyReader,i=C("./document-xml-reader").DocumentXmlReader,e=C("./relationships-reader"),r=C("./content-types-reader"),d=C("./numbering-xml"),p=C("./styles-reader"),c=C("./notes-reader"),y=C("./comments-reader"),u=C("./files").Files;function h(A,Y,ae){Y=Y||{},ae=ae||{};var F=new u({externalFileAccess:ae.externalFileAccess,relativeToFile:Y.path});return D.props({contentTypes:E(A),partPaths:o(A),docxFile:A,files:F}).also(function(H){return{styles:I(A,H.partPaths.styles)}}).also(function(H){return{numbering:W(A,H.partPaths.numbering,H.styles)}}).also(function(H){return{footnotes:U(H.partPaths.footnotes,H,function(T,$){return $?c.createFootnotesReader(T)($):new a([])}),endnotes:U(H.partPaths.endnotes,H,function(T,$){return $?c.createEndnotesReader(T)($):new a([])}),comments:U(H.partPaths.comments,H,function(T,$){return $?y.createCommentsReader(T)($):new a([])})}}).also(function(H){return{notes:H.footnotes.flatMap(function(T){return H.endnotes.map(function($){return new m.Notes(T.concat($))})})}}).then(function(H){return U(H.partPaths.mainDocument,H,function(T,$){return H.notes.flatMap(function(z){return H.comments.flatMap(function(V){var re=new i({bodyReader:T,notes:z,comments:V});return re.convertXmlToDocument($)})})})})}function o(A){return R(A).then(function(Y){var ae=t({docxFile:A,relationships:Y,relationshipType:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",basePath:"",fallbackPath:"word/document.xml"});if(!A.exists(ae))throw new Error("Could not find main document part. Are you sure this is a valid .docx file?");return b({filename:M(ae),readElement:e.readRelationships,defaultValue:e.defaultValue})(A).then(function(F){function H(T){return t({docxFile:A,relationships:F,relationshipType:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/"+T,basePath:g.splitPath(ae).dirname,fallbackPath:"word/"+T+".xml"})}return{mainDocument:ae,comments:H("comments"),endnotes:H("endnotes"),footnotes:H("footnotes"),numbering:H("numbering"),styles:H("styles")}})})}function t(A){var Y=A.docxFile,ae=A.relationships,F=A.relationshipType,H=A.basePath,T=A.fallbackPath,$=ae.findTargetsByType(F),z=$.map(function(re){return n(g.joinPath(H,re),"/")}),V=z.filter(function(re){return Y.exists(re)});return V.length===0?T:V[0]}function n(A,Y){return A.substring(0,Y.length)===Y?A.substring(Y.length):A}function b(A){return function(Y){return f(Y,A.filename).then(function(ae){return ae?A.readElement(ae):A.defaultValue})}}function U(A,Y,ae){var F=b({filename:M(A),readElement:e.readRelationships,defaultValue:e.defaultValue});return F(Y.docxFile).then(function(H){var T=new s({relationships:H,contentTypes:Y.contentTypes,docxFile:Y.docxFile,numbering:Y.numbering,styles:Y.styles,files:Y.files});return f(Y.docxFile,A).then(function($){return ae(T,$)})})}function M(A){var Y=g.splitPath(A);return g.joinPath(Y.dirname,"_rels",Y.basename+".rels")}var E=b({filename:"[Content_Types].xml",readElement:r.readContentTypesFromXml,defaultValue:r.defaultContentTypes});function W(A,Y,ae){return b({filename:Y,readElement:function(F){return d.readNumberingXml(F,{styles:ae})},defaultValue:d.defaultNumbering})(A)}function I(A,Y){return b({filename:Y,readElement:p.readStylesXml,defaultValue:p.defaultStyles})(A)}var R=b({filename:"_rels/.rels",readElement:e.readRelationships,defaultValue:e.defaultValue})},{"../documents":4,"../promises":23,"../results":25,"../zipfile":40,"./body-reader":5,"./comments-reader":6,"./content-types-reader":7,"./document-xml-reader":8,"./files":1,"./notes-reader":10,"./numbering-xml":11,"./office-xml-reader":12,"./relationships-reader":13,"./styles-reader":15}],10:[function(C,ie,k){var D=C("../documents"),m=C("../results").Result;k.createFootnotesReader=a.bind(this,"footnote"),k.createEndnotesReader=a.bind(this,"endnote");function a(g,f){function s(r){return m.combine(r.getElementsByTagName("w:"+g).filter(i).map(e))}function i(r){var d=r.attributes["w:type"];return d!=="continuationSeparator"&&d!=="separator"}function e(r){var d=r.attributes["w:id"];return f.readXmlElements(r.children).map(function(p){return D.Note({noteType:g,noteId:d,body:p})})}return s}},{"../documents":4,"../results":25}],11:[function(C,ie,k){var D=C("underscore");k.readNumberingXml=a,k.Numbering=m,k.defaultNumbering=new m({},{});function m(i,e,r){var d=D.flatten(D.values(e).map(function(u){return D.values(u.levels)})),p=D.indexBy(d.filter(function(u){return u.paragraphStyleId!=null}),"paragraphStyleId");function c(u,h){var o=i[u];if(o){var t=e[o.abstractNumId];if(t){if(t.numStyleLink==null)return e[o.abstractNumId].levels[h];var n=r.findNumberingStyleById(t.numStyleLink);return c(n.numId,h)}else return null}else return null}function y(u){return p[u]||null}return{findLevel:c,findLevelByParagraphStyleId:y}}function a(i,e){if(!e||!e.styles)throw new Error("styles is missing");var r=g(i),d=s(i);return new m(d,r,e.styles)}function g(i){var e={};return i.getElementsByTagName("w:abstractNum").forEach(function(r){var d=r.attributes["w:abstractNumId"];e[d]=f(r)}),e}function f(i){var e={},r=null;i.getElementsByTagName("w:lvl").forEach(function(p){var c=p.attributes["w:ilvl"],y=p.firstOrEmpty("w:numFmt").attributes["w:val"],u=y!=="bullet",h=p.firstOrEmpty("w:pStyle").attributes["w:val"];c===void 0?r={isOrdered:u,level:"0",paragraphStyleId:h}:e[c]={isOrdered:u,level:c,paragraphStyleId:h}}),r!==null&&e[r.level]===void 0&&(e[r.level]=r);var d=i.firstOrEmpty("w:numStyleLink").attributes["w:val"];return{levels:e,numStyleLink:d}}function s(i){var e={};return i.getElementsByTagName("w:num").forEach(function(r){var d=r.attributes["w:numId"],p=r.first("w:abstractNumId").attributes["w:val"];e[d]={abstractNumId:p}}),e}},{underscore:102}],12:[function(C,ie,k){var D=C("underscore"),m=C("../promises"),a=C("../xml");k.read=f,k.readXmlFromZipFile=s;var g={"http://schemas.openxmlformats.org/wordprocessingml/2006/main":"w","http://schemas.openxmlformats.org/officeDocument/2006/relationships":"r","http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing":"wp","http://schemas.openxmlformats.org/drawingml/2006/main":"a","http://schemas.openxmlformats.org/drawingml/2006/picture":"pic","http://purl.oclc.org/ooxml/wordprocessingml/main":"w","http://purl.oclc.org/ooxml/officeDocument/relationships":"r","http://purl.oclc.org/ooxml/drawingml/wordprocessingDrawing":"wp","http://purl.oclc.org/ooxml/drawingml/main":"a","http://purl.oclc.org/ooxml/drawingml/picture":"pic","http://schemas.openxmlformats.org/package/2006/content-types":"content-types","http://schemas.openxmlformats.org/package/2006/relationships":"relationships","http://schemas.openxmlformats.org/markup-compatibility/2006":"mc","urn:schemas-microsoft-com:vml":"v","urn:schemas-microsoft-com:office:word":"office-word","http://schemas.microsoft.com/office/word/2010/wordml":"wordml"};function f(r){return a.readString(r,g).then(function(d){return e(d)[0]})}function s(r,d){return r.exists(d)?r.read(d,"utf-8").then(i).then(f):m.resolve(null)}function i(r){return r.replace(/^\uFEFF/g,"")}function e(r){return r.type==="element"?r.name==="mc:AlternateContent"?r.firstOrEmpty("mc:Fallback").children:(r.children=D.flatten(r.children.map(e,!0)),[r]):[r]}},{"../promises":23,"../xml":35,underscore:102}],13:[function(C,ie,k){k.readRelationships=D,k.defaultValue=new m([]),k.Relationships=m;function D(a){var g=[];return a.children.forEach(function(f){if(f.name==="relationships:Relationship"){var s={relationshipId:f.attributes.Id,target:f.attributes.Target,type:f.attributes.Type};g.push(s)}}),new m(g)}function m(a){var g={};a.forEach(function(s){g[s.relationshipId]=s.target});var f={};return a.forEach(function(s){f[s.type]||(f[s.type]=[]),f[s.type].push(s.target)}),{findTargetByRelationshipId:function(s){return g[s]},findTargetsByType:function(s){return f[s]||[]}}}},{}],14:[function(C,ie,k){var D=C("underscore"),m=C("../promises"),a=C("../xml");k.writeStyleMap=i,k.readStyleMap=p;var g="http://schemas.zwobble.org/mammoth/style-map",f="mammoth/style-map",s="/"+f;function i(c,y){return c.write(f,y),e(c).then(function(){return r(c)})}function e(c){var y="word/_rels/document.xml.rels",u="http://schemas.openxmlformats.org/package/2006/relationships",h="{"+u+"}Relationship";return c.read(y,"utf8").then(a.readString).then(function(o){var t=o.children;d(t,h,"Id",{Id:"rMammothStyleMap",Type:g,Target:s});var n={"":u};return c.write(y,a.writeString(o,n))})}function r(c){var y="[Content_Types].xml",u="http://schemas.openxmlformats.org/package/2006/content-types",h="{"+u+"}Override";return c.read(y,"utf8").then(a.readString).then(function(o){var t=o.children;d(t,h,"PartName",{PartName:s,ContentType:"text/prs.mammoth.style-map"});var n={"":u};return c.write(y,a.writeString(o,n))})}function d(c,y,u,h){var o=D.find(c,function(t){return t.name===y&&t.attributes[u]===h[u]});o?o.attributes=h:c.push(a.element(y,h))}function p(c){return c.exists(f)?c.read(f,"utf8"):m.resolve(null)}},{"../promises":23,"../xml":35,underscore:102}],15:[function(C,ie,k){k.readStylesXml=m,k.Styles=D,k.defaultStyles=new D({},{});function D(i,e,r,d){return{findParagraphStyleById:function(p){return i[p]},findCharacterStyleById:function(p){return e[p]},findTableStyleById:function(p){return r[p]},findNumberingStyleById:function(p){return d[p]}}}D.EMPTY=new D({},{},{},{});function m(i){var e={},r={},d={},p={},c={paragraph:e,character:r,table:d,numbering:p};return i.getElementsByTagName("w:style").forEach(function(y){var u=a(y),h=c[u.type];h&&h[u.styleId]===void 0&&(h[u.styleId]=u)}),new D(e,r,d,p)}function a(i){var e=i.attributes["w:type"];if(e==="numbering")return f(e,i);var r=s(i),d=g(i);return{type:e,styleId:r,name:d}}function g(i){var e=i.first("w:name");return e?e.attributes["w:val"]:null}function f(i,e){var r=s(e),d=e.firstOrEmpty("w:pPr").firstOrEmpty("w:numPr").firstOrEmpty("w:numId").attributes["w:val"];return{type:i,numId:d,styleId:r}}function s(i){return i.attributes["w:styleId"]}},{}],16:[function(C,ie,k){k.uriToZipEntryName=D,k.replaceFragment=m;function D(a,g){return g.charAt(0)==="/"?g.substr(1):a+"/"+g}function m(a,g){var f=a.indexOf("#");return f!==-1&&(a=a.substring(0,f)),a+"#"+g}},{}],17:[function(C,ie,k){var D=C("../styles/html-paths");function m(r,d,p){return g(D.element(r,d,{fresh:!1}),p)}function a(r,d,p){var c=D.element(r,d,{fresh:!0});return g(c,p)}function g(r,d){return{type:"element",tag:r,children:d||[]}}function f(r){return{type:"text",value:r}}var s={type:"forceWrite"};k.freshElement=a,k.nonFreshElement=m,k.elementWithTag=g,k.text=f,k.forceWrite=s;var i={br:!0,hr:!0,img:!0,input:!0};function e(r){return r.children.length===0&&i[r.tag.tagName]}k.isVoidElement=e},{"../styles/html-paths":28}],18:[function(C,ie,k){var D=C("./ast");k.freshElement=D.freshElement,k.nonFreshElement=D.nonFreshElement,k.elementWithTag=D.elementWithTag,k.text=D.text,k.forceWrite=D.forceWrite,k.simplify=C("./simplify");function m(i,e){e.forEach(function(r){a(i,r)})}function a(i,e){g[e.type](i,e)}var g={element:f,text:s,forceWrite:function(){}};function f(i,e){D.isVoidElement(e)?i.selfClosing(e.tag.tagName,e.tag.attributes):(i.open(e.tag.tagName,e.tag.attributes),m(i,e.children),i.close(e.tag.tagName))}function s(i,e){i.text(e.value)}k.write=m},{"./ast":17,"./simplify":19}],19:[function(C,ie,k){var D=C("underscore"),m=C("./ast");function a(o){return g(d(o))}function g(o){var t=[];return o.map(f).forEach(function(n){r(t,n)}),t}function f(o){return s[o.type](o)}var s={element:i,text:e,forceWrite:e};function i(o){return m.elementWithTag(o.tag,g(o.children))}function e(o){return o}function r(o,t){var n=o[o.length-1];t.type==="element"&&!t.tag.fresh&&n&&n.type==="element"&&t.tag.matchesElement(n.tag)?(t.tag.separator&&r(n.children,m.text(t.tag.separator)),t.children.forEach(function(b){r(n.children,b)})):o.push(t)}function d(o){return p(o,function(t){return c[t.type](t)})}function p(o,t){return D.flatten(D.map(o,t),!0)}var c={element:u,text:h,forceWrite:y};function y(o){return[o]}function u(o){var t=d(o.children);return t.length===0&&!m.isVoidElement(o)?[]:[m.elementWithTag(o.tag,t)]}function h(o){return o.value.length===0?[]:[o]}ie.exports=a},{"./ast":17,underscore:102}],20:[function(C,ie,k){var D=C("underscore"),m=C("./promises"),a=C("./html");k.imgElement=g;function g(f){return function(s,i){return m.when(f(s)).then(function(e){var r={};return s.altText&&(r.alt=s.altText),D.extend(r,e),[a.freshElement("img",r)]})}}k.inline=k.imgElement,k.dataUri=g(function(f){return f.readAsBase64String().then(function(s){return{src:"data:"+f.contentType+";base64,"+s}})})},{"./html":18,"./promises":23,underscore:102}],21:[function(C,ie,k){(function(D){var m=C("underscore"),a=C("./docx/docx-reader"),g=C("./docx/style-map"),f=C("./document-to-html").DocumentConverter,s=C("./raw-text").convertElementToRawText,i=C("./style-reader").readStyle,e=C("./options-reader").readOptions,r=C("./unzip"),d=C("./results").Result;k.convertToHtml=p,k.convertToMarkdown=c,k.convert=y,k.extractRawText=t,k.images=C("./images"),k.transforms=C("./transforms"),k.underline=C("./underline"),k.embedStyleMap=n,k.readEmbeddedStyleMap=u;function p(b,U){return y(b,U)}function c(b,U){var M=Object.create(U||{});return M.outputFormat="markdown",y(b,M)}function y(b,U){return U=e(U),r.openZip(b).tap(function(M){return g.readStyleMap(M).then(function(E){U.embeddedStyleMap=E})}).then(function(M){return a.read(M,b,U).then(function(E){return E.map(U.transformDocument)}).then(function(E){return h(E,U)})})}function u(b){return r.openZip(b).then(g.readStyleMap)}function h(b,U){var M=o(U.readStyleMap()),E=m.extend({},U,{styleMap:M.value}),W=new f(E);return b.flatMapThen(function(I){return M.flatMapThen(function(R){return W.convertToHtml(I)})})}function o(b){return d.combine((b||[]).map(i)).map(function(U){return U.filter(function(M){return!!M})})}function t(b){return r.openZip(b).then(a.read).then(function(U){return U.map(s)})}function n(b,U){return r.openZip(b).tap(function(M){return g.writeStyleMap(M,U)}).then(function(M){return M.toArrayBuffer()}).then(function(M){return{toArrayBuffer:function(){return M},toBuffer:function(){return D.from(M)}}})}k.styleMapping=function(){throw new Error(`Use a raw string instead of mammoth.styleMapping e.g. "p[style-name='Title'] => h1" instead of mammoth.styleMapping("p[style-name='Title'] => h1")`)}}).call(this,C("buffer").Buffer)},{"./document-to-html":3,"./docx/docx-reader":9,"./docx/style-map":14,"./images":20,"./options-reader":22,"./raw-text":24,"./results":25,"./style-reader":26,"./transforms":30,"./underline":31,"./unzip":2,buffer:83,underscore:102}],22:[function(C,ie,k){k.readOptions=g;var D=C("underscore"),m=k._defaultStyleMap=["p.Heading1 => h1:fresh","p.Heading2 => h2:fresh","p.Heading3 => h3:fresh","p.Heading4 => h4:fresh","p.Heading5 => h5:fresh","p.Heading6 => h6:fresh","p[style-name='Heading 1'] => h1:fresh","p[style-name='Heading 2'] => h2:fresh","p[style-name='Heading 3'] => h3:fresh","p[style-name='Heading 4'] => h4:fresh","p[style-name='Heading 5'] => h5:fresh","p[style-name='Heading 6'] => h6:fresh","p[style-name='heading 1'] => h1:fresh","p[style-name='heading 2'] => h2:fresh","p[style-name='heading 3'] => h3:fresh","p[style-name='heading 4'] => h4:fresh","p[style-name='heading 5'] => h5:fresh","p[style-name='heading 6'] => h6:fresh","p.Heading => h1:fresh","p[style-name='Heading'] => h1:fresh","r[style-name='Strong'] => strong","p[style-name='footnote text'] => p:fresh","r[style-name='footnote reference'] =>","p[style-name='endnote text'] => p:fresh","r[style-name='endnote reference'] =>","p[style-name='annotation text'] => p:fresh","r[style-name='annotation reference'] =>","p[style-name='Footnote'] => p:fresh","r[style-name='Footnote anchor'] =>","p[style-name='Endnote'] => p:fresh","r[style-name='Endnote anchor'] =>","p:unordered-list(1) => ul > li:fresh","p:unordered-list(2) => ul|ol > li > ul > li:fresh","p:unordered-list(3) => ul|ol > li > ul|ol > li > ul > li:fresh","p:unordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ul > li:fresh","p:unordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ul > li:fresh","p:ordered-list(1) => ol > li:fresh","p:ordered-list(2) => ul|ol > li > ol > li:fresh","p:ordered-list(3) => ul|ol > li > ul|ol > li > ol > li:fresh","p:ordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh","p:ordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh","r[style-name='Hyperlink'] =>","p[style-name='Normal'] => p:fresh","p.Body => p:fresh","p[style-name='Body'] => p:fresh"],a=k._standardOptions={externalFileAccess:!1,transformDocument:s,includeDefaultStyleMap:!0,includeEmbeddedStyleMap:!0};function g(i){return i=i||{},D.extend({},a,i,{customStyleMap:f(i.styleMap),readStyleMap:function(){var e=this.customStyleMap;return this.includeEmbeddedStyleMap&&(e=e.concat(f(this.embeddedStyleMap))),this.includeDefaultStyleMap&&(e=e.concat(m)),e}})}function f(i){return i?D.isString(i)?i.split(`
3
3
  `).map(function(e){return e.trim()}).filter(function(e){return e!==""&&e.charAt(0)!=="#"}):i:[]}function s(i){return i}},{underscore:102}],23:[function(C,ie,k){var D=C("underscore"),m=C("bluebird/js/release/promise")();k.defer=a,k.when=m.resolve,k.resolve=m.resolve,k.all=m.all,k.props=m.props,k.reject=m.reject,k.promisify=m.promisify,k.mapSeries=m.mapSeries,k.attempt=m.attempt,k.nfcall=function(g){var f=Array.prototype.slice.call(arguments,1),s=m.promisify(g);return s.apply(null,f)},m.prototype.fail=m.prototype.caught,m.prototype.also=function(g){return this.then(function(f){var s=D.extend({},f,g(f));return m.props(s)})};function a(){var g,f,s=new m.Promise(function(i,e){g=i,f=e});return{resolve:g,reject:f,promise:s}}},{"bluebird/js/release/promise":68,underscore:102}],24:[function(C,ie,k){var D=C("./documents");function m(a){if(a.type==="text")return a.value;if(a.type===D.types.tab)return" ";var g=a.type==="paragraph"?`
4
4