@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
@@ -4320,7 +4320,7 @@ var require_BufferList = __commonJS({
4320
4320
  this.head = this.tail = null;
4321
4321
  this.length = 0;
4322
4322
  };
4323
- BufferList.prototype.join = function join4(s) {
4323
+ BufferList.prototype.join = function join6(s) {
4324
4324
  if (this.length === 0) return "";
4325
4325
  var p = this.head;
4326
4326
  var ret2 = "" + p.data;
@@ -13795,9 +13795,9 @@ var require_load = __commonJS({
13795
13795
  var require_lib3 = __commonJS({
13796
13796
  "node_modules/jszip/lib/index.js"(exports2, module2) {
13797
13797
  "use strict";
13798
- function JSZip2() {
13799
- if (!(this instanceof JSZip2)) {
13800
- return new JSZip2();
13798
+ function JSZip4() {
13799
+ if (!(this instanceof JSZip4)) {
13800
+ return new JSZip4();
13801
13801
  }
13802
13802
  if (arguments.length) {
13803
13803
  throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");
@@ -13806,7 +13806,7 @@ var require_lib3 = __commonJS({
13806
13806
  this.comment = null;
13807
13807
  this.root = "";
13808
13808
  this.clone = function() {
13809
- var newObj = new JSZip2();
13809
+ var newObj = new JSZip4();
13810
13810
  for (var i in this) {
13811
13811
  if (typeof this[i] !== "function") {
13812
13812
  newObj[i] = this[i];
@@ -13815,16 +13815,16 @@ var require_lib3 = __commonJS({
13815
13815
  return newObj;
13816
13816
  };
13817
13817
  }
13818
- JSZip2.prototype = require_object();
13819
- JSZip2.prototype.loadAsync = require_load();
13820
- JSZip2.support = require_support();
13821
- JSZip2.defaults = require_defaults();
13822
- JSZip2.version = "3.10.1";
13823
- JSZip2.loadAsync = function(content, options) {
13824
- return new JSZip2().loadAsync(content, options);
13818
+ JSZip4.prototype = require_object();
13819
+ JSZip4.prototype.loadAsync = require_load();
13820
+ JSZip4.support = require_support();
13821
+ JSZip4.defaults = require_defaults();
13822
+ JSZip4.version = "3.10.1";
13823
+ JSZip4.loadAsync = function(content, options) {
13824
+ return new JSZip4().loadAsync(content, options);
13825
13825
  };
13826
- JSZip2.external = require_external();
13827
- module2.exports = JSZip2;
13826
+ JSZip4.external = require_external();
13827
+ module2.exports = JSZip4;
13828
13828
  }
13829
13829
  });
13830
13830
 
@@ -13959,7 +13959,7 @@ var require_buffer_list2 = __commonJS({
13959
13959
  }
13960
13960
  }, {
13961
13961
  key: "join",
13962
- value: function join4(s) {
13962
+ value: function join6(s) {
13963
13963
  if (this.length === 0) return "";
13964
13964
  var p = this.head;
13965
13965
  var ret2 = "" + p.data;
@@ -16738,7 +16738,7 @@ var require_browser_buffer_encode = __commonJS({
16738
16738
  var require_zip_stream = __commonJS({
16739
16739
  "node_modules/exceljs/lib/utils/zip-stream.js"(exports2, module2) {
16740
16740
  var events = require("events");
16741
- var JSZip2 = require_lib3();
16741
+ var JSZip4 = require_lib3();
16742
16742
  var StreamBuf = require_stream_buf();
16743
16743
  var { stringToBuffer } = require_browser_buffer_encode();
16744
16744
  var ZipWriter = class extends events.EventEmitter {
@@ -16751,7 +16751,7 @@ var require_zip_stream = __commonJS({
16751
16751
  },
16752
16752
  options
16753
16753
  );
16754
- this.zip = new JSZip2();
16754
+ this.zip = new JSZip4();
16755
16755
  this.stream = new StreamBuf();
16756
16756
  }
16757
16757
  append(data, options) {
@@ -28431,7 +28431,7 @@ var require_theme1 = __commonJS({
28431
28431
  var require_xlsx = __commonJS({
28432
28432
  "node_modules/exceljs/lib/xlsx/xlsx.js"(exports2, module2) {
28433
28433
  var fs = require("fs");
28434
- var JSZip2 = require_lib3();
28434
+ var JSZip4 = require_lib3();
28435
28435
  var { PassThrough } = require_readable2();
28436
28436
  var ZipStream = require_zip_stream();
28437
28437
  var StreamBuf = require_stream_buf();
@@ -28670,7 +28670,7 @@ var require_xlsx = __commonJS({
28670
28670
  tables: {},
28671
28671
  vmlDrawings: {}
28672
28672
  };
28673
- const zip = await JSZip2.loadAsync(buffer);
28673
+ const zip = await JSZip4.loadAsync(buffer);
28674
28674
  for (const entry of Object.values(zip.files)) {
28675
28675
  if (!entry.dir) {
28676
28676
  let entryName = entry.name;
@@ -36902,8 +36902,8 @@ var require_graceful_fs = __commonJS({
36902
36902
  fs2.createReadStream = createReadStream;
36903
36903
  fs2.createWriteStream = createWriteStream;
36904
36904
  var fs$readFile = fs2.readFile;
36905
- fs2.readFile = readFile3;
36906
- function readFile3(path, options, cb) {
36905
+ fs2.readFile = readFile4;
36906
+ function readFile4(path, options, cb) {
36907
36907
  if (typeof options === "function")
36908
36908
  cb = options, options = null;
36909
36909
  return go$readFile(path, options, cb);
@@ -41204,7 +41204,7 @@ var require_buffer_list3 = __commonJS({
41204
41204
  }
41205
41205
  }, {
41206
41206
  key: "join",
41207
- value: function join4(s) {
41207
+ value: function join6(s) {
41208
41208
  if (this.length === 0) return "";
41209
41209
  var p = this.head;
41210
41210
  var ret2 = "" + p.data;
@@ -44570,7 +44570,7 @@ var require_buffer_list4 = __commonJS({
44570
44570
  }
44571
44571
  }, {
44572
44572
  key: "join",
44573
- value: function join4(s) {
44573
+ value: function join6(s) {
44574
44574
  if (this.length === 0) return "";
44575
44575
  var p = this.head;
44576
44576
  var ret2 = "" + p.data;
@@ -47366,7 +47366,7 @@ var require_buffer_list5 = __commonJS({
47366
47366
  }
47367
47367
  }, {
47368
47368
  key: "join",
47369
- value: function join4(s) {
47369
+ value: function join6(s) {
47370
47370
  if (this.length === 0) return "";
47371
47371
  var p = this.head;
47372
47372
  var ret2 = "" + p.data;
@@ -50236,7 +50236,7 @@ var require_buffer_list6 = __commonJS({
50236
50236
  }
50237
50237
  }, {
50238
50238
  key: "join",
50239
- value: function join4(s) {
50239
+ value: function join6(s) {
50240
50240
  if (this.length === 0) return "";
50241
50241
  var p = this.head;
50242
50242
  var ret2 = "" + p.data;
@@ -53025,7 +53025,7 @@ var require_buffer_list7 = __commonJS({
53025
53025
  }
53026
53026
  }, {
53027
53027
  key: "join",
53028
- value: function join4(s) {
53028
+ value: function join6(s) {
53029
53029
  if (this.length === 0) return "";
53030
53030
  var p = this.head;
53031
53031
  var ret2 = "" + p.data;
@@ -56015,7 +56015,7 @@ var require_buffer_list8 = __commonJS({
56015
56015
  }
56016
56016
  }, {
56017
56017
  key: "join",
56018
- value: function join4(s) {
56018
+ value: function join6(s) {
56019
56019
  if (this.length === 0) return "";
56020
56020
  var p = this.head;
56021
56021
  var ret2 = "" + p.data;
@@ -66273,7 +66273,7 @@ var require_BufferList3 = __commonJS({
66273
66273
  this.head = this.tail = null;
66274
66274
  this.length = 0;
66275
66275
  };
66276
- BufferList.prototype.join = function join4(s) {
66276
+ BufferList.prototype.join = function join6(s) {
66277
66277
  if (this.length === 0) return "";
66278
66278
  var p = this.head;
66279
66279
  var ret2 = "" + p.data;
@@ -73638,31 +73638,31 @@ var require_unicode = __commonJS({
73638
73638
  if (byteOrderMark)
73639
73639
  encoded.push(239, 187, 191);
73640
73640
  for (var idx = 0, len = input.length; idx < len; ) {
73641
- var codePoint = input.codePointAt(idx);
73642
- if (codePoint < 128) {
73643
- var byte1 = codePoint & 127;
73641
+ var codePoint2 = input.codePointAt(idx);
73642
+ if (codePoint2 < 128) {
73643
+ var byte1 = codePoint2 & 127;
73644
73644
  encoded.push(byte1);
73645
73645
  idx += 1;
73646
- } else if (codePoint < 2048) {
73647
- var byte1 = codePoint >> 6 & 31 | 192;
73648
- var byte2 = codePoint & 63 | 128;
73646
+ } else if (codePoint2 < 2048) {
73647
+ var byte1 = codePoint2 >> 6 & 31 | 192;
73648
+ var byte2 = codePoint2 & 63 | 128;
73649
73649
  encoded.push(byte1, byte2);
73650
73650
  idx += 1;
73651
- } else if (codePoint < 65536) {
73652
- var byte1 = codePoint >> 12 & 15 | 224;
73653
- var byte2 = codePoint >> 6 & 63 | 128;
73654
- var byte3 = codePoint & 63 | 128;
73651
+ } else if (codePoint2 < 65536) {
73652
+ var byte1 = codePoint2 >> 12 & 15 | 224;
73653
+ var byte2 = codePoint2 >> 6 & 63 | 128;
73654
+ var byte3 = codePoint2 & 63 | 128;
73655
73655
  encoded.push(byte1, byte2, byte3);
73656
73656
  idx += 1;
73657
- } else if (codePoint < 1114112) {
73658
- var byte1 = codePoint >> 18 & 7 | 240;
73659
- var byte2 = codePoint >> 12 & 63 | 128;
73660
- var byte3 = codePoint >> 6 & 63 | 128;
73661
- var byte4 = codePoint >> 0 & 63 | 128;
73657
+ } else if (codePoint2 < 1114112) {
73658
+ var byte1 = codePoint2 >> 18 & 7 | 240;
73659
+ var byte2 = codePoint2 >> 12 & 63 | 128;
73660
+ var byte3 = codePoint2 >> 6 & 63 | 128;
73661
+ var byte4 = codePoint2 >> 0 & 63 | 128;
73662
73662
  encoded.push(byte1, byte2, byte3, byte4);
73663
73663
  idx += 2;
73664
73664
  } else
73665
- throw new Error("Invalid code point: 0x" + strings_1.toHexString(codePoint));
73665
+ throw new Error("Invalid code point: 0x" + strings_1.toHexString(codePoint2));
73666
73666
  }
73667
73667
  return new Uint8Array(encoded);
73668
73668
  };
@@ -73674,29 +73674,29 @@ var require_unicode = __commonJS({
73674
73674
  if (byteOrderMark)
73675
73675
  encoded.push(65279);
73676
73676
  for (var idx = 0, len = input.length; idx < len; ) {
73677
- var codePoint = input.codePointAt(idx);
73678
- if (codePoint < 65536) {
73679
- encoded.push(codePoint);
73677
+ var codePoint2 = input.codePointAt(idx);
73678
+ if (codePoint2 < 65536) {
73679
+ encoded.push(codePoint2);
73680
73680
  idx += 1;
73681
- } else if (codePoint < 1114112) {
73682
- encoded.push(exports2.highSurrogate(codePoint), exports2.lowSurrogate(codePoint));
73681
+ } else if (codePoint2 < 1114112) {
73682
+ encoded.push(exports2.highSurrogate(codePoint2), exports2.lowSurrogate(codePoint2));
73683
73683
  idx += 2;
73684
73684
  } else
73685
- throw new Error("Invalid code point: 0x" + strings_1.toHexString(codePoint));
73685
+ throw new Error("Invalid code point: 0x" + strings_1.toHexString(codePoint2));
73686
73686
  }
73687
73687
  return new Uint16Array(encoded);
73688
73688
  };
73689
- exports2.isWithinBMP = function(codePoint) {
73690
- return codePoint >= 0 && codePoint <= 65535;
73689
+ exports2.isWithinBMP = function(codePoint2) {
73690
+ return codePoint2 >= 0 && codePoint2 <= 65535;
73691
73691
  };
73692
- exports2.hasSurrogates = function(codePoint) {
73693
- return codePoint >= 65536 && codePoint <= 1114111;
73692
+ exports2.hasSurrogates = function(codePoint2) {
73693
+ return codePoint2 >= 65536 && codePoint2 <= 1114111;
73694
73694
  };
73695
- exports2.highSurrogate = function(codePoint) {
73696
- return Math.floor((codePoint - 65536) / 1024) + 55296;
73695
+ exports2.highSurrogate = function(codePoint2) {
73696
+ return Math.floor((codePoint2 - 65536) / 1024) + 55296;
73697
73697
  };
73698
- exports2.lowSurrogate = function(codePoint) {
73699
- return (codePoint - 65536) % 1024 + 56320;
73698
+ exports2.lowSurrogate = function(codePoint2) {
73699
+ return (codePoint2 - 65536) % 1024 + 56320;
73700
73700
  };
73701
73701
  var ByteOrder;
73702
73702
  (function(ByteOrder2) {
@@ -73737,11 +73737,11 @@ var require_unicode = __commonJS({
73737
73737
  codePoints.push(REPLACEMENT);
73738
73738
  return String.fromCodePoint.apply(String, codePoints);
73739
73739
  };
73740
- var isHighSurrogate = function(codePoint) {
73741
- return codePoint >= 55296 && codePoint <= 56319;
73740
+ var isHighSurrogate = function(codePoint2) {
73741
+ return codePoint2 >= 55296 && codePoint2 <= 56319;
73742
73742
  };
73743
- var isLowSurrogate = function(codePoint) {
73744
- return codePoint >= 56320 && codePoint <= 57343;
73743
+ var isLowSurrogate = function(codePoint2) {
73744
+ return codePoint2 >= 56320 && codePoint2 <= 57343;
73745
73745
  };
73746
73746
  var decodeValues = function(first, second, byteOrder) {
73747
73747
  if (byteOrder === ByteOrder.LittleEndian)
@@ -74099,14 +74099,14 @@ var require_Encoding = __commonJS({
74099
74099
  /* @__PURE__ */ (function() {
74100
74100
  function Encoding2(name, unicodeMappings) {
74101
74101
  var _this = this;
74102
- this.canEncodeUnicodeCodePoint = function(codePoint) {
74103
- return codePoint in _this.unicodeMappings;
74102
+ this.canEncodeUnicodeCodePoint = function(codePoint2) {
74103
+ return codePoint2 in _this.unicodeMappings;
74104
74104
  };
74105
- this.encodeUnicodeCodePoint = function(codePoint) {
74106
- var mapped = _this.unicodeMappings[codePoint];
74105
+ this.encodeUnicodeCodePoint = function(codePoint2) {
74106
+ var mapped = _this.unicodeMappings[codePoint2];
74107
74107
  if (!mapped) {
74108
- var str = String.fromCharCode(codePoint);
74109
- var hexCode = "0x" + utils_1.padStart(codePoint.toString(16), 4, "0");
74108
+ var str = String.fromCharCode(codePoint2);
74109
+ var hexCode = "0x" + utils_1.padStart(codePoint2.toString(16), 4, "0");
74110
74110
  var msg = _this.name + ' cannot encode "' + str + '" (' + hexCode + ")";
74111
74111
  throw new Error(msg);
74112
74112
  }
@@ -77536,16 +77536,16 @@ var require_StandardFontEmbedder = __commonJS({
77536
77536
  var standard_fonts_1 = require_lib5();
77537
77537
  var PDFHexString_1 = tslib_1.__importDefault(require_PDFHexString());
77538
77538
  var utils_1 = require_utils5();
77539
- var StandardFontEmbedder = (
77539
+ var StandardFontEmbedder2 = (
77540
77540
  /** @class */
77541
77541
  (function() {
77542
- function StandardFontEmbedder2(fontName, customName) {
77542
+ function StandardFontEmbedder3(fontName, customName) {
77543
77543
  this.encoding = fontName === standard_fonts_1.FontNames.ZapfDingbats ? standard_fonts_1.Encodings.ZapfDingbats : fontName === standard_fonts_1.FontNames.Symbol ? standard_fonts_1.Encodings.Symbol : standard_fonts_1.Encodings.WinAnsi;
77544
77544
  this.font = standard_fonts_1.Font.load(fontName);
77545
77545
  this.fontName = this.font.FontName;
77546
77546
  this.customName = customName;
77547
77547
  }
77548
- StandardFontEmbedder2.prototype.encodeText = function(text) {
77548
+ StandardFontEmbedder3.prototype.encodeText = function(text) {
77549
77549
  var glyphs = this.encodeTextAsGlyphs(text);
77550
77550
  var hexCodes = new Array(glyphs.length);
77551
77551
  for (var idx = 0, len = glyphs.length; idx < len; idx++) {
@@ -77553,7 +77553,7 @@ var require_StandardFontEmbedder = __commonJS({
77553
77553
  }
77554
77554
  return PDFHexString_1.default.of(hexCodes.join(""));
77555
77555
  };
77556
- StandardFontEmbedder2.prototype.widthOfTextAtSize = function(text, size) {
77556
+ StandardFontEmbedder3.prototype.widthOfTextAtSize = function(text, size) {
77557
77557
  var glyphs = this.encodeTextAsGlyphs(text);
77558
77558
  var totalWidth = 0;
77559
77559
  for (var idx = 0, len = glyphs.length; idx < len; idx++) {
@@ -77565,7 +77565,7 @@ var require_StandardFontEmbedder = __commonJS({
77565
77565
  var scale = size / 1e3;
77566
77566
  return totalWidth * scale;
77567
77567
  };
77568
- StandardFontEmbedder2.prototype.heightOfFontAtSize = function(size, options) {
77568
+ StandardFontEmbedder3.prototype.heightOfFontAtSize = function(size, options) {
77569
77569
  if (options === void 0) {
77570
77570
  options = {};
77571
77571
  }
@@ -77578,13 +77578,13 @@ var require_StandardFontEmbedder = __commonJS({
77578
77578
  height += Descender || 0;
77579
77579
  return height / 1e3 * size;
77580
77580
  };
77581
- StandardFontEmbedder2.prototype.sizeOfFontAtHeight = function(height) {
77581
+ StandardFontEmbedder3.prototype.sizeOfFontAtHeight = function(height) {
77582
77582
  var _a = this.font, Ascender = _a.Ascender, Descender = _a.Descender, FontBBox = _a.FontBBox;
77583
77583
  var yTop = Ascender || FontBBox[3];
77584
77584
  var yBottom = Descender || FontBBox[1];
77585
77585
  return 1e3 * height / (yTop - yBottom);
77586
77586
  };
77587
- StandardFontEmbedder2.prototype.embedIntoContext = function(context, ref) {
77587
+ StandardFontEmbedder3.prototype.embedIntoContext = function(context, ref) {
77588
77588
  var fontDict = context.obj({
77589
77589
  Type: "Font",
77590
77590
  Subtype: "Type1",
@@ -77598,25 +77598,25 @@ var require_StandardFontEmbedder = __commonJS({
77598
77598
  return context.register(fontDict);
77599
77599
  }
77600
77600
  };
77601
- StandardFontEmbedder2.prototype.widthOfGlyph = function(glyphName) {
77601
+ StandardFontEmbedder3.prototype.widthOfGlyph = function(glyphName) {
77602
77602
  return this.font.getWidthOfGlyph(glyphName) || 250;
77603
77603
  };
77604
- StandardFontEmbedder2.prototype.encodeTextAsGlyphs = function(text) {
77604
+ StandardFontEmbedder3.prototype.encodeTextAsGlyphs = function(text) {
77605
77605
  var codePoints = Array.from(text);
77606
77606
  var glyphs = new Array(codePoints.length);
77607
77607
  for (var idx = 0, len = codePoints.length; idx < len; idx++) {
77608
- var codePoint = utils_1.toCodePoint(codePoints[idx]);
77609
- glyphs[idx] = this.encoding.encodeUnicodeCodePoint(codePoint);
77608
+ var codePoint2 = utils_1.toCodePoint(codePoints[idx]);
77609
+ glyphs[idx] = this.encoding.encodeUnicodeCodePoint(codePoint2);
77610
77610
  }
77611
77611
  return glyphs;
77612
77612
  };
77613
- StandardFontEmbedder2.for = function(fontName, customName) {
77614
- return new StandardFontEmbedder2(fontName, customName);
77613
+ StandardFontEmbedder3.for = function(fontName, customName) {
77614
+ return new StandardFontEmbedder3(fontName, customName);
77615
77615
  };
77616
- return StandardFontEmbedder2;
77616
+ return StandardFontEmbedder3;
77617
77617
  })()
77618
77618
  );
77619
- exports2.default = StandardFontEmbedder;
77619
+ exports2.default = StandardFontEmbedder2;
77620
77620
  }
77621
77621
  });
77622
77622
 
@@ -77640,8 +77640,8 @@ var require_CMap = __commonJS({
77640
77640
  };
77641
77641
  var fillCmapTemplate = function(bfChars) {
77642
77642
  return "/CIDInit /ProcSet findresource begin\n12 dict begin\nbegincmap\n/CIDSystemInfo <<\n /Registry (Adobe)\n /Ordering (UCS)\n /Supplement 0\n>> def\n/CMapName /Adobe-Identity-UCS def\n/CMapType 2 def\n1 begincodespacerange\n<0000><ffff>\nendcodespacerange\n" + bfChars.length + " beginbfchar\n" + bfChars.map(function(_a) {
77643
- var glyphId = _a[0], codePoint = _a[1];
77644
- return glyphId + " " + codePoint;
77643
+ var glyphId = _a[0], codePoint2 = _a[1];
77644
+ return glyphId + " " + codePoint2;
77645
77645
  }).join("\n") + "\nendbfchar\nendcmap\nCMapName currentdict /CMap defineresource pop\nend\nend";
77646
77646
  };
77647
77647
  var cmapHexFormat = function() {
@@ -77654,15 +77654,15 @@ var require_CMap = __commonJS({
77654
77654
  var cmapHexString = function(value) {
77655
77655
  return utils_1.toHexStringOfMinLength(value, 4);
77656
77656
  };
77657
- var cmapCodePointFormat = function(codePoint) {
77658
- if (unicode_1.isWithinBMP(codePoint))
77659
- return cmapHexString(codePoint);
77660
- if (unicode_1.hasSurrogates(codePoint)) {
77661
- var hs = unicode_1.highSurrogate(codePoint);
77662
- var ls = unicode_1.lowSurrogate(codePoint);
77657
+ var cmapCodePointFormat = function(codePoint2) {
77658
+ if (unicode_1.isWithinBMP(codePoint2))
77659
+ return cmapHexString(codePoint2);
77660
+ if (unicode_1.hasSurrogates(codePoint2)) {
77661
+ var hs = unicode_1.highSurrogate(codePoint2);
77662
+ var ls = unicode_1.lowSurrogate(codePoint2);
77663
77663
  return "" + cmapHexString(hs) + cmapHexString(ls);
77664
77664
  }
77665
- var hex = utils_1.toHexString(codePoint);
77665
+ var hex = utils_1.toHexString(codePoint2);
77666
77666
  var msg = "0x" + hex + " is not a valid UTF-8 or UTF-16 codepoint.";
77667
77667
  throw new Error(msg);
77668
77668
  };
@@ -77854,8 +77854,8 @@ var require_CustomFontEmbedder = __commonJS({
77854
77854
  this.allGlyphsInFontSortedById = function() {
77855
77855
  var glyphs = new Array(_this.font.characterSet.length);
77856
77856
  for (var idx = 0, len = glyphs.length; idx < len; idx++) {
77857
- var codePoint = _this.font.characterSet[idx];
77858
- glyphs[idx] = _this.font.glyphForCodePoint(codePoint);
77857
+ var codePoint2 = _this.font.characterSet[idx];
77858
+ glyphs[idx] = _this.font.glyphForCodePoint(codePoint2);
77859
77859
  }
77860
77860
  return utils_1.sortedUniq(glyphs.sort(utils_1.byAscendingId), function(g) {
77861
77861
  return g.id;
@@ -86129,20 +86129,20 @@ var require_errors11 = __commonJS({
86129
86129
  Object.defineProperty(exports2, "__esModule", { value: true });
86130
86130
  exports2.InvalidMaxLengthError = exports2.ExceededMaxLengthError = exports2.CombedTextLayoutError = exports2.RichTextFieldReadError = exports2.FieldExistsAsNonTerminalError = exports2.InvalidFieldNamePartError = exports2.FieldAlreadyExistsError = exports2.MissingOnValueCheckError = exports2.UnexpectedFieldTypeError = exports2.NoSuchFieldError = exports2.RemovePageFromEmptyDocumentError = exports2.ForeignPageError = exports2.FontkitNotRegisteredError = exports2.EncryptedPDFError = void 0;
86131
86131
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
86132
- var EncryptedPDFError = (
86132
+ var EncryptedPDFError2 = (
86133
86133
  /** @class */
86134
86134
  (function(_super) {
86135
- tslib_1.__extends(EncryptedPDFError2, _super);
86136
- function EncryptedPDFError2() {
86135
+ tslib_1.__extends(EncryptedPDFError3, _super);
86136
+ function EncryptedPDFError3() {
86137
86137
  var _this = this;
86138
86138
  var msg = "Input document to `PDFDocument.load` is encrypted. You can use `PDFDocument.load(..., { ignoreEncryption: true })` if you wish to load the document anyways.";
86139
86139
  _this = _super.call(this, msg) || this;
86140
86140
  return _this;
86141
86141
  }
86142
- return EncryptedPDFError2;
86142
+ return EncryptedPDFError3;
86143
86143
  })(Error)
86144
86144
  );
86145
- exports2.EncryptedPDFError = EncryptedPDFError;
86145
+ exports2.EncryptedPDFError = EncryptedPDFError2;
86146
86146
  var FontkitNotRegisteredError = (
86147
86147
  /** @class */
86148
86148
  (function(_super) {
@@ -88401,23 +88401,23 @@ var require_StandardFonts = __commonJS({
88401
88401
  "use strict";
88402
88402
  Object.defineProperty(exports2, "__esModule", { value: true });
88403
88403
  exports2.StandardFonts = void 0;
88404
- var StandardFonts;
88405
- (function(StandardFonts2) {
88406
- StandardFonts2["Courier"] = "Courier";
88407
- StandardFonts2["CourierBold"] = "Courier-Bold";
88408
- StandardFonts2["CourierOblique"] = "Courier-Oblique";
88409
- StandardFonts2["CourierBoldOblique"] = "Courier-BoldOblique";
88410
- StandardFonts2["Helvetica"] = "Helvetica";
88411
- StandardFonts2["HelveticaBold"] = "Helvetica-Bold";
88412
- StandardFonts2["HelveticaOblique"] = "Helvetica-Oblique";
88413
- StandardFonts2["HelveticaBoldOblique"] = "Helvetica-BoldOblique";
88414
- StandardFonts2["TimesRoman"] = "Times-Roman";
88415
- StandardFonts2["TimesRomanBold"] = "Times-Bold";
88416
- StandardFonts2["TimesRomanItalic"] = "Times-Italic";
88417
- StandardFonts2["TimesRomanBoldItalic"] = "Times-BoldItalic";
88418
- StandardFonts2["Symbol"] = "Symbol";
88419
- StandardFonts2["ZapfDingbats"] = "ZapfDingbats";
88420
- })(StandardFonts = exports2.StandardFonts || (exports2.StandardFonts = {}));
88404
+ var StandardFonts2;
88405
+ (function(StandardFonts3) {
88406
+ StandardFonts3["Courier"] = "Courier";
88407
+ StandardFonts3["CourierBold"] = "Courier-Bold";
88408
+ StandardFonts3["CourierOblique"] = "Courier-Oblique";
88409
+ StandardFonts3["CourierBoldOblique"] = "Courier-BoldOblique";
88410
+ StandardFonts3["Helvetica"] = "Helvetica";
88411
+ StandardFonts3["HelveticaBold"] = "Helvetica-Bold";
88412
+ StandardFonts3["HelveticaOblique"] = "Helvetica-Oblique";
88413
+ StandardFonts3["HelveticaBoldOblique"] = "Helvetica-BoldOblique";
88414
+ StandardFonts3["TimesRoman"] = "Times-Roman";
88415
+ StandardFonts3["TimesRomanBold"] = "Times-Bold";
88416
+ StandardFonts3["TimesRomanItalic"] = "Times-Italic";
88417
+ StandardFonts3["TimesRomanBoldItalic"] = "Times-BoldItalic";
88418
+ StandardFonts3["Symbol"] = "Symbol";
88419
+ StandardFonts3["ZapfDingbats"] = "ZapfDingbats";
88420
+ })(StandardFonts2 = exports2.StandardFonts || (exports2.StandardFonts = {}));
88421
88421
  }
88422
88422
  });
88423
88423
 
@@ -89071,10 +89071,10 @@ var require_PDFDocument = __commonJS({
89071
89071
  var PDFEmbeddedFile_1 = tslib_1.__importDefault(require_PDFEmbeddedFile());
89072
89072
  var PDFJavaScript_1 = tslib_1.__importDefault(require_PDFJavaScript());
89073
89073
  var JavaScriptEmbedder_1 = tslib_1.__importDefault(require_JavaScriptEmbedder());
89074
- var PDFDocument2 = (
89074
+ var PDFDocument3 = (
89075
89075
  /** @class */
89076
89076
  (function() {
89077
- function PDFDocument3(context, ignoreEncryption, updateMetadata) {
89077
+ function PDFDocument4(context, ignoreEncryption, updateMetadata) {
89078
89078
  var _this = this;
89079
89079
  this.defaultWordBreaks = [" "];
89080
89080
  this.computePages = function() {
@@ -89113,7 +89113,7 @@ var require_PDFDocument = __commonJS({
89113
89113
  if (updateMetadata)
89114
89114
  this.updateInfoDict();
89115
89115
  }
89116
- PDFDocument3.load = function(pdf, options) {
89116
+ PDFDocument4.load = function(pdf, options) {
89117
89117
  if (options === void 0) {
89118
89118
  options = {};
89119
89119
  }
@@ -89131,12 +89131,12 @@ var require_PDFDocument = __commonJS({
89131
89131
  return [4, core_1.PDFParser.forBytesWithOptions(bytes, parseSpeed, throwOnInvalidObject, capNumbers).parseDocument()];
89132
89132
  case 1:
89133
89133
  context = _f.sent();
89134
- return [2, new PDFDocument3(context, ignoreEncryption, updateMetadata)];
89134
+ return [2, new PDFDocument4(context, ignoreEncryption, updateMetadata)];
89135
89135
  }
89136
89136
  });
89137
89137
  });
89138
89138
  };
89139
- PDFDocument3.create = function(options) {
89139
+ PDFDocument4.create = function(options) {
89140
89140
  if (options === void 0) {
89141
89141
  options = {};
89142
89142
  }
@@ -89149,14 +89149,14 @@ var require_PDFDocument = __commonJS({
89149
89149
  pageTreeRef = context.register(pageTree);
89150
89150
  catalog = core_1.PDFCatalog.withContextAndPages(context, pageTreeRef);
89151
89151
  context.trailerInfo.Root = context.register(catalog);
89152
- return [2, new PDFDocument3(context, false, updateMetadata)];
89152
+ return [2, new PDFDocument4(context, false, updateMetadata)];
89153
89153
  });
89154
89154
  });
89155
89155
  };
89156
- PDFDocument3.prototype.registerFontkit = function(fontkit) {
89156
+ PDFDocument4.prototype.registerFontkit = function(fontkit) {
89157
89157
  this.fontkit = fontkit;
89158
89158
  };
89159
- PDFDocument3.prototype.getForm = function() {
89159
+ PDFDocument4.prototype.getForm = function() {
89160
89160
  var form = this.formCache.access();
89161
89161
  if (form.hasXFA()) {
89162
89162
  console.warn("Removing XFA form data as pdf-lib does not support reading or writing XFA");
@@ -89164,63 +89164,63 @@ var require_PDFDocument = __commonJS({
89164
89164
  }
89165
89165
  return form;
89166
89166
  };
89167
- PDFDocument3.prototype.getTitle = function() {
89167
+ PDFDocument4.prototype.getTitle = function() {
89168
89168
  var title = this.getInfoDict().lookup(core_1.PDFName.Title);
89169
89169
  if (!title)
89170
89170
  return void 0;
89171
89171
  assertIsLiteralOrHexString(title);
89172
89172
  return title.decodeText();
89173
89173
  };
89174
- PDFDocument3.prototype.getAuthor = function() {
89174
+ PDFDocument4.prototype.getAuthor = function() {
89175
89175
  var author = this.getInfoDict().lookup(core_1.PDFName.Author);
89176
89176
  if (!author)
89177
89177
  return void 0;
89178
89178
  assertIsLiteralOrHexString(author);
89179
89179
  return author.decodeText();
89180
89180
  };
89181
- PDFDocument3.prototype.getSubject = function() {
89181
+ PDFDocument4.prototype.getSubject = function() {
89182
89182
  var subject = this.getInfoDict().lookup(core_1.PDFName.Subject);
89183
89183
  if (!subject)
89184
89184
  return void 0;
89185
89185
  assertIsLiteralOrHexString(subject);
89186
89186
  return subject.decodeText();
89187
89187
  };
89188
- PDFDocument3.prototype.getKeywords = function() {
89188
+ PDFDocument4.prototype.getKeywords = function() {
89189
89189
  var keywords = this.getInfoDict().lookup(core_1.PDFName.Keywords);
89190
89190
  if (!keywords)
89191
89191
  return void 0;
89192
89192
  assertIsLiteralOrHexString(keywords);
89193
89193
  return keywords.decodeText();
89194
89194
  };
89195
- PDFDocument3.prototype.getCreator = function() {
89195
+ PDFDocument4.prototype.getCreator = function() {
89196
89196
  var creator = this.getInfoDict().lookup(core_1.PDFName.Creator);
89197
89197
  if (!creator)
89198
89198
  return void 0;
89199
89199
  assertIsLiteralOrHexString(creator);
89200
89200
  return creator.decodeText();
89201
89201
  };
89202
- PDFDocument3.prototype.getProducer = function() {
89202
+ PDFDocument4.prototype.getProducer = function() {
89203
89203
  var producer = this.getInfoDict().lookup(core_1.PDFName.Producer);
89204
89204
  if (!producer)
89205
89205
  return void 0;
89206
89206
  assertIsLiteralOrHexString(producer);
89207
89207
  return producer.decodeText();
89208
89208
  };
89209
- PDFDocument3.prototype.getCreationDate = function() {
89209
+ PDFDocument4.prototype.getCreationDate = function() {
89210
89210
  var creationDate = this.getInfoDict().lookup(core_1.PDFName.CreationDate);
89211
89211
  if (!creationDate)
89212
89212
  return void 0;
89213
89213
  assertIsLiteralOrHexString(creationDate);
89214
89214
  return creationDate.decodeDate();
89215
89215
  };
89216
- PDFDocument3.prototype.getModificationDate = function() {
89216
+ PDFDocument4.prototype.getModificationDate = function() {
89217
89217
  var modificationDate = this.getInfoDict().lookup(core_1.PDFName.ModDate);
89218
89218
  if (!modificationDate)
89219
89219
  return void 0;
89220
89220
  assertIsLiteralOrHexString(modificationDate);
89221
89221
  return modificationDate.decodeDate();
89222
89222
  };
89223
- PDFDocument3.prototype.setTitle = function(title, options) {
89223
+ PDFDocument4.prototype.setTitle = function(title, options) {
89224
89224
  utils_1.assertIs(title, "title", ["string"]);
89225
89225
  var key = core_1.PDFName.of("Title");
89226
89226
  this.getInfoDict().set(key, core_1.PDFHexString.fromText(title));
@@ -89229,63 +89229,63 @@ var require_PDFDocument = __commonJS({
89229
89229
  prefs.setDisplayDocTitle(true);
89230
89230
  }
89231
89231
  };
89232
- PDFDocument3.prototype.setAuthor = function(author) {
89232
+ PDFDocument4.prototype.setAuthor = function(author) {
89233
89233
  utils_1.assertIs(author, "author", ["string"]);
89234
89234
  var key = core_1.PDFName.of("Author");
89235
89235
  this.getInfoDict().set(key, core_1.PDFHexString.fromText(author));
89236
89236
  };
89237
- PDFDocument3.prototype.setSubject = function(subject) {
89237
+ PDFDocument4.prototype.setSubject = function(subject) {
89238
89238
  utils_1.assertIs(subject, "author", ["string"]);
89239
89239
  var key = core_1.PDFName.of("Subject");
89240
89240
  this.getInfoDict().set(key, core_1.PDFHexString.fromText(subject));
89241
89241
  };
89242
- PDFDocument3.prototype.setKeywords = function(keywords) {
89242
+ PDFDocument4.prototype.setKeywords = function(keywords) {
89243
89243
  utils_1.assertIs(keywords, "keywords", [Array]);
89244
89244
  var key = core_1.PDFName.of("Keywords");
89245
89245
  this.getInfoDict().set(key, core_1.PDFHexString.fromText(keywords.join(" ")));
89246
89246
  };
89247
- PDFDocument3.prototype.setCreator = function(creator) {
89247
+ PDFDocument4.prototype.setCreator = function(creator) {
89248
89248
  utils_1.assertIs(creator, "creator", ["string"]);
89249
89249
  var key = core_1.PDFName.of("Creator");
89250
89250
  this.getInfoDict().set(key, core_1.PDFHexString.fromText(creator));
89251
89251
  };
89252
- PDFDocument3.prototype.setProducer = function(producer) {
89252
+ PDFDocument4.prototype.setProducer = function(producer) {
89253
89253
  utils_1.assertIs(producer, "creator", ["string"]);
89254
89254
  var key = core_1.PDFName.of("Producer");
89255
89255
  this.getInfoDict().set(key, core_1.PDFHexString.fromText(producer));
89256
89256
  };
89257
- PDFDocument3.prototype.setLanguage = function(language) {
89257
+ PDFDocument4.prototype.setLanguage = function(language) {
89258
89258
  utils_1.assertIs(language, "language", ["string"]);
89259
89259
  var key = core_1.PDFName.of("Lang");
89260
89260
  this.catalog.set(key, core_1.PDFString.of(language));
89261
89261
  };
89262
- PDFDocument3.prototype.setCreationDate = function(creationDate) {
89262
+ PDFDocument4.prototype.setCreationDate = function(creationDate) {
89263
89263
  utils_1.assertIs(creationDate, "creationDate", [[Date, "Date"]]);
89264
89264
  var key = core_1.PDFName.of("CreationDate");
89265
89265
  this.getInfoDict().set(key, core_1.PDFString.fromDate(creationDate));
89266
89266
  };
89267
- PDFDocument3.prototype.setModificationDate = function(modificationDate) {
89267
+ PDFDocument4.prototype.setModificationDate = function(modificationDate) {
89268
89268
  utils_1.assertIs(modificationDate, "modificationDate", [[Date, "Date"]]);
89269
89269
  var key = core_1.PDFName.of("ModDate");
89270
89270
  this.getInfoDict().set(key, core_1.PDFString.fromDate(modificationDate));
89271
89271
  };
89272
- PDFDocument3.prototype.getPageCount = function() {
89272
+ PDFDocument4.prototype.getPageCount = function() {
89273
89273
  if (this.pageCount === void 0)
89274
89274
  this.pageCount = this.getPages().length;
89275
89275
  return this.pageCount;
89276
89276
  };
89277
- PDFDocument3.prototype.getPages = function() {
89277
+ PDFDocument4.prototype.getPages = function() {
89278
89278
  return this.pageCache.access();
89279
89279
  };
89280
- PDFDocument3.prototype.getPage = function(index) {
89280
+ PDFDocument4.prototype.getPage = function(index) {
89281
89281
  var pages = this.getPages();
89282
89282
  utils_1.assertRange(index, "index", 0, pages.length - 1);
89283
89283
  return pages[index];
89284
89284
  };
89285
- PDFDocument3.prototype.getPageIndices = function() {
89285
+ PDFDocument4.prototype.getPageIndices = function() {
89286
89286
  return utils_1.range(0, this.getPageCount());
89287
89287
  };
89288
- PDFDocument3.prototype.removePage = function(index) {
89288
+ PDFDocument4.prototype.removePage = function(index) {
89289
89289
  var pageCount = this.getPageCount();
89290
89290
  if (this.pageCount === 0)
89291
89291
  throw new errors_1.RemovePageFromEmptyDocumentError();
@@ -89293,11 +89293,11 @@ var require_PDFDocument = __commonJS({
89293
89293
  this.catalog.removeLeafNode(index);
89294
89294
  this.pageCount = pageCount - 1;
89295
89295
  };
89296
- PDFDocument3.prototype.addPage = function(page) {
89296
+ PDFDocument4.prototype.addPage = function(page) {
89297
89297
  utils_1.assertIs(page, "page", ["undefined", [PDFPage_1.default, "PDFPage"], Array]);
89298
89298
  return this.insertPage(this.getPageCount(), page);
89299
89299
  };
89300
- PDFDocument3.prototype.insertPage = function(index, page) {
89300
+ PDFDocument4.prototype.insertPage = function(index, page) {
89301
89301
  var pageCount = this.getPageCount();
89302
89302
  utils_1.assertRange(index, "index", 0, pageCount);
89303
89303
  utils_1.assertIs(page, "page", ["undefined", [PDFPage_1.default, "PDFPage"], Array]);
@@ -89315,13 +89315,13 @@ var require_PDFDocument = __commonJS({
89315
89315
  this.pageCount = pageCount + 1;
89316
89316
  return page;
89317
89317
  };
89318
- PDFDocument3.prototype.copyPages = function(srcDoc, indices) {
89318
+ PDFDocument4.prototype.copyPages = function(srcDoc, indices) {
89319
89319
  return tslib_1.__awaiter(this, void 0, void 0, function() {
89320
89320
  var copier, srcPages, copiedPages, idx, len, srcPage, copiedPage, ref;
89321
89321
  return tslib_1.__generator(this, function(_a) {
89322
89322
  switch (_a.label) {
89323
89323
  case 0:
89324
- utils_1.assertIs(srcDoc, "srcDoc", [[PDFDocument3, "PDFDocument"]]);
89324
+ utils_1.assertIs(srcDoc, "srcDoc", [[PDFDocument4, "PDFDocument"]]);
89325
89325
  utils_1.assertIs(indices, "indices", [Array]);
89326
89326
  return [4, srcDoc.flush()];
89327
89327
  case 1:
@@ -89340,13 +89340,13 @@ var require_PDFDocument = __commonJS({
89340
89340
  });
89341
89341
  });
89342
89342
  };
89343
- PDFDocument3.prototype.copy = function() {
89343
+ PDFDocument4.prototype.copy = function() {
89344
89344
  return tslib_1.__awaiter(this, void 0, void 0, function() {
89345
89345
  var pdfCopy, contentPages, idx, len;
89346
89346
  return tslib_1.__generator(this, function(_a) {
89347
89347
  switch (_a.label) {
89348
89348
  case 0:
89349
- return [4, PDFDocument3.create()];
89349
+ return [4, PDFDocument4.create()];
89350
89350
  case 1:
89351
89351
  pdfCopy = _a.sent();
89352
89352
  return [4, pdfCopy.copyPages(this, this.getPageIndices())];
@@ -89382,7 +89382,7 @@ var require_PDFDocument = __commonJS({
89382
89382
  });
89383
89383
  });
89384
89384
  };
89385
- PDFDocument3.prototype.addJavaScript = function(name, script) {
89385
+ PDFDocument4.prototype.addJavaScript = function(name, script) {
89386
89386
  utils_1.assertIs(name, "name", ["string"]);
89387
89387
  utils_1.assertIs(script, "script", ["string"]);
89388
89388
  var embedder = JavaScriptEmbedder_1.default.for(script, name);
@@ -89390,7 +89390,7 @@ var require_PDFDocument = __commonJS({
89390
89390
  var javaScript = PDFJavaScript_1.default.of(ref, this, embedder);
89391
89391
  this.javaScripts.push(javaScript);
89392
89392
  };
89393
- PDFDocument3.prototype.attach = function(attachment, name, options) {
89393
+ PDFDocument4.prototype.attach = function(attachment, name, options) {
89394
89394
  if (options === void 0) {
89395
89395
  options = {};
89396
89396
  }
@@ -89418,7 +89418,7 @@ var require_PDFDocument = __commonJS({
89418
89418
  });
89419
89419
  });
89420
89420
  };
89421
- PDFDocument3.prototype.embedFont = function(font, options) {
89421
+ PDFDocument4.prototype.embedFont = function(font, options) {
89422
89422
  if (options === void 0) {
89423
89423
  options = {};
89424
89424
  }
@@ -89461,7 +89461,7 @@ var require_PDFDocument = __commonJS({
89461
89461
  });
89462
89462
  });
89463
89463
  };
89464
- PDFDocument3.prototype.embedStandardFont = function(font, customName) {
89464
+ PDFDocument4.prototype.embedStandardFont = function(font, customName) {
89465
89465
  utils_1.assertIs(font, "font", ["string"]);
89466
89466
  if (!utils_1.isStandardFont(font)) {
89467
89467
  throw new TypeError("`font` must be one of type `StandardFonts`");
@@ -89472,7 +89472,7 @@ var require_PDFDocument = __commonJS({
89472
89472
  this.fonts.push(pdfFont);
89473
89473
  return pdfFont;
89474
89474
  };
89475
- PDFDocument3.prototype.embedJpg = function(jpg) {
89475
+ PDFDocument4.prototype.embedJpg = function(jpg) {
89476
89476
  return tslib_1.__awaiter(this, void 0, void 0, function() {
89477
89477
  var bytes, embedder, ref, pdfImage;
89478
89478
  return tslib_1.__generator(this, function(_a) {
@@ -89491,7 +89491,7 @@ var require_PDFDocument = __commonJS({
89491
89491
  });
89492
89492
  });
89493
89493
  };
89494
- PDFDocument3.prototype.embedPng = function(png) {
89494
+ PDFDocument4.prototype.embedPng = function(png) {
89495
89495
  return tslib_1.__awaiter(this, void 0, void 0, function() {
89496
89496
  var bytes, embedder, ref, pdfImage;
89497
89497
  return tslib_1.__generator(this, function(_a) {
@@ -89510,7 +89510,7 @@ var require_PDFDocument = __commonJS({
89510
89510
  });
89511
89511
  });
89512
89512
  };
89513
- PDFDocument3.prototype.embedPdf = function(pdf, indices) {
89513
+ PDFDocument4.prototype.embedPdf = function(pdf, indices) {
89514
89514
  if (indices === void 0) {
89515
89515
  indices = [0];
89516
89516
  }
@@ -89523,14 +89523,14 @@ var require_PDFDocument = __commonJS({
89523
89523
  "string",
89524
89524
  Uint8Array,
89525
89525
  ArrayBuffer,
89526
- [PDFDocument3, "PDFDocument"]
89526
+ [PDFDocument4, "PDFDocument"]
89527
89527
  ]);
89528
89528
  utils_1.assertIs(indices, "indices", [Array]);
89529
- if (!(pdf instanceof PDFDocument3)) return [3, 1];
89529
+ if (!(pdf instanceof PDFDocument4)) return [3, 1];
89530
89530
  _a = pdf;
89531
89531
  return [3, 3];
89532
89532
  case 1:
89533
- return [4, PDFDocument3.load(pdf)];
89533
+ return [4, PDFDocument4.load(pdf)];
89534
89534
  case 2:
89535
89535
  _a = _b.sent();
89536
89536
  _b.label = 3;
@@ -89542,7 +89542,7 @@ var require_PDFDocument = __commonJS({
89542
89542
  });
89543
89543
  });
89544
89544
  };
89545
- PDFDocument3.prototype.embedPage = function(page, boundingBox, transformationMatrix) {
89545
+ PDFDocument4.prototype.embedPage = function(page, boundingBox, transformationMatrix) {
89546
89546
  return tslib_1.__awaiter(this, void 0, void 0, function() {
89547
89547
  var embeddedPage;
89548
89548
  return tslib_1.__generator(this, function(_a) {
@@ -89557,7 +89557,7 @@ var require_PDFDocument = __commonJS({
89557
89557
  });
89558
89558
  });
89559
89559
  };
89560
- PDFDocument3.prototype.embedPages = function(pages, boundingBoxes, transformationMatrices) {
89560
+ PDFDocument4.prototype.embedPages = function(pages, boundingBoxes, transformationMatrices) {
89561
89561
  if (boundingBoxes === void 0) {
89562
89562
  boundingBoxes = [];
89563
89563
  }
@@ -89607,7 +89607,7 @@ var require_PDFDocument = __commonJS({
89607
89607
  });
89608
89608
  });
89609
89609
  };
89610
- PDFDocument3.prototype.flush = function() {
89610
+ PDFDocument4.prototype.flush = function() {
89611
89611
  return tslib_1.__awaiter(this, void 0, void 0, function() {
89612
89612
  return tslib_1.__generator(this, function(_a) {
89613
89613
  switch (_a.label) {
@@ -89635,7 +89635,7 @@ var require_PDFDocument = __commonJS({
89635
89635
  });
89636
89636
  });
89637
89637
  };
89638
- PDFDocument3.prototype.save = function(options) {
89638
+ PDFDocument4.prototype.save = function(options) {
89639
89639
  if (options === void 0) {
89640
89640
  options = {};
89641
89641
  }
@@ -89665,7 +89665,7 @@ var require_PDFDocument = __commonJS({
89665
89665
  });
89666
89666
  });
89667
89667
  };
89668
- PDFDocument3.prototype.saveAsBase64 = function(options) {
89668
+ PDFDocument4.prototype.saveAsBase64 = function(options) {
89669
89669
  if (options === void 0) {
89670
89670
  options = {};
89671
89671
  }
@@ -89685,7 +89685,7 @@ var require_PDFDocument = __commonJS({
89685
89685
  });
89686
89686
  });
89687
89687
  };
89688
- PDFDocument3.prototype.findPageForAnnotationRef = function(ref) {
89688
+ PDFDocument4.prototype.findPageForAnnotationRef = function(ref) {
89689
89689
  var pages = this.getPages();
89690
89690
  for (var idx = 0, len = pages.length; idx < len; idx++) {
89691
89691
  var page = pages[idx];
@@ -89696,7 +89696,7 @@ var require_PDFDocument = __commonJS({
89696
89696
  }
89697
89697
  return void 0;
89698
89698
  };
89699
- PDFDocument3.prototype.embedAll = function(embeddables) {
89699
+ PDFDocument4.prototype.embedAll = function(embeddables) {
89700
89700
  return tslib_1.__awaiter(this, void 0, void 0, function() {
89701
89701
  var idx, len;
89702
89702
  return tslib_1.__generator(this, function(_a) {
@@ -89722,7 +89722,7 @@ var require_PDFDocument = __commonJS({
89722
89722
  });
89723
89723
  });
89724
89724
  };
89725
- PDFDocument3.prototype.updateInfoDict = function() {
89725
+ PDFDocument4.prototype.updateInfoDict = function() {
89726
89726
  var pdfLib = "pdf-lib (https://github.com/Hopding/pdf-lib)";
89727
89727
  var now = /* @__PURE__ */ new Date();
89728
89728
  var info = this.getInfoDict();
@@ -89733,7 +89733,7 @@ var require_PDFDocument = __commonJS({
89733
89733
  if (!info.get(core_1.PDFName.of("CreationDate")))
89734
89734
  this.setCreationDate(now);
89735
89735
  };
89736
- PDFDocument3.prototype.getInfoDict = function() {
89736
+ PDFDocument4.prototype.getInfoDict = function() {
89737
89737
  var existingInfo = this.context.lookup(this.context.trailerInfo.Info);
89738
89738
  if (existingInfo instanceof core_1.PDFDict)
89739
89739
  return existingInfo;
@@ -89741,15 +89741,15 @@ var require_PDFDocument = __commonJS({
89741
89741
  this.context.trailerInfo.Info = this.context.register(newInfo);
89742
89742
  return newInfo;
89743
89743
  };
89744
- PDFDocument3.prototype.assertFontkit = function() {
89744
+ PDFDocument4.prototype.assertFontkit = function() {
89745
89745
  if (!this.fontkit)
89746
89746
  throw new errors_1.FontkitNotRegisteredError();
89747
89747
  return this.fontkit;
89748
89748
  };
89749
- return PDFDocument3;
89749
+ return PDFDocument4;
89750
89750
  })()
89751
89751
  );
89752
- exports2.default = PDFDocument2;
89752
+ exports2.default = PDFDocument3;
89753
89753
  function assertIsLiteralOrHexString(pdfObject) {
89754
89754
  if (!(pdfObject instanceof core_1.PDFHexString) && !(pdfObject instanceof core_1.PDFString)) {
89755
89755
  throw new core_1.UnexpectedObjectTypeError([core_1.PDFHexString, core_1.PDFString], pdfObject);
@@ -90687,8 +90687,404 @@ var require_cjs = __commonJS({
90687
90687
  }
90688
90688
  });
90689
90689
 
90690
+ // packages/core/dist/document/pdf-encrypted.js
90691
+ var ENCRYPTED_PDF_MESSAGE, OWNER_ONLY_PDF_MESSAGE, PdfEncryptedError;
90692
+ var init_pdf_encrypted = __esm({
90693
+ "packages/core/dist/document/pdf-encrypted.js"() {
90694
+ "use strict";
90695
+ ENCRYPTED_PDF_MESSAGE = "PDF is password-protected (encrypted); decrypt first: pdf-ops decrypt <in> <password> <out>";
90696
+ OWNER_ONLY_PDF_MESSAGE = 'PDF is encrypted with an owner password only (it opens without a password, but cannot be edited encrypted); remove the encryption first: pdf-ops decrypt <in> "" <out>';
90697
+ PdfEncryptedError = class extends Error {
90698
+ constructor() {
90699
+ super(ENCRYPTED_PDF_MESSAGE);
90700
+ this.name = "PdfEncryptedError";
90701
+ }
90702
+ };
90703
+ }
90704
+ });
90705
+
90706
+ // packages/core/dist/document/pdf-extract.js
90707
+ var pdf_extract_exports = {};
90708
+ __export(pdf_extract_exports, {
90709
+ analyzePdfDocument: () => analyzePdfDocument,
90710
+ countVectorOperators: () => countVectorOperators,
90711
+ decryptPdf: () => decryptPdf,
90712
+ encryptPdf: () => encryptPdf,
90713
+ extractPdfImages: () => extractPdfImages,
90714
+ extractPdfTables: () => extractPdfTables,
90715
+ extractPdfText: () => extractPdfText,
90716
+ extractPdfTextLines: () => extractPdfTextLines,
90717
+ pdfNeedsPassword: () => pdfNeedsPassword,
90718
+ pngPixels: () => pngPixels,
90719
+ renderPdfPages: () => renderPdfPages,
90720
+ scanPdfSignals: () => scanPdfSignals,
90721
+ textMathHint: () => textMathHint,
90722
+ textTableHint: () => textTableHint
90723
+ });
90724
+ function loadMupdf() {
90725
+ if (!_mupdf) {
90726
+ const deps = process.env.TALOS_SKILL_DEPS;
90727
+ const spec = deps ? (0, import_node_url.pathToFileURL)((0, import_node_path.join)(deps, "mupdf", "dist", "mupdf.js")).href : "mupdf";
90728
+ _mupdf = import(spec);
90729
+ }
90730
+ return _mupdf;
90731
+ }
90732
+ function textMathHint(text) {
90733
+ if (!text)
90734
+ return false;
90735
+ const hits = (text.match(MATH_CHARS) || []).length;
90736
+ return hits >= 3 || hits / Math.max(text.length, 1) > 0.02;
90737
+ }
90738
+ function textTableHint(text) {
90739
+ if (!text)
90740
+ return false;
90741
+ const gaps = (text.match(/ {2,}|\t/g) || []).length;
90742
+ return gaps >= 6;
90743
+ }
90744
+ async function openDoc(bytes) {
90745
+ const mupdf = await loadMupdf();
90746
+ const doc = mupdf.Document.openDocument(bytes, "application/pdf");
90747
+ if (doc.needsPassword())
90748
+ throw new PdfEncryptedError();
90749
+ if (doc.countPages() === 0) {
90750
+ throw new Error("PDF has no readable pages (corrupt, encrypted, or empty)");
90751
+ }
90752
+ return { mupdf, doc };
90753
+ }
90754
+ async function analyzePdfDocument(bytes, options = {}) {
90755
+ const wantText = options.text !== false;
90756
+ const wantSignals = options.signals === true;
90757
+ const { doc } = await openDoc(bytes);
90758
+ const pageCount = doc.countPages();
90759
+ const signals = [];
90760
+ let out = "";
90761
+ for (let i = 0; i < pageCount; i++) {
90762
+ const page = doc.loadPage(i);
90763
+ if (wantText) {
90764
+ out += `
90765
+ [page ${i + 1}]
90766
+ ${page.toStructuredText().asText()}`;
90767
+ }
90768
+ if (wantSignals) {
90769
+ signals.push(pageSignalsFrom(page, i + 1));
90770
+ }
90771
+ }
90772
+ return { text: wantText ? out.trim() : "", pageCount, signals };
90773
+ }
90774
+ async function extractPdfText(bytes) {
90775
+ const { text, pageCount } = await analyzePdfDocument(bytes, { text: true });
90776
+ return { text, pageCount };
90777
+ }
90778
+ function countVectorOperators(content) {
90779
+ let ops = 0;
90780
+ let curves = 0;
90781
+ let fills = 0;
90782
+ let i = 0;
90783
+ const n = content.length;
90784
+ while (i < n) {
90785
+ const ch = content[i];
90786
+ if (ch === "(") {
90787
+ let depth = 1;
90788
+ i++;
90789
+ while (i < n && depth > 0) {
90790
+ if (content[i] === "\\")
90791
+ i++;
90792
+ else if (content[i] === "(")
90793
+ depth++;
90794
+ else if (content[i] === ")")
90795
+ depth--;
90796
+ i++;
90797
+ }
90798
+ continue;
90799
+ }
90800
+ if (ch === "<" && content[i + 1] !== "<") {
90801
+ while (i < n && content[i] !== ">")
90802
+ i++;
90803
+ i++;
90804
+ continue;
90805
+ }
90806
+ if (ch === "I" && content[i + 1] === "D" && isDelimiter(content[i + 2])) {
90807
+ const end = content.indexOf("EI", i + 2);
90808
+ i = end === -1 ? n : end + 2;
90809
+ continue;
90810
+ }
90811
+ if (!isDelimiter(ch)) {
90812
+ const start = i;
90813
+ while (i < n && !isDelimiter(content[i]))
90814
+ i++;
90815
+ const token = content.slice(start, i);
90816
+ switch (token) {
90817
+ case "m":
90818
+ case "l":
90819
+ case "re":
90820
+ ops++;
90821
+ break;
90822
+ case "c":
90823
+ case "v":
90824
+ case "y":
90825
+ ops++;
90826
+ curves++;
90827
+ break;
90828
+ case "f":
90829
+ case "F":
90830
+ case "f*":
90831
+ fills++;
90832
+ break;
90833
+ case "B":
90834
+ case "B*":
90835
+ case "b":
90836
+ case "b*":
90837
+ fills++;
90838
+ break;
90839
+ default:
90840
+ break;
90841
+ }
90842
+ continue;
90843
+ }
90844
+ i++;
90845
+ }
90846
+ return { ops, curves, fills };
90847
+ }
90848
+ function isDelimiter(ch) {
90849
+ return ch === void 0 || ch === " " || ch === "\n" || ch === "\r" || ch === " " || ch === "\f" || ch === "\0" || ch === "[" || ch === "]" || ch === "/" || ch === "{" || ch === "}";
90850
+ }
90851
+ function pageContentStream(page) {
90852
+ try {
90853
+ const obj2 = page.getObject?.();
90854
+ const contents = obj2?.get?.("Contents");
90855
+ if (!contents)
90856
+ return "";
90857
+ const streams = contents.isArray?.() && contents.get ? Array.from({ length: contents.length ?? 0 }, (_2, i) => contents.get(i)) : [contents];
90858
+ let out = "";
90859
+ for (const stream of streams) {
90860
+ const buf = stream?.readStream?.();
90861
+ const bytes = buf?.asUint8Array?.();
90862
+ if (bytes)
90863
+ out += Buffer.from(bytes).toString("latin1");
90864
+ }
90865
+ return out;
90866
+ } catch {
90867
+ return "";
90868
+ }
90869
+ }
90870
+ function pageSignalsFrom(page, pageNumber) {
90871
+ const json = JSON.parse(page.toStructuredText("preserve-images").asJSON());
90872
+ const blocks = json.blocks ?? [];
90873
+ const text = blocks.flatMap((b) => (b.lines ?? []).map((l2) => l2.text ?? "")).join(" ");
90874
+ const [x0, y0, x1, y1] = page.getBounds();
90875
+ const pageArea = Math.max((x1 - x0) * (y1 - y0), 1);
90876
+ const imgArea = blocks.filter((b) => b.type === "image").reduce((a, b) => a + Math.max((b.bbox?.w ?? 0) * (b.bbox?.h ?? 0), 0), 0);
90877
+ const vector = countVectorOperators(pageContentStream(page));
90878
+ return {
90879
+ page: pageNumber,
90880
+ textChars: text.trim().length,
90881
+ imageCoverage: Math.min(imgArea / pageArea, 1),
90882
+ vectorOps: vector.ops,
90883
+ vectorCurves: vector.curves,
90884
+ vectorFills: vector.fills,
90885
+ mathHint: textMathHint(text),
90886
+ tableHint: textTableHint(text)
90887
+ };
90888
+ }
90889
+ async function scanPdfSignals(bytes) {
90890
+ const { signals } = await analyzePdfDocument(bytes, { text: false, signals: true });
90891
+ return signals;
90892
+ }
90893
+ function median(nums) {
90894
+ if (!nums.length)
90895
+ return 0;
90896
+ const s = [...nums].sort((a, b) => a - b);
90897
+ return s[Math.floor(s.length / 2)];
90898
+ }
90899
+ async function extractPdfTables(bytes, pageNum, minColumns = 2) {
90900
+ const { doc } = await openDoc(bytes);
90901
+ const total = doc.countPages();
90902
+ const from = pageNum ? pageNum : 1;
90903
+ const to = pageNum ? pageNum : total;
90904
+ const out = [];
90905
+ for (let p = from; p <= to; p++) {
90906
+ if (p < 1 || p > total)
90907
+ continue;
90908
+ const json = JSON.parse(doc.loadPage(p - 1).toStructuredText().asJSON());
90909
+ const cells = [];
90910
+ for (const b of json.blocks ?? []) {
90911
+ if (b.type === "image")
90912
+ continue;
90913
+ for (const l2 of b.lines ?? []) {
90914
+ const text = (l2.text ?? "").trim();
90915
+ if (!text)
90916
+ continue;
90917
+ cells.push({ text, x: l2.bbox?.x ?? 0, y: l2.bbox?.y ?? 0, h: l2.bbox?.h ?? 12 });
90918
+ }
90919
+ }
90920
+ if (cells.length < 2)
90921
+ continue;
90922
+ const medH = median(cells.map((c) => c.h)) || 12;
90923
+ const rowTol = Math.max(4, medH * 0.6);
90924
+ const colTol = Math.max(6, medH * 0.9);
90925
+ const byY = [...cells].sort((a, b) => a.y - b.y);
90926
+ const rowGroups = [];
90927
+ let rowRef = Number.NEGATIVE_INFINITY;
90928
+ for (const c of byY) {
90929
+ if (c.y - rowRef > rowTol) {
90930
+ rowGroups.push([]);
90931
+ rowRef = c.y;
90932
+ }
90933
+ rowGroups[rowGroups.length - 1].push(c);
90934
+ }
90935
+ const colRefs = [];
90936
+ for (const x of cells.map((c) => c.x).sort((a, b) => a - b)) {
90937
+ if (!colRefs.length || x - colRefs[colRefs.length - 1] > colTol)
90938
+ colRefs.push(x);
90939
+ }
90940
+ const colIndex = (x) => {
90941
+ let best = 0, bd = Infinity;
90942
+ colRefs.forEach((r, i) => {
90943
+ const d = Math.abs(x - r);
90944
+ if (d < bd) {
90945
+ bd = d;
90946
+ best = i;
90947
+ }
90948
+ });
90949
+ return best;
90950
+ };
90951
+ const rows = [];
90952
+ for (const group of rowGroups) {
90953
+ const arr = Array(colRefs.length).fill("");
90954
+ for (const c of group.sort((a, b) => a.x - b.x)) {
90955
+ const i = colIndex(c.x);
90956
+ arr[i] = arr[i] ? `${arr[i]} ${c.text}` : c.text;
90957
+ }
90958
+ if (arr.filter((v) => v).length >= minColumns)
90959
+ rows.push(arr);
90960
+ }
90961
+ if (rows.length)
90962
+ out.push({ page: p, rows });
90963
+ }
90964
+ return out;
90965
+ }
90966
+ async function extractPdfTextLines(bytes) {
90967
+ const { doc } = await openDoc(bytes);
90968
+ const out = [];
90969
+ for (let p = 1; p <= doc.countPages(); p++) {
90970
+ const page = doc.loadPage(p - 1);
90971
+ const [x0, y0, x1, y1] = page.getBounds();
90972
+ const json = JSON.parse(page.toStructuredText().asJSON());
90973
+ const lines = [];
90974
+ for (const b of json.blocks ?? []) {
90975
+ if (b.type === "image")
90976
+ continue;
90977
+ for (const l2 of b.lines ?? []) {
90978
+ const text = l2.text ?? "";
90979
+ if (!text.trim() || !l2.bbox)
90980
+ continue;
90981
+ lines.push({
90982
+ x: l2.bbox.x ?? 0,
90983
+ y: l2.bbox.y ?? 0,
90984
+ w: l2.bbox.w ?? 0,
90985
+ h: l2.bbox.h ?? 0,
90986
+ size: l2.font?.size ?? 12,
90987
+ text
90988
+ });
90989
+ }
90990
+ }
90991
+ out.push({ page: p, width: x1 - x0, height: y1 - y0, lines });
90992
+ }
90993
+ return out;
90994
+ }
90995
+ async function renderPdfPages(bytes, pages, scale = 2, maxEdge) {
90996
+ const { mupdf, doc } = await openDoc(bytes);
90997
+ const total = doc.countPages();
90998
+ const wanted = pages === "all" ? Array.from({ length: total }, (_2, i) => i + 1) : pages;
90999
+ const out = [];
91000
+ for (const p of wanted) {
91001
+ if (p < 1 || p > total)
91002
+ continue;
91003
+ const page = doc.loadPage(p - 1);
91004
+ const [x0, y0, x1, y1] = page.getBounds();
91005
+ const longest = Math.max(x1 - x0, y1 - y0);
91006
+ const s = maxEdge && longest > 0 ? Math.min(scale, maxEdge / longest) : scale;
91007
+ const pix = page.toPixmap(mupdf.Matrix.scale(s, s), mupdf.ColorSpace.DeviceRGB, false, true);
91008
+ out.push({ page: p, png: pix.asPNG() });
91009
+ }
91010
+ return out;
91011
+ }
91012
+ async function pngPixels(png) {
91013
+ const mupdf = await loadMupdf();
91014
+ const pix = new mupdf.Image(png).toPixmap();
91015
+ const width = pix.getWidth(), height = pix.getHeight();
91016
+ const channels = pix.getStride() / width;
91017
+ return { width, height, channels, data: pix.getPixels() };
91018
+ }
91019
+ async function extractPdfImages(bytes, pages) {
91020
+ const { doc } = await openDoc(bytes);
91021
+ const total = doc.countPages();
91022
+ const wanted = pages && pages.length ? pages : Array.from({ length: total }, (_2, i) => i + 1);
91023
+ const images = [];
91024
+ let skipped = 0;
91025
+ for (const p of wanted) {
91026
+ if (p < 1 || p > total)
91027
+ continue;
91028
+ const stext = doc.loadPage(p - 1).toStructuredText("preserve-images");
91029
+ let index = 0;
91030
+ stext.walk({
91031
+ onImageBlock(bbox, _matrix, image) {
91032
+ const slot = index++;
91033
+ try {
91034
+ const png = image.toPixmap().asPNG();
91035
+ images.push({
91036
+ page: p,
91037
+ index: slot,
91038
+ bbox: [bbox[0], bbox[1], bbox[2], bbox[3]],
91039
+ width: image.getWidth(),
91040
+ height: image.getHeight(),
91041
+ png
91042
+ });
91043
+ } catch {
91044
+ skipped++;
91045
+ }
91046
+ }
91047
+ });
91048
+ }
91049
+ return { images, skipped };
91050
+ }
91051
+ async function encryptPdf(bytes, userPassword, ownerPassword) {
91052
+ if (!userPassword)
91053
+ throw new Error("a non-empty user password is required");
91054
+ const { doc } = await openDoc(bytes);
91055
+ const opts = `encrypt=aes-256,user-password=${userPassword},owner-password=${ownerPassword || userPassword}`;
91056
+ return doc.saveToBuffer(opts).asUint8Array();
91057
+ }
91058
+ async function pdfNeedsPassword(bytes) {
91059
+ const mupdf = await loadMupdf();
91060
+ const doc = mupdf.Document.openDocument(bytes, "application/pdf");
91061
+ return doc.needsPassword();
91062
+ }
91063
+ async function decryptPdf(bytes, password) {
91064
+ const mupdf = await loadMupdf();
91065
+ const doc = mupdf.Document.openDocument(bytes, "application/pdf");
91066
+ if (doc.needsPassword()) {
91067
+ if (doc.authenticatePassword(password) === 0)
91068
+ throw new Error("wrong password");
91069
+ }
91070
+ if (doc.countPages() === 0)
91071
+ throw new Error("PDF has no readable pages (corrupt or empty)");
91072
+ return doc.saveToBuffer("encrypt=none").asUint8Array();
91073
+ }
91074
+ var import_node_path, import_node_url, _mupdf, MATH_CHARS;
91075
+ var init_pdf_extract = __esm({
91076
+ "packages/core/dist/document/pdf-extract.js"() {
91077
+ "use strict";
91078
+ import_node_path = require("node:path");
91079
+ import_node_url = require("node:url");
91080
+ init_pdf_encrypted();
91081
+ _mupdf = null;
91082
+ MATH_CHARS = /[=∑∫√≤≥≠±∞πθλμσΩ×÷∂∇→←↔∈∉⊂⊃∀∃]/g;
91083
+ }
91084
+ });
91085
+
90690
91086
  // apps/admin/data/skills.lib/document/bin-src/doc-gen.mjs
90691
- var import_promises2 = require("node:fs/promises");
91087
+ var import_promises3 = require("node:fs/promises");
90692
91088
 
90693
91089
  // node_modules/docx/dist/index.mjs
90694
91090
  var __create2 = Object.create;
@@ -92095,19 +92491,19 @@ var require_buffer = /* @__PURE__ */ __commonJSMin(((exports2) => {
92095
92491
  var i = start;
92096
92492
  while (i < end) {
92097
92493
  var firstByte = buf[i];
92098
- var codePoint = null;
92494
+ var codePoint2 = null;
92099
92495
  var bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
92100
92496
  if (i + bytesPerSequence <= end) {
92101
92497
  var secondByte, thirdByte, fourthByte, tempCodePoint;
92102
92498
  switch (bytesPerSequence) {
92103
92499
  case 1:
92104
- if (firstByte < 128) codePoint = firstByte;
92500
+ if (firstByte < 128) codePoint2 = firstByte;
92105
92501
  break;
92106
92502
  case 2:
92107
92503
  secondByte = buf[i + 1];
92108
92504
  if ((secondByte & 192) === 128) {
92109
92505
  tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
92110
- if (tempCodePoint > 127) codePoint = tempCodePoint;
92506
+ if (tempCodePoint > 127) codePoint2 = tempCodePoint;
92111
92507
  }
92112
92508
  break;
92113
92509
  case 3:
@@ -92115,7 +92511,7 @@ var require_buffer = /* @__PURE__ */ __commonJSMin(((exports2) => {
92115
92511
  thirdByte = buf[i + 2];
92116
92512
  if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
92117
92513
  tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
92118
- if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) codePoint = tempCodePoint;
92514
+ if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) codePoint2 = tempCodePoint;
92119
92515
  }
92120
92516
  break;
92121
92517
  case 4:
@@ -92124,19 +92520,19 @@ var require_buffer = /* @__PURE__ */ __commonJSMin(((exports2) => {
92124
92520
  fourthByte = buf[i + 3];
92125
92521
  if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
92126
92522
  tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
92127
- if (tempCodePoint > 65535 && tempCodePoint < 1114112) codePoint = tempCodePoint;
92523
+ if (tempCodePoint > 65535 && tempCodePoint < 1114112) codePoint2 = tempCodePoint;
92128
92524
  }
92129
92525
  }
92130
92526
  }
92131
- if (codePoint === null) {
92132
- codePoint = 65533;
92527
+ if (codePoint2 === null) {
92528
+ codePoint2 = 65533;
92133
92529
  bytesPerSequence = 1;
92134
- } else if (codePoint > 65535) {
92135
- codePoint -= 65536;
92136
- res.push(codePoint >>> 10 & 1023 | 55296);
92137
- codePoint = 56320 | codePoint & 1023;
92530
+ } else if (codePoint2 > 65535) {
92531
+ codePoint2 -= 65536;
92532
+ res.push(codePoint2 >>> 10 & 1023 | 55296);
92533
+ codePoint2 = 56320 | codePoint2 & 1023;
92138
92534
  }
92139
- res.push(codePoint);
92535
+ res.push(codePoint2);
92140
92536
  i += bytesPerSequence;
92141
92537
  }
92142
92538
  return decodeCodePointsArray(res);
@@ -92560,46 +92956,46 @@ var require_buffer = /* @__PURE__ */ __commonJSMin(((exports2) => {
92560
92956
  }
92561
92957
  function utf8ToBytes(string, units) {
92562
92958
  units = units || Infinity;
92563
- var codePoint;
92959
+ var codePoint2;
92564
92960
  var length = string.length;
92565
92961
  var leadSurrogate = null;
92566
92962
  var bytes = [];
92567
92963
  for (var i = 0; i < length; ++i) {
92568
- codePoint = string.charCodeAt(i);
92569
- if (codePoint > 55295 && codePoint < 57344) {
92964
+ codePoint2 = string.charCodeAt(i);
92965
+ if (codePoint2 > 55295 && codePoint2 < 57344) {
92570
92966
  if (!leadSurrogate) {
92571
- if (codePoint > 56319) {
92967
+ if (codePoint2 > 56319) {
92572
92968
  if ((units -= 3) > -1) bytes.push(239, 191, 189);
92573
92969
  continue;
92574
92970
  } else if (i + 1 === length) {
92575
92971
  if ((units -= 3) > -1) bytes.push(239, 191, 189);
92576
92972
  continue;
92577
92973
  }
92578
- leadSurrogate = codePoint;
92974
+ leadSurrogate = codePoint2;
92579
92975
  continue;
92580
92976
  }
92581
- if (codePoint < 56320) {
92977
+ if (codePoint2 < 56320) {
92582
92978
  if ((units -= 3) > -1) bytes.push(239, 191, 189);
92583
- leadSurrogate = codePoint;
92979
+ leadSurrogate = codePoint2;
92584
92980
  continue;
92585
92981
  }
92586
- codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
92982
+ codePoint2 = (leadSurrogate - 55296 << 10 | codePoint2 - 56320) + 65536;
92587
92983
  } else if (leadSurrogate) {
92588
92984
  if ((units -= 3) > -1) bytes.push(239, 191, 189);
92589
92985
  }
92590
92986
  leadSurrogate = null;
92591
- if (codePoint < 128) {
92987
+ if (codePoint2 < 128) {
92592
92988
  if ((units -= 1) < 0) break;
92593
- bytes.push(codePoint);
92594
- } else if (codePoint < 2048) {
92989
+ bytes.push(codePoint2);
92990
+ } else if (codePoint2 < 2048) {
92595
92991
  if ((units -= 2) < 0) break;
92596
- bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128);
92597
- } else if (codePoint < 65536) {
92992
+ bytes.push(codePoint2 >> 6 | 192, codePoint2 & 63 | 128);
92993
+ } else if (codePoint2 < 65536) {
92598
92994
  if ((units -= 3) < 0) break;
92599
- bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
92600
- } else if (codePoint < 1114112) {
92995
+ bytes.push(codePoint2 >> 12 | 224, codePoint2 >> 6 & 63 | 128, codePoint2 & 63 | 128);
92996
+ } else if (codePoint2 < 1114112) {
92601
92997
  if ((units -= 4) < 0) break;
92602
- bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
92998
+ bytes.push(codePoint2 >> 18 | 240, codePoint2 >> 12 & 63 | 128, codePoint2 >> 6 & 63 | 128, codePoint2 & 63 | 128);
92603
92999
  } else throw new Error("Invalid code point");
92604
93000
  }
92605
93001
  return bytes;
@@ -94311,7 +94707,7 @@ var require_buffer_list = /* @__PURE__ */ __commonJSMin(((exports2, module2) =>
94311
94707
  },
94312
94708
  {
94313
94709
  key: "join",
94314
- value: function join4(s) {
94710
+ value: function join6(s) {
94315
94711
  if (this.length === 0) return "";
94316
94712
  var p = this.head;
94317
94713
  var ret2 = "" + p.data;
@@ -97691,13 +98087,13 @@ var require_sax = /* @__PURE__ */ __commonJSMin(((exports2) => {
97691
98087
  if (!length) return "";
97692
98088
  var result = "";
97693
98089
  while (++index < length) {
97694
- var codePoint = Number(arguments[index]);
97695
- if (!isFinite(codePoint) || codePoint < 0 || codePoint > 1114111 || floor(codePoint) !== codePoint) throw RangeError("Invalid code point: " + codePoint);
97696
- if (codePoint <= 65535) codeUnits.push(codePoint);
98090
+ var codePoint2 = Number(arguments[index]);
98091
+ if (!isFinite(codePoint2) || codePoint2 < 0 || codePoint2 > 1114111 || floor(codePoint2) !== codePoint2) throw RangeError("Invalid code point: " + codePoint2);
98092
+ if (codePoint2 <= 65535) codeUnits.push(codePoint2);
97697
98093
  else {
97698
- codePoint -= 65536;
97699
- highSurrogate = (codePoint >> 10) + 55296;
97700
- lowSurrogate = codePoint % 1024 + 56320;
98094
+ codePoint2 -= 65536;
98095
+ highSurrogate = (codePoint2 >> 10) + 55296;
98096
+ lowSurrogate = codePoint2 % 1024 + 56320;
97701
98097
  codeUnits.push(highSurrogate, lowSurrogate);
97702
98098
  }
97703
98099
  if (index + 1 === length || codeUnits.length > MAX_SIZE) {
@@ -98748,6 +99144,46 @@ var createShading = ({ fill, color, type }) => new BuilderElement({
98748
99144
  }
98749
99145
  }
98750
99146
  });
99147
+ var ShadingType = {
99148
+ /** Clear shading - no pattern, fill color only */
99149
+ CLEAR: "clear",
99150
+ DIAGONAL_CROSS: "diagCross",
99151
+ DIAGONAL_STRIPE: "diagStripe",
99152
+ HORIZONTAL_CROSS: "horzCross",
99153
+ HORIZONTAL_STRIPE: "horzStripe",
99154
+ NIL: "nil",
99155
+ PERCENT_5: "pct5",
99156
+ PERCENT_10: "pct10",
99157
+ PERCENT_12: "pct12",
99158
+ PERCENT_15: "pct15",
99159
+ PERCENT_20: "pct20",
99160
+ PERCENT_25: "pct25",
99161
+ PERCENT_30: "pct30",
99162
+ PERCENT_35: "pct35",
99163
+ PERCENT_37: "pct37",
99164
+ PERCENT_40: "pct40",
99165
+ PERCENT_45: "pct45",
99166
+ PERCENT_50: "pct50",
99167
+ PERCENT_55: "pct55",
99168
+ PERCENT_60: "pct60",
99169
+ PERCENT_62: "pct62",
99170
+ PERCENT_65: "pct65",
99171
+ PERCENT_70: "pct70",
99172
+ PERCENT_75: "pct75",
99173
+ PERCENT_80: "pct80",
99174
+ PERCENT_85: "pct85",
99175
+ PERCENT_87: "pct87",
99176
+ PERCENT_90: "pct90",
99177
+ PERCENT_95: "pct95",
99178
+ REVERSE_DIAGONAL_STRIPE: "reverseDiagStripe",
99179
+ SOLID: "solid",
99180
+ THIN_DIAGONAL_CROSS: "thinDiagCross",
99181
+ THIN_DIAGONAL_STRIPE: "thinDiagStripe",
99182
+ THIN_HORIZONTAL_CROSS: "thinHorzCross",
99183
+ THIN_REVERSE_DIAGONAL_STRIPE: "thinReverseDiagStripe",
99184
+ THIN_VERTICAL_STRIPE: "thinVertStripe",
99185
+ VERTICAL_STRIPE: "vertStripe"
99186
+ };
98751
99187
  var ChangeAttributes = class extends XmlAttributeComponent {
98752
99188
  constructor(..._args) {
98753
99189
  super(..._args);
@@ -109929,6 +110365,67 @@ function accentOnlyTheme(accent) {
109929
110365
  };
109930
110366
  }
109931
110367
 
110368
+ // packages/core/dist/document/docx-defaults.js
110369
+ var import_jszip = __toESM(require_lib3(), 1);
110370
+ var DEFAULT_PARAGRAPH = { lineHeight: 1.5, spaceAfterPt: 6, justify: true };
110371
+ function hasDefaultParagraphStyle(stylesXml) {
110372
+ return [...stylesXml.matchAll(/<w:style\b[^>]*>/g)].some(([tag]) => /\bw:type="paragraph"/.test(tag) && /\bw:default="(1|true|on)"/.test(tag));
110373
+ }
110374
+ function emptyParagraphDefaults(stylesXml) {
110375
+ const m = /<w:pPrDefault\b[^>]*?(\/>|>([\s\S]*?)<\/w:pPrDefault>)/.exec(stylesXml);
110376
+ return !m || m[1] === "/>" || !/<w:pPr\b/.test(m[2] ?? "");
110377
+ }
110378
+ function pPr(d) {
110379
+ return `<w:pPr><w:spacing w:after="${Math.round(d.spaceAfterPt * 20)}" w:line="${Math.round(d.lineHeight * 240)}" w:lineRule="auto"/>${d.justify ? '<w:jc w:val="both"/>' : ""}</w:pPr>`;
110380
+ }
110381
+ function ensureDefaultStyles(stylesXml, d = DEFAULT_PARAGRAPH) {
110382
+ let xml = stylesXml;
110383
+ const changed = [];
110384
+ if (emptyParagraphDefaults(xml)) {
110385
+ const block = `<w:pPrDefault>${pPr(d)}</w:pPrDefault>`;
110386
+ if (/<w:pPrDefault\b[^>]*\/>/.test(xml))
110387
+ xml = xml.replace(/<w:pPrDefault\b[^>]*\/>/, block);
110388
+ else if (/<w:pPrDefault\b[\s\S]*?<\/w:pPrDefault>/.test(xml))
110389
+ xml = xml.replace(/<w:pPrDefault\b[\s\S]*?<\/w:pPrDefault>/, block);
110390
+ else if (/<\/w:rPrDefault>/.test(xml))
110391
+ xml = xml.replace(/<\/w:rPrDefault>/, `</w:rPrDefault>${block}`);
110392
+ else if (/<w:docDefaults\s*\/>/.test(xml))
110393
+ xml = xml.replace(/<w:docDefaults\s*\/>/, `<w:docDefaults>${block}</w:docDefaults>`);
110394
+ else if (/<\/w:docDefaults>/.test(xml))
110395
+ xml = xml.replace(/<\/w:docDefaults>/, `${block}</w:docDefaults>`);
110396
+ else
110397
+ xml = xml.replace(/(<w:styles\b[^>]*>)/, `$1<w:docDefaults>${block}</w:docDefaults>`);
110398
+ changed.push("paragraph defaults");
110399
+ }
110400
+ if (!hasDefaultParagraphStyle(xml)) {
110401
+ const normal = /<w:style\b(?=[^>]*\bw:type="paragraph")(?=[^>]*\bw:styleId="Normal")[^>]*>/.exec(xml);
110402
+ if (normal) {
110403
+ xml = xml.replace(normal[0], normal[0].replace(/<w:style\b/, '<w:style w:default="1"'));
110404
+ } else {
110405
+ const style = '<w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/><w:qFormat/></w:style>';
110406
+ if (/<\/w:latentStyles>/.test(xml))
110407
+ xml = xml.replace(/<\/w:latentStyles>/, `</w:latentStyles>${style}`);
110408
+ else if (/<\/w:docDefaults>/.test(xml))
110409
+ xml = xml.replace(/<\/w:docDefaults>/, `</w:docDefaults>${style}`);
110410
+ else
110411
+ xml = xml.replace(/(<w:styles\b[^>]*>)/, `$1${style}`);
110412
+ }
110413
+ changed.push("default paragraph style");
110414
+ }
110415
+ return { xml, changed };
110416
+ }
110417
+ async function ensureDocxDefaults(bytes, d = DEFAULT_PARAGRAPH) {
110418
+ const zip = await import_jszip.default.loadAsync(bytes);
110419
+ const part = zip.file("word/styles.xml");
110420
+ if (!part)
110421
+ return { bytes, changed: [] };
110422
+ const { xml, changed } = ensureDefaultStyles(await part.async("string"), d);
110423
+ if (!changed.length)
110424
+ return { bytes, changed };
110425
+ zip.file("word/styles.xml", xml);
110426
+ return { bytes: await zip.generateAsync({ type: "uint8array", compression: "DEFLATE" }), changed };
110427
+ }
110428
+
109932
110429
  // packages/core/dist/document/doc-gen.js
109933
110430
  function bareHex(c) {
109934
110431
  return c.replace("#", "").toUpperCase();
@@ -110210,8 +110707,9 @@ function docxBlock(b, theme) {
110210
110707
  const isHeader = Boolean(b.header && i === 0);
110211
110708
  return new TableCell({
110212
110709
  width: { size: columnWidths[columnIndex] ?? 0, type: WidthType.DXA },
110213
- // Themed header row background (the visible "not cheap" cue).
110214
- ...isHeader ? { shading: { fill: bareHex(theme.colors.tableHeaderBg) } } : {},
110710
+ // Themed header row background (the visible "not cheap" cue). w:shd
110711
+ // requires w:val — a fill-only shading fails the strict XSD gate.
110712
+ ...isHeader ? { shading: { type: ShadingType.CLEAR, color: "auto", fill: bareHex(theme.colors.tableHeaderBg) } } : {},
110215
110713
  children: [new Paragraph({ children: [new TextRun({ text: String(c), bold: isHeader })] })]
110216
110714
  });
110217
110715
  })
@@ -110348,7 +110846,12 @@ async function generateDocx(spec, themeInput) {
110348
110846
  }
110349
110847
  ]
110350
110848
  });
110351
- return new Uint8Array(await Packer.toBuffer(doc));
110849
+ const { bytes } = await ensureDocxDefaults(new Uint8Array(await Packer.toBuffer(doc)), {
110850
+ lineHeight: theme.body.lineHeight,
110851
+ spaceAfterPt: 6,
110852
+ justify: theme.body.justify
110853
+ });
110854
+ return bytes;
110352
110855
  }
110353
110856
  function isRichSheet(v) {
110354
110857
  return !!v && !Array.isArray(v) && typeof v === "object" && Array.isArray(v.rows);
@@ -110411,8 +110914,37 @@ async function generateDocument(kind, spec, theme) {
110411
110914
  }
110412
110915
 
110413
110916
  // packages/core/dist/document/doc-validate.js
110414
- var import_jszip = __toESM(require_lib3(), 1);
110917
+ var import_jszip3 = __toESM(require_lib3(), 1);
110415
110918
  var import_pdf_lib = __toESM(require_cjs(), 1);
110919
+
110920
+ // packages/core/dist/document/pptx-notes.js
110921
+ var import_jszip2 = __toESM(require_lib3(), 1);
110922
+ var REL_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
110923
+ var NOTES_SLIDE_REL = `${REL_NS}/notesSlide`;
110924
+ var NOTES_MASTER_REL = `${REL_NS}/notesMaster`;
110925
+ var SLIDE_REL = `${REL_NS}/slide`;
110926
+ async function notesKeynoteIssues(zip) {
110927
+ const out = [];
110928
+ for (const p of Object.keys(zip.files).filter((p2) => /^ppt\/notesSlides\/notesSlide\d+\.xml$/.test(p2)).sort()) {
110929
+ const xml = await zip.file(p).async("string");
110930
+ if (!/<p:clrMapOvr\b/.test(xml))
110931
+ out.push(p);
110932
+ }
110933
+ return out;
110934
+ }
110935
+ async function unlistedNotesMaster(zip) {
110936
+ const relsFile = zip.file("ppt/_rels/presentation.xml.rels");
110937
+ const presFile = zip.file("ppt/presentation.xml");
110938
+ if (!relsFile || !presFile)
110939
+ return null;
110940
+ const rel = new RegExp(`<Relationship\\b[^>]*Type="${NOTES_MASTER_REL}"[^>]*>`).exec(await relsFile.async("string"))?.[0];
110941
+ const rid = rel ? /\bId="([^"]+)"/.exec(rel)?.[1] : void 0;
110942
+ if (!rid)
110943
+ return null;
110944
+ return /<p:notesMasterId\b/.test(await presFile.async("string")) ? null : rid;
110945
+ }
110946
+
110947
+ // packages/core/dist/document/doc-validate.js
110416
110948
  function looksLikePdf(bytes) {
110417
110949
  const head = Buffer.from(bytes.subarray(0, 1024)).toString("latin1");
110418
110950
  return head.includes("%PDF-");
@@ -110424,6 +110956,17 @@ async function validatePdf(bytes) {
110424
110956
  try {
110425
110957
  const doc = await import_pdf_lib.PDFDocument.load(bytes, { ignoreEncryption: true, throwOnInvalidObject: true, updateMetadata: false });
110426
110958
  pages = doc.getPageCount();
110959
+ if (doc.isEncrypted) {
110960
+ const { pdfNeedsPassword: pdfNeedsPassword2 } = await Promise.resolve().then(() => (init_pdf_extract(), pdf_extract_exports));
110961
+ if (await pdfNeedsPassword2(bytes).catch(() => true)) {
110962
+ errors.push({
110963
+ code: "pdf-encrypted",
110964
+ message: "the PDF needs a password to open, so its content cannot be checked or rendered \u2014 validate (and render) the unencrypted file before `pdf-ops encrypt`; to inspect this one, `pdf-ops decrypt <in> <password> <out>` first"
110965
+ });
110966
+ return { ok: false, kind: "pdf", errors, warnings, pages };
110967
+ }
110968
+ warnings.push({ code: "pdf-encrypted", message: 'the PDF is encrypted with an owner password only: it opens without a password, but pdf-form / pdf-ops cannot edit it until `pdf-ops decrypt <in> "" <out>`' });
110969
+ }
110427
110970
  if (pages === 0)
110428
110971
  errors.push({ code: "pdf-no-pages", message: "the PDF parses but has no pages" });
110429
110972
  else
@@ -110581,7 +111124,7 @@ async function validateOoxml(bytes) {
110581
111124
  const result = (kind) => ({ ok: errors.length === 0, kind, errors, warnings });
110582
111125
  let zip;
110583
111126
  try {
110584
- zip = await import_jszip.default.loadAsync(Buffer.from(bytes));
111127
+ zip = await import_jszip3.default.loadAsync(Buffer.from(bytes));
110585
111128
  } catch (e) {
110586
111129
  errors.push({ code: "zip-unreadable", message: `not a readable OOXML zip: ${e.message}` });
110587
111130
  return result("unknown");
@@ -110649,44 +111192,168 @@ async function validateOoxml(bytes) {
110649
111192
  }
110650
111193
  }
110651
111194
  }
111195
+ if (root.kind === "pptx") {
111196
+ const bad = await notesKeynoteIssues(zip);
111197
+ if (bad.length) {
111198
+ errors.push({
111199
+ code: "notes-keynote",
111200
+ part: bad[0],
111201
+ message: `${bad.length} notes slide(s) lack <p:clrMapOvr> (${bad.slice(0, 3).join(", ")}${bad.length > 3 ? ", \u2026" : ""}) \u2014 Keynote refuses the whole file ("\u6587\u4EF6\u683C\u5F0F\u65E0\u6548"). Repair with \`pptx-notes <in.pptx> {} <out.pptx>\`; write notes with pptx-notes, never by hand`
111202
+ });
111203
+ }
111204
+ }
111205
+ if (root.kind === "pptx" && await unlistedNotesMaster(zip)) {
111206
+ errors.push({
111207
+ code: "notes-keynote",
111208
+ part: "ppt/presentation.xml",
111209
+ message: 'the notes master is not listed in <p:notesMasterIdLst> (python-pptx leaves it out) \u2014 Keynote refuses the whole file ("\u6587\u4EF6\u683C\u5F0F\u65E0\u6548"). Repair with `pptx-notes <in.pptx> {} <out.pptx>`'
111210
+ });
111211
+ }
111212
+ if (root.kind === "docx" && has("word/styles.xml") && !hasDefaultParagraphStyle(await text("word/styles.xml"))) {
111213
+ errors.push({
111214
+ code: "docx-default-style",
111215
+ part: "word/styles.xml",
111216
+ message: 'no default paragraph style (w:default="1", usually "Normal") \u2014 Word fills the gap, but Pages lays every unstyled paragraph out like the one before it (a centred title turns the whole body huge and centred). Repair with `docx-defaults <in.docx> <out.docx>`; docx from doc-gen already has it'
111217
+ });
111218
+ }
110652
111219
  return result(root.kind);
110653
111220
  }
110654
111221
 
110655
- // packages/core/dist/document/pdf-extract.js
110656
- var import_node_path = require("node:path");
110657
- var import_node_url = require("node:url");
110658
- var _mupdf = null;
110659
- function loadMupdf() {
110660
- if (!_mupdf) {
110661
- const deps = process.env.TALOS_SKILL_DEPS;
110662
- const spec = deps ? (0, import_node_url.pathToFileURL)((0, import_node_path.join)(deps, "mupdf", "dist", "mupdf.js")).href : "mupdf";
110663
- _mupdf = import(spec);
111222
+ // packages/core/dist/document/pdf-page-labels.js
111223
+ var import_pdf_lib4 = __toESM(require_cjs(), 1);
111224
+
111225
+ // packages/core/dist/document/pdf-lib-load.js
111226
+ var import_pdf_lib2 = __toESM(require_cjs(), 1);
111227
+ init_pdf_encrypted();
111228
+ var isEncryptedError = (e) => e instanceof import_pdf_lib2.EncryptedPDFError || /PDFDocument\.load` is encrypted/.test(String(e?.message));
111229
+ async function loadEditablePdf(bytes) {
111230
+ try {
111231
+ return await import_pdf_lib2.PDFDocument.load(bytes);
111232
+ } catch (e) {
111233
+ if (!isEncryptedError(e))
111234
+ throw e;
111235
+ const { pdfNeedsPassword: pdfNeedsPassword2 } = await Promise.resolve().then(() => (init_pdf_extract(), pdf_extract_exports));
111236
+ const needsPassword = await pdfNeedsPassword2(bytes).catch(() => true);
111237
+ throw needsPassword ? new PdfEncryptedError() : new Error(OWNER_ONLY_PDF_MESSAGE);
110664
111238
  }
110665
- return _mupdf;
110666
111239
  }
110667
- async function openDoc(bytes) {
110668
- const mupdf = await loadMupdf();
110669
- const doc = mupdf.Document.openDocument(bytes, "application/pdf");
110670
- if (doc.countPages() === 0) {
110671
- throw new Error("PDF has no readable pages (corrupt, encrypted, or empty)");
110672
- }
110673
- return { mupdf, doc };
111240
+
111241
+ // packages/core/dist/document/pdf-text-font.js
111242
+ var import_promises = require("node:fs/promises");
111243
+ var import_node_path2 = require("node:path");
111244
+ var import_pdf_lib3 = __toESM(require_cjs(), 1);
111245
+ async function loadFontkit() {
111246
+ const mod = await import("./fontkit.cjs");
111247
+ return mod.default?.create ? mod.default : mod;
110674
111248
  }
110675
- async function renderPdfPages(bytes, pages, scale = 2) {
110676
- const { mupdf, doc } = await openDoc(bytes);
110677
- const total = doc.countPages();
110678
- const wanted = pages === "all" ? Array.from({ length: total }, (_2, i) => i + 1) : pages;
110679
- const out = [];
110680
- const matrix = mupdf.Matrix.scale(scale, scale);
110681
- for (const p of wanted) {
110682
- if (p < 1 || p > total)
110683
- continue;
110684
- const pix = doc.loadPage(p - 1).toPixmap(matrix, mupdf.ColorSpace.DeviceRGB, false, true);
110685
- out.push({ page: p, png: pix.asPNG() });
111249
+ var PDF_CJK_FONT_FILES = {
111250
+ regular: "NotoSansSC-PDF-Regular.ttf",
111251
+ bold: "NotoSansSC-PDF-Bold.ttf"
111252
+ };
111253
+ var LINE_BREAK = /\r\n|[\n\f\r\u000B\u0085\u2028\u2029]/;
111254
+ function encodableAs(std, text) {
111255
+ const enc = import_pdf_lib3.StandardFontEmbedder.for(std);
111256
+ try {
111257
+ for (const line of text.replace(/\t/g, " ").split(LINE_BREAK))
111258
+ enc.encodeText(line);
111259
+ return true;
111260
+ } catch {
111261
+ return false;
110686
111262
  }
110687
- return out;
111263
+ }
111264
+ var codePoint = (cp) => `"${String.fromCodePoint(cp)}" (U+${cp.toString(16).toUpperCase().padStart(4, "0")})`;
111265
+ async function embedTextFont(doc, texts, opts = {}) {
111266
+ const bold = opts.weight === "bold";
111267
+ const std = bold ? import_pdf_lib3.StandardFonts.HelveticaBold : import_pdf_lib3.StandardFonts.Helvetica;
111268
+ if (texts.every((t) => encodableAs(std, t)))
111269
+ return doc.embedFont(std);
111270
+ if (!opts.fontDir) {
111271
+ const sample = [...texts.join("")].find((ch) => ch !== " " && !LINE_BREAK.test(ch) && !encodableAs(std, ch)) ?? "";
111272
+ throw new Error(`text has characters Helvetica cannot draw (e.g. ${codePoint(sample.codePointAt(0) ?? 0)}) and no CJK font directory was given`);
111273
+ }
111274
+ const used = /* @__PURE__ */ new Set();
111275
+ for (const t of texts) {
111276
+ for (const ch of t) {
111277
+ const cp = ch.codePointAt(0);
111278
+ if (cp >= 32 && !LINE_BREAK.test(ch) && cp !== 127)
111279
+ used.add(cp);
111280
+ }
111281
+ }
111282
+ const fontkit = await loadFontkit();
111283
+ const regularBytes = await (0, import_promises.readFile)((0, import_node_path2.join)(opts.fontDir, PDF_CJK_FONT_FILES.regular));
111284
+ const regular = fontkit.create(regularBytes);
111285
+ const missing = [...used].filter((cp) => !regular.hasGlyphForCodePoint(cp));
111286
+ if (missing.length) {
111287
+ const shown = missing.slice(0, 8).map(codePoint).join(", ");
111288
+ throw new Error(`the bundled CJK font has no glyph for ${shown}${missing.length > 8 ? ` and ${missing.length - 8} more` : ""} \u2014 remove or replace those characters (it covers Chinese \u2014 all CJK Unified Ideographs \u2014 plus Latin, punctuation and full-width forms; emoji and rare extension characters are not included)`);
111289
+ }
111290
+ let bytes = regularBytes;
111291
+ if (bold) {
111292
+ const boldBytes = await (0, import_promises.readFile)((0, import_node_path2.join)(opts.fontDir, PDF_CJK_FONT_FILES.bold));
111293
+ const boldFont = fontkit.create(boldBytes);
111294
+ if ([...used].every((cp) => boldFont.hasGlyphForCodePoint(cp)))
111295
+ bytes = boldBytes;
111296
+ }
111297
+ doc.registerFontkit(fontkit);
111298
+ return doc.embedFont(bytes, { subset: true });
111299
+ }
111300
+
111301
+ // packages/core/dist/document/pdf-page-layout.js
111302
+ var PDF_LABEL_SIZE = 8;
111303
+ function pdfPageLayout(theme) {
111304
+ const match = /^(\d+(?:\.\d+)?)(mm|cm|in|pt|px)$/.exec(theme.page.margin);
111305
+ if (!match)
111306
+ throw new Error("invalid PDF page margin");
111307
+ const scales = { mm: 72 / 25.4, cm: 72 / 2.54, in: 72, pt: 1, px: 0.75 };
111308
+ const side = Number(match[1]) * scales[match[2]];
111309
+ if (!Number.isFinite(side))
111310
+ throw new Error("invalid PDF page margin");
111311
+ const top = theme.page.header ? Math.max(side, 24) : side;
111312
+ const bottom = theme.page.footer ? Math.max(side, 24) : side;
111313
+ return { top, bottom, side, inset: Math.max(side, 12), cssMargin: theme.page.header || theme.page.footer ? `${top}pt ${side}pt ${bottom}pt ${side}pt` : theme.page.margin };
110688
111314
  }
110689
111315
 
111316
+ // packages/core/dist/document/pdf-page-labels.js
111317
+ async function addPdfPageLabels(bytes, theme, title, options = {}) {
111318
+ if (!theme.page.header && !theme.page.footer)
111319
+ return bytes;
111320
+ const doc = await loadEditablePdf(bytes);
111321
+ const pages = doc.getPages();
111322
+ if (!pages.length)
111323
+ throw new Error("PDF page labels require at least one page");
111324
+ const layout = pdfPageLayout(theme);
111325
+ const labels = pages.flatMap((page, index) => ["header", "footer"].flatMap((kind) => {
111326
+ if (!theme.page[kind])
111327
+ return [];
111328
+ const text = theme.page[kind].replace(/\{(title|page|pages)\}/g, (_2, token) => token === "title" ? title ?? "" : String(token === "page" ? index + 1 : pages.length)).replace(/\t/g, " ");
111329
+ if (/[\x00-\x1f\x7f\x85\u2028\u2029]/.test(text))
111330
+ throw new Error(`PDF ${kind} must be a single line without control characters`);
111331
+ return [{ page, index, kind, text }];
111332
+ }));
111333
+ const font = await embedTextFont(doc, labels.map((label) => label.text), options);
111334
+ const ascent = font.heightAtSize(PDF_LABEL_SIZE, { descender: false });
111335
+ const descent = font.heightAtSize(PDF_LABEL_SIZE) - ascent;
111336
+ const hex = theme.colors.muted.replace("#", "");
111337
+ const color = (0, import_pdf_lib4.rgb)(parseInt(hex.slice(0, 2), 16) / 255, parseInt(hex.slice(2, 4), 16) / 255, parseInt(hex.slice(4, 6), 16) / 255);
111338
+ for (const { page, index, kind, text } of labels) {
111339
+ const { width, height } = page.getSize();
111340
+ const crop = page.getCropBox();
111341
+ if (page.getRotation().angle !== 0 || crop.x !== 0 || crop.y !== 0 || crop.width !== width || crop.height !== height)
111342
+ throw new Error("PDF page labels require unrotated, uncropped pages");
111343
+ if (height <= layout.top + layout.bottom || width <= layout.inset * 2)
111344
+ throw new Error(`PDF page ${index + 1} has no space inside its margins`);
111345
+ const textWidth = font.widthOfTextAtSize(text, PDF_LABEL_SIZE);
111346
+ if (textWidth > width - 2 * layout.inset)
111347
+ throw new Error(`PDF ${kind} on page ${index + 1} exceeds the available width; shorten the text or reduce page margins`);
111348
+ const centerY = kind === "header" ? height - layout.top / 2 : layout.bottom / 2;
111349
+ page.drawText(text, { x: (width - textWidth) / 2, y: centerY - (ascent - descent) / 2, size: PDF_LABEL_SIZE, font, color });
111350
+ }
111351
+ return doc.save();
111352
+ }
111353
+
111354
+ // apps/admin/data/skills.lib/document/bin-src/doc-gen.mjs
111355
+ init_pdf_extract();
111356
+
110690
111357
  // packages/core/dist/document/html-escape.js
110691
111358
  function escapeHtml(value) {
110692
111359
  return String(value).replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
@@ -110700,7 +111367,7 @@ function stackWith(font) {
110700
111367
  function themeStyle(t) {
110701
111368
  const h = (lvl, extra = "") => `${lvl} { font-size: ${t.heading[lvl].size}pt; font-weight: ${t.heading[lvl].bold ? 700 : 400}; color: ${resolveColor(t, t.heading[lvl].color)}; margin: ${lvl === "h1" ? "0" : "1em"} 0 ${t.heading[lvl].spaceAfter}pt; ${extra}}`;
110702
111369
  return `
110703
- @page { size: ${t.page.size}; margin: ${t.page.margin}; }
111370
+ @page { size: ${t.page.size}; margin: ${pdfPageLayout(t).cssMargin}; }
110704
111371
  * { box-sizing: border-box; }
110705
111372
  html { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
110706
111373
  body { font-family: ${stackWith(t.fonts.body)}; font-size: ${t.body.size}pt; line-height: ${t.body.lineHeight}; color: ${t.colors.text}; margin: 0; }
@@ -110800,26 +111467,48 @@ function specToHtml(spec, themeInput) {
110800
111467
  body.push(blockHtml(b));
110801
111468
  return `<!doctype html><html lang="zh"><head><meta charset="utf-8"><style>${themeStyle(theme)}</style></head><body>${body.join("\n")}</body></html>`;
110802
111469
  }
110803
- function themePrintOptions(themeInput, title) {
110804
- const theme = themeInput && typeof themeInput === "object" && "warnings" in themeInput ? themeInput : resolveTheme(themeInput);
110805
- if (!theme.page.header && !theme.page.footer)
110806
- return void 0;
110807
- const line = (tpl) => {
110808
- const withTitle = norm(interpolateTitle(tpl, title));
110809
- const withPages = withTitle.replaceAll("{page}", '<span class="pageNumber"></span>').replaceAll("{pages}", '<span class="totalPages"></span>');
110810
- return `<div style="font-size:8pt;width:100%;text-align:center;color:${theme.colors.muted};font-family:${stackWith(theme.fonts.body).replace(/"/g, "&quot;")};">${withPages}</div>`;
110811
- };
110812
- return {
110813
- headerTemplate: theme.page.header ? line(theme.page.header) : "<span></span>",
110814
- footerTemplate: theme.page.footer ? line(theme.page.footer) : "<span></span>"
111470
+
111471
+ // apps/admin/data/skills.lib/document/bin-src/lib/headless-chromium.mjs
111472
+ var import_promises2 = require("node:fs/promises");
111473
+ var import_node_module = require("node:module");
111474
+ var import_node_path3 = require("node:path");
111475
+
111476
+ // packages/core/dist/document/pdf-print.js
111477
+ var CJK_TEXT_RE = /[\u2E80-\u30FF\u3200-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF]/;
111478
+ var PREPARE_FONTS = String.raw`async (fallbackFamily) => {
111479
+ const cjk = new RegExp(${JSON.stringify(CJK_TEXT_RE.source)});
111480
+ const normalize = (family) => family.trim().replace(/^['"]|['"]$/g, '').toLowerCase();
111481
+ const check = async () => {
111482
+ await document.fonts.ready;
111483
+ const failed = [...document.fonts].filter(face => face.status === 'error');
111484
+ if (failed.length) throw new Error('PDF font failed to load: ' + failed.map(face => face.family).join(', '));
110815
111485
  };
111486
+ await check();
111487
+ if (fallbackFamily && cjk.test(document.body.innerText)) {
111488
+ const faces = [...document.fonts];
111489
+ if (!faces.some(face => normalize(face.family) === normalize(fallbackFamily))) {
111490
+ throw new Error('PDF CJK fallback font is unavailable: ' + fallbackFamily);
111491
+ }
111492
+ const embedded = new Set(faces.filter(face => face.status === 'loaded' && normalize(face.family) !== normalize(fallbackFamily)).map(face => normalize(face.family)));
111493
+ const updates = [...document.body.querySelectorAll('*'), document.body]
111494
+ .filter(element => element.style && !['SCRIPT', 'STYLE', 'TEMPLATE', 'NOSCRIPT'].includes(element.tagName))
111495
+ .map(element => {
111496
+ const families = getComputedStyle(element).fontFamily.match(/(?:[^,"']+|"[^"]*"|'[^']*')+/g) || [];
111497
+ const authored = families.filter(family => normalize(family) !== normalize(fallbackFamily));
111498
+ return [element, [...authored.filter(family => embedded.has(normalize(family))), fallbackFamily,
111499
+ ...authored.filter(family => !embedded.has(normalize(family)))].join(', ')];
111500
+ });
111501
+ for (const [element, family] of updates) element.style.setProperty('font-family', family, 'important');
111502
+ // Force layout before fonts.ready: newly selected fallback faces load lazily.
111503
+ document.body.getBoundingClientRect();
111504
+ await check();
111505
+ }
111506
+ }`;
111507
+ function pdfFontPreparationScript(fallbackFamily) {
111508
+ return `(${PREPARE_FONTS})(${JSON.stringify(fallbackFamily ?? null)})`;
110816
111509
  }
110817
111510
 
110818
111511
  // apps/admin/data/skills.lib/document/bin-src/lib/headless-chromium.mjs
110819
- var import_node_fs = require("node:fs");
110820
- var import_promises = require("node:fs/promises");
110821
- var import_node_module = require("node:module");
110822
- var import_node_path2 = require("node:path");
110823
111512
  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.";
110824
111513
  function headlessBrowserDisabled() {
110825
111514
  const v = (process.env.TALOS_HEADLESS_BROWSER ?? "").trim().toLowerCase();
@@ -110828,7 +111517,7 @@ function headlessBrowserDisabled() {
110828
111517
  async function loadPlaywright() {
110829
111518
  const deps = process.env.TALOS_SKILL_DEPS;
110830
111519
  if (deps) {
110831
- const req = (0, import_node_module.createRequire)((0, import_node_path2.join)(deps, "_resolve.js"));
111520
+ const req = (0, import_node_module.createRequire)((0, import_node_path3.join)(deps, "_resolve.js"));
110832
111521
  for (const name of ["playwright", "playwright-core"]) {
110833
111522
  try {
110834
111523
  return req(name);
@@ -110857,29 +111546,42 @@ async function launchHeadlessChromium() {
110857
111546
  return null;
110858
111547
  }
110859
111548
  }
110860
- var CJK_RE = /[\u2E80-\u2FFF\u3000-\u303F\u3040-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\uFF00-\uFFEF]/;
110861
111549
  var _fontManifest;
110862
111550
  async function fontManifest() {
110863
111551
  if (_fontManifest !== void 0) return _fontManifest;
110864
- const dir = process.env.TALOS_CJK_FONT_DIR || (0, import_node_path2.join)((0, import_node_path2.dirname)(process.argv[1]), "..", "assets", "fonts");
110865
- const file = (0, import_node_path2.join)(dir, "fonts.json");
111552
+ const dir = process.env.TALOS_CJK_FONT_DIR || (0, import_node_path3.join)((0, import_node_path3.dirname)(process.argv[1]), "..", "assets", "fonts");
111553
+ const file = (0, import_node_path3.join)(dir, "fonts.json");
111554
+ let manifest;
110866
111555
  try {
110867
- _fontManifest = { dir, ...JSON.parse(await (0, import_promises.readFile)(file, "utf8")) };
110868
- } catch {
110869
- _fontManifest = { dir, cjk: [], latin: [], cjkUnicodeRange: "" };
111556
+ manifest = JSON.parse(await (0, import_promises2.readFile)(file, "utf8"));
111557
+ } catch (error) {
111558
+ throw new Error(`Cannot load PDF font manifest ${file}: ${error.message}`);
111559
+ }
111560
+ 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"))) {
111561
+ throw new Error(`Invalid PDF font manifest: ${file}`);
110870
111562
  }
111563
+ _fontManifest = { ...manifest, dir };
110871
111564
  return _fontManifest;
110872
111565
  }
111566
+ var _faceB64 = /* @__PURE__ */ new Map();
111567
+ async function faceBase64(path) {
111568
+ if (!_faceB64.has(path)) {
111569
+ const bytes = await (0, import_promises2.readFile)(path).catch((error) => {
111570
+ throw new Error(`Cannot load PDF font ${path}: ${error.message}`);
111571
+ });
111572
+ if (!bytes.length) throw new Error(`Empty PDF font: ${path}`);
111573
+ _faceB64.set(path, bytes.toString("base64"));
111574
+ }
111575
+ return _faceB64.get(path);
111576
+ }
110873
111577
  async function faceCss(entries, range, doc) {
110874
111578
  const { dir } = await fontManifest();
110875
111579
  const rules = [];
110876
111580
  for (const entry of entries ?? []) {
110877
111581
  const families = doc ? (entry.families ?? []).filter((f) => doc.includes(f)) : entry.families ?? [];
110878
111582
  if (!families.length) continue;
110879
- const path = (0, import_node_path2.join)(dir, entry.file);
110880
- if (!(0, import_node_fs.existsSync)(path)) continue;
110881
- const b64 = (await (0, import_promises.readFile)(path).catch(() => null))?.toString("base64");
110882
- if (!b64) continue;
111583
+ const path = (0, import_node_path3.join)(dir, entry.file);
111584
+ const b64 = await faceBase64(path);
110883
111585
  for (const family of families) {
110884
111586
  rules.push(
110885
111587
  `@font-face{font-family:'${family}';src:local('${family}'),url(data:font/woff2;base64,${b64}) format('woff2');${entry.weight ? `font-weight:${entry.weight};` : ""}${range ? `unicode-range:${range};` : ""}font-display:swap}`
@@ -110888,38 +111590,36 @@ async function faceCss(entries, range, doc) {
110888
111590
  }
110889
111591
  return rules.join("");
110890
111592
  }
110891
- var _cjkFontCss;
111593
+ var _faceCssBySet = /* @__PURE__ */ new Map();
111594
+ async function cachedFaceCss(group, entries, range, doc) {
111595
+ const named = (entries ?? []).flatMap((e) => (e.families ?? []).filter((f) => doc.includes(f)));
111596
+ const key = `${group}|${named.join("|")}`;
111597
+ if (!_faceCssBySet.has(key)) _faceCssBySet.set(key, await faceCss(entries, range, doc));
111598
+ return _faceCssBySet.get(key);
111599
+ }
110892
111600
  async function cjkFontFaceCss(doc) {
110893
- if (_cjkFontCss === void 0) {
110894
- const m = await fontManifest();
110895
- _cjkFontCss = await faceCss(m.cjk, m.cjkUnicodeRange, doc);
110896
- }
110897
- return _cjkFontCss;
111601
+ if (process.env.TALOS_CJK_FONTS === "system") return "";
111602
+ const m = await fontManifest();
111603
+ return cachedFaceCss("cjk", m.cjk, m.cjkUnicodeRange, doc);
110898
111604
  }
110899
- var _latinFontCss;
110900
111605
  async function latinFontFaceCss(doc) {
110901
- if (_latinFontCss === void 0) {
110902
- const m = await fontManifest();
110903
- const wanted = (m.latin ?? []).filter((e) => (e.families ?? []).some((f) => doc.includes(f)));
110904
- _latinFontCss = await faceCss(wanted, void 0);
110905
- }
110906
- return _latinFontCss;
111606
+ const m = await fontManifest();
111607
+ return cachedFaceCss("latin", m.latin, void 0, doc);
110907
111608
  }
110908
111609
  function injectStyle(html, css) {
110909
111610
  const tag = `<style>${css}</style>`;
110910
111611
  return html.includes("</head>") ? html.replace("</head>", `${tag}</head>`) : tag + html;
110911
111612
  }
110912
- async function renderPdfHeadless(html, print = {}) {
111613
+ async function renderPdfHeadless(html) {
110913
111614
  const browser2 = await launchHeadlessChromium();
110914
111615
  if (!browser2) return null;
110915
111616
  try {
110916
111617
  const page = await browser2.newPage();
110917
- const faces = (CJK_RE.test(html) ? await cjkFontFaceCss(html) : "") + await latinFontFaceCss(html);
111618
+ const faces = (CJK_TEXT_RE.test(html) ? await cjkFontFaceCss(html) : "") + await latinFontFaceCss(html);
111619
+ await page.emulateMedia({ media: "print" });
110918
111620
  await page.setContent(faces ? injectStyle(html, faces) : html, { waitUntil: "load" });
110919
- await page.evaluate("document.fonts && document.fonts.ready").catch(() => {
110920
- });
110921
- const hf = print.headerTemplate || print.footerTemplate ? { displayHeaderFooter: true, headerTemplate: print.headerTemplate || "<span></span>", footerTemplate: print.footerTemplate || "<span></span>" } : {};
110922
- return new Uint8Array(await page.pdf({ printBackground: true, preferCSSPageSize: true, ...hf }));
111621
+ await page.evaluate(pdfFontPreparationScript());
111622
+ return new Uint8Array(await page.pdf({ printBackground: true, preferCSSPageSize: true }));
110923
111623
  } finally {
110924
111624
  await browser2.close().catch(() => {
110925
111625
  });
@@ -110927,7 +111627,7 @@ async function renderPdfHeadless(html, print = {}) {
110927
111627
  }
110928
111628
 
110929
111629
  // apps/admin/data/skills.lib/document/bin-src/doc-gen.mjs
110930
- var import_node_path3 = require("node:path");
111630
+ var import_node_path5 = require("node:path");
110931
111631
  var import_node_fs2 = require("node:fs");
110932
111632
  var import_node_crypto = require("node:crypto");
110933
111633
 
@@ -111166,6 +111866,1475 @@ function listPalettes() {
111166
111866
  return PALETTE_LIBRARY.map(({ name, mood, dark }) => ({ name, mood, dark }));
111167
111867
  }
111168
111868
 
111869
+ // packages/core/dist/document/deck-scenarios.data.js
111870
+ var SCENARIO_MATRIX = {
111871
+ "scenarios": [
111872
+ {
111873
+ "id": "pitch",
111874
+ "subtitle": "\u878D\u8D44/\u8DEF\u6F14",
111875
+ "tone": [
111876
+ "\u81EA\u4FE1",
111877
+ "\u6709\u5F20\u529B",
111878
+ "\u6545\u4E8B\u9A71\u52A8"
111879
+ ],
111880
+ "density": [
111881
+ "\u4E2D",
111882
+ "\u5927\u6570\u5B57+\u4E00\u53E5\u89E3\u91CA"
111883
+ ],
111884
+ "requiredSections": [
111885
+ {
111886
+ "terms": [
111887
+ "Problem",
111888
+ "\u95EE\u9898"
111889
+ ],
111890
+ "content": "\u8C01\u75DB\u3001\u591A\u75DB\uFF1A\u91CF\u5316\u7684\u75DB\u70B9\u8BC1\u636E\uFF08\u65F6\u95F4/\u91D1\u94B1\u635F\u5931\uFF09\uFF1B\u5B9C \u5927\u6570\u5B57"
111891
+ },
111892
+ {
111893
+ "terms": [
111894
+ "Solution",
111895
+ "\u89E3\u51B3\u65B9\u6848"
111896
+ ],
111897
+ "content": "\u600E\u4E48\u89E3\u51B3\u3001\u4E3A\u4EC0\u4E48\u73B0\u5728\u80FD\u89E3\u51B3\uFF1B\u5B9C \u524D\u540E\u5BF9\u6BD4\u6216\u6D41\u7A0B"
111898
+ },
111899
+ {
111900
+ "terms": [
111901
+ "Market",
111902
+ "\u5E02\u573A"
111903
+ ],
111904
+ "content": "TAM/SAM/SOM \u4E0E\u589E\u901F\uFF0C\u6CE8\u660E\u6765\u6E90\u5E74\u4EFD\uFF1B\u5B9C \u67F1\u72B6\u56FE"
111905
+ },
111906
+ {
111907
+ "terms": [
111908
+ "Product",
111909
+ "Traction",
111910
+ "\u4EA7\u54C1",
111911
+ "\u8FDB\u5C55"
111912
+ ],
111913
+ "content": "\u4EA7\u54C1\u5F62\u6001 + \u589E\u957F\u8BC1\u636E\uFF08\u5BA2\u6237\u6570\u3001\u6536\u5165\u3001\u7559\u5B58\uFF09\uFF1B\u5B9C \u589E\u957F\u6298\u7EBF"
111914
+ },
111915
+ {
111916
+ "terms": [
111917
+ "Team",
111918
+ "\u56E2\u961F"
111919
+ ],
111920
+ "content": "\u6838\u5FC3\u6210\u5458\u4E0E\u8FD9\u4EF6\u4E8B\u76F8\u5173\u7684\u7ECF\u5386\uFF1B\u5B9C \u5E76\u5217\u5361\u7247"
111921
+ },
111922
+ {
111923
+ "terms": [
111924
+ "Ask",
111925
+ "\u878D\u8D44\u9700\u6C42"
111926
+ ],
111927
+ "key": true,
111928
+ "content": "\u878D\u8D44\u91D1\u989D\u3001\u8D44\u91D1\u7528\u9014\u5360\u6BD4\u3001\u5230\u4E0B\u4E00\u8F6E\u7684\u91CC\u7A0B\u7891\uFF1B\u5B9C \u997C\u56FE\u6216\u62C6\u5206"
111929
+ }
111930
+ ],
111931
+ "narrative": "SCQA / \u95EE\u9898-\u65B9\u6848",
111932
+ "pages": {
111933
+ "min": 10,
111934
+ "max": 12
111935
+ },
111936
+ "researchFocus": [
111937
+ "\u5E02\u573A\u89C4\u6A21\u4E0E\u589E\u901F(TAM/SAM)",
111938
+ "\u53EF\u6BD4\u516C\u53F8\u878D\u8D44\u4E0E\u4F30\u503C",
111939
+ "\u540C\u7C7B\u4EA7\u54C1\u4E0E\u5DEE\u5F02",
111940
+ "\u76EE\u6807\u5BA2\u7FA4\u75DB\u70B9\u8BC1\u636E"
111941
+ ],
111942
+ "motion": {
111943
+ "delivery": "presented",
111944
+ "keywords": [
111945
+ "pitch",
111946
+ "\u8DEF\u6F14"
111947
+ ]
111948
+ }
111949
+ },
111950
+ {
111951
+ "id": "\u5185\u5BA1",
111952
+ "tone": [
111953
+ "\u5BA2\u89C2",
111954
+ "\u76F4\u63A5",
111955
+ "\u7ED3\u8BBA\u5148\u884C"
111956
+ ],
111957
+ "density": [
111958
+ "\u7565\u5BC6(\u5BB9\u660E\u7EC6/\u6570\u636E)"
111959
+ ],
111960
+ "requiredSections": [
111961
+ {
111962
+ "terms": [
111963
+ "\u7ED3\u8BBA",
111964
+ "\u8FDB\u5C55"
111965
+ ],
111966
+ "content": "\u4E00\u53E5\u8BDD\u7ED3\u8BBA\uFF1A\u8FBE\u6210/\u672A\u8FBE\u6210\u4E0E\u504F\u5DEE\u5E45\u5EA6"
111967
+ },
111968
+ {
111969
+ "terms": [
111970
+ "\u5173\u952E\u6307\u6807"
111971
+ ],
111972
+ "content": "\u6838\u5FC3\u6307\u6807 \u5B9E\u9645 vs \u76EE\u6807 vs \u4E0A\u671F\uFF0C\u53E3\u5F84\u4E00\u81F4\uFF1B\u5B9C \u8868\u683C\u6216\u5BF9\u6BD4\u67F1"
111973
+ },
111974
+ {
111975
+ "terms": [
111976
+ "\u95EE\u9898\u4E0E\u98CE\u9669"
111977
+ ],
111978
+ "content": "\u95EE\u9898\u3001\u5F71\u54CD\u7A0B\u5EA6\u3001\u8D23\u4EFB\u65B9\uFF1B\u5B9C \u5217\u8868\u6216\u77E9\u9635"
111979
+ },
111980
+ {
111981
+ "terms": [
111982
+ "\u4E0B\u4E00\u6B65",
111983
+ "\u51B3\u7B56\u9879"
111984
+ ],
111985
+ "content": "\u9700\u62CD\u677F\u7684\u51B3\u7B56\u9879\u3001\u8D1F\u8D23\u4EBA\u3001\u622A\u6B62\u65F6\u95F4"
111986
+ }
111987
+ ],
111988
+ "narrative": "\u7ED3\u8BBA\u5148\u884C",
111989
+ "pages": {
111990
+ "min": 6,
111991
+ "max": 8
111992
+ },
111993
+ "researchFocus": [
111994
+ "\u884C\u4E1A\u5BF9\u6807\u6307\u6807",
111995
+ "\u53E3\u5F84\u5B9A\u4E49",
111996
+ "\u5916\u90E8\u98CE\u9669\u4E8B\u4EF6"
111997
+ ],
111998
+ "motion": {
111999
+ "delivery": "read",
112000
+ "keywords": [
112001
+ "\u5185\u5BA1"
112002
+ ]
112003
+ }
112004
+ },
112005
+ {
112006
+ "id": "\u9500\u552E",
112007
+ "tone": [
112008
+ "\u5229\u76CA\u9A71\u52A8",
112009
+ "\u5BA2\u6237\u4E2D\u5FC3",
112010
+ "\u8BF4\u670D"
112011
+ ],
112012
+ "density": [
112013
+ "\u4E2D",
112014
+ "\u91CD\u4EF7\u503C\u4E0E\u4F50\u8BC1"
112015
+ ],
112016
+ "requiredSections": [
112017
+ {
112018
+ "terms": [
112019
+ "\u75DB\u70B9"
112020
+ ],
112021
+ "content": "\u5BA2\u6237\u7684\u4E1A\u52A1\u75DB\u70B9\u4E0E\u4EE3\u4EF7\uFF0C\u7528\u5BA2\u6237\u884C\u4E1A\u7684\u6570\u636E"
112022
+ },
112023
+ {
112024
+ "terms": [
112025
+ "\u65B9\u6848",
112026
+ "\u4EF7\u503C\u4E3B\u5F20"
112027
+ ],
112028
+ "content": "\u65B9\u6848\u5982\u4F55\u89E3\u51B3\u3001\u5BF9\u5BA2\u6237\u7684\u4EF7\u503C\u4E3B\u5F20\u4E00\u53E5\u8BDD"
112029
+ },
112030
+ {
112031
+ "terms": [
112032
+ "\u5DEE\u5F02\u5316"
112033
+ ],
112034
+ "content": "\u4E0E\u66FF\u4EE3\u65B9\u6848\u9010\u9879\u5BF9\u6BD4\u7684\u5DEE\u5F02\u70B9\uFF1B\u5B9C \u5BF9\u6BD4\u8868"
112035
+ },
112036
+ {
112037
+ "terms": [
112038
+ "\u5BA2\u6237\u6848\u4F8B"
112039
+ ],
112040
+ "content": "\u540C\u884C\u4E1A\u5BA2\u6237\u3001\u505A\u4E86\u4EC0\u4E48\u3001\u91CF\u5316\u7ED3\u679C"
112041
+ },
112042
+ {
112043
+ "terms": [
112044
+ "ROI",
112045
+ "\u5B9A\u4EF7"
112046
+ ],
112047
+ "content": "\u6295\u5165\u3001\u56DE\u62A5\u3001\u56DE\u672C\u5468\u671F\u6216\u5B9A\u4EF7\u65B9\u6848\uFF1B\u5B9C \u5927\u6570\u5B57"
112048
+ },
112049
+ {
112050
+ "terms": [
112051
+ "CTA",
112052
+ "\u884C\u52A8\u53F7\u53EC"
112053
+ ],
112054
+ "key": true,
112055
+ "content": "\u4E0B\u4E00\u6B65\u5177\u4F53\u52A8\u4F5C\uFF1A\u8BD5\u7528\u3001\u4F1A\u8BAE\u3001\u7B7E\u7EA6\u65F6\u95F4"
112056
+ }
112057
+ ],
112058
+ "narrative": "\u95EE\u9898-\u65B9\u6848",
112059
+ "pages": {
112060
+ "min": 8,
112061
+ "max": 12
112062
+ },
112063
+ "researchFocus": [
112064
+ "\u5BA2\u6237\u6240\u5728\u884C\u4E1A\u75DB\u70B9",
112065
+ "\u7ADE\u54C1\u65B9\u6848\u4E0E\u5DEE\u5F02",
112066
+ "\u540C\u884C\u843D\u5730\u6848\u4F8B\u4E0E ROI",
112067
+ "\u516C\u5F00\u5B9A\u4EF7"
112068
+ ],
112069
+ "motion": {
112070
+ "delivery": "presented",
112071
+ "keywords": [
112072
+ "\u9500\u552E",
112073
+ "sales"
112074
+ ]
112075
+ }
112076
+ },
112077
+ {
112078
+ "id": "\u8BB2\u5EA7",
112079
+ "subtitle": "\u5B66\u672F",
112080
+ "tone": [
112081
+ "\u8BB2\u89E3",
112082
+ "\u5FAA\u5E8F\u6E10\u8FDB"
112083
+ ],
112084
+ "density": [
112085
+ "\u4E2D",
112086
+ "\u6982\u5FF5+\u4F8B\u5B50"
112087
+ ],
112088
+ "requiredSections": [
112089
+ {
112090
+ "terms": [
112091
+ "\u5B66\u4E60\u76EE\u6807"
112092
+ ],
112093
+ "content": "\u542C\u5B8C\u80FD\u505A\u5230\u7684 3 \u4EF6\u4E8B"
112094
+ },
112095
+ {
112096
+ "terms": [
112097
+ "\u80CC\u666F",
112098
+ "\u57FA\u7840"
112099
+ ],
112100
+ "content": "\u7406\u89E3\u6838\u5FC3\u6982\u5FF5\u5FC5\u987B\u5148\u77E5\u9053\u7684\u524D\u7F6E\u77E5\u8BC6"
112101
+ },
112102
+ {
112103
+ "terms": [
112104
+ "\u6838\u5FC3\u6982\u5FF5"
112105
+ ],
112106
+ "content": "\u5B9A\u4E49\u3001\u5173\u952E\u6027\u8D28\uFF0C\u914D\u4E00\u4E2A\u76F4\u89C2\u4F8B\u5B50"
112107
+ },
112108
+ {
112109
+ "terms": [
112110
+ "\u6848\u4F8B",
112111
+ "\u63A8\u5BFC"
112112
+ ],
112113
+ "content": "\u5B8C\u6574\u7684\u6848\u4F8B\u6216\u63A8\u5BFC\u6B65\u9AA4\uFF1B\u5B9C \u6B65\u9AA4"
112114
+ },
112115
+ {
112116
+ "terms": [
112117
+ "\u5C0F\u7ED3"
112118
+ ],
112119
+ "content": "\u8981\u70B9\u56DE\u987E + \u5EF6\u4F38\u9605\u8BFB"
112120
+ }
112121
+ ],
112122
+ "narrative": "\u7531\u6D45\u5165\u6DF1",
112123
+ "pages": {
112124
+ "min": 10,
112125
+ "max": 15
112126
+ },
112127
+ "researchFocus": [
112128
+ "\u6982\u5FF5\u5B9A\u4E49\u4E0E\u6743\u5A01\u6559\u6750",
112129
+ "\u5173\u952E\u8BBA\u6587\u4E0E\u7EFC\u8FF0",
112130
+ "\u7ECF\u5178\u6848\u4F8B/\u63A8\u5BFC",
112131
+ "\u5E38\u89C1\u8BEF\u89E3"
112132
+ ],
112133
+ "motion": {
112134
+ "delivery": "presented",
112135
+ "keywords": [
112136
+ "\u8BB2\u5EA7",
112137
+ "lecture"
112138
+ ]
112139
+ }
112140
+ },
112141
+ {
112142
+ "id": "\u53D1\u5E03\u4F1A",
112143
+ "subtitle": "keynote",
112144
+ "tone": [
112145
+ "\u60C5\u7EEA\u5316",
112146
+ "\u620F\u5267\u6027",
112147
+ "\u63ED\u6653\u611F"
112148
+ ],
112149
+ "density": [
112150
+ "\u6781\u7A00\u758F",
112151
+ "\u4E00\u9875\u4E00\u4FE1\u606F",
112152
+ "\u8D85\u5927\u89C6\u89C9"
112153
+ ],
112154
+ "densityEmphasis": true,
112155
+ "requiredSections": [
112156
+ {
112157
+ "terms": [
112158
+ "\u94A9\u5B50"
112159
+ ],
112160
+ "content": "\u4E00\u53E5\u8BDD\u6216\u4E00\u4E2A\u753B\u9762\u6293\u4F4F\u6CE8\u610F\u529B\uFF1B\u5B9C \u5927\u5B57\u6216\u5927\u56FE"
112161
+ },
112162
+ {
112163
+ "terms": [
112164
+ "\u80CC\u666F",
112165
+ "\u75DB\u70B9"
112166
+ ],
112167
+ "content": "\u7528\u6237\u4ECA\u5929\u7684\u56F0\u6270\uFF0C\u4E00\u4E2A\u5177\u4F53\u573A\u666F"
112168
+ },
112169
+ {
112170
+ "terms": [
112171
+ "\u4EA7\u54C1\u63ED\u6653"
112172
+ ],
112173
+ "content": "\u4EA7\u54C1\u540D\u4E0E\u4E00\u53E5\u8BDD\u5B9A\u4F4D\uFF0C\u5355\u72EC\u4E00\u9875\uFF1B\u5B9C \u5927\u56FE"
112174
+ },
112175
+ {
112176
+ "terms": [
112177
+ "\u4EAE\u70B9\u7279\u6027"
112178
+ ],
112179
+ "content": "3 \u4E2A\u4EE5\u5185\u7684\u6838\u5FC3\u5356\u70B9\uFF0C\u5404\u914D\u4E00\u4E2A\u53EF\u611F\u77E5\u7684\u6570\u5B57"
112180
+ },
112181
+ {
112182
+ "terms": [
112183
+ "Demo",
112184
+ "\u6F14\u793A"
112185
+ ],
112186
+ "content": "\u771F\u5B9E\u4F7F\u7528\u6D41\u7A0B\u6F14\u793A\uFF1B\u5B9C \u6B65\u9AA4\u6216\u622A\u56FE"
112187
+ },
112188
+ {
112189
+ "terms": [
112190
+ "\u4EF7\u683C\u4E0A\u5E02"
112191
+ ],
112192
+ "content": "\u4EF7\u683C\u3001\u7248\u672C\u3001\u4E0A\u5E02\u65F6\u95F4\u4E0E\u6E20\u9053"
112193
+ },
112194
+ {
112195
+ "terms": [
112196
+ "\u884C\u52A8\u53F7\u53EC"
112197
+ ],
112198
+ "key": true,
112199
+ "content": "\u73B0\u5728\u5C31\u80FD\u505A\u7684\u4E8B\uFF1A\u9884\u8BA2\u3001\u4E0B\u8F7D\u3001\u4F53\u9A8C"
112200
+ }
112201
+ ],
112202
+ "narrative": "\u60C5\u7EEA\u7EBF",
112203
+ "pages": {
112204
+ "min": 15,
112205
+ "max": 20
112206
+ },
112207
+ "researchFocus": [
112208
+ "\u540C\u7C7B\u4EA7\u54C1\u75DB\u70B9\u4E0E\u5DEE\u8BC4",
112209
+ "\u7ADE\u54C1\u53C2\u6570\u5BF9\u6BD4",
112210
+ "\u7ADE\u54C1\u5B9A\u4EF7\u4E0E\u4E0A\u5E02\u8282\u594F",
112211
+ "\u53EF\u5F15\u7528\u7684\u7528\u6237\u573A\u666F"
112212
+ ],
112213
+ "motion": {
112214
+ "delivery": "presented",
112215
+ "keywords": [
112216
+ "\u53D1\u5E03\u4F1A",
112217
+ "launch",
112218
+ "keynote"
112219
+ ]
112220
+ }
112221
+ },
112222
+ {
112223
+ "id": "\u57F9\u8BAD",
112224
+ "tone": [
112225
+ "\u6559\u5B66",
112226
+ "\u6E05\u6670",
112227
+ "\u53EF\u64CD\u4F5C"
112228
+ ],
112229
+ "density": [
112230
+ "\u4E2D",
112231
+ "\u5206\u6A21\u5757"
112232
+ ],
112233
+ "requiredSections": [
112234
+ {
112235
+ "terms": [
112236
+ "Objectives",
112237
+ "\u5B66\u4E60\u76EE\u6807"
112238
+ ],
112239
+ "content": "\u5B66\u5B8C\u80FD\u505A\u5230\u4EC0\u4E48\uFF0C\u53EF\u68C0\u9A8C"
112240
+ },
112241
+ {
112242
+ "terms": [
112243
+ "Module",
112244
+ "\u8BFE\u7A0B\u6A21\u5757"
112245
+ ],
112246
+ "content": "\u6A21\u5757\u5212\u5206\u4E0E\u6BCF\u5757\u8981\u70B9\uFF1B\u5B9C \u5206\u5C42\u6216\u6B65\u9AA4"
112247
+ },
112248
+ {
112249
+ "terms": [
112250
+ "\u7EC3\u4E60",
112251
+ "\u793A\u4F8B",
112252
+ "Exercise"
112253
+ ],
112254
+ "content": "\u53EF\u7167\u505A\u7684\u793A\u4F8B\u6216\u7EC3\u4E60\u9898"
112255
+ },
112256
+ {
112257
+ "terms": [
112258
+ "Quiz",
112259
+ "\u968F\u5802\u6D4B\u9A8C"
112260
+ ],
112261
+ "content": "\u68C0\u9A8C\u7406\u89E3\u7684\u9898\u76EE\u4E0E\u7B54\u6848"
112262
+ },
112263
+ {
112264
+ "terms": [
112265
+ "Summary",
112266
+ "\u5C0F\u7ED3"
112267
+ ],
112268
+ "content": "\u8981\u70B9\u56DE\u987E\u4E0E\u8BFE\u540E\u884C\u52A8"
112269
+ }
112270
+ ],
112271
+ "narrative": "\u7531\u6D45\u5165\u6DF1",
112272
+ "pages": {
112273
+ "min": 8,
112274
+ "max": 15
112275
+ },
112276
+ "researchFocus": [
112277
+ "\u6743\u5A01\u6559\u7A0B\u4E0E\u6807\u51C6",
112278
+ "\u5206\u6B65\u64CD\u4F5C\u793A\u4F8B",
112279
+ "\u5E38\u89C1\u9519\u8BEF\u4E0E\u6392\u9519",
112280
+ "\u7EC3\u4E60\u9898\u4E0E\u8003\u70B9"
112281
+ ],
112282
+ "motion": {
112283
+ "delivery": "read",
112284
+ "keywords": [
112285
+ "\u57F9\u8BAD",
112286
+ "training"
112287
+ ]
112288
+ }
112289
+ },
112290
+ {
112291
+ "id": "\u5927\u4F1A",
112292
+ "subtitle": "talk",
112293
+ "tone": [
112294
+ "\u89C2\u70B9\u9C9C\u660E",
112295
+ "\u542F\u53D1",
112296
+ "\u8BB0\u5FC6\u70B9"
112297
+ ],
112298
+ "density": [
112299
+ "\u7A00\u758F",
112300
+ "\u4E00\u56FE\u4E00\u53E5"
112301
+ ],
112302
+ "requiredSections": [
112303
+ {
112304
+ "terms": [
112305
+ "\u5F00\u573A\u94A9\u5B50"
112306
+ ],
112307
+ "content": "\u53CD\u5E38\u8BC6\u7684\u95EE\u9898\u3001\u6570\u636E\u6216\u6545\u4E8B\u5F00\u573A"
112308
+ },
112309
+ {
112310
+ "terms": [
112311
+ "\u6838\u5FC3\u8BBA\u70B9"
112312
+ ],
112313
+ "content": "\u4E00\u53E5\u8BDD\u89C2\u70B9\uFF0C\u5168\u573A\u53EA\u6B64\u4E00\u4E2A"
112314
+ },
112315
+ {
112316
+ "terms": [
112317
+ "\u8BBA\u636E",
112318
+ "\u6848\u4F8B"
112319
+ ],
112320
+ "content": "\u652F\u6491\u89C2\u70B9\u7684\u6848\u4F8B\u4E0E\u6570\u636E\uFF0C\u6CE8\u660E\u51FA\u5904"
112321
+ },
112322
+ {
112323
+ "terms": [
112324
+ "\u53CD\u76F4\u89C9\u6D1E\u5BDF"
112325
+ ],
112326
+ "content": "\u4E0E\u542C\u4F17\u76F4\u89C9\u76F8\u53CD\u7684\u53D1\u73B0\u53CA\u5176\u539F\u56E0"
112327
+ },
112328
+ {
112329
+ "terms": [
112330
+ "\u6536\u675F\u8BB0\u5FC6\u70B9"
112331
+ ],
112332
+ "content": "\u4E00\u53E5\u53EF\u88AB\u590D\u8FF0\u7684\u8BDD\u6536\u5C3E"
112333
+ }
112334
+ ],
112335
+ "narrative": "\u60C5\u7EEA\u7EBF / SCQA",
112336
+ "pages": {
112337
+ "min": 15,
112338
+ "max": 20
112339
+ },
112340
+ "researchFocus": [
112341
+ "\u53CD\u76F4\u89C9\u6570\u636E\u4E0E\u7814\u7A76",
112342
+ "\u4E89\u8BAE\u89C2\u70B9\u4E0E\u53CD\u4F8B",
112343
+ "\u4E00\u624B\u6848\u4F8B/\u5931\u8D25\u6559\u8BAD",
112344
+ "\u53EF\u5F15\u7528\u91D1\u53E5"
112345
+ ],
112346
+ "motion": {
112347
+ "delivery": "presented",
112348
+ "keywords": [
112349
+ "\u5927\u4F1A",
112350
+ "conference",
112351
+ "talk"
112352
+ ]
112353
+ }
112354
+ },
112355
+ {
112356
+ "id": "\u5DE5\u4F5C\u6C47\u62A5",
112357
+ "subtitle": "\u5468\u6708\u5B63\u62A5",
112358
+ "aliases": [
112359
+ "\u5468\u62A5",
112360
+ "\u6708\u62A5",
112361
+ "\u5B63\u62A5"
112362
+ ],
112363
+ "tone": [
112364
+ "\u5BA2\u89C2",
112365
+ "\u7B80\u6D01",
112366
+ "\u7ED3\u8BBA\u5148\u884C"
112367
+ ],
112368
+ "density": [
112369
+ "\u4E2D"
112370
+ ],
112371
+ "requiredSections": [
112372
+ {
112373
+ "terms": [
112374
+ "\u6982\u8981"
112375
+ ],
112376
+ "content": "\u672C\u671F\u7ED3\u8BBA\u4E00\u53E5\u8BDD + 2\u20133 \u4E2A\u5173\u952E\u6570"
112377
+ },
112378
+ {
112379
+ "terms": [
112380
+ "\u8FDB\u5C55",
112381
+ "\u6210\u679C"
112382
+ ],
112383
+ "content": "\u5B8C\u6210\u4E8B\u9879\u4E0E\u4EA7\u51FA\uFF0C\u5BF9\u7167\u8BA1\u5212"
112384
+ },
112385
+ {
112386
+ "terms": [
112387
+ "\u6570\u636E\u6307\u6807"
112388
+ ],
112389
+ "content": "\u5173\u952E\u6307\u6807\u73AF\u6BD4/\u540C\u6BD4\uFF0C\u53E3\u5F84\u4E00\u81F4\uFF1B\u5B9C \u6298\u7EBF\u6216\u67F1\u72B6"
112390
+ },
112391
+ {
112392
+ "terms": [
112393
+ "\u95EE\u9898"
112394
+ ],
112395
+ "content": "\u672A\u8FBE\u6210\u9879\u3001\u539F\u56E0\u3001\u9700\u8981\u7684\u652F\u6301"
112396
+ },
112397
+ {
112398
+ "terms": [
112399
+ "\u4E0B\u4E00\u6B65\u8BA1\u5212"
112400
+ ],
112401
+ "content": "\u4E0B\u671F\u76EE\u6807\u3001\u5173\u952E\u52A8\u4F5C\u3001\u65F6\u95F4\u70B9"
112402
+ }
112403
+ ],
112404
+ "narrative": "\u7ED3\u8BBA\u5148\u884C",
112405
+ "pages": {
112406
+ "min": 5,
112407
+ "max": 10
112408
+ },
112409
+ "researchFocus": [
112410
+ "\u884C\u4E1A\u57FA\u51C6\u4E0E\u540C\u884C\u6570\u636E",
112411
+ "\u6307\u6807\u53E3\u5F84\u5B9A\u4E49",
112412
+ "\u5916\u90E8\u73AF\u5883\u53D8\u5316"
112413
+ ],
112414
+ "motion": {
112415
+ "delivery": "read",
112416
+ "keywords": [
112417
+ "\u6C47\u62A5",
112418
+ "\u5468\u62A5",
112419
+ "\u6708\u62A5"
112420
+ ]
112421
+ }
112422
+ },
112423
+ {
112424
+ "id": "\u8FF0\u804C/\u664B\u5347",
112425
+ "tone": [
112426
+ "\u81EA\u4FE1",
112427
+ "\u6709\u636E",
112428
+ "\u4E2A\u4EBA\u89C6\u89D2"
112429
+ ],
112430
+ "density": [
112431
+ "\u4E2D"
112432
+ ],
112433
+ "requiredSections": [
112434
+ {
112435
+ "terms": [
112436
+ "\u804C\u8D23\u6982\u8FF0"
112437
+ ],
112438
+ "content": "\u5C97\u4F4D\u804C\u8D23\u4E0E\u8D1F\u8D23\u8303\u56F4"
112439
+ },
112440
+ {
112441
+ "terms": [
112442
+ "\u5173\u952E\u6210\u679C",
112443
+ "STAR"
112444
+ ],
112445
+ "content": "2\u20133 \u4E2A\u4EE3\u8868\u6027\u6210\u679C\uFF0C\u6309\u60C5\u5883-\u4EFB\u52A1-\u884C\u52A8-\u7ED3\u679C\u5199"
112446
+ },
112447
+ {
112448
+ "terms": [
112449
+ "\u6570\u636E\u4F50\u8BC1"
112450
+ ],
112451
+ "content": "\u6210\u679C\u7684\u91CF\u5316\u6570\u636E\u4E0E\u5BF9\u6BD4\u57FA\u51C6"
112452
+ },
112453
+ {
112454
+ "terms": [
112455
+ "\u80FD\u529B\u6210\u957F"
112456
+ ],
112457
+ "content": "\u76F8\u6BD4\u4E0A\u671F\u65B0\u589E\u7684\u80FD\u529B\uFF0C\u914D\u4E8B\u4F8B"
112458
+ },
112459
+ {
112460
+ "terms": [
112461
+ "\u89C4\u5212"
112462
+ ],
112463
+ "content": "\u4E0B\u4E00\u9636\u6BB5\u76EE\u6807\u4E0E\u8BA1\u5212"
112464
+ }
112465
+ ],
112466
+ "narrative": "\u7ED3\u8BBA\u5148\u884C",
112467
+ "pages": {
112468
+ "min": 8,
112469
+ "max": 12
112470
+ },
112471
+ "researchFocus": [
112472
+ "\u540C\u5C97\u4F4D\u80FD\u529B\u6A21\u578B",
112473
+ "\u884C\u4E1A\u5BF9\u6807\u6570\u636E",
112474
+ "\u8BE5\u9886\u57DF\u516C\u8BA4\u7684\u6210\u679C\u8861\u91CF\u53E3\u5F84"
112475
+ ],
112476
+ "motion": {
112477
+ "delivery": "read",
112478
+ "keywords": [
112479
+ "\u8FF0\u804C"
112480
+ ]
112481
+ }
112482
+ },
112483
+ {
112484
+ "id": "\u9879\u76EE\u7ACB\u9879/\u8BC4\u5BA1",
112485
+ "aliases": [
112486
+ "\u7ACB\u9879"
112487
+ ],
112488
+ "tone": [
112489
+ "\u4E25\u8C28",
112490
+ "\u8BF4\u670D"
112491
+ ],
112492
+ "density": [
112493
+ "\u4E2D\u504F\u5BC6"
112494
+ ],
112495
+ "requiredSections": [
112496
+ {
112497
+ "terms": [
112498
+ "\u80CC\u666F",
112499
+ "\u75DB\u70B9"
112500
+ ],
112501
+ "content": "\u4E3A\u4EC0\u4E48\u8981\u505A\uFF1A\u73B0\u72B6\u95EE\u9898\u4E0E\u4E0D\u505A\u7684\u4EE3\u4EF7"
112502
+ },
112503
+ {
112504
+ "terms": [
112505
+ "\u76EE\u6807"
112506
+ ],
112507
+ "content": "\u53EF\u8861\u91CF\u7684\u76EE\u6807\u4E0E\u9A8C\u6536\u6807\u51C6"
112508
+ },
112509
+ {
112510
+ "terms": [
112511
+ "\u65B9\u6848"
112512
+ ],
112513
+ "content": "\u65B9\u6848\u8981\u70B9\u4E0E\u5907\u9009\u65B9\u6848\u5BF9\u6BD4\uFF1B\u5B9C \u5BF9\u6BD4\u8868"
112514
+ },
112515
+ {
112516
+ "terms": [
112517
+ "\u8BA1\u5212",
112518
+ "\u91CC\u7A0B\u7891"
112519
+ ],
112520
+ "content": "\u9636\u6BB5\u5212\u5206\u3001\u91CC\u7A0B\u7891\u3001\u65F6\u95F4\uFF1B\u5B9C \u65F6\u95F4\u8F74"
112521
+ },
112522
+ {
112523
+ "terms": [
112524
+ "\u8D44\u6E90",
112525
+ "\u9884\u7B97"
112526
+ ],
112527
+ "content": "\u4EBA\u529B\u3001\u9884\u7B97\u3001\u5916\u90E8\u4F9D\u8D56\uFF1B\u5B9C \u8868\u683C"
112528
+ },
112529
+ {
112530
+ "terms": [
112531
+ "\u98CE\u9669"
112532
+ ],
112533
+ "content": "\u4E3B\u8981\u98CE\u9669\u3001\u6982\u7387\u5F71\u54CD\u3001\u5E94\u5BF9\u63AA\u65BD\uFF1B\u5B9C \u77E9\u9635"
112534
+ }
112535
+ ],
112536
+ "narrative": "\u95EE\u9898-\u65B9\u6848",
112537
+ "pages": {
112538
+ "min": 8,
112539
+ "max": 14
112540
+ },
112541
+ "researchFocus": [
112542
+ "\u540C\u7C7B\u9879\u76EE\u6295\u5165\u4EA7\u51FA",
112543
+ "\u6280\u672F\u65B9\u6848\u4E0E\u9009\u578B\u5BF9\u6BD4",
112544
+ "\u5408\u89C4\u4E0E\u98CE\u9669\u6848\u4F8B",
112545
+ "\u4EBA\u529B/\u9884\u7B97\u57FA\u51C6"
112546
+ ],
112547
+ "motion": {
112548
+ "delivery": "read",
112549
+ "keywords": [
112550
+ "\u8BC4\u5BA1",
112551
+ "review"
112552
+ ]
112553
+ }
112554
+ },
112555
+ {
112556
+ "id": "\u5E74\u5EA6\u603B\u7ED3/\u5E74\u4F1A",
112557
+ "aliases": [
112558
+ "\u5E74\u7EC8\u603B\u7ED3"
112559
+ ],
112560
+ "tone": [
112561
+ "\u632F\u594B",
112562
+ "\u4EEA\u5F0F\u611F"
112563
+ ],
112564
+ "density": [
112565
+ "\u7A00\u758F",
112566
+ "\u5927\u89C6\u89C9"
112567
+ ],
112568
+ "requiredSections": [
112569
+ {
112570
+ "terms": [
112571
+ "\u56DE\u987E",
112572
+ "\u9AD8\u5149"
112573
+ ],
112574
+ "content": "\u5E74\u5EA6\u9AD8\u5149\u65F6\u523B\uFF0C\u914D\u753B\u9762"
112575
+ },
112576
+ {
112577
+ "terms": [
112578
+ "\u5173\u952E\u6570\u636E"
112579
+ ],
112580
+ "content": "\u5168\u5E74\u6838\u5FC3\u6570\u636E\u4E0E\u589E\u957F\uFF1B\u5B9C \u5927\u6570\u5B57"
112581
+ },
112582
+ {
112583
+ "terms": [
112584
+ "\u91CC\u7A0B\u7891"
112585
+ ],
112586
+ "content": "\u6309\u65F6\u95F4\u6392\u5217\u7684\u5173\u952E\u8282\u70B9\uFF1B\u5B9C \u65F6\u95F4\u8F74"
112587
+ },
112588
+ {
112589
+ "terms": [
112590
+ "\u56E2\u961F"
112591
+ ],
112592
+ "content": "\u81F4\u8C22\u7684\u56E2\u961F\u4E0E\u4EBA\u7269\uFF0C\u914D\u6545\u4E8B"
112593
+ },
112594
+ {
112595
+ "terms": [
112596
+ "\u6765\u5E74\u5C55\u671B"
112597
+ ],
112598
+ "content": "\u6765\u5E74\u76EE\u6807\u4E0E\u65B9\u5411"
112599
+ }
112600
+ ],
112601
+ "narrative": "\u60C5\u7EEA\u7EBF",
112602
+ "pages": {
112603
+ "min": 12,
112604
+ "max": 20
112605
+ },
112606
+ "researchFocus": [
112607
+ "\u884C\u4E1A\u5E74\u5EA6\u5927\u4E8B",
112608
+ "\u540C\u884C\u91CC\u7A0B\u7891\u5BF9\u7167",
112609
+ "\u6765\u5E74\u8D8B\u52BF\u9884\u6D4B"
112610
+ ]
112611
+ },
112612
+ {
112613
+ "id": "\u5546\u4E1A\u8BA1\u5212\u4E66",
112614
+ "subtitle": "BP",
112615
+ "tone": [
112616
+ "\u81EA\u4FE1",
112617
+ "\u5168\u9762",
112618
+ "\u6570\u636E\u652F\u6491"
112619
+ ],
112620
+ "density": [
112621
+ "\u4E2D\u504F\u5BC6"
112622
+ ],
112623
+ "requiredSections": [
112624
+ {
112625
+ "terms": [
112626
+ "\u95EE\u9898"
112627
+ ],
112628
+ "content": "\u76EE\u6807\u7528\u6237\u7684\u75DB\u70B9\u4E0E\u89C4\u6A21"
112629
+ },
112630
+ {
112631
+ "terms": [
112632
+ "\u65B9\u6848"
112633
+ ],
112634
+ "content": "\u4EA7\u54C1\u5982\u4F55\u89E3\u51B3\uFF0C\u4E3A\u4EC0\u4E48\u662F\u73B0\u5728"
112635
+ },
112636
+ {
112637
+ "terms": [
112638
+ "\u5E02\u573A"
112639
+ ],
112640
+ "content": "\u5E02\u573A\u89C4\u6A21\u5206\u5C42\u4E0E\u589E\u901F\uFF0C\u6CE8\u660E\u6765\u6E90\uFF1B\u5B9C \u67F1\u72B6\u56FE"
112641
+ },
112642
+ {
112643
+ "terms": [
112644
+ "\u4EA7\u54C1"
112645
+ ],
112646
+ "content": "\u4EA7\u54C1\u5F62\u6001\u3001\u6838\u5FC3\u529F\u80FD\u3001\u5F53\u524D\u8FDB\u5C55"
112647
+ },
112648
+ {
112649
+ "terms": [
112650
+ "\u5546\u4E1A\u6A21\u5F0F"
112651
+ ],
112652
+ "content": "\u600E\u4E48\u8D5A\u94B1\uFF1A\u6536\u5165\u6765\u6E90\u3001\u5B9A\u4EF7\u3001\u5355\u4F4D\u7ECF\u6D4E"
112653
+ },
112654
+ {
112655
+ "terms": [
112656
+ "\u7ADE\u4E89"
112657
+ ],
112658
+ "content": "\u7ADE\u54C1\u683C\u5C40\u4E0E\u5DEE\u5F02\u5316\uFF1B\u5B9C \u77E9\u9635\u6216\u5BF9\u6BD4\u8868"
112659
+ },
112660
+ {
112661
+ "terms": [
112662
+ "\u8D22\u52A1\u9884\u6D4B"
112663
+ ],
112664
+ "content": "\u672A\u6765 3\u20135 \u5E74\u6536\u5165\u3001\u6210\u672C\u3001\u5229\u6DA6\u9884\u6D4B\u4E0E\u5173\u952E\u5047\u8BBE\uFF1B\u5B9C \u8868\u683C"
112665
+ },
112666
+ {
112667
+ "terms": [
112668
+ "\u56E2\u961F"
112669
+ ],
112670
+ "content": "\u6838\u5FC3\u56E2\u961F\u4E0E\u76F8\u5173\u7ECF\u5386"
112671
+ },
112672
+ {
112673
+ "terms": [
112674
+ "\u878D\u8D44"
112675
+ ],
112676
+ "key": true,
112677
+ "content": "\u878D\u8D44\u91D1\u989D\u3001\u51FA\u8BA9\u6BD4\u4F8B\u3001\u8D44\u91D1\u7528\u9014\u5360\u6BD4"
112678
+ }
112679
+ ],
112680
+ "narrative": "SCQA",
112681
+ "pages": {
112682
+ "min": 15,
112683
+ "max": 25
112684
+ },
112685
+ "researchFocus": [
112686
+ "\u5E02\u573A\u89C4\u6A21\u4E0E\u5206\u5C42",
112687
+ "\u7ADE\u4E89\u683C\u5C40\u4E0E\u4EFD\u989D",
112688
+ "\u5546\u4E1A\u6A21\u5F0F\u4E0E\u5355\u4F4D\u7ECF\u6D4E",
112689
+ "\u53EF\u6BD4\u516C\u53F8\u8D22\u52A1\u4E0E\u878D\u8D44"
112690
+ ]
112691
+ },
112692
+ {
112693
+ "id": "\u6295\u6807",
112694
+ "subtitle": "\u62DB\u6295\u6807",
112695
+ "tone": [
112696
+ "\u6B63\u5F0F",
112697
+ "\u8981\u7D20\u9F50\u5168",
112698
+ "\u5F97\u5206\u5BFC\u5411"
112699
+ ],
112700
+ "density": [
112701
+ "\u5BC6"
112702
+ ],
112703
+ "requiredSections": [
112704
+ {
112705
+ "terms": [
112706
+ "\u9700\u6C42\u7406\u89E3"
112707
+ ],
112708
+ "content": "\u5BF9\u62DB\u6807\u9700\u6C42\u4E0E\u8BC4\u5206\u70B9\u7684\u9010\u6761\u56DE\u5E94"
112709
+ },
112710
+ {
112711
+ "terms": [
112712
+ "\u65B9\u6848"
112713
+ ],
112714
+ "content": "\u6280\u672F\u65B9\u6848\u8981\u70B9\uFF0C\u5BF9\u5E94\u9700\u6C42\u6761\u76EE"
112715
+ },
112716
+ {
112717
+ "terms": [
112718
+ "\u56E2\u961F",
112719
+ "\u8D44\u8D28"
112720
+ ],
112721
+ "content": "\u9879\u76EE\u56E2\u961F\u914D\u7F6E\u4E0E\u8D44\u8D28\u8BC1\u4E66"
112722
+ },
112723
+ {
112724
+ "terms": [
112725
+ "\u6848\u4F8B\u4E1A\u7EE9"
112726
+ ],
112727
+ "content": "\u540C\u7C7B\u9879\u76EE\u4E1A\u7EE9\u3001\u5BA2\u6237\u3001\u89C4\u6A21"
112728
+ },
112729
+ {
112730
+ "terms": [
112731
+ "\u5B9E\u65BD\u8BA1\u5212"
112732
+ ],
112733
+ "content": "\u9636\u6BB5\u3001\u91CC\u7A0B\u7891\u3001\u5DE5\u671F\uFF1B\u5B9C \u65F6\u95F4\u8F74"
112734
+ },
112735
+ {
112736
+ "terms": [
112737
+ "\u62A5\u4EF7"
112738
+ ],
112739
+ "key": true,
112740
+ "content": "\u62A5\u4EF7\u603B\u989D\u4E0E\u5206\u9879\u660E\u7EC6\u3001\u4ED8\u6B3E\u65B9\u5F0F\uFF1B\u5B9C \u8868\u683C"
112741
+ },
112742
+ {
112743
+ "terms": [
112744
+ "\u552E\u540E"
112745
+ ],
112746
+ "content": "\u552E\u540E\u670D\u52A1\u5185\u5BB9\u3001\u54CD\u5E94\u65F6\u95F4\u3001\u8D28\u4FDD\u671F"
112747
+ }
112748
+ ],
112749
+ "narrative": "\u7ED3\u8BBA\u5148\u884C",
112750
+ "pages": {
112751
+ "min": 15,
112752
+ "max": 30
112753
+ },
112754
+ "researchFocus": [
112755
+ "\u62DB\u6807\u65B9\u80CC\u666F\u4E0E\u65E2\u5F80\u91C7\u8D2D",
112756
+ "\u8BC4\u5206\u529E\u6CD5\u4E0E\u8D44\u8D28\u8981\u6C42",
112757
+ "\u540C\u7C7B\u4E2D\u6807\u516C\u544A\u4E0E\u62A5\u4EF7\u533A\u95F4",
112758
+ "\u6807\u6746\u6848\u4F8B"
112759
+ ]
112760
+ },
112761
+ {
112762
+ "id": "\u653F\u52A1/\u515A\u653F\u6C47\u62A5",
112763
+ "aliases": [
112764
+ "\u653F\u52A1\u6C47\u62A5"
112765
+ ],
112766
+ "tone": [
112767
+ "\u4E25\u8083",
112768
+ "\u89C4\u8303"
112769
+ ],
112770
+ "density": [
112771
+ "\u4E2D\u504F\u5BC6"
112772
+ ],
112773
+ "requiredSections": [
112774
+ {
112775
+ "terms": [
112776
+ "\u80CC\u666F",
112777
+ "\u4F9D\u636E"
112778
+ ],
112779
+ "content": "\u653F\u7B56\u4F9D\u636E\u4E0E\u4E0A\u7EA7\u90E8\u7F72\uFF0C\u5F15\u539F\u6587\u51FA\u5904"
112780
+ },
112781
+ {
112782
+ "terms": [
112783
+ "\u5DE5\u4F5C\u4E3E\u63AA"
112784
+ ],
112785
+ "content": "\u91C7\u53D6\u7684\u4E3B\u8981\u63AA\u65BD\uFF0C\u5206\u6761\u5217\u51FA"
112786
+ },
112787
+ {
112788
+ "terms": [
112789
+ "\u6210\u6548\u6570\u636E"
112790
+ ],
112791
+ "content": "\u91CF\u5316\u6210\u6548\u4E0E\u540C\u6BD4\uFF0C\u6CE8\u660E\u53E3\u5F84\uFF1B\u5B9C \u8868\u683C"
112792
+ },
112793
+ {
112794
+ "terms": [
112795
+ "\u5B58\u5728\u95EE\u9898"
112796
+ ],
112797
+ "content": "\u5B58\u5728\u7684\u95EE\u9898\u4E0E\u539F\u56E0\u5206\u6790"
112798
+ },
112799
+ {
112800
+ "terms": [
112801
+ "\u4E0B\u6B65\u90E8\u7F72"
112802
+ ],
112803
+ "content": "\u4E0B\u4E00\u6B65\u5DE5\u4F5C\u5B89\u6392\u4E0E\u65F6\u95F4\u8282\u70B9"
112804
+ }
112805
+ ],
112806
+ "narrative": "\u7ED3\u8BBA\u5148\u884C",
112807
+ "pages": {
112808
+ "min": 8,
112809
+ "max": 15
112810
+ },
112811
+ "researchFocus": [
112812
+ "\u653F\u7B56\u6587\u4EF6\u4E0E\u4F9D\u636E\u539F\u6587",
112813
+ "\u4E0A\u7EA7\u90E8\u7F72\u53E3\u5F84",
112814
+ "\u540C\u7EA7\u5730\u533A\u505A\u6CD5",
112815
+ "\u516C\u5F00\u7EDF\u8BA1\u6570\u636E"
112816
+ ],
112817
+ "motion": {
112818
+ "delivery": "read",
112819
+ "keywords": [
112820
+ "\u6C47\u62A5"
112821
+ ]
112822
+ }
112823
+ },
112824
+ {
112825
+ "id": "\u516C\u53F8/\u4EA7\u54C1\u4ECB\u7ECD",
112826
+ "aliases": [
112827
+ "\u516C\u53F8\u4ECB\u7ECD"
112828
+ ],
112829
+ "tone": [
112830
+ "\u54C1\u724C",
112831
+ "\u81EA\u4FE1",
112832
+ "\u5229\u76CA\u5BFC\u5411"
112833
+ ],
112834
+ "density": [
112835
+ "\u4E2D",
112836
+ "\u91CD\u89C6\u89C9"
112837
+ ],
112838
+ "requiredSections": [
112839
+ {
112840
+ "terms": [
112841
+ "\u516C\u53F8",
112842
+ "\u613F\u666F"
112843
+ ],
112844
+ "content": "\u516C\u53F8\u662F\u8C01\u3001\u613F\u666F\u4E00\u53E5\u8BDD\u3001\u5173\u952E\u80CC\u666F\u6570\u636E"
112845
+ },
112846
+ {
112847
+ "terms": [
112848
+ "\u6838\u5FC3\u80FD\u529B"
112849
+ ],
112850
+ "content": "\u6838\u5FC3\u6280\u672F\u6216\u80FD\u529B\uFF0C\u4E0E\u540C\u884C\u7684\u5DEE\u5F02"
112851
+ },
112852
+ {
112853
+ "terms": [
112854
+ "\u4EA7\u54C1",
112855
+ "\u65B9\u6848"
112856
+ ],
112857
+ "content": "\u4EA7\u54C1\u6216\u65B9\u6848\u7EC4\u5408\u4E0E\u9002\u7528\u573A\u666F"
112858
+ },
112859
+ {
112860
+ "terms": [
112861
+ "\u6807\u6746\u6848\u4F8B"
112862
+ ],
112863
+ "content": "\u6807\u6746\u5BA2\u6237\u4E0E\u91CF\u5316\u6210\u679C"
112864
+ },
112865
+ {
112866
+ "terms": [
112867
+ "\u6570\u636E"
112868
+ ],
112869
+ "content": "\u89C4\u6A21\u3001\u5BA2\u6237\u6570\u3001\u589E\u957F\u7B49\u53EF\u516C\u5F00\u6570\u636E\uFF1B\u5B9C \u5927\u6570\u5B57"
112870
+ },
112871
+ {
112872
+ "terms": [
112873
+ "\u5408\u4F5C\u9080\u8BF7"
112874
+ ],
112875
+ "content": "\u5408\u4F5C\u65B9\u5F0F\u4E0E\u8054\u7CFB\u65B9\u5F0F"
112876
+ }
112877
+ ],
112878
+ "narrative": "\u95EE\u9898-\u65B9\u6848",
112879
+ "pages": {
112880
+ "min": 8,
112881
+ "max": 15
112882
+ },
112883
+ "researchFocus": [
112884
+ "\u884C\u4E1A\u5730\u4F4D\u4E0E\u7B2C\u4E09\u65B9\u62A5\u544A",
112885
+ "\u7ADE\u54C1\u5BF9\u6BD4",
112886
+ "\u53EF\u516C\u5F00\u5F15\u7528\u7684\u5BA2\u6237\u6848\u4F8B",
112887
+ "\u884C\u4E1A\u8D8B\u52BF"
112888
+ ]
112889
+ },
112890
+ {
112891
+ "id": "\u4EA7\u54C1\u8C03\u7814",
112892
+ "subtitle": "\u7ADE\u54C1\u5206\u6790 \u5E02\u573A\u7814\u7A76",
112893
+ "tone": [
112894
+ "\u5BA2\u89C2",
112895
+ "\u6709\u636E",
112896
+ "\u4E0D\u66FF\u7ED3\u8BBA\u4E0B\u5224\u65AD"
112897
+ ],
112898
+ "density": [
112899
+ "\u4E2D"
112900
+ ],
112901
+ "requiredSections": [
112902
+ {
112903
+ "terms": [
112904
+ "\u5E02\u573A\u89C4\u6A21"
112905
+ ],
112906
+ "content": "\u5E02\u573A\u89C4\u6A21\u4E0E\u589E\u901F\uFF0C\u6CE8\u660E\u6765\u6E90\u5E74\u4EFD\uFF1B\u5B9C \u67F1\u72B6\u56FE"
112907
+ },
112908
+ {
112909
+ "terms": [
112910
+ "\u7ADE\u54C1\u683C\u5C40"
112911
+ ],
112912
+ "content": "\u4E3B\u8981\u7ADE\u54C1\u7684\u5B9A\u4F4D\u3001\u529F\u80FD\u3001\u5B9A\u4EF7\u3001\u4EFD\u989D\uFF1B\u5B9C \u5BF9\u6BD4\u8868"
112913
+ },
112914
+ {
112915
+ "terms": [
112916
+ "\u7528\u6237\u9700\u6C42"
112917
+ ],
112918
+ "content": "\u7528\u6237\u7684\u6838\u5FC3\u9700\u6C42\u4E0E\u75DB\u70B9\uFF0C\u5F15\u7528\u8BC4\u4EF7\u539F\u8BDD"
112919
+ },
112920
+ {
112921
+ "terms": [
112922
+ "\u5DEE\u8DDD\u4E0E\u673A\u4F1A"
112923
+ ],
112924
+ "content": "\u7ADE\u54C1\u672A\u6EE1\u8DB3\u7684\u9700\u6C42\u4E0E\u6211\u4EEC\u7684\u673A\u4F1A"
112925
+ },
112926
+ {
112927
+ "terms": [
112928
+ "\u7ED3\u8BBA\u5EFA\u8BAE"
112929
+ ],
112930
+ "content": "\u57FA\u4E8E\u4E0A\u8FF0\u4E8B\u5B9E\u7684\u5224\u65AD\u4E0E\u5EFA\u8BAE"
112931
+ }
112932
+ ],
112933
+ "narrative": "\u5148\u6446\u4E8B\u5B9E\uFF0C\u518D\u7ED9\u5224\u65AD",
112934
+ "pages": {
112935
+ "min": 10,
112936
+ "max": 15
112937
+ },
112938
+ "researchFocus": [
112939
+ "\u5E02\u573A\u89C4\u6A21\u4E0E\u589E\u901F",
112940
+ "\u7ADE\u54C1\u529F\u80FD\u4E0E\u5B9A\u4EF7\u5BF9\u6BD4",
112941
+ "\u7528\u6237\u8BC4\u4EF7\u4E0E\u5DEE\u8BC4",
112942
+ "\u6E20\u9053\u4E0E\u4EFD\u989D\u6570\u636E"
112943
+ ],
112944
+ "motion": {
112945
+ "delivery": "read",
112946
+ "keywords": [
112947
+ "\u8C03\u7814",
112948
+ "research"
112949
+ ]
112950
+ }
112951
+ },
112952
+ {
112953
+ "id": "\u4F1A\u8BAE\u7EAA\u8981",
112954
+ "subtitle": "\u4F1A\u540E\u540C\u6B65",
112955
+ "tone": [
112956
+ "\u7B80\u6D01",
112957
+ "\u53EF\u6267\u884C",
112958
+ "\u4E0D\u590D\u8FF0\u8FC7\u7A0B"
112959
+ ],
112960
+ "density": [
112961
+ "\u4F4E"
112962
+ ],
112963
+ "requiredSections": [
112964
+ {
112965
+ "terms": [
112966
+ "\u8BAE\u9898"
112967
+ ],
112968
+ "content": "\u8BA8\u8BBA\u7684\u8BAE\u9898\u6E05\u5355"
112969
+ },
112970
+ {
112971
+ "terms": [
112972
+ "\u7ED3\u8BBA"
112973
+ ],
112974
+ "content": "\u6BCF\u4E2A\u8BAE\u9898\u7684\u7ED3\u8BBA"
112975
+ },
112976
+ {
112977
+ "terms": [
112978
+ "\u5F85\u529E"
112979
+ ],
112980
+ "content": "\u5F85\u529E\u4E8B\u9879\u3001\u8D1F\u8D23\u4EBA\u3001\u622A\u6B62\u65F6\u95F4\uFF1B\u5B9C \u8868\u683C"
112981
+ },
112982
+ {
112983
+ "terms": [
112984
+ "\u5F85\u51B3\u4E8B\u9879"
112985
+ ],
112986
+ "content": "\u672A\u51B3\u4E8B\u9879\u4E0E\u5F85\u51B3\u4EBA"
112987
+ }
112988
+ ],
112989
+ "narrative": "\u7ED3\u8BBA\u5148\u884C",
112990
+ "pages": {
112991
+ "min": 4,
112992
+ "max": 8
112993
+ },
112994
+ "researchFocus": [
112995
+ "\u8BAE\u9898\u6D89\u53CA\u7684\u5916\u90E8\u4E8B\u5B9E",
112996
+ "\u76F8\u5173\u53E3\u5F84\u4E0E\u5B9A\u4E49",
112997
+ "\u540C\u7C7B\u51B3\u7B56\u7684\u516C\u5F00\u5148\u4F8B"
112998
+ ],
112999
+ "motion": {
113000
+ "delivery": "read",
113001
+ "keywords": [
113002
+ "\u7EAA\u8981",
113003
+ "minutes"
113004
+ ]
113005
+ }
113006
+ },
113007
+ {
113008
+ "id": "\u6570\u636E\u5206\u6790",
113009
+ "subtitle": "\u6570\u636E\u89E3\u8BFB \u6307\u6807\u590D\u76D8",
113010
+ "tone": [
113011
+ "\u7ED3\u8BBA\u5148\u884C",
113012
+ "\u53EF\u8FFD\u6EAF"
113013
+ ],
113014
+ "density": [
113015
+ "\u4E2D"
113016
+ ],
113017
+ "requiredSections": [
113018
+ {
113019
+ "terms": [
113020
+ "\u7ED3\u8BBA"
113021
+ ],
113022
+ "content": "\u4E00\u53E5\u8BDD\u7ED3\u8BBA\u4E0E\u5173\u952E\u6570\u5B57\uFF1B\u5B9C \u5927\u6570\u5B57"
113023
+ },
113024
+ {
113025
+ "terms": [
113026
+ "\u53E3\u5F84\u4E0E\u6570\u636E\u6E90"
113027
+ ],
113028
+ "content": "\u6307\u6807\u5B9A\u4E49\u3001\u6570\u636E\u6765\u6E90\u3001\u65F6\u95F4\u8303\u56F4"
113029
+ },
113030
+ {
113031
+ "terms": [
113032
+ "\u7EF4\u5EA6\u62C6\u89E3"
113033
+ ],
113034
+ "content": "\u6309\u7EF4\u5EA6\u62C6\u89E3\u7684\u5206\u5E03\u4E0E\u53D8\u5316\uFF1B\u5B9C \u67F1\u72B6\u6216\u6298\u7EBF"
113035
+ },
113036
+ {
113037
+ "terms": [
113038
+ "\u5F52\u56E0"
113039
+ ],
113040
+ "content": "\u53D8\u5316\u7684\u4E3B\u8981\u539F\u56E0\u53CA\u5176\u8D21\u732E"
113041
+ },
113042
+ {
113043
+ "terms": [
113044
+ "\u5EFA\u8BAE"
113045
+ ],
113046
+ "content": "\u57FA\u4E8E\u5F52\u56E0\u7684\u53EF\u6267\u884C\u5EFA\u8BAE"
113047
+ }
113048
+ ],
113049
+ "narrative": "\u7ED3\u8BBA\u5148\u884C",
113050
+ "pages": {
113051
+ "min": 6,
113052
+ "max": 10
113053
+ },
113054
+ "researchFocus": [
113055
+ "\u6307\u6807\u53E3\u5F84\u5B9A\u4E49",
113056
+ "\u884C\u4E1A\u57FA\u51C6\u503C",
113057
+ "\u540C\u7C7B\u5F52\u56E0\u6848\u4F8B\u4E0E\u65B9\u6CD5"
113058
+ ],
113059
+ "motion": {
113060
+ "delivery": "read",
113061
+ "keywords": [
113062
+ "\u5206\u6790",
113063
+ "analysis"
113064
+ ]
113065
+ }
113066
+ }
113067
+ ],
113068
+ "narratives": [
113069
+ {
113070
+ "deckType": "\u62A5\u544A/\u603B\u7ED3",
113071
+ "structure": "\u7ED3\u8BBA\u5148\u884C",
113072
+ "flow": [
113073
+ "\u7ED3\u8BBA",
113074
+ "\u8BC1\u636E",
113075
+ "\u7EC6\u8282",
113076
+ "\u4E0B\u4E00\u6B65"
113077
+ ]
113078
+ },
113079
+ {
113080
+ "deckType": "\u4EA7\u54C1/\u9500\u552E",
113081
+ "structure": "\u95EE\u9898-\u65B9\u6848",
113082
+ "flow": [
113083
+ "\u75DB\u70B9",
113084
+ "\u65B9\u6848",
113085
+ "\u4EF7\u503C",
113086
+ "\u4F50\u8BC1",
113087
+ "CTA"
113088
+ ]
113089
+ },
113090
+ {
113091
+ "deckType": "\u57F9\u8BAD/\u6559\u5B66",
113092
+ "structure": "\u7531\u6D45\u5165\u6DF1",
113093
+ "flow": [
113094
+ "\u57FA\u7840",
113095
+ "\u6838\u5FC3",
113096
+ "\u8FDB\u9636",
113097
+ "\u7EC3\u4E60"
113098
+ ]
113099
+ },
113100
+ {
113101
+ "deckType": "\u878D\u8D44/\u8DEF\u6F14",
113102
+ "structure": "SCQA",
113103
+ "flow": [
113104
+ "\u60C5\u5883",
113105
+ "\u51B2\u7A81",
113106
+ "\u95EE\u9898",
113107
+ "\u89E3\u7B54"
113108
+ ]
113109
+ },
113110
+ {
113111
+ "deckType": "\u6D3B\u52A8/\u5BA3\u4F20",
113112
+ "structure": "\u60C5\u7EEA\u7EBF",
113113
+ "flow": [
113114
+ "\u94A9\u5B50",
113115
+ "\u5171\u9E23",
113116
+ "\u9AD8\u6F6E",
113117
+ "\u884C\u52A8"
113118
+ ]
113119
+ }
113120
+ ],
113121
+ "styleBias": [
113122
+ {
113123
+ "tones": [
113124
+ "\u5F20\u529B",
113125
+ "\u60C5\u7EEA"
113126
+ ],
113127
+ "scenarios": [
113128
+ "pitch",
113129
+ "\u53D1\u5E03\u4F1A",
113130
+ "\u5927\u4F1A"
113131
+ ],
113132
+ "look": "\u6DF1\u8272\u9177\u70AB",
113133
+ "styles": [
113134
+ "cool",
113135
+ "apple",
113136
+ "black-gold"
113137
+ ]
113138
+ },
113139
+ {
113140
+ "tones": [
113141
+ "\u52A1\u5B9E"
113142
+ ],
113143
+ "scenarios": [
113144
+ "\u5185\u5BA1",
113145
+ "\u9500\u552E"
113146
+ ],
113147
+ "look": "\u767D\u5E95\u54A8\u8BE2",
113148
+ "styles": [
113149
+ "mckinsey"
113150
+ ]
113151
+ },
113152
+ {
113153
+ "tones": [
113154
+ "\u6E05\u6670"
113155
+ ],
113156
+ "scenarios": [
113157
+ "\u8BB2\u5EA7",
113158
+ "\u57F9\u8BAD"
113159
+ ],
113160
+ "look": "\u4E2D\u6027/\u6559\u80B2\u98CE",
113161
+ "styles": []
113162
+ }
113163
+ ],
113164
+ "motionExtraKeywords": {
113165
+ "presented": [
113166
+ "\u4E3B\u9898\u6F14\u8BB2"
113167
+ ],
113168
+ "read": [
113169
+ "\u62A5\u544A",
113170
+ "report",
113171
+ "\u8BB2\u4E49",
113172
+ "handout"
113173
+ ]
113174
+ }
113175
+ };
113176
+
113177
+ // packages/core/dist/document/deck-catalog.js
113178
+ var SCENARIO_IDS = new Set(SCENARIO_MATRIX.scenarios.map((s) => s.id));
113179
+ var KINDS = ["skin", "pack"];
113180
+ var MODES = ["light", "dark"];
113181
+ var RENDER_MODES = ["classic-v1", "theme-v2"];
113182
+ var ID_RE = /^[a-z0-9][a-z0-9-]*$/;
113183
+ var COMMIT_RE = /^[0-9a-f]{7,40}$/;
113184
+ function isStr(v) {
113185
+ return typeof v === "string" && v.length > 0;
113186
+ }
113187
+ function isStrArr(v) {
113188
+ return Array.isArray(v) && v.every((x) => typeof x === "string");
113189
+ }
113190
+ function parseCatalog(raw) {
113191
+ const errors = [];
113192
+ const o = raw;
113193
+ if (!o || typeof o !== "object")
113194
+ return { catalog: null, errors: ["catalog is not an object"] };
113195
+ const groups = [];
113196
+ const rawGroups = Array.isArray(o.groups) ? o.groups : [];
113197
+ if (!Array.isArray(o.groups))
113198
+ errors.push("catalog.groups must be an array");
113199
+ rawGroups.forEach((g, i) => {
113200
+ const at = `group[${i}]`;
113201
+ if (!isStr(g?.id) || !ID_RE.test(g.id))
113202
+ errors.push(`${at}: bad id`);
113203
+ if (!isStr(g?.name_cn))
113204
+ errors.push(`${at}: missing name_cn`);
113205
+ if (!isStr(g?.sample))
113206
+ errors.push(`${at}: missing sample`);
113207
+ if (!isStrArr(g?.scenarios))
113208
+ errors.push(`${at}: scenarios must be a string array`);
113209
+ if (isStr(g?.id) && isStr(g?.name_cn) && isStr(g?.sample) && isStrArr(g?.scenarios)) {
113210
+ groups.push({ id: g.id, name_cn: g.name_cn, sample: g.sample, scenarios: g.scenarios });
113211
+ }
113212
+ });
113213
+ const collections = [];
113214
+ const rawCollections = o.collections === void 0 ? [] : Array.isArray(o.collections) ? o.collections : [];
113215
+ if (o.collections !== void 0 && !Array.isArray(o.collections))
113216
+ errors.push("catalog.collections must be an array when present");
113217
+ rawCollections.forEach((c, i) => {
113218
+ const at = `collection[${i}]`;
113219
+ const before = errors.length;
113220
+ if (!isStr(c?.id) || !ID_RE.test(c.id))
113221
+ errors.push(`${at}: bad id`);
113222
+ if (!isStr(c?.name_cn))
113223
+ errors.push(`${at}: missing name_cn`);
113224
+ if (!isStr(c?.renderMode) || !RENDER_MODES.includes(c.renderMode))
113225
+ errors.push(`${at}: bad renderMode`);
113226
+ if (!isStrArr(c?.entryIds) || c.entryIds.length === 0)
113227
+ errors.push(`${at}: entryIds must be a non-empty string array`);
113228
+ if (c?.sourceCommit !== void 0 && (!isStr(c.sourceCommit) || !COMMIT_RE.test(c.sourceCommit)))
113229
+ errors.push(`${at}: bad sourceCommit`);
113230
+ if (c?.renderMode === "classic-v1" && c?.sourceCommit === void 0)
113231
+ errors.push(`${at}: classic-v1 requires sourceCommit`);
113232
+ if (errors.length === before) {
113233
+ collections.push({
113234
+ id: c.id,
113235
+ name_cn: c.name_cn,
113236
+ renderMode: c.renderMode,
113237
+ entryIds: c.entryIds,
113238
+ ...c.sourceCommit !== void 0 ? { sourceCommit: c.sourceCommit } : {}
113239
+ });
113240
+ }
113241
+ });
113242
+ const entries = [];
113243
+ const rawEntries = Array.isArray(o.entries) ? o.entries : [];
113244
+ if (!Array.isArray(o.entries))
113245
+ errors.push("catalog.entries must be an array");
113246
+ rawEntries.forEach((e, i) => {
113247
+ const at = `entry[${i}]${isStr(e?.id) ? ` (${e.id})` : ""}`;
113248
+ const before = errors.length;
113249
+ if (!isStr(e?.id) || !ID_RE.test(e.id))
113250
+ errors.push(`${at}: bad id`);
113251
+ if (!isStr(e?.kind) || !KINDS.includes(e.kind))
113252
+ errors.push(`${at}: kind must be "skin" or "pack"`);
113253
+ if (!isStr(e?.group))
113254
+ errors.push(`${at}: missing group`);
113255
+ if (!isStr(e?.name_cn))
113256
+ errors.push(`${at}: missing name_cn`);
113257
+ if (!isStr(e?.oneliner))
113258
+ errors.push(`${at}: missing oneliner`);
113259
+ if (!isStrArr(e?.scenarios))
113260
+ errors.push(`${at}: scenarios must be a string array`);
113261
+ if (!isStr(e?.mode) || !MODES.includes(e.mode))
113262
+ errors.push(`${at}: mode must be "light" or "dark"`);
113263
+ if (!isStr(e?.sample))
113264
+ errors.push(`${at}: missing sample`);
113265
+ if (e?.motion !== void 0 && !isStr(e.motion))
113266
+ errors.push(`${at}: motion must be a string when present`);
113267
+ if (e?.use_cases !== void 0) {
113268
+ if (!isStrArr(e.use_cases))
113269
+ errors.push(`${at}: use_cases must be a string array`);
113270
+ else
113271
+ for (const uc of e.use_cases)
113272
+ if (!SCENARIO_IDS.has(uc))
113273
+ errors.push(`${at}: use_cases "${uc}" is not a scenarios.json id`);
113274
+ }
113275
+ if (errors.length === before) {
113276
+ entries.push({
113277
+ id: e.id,
113278
+ kind: e.kind,
113279
+ group: e.group,
113280
+ name_cn: e.name_cn,
113281
+ oneliner: e.oneliner,
113282
+ scenarios: e.scenarios,
113283
+ mode: e.mode,
113284
+ sample: e.sample,
113285
+ ...e.motion !== void 0 ? { motion: e.motion } : {},
113286
+ ...isStrArr(e.use_cases) ? { use_cases: e.use_cases } : {}
113287
+ });
113288
+ }
113289
+ });
113290
+ let fallbackEntryIds;
113291
+ if (o.fallbackEntryIds !== void 0) {
113292
+ if (!isStrArr(o.fallbackEntryIds))
113293
+ errors.push("fallbackEntryIds must be a string array");
113294
+ else {
113295
+ const ids = new Set(entries.map((e) => e.id));
113296
+ for (const id of o.fallbackEntryIds)
113297
+ if (!ids.has(id))
113298
+ errors.push(`fallbackEntryIds: "${id}" is not a registered entry`);
113299
+ fallbackEntryIds = o.fallbackEntryIds;
113300
+ }
113301
+ }
113302
+ return {
113303
+ catalog: errors.length ? null : { groups, ...collections.length ? { collections } : {}, entries, ...fallbackEntryIds ? { fallbackEntryIds } : {} },
113304
+ errors
113305
+ };
113306
+ }
113307
+ function resolveEntry(catalog, id) {
113308
+ return catalog.entries.find((e) => e.id === id) ?? null;
113309
+ }
113310
+ function assetDirOf(entry) {
113311
+ return entry.kind === "skin" ? `styles/${entry.id}` : `packs/${entry.id}`;
113312
+ }
113313
+ function cssFileOf(entry) {
113314
+ return entry.kind === "skin" ? "skin.css" : "pack.css";
113315
+ }
113316
+
113317
+ // apps/admin/data/skills.lib/document/bin-src/lib/user-styles.mjs
113318
+ var import_node_fs = require("node:fs");
113319
+ var import_node_path4 = require("node:path");
113320
+ var SAFE_NAME = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
113321
+ function userStylesDir() {
113322
+ return process.env.TALOS_DOC_STYLES_DIR?.trim() || null;
113323
+ }
113324
+ function userSkinDir(name) {
113325
+ const root = userStylesDir();
113326
+ if (!root || !SAFE_NAME.test(name)) return null;
113327
+ const dir = (0, import_node_path4.join)(root, "styles", name);
113328
+ return (0, import_node_fs.existsSync)((0, import_node_path4.join)(dir, "skin.css")) ? dir : null;
113329
+ }
113330
+ function userThemePath(name) {
113331
+ const root = userStylesDir();
113332
+ const base = name.replace(/\.json$/i, "");
113333
+ if (!root || !SAFE_NAME.test(base)) return null;
113334
+ const path = (0, import_node_path4.join)(root, "themes", `${base}.json`);
113335
+ return (0, import_node_fs.existsSync)(path) ? path : null;
113336
+ }
113337
+
111169
113338
  // apps/admin/data/skills.lib/document/bin-src/doc-gen.mjs
111170
113339
  function die(msg, code = 1) {
111171
113340
  process.stderr.write(`doc-gen: ${msg}
@@ -111173,13 +113342,13 @@ function die(msg, code = 1) {
111173
113342
  process.exit(code);
111174
113343
  }
111175
113344
  async function writeArtifactAtomically(out, bytes) {
111176
- const temp = (0, import_node_path3.join)((0, import_node_path3.dirname)(out), `.${(0, import_node_path3.basename)(out)}.${process.pid}.${(0, import_node_crypto.randomUUID)()}.tmp`);
113345
+ const temp = (0, import_node_path5.join)((0, import_node_path5.dirname)(out), `.${(0, import_node_path5.basename)(out)}.${process.pid}.${(0, import_node_crypto.randomUUID)()}.tmp`);
111177
113346
  try {
111178
- await (0, import_promises2.writeFile)(temp, Buffer.from(bytes), { flag: "wx" });
111179
- await (0, import_promises2.rename)(temp, out);
113347
+ await (0, import_promises3.writeFile)(temp, Buffer.from(bytes), { flag: "wx" });
113348
+ await (0, import_promises3.rename)(temp, out);
111180
113349
  } catch (error) {
111181
113350
  try {
111182
- await (0, import_promises2.rm)(temp, { force: true });
113351
+ await (0, import_promises3.rm)(temp, { force: true });
111183
113352
  } catch (cleanupError) {
111184
113353
  process.stderr.write(`doc-gen: cleanup failed for ${temp}: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}
111185
113354
  `);
@@ -111191,17 +113360,13 @@ async function renderPdfViaService(spec, theme) {
111191
113360
  const url = process.env.TALOS_PDF_URL;
111192
113361
  if (!url) return null;
111193
113362
  const token = process.env.TALOS_PDF_TOKEN;
111194
- const print = themePrintOptions(theme, spec.title);
111195
113363
  try {
111196
- if (print && /[一-鿿぀-ヿ]/.test(`${print.headerTemplate}${print.footerTemplate}`)) {
111197
- process.stderr.write("doc-gen: warning: CJK in page header/footer may render blank (Chromium print-template limitation); prefer Latin/digits there\n");
111198
- }
111199
113364
  const res = await fetch(url, {
111200
113365
  method: "POST",
111201
113366
  headers: { "content-type": "application/json", ...token ? { authorization: `Bearer ${token}` } : {} },
111202
113367
  // The service injects a CJK @font-face (Chromium can't load system CJK
111203
- // fonts in printToPDF); the bin sends themed HTML + print header/footer.
111204
- body: JSON.stringify({ html: specToHtml(spec, theme), ...print ?? {} })
113368
+ // fonts in printToPDF); the bin sends themed body HTML; labels are added after pagination.
113369
+ body: JSON.stringify({ html: specToHtml(spec, theme) })
111205
113370
  });
111206
113371
  if (!res.ok) {
111207
113372
  process.stderr.write(`doc-gen: pdf service HTTP ${res.status}; trying headless Chromium
@@ -111237,6 +113402,7 @@ async function main() {
111237
113402
  themePath = args[themeIdx + 1];
111238
113403
  if (!themePath) die("--theme needs a path to a theme.json", 64);
111239
113404
  args.splice(themeIdx, 2);
113405
+ if (!(0, import_node_fs2.existsSync)(themePath)) themePath = userThemePath(themePath) ?? themePath;
111240
113406
  }
111241
113407
  const topicFlag = takeFlag(args, "--topic");
111242
113408
  const paletteFlag = takeFlag(args, "--palette");
@@ -111250,7 +113416,7 @@ async function main() {
111250
113416
  if (kind === "pptx") die(DECKS_ARE_HTML2PPTX, 64);
111251
113417
  let spec;
111252
113418
  try {
111253
- spec = JSON.parse(await (0, import_promises2.readFile)(specPath, "utf-8"));
113419
+ spec = JSON.parse(await (0, import_promises3.readFile)(specPath, "utf-8"));
111254
113420
  } catch (e) {
111255
113421
  die(`bad spec: ${e.message}`, 64);
111256
113422
  }
@@ -111264,7 +113430,7 @@ async function main() {
111264
113430
  let rawTheme = spec.theme;
111265
113431
  if (themePath) {
111266
113432
  try {
111267
- rawTheme = JSON.parse(await (0, import_promises2.readFile)(themePath, "utf-8"));
113433
+ rawTheme = JSON.parse(await (0, import_promises3.readFile)(themePath, "utf-8"));
111268
113434
  } catch (e) {
111269
113435
  die(`bad theme: ${e.message}`, 64);
111270
113436
  }
@@ -111272,17 +113438,26 @@ async function main() {
111272
113438
  } else if (accentFlag || styleFlag) {
111273
113439
  let accent = accentFlag;
111274
113440
  if (!accent && styleFlag) {
111275
- const skillDir = (0, import_node_path3.dirname)((0, import_node_path3.dirname)(process.argv[1] || ""));
111276
- const styleDir = (0, import_node_fs2.existsSync)((0, import_node_path3.join)(styleFlag, "skin.css")) ? styleFlag : (0, import_node_path3.join)(skillDir, "styles", styleFlag);
111277
- const skinPath = (0, import_node_path3.join)(styleDir, "skin.css");
113441
+ const skillDir = (0, import_node_path5.dirname)((0, import_node_path5.dirname)(process.argv[1] || ""));
113442
+ let skinPath = (0, import_node_path5.join)(styleFlag, "skin.css");
113443
+ if (!(0, import_node_fs2.existsSync)(skinPath)) {
113444
+ const user = userSkinDir(styleFlag);
113445
+ skinPath = user ? (0, import_node_path5.join)(user, "skin.css") : (0, import_node_path5.join)(skillDir, "styles", styleFlag, "skin.css");
113446
+ try {
113447
+ const { catalog } = parseCatalog(JSON.parse(await (0, import_promises3.readFile)((0, import_node_path5.join)(skillDir, "catalog.json"), "utf-8")));
113448
+ const entry = catalog ? resolveEntry(catalog, styleFlag) : null;
113449
+ if (entry) skinPath = (0, import_node_path5.join)(skillDir, assetDirOf(entry), cssFileOf(entry));
113450
+ } catch {
113451
+ }
113452
+ }
111278
113453
  let skinCss;
111279
113454
  try {
111280
- skinCss = await (0, import_promises2.readFile)(skinPath, "utf-8");
113455
+ skinCss = await (0, import_promises3.readFile)(skinPath, "utf-8");
111281
113456
  } catch {
111282
113457
  die(`--style: cannot read ${skinPath}`, 66);
111283
113458
  }
111284
113459
  accent = skinAccentColor(skinCss);
111285
- if (!accent) die(`--style ${styleFlag}: no hex --accent in skin.css`, 65);
113460
+ if (!accent) die(`--style ${styleFlag}: no hex --accent in ${skinPath}`, 65);
111286
113461
  }
111287
113462
  rawTheme = accentOnlyTheme(accent);
111288
113463
  if (!rawTheme.colors) process.stderr.write(`doc-gen: --accent ${accent}: not a #rrggbb hex; using plain black-on-white
@@ -111299,7 +113474,7 @@ async function main() {
111299
113474
  bytes = await renderPdfViaService(spec, theme);
111300
113475
  if (bytes) engine = "pdf (chromium)";
111301
113476
  else {
111302
- bytes = await renderPdfHeadless(specToHtml(spec, theme), themePrintOptions(theme, spec.title) ?? {}).catch((e) => die(`headless Chromium failed: ${e.message}`, 1));
113477
+ bytes = await renderPdfHeadless(specToHtml(spec, theme)).catch((e) => die(`headless Chromium failed: ${e.message}`, 1));
111303
113478
  if (bytes) engine = "pdf (headless chromium)";
111304
113479
  else die(PDF_NEEDS_BROWSER, 69);
111305
113480
  }
@@ -111311,6 +113486,7 @@ async function main() {
111311
113486
  die(e.message, e.message.startsWith("unsupported kind") ? 64 : 1);
111312
113487
  }
111313
113488
  }
113489
+ if (kind === "pdf") bytes = await addPdfPageLabels(bytes, theme, spec.title, { fontDir: (0, import_node_path5.join)(__dirname, "..", "assets", "pdf-fonts") });
111314
113490
  await writeArtifactAtomically(out, bytes);
111315
113491
  process.stdout.write(`wrote ${out}${kind === "pdf" ? ` [${engine}]` : ""}
111316
113492
  `);
@@ -111333,8 +113509,8 @@ async function reportPdf(out, bytes, spec, noPreview) {
111333
113509
  if (!noPreview && validation.ok) {
111334
113510
  try {
111335
113511
  for (const r of await renderPdfPages(bytes, "all", 1)) {
111336
- const dest = (0, import_node_path3.join)((0, import_node_path3.dirname)(out), `${(0, import_node_path3.basename)(out).replace(/\.[^.]+$/, "")}_p${r.page}.png`);
111337
- await (0, import_promises2.writeFile)(dest, Buffer.from(r.png));
113512
+ const dest = (0, import_node_path5.join)((0, import_node_path5.dirname)(out), `${(0, import_node_path5.basename)(out).replace(/\.[^.]+$/, "")}_p${r.page}.png`);
113513
+ await (0, import_promises3.writeFile)(dest, Buffer.from(r.png));
111338
113514
  previews.push(dest);
111339
113515
  }
111340
113516
  } catch (e) {
@@ -111345,6 +113521,9 @@ async function reportPdf(out, bytes, spec, noPreview) {
111345
113521
  const report = {
111346
113522
  valid: validation.ok,
111347
113523
  pages: validation.pages ?? 0,
113524
+ validationScope: "structure-only",
113525
+ textStatsSource: "input-spec",
113526
+ warnings: validation.warnings,
111348
113527
  ...documentTextStats(spec),
111349
113528
  previews,
111350
113529
  ...validation.ok ? {} : { errors: validation.errors }