openwork-server 0.18.71 → 0.18.72

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 (98) hide show
  1. package/dist/opencode-plugin-deps-1.18.33.tgz +0 -0
  2. package/dist/opencode-plugins/agent-instruction-compose.js +0 -24
  3. package/dist/opencode-plugins/approval-loopback-fetch.js +0 -9
  4. package/dist/opencode-plugins/browser-tool-args.js +37 -0
  5. package/dist/opencode-plugins/computer-listing-files.js +0 -19
  6. package/dist/opencode-plugins/drive-file-tools.js +0 -4
  7. package/dist/opencode-plugins/gmail-attachment-fulfillment.js +0 -14
  8. package/dist/opencode-plugins/managed-policy-client.js +0 -2
  9. package/dist/opencode-plugins/opencode-stop-fence-client.js +0 -1
  10. package/dist/opencode-plugins/openwork-agent-questions.js +2 -10
  11. package/dist/opencode-plugins/openwork-capabilities-knowledge.js +2 -2
  12. package/dist/opencode-plugins/openwork-chrome-devtools.js +47 -4
  13. package/dist/opencode-plugins/openwork-cloud-skills-v2.js +34 -49
  14. package/dist/opencode-plugins/openwork-codemode-discovery-v2.js +0 -7
  15. package/dist/opencode-plugins/openwork-context-v2.js +81 -12
  16. package/dist/opencode-plugins/openwork-extensions-preview-steering.js +0 -16
  17. package/dist/opencode-plugins/openwork-extensions-preview.js +1 -1
  18. package/dist/opencode-plugins/openwork-office-attachments.js +1401 -10
  19. package/dist/opencode-plugins/openwork-provider-adapters.js +0 -11
  20. package/dist/opencode-plugins/openwork-session-groups.js +0 -13
  21. package/dist/opencode-plugins/openwork-spreadsheets.js +1401 -10
  22. package/dist/opencode-plugins/openwork-ui-bridge.js +1 -6
  23. package/dist/opencode-plugins/provider-safe-tool-schema.js +0 -10
  24. package/dist/opencode-plugins/session-read-detail.js +0 -36
  25. package/dist/opencode-plugins/workspace-file-destinations.js +0 -5
  26. package/dist/openwork-server.mjs +3190 -1101
  27. package/package.json +1 -1
  28. package/web/assets/{abnfDiagram-VCTEODGH-DlWncS8i.js → abnfDiagram-VCTEODGH-Bk2JrJ3j.js} +1 -1
  29. package/web/assets/app-BinIaXyk.css +32 -0
  30. package/web/assets/{app-DSUHKGsm.js → app-CNo6L1tq.js} +487 -479
  31. package/web/assets/{arc-BtZC6wuw.js → arc-BeMgz_zn.js} +1 -1
  32. package/web/assets/{architectureDiagram-5GKGNRK7-DTbl4Rnl.js → architectureDiagram-5GKGNRK7-CRxylST_.js} +1 -1
  33. package/web/assets/{artifact-code-view-Ck4sjscy.js → artifact-code-view-BwBuxnOh.js} +1 -1
  34. package/web/assets/artifact-office-preview-v_N9yGCg.js +6 -0
  35. package/web/assets/artifact-spreadsheet-editor-5lpd49cl.js +4 -0
  36. package/web/assets/{artifact-text-editor-DjSmnNjJ.js → artifact-text-editor-Dj0SDUYJ.js} +1 -1
  37. package/web/assets/{blockDiagram-OSKFZWR5-DAYSy6DL.js → blockDiagram-OSKFZWR5-CYcFpnr1.js} +1 -1
  38. package/web/assets/{c4Diagram-7LVT6UL2-CjyvESYl.js → c4Diagram-7LVT6UL2-KL6win2t.js} +1 -1
  39. package/web/assets/channel-C7q2VHY_.js +1 -0
  40. package/web/assets/{chunk-2Q5K7J3B-CcMgFZAV.js → chunk-2Q5K7J3B-CjBMu5Dk.js} +1 -1
  41. package/web/assets/{chunk-5VM5RSS4-D4c8XRGl.js → chunk-5VM5RSS4-CVfSxxeV.js} +1 -1
  42. package/web/assets/{chunk-F27PBJKO-BnyyjaCS.js → chunk-F27PBJKO-Da-CK7uS.js} +1 -1
  43. package/web/assets/{chunk-HLEWEB6X-JXz7B5zc.js → chunk-HLEWEB6X-DaBpQjxM.js} +1 -1
  44. package/web/assets/{chunk-JWPE2WC7-CYcnmDz7.js → chunk-JWPE2WC7-eZhhKb-9.js} +1 -1
  45. package/web/assets/{chunk-POPQ4Y6H-2llTUUN7.js → chunk-POPQ4Y6H-BuQza4Dl.js} +1 -1
  46. package/web/assets/{chunk-SVP7TREG-BnWFSOpJ.js → chunk-SVP7TREG-MuA1wNzK.js} +1 -1
  47. package/web/assets/{chunk-XXDRQBXY-XqHzbo0u.js → chunk-XXDRQBXY-CIpJOQtx.js} +1 -1
  48. package/web/assets/{chunk-ZLD2IHE6-Dz_IjbQJ.js → chunk-ZLD2IHE6-NhKoLW1Y.js} +1 -1
  49. package/web/assets/classDiagram-CYGNFDIV-DKD7FwJZ.js +1 -0
  50. package/web/assets/classDiagram-v2-TLXNO2FR-DKD7FwJZ.js +1 -0
  51. package/web/assets/{cose-bilkent-JH36ORCC--bD81EP5.js → cose-bilkent-JH36ORCC-B_lNY9db.js} +1 -1
  52. package/web/assets/{cynefin-OW5HDTMX-tTD-HcrI.js → cynefin-OW5HDTMX-BmqyCndA.js} +1 -1
  53. package/web/assets/{cynefinDiagram-5FMLGOSQ-CMslIrwy.js → cynefinDiagram-5FMLGOSQ-By2KC7b4.js} +1 -1
  54. package/web/assets/{dagre-OS7QT2EB-B__oM1cx.js → dagre-OS7QT2EB-By7csWyW.js} +1 -1
  55. package/web/assets/{diagram-S7CK7UJ4-D2ghWE6t.js → diagram-S7CK7UJ4-5_mhvlGk.js} +1 -1
  56. package/web/assets/{diagram-UQ7AKVKN-BanDxdhW.js → diagram-UQ7AKVKN-BPHF9t90.js} +1 -1
  57. package/web/assets/{diagram-VSXAHHWV-DGvbp0xT.js → diagram-VSXAHHWV-CyVv5z8B.js} +1 -1
  58. package/web/assets/{diagram-VX7I27RA-CThCeJli.js → diagram-VX7I27RA-BdfxwGwk.js} +1 -1
  59. package/web/assets/{diagram-Z3DM3KII-CAt65CmM.js → diagram-Z3DM3KII-BXg_HOys.js} +1 -1
  60. package/web/assets/{ebnfDiagram-PWID7BFC-Cp5nPs03.js → ebnfDiagram-PWID7BFC-57--ZiB5.js} +1 -1
  61. package/web/assets/{erDiagram-2YWLMYGG-HLBdDnlf.js → erDiagram-2YWLMYGG-2WR_i4mr.js} +1 -1
  62. package/web/assets/{flowDiagram-T62WH6J4-CELW8hlc.js → flowDiagram-T62WH6J4-1qB430Tj.js} +1 -1
  63. package/web/assets/{ganttDiagram-EL5Y4UJY-C7R0OzTb.js → ganttDiagram-EL5Y4UJY-DlsKL-gN.js} +1 -1
  64. package/web/assets/{gitGraphDiagram-WWUBYQGX-qBuuQIor.js → gitGraphDiagram-WWUBYQGX-DQ8IU_wC.js} +1 -1
  65. package/web/assets/{infoDiagram-FKFFQAWI-iEzBkgjk.js → infoDiagram-FKFFQAWI-kh9s5sRC.js} +1 -1
  66. package/web/assets/{ishikawaDiagram-5VMMS53U-DrK4XY4T.js → ishikawaDiagram-5VMMS53U-CaknQUcm.js} +1 -1
  67. package/web/assets/{journeyDiagram-EYS64GPL-CGd8HUPB.js → journeyDiagram-EYS64GPL-DenZYZs9.js} +1 -1
  68. package/web/assets/{kanban-definition-UXKFOSKX-DQmiyxel.js → kanban-definition-UXKFOSKX-ptoI6qD1.js} +1 -1
  69. package/web/assets/{layout-DLjmmpHK.js → layout-B4UdHd1t.js} +1 -1
  70. package/web/assets/{linear-DHJPnkfR.js → linear-DbhtXtCn.js} +1 -1
  71. package/web/assets/{mermaid.core-PQNy-dHT.js → mermaid.core-BoXM2BMZ.js} +6 -6
  72. package/web/assets/{mindmap-definition-THT77NOG-B5jNdC9x.js → mindmap-definition-THT77NOG-Bcw34klO.js} +1 -1
  73. package/web/assets/{pegDiagram-XKGWAZYB-wbhF-roR.js → pegDiagram-XKGWAZYB-CZ49Cylj.js} +1 -1
  74. package/web/assets/{pieDiagram-E7YTZNPT-2HAV5f46.js → pieDiagram-E7YTZNPT-F5Tl-jOo.js} +1 -1
  75. package/web/assets/{quadrantDiagram-AXDQQJYC-CLDLYWPn.js → quadrantDiagram-AXDQQJYC-BindC9Ln.js} +1 -1
  76. package/web/assets/{railroadDiagram-O6MQD6OU-Be5VkSOo.js → railroadDiagram-O6MQD6OU-BHfARQKt.js} +1 -1
  77. package/web/assets/{requirementDiagram-IS5BZ75X-qBk4BaLm.js → requirementDiagram-IS5BZ75X-DeyyjrFZ.js} +1 -1
  78. package/web/assets/{sankeyDiagram-P5KCCOFB-a-kGn14g.js → sankeyDiagram-P5KCCOFB-Bf4RYjdY.js} +1 -1
  79. package/web/assets/{sequenceDiagram-WJ2MYXX4-B19t616Z.js → sequenceDiagram-WJ2MYXX4-D0I5Iail.js} +1 -1
  80. package/web/assets/{sizeCapture-INFHLROL-CGM0ZmNa.js → sizeCapture-INFHLROL-ZMHjeD6L.js} +1 -1
  81. package/web/assets/{stateDiagram-XQSTLZYL-CQYuKN4p.js → stateDiagram-XQSTLZYL-XMu0akCC.js} +1 -1
  82. package/web/assets/stateDiagram-v2-IH3M54BS-CNv5Ofd5.js +1 -0
  83. package/web/assets/{swimlanes-V6O3JKXN-CvzknNlU.js → swimlanes-V6O3JKXN-BX1vgjAt.js} +1 -1
  84. package/web/assets/swimlanesDiagram-JKAHXJPX-yIR7kUmA.js +8 -0
  85. package/web/assets/{timeline-definition-24CTP7MA-BhF3gzcl.js → timeline-definition-24CTP7MA-B-V8Y7U9.js} +1 -1
  86. package/web/assets/{vennDiagram-4TSXK5OY-6DNrrc2_.js → vennDiagram-4TSXK5OY-iHvsobDU.js} +1 -1
  87. package/web/assets/{wardleyDiagram-VM6X3IG4-DO0onK3t.js → wardleyDiagram-VM6X3IG4-BTl7bSNi.js} +1 -1
  88. package/web/assets/{workspace-file-tree-BCpC4HYD.js → workspace-file-tree-EJaUSokl.js} +1 -1
  89. package/web/assets/xlsx-workbook-DVIQLEdk.js +9 -0
  90. package/web/assets/{xychartDiagram-S5SC5T6Z-44sg_69l.js → xychartDiagram-S5SC5T6Z-BKhJK0Av.js} +1 -1
  91. package/web/index.html +2 -2
  92. package/web/assets/app-CfKQPy_C.css +0 -32
  93. package/web/assets/artifact-spreadsheet-editor-O5R5Qt-8.js +0 -11
  94. package/web/assets/channel-OiorT9Re.js +0 -1
  95. package/web/assets/classDiagram-CYGNFDIV-CLY7M0C9.js +0 -1
  96. package/web/assets/classDiagram-v2-TLXNO2FR-CLY7M0C9.js +0 -1
  97. package/web/assets/stateDiagram-v2-IH3M54BS-CVq-yI8K.js +0 -1
  98. package/web/assets/swimlanesDiagram-JKAHXJPX-YWNRXT7V.js +0 -8
@@ -21087,6 +21087,1258 @@ class Parser {
21087
21087
  this.end(chunk);
21088
21088
  }
21089
21089
  }
21090
+ // ../../node_modules/.pnpm/domelementtype@2.3.0/node_modules/domelementtype/lib/esm/index.js
21091
+ var ElementType;
21092
+ (function(ElementType2) {
21093
+ ElementType2["Root"] = "root";
21094
+ ElementType2["Text"] = "text";
21095
+ ElementType2["Directive"] = "directive";
21096
+ ElementType2["Comment"] = "comment";
21097
+ ElementType2["Script"] = "script";
21098
+ ElementType2["Style"] = "style";
21099
+ ElementType2["Tag"] = "tag";
21100
+ ElementType2["CDATA"] = "cdata";
21101
+ ElementType2["Doctype"] = "doctype";
21102
+ })(ElementType || (ElementType = {}));
21103
+ function isTag(elem) {
21104
+ return elem.type === ElementType.Tag || elem.type === ElementType.Script || elem.type === ElementType.Style;
21105
+ }
21106
+ var Root = ElementType.Root;
21107
+ var Text = ElementType.Text;
21108
+ var Directive = ElementType.Directive;
21109
+ var Comment = ElementType.Comment;
21110
+ var Script = ElementType.Script;
21111
+ var Style = ElementType.Style;
21112
+ var Tag = ElementType.Tag;
21113
+ var CDATA = ElementType.CDATA;
21114
+ var Doctype = ElementType.Doctype;
21115
+
21116
+ // ../../node_modules/.pnpm/domhandler@5.0.3/node_modules/domhandler/lib/esm/node.js
21117
+ class Node {
21118
+ constructor() {
21119
+ this.parent = null;
21120
+ this.prev = null;
21121
+ this.next = null;
21122
+ this.startIndex = null;
21123
+ this.endIndex = null;
21124
+ }
21125
+ get parentNode() {
21126
+ return this.parent;
21127
+ }
21128
+ set parentNode(parent) {
21129
+ this.parent = parent;
21130
+ }
21131
+ get previousSibling() {
21132
+ return this.prev;
21133
+ }
21134
+ set previousSibling(prev) {
21135
+ this.prev = prev;
21136
+ }
21137
+ get nextSibling() {
21138
+ return this.next;
21139
+ }
21140
+ set nextSibling(next) {
21141
+ this.next = next;
21142
+ }
21143
+ cloneNode(recursive2 = false) {
21144
+ return cloneNode(this, recursive2);
21145
+ }
21146
+ }
21147
+
21148
+ class DataNode extends Node {
21149
+ constructor(data) {
21150
+ super();
21151
+ this.data = data;
21152
+ }
21153
+ get nodeValue() {
21154
+ return this.data;
21155
+ }
21156
+ set nodeValue(data) {
21157
+ this.data = data;
21158
+ }
21159
+ }
21160
+
21161
+ class Text2 extends DataNode {
21162
+ constructor() {
21163
+ super(...arguments);
21164
+ this.type = ElementType.Text;
21165
+ }
21166
+ get nodeType() {
21167
+ return 3;
21168
+ }
21169
+ }
21170
+
21171
+ class Comment2 extends DataNode {
21172
+ constructor() {
21173
+ super(...arguments);
21174
+ this.type = ElementType.Comment;
21175
+ }
21176
+ get nodeType() {
21177
+ return 8;
21178
+ }
21179
+ }
21180
+
21181
+ class ProcessingInstruction extends DataNode {
21182
+ constructor(name, data) {
21183
+ super(data);
21184
+ this.name = name;
21185
+ this.type = ElementType.Directive;
21186
+ }
21187
+ get nodeType() {
21188
+ return 1;
21189
+ }
21190
+ }
21191
+
21192
+ class NodeWithChildren extends Node {
21193
+ constructor(children) {
21194
+ super();
21195
+ this.children = children;
21196
+ }
21197
+ get firstChild() {
21198
+ var _a4;
21199
+ return (_a4 = this.children[0]) !== null && _a4 !== undefined ? _a4 : null;
21200
+ }
21201
+ get lastChild() {
21202
+ return this.children.length > 0 ? this.children[this.children.length - 1] : null;
21203
+ }
21204
+ get childNodes() {
21205
+ return this.children;
21206
+ }
21207
+ set childNodes(children) {
21208
+ this.children = children;
21209
+ }
21210
+ }
21211
+
21212
+ class CDATA2 extends NodeWithChildren {
21213
+ constructor() {
21214
+ super(...arguments);
21215
+ this.type = ElementType.CDATA;
21216
+ }
21217
+ get nodeType() {
21218
+ return 4;
21219
+ }
21220
+ }
21221
+
21222
+ class Document extends NodeWithChildren {
21223
+ constructor() {
21224
+ super(...arguments);
21225
+ this.type = ElementType.Root;
21226
+ }
21227
+ get nodeType() {
21228
+ return 9;
21229
+ }
21230
+ }
21231
+
21232
+ class Element extends NodeWithChildren {
21233
+ constructor(name, attribs, children = [], type = name === "script" ? ElementType.Script : name === "style" ? ElementType.Style : ElementType.Tag) {
21234
+ super(children);
21235
+ this.name = name;
21236
+ this.attribs = attribs;
21237
+ this.type = type;
21238
+ }
21239
+ get nodeType() {
21240
+ return 1;
21241
+ }
21242
+ get tagName() {
21243
+ return this.name;
21244
+ }
21245
+ set tagName(name) {
21246
+ this.name = name;
21247
+ }
21248
+ get attributes() {
21249
+ return Object.keys(this.attribs).map((name) => {
21250
+ var _a4, _b;
21251
+ return {
21252
+ name,
21253
+ value: this.attribs[name],
21254
+ namespace: (_a4 = this["x-attribsNamespace"]) === null || _a4 === undefined ? undefined : _a4[name],
21255
+ prefix: (_b = this["x-attribsPrefix"]) === null || _b === undefined ? undefined : _b[name]
21256
+ };
21257
+ });
21258
+ }
21259
+ }
21260
+ function isTag2(node2) {
21261
+ return isTag(node2);
21262
+ }
21263
+ function isCDATA(node2) {
21264
+ return node2.type === ElementType.CDATA;
21265
+ }
21266
+ function isText(node2) {
21267
+ return node2.type === ElementType.Text;
21268
+ }
21269
+ function isComment(node2) {
21270
+ return node2.type === ElementType.Comment;
21271
+ }
21272
+ function isDirective(node2) {
21273
+ return node2.type === ElementType.Directive;
21274
+ }
21275
+ function isDocument(node2) {
21276
+ return node2.type === ElementType.Root;
21277
+ }
21278
+ function hasChildren(node2) {
21279
+ return Object.prototype.hasOwnProperty.call(node2, "children");
21280
+ }
21281
+ function cloneNode(node2, recursive2 = false) {
21282
+ let result;
21283
+ if (isText(node2)) {
21284
+ result = new Text2(node2.data);
21285
+ } else if (isComment(node2)) {
21286
+ result = new Comment2(node2.data);
21287
+ } else if (isTag2(node2)) {
21288
+ const children = recursive2 ? cloneChildren(node2.children) : [];
21289
+ const clone2 = new Element(node2.name, { ...node2.attribs }, children);
21290
+ children.forEach((child) => child.parent = clone2);
21291
+ if (node2.namespace != null) {
21292
+ clone2.namespace = node2.namespace;
21293
+ }
21294
+ if (node2["x-attribsNamespace"]) {
21295
+ clone2["x-attribsNamespace"] = { ...node2["x-attribsNamespace"] };
21296
+ }
21297
+ if (node2["x-attribsPrefix"]) {
21298
+ clone2["x-attribsPrefix"] = { ...node2["x-attribsPrefix"] };
21299
+ }
21300
+ result = clone2;
21301
+ } else if (isCDATA(node2)) {
21302
+ const children = recursive2 ? cloneChildren(node2.children) : [];
21303
+ const clone2 = new CDATA2(children);
21304
+ children.forEach((child) => child.parent = clone2);
21305
+ result = clone2;
21306
+ } else if (isDocument(node2)) {
21307
+ const children = recursive2 ? cloneChildren(node2.children) : [];
21308
+ const clone2 = new Document(children);
21309
+ children.forEach((child) => child.parent = clone2);
21310
+ if (node2["x-mode"]) {
21311
+ clone2["x-mode"] = node2["x-mode"];
21312
+ }
21313
+ result = clone2;
21314
+ } else if (isDirective(node2)) {
21315
+ const instruction = new ProcessingInstruction(node2.name, node2.data);
21316
+ if (node2["x-name"] != null) {
21317
+ instruction["x-name"] = node2["x-name"];
21318
+ instruction["x-publicId"] = node2["x-publicId"];
21319
+ instruction["x-systemId"] = node2["x-systemId"];
21320
+ }
21321
+ result = instruction;
21322
+ } else {
21323
+ throw new Error(`Not implemented yet: ${node2.type}`);
21324
+ }
21325
+ result.startIndex = node2.startIndex;
21326
+ result.endIndex = node2.endIndex;
21327
+ if (node2.sourceCodeLocation != null) {
21328
+ result.sourceCodeLocation = node2.sourceCodeLocation;
21329
+ }
21330
+ return result;
21331
+ }
21332
+ function cloneChildren(childs) {
21333
+ const children = childs.map((child) => cloneNode(child, true));
21334
+ for (let i = 1;i < children.length; i++) {
21335
+ children[i].prev = children[i - 1];
21336
+ children[i - 1].next = children[i];
21337
+ }
21338
+ return children;
21339
+ }
21340
+
21341
+ // ../../node_modules/.pnpm/domhandler@5.0.3/node_modules/domhandler/lib/esm/index.js
21342
+ var defaultOpts = {
21343
+ withStartIndices: false,
21344
+ withEndIndices: false,
21345
+ xmlMode: false
21346
+ };
21347
+
21348
+ class DomHandler {
21349
+ constructor(callback, options, elementCB) {
21350
+ this.dom = [];
21351
+ this.root = new Document(this.dom);
21352
+ this.done = false;
21353
+ this.tagStack = [this.root];
21354
+ this.lastNode = null;
21355
+ this.parser = null;
21356
+ if (typeof options === "function") {
21357
+ elementCB = options;
21358
+ options = defaultOpts;
21359
+ }
21360
+ if (typeof callback === "object") {
21361
+ options = callback;
21362
+ callback = undefined;
21363
+ }
21364
+ this.callback = callback !== null && callback !== undefined ? callback : null;
21365
+ this.options = options !== null && options !== undefined ? options : defaultOpts;
21366
+ this.elementCB = elementCB !== null && elementCB !== undefined ? elementCB : null;
21367
+ }
21368
+ onparserinit(parser) {
21369
+ this.parser = parser;
21370
+ }
21371
+ onreset() {
21372
+ this.dom = [];
21373
+ this.root = new Document(this.dom);
21374
+ this.done = false;
21375
+ this.tagStack = [this.root];
21376
+ this.lastNode = null;
21377
+ this.parser = null;
21378
+ }
21379
+ onend() {
21380
+ if (this.done)
21381
+ return;
21382
+ this.done = true;
21383
+ this.parser = null;
21384
+ this.handleCallback(null);
21385
+ }
21386
+ onerror(error62) {
21387
+ this.handleCallback(error62);
21388
+ }
21389
+ onclosetag() {
21390
+ this.lastNode = null;
21391
+ const elem = this.tagStack.pop();
21392
+ if (this.options.withEndIndices) {
21393
+ elem.endIndex = this.parser.endIndex;
21394
+ }
21395
+ if (this.elementCB)
21396
+ this.elementCB(elem);
21397
+ }
21398
+ onopentag(name, attribs) {
21399
+ const type = this.options.xmlMode ? ElementType.Tag : undefined;
21400
+ const element = new Element(name, attribs, undefined, type);
21401
+ this.addNode(element);
21402
+ this.tagStack.push(element);
21403
+ }
21404
+ ontext(data) {
21405
+ const { lastNode } = this;
21406
+ if (lastNode && lastNode.type === ElementType.Text) {
21407
+ lastNode.data += data;
21408
+ if (this.options.withEndIndices) {
21409
+ lastNode.endIndex = this.parser.endIndex;
21410
+ }
21411
+ } else {
21412
+ const node3 = new Text2(data);
21413
+ this.addNode(node3);
21414
+ this.lastNode = node3;
21415
+ }
21416
+ }
21417
+ oncomment(data) {
21418
+ if (this.lastNode && this.lastNode.type === ElementType.Comment) {
21419
+ this.lastNode.data += data;
21420
+ return;
21421
+ }
21422
+ const node3 = new Comment2(data);
21423
+ this.addNode(node3);
21424
+ this.lastNode = node3;
21425
+ }
21426
+ oncommentend() {
21427
+ this.lastNode = null;
21428
+ }
21429
+ oncdatastart() {
21430
+ const text = new Text2("");
21431
+ const node3 = new CDATA2([text]);
21432
+ this.addNode(node3);
21433
+ text.parent = node3;
21434
+ this.lastNode = text;
21435
+ }
21436
+ oncdataend() {
21437
+ this.lastNode = null;
21438
+ }
21439
+ onprocessinginstruction(name, data) {
21440
+ const node3 = new ProcessingInstruction(name, data);
21441
+ this.addNode(node3);
21442
+ }
21443
+ handleCallback(error62) {
21444
+ if (typeof this.callback === "function") {
21445
+ this.callback(error62, this.dom);
21446
+ } else if (error62) {
21447
+ throw error62;
21448
+ }
21449
+ }
21450
+ addNode(node3) {
21451
+ const parent = this.tagStack[this.tagStack.length - 1];
21452
+ const previousSibling = parent.children[parent.children.length - 1];
21453
+ if (this.options.withStartIndices) {
21454
+ node3.startIndex = this.parser.startIndex;
21455
+ }
21456
+ if (this.options.withEndIndices) {
21457
+ node3.endIndex = this.parser.endIndex;
21458
+ }
21459
+ parent.children.push(node3);
21460
+ if (previousSibling) {
21461
+ node3.prev = previousSibling;
21462
+ previousSibling.next = node3;
21463
+ }
21464
+ node3.parent = parent;
21465
+ this.lastNode = null;
21466
+ }
21467
+ }
21468
+ // ../../node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/index.js
21469
+ var exports_esm2 = {};
21470
+ __export(exports_esm2, {
21471
+ uniqueSort: () => uniqueSort,
21472
+ textContent: () => textContent,
21473
+ testElement: () => testElement,
21474
+ replaceElement: () => replaceElement,
21475
+ removeSubsets: () => removeSubsets,
21476
+ removeElement: () => removeElement,
21477
+ prevElementSibling: () => prevElementSibling,
21478
+ prependChild: () => prependChild,
21479
+ prepend: () => prepend,
21480
+ nextElementSibling: () => nextElementSibling,
21481
+ isText: () => isText,
21482
+ isTag: () => isTag2,
21483
+ isDocument: () => isDocument,
21484
+ isComment: () => isComment,
21485
+ isCDATA: () => isCDATA,
21486
+ innerText: () => innerText,
21487
+ hasChildren: () => hasChildren,
21488
+ hasAttrib: () => hasAttrib,
21489
+ getText: () => getText,
21490
+ getSiblings: () => getSiblings,
21491
+ getParent: () => getParent,
21492
+ getOuterHTML: () => getOuterHTML,
21493
+ getName: () => getName,
21494
+ getInnerHTML: () => getInnerHTML,
21495
+ getFeed: () => getFeed,
21496
+ getElementsByTagType: () => getElementsByTagType,
21497
+ getElementsByTagName: () => getElementsByTagName,
21498
+ getElementsByClassName: () => getElementsByClassName,
21499
+ getElements: () => getElements,
21500
+ getElementById: () => getElementById,
21501
+ getChildren: () => getChildren,
21502
+ getAttributeValue: () => getAttributeValue,
21503
+ findOneChild: () => findOneChild,
21504
+ findOne: () => findOne,
21505
+ findAll: () => findAll,
21506
+ find: () => find,
21507
+ filter: () => filter,
21508
+ existsOne: () => existsOne,
21509
+ compareDocumentPosition: () => compareDocumentPosition,
21510
+ appendChild: () => appendChild,
21511
+ append: () => append,
21512
+ DocumentPosition: () => DocumentPosition
21513
+ });
21514
+
21515
+ // ../../node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/escape.js
21516
+ var xmlReplacer = /["&'<>$\x80-\uFFFF]/g;
21517
+ var xmlCodeMap = new Map([
21518
+ [34, "&quot;"],
21519
+ [38, "&amp;"],
21520
+ [39, "&apos;"],
21521
+ [60, "&lt;"],
21522
+ [62, "&gt;"]
21523
+ ]);
21524
+ var getCodePoint = String.prototype.codePointAt != null ? (str, index) => str.codePointAt(index) : (c, index) => (c.charCodeAt(index) & 64512) === 55296 ? (c.charCodeAt(index) - 55296) * 1024 + c.charCodeAt(index + 1) - 56320 + 65536 : c.charCodeAt(index);
21525
+ function encodeXML(str) {
21526
+ let ret = "";
21527
+ let lastIdx = 0;
21528
+ let match;
21529
+ while ((match = xmlReplacer.exec(str)) !== null) {
21530
+ const i = match.index;
21531
+ const char = str.charCodeAt(i);
21532
+ const next = xmlCodeMap.get(char);
21533
+ if (next !== undefined) {
21534
+ ret += str.substring(lastIdx, i) + next;
21535
+ lastIdx = i + 1;
21536
+ } else {
21537
+ ret += `${str.substring(lastIdx, i)}&#x${getCodePoint(str, i).toString(16)};`;
21538
+ lastIdx = xmlReplacer.lastIndex += Number((char & 64512) === 55296);
21539
+ }
21540
+ }
21541
+ return ret + str.substr(lastIdx);
21542
+ }
21543
+ function getEscaper(regex, map2) {
21544
+ return function escape(data) {
21545
+ let match;
21546
+ let lastIdx = 0;
21547
+ let result = "";
21548
+ while (match = regex.exec(data)) {
21549
+ if (lastIdx !== match.index) {
21550
+ result += data.substring(lastIdx, match.index);
21551
+ }
21552
+ result += map2.get(match[0].charCodeAt(0));
21553
+ lastIdx = match.index + 1;
21554
+ }
21555
+ return result + data.substring(lastIdx);
21556
+ };
21557
+ }
21558
+ var escapeUTF8 = getEscaper(/[&<>'"]/g, xmlCodeMap);
21559
+ var escapeAttribute = getEscaper(/["&\u00A0]/g, new Map([
21560
+ [34, "&quot;"],
21561
+ [38, "&amp;"],
21562
+ [160, "&nbsp;"]
21563
+ ]));
21564
+ var escapeText = getEscaper(/[&<>\u00A0]/g, new Map([
21565
+ [38, "&amp;"],
21566
+ [60, "&lt;"],
21567
+ [62, "&gt;"],
21568
+ [160, "&nbsp;"]
21569
+ ]));
21570
+ // ../../node_modules/.pnpm/entities@4.5.0/node_modules/entities/lib/esm/index.js
21571
+ var EntityLevel;
21572
+ (function(EntityLevel2) {
21573
+ EntityLevel2[EntityLevel2["XML"] = 0] = "XML";
21574
+ EntityLevel2[EntityLevel2["HTML"] = 1] = "HTML";
21575
+ })(EntityLevel || (EntityLevel = {}));
21576
+ var EncodingMode;
21577
+ (function(EncodingMode2) {
21578
+ EncodingMode2[EncodingMode2["UTF8"] = 0] = "UTF8";
21579
+ EncodingMode2[EncodingMode2["ASCII"] = 1] = "ASCII";
21580
+ EncodingMode2[EncodingMode2["Extensive"] = 2] = "Extensive";
21581
+ EncodingMode2[EncodingMode2["Attribute"] = 3] = "Attribute";
21582
+ EncodingMode2[EncodingMode2["Text"] = 4] = "Text";
21583
+ })(EncodingMode || (EncodingMode = {}));
21584
+
21585
+ // ../../node_modules/.pnpm/dom-serializer@2.0.0/node_modules/dom-serializer/lib/esm/foreignNames.js
21586
+ var elementNames = new Map([
21587
+ "altGlyph",
21588
+ "altGlyphDef",
21589
+ "altGlyphItem",
21590
+ "animateColor",
21591
+ "animateMotion",
21592
+ "animateTransform",
21593
+ "clipPath",
21594
+ "feBlend",
21595
+ "feColorMatrix",
21596
+ "feComponentTransfer",
21597
+ "feComposite",
21598
+ "feConvolveMatrix",
21599
+ "feDiffuseLighting",
21600
+ "feDisplacementMap",
21601
+ "feDistantLight",
21602
+ "feDropShadow",
21603
+ "feFlood",
21604
+ "feFuncA",
21605
+ "feFuncB",
21606
+ "feFuncG",
21607
+ "feFuncR",
21608
+ "feGaussianBlur",
21609
+ "feImage",
21610
+ "feMerge",
21611
+ "feMergeNode",
21612
+ "feMorphology",
21613
+ "feOffset",
21614
+ "fePointLight",
21615
+ "feSpecularLighting",
21616
+ "feSpotLight",
21617
+ "feTile",
21618
+ "feTurbulence",
21619
+ "foreignObject",
21620
+ "glyphRef",
21621
+ "linearGradient",
21622
+ "radialGradient",
21623
+ "textPath"
21624
+ ].map((val) => [val.toLowerCase(), val]));
21625
+ var attributeNames = new Map([
21626
+ "definitionURL",
21627
+ "attributeName",
21628
+ "attributeType",
21629
+ "baseFrequency",
21630
+ "baseProfile",
21631
+ "calcMode",
21632
+ "clipPathUnits",
21633
+ "diffuseConstant",
21634
+ "edgeMode",
21635
+ "filterUnits",
21636
+ "glyphRef",
21637
+ "gradientTransform",
21638
+ "gradientUnits",
21639
+ "kernelMatrix",
21640
+ "kernelUnitLength",
21641
+ "keyPoints",
21642
+ "keySplines",
21643
+ "keyTimes",
21644
+ "lengthAdjust",
21645
+ "limitingConeAngle",
21646
+ "markerHeight",
21647
+ "markerUnits",
21648
+ "markerWidth",
21649
+ "maskContentUnits",
21650
+ "maskUnits",
21651
+ "numOctaves",
21652
+ "pathLength",
21653
+ "patternContentUnits",
21654
+ "patternTransform",
21655
+ "patternUnits",
21656
+ "pointsAtX",
21657
+ "pointsAtY",
21658
+ "pointsAtZ",
21659
+ "preserveAlpha",
21660
+ "preserveAspectRatio",
21661
+ "primitiveUnits",
21662
+ "refX",
21663
+ "refY",
21664
+ "repeatCount",
21665
+ "repeatDur",
21666
+ "requiredExtensions",
21667
+ "requiredFeatures",
21668
+ "specularConstant",
21669
+ "specularExponent",
21670
+ "spreadMethod",
21671
+ "startOffset",
21672
+ "stdDeviation",
21673
+ "stitchTiles",
21674
+ "surfaceScale",
21675
+ "systemLanguage",
21676
+ "tableValues",
21677
+ "targetX",
21678
+ "targetY",
21679
+ "textLength",
21680
+ "viewBox",
21681
+ "viewTarget",
21682
+ "xChannelSelector",
21683
+ "yChannelSelector",
21684
+ "zoomAndPan"
21685
+ ].map((val) => [val.toLowerCase(), val]));
21686
+
21687
+ // ../../node_modules/.pnpm/dom-serializer@2.0.0/node_modules/dom-serializer/lib/esm/index.js
21688
+ var unencodedElements = new Set([
21689
+ "style",
21690
+ "script",
21691
+ "xmp",
21692
+ "iframe",
21693
+ "noembed",
21694
+ "noframes",
21695
+ "plaintext",
21696
+ "noscript"
21697
+ ]);
21698
+ function replaceQuotes(value) {
21699
+ return value.replace(/"/g, "&quot;");
21700
+ }
21701
+ function formatAttributes(attributes, opts) {
21702
+ var _a4;
21703
+ if (!attributes)
21704
+ return;
21705
+ const encode3 = ((_a4 = opts.encodeEntities) !== null && _a4 !== undefined ? _a4 : opts.decodeEntities) === false ? replaceQuotes : opts.xmlMode || opts.encodeEntities !== "utf8" ? encodeXML : escapeAttribute;
21706
+ return Object.keys(attributes).map((key) => {
21707
+ var _a5, _b;
21708
+ const value = (_a5 = attributes[key]) !== null && _a5 !== undefined ? _a5 : "";
21709
+ if (opts.xmlMode === "foreign") {
21710
+ key = (_b = attributeNames.get(key)) !== null && _b !== undefined ? _b : key;
21711
+ }
21712
+ if (!opts.emptyAttrs && !opts.xmlMode && value === "") {
21713
+ return key;
21714
+ }
21715
+ return `${key}="${encode3(value)}"`;
21716
+ }).join(" ");
21717
+ }
21718
+ var singleTag = new Set([
21719
+ "area",
21720
+ "base",
21721
+ "basefont",
21722
+ "br",
21723
+ "col",
21724
+ "command",
21725
+ "embed",
21726
+ "frame",
21727
+ "hr",
21728
+ "img",
21729
+ "input",
21730
+ "isindex",
21731
+ "keygen",
21732
+ "link",
21733
+ "meta",
21734
+ "param",
21735
+ "source",
21736
+ "track",
21737
+ "wbr"
21738
+ ]);
21739
+ function render(node3, options = {}) {
21740
+ const nodes = "length" in node3 ? node3 : [node3];
21741
+ let output2 = "";
21742
+ for (let i = 0;i < nodes.length; i++) {
21743
+ output2 += renderNode(nodes[i], options);
21744
+ }
21745
+ return output2;
21746
+ }
21747
+ var esm_default = render;
21748
+ function renderNode(node3, options) {
21749
+ switch (node3.type) {
21750
+ case Root:
21751
+ return render(node3.children, options);
21752
+ case Doctype:
21753
+ case Directive:
21754
+ return renderDirective(node3);
21755
+ case Comment:
21756
+ return renderComment(node3);
21757
+ case CDATA:
21758
+ return renderCdata(node3);
21759
+ case Script:
21760
+ case Style:
21761
+ case Tag:
21762
+ return renderTag(node3, options);
21763
+ case Text:
21764
+ return renderText(node3, options);
21765
+ }
21766
+ }
21767
+ var foreignModeIntegrationPoints = new Set([
21768
+ "mi",
21769
+ "mo",
21770
+ "mn",
21771
+ "ms",
21772
+ "mtext",
21773
+ "annotation-xml",
21774
+ "foreignObject",
21775
+ "desc",
21776
+ "title"
21777
+ ]);
21778
+ var foreignElements = new Set(["svg", "math"]);
21779
+ function renderTag(elem, opts) {
21780
+ var _a4;
21781
+ if (opts.xmlMode === "foreign") {
21782
+ elem.name = (_a4 = elementNames.get(elem.name)) !== null && _a4 !== undefined ? _a4 : elem.name;
21783
+ if (elem.parent && foreignModeIntegrationPoints.has(elem.parent.name)) {
21784
+ opts = { ...opts, xmlMode: false };
21785
+ }
21786
+ }
21787
+ if (!opts.xmlMode && foreignElements.has(elem.name)) {
21788
+ opts = { ...opts, xmlMode: "foreign" };
21789
+ }
21790
+ let tag = `<${elem.name}`;
21791
+ const attribs = formatAttributes(elem.attribs, opts);
21792
+ if (attribs) {
21793
+ tag += ` ${attribs}`;
21794
+ }
21795
+ if (elem.children.length === 0 && (opts.xmlMode ? opts.selfClosingTags !== false : opts.selfClosingTags && singleTag.has(elem.name))) {
21796
+ if (!opts.xmlMode)
21797
+ tag += " ";
21798
+ tag += "/>";
21799
+ } else {
21800
+ tag += ">";
21801
+ if (elem.children.length > 0) {
21802
+ tag += render(elem.children, opts);
21803
+ }
21804
+ if (opts.xmlMode || !singleTag.has(elem.name)) {
21805
+ tag += `</${elem.name}>`;
21806
+ }
21807
+ }
21808
+ return tag;
21809
+ }
21810
+ function renderDirective(elem) {
21811
+ return `<${elem.data}>`;
21812
+ }
21813
+ function renderText(elem, opts) {
21814
+ var _a4;
21815
+ let data = elem.data || "";
21816
+ if (((_a4 = opts.encodeEntities) !== null && _a4 !== undefined ? _a4 : opts.decodeEntities) !== false && !(!opts.xmlMode && elem.parent && unencodedElements.has(elem.parent.name))) {
21817
+ data = opts.xmlMode || opts.encodeEntities !== "utf8" ? encodeXML(data) : escapeText(data);
21818
+ }
21819
+ return data;
21820
+ }
21821
+ function renderCdata(elem) {
21822
+ return `<![CDATA[${elem.children[0].data}]]>`;
21823
+ }
21824
+ function renderComment(elem) {
21825
+ return `<!--${elem.data}-->`;
21826
+ }
21827
+
21828
+ // ../../node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/stringify.js
21829
+ function getOuterHTML(node3, options) {
21830
+ return esm_default(node3, options);
21831
+ }
21832
+ function getInnerHTML(node3, options) {
21833
+ return hasChildren(node3) ? node3.children.map((node4) => getOuterHTML(node4, options)).join("") : "";
21834
+ }
21835
+ function getText(node3) {
21836
+ if (Array.isArray(node3))
21837
+ return node3.map(getText).join("");
21838
+ if (isTag2(node3))
21839
+ return node3.name === "br" ? `
21840
+ ` : getText(node3.children);
21841
+ if (isCDATA(node3))
21842
+ return getText(node3.children);
21843
+ if (isText(node3))
21844
+ return node3.data;
21845
+ return "";
21846
+ }
21847
+ function textContent(node3) {
21848
+ if (Array.isArray(node3))
21849
+ return node3.map(textContent).join("");
21850
+ if (hasChildren(node3) && !isComment(node3)) {
21851
+ return textContent(node3.children);
21852
+ }
21853
+ if (isText(node3))
21854
+ return node3.data;
21855
+ return "";
21856
+ }
21857
+ function innerText(node3) {
21858
+ if (Array.isArray(node3))
21859
+ return node3.map(innerText).join("");
21860
+ if (hasChildren(node3) && (node3.type === ElementType.Tag || isCDATA(node3))) {
21861
+ return innerText(node3.children);
21862
+ }
21863
+ if (isText(node3))
21864
+ return node3.data;
21865
+ return "";
21866
+ }
21867
+ // ../../node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/traversal.js
21868
+ function getChildren(elem) {
21869
+ return hasChildren(elem) ? elem.children : [];
21870
+ }
21871
+ function getParent(elem) {
21872
+ return elem.parent || null;
21873
+ }
21874
+ function getSiblings(elem) {
21875
+ const parent = getParent(elem);
21876
+ if (parent != null)
21877
+ return getChildren(parent);
21878
+ const siblings = [elem];
21879
+ let { prev, next } = elem;
21880
+ while (prev != null) {
21881
+ siblings.unshift(prev);
21882
+ ({ prev } = prev);
21883
+ }
21884
+ while (next != null) {
21885
+ siblings.push(next);
21886
+ ({ next } = next);
21887
+ }
21888
+ return siblings;
21889
+ }
21890
+ function getAttributeValue(elem, name) {
21891
+ var _a4;
21892
+ return (_a4 = elem.attribs) === null || _a4 === undefined ? undefined : _a4[name];
21893
+ }
21894
+ function hasAttrib(elem, name) {
21895
+ return elem.attribs != null && Object.prototype.hasOwnProperty.call(elem.attribs, name) && elem.attribs[name] != null;
21896
+ }
21897
+ function getName(elem) {
21898
+ return elem.name;
21899
+ }
21900
+ function nextElementSibling(elem) {
21901
+ let { next } = elem;
21902
+ while (next !== null && !isTag2(next))
21903
+ ({ next } = next);
21904
+ return next;
21905
+ }
21906
+ function prevElementSibling(elem) {
21907
+ let { prev } = elem;
21908
+ while (prev !== null && !isTag2(prev))
21909
+ ({ prev } = prev);
21910
+ return prev;
21911
+ }
21912
+ // ../../node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/manipulation.js
21913
+ function removeElement(elem) {
21914
+ if (elem.prev)
21915
+ elem.prev.next = elem.next;
21916
+ if (elem.next)
21917
+ elem.next.prev = elem.prev;
21918
+ if (elem.parent) {
21919
+ const childs = elem.parent.children;
21920
+ const childsIndex = childs.lastIndexOf(elem);
21921
+ if (childsIndex >= 0) {
21922
+ childs.splice(childsIndex, 1);
21923
+ }
21924
+ }
21925
+ elem.next = null;
21926
+ elem.prev = null;
21927
+ elem.parent = null;
21928
+ }
21929
+ function replaceElement(elem, replacement) {
21930
+ const prev = replacement.prev = elem.prev;
21931
+ if (prev) {
21932
+ prev.next = replacement;
21933
+ }
21934
+ const next = replacement.next = elem.next;
21935
+ if (next) {
21936
+ next.prev = replacement;
21937
+ }
21938
+ const parent = replacement.parent = elem.parent;
21939
+ if (parent) {
21940
+ const childs = parent.children;
21941
+ childs[childs.lastIndexOf(elem)] = replacement;
21942
+ elem.parent = null;
21943
+ }
21944
+ }
21945
+ function appendChild(parent, child) {
21946
+ removeElement(child);
21947
+ child.next = null;
21948
+ child.parent = parent;
21949
+ if (parent.children.push(child) > 1) {
21950
+ const sibling = parent.children[parent.children.length - 2];
21951
+ sibling.next = child;
21952
+ child.prev = sibling;
21953
+ } else {
21954
+ child.prev = null;
21955
+ }
21956
+ }
21957
+ function append(elem, next) {
21958
+ removeElement(next);
21959
+ const { parent } = elem;
21960
+ const currNext = elem.next;
21961
+ next.next = currNext;
21962
+ next.prev = elem;
21963
+ elem.next = next;
21964
+ next.parent = parent;
21965
+ if (currNext) {
21966
+ currNext.prev = next;
21967
+ if (parent) {
21968
+ const childs = parent.children;
21969
+ childs.splice(childs.lastIndexOf(currNext), 0, next);
21970
+ }
21971
+ } else if (parent) {
21972
+ parent.children.push(next);
21973
+ }
21974
+ }
21975
+ function prependChild(parent, child) {
21976
+ removeElement(child);
21977
+ child.parent = parent;
21978
+ child.prev = null;
21979
+ if (parent.children.unshift(child) !== 1) {
21980
+ const sibling = parent.children[1];
21981
+ sibling.prev = child;
21982
+ child.next = sibling;
21983
+ } else {
21984
+ child.next = null;
21985
+ }
21986
+ }
21987
+ function prepend(elem, prev) {
21988
+ removeElement(prev);
21989
+ const { parent } = elem;
21990
+ if (parent) {
21991
+ const childs = parent.children;
21992
+ childs.splice(childs.indexOf(elem), 0, prev);
21993
+ }
21994
+ if (elem.prev) {
21995
+ elem.prev.next = prev;
21996
+ }
21997
+ prev.parent = parent;
21998
+ prev.prev = elem.prev;
21999
+ prev.next = elem;
22000
+ elem.prev = prev;
22001
+ }
22002
+ // ../../node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/querying.js
22003
+ function filter(test, node3, recurse = true, limit = Infinity) {
22004
+ return find(test, Array.isArray(node3) ? node3 : [node3], recurse, limit);
22005
+ }
22006
+ function find(test, nodes, recurse, limit) {
22007
+ const result = [];
22008
+ const nodeStack = [Array.isArray(nodes) ? nodes : [nodes]];
22009
+ const indexStack = [0];
22010
+ for (;; ) {
22011
+ if (indexStack[0] >= nodeStack[0].length) {
22012
+ if (indexStack.length === 1) {
22013
+ return result;
22014
+ }
22015
+ nodeStack.shift();
22016
+ indexStack.shift();
22017
+ continue;
22018
+ }
22019
+ const elem = nodeStack[0][indexStack[0]++];
22020
+ if (test(elem)) {
22021
+ result.push(elem);
22022
+ if (--limit <= 0)
22023
+ return result;
22024
+ }
22025
+ if (recurse && hasChildren(elem) && elem.children.length > 0) {
22026
+ indexStack.unshift(0);
22027
+ nodeStack.unshift(elem.children);
22028
+ }
22029
+ }
22030
+ }
22031
+ function findOneChild(test, nodes) {
22032
+ return nodes.find(test);
22033
+ }
22034
+ function findOne(test, nodes, recurse = true) {
22035
+ const searchedNodes = Array.isArray(nodes) ? nodes : [nodes];
22036
+ for (let i = 0;i < searchedNodes.length; i++) {
22037
+ const node3 = searchedNodes[i];
22038
+ if (isTag2(node3) && test(node3)) {
22039
+ return node3;
22040
+ }
22041
+ if (recurse && hasChildren(node3) && node3.children.length > 0) {
22042
+ const found = findOne(test, node3.children, true);
22043
+ if (found)
22044
+ return found;
22045
+ }
22046
+ }
22047
+ return null;
22048
+ }
22049
+ function existsOne(test, nodes) {
22050
+ return (Array.isArray(nodes) ? nodes : [nodes]).some((node3) => isTag2(node3) && test(node3) || hasChildren(node3) && existsOne(test, node3.children));
22051
+ }
22052
+ function findAll(test, nodes) {
22053
+ const result = [];
22054
+ const nodeStack = [Array.isArray(nodes) ? nodes : [nodes]];
22055
+ const indexStack = [0];
22056
+ for (;; ) {
22057
+ if (indexStack[0] >= nodeStack[0].length) {
22058
+ if (nodeStack.length === 1) {
22059
+ return result;
22060
+ }
22061
+ nodeStack.shift();
22062
+ indexStack.shift();
22063
+ continue;
22064
+ }
22065
+ const elem = nodeStack[0][indexStack[0]++];
22066
+ if (isTag2(elem) && test(elem))
22067
+ result.push(elem);
22068
+ if (hasChildren(elem) && elem.children.length > 0) {
22069
+ indexStack.unshift(0);
22070
+ nodeStack.unshift(elem.children);
22071
+ }
22072
+ }
22073
+ }
22074
+ // ../../node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/legacy.js
22075
+ var Checks = {
22076
+ tag_name(name) {
22077
+ if (typeof name === "function") {
22078
+ return (elem) => isTag2(elem) && name(elem.name);
22079
+ } else if (name === "*") {
22080
+ return isTag2;
22081
+ }
22082
+ return (elem) => isTag2(elem) && elem.name === name;
22083
+ },
22084
+ tag_type(type) {
22085
+ if (typeof type === "function") {
22086
+ return (elem) => type(elem.type);
22087
+ }
22088
+ return (elem) => elem.type === type;
22089
+ },
22090
+ tag_contains(data) {
22091
+ if (typeof data === "function") {
22092
+ return (elem) => isText(elem) && data(elem.data);
22093
+ }
22094
+ return (elem) => isText(elem) && elem.data === data;
22095
+ }
22096
+ };
22097
+ function getAttribCheck(attrib, value) {
22098
+ if (typeof value === "function") {
22099
+ return (elem) => isTag2(elem) && value(elem.attribs[attrib]);
22100
+ }
22101
+ return (elem) => isTag2(elem) && elem.attribs[attrib] === value;
22102
+ }
22103
+ function combineFuncs(a, b) {
22104
+ return (elem) => a(elem) || b(elem);
22105
+ }
22106
+ function compileTest(options) {
22107
+ const funcs = Object.keys(options).map((key) => {
22108
+ const value = options[key];
22109
+ return Object.prototype.hasOwnProperty.call(Checks, key) ? Checks[key](value) : getAttribCheck(key, value);
22110
+ });
22111
+ return funcs.length === 0 ? null : funcs.reduce(combineFuncs);
22112
+ }
22113
+ function testElement(options, node3) {
22114
+ const test = compileTest(options);
22115
+ return test ? test(node3) : true;
22116
+ }
22117
+ function getElements(options, nodes, recurse, limit = Infinity) {
22118
+ const test = compileTest(options);
22119
+ return test ? filter(test, nodes, recurse, limit) : [];
22120
+ }
22121
+ function getElementById(id, nodes, recurse = true) {
22122
+ if (!Array.isArray(nodes))
22123
+ nodes = [nodes];
22124
+ return findOne(getAttribCheck("id", id), nodes, recurse);
22125
+ }
22126
+ function getElementsByTagName(tagName, nodes, recurse = true, limit = Infinity) {
22127
+ return filter(Checks["tag_name"](tagName), nodes, recurse, limit);
22128
+ }
22129
+ function getElementsByClassName(className, nodes, recurse = true, limit = Infinity) {
22130
+ return filter(getAttribCheck("class", className), nodes, recurse, limit);
22131
+ }
22132
+ function getElementsByTagType(type, nodes, recurse = true, limit = Infinity) {
22133
+ return filter(Checks["tag_type"](type), nodes, recurse, limit);
22134
+ }
22135
+ // ../../node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/helpers.js
22136
+ function removeSubsets(nodes) {
22137
+ let idx = nodes.length;
22138
+ while (--idx >= 0) {
22139
+ const node3 = nodes[idx];
22140
+ if (idx > 0 && nodes.lastIndexOf(node3, idx - 1) >= 0) {
22141
+ nodes.splice(idx, 1);
22142
+ continue;
22143
+ }
22144
+ for (let ancestor = node3.parent;ancestor; ancestor = ancestor.parent) {
22145
+ if (nodes.includes(ancestor)) {
22146
+ nodes.splice(idx, 1);
22147
+ break;
22148
+ }
22149
+ }
22150
+ }
22151
+ return nodes;
22152
+ }
22153
+ var DocumentPosition;
22154
+ (function(DocumentPosition2) {
22155
+ DocumentPosition2[DocumentPosition2["DISCONNECTED"] = 1] = "DISCONNECTED";
22156
+ DocumentPosition2[DocumentPosition2["PRECEDING"] = 2] = "PRECEDING";
22157
+ DocumentPosition2[DocumentPosition2["FOLLOWING"] = 4] = "FOLLOWING";
22158
+ DocumentPosition2[DocumentPosition2["CONTAINS"] = 8] = "CONTAINS";
22159
+ DocumentPosition2[DocumentPosition2["CONTAINED_BY"] = 16] = "CONTAINED_BY";
22160
+ })(DocumentPosition || (DocumentPosition = {}));
22161
+ function compareDocumentPosition(nodeA, nodeB) {
22162
+ const aParents = [];
22163
+ const bParents = [];
22164
+ if (nodeA === nodeB) {
22165
+ return 0;
22166
+ }
22167
+ let current = hasChildren(nodeA) ? nodeA : nodeA.parent;
22168
+ while (current) {
22169
+ aParents.unshift(current);
22170
+ current = current.parent;
22171
+ }
22172
+ current = hasChildren(nodeB) ? nodeB : nodeB.parent;
22173
+ while (current) {
22174
+ bParents.unshift(current);
22175
+ current = current.parent;
22176
+ }
22177
+ const maxIdx = Math.min(aParents.length, bParents.length);
22178
+ let idx = 0;
22179
+ while (idx < maxIdx && aParents[idx] === bParents[idx]) {
22180
+ idx++;
22181
+ }
22182
+ if (idx === 0) {
22183
+ return DocumentPosition.DISCONNECTED;
22184
+ }
22185
+ const sharedParent = aParents[idx - 1];
22186
+ const siblings = sharedParent.children;
22187
+ const aSibling = aParents[idx];
22188
+ const bSibling = bParents[idx];
22189
+ if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) {
22190
+ if (sharedParent === nodeB) {
22191
+ return DocumentPosition.FOLLOWING | DocumentPosition.CONTAINED_BY;
22192
+ }
22193
+ return DocumentPosition.FOLLOWING;
22194
+ }
22195
+ if (sharedParent === nodeA) {
22196
+ return DocumentPosition.PRECEDING | DocumentPosition.CONTAINS;
22197
+ }
22198
+ return DocumentPosition.PRECEDING;
22199
+ }
22200
+ function uniqueSort(nodes) {
22201
+ nodes = nodes.filter((node3, i, arr) => !arr.includes(node3, i + 1));
22202
+ nodes.sort((a, b) => {
22203
+ const relative2 = compareDocumentPosition(a, b);
22204
+ if (relative2 & DocumentPosition.PRECEDING) {
22205
+ return -1;
22206
+ } else if (relative2 & DocumentPosition.FOLLOWING) {
22207
+ return 1;
22208
+ }
22209
+ return 0;
22210
+ });
22211
+ return nodes;
22212
+ }
22213
+ // ../../node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/feeds.js
22214
+ function getFeed(doc2) {
22215
+ const feedRoot = getOneElement(isValidFeed, doc2);
22216
+ return !feedRoot ? null : feedRoot.name === "feed" ? getAtomFeed(feedRoot) : getRssFeed(feedRoot);
22217
+ }
22218
+ function getAtomFeed(feedRoot) {
22219
+ var _a4;
22220
+ const childs = feedRoot.children;
22221
+ const feed = {
22222
+ type: "atom",
22223
+ items: getElementsByTagName("entry", childs).map((item) => {
22224
+ var _a5;
22225
+ const { children } = item;
22226
+ const entry = { media: getMediaElements(children) };
22227
+ addConditionally(entry, "id", "id", children);
22228
+ addConditionally(entry, "title", "title", children);
22229
+ const href2 = (_a5 = getOneElement("link", children)) === null || _a5 === undefined ? undefined : _a5.attribs["href"];
22230
+ if (href2) {
22231
+ entry.link = href2;
22232
+ }
22233
+ const description = fetch("summary", children) || fetch("content", children);
22234
+ if (description) {
22235
+ entry.description = description;
22236
+ }
22237
+ const pubDate = fetch("updated", children);
22238
+ if (pubDate) {
22239
+ entry.pubDate = new Date(pubDate);
22240
+ }
22241
+ return entry;
22242
+ })
22243
+ };
22244
+ addConditionally(feed, "id", "id", childs);
22245
+ addConditionally(feed, "title", "title", childs);
22246
+ const href = (_a4 = getOneElement("link", childs)) === null || _a4 === undefined ? undefined : _a4.attribs["href"];
22247
+ if (href) {
22248
+ feed.link = href;
22249
+ }
22250
+ addConditionally(feed, "description", "subtitle", childs);
22251
+ const updated = fetch("updated", childs);
22252
+ if (updated) {
22253
+ feed.updated = new Date(updated);
22254
+ }
22255
+ addConditionally(feed, "author", "email", childs, true);
22256
+ return feed;
22257
+ }
22258
+ function getRssFeed(feedRoot) {
22259
+ var _a4, _b;
22260
+ const childs = (_b = (_a4 = getOneElement("channel", feedRoot.children)) === null || _a4 === undefined ? undefined : _a4.children) !== null && _b !== undefined ? _b : [];
22261
+ const feed = {
22262
+ type: feedRoot.name.substr(0, 3),
22263
+ id: "",
22264
+ items: getElementsByTagName("item", feedRoot.children).map((item) => {
22265
+ const { children } = item;
22266
+ const entry = { media: getMediaElements(children) };
22267
+ addConditionally(entry, "id", "guid", children);
22268
+ addConditionally(entry, "title", "title", children);
22269
+ addConditionally(entry, "link", "link", children);
22270
+ addConditionally(entry, "description", "description", children);
22271
+ const pubDate = fetch("pubDate", children) || fetch("dc:date", children);
22272
+ if (pubDate)
22273
+ entry.pubDate = new Date(pubDate);
22274
+ return entry;
22275
+ })
22276
+ };
22277
+ addConditionally(feed, "title", "title", childs);
22278
+ addConditionally(feed, "link", "link", childs);
22279
+ addConditionally(feed, "description", "description", childs);
22280
+ const updated = fetch("lastBuildDate", childs);
22281
+ if (updated) {
22282
+ feed.updated = new Date(updated);
22283
+ }
22284
+ addConditionally(feed, "author", "managingEditor", childs, true);
22285
+ return feed;
22286
+ }
22287
+ var MEDIA_KEYS_STRING = ["url", "type", "lang"];
22288
+ var MEDIA_KEYS_INT = [
22289
+ "fileSize",
22290
+ "bitrate",
22291
+ "framerate",
22292
+ "samplingrate",
22293
+ "channels",
22294
+ "duration",
22295
+ "height",
22296
+ "width"
22297
+ ];
22298
+ function getMediaElements(where) {
22299
+ return getElementsByTagName("media:content", where).map((elem) => {
22300
+ const { attribs } = elem;
22301
+ const media = {
22302
+ medium: attribs["medium"],
22303
+ isDefault: !!attribs["isDefault"]
22304
+ };
22305
+ for (const attrib of MEDIA_KEYS_STRING) {
22306
+ if (attribs[attrib]) {
22307
+ media[attrib] = attribs[attrib];
22308
+ }
22309
+ }
22310
+ for (const attrib of MEDIA_KEYS_INT) {
22311
+ if (attribs[attrib]) {
22312
+ media[attrib] = parseInt(attribs[attrib], 10);
22313
+ }
22314
+ }
22315
+ if (attribs["expression"]) {
22316
+ media.expression = attribs["expression"];
22317
+ }
22318
+ return media;
22319
+ });
22320
+ }
22321
+ function getOneElement(tagName, node3) {
22322
+ return getElementsByTagName(tagName, node3, true, 1)[0];
22323
+ }
22324
+ function fetch(tagName, where, recurse = false) {
22325
+ return textContent(getElementsByTagName(tagName, where, recurse, 1)).trim();
22326
+ }
22327
+ function addConditionally(obj, prop, tagName, where, recurse = false) {
22328
+ const val = fetch(tagName, where, recurse);
22329
+ if (val)
22330
+ obj[prop] = val;
22331
+ }
22332
+ function isValidFeed(value) {
22333
+ return value === "rss" || value === "feed" || value === "rdf:RDF";
22334
+ }
22335
+ // ../../node_modules/.pnpm/htmlparser2@8.0.2/node_modules/htmlparser2/lib/esm/index.js
22336
+ function parseDocument(data, options) {
22337
+ const handler = new DomHandler(undefined, options);
22338
+ new Parser(handler, options).end(data);
22339
+ return handler.root;
22340
+ }
22341
+
21090
22342
  // ../../packages/workbook/src/ooxml-package.ts
21091
22343
  var ZIP_LOCAL_FILE_HEADER = 67324752;
21092
22344
  var ZIP_CENTRAL_DIRECTORY_HEADER = 33639248;
@@ -21101,6 +22353,9 @@ var MAX_ZIP_ENTRIES = 128;
21101
22353
  var MAX_TOTAL_UNCOMPRESSED_BYTES = 10 * 1024 * 1024;
21102
22354
  var MAX_ENTRY_UNCOMPRESSED_BYTES = 2 * 1024 * 1024;
21103
22355
  var MAX_ZIP_COMPRESSION_RATIO = 100;
22356
+
22357
+ class OfficeSizeLimitError extends Error {
22358
+ }
21104
22359
  var textEncoder = new TextEncoder;
21105
22360
  var textDecoder = new TextDecoder("utf-8");
21106
22361
  function utf8Bytes(text) {
@@ -21137,7 +22392,7 @@ async function readStreamBounded(stream, limit, label) {
21137
22392
  total += value.byteLength;
21138
22393
  if (total > limit) {
21139
22394
  await reader.cancel();
21140
- throw new Error(`ZIP entry ${label} inflated beyond its declared size.`);
22395
+ throw new OfficeSizeLimitError(`ZIP entry ${label} inflated beyond its declared size.`);
21141
22396
  }
21142
22397
  chunks.push(value);
21143
22398
  }
@@ -21189,7 +22444,7 @@ function localSizeMatches(localFlags, localSize, centralSize) {
21189
22444
  }
21190
22445
  function listZipEntries(bytes) {
21191
22446
  if (bytes.byteLength > MAX_COMPRESSED_BYTES)
21192
- throw new Error("ZIP input exceeds compressed byte limit.");
22447
+ throw new OfficeSizeLimitError("ZIP input exceeds compressed byte limit.");
21193
22448
  const view = dataView(bytes);
21194
22449
  const eocd = findEndOfCentralDirectory(bytes);
21195
22450
  const disk = view.getUint16(eocd + 4, true);
@@ -21204,7 +22459,7 @@ function listZipEntries(bytes) {
21204
22459
  if (count === 65535 || centralSize === 4294967295 || centralOffset === 4294967295)
21205
22460
  throw new Error("ZIP64 archives are not supported.");
21206
22461
  if (count > MAX_ZIP_ENTRIES)
21207
- throw new Error(`ZIP entry count ${count} exceeds limit ${MAX_ZIP_ENTRIES}.`);
22462
+ throw new OfficeSizeLimitError(`ZIP entry count ${count} exceeds limit ${MAX_ZIP_ENTRIES}.`);
21208
22463
  if (centralOffset + centralSize > bytes.byteLength)
21209
22464
  throw new Error("ZIP central directory is out of bounds.");
21210
22465
  if (centralEnd > eocd)
@@ -21232,14 +22487,14 @@ function listZipEntries(bytes) {
21232
22487
  if (method !== ZIP_STORED && method !== ZIP_DEFLATE)
21233
22488
  throw new Error(`ZIP entry ${name} uses unsupported compression method ${method}.`);
21234
22489
  if (uncompressedSize > MAX_ENTRY_UNCOMPRESSED_BYTES)
21235
- throw new Error(`ZIP entry ${name} exceeds per-entry uncompressed limit.`);
22490
+ throw new OfficeSizeLimitError(`ZIP entry ${name} exceeds per-entry uncompressed limit.`);
21236
22491
  if (uncompressedSize > 0 && compressedSize === 0)
21237
22492
  throw new Error(`ZIP entry ${name} has an invalid compression ratio.`);
21238
22493
  if (compressedSize > 0 && uncompressedSize / compressedSize > MAX_ZIP_COMPRESSION_RATIO)
21239
- throw new Error(`ZIP entry ${name} exceeds compression ratio limit.`);
22494
+ throw new OfficeSizeLimitError(`ZIP entry ${name} exceeds compression ratio limit.`);
21240
22495
  totalUncompressed += uncompressedSize;
21241
22496
  if (totalUncompressed > MAX_TOTAL_UNCOMPRESSED_BYTES)
21242
- throw new Error("ZIP archive exceeds total uncompressed limit.");
22497
+ throw new OfficeSizeLimitError("ZIP archive exceeds total uncompressed limit.");
21243
22498
  entries.push({ name, flags, method, compressedSize, uncompressedSize, localOffset });
21244
22499
  cursor += 46 + nameLength + extraLength + commentLength;
21245
22500
  }
@@ -21309,17 +22564,17 @@ function crc32(bytes) {
21309
22564
  }
21310
22565
  async function buildZip(files) {
21311
22566
  if (files.length > MAX_ZIP_ENTRIES)
21312
- throw new Error(`ZIP entry count ${files.length} exceeds limit ${MAX_ZIP_ENTRIES}.`);
22567
+ throw new OfficeSizeLimitError(`ZIP entry count ${files.length} exceeds limit ${MAX_ZIP_ENTRIES}.`);
21313
22568
  const localChunks = [];
21314
22569
  const centralChunks = [];
21315
22570
  let offset = 0;
21316
22571
  let totalUncompressed = 0;
21317
22572
  for (const file2 of files) {
21318
22573
  if (file2.data.byteLength > MAX_ENTRY_UNCOMPRESSED_BYTES)
21319
- throw new Error(`ZIP entry ${file2.name} exceeds per-entry uncompressed limit.`);
22574
+ throw new OfficeSizeLimitError(`ZIP entry ${file2.name} exceeds per-entry uncompressed limit.`);
21320
22575
  totalUncompressed += file2.data.byteLength;
21321
22576
  if (totalUncompressed > MAX_TOTAL_UNCOMPRESSED_BYTES)
21322
- throw new Error("ZIP archive exceeds total uncompressed limit.");
22577
+ throw new OfficeSizeLimitError("ZIP archive exceeds total uncompressed limit.");
21323
22578
  const deflated = await deflateRaw(file2.data);
21324
22579
  const useDeflate = deflated.byteLength < file2.data.byteLength && file2.data.byteLength / Math.max(1, deflated.byteLength) <= MAX_ZIP_COMPRESSION_RATIO;
21325
22580
  const stored = useDeflate ? deflated : file2.data;
@@ -21364,7 +22619,7 @@ async function buildZip(files) {
21364
22619
  }
21365
22620
  function assertSafeOfficeXml(xml) {
21366
22621
  if (utf8ByteLength(xml) > MAX_ENTRY_UNCOMPRESSED_BYTES)
21367
- throw new Error("Office XML exceeds the parser input limit.");
22622
+ throw new OfficeSizeLimitError("Office XML exceeds the parser input limit.");
21368
22623
  const lower = xml.toLowerCase();
21369
22624
  if (lower.includes("<!doctype") || lower.includes("<!entity"))
21370
22625
  throw new Error("Office XML DTD and entity declarations are not supported.");
@@ -21663,9 +22918,22 @@ function parseNumberFormats(stylesXml) {
21663
22918
  return custom2.get(id) ?? builtinNumberFormat(id);
21664
22919
  });
21665
22920
  }
22921
+ var ELAPSED_TIME_TOKEN = /\[(?:h+|m+|s+)\]/i;
22922
+ function isElapsedTimeFormat(format) {
22923
+ return !!format && ELAPSED_TIME_TOKEN.test(format.replace(/"[^"]*"/g, ""));
22924
+ }
22925
+ function excelSerialToElapsedTime(serial) {
22926
+ if (!Number.isFinite(serial) || serial < 0)
22927
+ return null;
22928
+ const totalSeconds = Math.round(serial * 86400);
22929
+ const hours = Math.floor(totalSeconds / 3600);
22930
+ return `${hours}:${pad(Math.floor(totalSeconds % 3600 / 60))}:${pad(totalSeconds % 60)}`;
22931
+ }
21666
22932
  function isDateNumberFormat(format) {
21667
22933
  if (!format || format === "General" || format === "@")
21668
22934
  return false;
22935
+ if (isElapsedTimeFormat(format))
22936
+ return false;
21669
22937
  const stripped = format.replace(/"[^"]*"/g, "").replace(/\[[^\]]*\]/g, "").replace(/\\./g, "").replace(/[Ee][+-]/g, "");
21670
22938
  return /[ymdhs]/i.test(stripped);
21671
22939
  }
@@ -21714,6 +22982,9 @@ function displayedCellValue(type, rawValue, body, sharedStrings, numberFormat, d
21714
22982
  }
21715
22983
  if (type === "b" && rawValue !== undefined)
21716
22984
  return rawValue === "1" ? "TRUE" : "FALSE";
22985
+ if ((type === "" || type === "n") && rawValue !== undefined && isElapsedTimeFormat(numberFormat)) {
22986
+ return excelSerialToElapsedTime(Number(rawValue)) ?? rawValue;
22987
+ }
21717
22988
  if ((type === "" || type === "n") && rawValue !== undefined && isDateNumberFormat(numberFormat)) {
21718
22989
  return excelSerialToIso(Number(rawValue), date1904) ?? rawValue;
21719
22990
  }
@@ -22062,6 +23333,121 @@ async function writeXlsxWorkbook(input2) {
22062
23333
  sheets: sheets.map((sheet, index) => ({ name: sheet.name, rows: worksheets[index].rows, columns: worksheets[index].columns }))
22063
23334
  };
22064
23335
  }
23336
+ // ../../packages/workbook/src/office-outline.ts
23337
+ function localName(name) {
23338
+ return name.slice(name.lastIndexOf(":") + 1);
23339
+ }
23340
+ function attribute(node3, name) {
23341
+ return node3 && Object.entries(node3.attribs).find(([key]) => localName(key) === name)?.[1];
23342
+ }
23343
+ function* elements(nodes, name) {
23344
+ const pending = nodes.slice().reverse();
23345
+ while (pending.length > 0) {
23346
+ const node3 = pending.pop();
23347
+ if (!node3 || !exports_esm2.isTag(node3))
23348
+ continue;
23349
+ if (localName(node3.name) === name) {
23350
+ yield node3;
23351
+ continue;
23352
+ }
23353
+ for (let index = node3.children.length - 1;index >= 0; index--)
23354
+ pending.push(node3.children[index]);
23355
+ }
23356
+ }
23357
+ function parse5(xml) {
23358
+ assertSafeOfficeXml(xml);
23359
+ return parseDocument(xml, { xmlMode: true }).children;
23360
+ }
23361
+ function paragraphText(paragraph) {
23362
+ return Array.from(elements(paragraph.children, "t"), (run) => run.children.map((node3) => exports_esm2.isText(node3) ? node3.data : "").join("")).join("").trim();
23363
+ }
23364
+ function isTitle(paragraph) {
23365
+ let ancestor = paragraph.parent;
23366
+ while (ancestor && exports_esm2.isTag(ancestor)) {
23367
+ const current = ancestor;
23368
+ ancestor = current.parent;
23369
+ if (localName(current.name) !== "sp")
23370
+ continue;
23371
+ const props = current.children.find((node3) => exports_esm2.isTag(node3) && localName(node3.name) === "nvSpPr");
23372
+ const placeholder = props && elements([props], "ph").next().value;
23373
+ const type = attribute(placeholder, "type");
23374
+ return type === "title" || type === "ctrTitle";
23375
+ }
23376
+ return false;
23377
+ }
23378
+ async function slideParts(bytes, entries) {
23379
+ const manifest = await readZipTextEntry(bytes, entries, "ppt/presentation.xml");
23380
+ if (manifest === null) {
23381
+ return [...entries.keys()].filter((name) => /^ppt\/slides\/slide\d+\.xml$/.test(name)).sort((a, b) => a.localeCompare(b, undefined, { numeric: true }));
23382
+ }
23383
+ const rels = relationshipTargets(await readZipTextEntry(bytes, entries, "ppt/_rels/presentation.xml.rels"), "ppt");
23384
+ const list = elements(parse5(manifest), "sldIdLst").next().value;
23385
+ if (!list)
23386
+ return [];
23387
+ return Array.from(elements(list.children, "sldId"), (node3) => {
23388
+ const id = Object.entries(node3.attribs).find(([key]) => key.endsWith(":id"))?.[1];
23389
+ const part = id && rels.get(id);
23390
+ if (!part || !/^ppt\/slides\/[^/]+\.xml$/.test(part))
23391
+ throw new Error("Missing or unsupported Office slide part.");
23392
+ return part;
23393
+ });
23394
+ }
23395
+ async function extractOfficeOutline(kind, bytes, entries, maxChars) {
23396
+ let remaining = maxChars;
23397
+ let truncated = false;
23398
+ const bounded = (text) => {
23399
+ if (text.length > remaining)
23400
+ truncated = true;
23401
+ let end = Math.min(text.length, remaining);
23402
+ if (end < text.length && /[\uD800-\uDBFF]/.test(text.charAt(end - 1)))
23403
+ end--;
23404
+ const visible = text.slice(0, end);
23405
+ remaining -= visible.length;
23406
+ return visible;
23407
+ };
23408
+ const read = async (part, root) => {
23409
+ const xml = await readZipTextEntry(bytes, entries, part);
23410
+ const node3 = xml !== null && elements(parse5(xml), root).next().value;
23411
+ if (!node3)
23412
+ throw new Error("Missing or unreadable Office text part.");
23413
+ return node3.children;
23414
+ };
23415
+ if (kind === "docx") {
23416
+ const paragraphs = [];
23417
+ for (const paragraph of elements(await read("word/document.xml", "body"), "p")) {
23418
+ const text = bounded(paragraphText(paragraph));
23419
+ const style = attribute(elements(paragraph.children, "pStyle").next().value, "val");
23420
+ const level = attribute(elements(paragraph.children, "outlineLvl").next().value, "val");
23421
+ if (text)
23422
+ paragraphs.push({ text, heading: /^(?:title|heading[1-9])$/i.test(style ?? "") || /^[0-8]$/.test(level ?? "") });
23423
+ if (truncated)
23424
+ break;
23425
+ }
23426
+ return { kind, paragraphs, truncated };
23427
+ }
23428
+ const slides = [];
23429
+ for (const part of await slideParts(bytes, entries)) {
23430
+ const slide = { title: "", bullets: [] };
23431
+ for (const paragraph of elements(await read(part, "sld"), "p")) {
23432
+ const text = bounded(paragraphText(paragraph));
23433
+ if (text) {
23434
+ if (isTitle(paragraph))
23435
+ slide.title = slide.title ? `${slide.title}
23436
+ ${text}` : text;
23437
+ else
23438
+ slide.bullets.push(text);
23439
+ }
23440
+ if (truncated)
23441
+ break;
23442
+ }
23443
+ if (!truncated || slide.title || slide.bullets.length)
23444
+ slides.push(slide);
23445
+ if (truncated)
23446
+ break;
23447
+ }
23448
+ return { kind, slides, truncated };
23449
+ }
23450
+
22065
23451
  // ../../packages/workbook/src/office-text.ts
22066
23452
  var DOCX_MIME = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
22067
23453
  var PPTX_MIME = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
@@ -22171,6 +23557,11 @@ async function extractXlsxText(bytes, options) {
22171
23557
  `).slice(0, MAX_OFFICE_TEXT_CHARS);
22172
23558
  }
22173
23559
  async function extractOfficeText(kind, bytes, options = {}) {
23560
+ if ("format" in options) {
23561
+ if (kind === "xlsx")
23562
+ throw new Error("Workbook outlines are not supported.");
23563
+ return extractOfficeOutline(kind, bytes, zipEntryMap(listZipEntries(bytes)), MAX_OFFICE_TEXT_CHARS);
23564
+ }
22174
23565
  if (kind === "xlsx")
22175
23566
  return await extractXlsxText(bytes, options);
22176
23567
  const entries = listZipEntries(bytes).filter((entry) => relevantXmlEntry(kind, entry.name)).sort(compareEntryName);