@taloswork/ose-shared 0.1.11 → 0.1.13

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 (159) hide show
  1. package/package.json +3 -3
  2. package/skills/document/SKILL.md +135 -219
  3. package/skills/document/art-directions/base.css +27 -2
  4. package/skills/document/art-directions/cinematic-depth.css +3 -1
  5. package/skills/document/art-directions/collage-paper.css +5 -1
  6. package/skills/document/art-directions/editorial-cut.css +5 -1
  7. package/skills/document/art-directions/geometric-pop.css +6 -0
  8. package/skills/document/art-directions/gradient-mesh.css +5 -1
  9. package/skills/document/art-directions/illustrated-doodle.css +5 -0
  10. package/skills/document/art-directions/luxury-ornament.css +4 -1
  11. package/skills/document/art-directions/maximalist-blocks.css +6 -0
  12. package/skills/document/art-directions/technical-grid.css +4 -0
  13. package/skills/document/assets/fonts/fonts.json +2 -2
  14. package/skills/document/assets/pdf-fonts/NotoSansSC-PDF-Bold.ttf +0 -0
  15. package/skills/document/assets/pdf-fonts/NotoSansSC-PDF-Regular.ttf +0 -0
  16. package/skills/document/assets/pdf-fonts/OFL.txt +93 -0
  17. package/skills/document/assets/pdf-fonts/README.md +35 -0
  18. package/skills/document/assets/tessdata/LICENSE-Apache-2.0.txt +202 -0
  19. package/skills/document/assets/tessdata/README.md +21 -0
  20. package/skills/document/assets/tessdata/chi_sim.traineddata.gz +0 -0
  21. package/skills/document/assets/tessdata/eng.traineddata.gz +0 -0
  22. package/skills/document/bin/deck-build.cjs +12563 -83
  23. package/skills/document/bin/deck-chart.cjs +771 -0
  24. package/skills/document/bin/deck-plan.cjs +12414 -0
  25. package/skills/document/bin/deck-qa.cjs +1075 -266
  26. package/skills/document/bin/deck-scenario.cjs +1363 -0
  27. package/skills/document/bin/deck-styles.cjs +1604 -0
  28. package/skills/document/bin/doc-convert.cjs +308 -292
  29. package/skills/document/bin/doc-fill.cjs +73264 -192
  30. package/skills/document/bin/doc-gen.cjs +2491 -312
  31. package/skills/document/bin/doc-run.cjs +162 -24
  32. package/skills/document/bin/doc-scan.cjs +13 -0
  33. package/skills/document/bin/doc-text.cjs +13 -0
  34. package/skills/document/bin/doc-validate.cjs +838 -68
  35. package/skills/document/bin/doc-xml.cjs +9 -5
  36. package/skills/document/bin/docx-annotate.cjs +95 -19
  37. package/skills/document/bin/docx-defaults.cjs +9907 -0
  38. package/skills/document/bin/fontkit.cjs +1 -0
  39. package/skills/document/bin/html2pptx.cjs +36622 -31394
  40. package/skills/document/bin/ocr-worker.cjs +1 -0
  41. package/skills/document/bin/ocr.cjs +131 -40
  42. package/skills/document/bin/pdf-form.cjs +682 -177
  43. package/skills/document/bin/pdf-images.cjs +13 -0
  44. package/skills/document/bin/pdf-ops.cjs +642 -199
  45. package/skills/document/bin/pdf-render.cjs +19 -3
  46. package/skills/document/bin/pdf-tables.cjs +13 -0
  47. package/skills/document/bin/pptx-clone.cjs +3 -3
  48. package/skills/document/bin/pptx-notes.cjs +10038 -0
  49. package/skills/document/bin/pptx-slide.cjs +3 -3
  50. package/skills/document/bin/pptx-tokenize.cjs +19 -4
  51. package/skills/document/bin/template-skin.cjs +10910 -0
  52. package/skills/document/bin/xlsx-query.cjs +192 -61
  53. package/skills/document/bin-reference.md +61 -33
  54. package/skills/document/catalog.json +33 -32
  55. package/skills/document/content-pipeline.md +179 -257
  56. package/skills/document/deck-design.md +378 -638
  57. package/skills/document/generated-visuals.md +99 -0
  58. package/skills/document/layouts/MAINTAINERS.md +33 -0
  59. package/skills/document/layouts/README.md +49 -36
  60. package/skills/document/layouts/big-stat.tpl +1 -1
  61. package/skills/document/layouts/capacity.json +1 -0
  62. package/skills/document/layouts/cards-3.tpl +1 -1
  63. package/skills/document/layouts/chart-full.tpl +1 -1
  64. package/skills/document/layouts/chart-kpi.tpl +1 -1
  65. package/skills/document/layouts/comparison.tpl +1 -1
  66. package/skills/document/layouts/data-table.tpl +1 -1
  67. package/skills/document/layouts/funnel.tpl +1 -1
  68. package/skills/document/layouts/gantt.tpl +1 -1
  69. package/skills/document/layouts/hub-flow.tpl +4 -0
  70. package/skills/document/layouts/icon-row.tpl +1 -1
  71. package/skills/document/layouts/image-grid.tpl +1 -1
  72. package/skills/document/layouts/matrix-2x2.tpl +1 -1
  73. package/skills/document/layouts/mock-qa.tpl +4 -0
  74. package/skills/document/layouts/profiles.json +2 -2
  75. package/skills/document/layouts/pyramid.tpl +1 -1
  76. package/skills/document/layouts/radar.tpl +1 -1
  77. package/skills/document/layouts/ring-progress.tpl +1 -1
  78. package/skills/document/layouts/slots.json +1 -1
  79. package/skills/document/layouts/steps-vertical.tpl +1 -1
  80. package/skills/document/layouts/steps.tpl +1 -1
  81. package/skills/document/layouts/three-kpi.tpl +1 -1
  82. package/skills/document/layouts/timeline.tpl +1 -1
  83. package/skills/document/layouts/toc-panel.tpl +2 -2
  84. package/skills/document/layouts/two-kpi.tpl +2 -2
  85. package/skills/document/layouts/versus.tpl +1 -1
  86. package/skills/document/motion/README.md +3 -2
  87. package/skills/document/office.md +3 -3
  88. package/skills/document/packs/README.md +1 -1
  89. package/skills/document/packs/board-brief/backdrop.html +2 -0
  90. package/skills/document/packs/board-brief/pack.css +2 -1
  91. package/skills/document/packs/mckinsey-photo/backdrop.html +2 -0
  92. package/skills/document/packs/mckinsey-photo/pack.css +2 -1
  93. package/skills/document/packs/press-room/backdrop.html +2 -0
  94. package/skills/document/packs/press-room/pack.css +2 -1
  95. package/skills/document/packs/prismatic-3d/backdrop.html +2 -0
  96. package/skills/document/packs/prismatic-3d/pack.css +4 -1
  97. package/skills/document/pdf.md +60 -43
  98. package/skills/document/rewrite.md +257 -309
  99. package/skills/document/scenarios.json +1307 -0
  100. package/skills/document/scenarios.schema.json +104 -0
  101. package/skills/document/styles/README.md +15 -25
  102. package/skills/document/styles/_backdrops/rimlight.html +3 -2
  103. package/skills/document/styles/_contract-defaults.css +31 -2
  104. package/skills/document/styles/_samples/_groups/biz-premium.webp +0 -0
  105. package/skills/document/styles/_samples/mckinsey.webp +0 -0
  106. package/skills/document/styles/anthropic/skin.css +6 -3
  107. package/skills/document/styles/apple/skin.css +4 -3
  108. package/skills/document/styles/bistro-warm/backdrop.html +2 -0
  109. package/skills/document/styles/bistro-warm/skin.css +4 -1
  110. package/skills/document/styles/black-gold/skin.css +6 -5
  111. package/skills/document/styles/bold-clash/backdrop.html +2 -0
  112. package/skills/document/styles/bold-clash/skin.css +2 -1
  113. package/skills/document/styles/branding/skin.css +4 -4
  114. package/skills/document/styles/campus-teal/backdrop.html +2 -0
  115. package/skills/document/styles/campus-teal/skin.css +2 -1
  116. package/skills/document/styles/cinereel/skin.css +7 -3
  117. package/skills/document/styles/clinic-care/backdrop.html +2 -0
  118. package/skills/document/styles/clinic-care/skin.css +2 -1
  119. package/skills/document/styles/cool/skin.css +6 -5
  120. package/skills/document/styles/dark-glass/backdrop.html +2 -0
  121. package/skills/document/styles/dark-glass/skin.css +2 -1
  122. package/skills/document/styles/gov-brief/backdrop.html +2 -0
  123. package/skills/document/styles/gov-brief/skin.css +2 -1
  124. package/skills/document/styles/grid-tech/backdrop.html +2 -0
  125. package/skills/document/styles/grid-tech/skin.css +2 -1
  126. package/skills/document/styles/hand-drawn/skin.css +3 -3
  127. package/skills/document/styles/ivory-gold/skin.css +7 -6
  128. package/skills/document/styles/legal-slate/backdrop.html +2 -0
  129. package/skills/document/styles/legal-slate/skin.css +2 -1
  130. package/skills/document/styles/magazine-ink/skin.css +4 -3
  131. package/skills/document/styles/mckinsey/backdrop.html +7 -5
  132. package/skills/document/styles/mckinsey/skin.css +2 -1
  133. package/skills/document/styles/memphis/backdrop.html +2 -0
  134. package/skills/document/styles/memphis/skin.css +2 -1
  135. package/skills/document/styles/mono/skin.css +6 -2
  136. package/skills/document/styles/neon-cyber/backdrop.html +2 -0
  137. package/skills/document/styles/neon-cyber/skin.css +2 -1
  138. package/skills/document/styles/olive-gold/skin.css +7 -6
  139. package/skills/document/styles/organic-earth/backdrop.html +2 -0
  140. package/skills/document/styles/organic-earth/skin.css +2 -1
  141. package/skills/document/styles/pastel-saas/backdrop.html +2 -0
  142. package/skills/document/styles/pastel-saas/skin.css +2 -1
  143. package/skills/document/styles/portfolio-noir/backdrop.html +2 -0
  144. package/skills/document/styles/portfolio-noir/skin.css +2 -1
  145. package/skills/document/styles/retro-press/backdrop.html +2 -0
  146. package/skills/document/styles/retro-press/skin.css +2 -1
  147. package/skills/document/styles/sport-arena/backdrop.html +2 -0
  148. package/skills/document/styles/sport-arena/skin.css +4 -1
  149. package/skills/document/styles/swiss-grid/skin.css +10 -5
  150. package/skills/document/styles/wedding-blush/backdrop.html +2 -0
  151. package/skills/document/styles/wedding-blush/skin.css +4 -1
  152. package/skills/document/theme-system.md +85 -77
  153. package/skills/document/themes/README.md +7 -5
  154. package/skills/document/vision.md +8 -5
  155. package/skills/document/xlsx.md +15 -25
  156. package/skills/grill-me/SKILL.md +6 -0
  157. package/skills/grill-me/agents/openai.yaml +5 -0
  158. package/skills/grilling/SKILL.md +28 -0
  159. package/skills/grilling/agents/openai.yaml +3 -0
@@ -3019,11 +3019,11 @@ var require_utils = __commonJS({
3019
3019
  ctor2.prototype = new Obj();
3020
3020
  };
3021
3021
  exports2.extend = function() {
3022
- var result2 = {}, i, attr2;
3022
+ var result2 = {}, i, attr;
3023
3023
  for (i = 0; i < arguments.length; i++) {
3024
- for (attr2 in arguments[i]) {
3025
- if (Object.prototype.hasOwnProperty.call(arguments[i], attr2) && typeof result2[attr2] === "undefined") {
3026
- result2[attr2] = arguments[i][attr2];
3024
+ for (attr in arguments[i]) {
3025
+ if (Object.prototype.hasOwnProperty.call(arguments[i], attr) && typeof result2[attr] === "undefined") {
3026
+ result2[attr] = arguments[i][attr];
3027
3027
  }
3028
3028
  }
3029
3029
  }
@@ -9790,9 +9790,9 @@ var require_load = __commonJS({
9790
9790
  var require_lib3 = __commonJS({
9791
9791
  "node_modules/jszip/lib/index.js"(exports2, module2) {
9792
9792
  "use strict";
9793
- function JSZip3() {
9794
- if (!(this instanceof JSZip3)) {
9795
- return new JSZip3();
9793
+ function JSZip4() {
9794
+ if (!(this instanceof JSZip4)) {
9795
+ return new JSZip4();
9796
9796
  }
9797
9797
  if (arguments.length) {
9798
9798
  throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");
@@ -9801,7 +9801,7 @@ var require_lib3 = __commonJS({
9801
9801
  this.comment = null;
9802
9802
  this.root = "";
9803
9803
  this.clone = function() {
9804
- var newObj = new JSZip3();
9804
+ var newObj = new JSZip4();
9805
9805
  for (var i in this) {
9806
9806
  if (typeof this[i] !== "function") {
9807
9807
  newObj[i] = this[i];
@@ -9810,16 +9810,16 @@ var require_lib3 = __commonJS({
9810
9810
  return newObj;
9811
9811
  };
9812
9812
  }
9813
- JSZip3.prototype = require_object();
9814
- JSZip3.prototype.loadAsync = require_load();
9815
- JSZip3.support = require_support();
9816
- JSZip3.defaults = require_defaults();
9817
- JSZip3.version = "3.10.1";
9818
- JSZip3.loadAsync = function(content, options) {
9819
- return new JSZip3().loadAsync(content, options);
9813
+ JSZip4.prototype = require_object();
9814
+ JSZip4.prototype.loadAsync = require_load();
9815
+ JSZip4.support = require_support();
9816
+ JSZip4.defaults = require_defaults();
9817
+ JSZip4.version = "3.10.1";
9818
+ JSZip4.loadAsync = function(content, options) {
9819
+ return new JSZip4().loadAsync(content, options);
9820
9820
  };
9821
- JSZip3.external = require_external();
9822
- module2.exports = JSZip3;
9821
+ JSZip4.external = require_external();
9822
+ module2.exports = JSZip4;
9823
9823
  }
9824
9824
  });
9825
9825
 
@@ -18401,12 +18401,12 @@ var require_base64_js = __commonJS({
18401
18401
  var require_zipfile = __commonJS({
18402
18402
  "node_modules/mammoth/lib/zipfile.js"(exports2) {
18403
18403
  var base64js = require_base64_js();
18404
- var JSZip3 = require_lib3();
18404
+ var JSZip4 = require_lib3();
18405
18405
  exports2.openArrayBuffer = openArrayBuffer;
18406
18406
  exports2.splitPath = splitPath;
18407
18407
  exports2.joinPath = joinPath;
18408
18408
  function openArrayBuffer(arrayBuffer) {
18409
- return JSZip3.loadAsync(arrayBuffer).then(function(zipFile) {
18409
+ return JSZip4.loadAsync(arrayBuffer).then(function(zipFile) {
18410
18410
  function exists(name) {
18411
18411
  return zipFile.file(name) !== null;
18412
18412
  }
@@ -18861,8 +18861,8 @@ var require_dom = __commonJS({
18861
18861
  }
18862
18862
  }
18863
18863
  }
18864
- function _removeNamedNode(el, list, attr2) {
18865
- var i = _findNodeIndex(list, attr2);
18864
+ function _removeNamedNode(el, list, attr) {
18865
+ var i = _findNodeIndex(list, attr);
18866
18866
  if (i >= 0) {
18867
18867
  var lastIndex = list.length - 1;
18868
18868
  while (i < lastIndex) {
@@ -18872,12 +18872,12 @@ var require_dom = __commonJS({
18872
18872
  if (el) {
18873
18873
  var doc = el.ownerDocument;
18874
18874
  if (doc) {
18875
- _onRemoveAttribute(doc, el, attr2);
18876
- attr2.ownerElement = null;
18875
+ _onRemoveAttribute(doc, el, attr);
18876
+ attr.ownerElement = null;
18877
18877
  }
18878
18878
  }
18879
18879
  } else {
18880
- throw new DOMException(NOT_FOUND_ERR, new Error(el.tagName + "@" + attr2));
18880
+ throw new DOMException(NOT_FOUND_ERR, new Error(el.tagName + "@" + attr));
18881
18881
  }
18882
18882
  }
18883
18883
  NamedNodeMap.prototype = {
@@ -18886,43 +18886,43 @@ var require_dom = __commonJS({
18886
18886
  getNamedItem: function(key) {
18887
18887
  var i = this.length;
18888
18888
  while (i--) {
18889
- var attr2 = this[i];
18890
- if (attr2.nodeName == key) {
18891
- return attr2;
18889
+ var attr = this[i];
18890
+ if (attr.nodeName == key) {
18891
+ return attr;
18892
18892
  }
18893
18893
  }
18894
18894
  },
18895
- setNamedItem: function(attr2) {
18896
- var el = attr2.ownerElement;
18895
+ setNamedItem: function(attr) {
18896
+ var el = attr.ownerElement;
18897
18897
  if (el && el != this._ownerElement) {
18898
18898
  throw new DOMException(INUSE_ATTRIBUTE_ERR);
18899
18899
  }
18900
- var oldAttr = this.getNamedItem(attr2.nodeName);
18901
- _addNamedNode(this._ownerElement, this, attr2, oldAttr);
18900
+ var oldAttr = this.getNamedItem(attr.nodeName);
18901
+ _addNamedNode(this._ownerElement, this, attr, oldAttr);
18902
18902
  return oldAttr;
18903
18903
  },
18904
18904
  /* returns Node */
18905
- setNamedItemNS: function(attr2) {
18906
- var el = attr2.ownerElement, oldAttr;
18905
+ setNamedItemNS: function(attr) {
18906
+ var el = attr.ownerElement, oldAttr;
18907
18907
  if (el && el != this._ownerElement) {
18908
18908
  throw new DOMException(INUSE_ATTRIBUTE_ERR);
18909
18909
  }
18910
- oldAttr = this.getNamedItemNS(attr2.namespaceURI, attr2.localName);
18911
- _addNamedNode(this._ownerElement, this, attr2, oldAttr);
18910
+ oldAttr = this.getNamedItemNS(attr.namespaceURI, attr.localName);
18911
+ _addNamedNode(this._ownerElement, this, attr, oldAttr);
18912
18912
  return oldAttr;
18913
18913
  },
18914
18914
  /* returns Node */
18915
18915
  removeNamedItem: function(key) {
18916
- var attr2 = this.getNamedItem(key);
18917
- _removeNamedNode(this._ownerElement, this, attr2);
18918
- return attr2;
18916
+ var attr = this.getNamedItem(key);
18917
+ _removeNamedNode(this._ownerElement, this, attr);
18918
+ return attr;
18919
18919
  },
18920
18920
  // raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR
18921
18921
  //for level2
18922
18922
  removeNamedItemNS: function(namespaceURI, localName) {
18923
- var attr2 = this.getNamedItemNS(namespaceURI, localName);
18924
- _removeNamedNode(this._ownerElement, this, attr2);
18925
- return attr2;
18923
+ var attr = this.getNamedItemNS(namespaceURI, localName);
18924
+ _removeNamedNode(this._ownerElement, this, attr);
18925
+ return attr;
18926
18926
  },
18927
18927
  getNamedItemNS: function(namespaceURI, localName) {
18928
18928
  var i = this.length;
@@ -19424,9 +19424,9 @@ var require_dom = __commonJS({
19424
19424
  node.ownerDocument = newOwnerDocument;
19425
19425
  if (node.nodeType === ELEMENT_NODE && node.attributes) {
19426
19426
  for (var i = 0; i < node.attributes.length; i++) {
19427
- var attr2 = node.attributes.item(i);
19428
- if (attr2) {
19429
- attr2.ownerDocument = newOwnerDocument;
19427
+ var attr = node.attributes.item(i);
19428
+ if (attr) {
19429
+ attr.ownerDocument = newOwnerDocument;
19430
19430
  }
19431
19431
  }
19432
19432
  }
@@ -19695,20 +19695,20 @@ var require_dom = __commonJS({
19695
19695
  return this.getAttributeNode(name) != null;
19696
19696
  },
19697
19697
  getAttribute: function(name) {
19698
- var attr2 = this.getAttributeNode(name);
19699
- return attr2 && attr2.value || "";
19698
+ var attr = this.getAttributeNode(name);
19699
+ return attr && attr.value || "";
19700
19700
  },
19701
19701
  getAttributeNode: function(name) {
19702
19702
  return this.attributes.getNamedItem(name);
19703
19703
  },
19704
19704
  setAttribute: function(name, value) {
19705
- var attr2 = this.ownerDocument.createAttribute(name);
19706
- attr2.value = attr2.nodeValue = "" + value;
19707
- this.setAttributeNode(attr2);
19705
+ var attr = this.ownerDocument.createAttribute(name);
19706
+ attr.value = attr.nodeValue = "" + value;
19707
+ this.setAttributeNode(attr);
19708
19708
  },
19709
19709
  removeAttribute: function(name) {
19710
- var attr2 = this.getAttributeNode(name);
19711
- attr2 && this.removeAttributeNode(attr2);
19710
+ var attr = this.getAttributeNode(name);
19711
+ attr && this.removeAttributeNode(attr);
19712
19712
  },
19713
19713
  //four real opeartion method
19714
19714
  appendChild: function(newChild) {
@@ -19736,13 +19736,13 @@ var require_dom = __commonJS({
19736
19736
  return this.getAttributeNodeNS(namespaceURI, localName) != null;
19737
19737
  },
19738
19738
  getAttributeNS: function(namespaceURI, localName) {
19739
- var attr2 = this.getAttributeNodeNS(namespaceURI, localName);
19740
- return attr2 && attr2.value || "";
19739
+ var attr = this.getAttributeNodeNS(namespaceURI, localName);
19740
+ return attr && attr.value || "";
19741
19741
  },
19742
19742
  setAttributeNS: function(namespaceURI, qualifiedName, value) {
19743
- var attr2 = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);
19744
- attr2.value = attr2.nodeValue = "" + value;
19745
- this.setAttributeNode(attr2);
19743
+ var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);
19744
+ attr.value = attr.nodeValue = "" + value;
19745
+ this.setAttributeNode(attr);
19746
19746
  },
19747
19747
  getAttributeNodeNS: function(namespaceURI, localName) {
19748
19748
  return this.attributes.getNamedItemNS(namespaceURI, localName);
@@ -19968,22 +19968,22 @@ var require_dom = __commonJS({
19968
19968
  buf.push("<", prefixedNodeName);
19969
19969
  var childNs = ns.slice();
19970
19970
  for (var i = 0; i < len; i++) {
19971
- var attr2 = attrs.item(i);
19972
- if (attr2.prefix == "xmlns") {
19973
- childNs.push({ prefix: attr2.localName, namespace: attr2.value });
19974
- } else if (attr2.nodeName == "xmlns") {
19975
- childNs.push({ prefix: "", namespace: attr2.value });
19971
+ var attr = attrs.item(i);
19972
+ if (attr.prefix == "xmlns") {
19973
+ childNs.push({ prefix: attr.localName, namespace: attr.value });
19974
+ } else if (attr.nodeName == "xmlns") {
19975
+ childNs.push({ prefix: "", namespace: attr.value });
19976
19976
  }
19977
19977
  }
19978
19978
  for (var i = 0; i < len; i++) {
19979
- var attr2 = attrs.item(i);
19980
- if (needNamespaceDefine(attr2, html, childNs)) {
19981
- var attrPrefix = attr2.prefix || "";
19982
- var uri = attr2.namespaceURI;
19979
+ var attr = attrs.item(i);
19980
+ if (needNamespaceDefine(attr, html, childNs)) {
19981
+ var attrPrefix = attr.prefix || "";
19982
+ var uri = attr.namespaceURI;
19983
19983
  addSerializedAttribute(buf, attrPrefix ? "xmlns:" + attrPrefix : "xmlns", uri);
19984
19984
  childNs.push({ prefix: attrPrefix, namespace: uri });
19985
19985
  }
19986
- var filteredAttr = nodeFilter ? nodeFilter(attr2) : attr2;
19986
+ var filteredAttr = nodeFilter ? nodeFilter(attr) : attr;
19987
19987
  if (filteredAttr) {
19988
19988
  if (typeof filteredAttr === "string") {
19989
19989
  buf.push(filteredAttr);
@@ -23050,10 +23050,10 @@ var require_dom_parser = __commonJS({
23050
23050
  var namespaceURI = attrs.getURI(i);
23051
23051
  var value = attrs.getValue(i);
23052
23052
  var qName = attrs.getQName(i);
23053
- var attr2 = doc.createAttributeNS(namespaceURI, qName);
23054
- this.locator && position(attrs.getLocator(i), attr2);
23055
- attr2.value = attr2.nodeValue = value;
23056
- el.setAttributeNode(attr2);
23053
+ var attr = doc.createAttributeNS(namespaceURI, qName);
23054
+ this.locator && position(attrs.getLocator(i), attr);
23055
+ attr.value = attr.nodeValue = value;
23056
+ el.setAttributeNode(attr);
23057
23057
  }
23058
23058
  },
23059
23059
  endElement: function(namespaceURI, localName, qName) {
@@ -37915,7 +37915,7 @@ var require_browser_buffer_encode = __commonJS({
37915
37915
  var require_zip_stream = __commonJS({
37916
37916
  "node_modules/exceljs/lib/utils/zip-stream.js"(exports2, module2) {
37917
37917
  var events = require("events");
37918
- var JSZip3 = require_lib3();
37918
+ var JSZip4 = require_lib3();
37919
37919
  var StreamBuf = require_stream_buf();
37920
37920
  var { stringToBuffer } = require_browser_buffer_encode();
37921
37921
  var ZipWriter = class extends events.EventEmitter {
@@ -37928,7 +37928,7 @@ var require_zip_stream = __commonJS({
37928
37928
  },
37929
37929
  options
37930
37930
  );
37931
- this.zip = new JSZip3();
37931
+ this.zip = new JSZip4();
37932
37932
  this.stream = new StreamBuf();
37933
37933
  }
37934
37934
  append(data, options) {
@@ -39794,9 +39794,9 @@ var require_saxes = __commonJS({
39794
39794
  pushAttribNS(name, value) {
39795
39795
  var _a;
39796
39796
  const { prefix, local } = this.qname(name);
39797
- const attr2 = { name, prefix, local, value };
39798
- this.attribList.push(attr2);
39799
- (_a = this.attributeHandler) === null || _a === void 0 ? void 0 : _a.call(this, attr2);
39797
+ const attr = { name, prefix, local, value };
39798
+ this.attribList.push(attr);
39799
+ (_a = this.attributeHandler) === null || _a === void 0 ? void 0 : _a.call(this, attr);
39800
39800
  if (prefix === "xmlns") {
39801
39801
  const trimmed = value.trim();
39802
39802
  if (this.currentXMLVersion === "1.0" && trimmed === "") {
@@ -39812,9 +39812,9 @@ var require_saxes = __commonJS({
39812
39812
  }
39813
39813
  pushAttribPlain(name, value) {
39814
39814
  var _a;
39815
- const attr2 = { name, value };
39816
- this.attribList.push(attr2);
39817
- (_a = this.attributeHandler) === null || _a === void 0 ? void 0 : _a.call(this, attr2);
39815
+ const attr = { name, value };
39816
+ this.attribList.push(attr);
39817
+ (_a = this.attributeHandler) === null || _a === void 0 ? void 0 : _a.call(this, attr);
39818
39818
  }
39819
39819
  /**
39820
39820
  * End parsing. This performs final well-formedness checks and resets the
@@ -39914,8 +39914,8 @@ var require_saxes = __commonJS({
39914
39914
  }
39915
39915
  const { attributes } = tag;
39916
39916
  const seen = /* @__PURE__ */ new Set();
39917
- for (const attr2 of attribList) {
39918
- const { name, prefix, local } = attr2;
39917
+ for (const attr of attribList) {
39918
+ const { name, prefix, local } = attr;
39919
39919
  let uri;
39920
39920
  let eqname;
39921
39921
  if (prefix === "") {
@@ -39933,8 +39933,8 @@ var require_saxes = __commonJS({
39933
39933
  this.fail(`duplicate attribute: ${eqname}.`);
39934
39934
  }
39935
39935
  seen.add(eqname);
39936
- attr2.uri = uri;
39937
- attributes[name] = attr2;
39936
+ attr.uri = uri;
39937
+ attributes[name] = attr;
39938
39938
  }
39939
39939
  this.attribList = [];
39940
39940
  }
@@ -40158,8 +40158,8 @@ var require_base_xform = __commonJS({
40158
40158
  static toStringAttribute(value, dflt, always = false) {
40159
40159
  return _BaseXform.toAttribute(value, dflt, always);
40160
40160
  }
40161
- static toStringValue(attr2, dflt) {
40162
- return attr2 === void 0 ? dflt : attr2;
40161
+ static toStringValue(attr, dflt) {
40162
+ return attr === void 0 ? dflt : attr;
40163
40163
  }
40164
40164
  static toBoolAttribute(value, dflt, always = false) {
40165
40165
  if (value === void 0) {
@@ -40171,20 +40171,20 @@ var require_base_xform = __commonJS({
40171
40171
  }
40172
40172
  return void 0;
40173
40173
  }
40174
- static toBoolValue(attr2, dflt) {
40175
- return attr2 === void 0 ? dflt : attr2 === "1";
40174
+ static toBoolValue(attr, dflt) {
40175
+ return attr === void 0 ? dflt : attr === "1";
40176
40176
  }
40177
40177
  static toIntAttribute(value, dflt, always = false) {
40178
40178
  return _BaseXform.toAttribute(value, dflt, always);
40179
40179
  }
40180
- static toIntValue(attr2, dflt) {
40181
- return attr2 === void 0 ? dflt : parseInt(attr2, 10);
40180
+ static toIntValue(attr, dflt) {
40181
+ return attr === void 0 ? dflt : parseInt(attr, 10);
40182
40182
  }
40183
40183
  static toFloatAttribute(value, dflt, always = false) {
40184
40184
  return _BaseXform.toAttribute(value, dflt, always);
40185
40185
  }
40186
- static toFloatValue(attr2, dflt) {
40187
- return attr2 === void 0 ? dflt : parseFloat(attr2);
40186
+ static toFloatValue(attr, dflt) {
40187
+ return attr === void 0 ? dflt : parseFloat(attr);
40188
40188
  }
40189
40189
  };
40190
40190
  module2.exports = BaseXform;
@@ -40538,9 +40538,9 @@ var require_underline_xform = __commonJS({
40538
40538
  if (model === true) {
40539
40539
  xmlStream.leafNode("u");
40540
40540
  } else {
40541
- const attr2 = _UnderlineXform.Attributes[model];
40542
- if (attr2) {
40543
- xmlStream.leafNode("u", attr2);
40541
+ const attr = _UnderlineXform.Attributes[model];
40542
+ if (attr) {
40543
+ xmlStream.leafNode("u", attr);
40544
40544
  }
40545
40545
  }
40546
40546
  }
@@ -44717,7 +44717,7 @@ var require_page_setup_properties_xform = __commonJS({
44717
44717
  var require_outline_properties_xform = __commonJS({
44718
44718
  "node_modules/exceljs/lib/xlsx/xform/sheet/outline-properties-xform.js"(exports2, module2) {
44719
44719
  var BaseXform = require_base_xform();
44720
- var isDefined = (attr2) => typeof attr2 !== "undefined";
44720
+ var isDefined = (attr) => typeof attr !== "undefined";
44721
44721
  var OutlinePropertiesXform = class extends BaseXform {
44722
44722
  get tag() {
44723
44723
  return "outlinePr";
@@ -49608,7 +49608,7 @@ var require_theme1 = __commonJS({
49608
49608
  var require_xlsx = __commonJS({
49609
49609
  "node_modules/exceljs/lib/xlsx/xlsx.js"(exports2, module2) {
49610
49610
  var fs = require("fs");
49611
- var JSZip3 = require_lib3();
49611
+ var JSZip4 = require_lib3();
49612
49612
  var { PassThrough } = require_readable2();
49613
49613
  var ZipStream = require_zip_stream();
49614
49614
  var StreamBuf = require_stream_buf();
@@ -49847,7 +49847,7 @@ var require_xlsx = __commonJS({
49847
49847
  tables: {},
49848
49848
  vmlDrawings: {}
49849
49849
  };
49850
- const zip = await JSZip3.loadAsync(buffer);
49850
+ const zip = await JSZip4.loadAsync(buffer);
49851
49851
  for (const entry of Object.values(zip.files)) {
49852
49852
  if (!entry.dir) {
49853
49853
  let entryName = entry.name;
@@ -58096,8 +58096,8 @@ var require_graceful_fs = __commonJS({
58096
58096
  }
58097
58097
  }
58098
58098
  var fs$writeFile = fs2.writeFile;
58099
- fs2.writeFile = writeFile2;
58100
- function writeFile2(path, data, options, cb2) {
58099
+ fs2.writeFile = writeFile3;
58100
+ function writeFile3(path, data, options, cb2) {
58101
58101
  if (typeof options === "function")
58102
58102
  cb2 = options, options = null;
58103
58103
  return go$writeFile(path, data, options, cb2);
@@ -59600,7 +59600,7 @@ var require_old = __commonJS({
59600
59600
  splitRootRe = /^[\/]*/;
59601
59601
  }
59602
59602
  var splitRootRe;
59603
- exports2.realpathSync = function realpathSync(p, cache) {
59603
+ exports2.realpathSync = function realpathSync2(p, cache) {
59604
59604
  p = pathModule.resolve(p);
59605
59605
  if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
59606
59606
  return cache[p];
@@ -59753,8 +59753,8 @@ var require_fs = __commonJS({
59753
59753
  "node_modules/fs.realpath/index.js"(exports2, module2) {
59754
59754
  module2.exports = realpath;
59755
59755
  realpath.realpath = realpath;
59756
- realpath.sync = realpathSync;
59757
- realpath.realpathSync = realpathSync;
59756
+ realpath.sync = realpathSync2;
59757
+ realpath.realpathSync = realpathSync2;
59758
59758
  realpath.monkeypatch = monkeypatch;
59759
59759
  realpath.unmonkeypatch = unmonkeypatch;
59760
59760
  var fs = require("fs");
@@ -59782,7 +59782,7 @@ var require_fs = __commonJS({
59782
59782
  }
59783
59783
  });
59784
59784
  }
59785
- function realpathSync(p, cache) {
59785
+ function realpathSync2(p, cache) {
59786
59786
  if (ok) {
59787
59787
  return origRealpathSync(p, cache);
59788
59788
  }
@@ -59798,7 +59798,7 @@ var require_fs = __commonJS({
59798
59798
  }
59799
59799
  function monkeypatch() {
59800
59800
  fs.realpath = realpath;
59801
- fs.realpathSync = realpathSync;
59801
+ fs.realpathSync = realpathSync2;
59802
59802
  }
59803
59803
  function unmonkeypatch() {
59804
59804
  fs.realpath = origRealpath;
@@ -65527,8 +65527,8 @@ var require_zip_archive_entry = __commonJS({
65527
65527
  }
65528
65528
  this.crc = crc;
65529
65529
  };
65530
- ZipArchiveEntry.prototype.setExternalAttributes = function(attr2) {
65531
- this.exattr = attr2 >>> 0;
65530
+ ZipArchiveEntry.prototype.setExternalAttributes = function(attr) {
65531
+ this.exattr = attr >>> 0;
65532
65532
  };
65533
65533
  ZipArchiveEntry.prototype.setExtra = function(extra) {
65534
65534
  this.extra = extra;
@@ -65539,8 +65539,8 @@ var require_zip_archive_entry = __commonJS({
65539
65539
  }
65540
65540
  this.gpb = gpb;
65541
65541
  };
65542
- ZipArchiveEntry.prototype.setInternalAttributes = function(attr2) {
65543
- this.inattr = attr2;
65542
+ ZipArchiveEntry.prototype.setInternalAttributes = function(attr) {
65543
+ this.inattr = attr;
65544
65544
  };
65545
65545
  ZipArchiveEntry.prototype.setMethod = function(method) {
65546
65546
  if (method < 0) {
@@ -85503,7 +85503,7 @@ var require_dir_writer = __commonJS({
85503
85503
  module2.exports = DirWriter;
85504
85504
  var Writer = require_writer2();
85505
85505
  var inherits2 = require_inherits();
85506
- var mkdir2 = require_mkdirp();
85506
+ var mkdir3 = require_mkdirp();
85507
85507
  var path = require("path");
85508
85508
  var collect = require_collect();
85509
85509
  inherits2(DirWriter, Writer);
@@ -85519,7 +85519,7 @@ var require_dir_writer = __commonJS({
85519
85519
  }
85520
85520
  DirWriter.prototype._create = function() {
85521
85521
  var self2 = this;
85522
- mkdir2(self2._path, Writer.dirmode, function(er) {
85522
+ mkdir3(self2._path, Writer.dirmode, function(er) {
85523
85523
  if (er) return self2.error(er);
85524
85524
  self2.ready = true;
85525
85525
  self2.emit("ready");
@@ -85864,7 +85864,7 @@ var require_writer2 = __commonJS({
85864
85864
  var fs = require_graceful_fs();
85865
85865
  var inherits2 = require_inherits();
85866
85866
  var rimraf = require_rimraf();
85867
- var mkdir2 = require_mkdirp();
85867
+ var mkdir3 = require_mkdirp();
85868
85868
  var path = require("path");
85869
85869
  var umask = process.platform === "win32" ? 0 : process.umask();
85870
85870
  var getType = require_get_type();
@@ -85970,7 +85970,7 @@ var require_writer2 = __commonJS({
85970
85970
  }
85971
85971
  };
85972
85972
  function create2(self2) {
85973
- mkdir2(path.dirname(self2._path), Writer.dirmode, function(er, made) {
85973
+ mkdir3(path.dirname(self2._path), Writer.dirmode, function(er, made) {
85974
85974
  if (er) return self2.error(er);
85975
85975
  self2._madeDir = made;
85976
85976
  return self2._create();
@@ -89026,65 +89026,12 @@ var import_node_path3 = require("node:path");
89026
89026
  var import_promises3 = require("node:fs/promises");
89027
89027
 
89028
89028
  // packages/core/dist/document/doc-convert.js
89029
- var import_jszip2 = __toESM(require_lib3(), 1);
89029
+ var import_jszip3 = __toESM(require_lib3(), 1);
89030
89030
  var import_mammoth2 = __toESM(require_lib6(), 1);
89031
89031
 
89032
89032
  // packages/core/dist/document/office-converter.js
89033
89033
  var import_jszip = __toESM(require_lib3(), 1);
89034
89034
  var import_mammoth = __toESM(require_lib6(), 1);
89035
-
89036
- // packages/core/dist/document/ooxml-util.js
89037
- function unescXml(s) {
89038
- return s.replace(/&(amp|lt|gt|quot|apos|#x?[0-9a-fA-F]+);/g, (whole, code) => {
89039
- switch (code) {
89040
- case "amp":
89041
- return "&";
89042
- case "lt":
89043
- return "<";
89044
- case "gt":
89045
- return ">";
89046
- case "quot":
89047
- return '"';
89048
- case "apos":
89049
- return "'";
89050
- default: {
89051
- const n = code.startsWith("#x") || code.startsWith("#X") ? parseInt(code.slice(2), 16) : parseInt(code.slice(1), 10);
89052
- return Number.isInteger(n) && n >= 0 && n <= 1114111 ? String.fromCodePoint(n) : whole;
89053
- }
89054
- }
89055
- });
89056
- }
89057
-
89058
- // packages/core/dist/document/pptx-parts.js
89059
- var SLIDE_PART = /^ppt\/slides\/(slide\d+\.xml)$/;
89060
- function relsPathFor(path) {
89061
- return path.replace(SLIDE_PART, "ppt/slides/_rels/$1.rels");
89062
- }
89063
- function attr(el, name) {
89064
- return new RegExp(`\\b${name}="([^"]*)"`).exec(el)?.[1];
89065
- }
89066
- async function slidePartsInOrder(zip) {
89067
- const byNumber = Object.keys(zip.files).filter((p) => SLIDE_PART.test(p)).sort((a, b) => Number(/(\d+)\.xml$/.exec(a)[1]) - Number(/(\d+)\.xml$/.exec(b)[1]));
89068
- const toParts = (paths) => paths.map((path, i) => ({ position: i + 1, path, relsPath: relsPathFor(path) }));
89069
- const pres = await zip.file("ppt/presentation.xml")?.async("string");
89070
- const rels = await zip.file("ppt/_rels/presentation.xml.rels")?.async("string");
89071
- if (!pres || !rels)
89072
- return toParts(byNumber);
89073
- const targetById = /* @__PURE__ */ new Map();
89074
- for (const [el] of rels.matchAll(/<Relationship\b[^>]*>/g)) {
89075
- const id = attr(el, "Id");
89076
- const target = attr(el, "Target");
89077
- if (!id || !target)
89078
- continue;
89079
- targetById.set(id, target.startsWith("/") ? target.slice(1) : `ppt/${target.replace(/^\.\//, "")}`);
89080
- }
89081
- const list = /<p:sldIdLst\b[^>]*>([\s\S]*?)<\/p:sldIdLst>/.exec(pres)?.[1] ?? "";
89082
- const ordered = [...list.matchAll(/<p:sldId\b[^>]*>/g)].map(([el]) => targetById.get(attr(el, "r:id") ?? "")).filter((p) => p !== void 0 && SLIDE_PART.test(p) && zip.file(p) !== null);
89083
- const complete = ordered.length === byNumber.length && new Set(ordered).size === ordered.length;
89084
- return toParts(complete ? ordered : byNumber);
89085
- }
89086
-
89087
- // packages/core/dist/document/office-converter.js
89088
89035
  function isZipMagic(buffer) {
89089
89036
  const b = new Uint8Array(buffer, 0, 4);
89090
89037
  return b[0] === 80 && b[1] === 75 && b[2] === 3 && b[3] === 4;
@@ -89104,51 +89051,6 @@ async function detectZipFormat(zip) {
89104
89051
  return "iwork";
89105
89052
  return "unknown";
89106
89053
  }
89107
- function mimeFromPath(path) {
89108
- const ext = path.split(".").pop()?.toLowerCase() ?? "";
89109
- const map2 = {
89110
- png: "image/png",
89111
- jpg: "image/jpeg",
89112
- jpeg: "image/jpeg",
89113
- gif: "image/gif",
89114
- webp: "image/webp",
89115
- svg: "image/svg+xml",
89116
- bmp: "image/bmp",
89117
- tiff: "image/tiff",
89118
- tif: "image/tiff",
89119
- emf: "image/x-emf",
89120
- wmf: "image/x-wmf"
89121
- };
89122
- return map2[ext] ?? "image/png";
89123
- }
89124
- function resolveRelTarget(relsFilePath, target) {
89125
- const base = relsFilePath.replace(/_rels\/[^/]+$/, "");
89126
- const parts = (base + target).split("/");
89127
- const resolved = [];
89128
- for (const part of parts) {
89129
- if (part === "..")
89130
- resolved.pop();
89131
- else if (part !== ".")
89132
- resolved.push(part);
89133
- }
89134
- return resolved.join("/");
89135
- }
89136
- function extractSlideText(xml) {
89137
- const paragraphs = [];
89138
- for (const pMatch of xml.matchAll(/<a:p[\s>][^]*?<\/a:p>/g)) {
89139
- const texts = [];
89140
- for (const tMatch of pMatch[0].matchAll(/<a:t\b[^>]*>([^<]*)<\/a:t>/g)) {
89141
- texts.push(unescXml(tMatch[1]));
89142
- }
89143
- const para = texts.join("").trim();
89144
- if (para)
89145
- paragraphs.push(para);
89146
- }
89147
- return paragraphs.join("\n");
89148
- }
89149
- function imageRefsFromRels(relsXml) {
89150
- return [...relsXml.matchAll(/Type="[^"]*\/image"\s+Target="([^"]+)"/g)].map((m) => m[1]);
89151
- }
89152
89054
 
89153
89055
  // node_modules/docx/dist/index.mjs
89154
89056
  var __create2 = Object.create;
@@ -96468,14 +96370,14 @@ var require_js2xml = /* @__PURE__ */ __commonJSMin(((exports2, module2) => {
96468
96370
  function writeAttributes(attributes, options, depth) {
96469
96371
  if (options.ignoreAttributes) return "";
96470
96372
  if ("attributesFn" in options) attributes = options.attributesFn(attributes, currentElementName, currentElement);
96471
- var key, attr2, attrName, quote, result2 = [];
96373
+ var key, attr, attrName, quote, result2 = [];
96472
96374
  for (key in attributes) if (attributes.hasOwnProperty(key) && attributes[key] !== null && attributes[key] !== void 0) {
96473
96375
  quote = options.noQuotesForNativeAttributes && typeof attributes[key] !== "string" ? "" : '"';
96474
- attr2 = "" + attributes[key];
96475
- attr2 = attr2.replace(/"/g, "&quot;");
96476
- attrName = "attributeNameFn" in options ? options.attributeNameFn(key, attr2, currentElementName, currentElement) : key;
96376
+ attr = "" + attributes[key];
96377
+ attr = attr.replace(/"/g, "&quot;");
96378
+ attrName = "attributeNameFn" in options ? options.attributeNameFn(key, attr, currentElementName, currentElement) : key;
96477
96379
  result2.push(options.spaces && options.indentAttributes ? writeIndentation(options, depth + 1, false) : " ");
96478
- result2.push(attrName + "=" + quote + ("attributeValueFn" in options ? options.attributeValueFn(attr2, key, currentElementName, currentElement) : attr2) + quote);
96380
+ result2.push(attrName + "=" + quote + ("attributeValueFn" in options ? options.attributeValueFn(attr, key, currentElementName, currentElement) : attr) + quote);
96479
96381
  }
96480
96382
  if (attributes && Object.keys(attributes).length && options.spaces && options.indentAttributes) result2.push(writeIndentation(options, depth, false));
96481
96383
  return result2.join("");
@@ -101619,12 +101521,12 @@ var require_xml2 = /* @__PURE__ */ __commonJSMin(((exports2, module2) => {
101619
101521
  }
101620
101522
  }
101621
101523
  function addXmlDeclaration(declaration) {
101622
- var attr2 = {
101524
+ var attr = {
101623
101525
  version: "1.0",
101624
101526
  encoding: declaration.encoding || "UTF-8"
101625
101527
  };
101626
- if (declaration.standalone) attr2.standalone = declaration.standalone;
101627
- add({ "?xml": { _attr: attr2 } });
101528
+ if (declaration.standalone) attr.standalone = declaration.standalone;
101529
+ add({ "?xml": { _attr: attr } });
101628
101530
  output = output.replace("/>", "?>");
101629
101531
  }
101630
101532
  delay(function() {
@@ -102845,6 +102747,11 @@ var findPatchKeys = (text) => {
102845
102747
 
102846
102748
  // packages/core/dist/document/doc-gen.js
102847
102749
  var import_exceljs = __toESM(require_excel(), 1);
102750
+
102751
+ // packages/core/dist/document/docx-defaults.js
102752
+ var import_jszip2 = __toESM(require_lib3(), 1);
102753
+
102754
+ // packages/core/dist/document/doc-gen.js
102848
102755
  var HEADINGS = [HeadingLevel.HEADING_1, HeadingLevel.HEADING_2, HeadingLevel.HEADING_3, HeadingLevel.HEADING_4];
102849
102756
 
102850
102757
  // packages/core/dist/document/html-escape.js
@@ -102872,9 +102779,6 @@ table { border-collapse: collapse; width: 100%; margin: 8pt 0; font-size: 10.5pt
102872
102779
  th, td { border: 1px solid #b9b9b9; padding: 4pt 8pt; text-align: left; vertical-align: top; }
102873
102780
  th { background: #f2f2f2; font-weight: 700; }
102874
102781
  img { max-width: 100%; }
102875
- .slide { page-break-after: always; }
102876
- .slide:last-child { page-break-after: auto; }
102877
- .slide-no { color: #999; font-size: 8pt; margin: 0 0 6pt; }
102878
102782
  `.trim();
102879
102783
  function htmlShell(bodyHtml, title) {
102880
102784
  const head = `<meta charset="utf-8">` + (title ? `<title>${escapeHtml(title)}</title>` : "") + `<style>${PRINT_STYLE}</style>`;
@@ -102898,32 +102802,6 @@ async function convertDocxToHtml(buffer, filename) {
102898
102802
  warnings: (result2.messages ?? []).map((m) => `${m.type ?? "warning"}: ${m.message ?? ""}`)
102899
102803
  };
102900
102804
  }
102901
- async function convertPptxToHtml(buffer, filename) {
102902
- const zip = await import_jszip2.default.loadAsync(buffer);
102903
- const slides = await slidePartsInOrder(zip);
102904
- const sections = [];
102905
- for (const { position, path, relsPath } of slides) {
102906
- const xml = await zip.file(path).async("string");
102907
- const paragraphs = extractSlideText(xml).split("\n").filter(Boolean);
102908
- const imgs = [];
102909
- const relsFile = zip.file(relsPath);
102910
- if (relsFile) {
102911
- for (const ref of imageRefsFromRels(await relsFile.async("string"))) {
102912
- const mediaPath = resolveRelTarget(relsPath, ref);
102913
- const media = zip.file(mediaPath);
102914
- if (!media)
102915
- continue;
102916
- imgs.push(`<img src="data:${mimeFromPath(mediaPath)};base64,${await media.async("base64")}" alt="">`);
102917
- }
102918
- }
102919
- sections.push(`<section class="slide"><div class="slide-no">${position} / ${slides.length}</div>` + paragraphs.map((p) => `<p>${escapeHtml(p)}</p>`).join("") + imgs.join("") + `</section>`);
102920
- }
102921
- return {
102922
- kind: "pptx",
102923
- html: htmlShell(sections.join("\n"), titleFromFilename(filename)),
102924
- warnings: ["pptx conversion is one page per slide (text + images); in-slide layout is not reproduced"]
102925
- };
102926
- }
102927
102805
  async function convertOfficeToPrintable(buffer, filename) {
102928
102806
  if (buffer.byteLength < 4)
102929
102807
  return { error: `\u65E0\u6CD5\u8BC6\u522B ${filename} \u7684\u6587\u4EF6\u683C\u5F0F\uFF08\u6587\u4EF6\u8FC7\u5C0F\uFF09` };
@@ -102931,10 +102809,10 @@ async function convertOfficeToPrintable(buffer, filename) {
102931
102809
  return { error: `\u4E0D\u652F\u6301\u65E7\u7248 .doc/.ppt\uFF0C\u8BF7\u5148\u5728\u5BF9\u5E94\u5E94\u7528\u4E2D\u53E6\u5B58\u4E3A .docx/.pptx \u518D\u8F6C\u6362` };
102932
102810
  }
102933
102811
  if (!isZipMagic(buffer))
102934
- return { error: `\u4E0D\u652F\u6301 ${filename} \u7684\u6587\u4EF6\u683C\u5F0F\uFF08doc-convert \u53EA\u652F\u6301 .docx/.pptx\uFF09` };
102812
+ return { error: `Unsupported format for ${filename}: HTML reconstruction supports .docx only` };
102935
102813
  let zip;
102936
102814
  try {
102937
- zip = await import_jszip2.default.loadAsync(buffer);
102815
+ zip = await import_jszip3.default.loadAsync(buffer);
102938
102816
  } catch {
102939
102817
  return { error: `\u65E0\u6CD5\u89E3\u6790 ${filename}\uFF1AZIP \u7ED3\u6784\u635F\u574F` };
102940
102818
  }
@@ -102943,14 +102821,14 @@ async function convertOfficeToPrintable(buffer, filename) {
102943
102821
  if (format === "docx")
102944
102822
  return await convertDocxToHtml(buffer, filename);
102945
102823
  if (format === "pptx")
102946
- return await convertPptxToHtml(buffer, filename);
102824
+ return { error: "PPTX to PDF requires Office; HTML reconstruction cannot preserve the source fonts and layout" };
102947
102825
  } catch (e) {
102948
102826
  return { error: `\u8F6C\u6362 ${filename} \u5931\u8D25\uFF1A${String(e)}` };
102949
102827
  }
102950
102828
  if (format === "xlsx") {
102951
102829
  return { error: `.xlsx \u65E0 HTML \u515C\u5E95\uFF1Axlsx\u2192PDF \u9700 LibreOffice\uFF08\u672C\u673A\u6216 sidecar\uFF09\uFF0C\u6570\u636E\u67E5\u8BE2\u7528 xlsx-query\u3001\u4EA7\u51FA\u62A5\u544A\u7528 doc-gen` };
102952
102830
  }
102953
- return { error: `\u4E0D\u652F\u6301 ${filename} \u7684\u6587\u4EF6\u683C\u5F0F\uFF08doc-convert \u53EA\u652F\u6301 .docx/.pptx\uFF09` };
102831
+ return { error: `Unsupported format for ${filename}: HTML reconstruction supports .docx only` };
102954
102832
  }
102955
102833
 
102956
102834
  // packages/core/dist/document/soffice.js
@@ -103048,6 +102926,10 @@ async function convertToPdfViaSoffice(inputPath, options = {}) {
103048
102926
  const profileDir = await (0, import_promises.mkdtemp)((0, import_node_path.join)((0, import_node_os.tmpdir)(), "talos-lo-profile-"));
103049
102927
  const outDir = await (0, import_promises.mkdtemp)((0, import_node_path.join)((0, import_node_os.tmpdir)(), "talos-lo-out-"));
103050
102928
  try {
102929
+ if (isMacAppSoffice(soffice)) {
102930
+ await (0, import_promises.mkdir)((0, import_node_path.join)(profileDir, "user"), { recursive: true });
102931
+ await (0, import_promises.writeFile)((0, import_node_path.join)(profileDir, "user", "registrymodifications.xcu"), macFontReplacementXcu(missingWebFonts()));
102932
+ }
103051
102933
  await runSoffice(soffice, [
103052
102934
  "--headless",
103053
102935
  "--norestore",
@@ -103073,6 +102955,83 @@ async function convertToPdfViaSoffice(inputPath, options = {}) {
103073
102955
  });
103074
102956
  }
103075
102957
  }
102958
+ function isMacAppSoffice(bin, platform = process.platform) {
102959
+ if (platform !== "darwin")
102960
+ return false;
102961
+ let real = bin;
102962
+ try {
102963
+ real = (0, import_node_fs.realpathSync)(bin);
102964
+ } catch {
102965
+ }
102966
+ return /\.app\/Contents\/MacOS\/soffice(\.bin)?$/.test(real);
102967
+ }
102968
+ var MAC_CJK_FONT_REPLACEMENT_XCU = `<?xml version="1.0" encoding="UTF-8"?>
102969
+ <oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
102970
+ <item oor:path="/org.openoffice.Office.Common/Font/Substitution"><prop oor:name="Replacement" oor:op="fuse"><value>true</value></prop></item>
102971
+ <item oor:path="/org.openoffice.Office.Common/Font/Substitution/FontPairs"><node oor:name="_0" oor:op="replace"><prop oor:name="Always" oor:op="fuse"><value>true</value></prop><prop oor:name="OnScreenOnly" oor:op="fuse"><value>false</value></prop><prop oor:name="ReplaceFont" oor:op="fuse"><value>Microsoft YaHei</value></prop><prop oor:name="SubstituteFont" oor:op="fuse"><value>\u51AC\u9752\u9ED1\u4F53\u7B80\u4F53\u4E2D\u6587</value></prop></node><node oor:name="_1" oor:op="replace"><prop oor:name="Always" oor:op="fuse"><value>true</value></prop><prop oor:name="OnScreenOnly" oor:op="fuse"><value>false</value></prop><prop oor:name="ReplaceFont" oor:op="fuse"><value>Microsoft JhengHei</value></prop><prop oor:name="SubstituteFont" oor:op="fuse"><value>\u9ED1\u4F53-\u7E41</value></prop></node></item>
102972
+ </oor:items>
102973
+ `;
102974
+ var SANS = { group: "sans", mac: "Arial", cloud: "Liberation Sans" };
102975
+ var SERIF_TIMES = { group: "serif", mac: "Times New Roman", cloud: "Liberation Serif" };
102976
+ var SERIF_GEORGIA = { group: "serif", mac: "Georgia", cloud: "Liberation Serif" };
102977
+ var CONDENSED = { group: "display", mac: "Arial Narrow", cloud: "Liberation Sans Narrow" };
102978
+ var WEB_FONT_SUBSTITUTES = {
102979
+ // sans — the neutral grotesques
102980
+ "Inter": SANS,
102981
+ "Jost": SANS,
102982
+ "Public Sans": SANS,
102983
+ "Manrope": SANS,
102984
+ "Karla": SANS,
102985
+ "Sora": SANS,
102986
+ "IBM Plex Sans": SANS,
102987
+ "Archivo": SANS,
102988
+ "Space Grotesk": SANS,
102989
+ "Quicksand": SANS,
102990
+ "Lexend": SANS,
102991
+ "Nunito": SANS,
102992
+ // serif
102993
+ "Playfair Display": SERIF_TIMES,
102994
+ "Bodoni Moda": SERIF_TIMES,
102995
+ "Zilla Slab": SERIF_TIMES,
102996
+ "Fraunces": SERIF_TIMES,
102997
+ "Cormorant Garamond": SERIF_TIMES,
102998
+ "Lora": SERIF_GEORGIA,
102999
+ "Marcellus": SERIF_GEORGIA,
103000
+ "DM Serif Display": SERIF_GEORGIA,
103001
+ // display
103002
+ "Anton": CONDENSED,
103003
+ "Big Shoulders Display": CONDENSED,
103004
+ "Syne": { group: "display", mac: "Arial", cloud: "Liberation Sans" },
103005
+ "Chakra Petch": { group: "display", mac: "Arial", cloud: "Liberation Sans" },
103006
+ "Gochi Hand": { group: "display", mac: "Noteworthy", cloud: "Liberation Sans" }
103007
+ };
103008
+ var WEB_GROTESQUE_FAMILIES = Object.keys(WEB_FONT_SUBSTITUTES).filter((f) => WEB_FONT_SUBSTITUTES[f].group === "sans");
103009
+ var MAC_FONT_DIRS = ["/System/Library/Fonts", "/System/Library/Fonts/Supplemental", "/Library/Fonts"];
103010
+ function missingWebFonts(fontFiles = macFontFiles()) {
103011
+ const names = fontFiles.map((f) => (0, import_node_path.basename)(f).toLowerCase());
103012
+ return Object.keys(WEB_FONT_SUBSTITUTES).filter((family) => {
103013
+ const stem = family.replace(/\s+/g, "").toLowerCase();
103014
+ return !names.some((n) => n.startsWith(stem) && /^[-_. \[]/.test(n.slice(stem.length)));
103015
+ });
103016
+ }
103017
+ function macFontFiles() {
103018
+ const dirs = [...MAC_FONT_DIRS, (0, import_node_path.join)(process.env.HOME ?? "", "Library/Fonts")];
103019
+ const out = [];
103020
+ for (const d of dirs) {
103021
+ try {
103022
+ out.push(...(0, import_node_fs.readdirSync)(d));
103023
+ } catch {
103024
+ }
103025
+ }
103026
+ return out;
103027
+ }
103028
+ var fontPair = (i, from, to) => `<node oor:name="_${i}" oor:op="replace"><prop oor:name="Always" oor:op="fuse"><value>true</value></prop><prop oor:name="OnScreenOnly" oor:op="fuse"><value>false</value></prop><prop oor:name="ReplaceFont" oor:op="fuse"><value>${from}</value></prop><prop oor:name="SubstituteFont" oor:op="fuse"><value>${to}</value></prop></node>`;
103029
+ function macFontReplacementXcu(missing) {
103030
+ if (!missing.length)
103031
+ return MAC_CJK_FONT_REPLACEMENT_XCU;
103032
+ const extra = missing.map((f, i) => fontPair(i + 2, f, WEB_FONT_SUBSTITUTES[f]?.mac ?? "Arial")).join("");
103033
+ return MAC_CJK_FONT_REPLACEMENT_XCU.replace("</node></item>", `</node>${extra}</item>`);
103034
+ }
103076
103035
  function runSoffice(bin, args, timeoutMs) {
103077
103036
  return new Promise((resolve, reject2) => {
103078
103037
  const child = (0, import_node_child_process.spawn)(bin, args, { stdio: ["ignore", "pipe", "pipe"] });
@@ -103126,10 +103085,46 @@ async function convertViaOfficeService(bytes, filename, url, options = {}) {
103126
103085
  }
103127
103086
 
103128
103087
  // apps/admin/data/skills.lib/document/bin-src/lib/headless-chromium.mjs
103129
- var import_node_fs2 = require("node:fs");
103130
103088
  var import_promises2 = require("node:fs/promises");
103131
103089
  var import_node_module = require("node:module");
103132
103090
  var import_node_path2 = require("node:path");
103091
+
103092
+ // packages/core/dist/document/pdf-print.js
103093
+ var CJK_TEXT_RE = /[\u2E80-\u30FF\u3200-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF]/;
103094
+ var PREPARE_FONTS = String.raw`async (fallbackFamily) => {
103095
+ const cjk = new RegExp(${JSON.stringify(CJK_TEXT_RE.source)});
103096
+ const normalize = (family) => family.trim().replace(/^['"]|['"]$/g, '').toLowerCase();
103097
+ const check = async () => {
103098
+ await document.fonts.ready;
103099
+ const failed = [...document.fonts].filter(face => face.status === 'error');
103100
+ if (failed.length) throw new Error('PDF font failed to load: ' + failed.map(face => face.family).join(', '));
103101
+ };
103102
+ await check();
103103
+ if (fallbackFamily && cjk.test(document.body.innerText)) {
103104
+ const faces = [...document.fonts];
103105
+ if (!faces.some(face => normalize(face.family) === normalize(fallbackFamily))) {
103106
+ throw new Error('PDF CJK fallback font is unavailable: ' + fallbackFamily);
103107
+ }
103108
+ const embedded = new Set(faces.filter(face => face.status === 'loaded' && normalize(face.family) !== normalize(fallbackFamily)).map(face => normalize(face.family)));
103109
+ const updates = [...document.body.querySelectorAll('*'), document.body]
103110
+ .filter(element => element.style && !['SCRIPT', 'STYLE', 'TEMPLATE', 'NOSCRIPT'].includes(element.tagName))
103111
+ .map(element => {
103112
+ const families = getComputedStyle(element).fontFamily.match(/(?:[^,"']+|"[^"]*"|'[^']*')+/g) || [];
103113
+ const authored = families.filter(family => normalize(family) !== normalize(fallbackFamily));
103114
+ return [element, [...authored.filter(family => embedded.has(normalize(family))), fallbackFamily,
103115
+ ...authored.filter(family => !embedded.has(normalize(family)))].join(', ')];
103116
+ });
103117
+ for (const [element, family] of updates) element.style.setProperty('font-family', family, 'important');
103118
+ // Force layout before fonts.ready: newly selected fallback faces load lazily.
103119
+ document.body.getBoundingClientRect();
103120
+ await check();
103121
+ }
103122
+ }`;
103123
+ function pdfFontPreparationScript(fallbackFamily) {
103124
+ return `(${PREPARE_FONTS})(${JSON.stringify(fallbackFamily ?? null)})`;
103125
+ }
103126
+
103127
+ // apps/admin/data/skills.lib/document/bin-src/lib/headless-chromium.mjs
103133
103128
  var NO_BROWSER_ADVICE = "Do not install packages or download a browser to work around this. Tell the user the file could not be produced here.";
103134
103129
  function headlessBrowserDisabled() {
103135
103130
  const v = (process.env.TALOS_HEADLESS_BROWSER ?? "").trim().toLowerCase();
@@ -103167,19 +103162,34 @@ async function launchHeadlessChromium() {
103167
103162
  return null;
103168
103163
  }
103169
103164
  }
103170
- var CJK_RE = /[\u2E80-\u2FFF\u3000-\u303F\u3040-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\uFF00-\uFFEF]/;
103171
103165
  var _fontManifest;
103172
103166
  async function fontManifest() {
103173
103167
  if (_fontManifest !== void 0) return _fontManifest;
103174
103168
  const dir = process.env.TALOS_CJK_FONT_DIR || (0, import_node_path2.join)((0, import_node_path2.dirname)(process.argv[1]), "..", "assets", "fonts");
103175
103169
  const file = (0, import_node_path2.join)(dir, "fonts.json");
103170
+ let manifest;
103176
103171
  try {
103177
- _fontManifest = { dir, ...JSON.parse(await (0, import_promises2.readFile)(file, "utf8")) };
103178
- } catch {
103179
- _fontManifest = { dir, cjk: [], latin: [], cjkUnicodeRange: "" };
103172
+ manifest = JSON.parse(await (0, import_promises2.readFile)(file, "utf8"));
103173
+ } catch (error) {
103174
+ throw new Error(`Cannot load PDF font manifest ${file}: ${error.message}`);
103175
+ }
103176
+ if (!manifest || !Array.isArray(manifest.cjk) || !Array.isArray(manifest.latin) || typeof manifest.cjkUnicodeRange !== "string" || [...manifest.cjk, ...manifest.latin].some((entry) => !entry || typeof entry.file !== "string" || !Array.isArray(entry.families) || !entry.families.every((family) => typeof family === "string"))) {
103177
+ throw new Error(`Invalid PDF font manifest: ${file}`);
103180
103178
  }
103179
+ _fontManifest = { ...manifest, dir };
103181
103180
  return _fontManifest;
103182
103181
  }
103182
+ var _faceB64 = /* @__PURE__ */ new Map();
103183
+ async function faceBase64(path) {
103184
+ if (!_faceB64.has(path)) {
103185
+ const bytes = await (0, import_promises2.readFile)(path).catch((error) => {
103186
+ throw new Error(`Cannot load PDF font ${path}: ${error.message}`);
103187
+ });
103188
+ if (!bytes.length) throw new Error(`Empty PDF font: ${path}`);
103189
+ _faceB64.set(path, bytes.toString("base64"));
103190
+ }
103191
+ return _faceB64.get(path);
103192
+ }
103183
103193
  async function faceCss(entries, range2, doc) {
103184
103194
  const { dir } = await fontManifest();
103185
103195
  const rules = [];
@@ -103187,9 +103197,7 @@ async function faceCss(entries, range2, doc) {
103187
103197
  const families = doc ? (entry.families ?? []).filter((f) => doc.includes(f)) : entry.families ?? [];
103188
103198
  if (!families.length) continue;
103189
103199
  const path = (0, import_node_path2.join)(dir, entry.file);
103190
- if (!(0, import_node_fs2.existsSync)(path)) continue;
103191
- const b64 = (await (0, import_promises2.readFile)(path).catch(() => null))?.toString("base64");
103192
- if (!b64) continue;
103200
+ const b64 = await faceBase64(path);
103193
103201
  for (const family of families) {
103194
103202
  rules.push(
103195
103203
  `@font-face{font-family:'${family}';src:local('${family}'),url(data:font/woff2;base64,${b64}) format('woff2');${entry.weight ? `font-weight:${entry.weight};` : ""}${range2 ? `unicode-range:${range2};` : ""}font-display:swap}`
@@ -103198,38 +103206,36 @@ async function faceCss(entries, range2, doc) {
103198
103206
  }
103199
103207
  return rules.join("");
103200
103208
  }
103201
- var _cjkFontCss;
103209
+ var _faceCssBySet = /* @__PURE__ */ new Map();
103210
+ async function cachedFaceCss(group2, entries, range2, doc) {
103211
+ const named = (entries ?? []).flatMap((e) => (e.families ?? []).filter((f) => doc.includes(f)));
103212
+ const key = `${group2}|${named.join("|")}`;
103213
+ if (!_faceCssBySet.has(key)) _faceCssBySet.set(key, await faceCss(entries, range2, doc));
103214
+ return _faceCssBySet.get(key);
103215
+ }
103202
103216
  async function cjkFontFaceCss(doc) {
103203
- if (_cjkFontCss === void 0) {
103204
- const m = await fontManifest();
103205
- _cjkFontCss = await faceCss(m.cjk, m.cjkUnicodeRange, doc);
103206
- }
103207
- return _cjkFontCss;
103217
+ if (process.env.TALOS_CJK_FONTS === "system") return "";
103218
+ const m = await fontManifest();
103219
+ return cachedFaceCss("cjk", m.cjk, m.cjkUnicodeRange, doc);
103208
103220
  }
103209
- var _latinFontCss;
103210
103221
  async function latinFontFaceCss(doc) {
103211
- if (_latinFontCss === void 0) {
103212
- const m = await fontManifest();
103213
- const wanted = (m.latin ?? []).filter((e) => (e.families ?? []).some((f) => doc.includes(f)));
103214
- _latinFontCss = await faceCss(wanted, void 0);
103215
- }
103216
- return _latinFontCss;
103222
+ const m = await fontManifest();
103223
+ return cachedFaceCss("latin", m.latin, void 0, doc);
103217
103224
  }
103218
103225
  function injectStyle(html, css) {
103219
103226
  const tag = `<style>${css}</style>`;
103220
103227
  return html.includes("</head>") ? html.replace("</head>", `${tag}</head>`) : tag + html;
103221
103228
  }
103222
- async function renderPdfHeadless(html, print = {}) {
103229
+ async function renderPdfHeadless(html) {
103223
103230
  const browser2 = await launchHeadlessChromium();
103224
103231
  if (!browser2) return null;
103225
103232
  try {
103226
103233
  const page = await browser2.newPage();
103227
- const faces = (CJK_RE.test(html) ? await cjkFontFaceCss(html) : "") + await latinFontFaceCss(html);
103234
+ const faces = (CJK_TEXT_RE.test(html) ? await cjkFontFaceCss(html) : "") + await latinFontFaceCss(html);
103235
+ await page.emulateMedia({ media: "print" });
103228
103236
  await page.setContent(faces ? injectStyle(html, faces) : html, { waitUntil: "load" });
103229
- await page.evaluate("document.fonts && document.fonts.ready").catch(() => {
103230
- });
103231
- const hf = print.headerTemplate || print.footerTemplate ? { displayHeaderFooter: true, headerTemplate: print.headerTemplate || "<span></span>", footerTemplate: print.footerTemplate || "<span></span>" } : {};
103232
- return new Uint8Array(await page.pdf({ printBackground: true, preferCSSPageSize: true, ...hf }));
103237
+ await page.evaluate(pdfFontPreparationScript());
103238
+ return new Uint8Array(await page.pdf({ printBackground: true, preferCSSPageSize: true }));
103233
103239
  } finally {
103234
103240
  await browser2.close().catch(() => {
103235
103241
  });
@@ -103300,32 +103306,29 @@ async function renderViaSoffice(input, cachePath) {
103300
103306
  });
103301
103307
  return { bytes, cached: false };
103302
103308
  } catch (e) {
103303
- process.stderr.write(`doc-convert: LibreOffice failed (${e.message}); falling back to HTML render
103304
- `);
103305
- return null;
103309
+ return { failed: `LibreOffice failed (${e.message})` };
103306
103310
  }
103307
103311
  }
103308
103312
  async function renderViaOfficeService(input, raw) {
103309
103313
  const url = process.env.TALOS_OFFICE_URL;
103310
103314
  if (!url) return null;
103311
103315
  try {
103312
- return await convertViaOfficeService(raw, (0, import_node_path3.basename)(input), url, {
103316
+ return { bytes: await convertViaOfficeService(raw, (0, import_node_path3.basename)(input), url, {
103313
103317
  token: process.env.TALOS_OFFICE_TOKEN,
103314
103318
  timeoutMs: 12e4
103315
- });
103319
+ }) };
103316
103320
  } catch (e) {
103317
- process.stderr.write(`doc-convert: office service failed (${e.message}); falling back
103318
- `);
103319
- return null;
103321
+ return { failed: `office service failed (${e.message})` };
103320
103322
  }
103321
103323
  }
103322
103324
  async function main() {
103323
103325
  const args = process.argv.slice(2);
103326
+ const requireOffice = args.includes("--require-office");
103324
103327
  const cacheIdx = args.indexOf("--cache-dir");
103325
103328
  const cacheDir = cacheIdx >= 0 ? args[cacheIdx + 1] : process.env.TALOS_OFFICE_CACHE_DIR;
103326
- const consumed = /* @__PURE__ */ new Set([cacheIdx, cacheIdx >= 0 ? cacheIdx + 1 : -1]);
103329
+ const consumed = /* @__PURE__ */ new Set([cacheIdx, cacheIdx >= 0 ? cacheIdx + 1 : -1, args.indexOf("--require-office")]);
103327
103330
  const [input, out] = args.filter((_4, i) => !consumed.has(i));
103328
- if (!input || !out) die("usage: doc-convert <in.docx|pptx|xlsx> <out.pdf> [--cache-dir <dir>]", 64);
103331
+ if (!input || !out) die("usage: doc-convert <in.docx|pptx|xlsx> <out.pdf> [--cache-dir <dir>] [--require-office]", 64);
103329
103332
  if (cacheIdx >= 0 && !cacheDir) die("--cache-dir requires a directory", 64);
103330
103333
  if (!/\.pdf$/i.test(out)) die("output must be a .pdf path", 64);
103331
103334
  let raw;
@@ -103336,20 +103339,33 @@ async function main() {
103336
103339
  }
103337
103340
  const buffer = raw.buffer.slice(raw.byteOffset, raw.byteOffset + raw.byteLength);
103338
103341
  const cachePath = await faithfulCachePath(cacheDir, input, raw).catch((e) => die(`cannot prepare cache: ${e.message}`, 73));
103342
+ const failures = [];
103339
103343
  const loResult = await renderViaSoffice(input, cachePath);
103340
- if (loResult) {
103344
+ if (loResult?.bytes) {
103341
103345
  await (0, import_promises3.writeFile)(out, Buffer.from(loResult.bytes));
103342
103346
  process.stdout.write(`wrote ${out} [pdf (libreoffice${loResult.cached ? ", cache hit" : ""})]
103343
103347
  `);
103344
103348
  return;
103345
103349
  }
103346
- const svcBytes = await renderViaOfficeService(input, raw);
103347
- if (svcBytes) {
103348
- await (0, import_promises3.writeFile)(out, Buffer.from(svcBytes));
103350
+ if (loResult?.failed) failures.push(loResult.failed);
103351
+ const svc = await renderViaOfficeService(input, raw);
103352
+ if (svc?.bytes) {
103353
+ await (0, import_promises3.writeFile)(out, Buffer.from(svc.bytes));
103349
103354
  process.stdout.write(`wrote ${out} [pdf (libreoffice service)]
103350
103355
  `);
103351
103356
  return;
103352
103357
  }
103358
+ if (svc?.failed) failures.push(svc.failed);
103359
+ if (requireOffice || /\.pptx$/i.test(input)) {
103360
+ const requirement = requireOffice ? "--require-office" : "PPTX to PDF requires Office";
103361
+ if (failures.length) {
103362
+ const policy = requireOffice ? "--require-office does not fall back" : "PPTX to PDF requires Office and cannot fall back";
103363
+ die(`${failures.join("; ")} \u2014 ${policy} to a Chromium reconstruction (its layout is not Office's); retry, a timeout under load is the usual cause`, 75);
103364
+ }
103365
+ die(`${requirement}: no LibreOffice engine here (no local soffice, TALOS_OFFICE_URL unset) \u2014 only a Chromium reconstruction is available, which is not an Office render`, 69);
103366
+ }
103367
+ for (const f of failures) process.stderr.write(`doc-convert: ${f}; falling back to HTML render
103368
+ `);
103353
103369
  if (/\.(xlsx|xls|ods)$/i.test(input)) {
103354
103370
  die("xlsx\u2192PDF \u9700\u8981\u672C\u673A LibreOffice \u6216 TALOS_OFFICE_URL sidecar,\u5F53\u524D\u90FD\u4E0D\u53EF\u7528", 69);
103355
103371
  }