web-annotation-renderer 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +39 -33
  4. package/dist/index.js.map +1 -1
  5. package/dist/index10.cjs +1 -1
  6. package/dist/index10.cjs.map +1 -1
  7. package/dist/index10.js +154 -119
  8. package/dist/index10.js.map +1 -1
  9. package/dist/index11.cjs +1 -1
  10. package/dist/index11.js +1 -1
  11. package/dist/index12.cjs +1 -1
  12. package/dist/index12.js +1 -1
  13. package/dist/index14.cjs +1 -1
  14. package/dist/index14.js +1 -1
  15. package/dist/index15.cjs +1 -1
  16. package/dist/index15.cjs.map +1 -1
  17. package/dist/index15.js +23 -117
  18. package/dist/index15.js.map +1 -1
  19. package/dist/index16.cjs +1 -1
  20. package/dist/index16.cjs.map +1 -1
  21. package/dist/index16.js +53 -103
  22. package/dist/index16.js.map +1 -1
  23. package/dist/index17.cjs +1 -1
  24. package/dist/index17.cjs.map +1 -1
  25. package/dist/index17.js +22 -57
  26. package/dist/index17.js.map +1 -1
  27. package/dist/index18.cjs +1 -1
  28. package/dist/index18.cjs.map +1 -1
  29. package/dist/index18.js +113 -136
  30. package/dist/index18.js.map +1 -1
  31. package/dist/index19.cjs +1 -1
  32. package/dist/index19.cjs.map +1 -1
  33. package/dist/index19.js +101 -35
  34. package/dist/index19.js.map +1 -1
  35. package/dist/index20.cjs +1 -1
  36. package/dist/index20.cjs.map +1 -1
  37. package/dist/index20.js +58 -36
  38. package/dist/index20.js.map +1 -1
  39. package/dist/index21.cjs +1 -1
  40. package/dist/index21.cjs.map +1 -1
  41. package/dist/index21.js +140 -37
  42. package/dist/index21.js.map +1 -1
  43. package/dist/index22.cjs +1 -1
  44. package/dist/index22.cjs.map +1 -1
  45. package/dist/index22.js +37 -21
  46. package/dist/index22.js.map +1 -1
  47. package/dist/index23.cjs +1 -1
  48. package/dist/index23.cjs.map +1 -1
  49. package/dist/index23.js +37 -5
  50. package/dist/index23.js.map +1 -1
  51. package/dist/index24.cjs +1 -1
  52. package/dist/index24.cjs.map +1 -1
  53. package/dist/index24.js +37 -4
  54. package/dist/index24.js.map +1 -1
  55. package/dist/index25.cjs +2 -0
  56. package/dist/index25.cjs.map +1 -0
  57. package/dist/index25.js +43 -0
  58. package/dist/index25.js.map +1 -0
  59. package/dist/index26.cjs +2 -0
  60. package/dist/index26.cjs.map +1 -0
  61. package/dist/index26.js +8 -0
  62. package/dist/index26.js.map +1 -0
  63. package/dist/index27.cjs +2 -0
  64. package/dist/index27.cjs.map +1 -0
  65. package/dist/index27.js +8 -0
  66. package/dist/index27.js.map +1 -0
  67. package/dist/index5.cjs +1 -1
  68. package/dist/index5.cjs.map +1 -1
  69. package/dist/index5.js +57 -36
  70. package/dist/index5.js.map +1 -1
  71. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index24.js","sources":["../src/utils/idGenerator.js"],"sourcesContent":["/**\n * ID Generator Utility\n *\n * Generates unique IDs for annotations.\n *\n * @module utils/idGenerator\n */\n\n/**\n * Generate a unique ID for an annotation\n *\n * @param {string} [prefix='anno'] - ID prefix (e.g., 'highlight', 'text', 'ink')\n * @returns {string} Unique annotation ID\n * @example\n * ```javascript\n * const id = generateId('highlight');\n * // Returns: \"highlight-1234567890abc\"\n * ```\n */\nexport function generateId(prefix = 'anno') {\n const timestamp = Date.now().toString(36);\n const random = Math.random().toString(36).substring(2, 9);\n return `${prefix}-${timestamp}${random}`;\n}\n"],"names":["generateId","prefix","timestamp","random"],"mappings":"AAmBO,SAASA,EAAWC,IAAS,QAAQ;AAC1C,QAAMC,IAAY,KAAK,IAAG,EAAG,SAAS,EAAE,GAClCC,IAAS,KAAK,SAAS,SAAS,EAAE,EAAE,UAAU,GAAG,CAAC;AACxD,SAAO,GAAGF,CAAM,IAAIC,CAAS,GAAGC,CAAM;AACxC;"}
1
+ {"version":3,"file":"index24.js","sources":["../src/ai-tools/creators/createText.js"],"sourcesContent":["/**\n * Text Annotation Creator\n *\n * Converts AI-generated tool call arguments into valid text annotation objects\n * compatible with web-annotation-renderer library format.\n *\n * @module ai-tools/creators/createText\n */\n\nimport { generateId } from '../../utils/idGenerator.js';\n\n/**\n * Create a text annotation from tool call arguments\n *\n * @param {Object} args - Tool call arguments from AI\n * @param {string} args.content - Text content\n * @param {number} args.x - Horizontal position (0-1)\n * @param {number} args.y - Vertical position (0-1)\n * @param {number} args.w - Width (0-1)\n * @param {number} args.h - Height (0-1)\n * @param {number} args.page - Page number (1-indexed)\n * @param {string} [args.textColor='#1f2937'] - Text color in hex format\n * @param {string} [args.bgColor='transparent'] - Background color (transparent by default, or rgba format)\n * @param {string} args.sentence_ref - Sentence reference for timing (e.g., 'S1')\n * @returns {Object} Valid text annotation object\n * @example\n * ```javascript\n * const textNote = createText({\n * content: 'This is important',\n * x: 0.1,\n * y: 0.5,\n * w: 0.3,\n * h: 0.1,\n * page: 1,\n * textColor: '#000000',\n * bgColor: 'transparent', // or use rgba format like 'rgba(255, 255, 255, 0.9)'\n * sentence_ref: 'S3'\n * });\n * ```\n */\nexport function createText(args) {\n // Validate required fields\n if (!args.content || typeof args.content !== 'string' || args.content.trim().length === 0) {\n throw new Error('Text annotation requires non-empty content');\n }\n\n if (typeof args.x !== 'number' || args.x < 0 || args.x > 1) {\n throw new Error('Text annotation x position must be between 0 and 1');\n }\n\n if (typeof args.y !== 'number' || args.y < 0 || args.y > 1) {\n throw new Error('Text annotation y position must be between 0 and 1');\n }\n\n if (typeof args.w !== 'number' || args.w < 0 || args.w > 1) {\n throw new Error('Text annotation width (w) must be between 0 and 1');\n }\n\n if (typeof args.h !== 'number' || args.h < 0 || args.h > 1) {\n throw new Error('Text annotation height (h) must be between 0 and 1');\n }\n\n if (!args.page || typeof args.page !== 'number' || args.page < 1) {\n throw new Error('Text annotation requires a valid page number (>= 1)');\n }\n\n if (!args.sentence_ref || typeof args.sentence_ref !== 'string') {\n throw new Error('Text annotation requires a sentence_ref for timing');\n }\n\n // Get colors with defaults (transparent background for better visibility)\n const textColor = args.textColor || '#1f2937';\n const bgColor = args.bgColor || 'transparent';\n\n // Create annotation object matching library format\n return {\n id: generateId('text'),\n type: 'text', // Type name is 'text', not 'text_annotation'\n page: args.page,\n content: args.content.trim(),\n x: args.x, // Direct properties, not in position object\n y: args.y,\n w: args.w,\n h: args.h,\n style: { // Colors wrapped in style object\n bg: bgColor,\n color: textColor\n },\n sentence_ref: args.sentence_ref,\n // Note: start/end will be added during timing sync phase\n };\n}\n"],"names":["createText","args","textColor","bgColor","generateId"],"mappings":";AAwCO,SAASA,EAAWC,GAAM;AAE/B,MAAI,CAACA,EAAK,WAAW,OAAOA,EAAK,WAAY,YAAYA,EAAK,QAAQ,OAAO,WAAW;AACtF,UAAM,IAAI,MAAM,4CAA4C;AAG9D,MAAI,OAAOA,EAAK,KAAM,YAAYA,EAAK,IAAI,KAAKA,EAAK,IAAI;AACvD,UAAM,IAAI,MAAM,oDAAoD;AAGtE,MAAI,OAAOA,EAAK,KAAM,YAAYA,EAAK,IAAI,KAAKA,EAAK,IAAI;AACvD,UAAM,IAAI,MAAM,oDAAoD;AAGtE,MAAI,OAAOA,EAAK,KAAM,YAAYA,EAAK,IAAI,KAAKA,EAAK,IAAI;AACvD,UAAM,IAAI,MAAM,mDAAmD;AAGrE,MAAI,OAAOA,EAAK,KAAM,YAAYA,EAAK,IAAI,KAAKA,EAAK,IAAI;AACvD,UAAM,IAAI,MAAM,oDAAoD;AAGtE,MAAI,CAACA,EAAK,QAAQ,OAAOA,EAAK,QAAS,YAAYA,EAAK,OAAO;AAC7D,UAAM,IAAI,MAAM,qDAAqD;AAGvE,MAAI,CAACA,EAAK,gBAAgB,OAAOA,EAAK,gBAAiB;AACrD,UAAM,IAAI,MAAM,oDAAoD;AAItE,QAAMC,IAAYD,EAAK,aAAa,WAC9BE,IAAUF,EAAK,WAAW;AAGhC,SAAO;AAAA,IACL,IAAIG,EAAW,MAAM;AAAA,IACrB,MAAM;AAAA;AAAA,IACN,MAAMH,EAAK;AAAA,IACX,SAASA,EAAK,QAAQ,KAAI;AAAA,IAC1B,GAAGA,EAAK;AAAA;AAAA,IACR,GAAGA,EAAK;AAAA,IACR,GAAGA,EAAK;AAAA,IACR,GAAGA,EAAK;AAAA,IACR,OAAO;AAAA;AAAA,MACL,IAAIE;AAAA,MACJ,OAAOD;AAAA,IACb;AAAA,IACI,cAAcD,EAAK;AAAA;AAAA,EAEvB;AACA;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o={page:1,start:0,end:0},t={mode:"quads",quads:[{x:.1,y:.1,w:.8,h:.05}],style:{color:"rgba(255, 255, 0, 0.3)"}},E={content:"[No content]",x:.1,y:.1,w:.3,h:.1,style:{bg:"rgba(255, 255, 255, 0.9)",color:"#000000"}},r={quads:[{x:.1,y:.1,w:.8,h:.05}],style:{color:"rgba(0, 0, 255, 0.8)"}},T={from_x:.2,from_y:.2,to_x:.8,to_y:.8,style:{color:"rgba(255, 0, 0, 0.8)"}},L={cx:.5,cy:.5,rx:.1,ry:.1,style:{color:"rgba(255, 165, 0, 0.8)"}};exports.ARROW_DEFAULTS=T;exports.BASE_DEFAULTS=o;exports.CIRCLE_DEFAULTS=L;exports.HIGHLIGHT_DEFAULTS=t;exports.TEXT_DEFAULTS=E;exports.UNDERLINE_DEFAULTS=r;
2
+ //# sourceMappingURL=index25.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index25.cjs","sources":["../src/types/defaults.js"],"sourcesContent":["/**\n * Default Values for Annotation Normalization\n *\n * This module defines default values used when annotation fields are missing\n * or invalid. These defaults ensure annotations render visibly and safely.\n *\n * @module types/defaults\n */\n\n/**\n * Default values for base annotation fields (common to all types)\n *\n * @constant {Object}\n * @property {number} page - Default page number (first page)\n * @property {number} start - Default start time (display immediately)\n * @property {number} end - Default end time (static display, no animation)\n */\nexport const BASE_DEFAULTS = {\n page: 1,\n start: 0,\n end: 0\n};\n\n/**\n * Default values for highlight annotations\n *\n * Creates a visible yellow highlight near the top of the page.\n *\n * @constant {Object}\n * @property {string} mode - Highlight mode (only 'quads' supported)\n * @property {Array<Object>} quads - Default rectangular regions\n * @property {Object} style - Default styling\n */\nexport const HIGHLIGHT_DEFAULTS = {\n mode: 'quads',\n quads: [{ x: 0.1, y: 0.1, w: 0.8, h: 0.05 }],\n style: { color: 'rgba(255, 255, 0, 0.3)' }\n};\n\n/**\n * Default values for text annotations\n *\n * Creates a visible text box in the top-left with placeholder content.\n *\n * @constant {Object}\n * @property {string} content - Placeholder text\n * @property {number} x - Normalized x position (10% from left)\n * @property {number} y - Normalized y position (10% from top)\n * @property {number} w - Normalized width (30% of page width)\n * @property {number} h - Normalized height (10% of page height)\n * @property {Object} style - Default styling with white background and black text\n */\nexport const TEXT_DEFAULTS = {\n content: '[No content]',\n x: 0.1,\n y: 0.1,\n w: 0.3,\n h: 0.1,\n style: {\n bg: 'rgba(255, 255, 255, 0.9)',\n color: '#000000'\n }\n};\n\n/**\n * Default values for underline annotations\n *\n * Creates a visible blue underline near the top of the page.\n *\n * @constant {Object}\n * @property {Array<Object>} quads - Default rectangular regions to underline\n * @property {Object} style - Default styling with blue color\n */\nexport const UNDERLINE_DEFAULTS = {\n quads: [{ x: 0.1, y: 0.1, w: 0.8, h: 0.05 }],\n style: { color: 'rgba(0, 0, 255, 0.8)' }\n};\n\n/**\n * Default values for arrow annotations\n *\n * Creates a diagonal arrow from top-left to bottom-right area.\n *\n * @constant {Object}\n * @property {number} from_x - Source x position\n * @property {number} from_y - Source y position\n * @property {number} to_x - Target x position\n * @property {number} to_y - Target y position\n * @property {Object} style - Default styling with red color\n */\nexport const ARROW_DEFAULTS = {\n from_x: 0.2,\n from_y: 0.2,\n to_x: 0.8,\n to_y: 0.8,\n style: { color: 'rgba(255, 0, 0, 0.8)' }\n};\n\n/**\n * Default values for circle annotations\n *\n * Creates a small orange ellipse centered on the page.\n *\n * @constant {Object}\n * @property {number} cx - Center x position\n * @property {number} cy - Center y position\n * @property {number} rx - Horizontal radius\n * @property {number} ry - Vertical radius\n * @property {Object} style - Default styling with orange color\n */\nexport const CIRCLE_DEFAULTS = {\n cx: 0.5,\n cy: 0.5,\n rx: 0.1,\n ry: 0.1,\n style: { color: 'rgba(255, 165, 0, 0.8)' }\n};\n"],"names":["BASE_DEFAULTS","HIGHLIGHT_DEFAULTS","TEXT_DEFAULTS","UNDERLINE_DEFAULTS","ARROW_DEFAULTS","CIRCLE_DEFAULTS"],"mappings":"gFAiBY,MAACA,EAAgB,CAC3B,KAAM,EACN,MAAO,EACP,IAAK,CACP,EAYaC,EAAqB,CAChC,KAAM,QACN,MAAO,CAAC,CAAE,EAAG,GAAK,EAAG,GAAK,EAAG,GAAK,EAAG,IAAM,EAC3C,MAAO,CAAE,MAAO,wBAAwB,CAC1C,EAeaC,EAAgB,CAC3B,QAAS,eACT,EAAG,GACH,EAAG,GACH,EAAG,GACH,EAAG,GACH,MAAO,CACL,GAAI,2BACJ,MAAO,SACX,CACA,EAWaC,EAAqB,CAChC,MAAO,CAAC,CAAE,EAAG,GAAK,EAAG,GAAK,EAAG,GAAK,EAAG,IAAM,EAC3C,MAAO,CAAE,MAAO,sBAAsB,CACxC,EAcaC,EAAiB,CAC5B,OAAQ,GACR,OAAQ,GACR,KAAM,GACN,KAAM,GACN,MAAO,CAAE,MAAO,sBAAsB,CACxC,EAcaC,EAAkB,CAC7B,GAAI,GACJ,GAAI,GACJ,GAAI,GACJ,GAAI,GACJ,MAAO,CAAE,MAAO,wBAAwB,CAC1C"}
@@ -0,0 +1,43 @@
1
+ const o = {
2
+ page: 1,
3
+ start: 0,
4
+ end: 0
5
+ }, t = {
6
+ mode: "quads",
7
+ quads: [{ x: 0.1, y: 0.1, w: 0.8, h: 0.05 }],
8
+ style: { color: "rgba(255, 255, 0, 0.3)" }
9
+ }, r = {
10
+ content: "[No content]",
11
+ x: 0.1,
12
+ y: 0.1,
13
+ w: 0.3,
14
+ h: 0.1,
15
+ style: {
16
+ bg: "rgba(255, 255, 255, 0.9)",
17
+ color: "#000000"
18
+ }
19
+ }, c = {
20
+ quads: [{ x: 0.1, y: 0.1, w: 0.8, h: 0.05 }],
21
+ style: { color: "rgba(0, 0, 255, 0.8)" }
22
+ }, s = {
23
+ from_x: 0.2,
24
+ from_y: 0.2,
25
+ to_x: 0.8,
26
+ to_y: 0.8,
27
+ style: { color: "rgba(255, 0, 0, 0.8)" }
28
+ }, y = {
29
+ cx: 0.5,
30
+ cy: 0.5,
31
+ rx: 0.1,
32
+ ry: 0.1,
33
+ style: { color: "rgba(255, 165, 0, 0.8)" }
34
+ };
35
+ export {
36
+ s as ARROW_DEFAULTS,
37
+ o as BASE_DEFAULTS,
38
+ y as CIRCLE_DEFAULTS,
39
+ t as HIGHLIGHT_DEFAULTS,
40
+ r as TEXT_DEFAULTS,
41
+ c as UNDERLINE_DEFAULTS
42
+ };
43
+ //# sourceMappingURL=index25.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index25.js","sources":["../src/types/defaults.js"],"sourcesContent":["/**\n * Default Values for Annotation Normalization\n *\n * This module defines default values used when annotation fields are missing\n * or invalid. These defaults ensure annotations render visibly and safely.\n *\n * @module types/defaults\n */\n\n/**\n * Default values for base annotation fields (common to all types)\n *\n * @constant {Object}\n * @property {number} page - Default page number (first page)\n * @property {number} start - Default start time (display immediately)\n * @property {number} end - Default end time (static display, no animation)\n */\nexport const BASE_DEFAULTS = {\n page: 1,\n start: 0,\n end: 0\n};\n\n/**\n * Default values for highlight annotations\n *\n * Creates a visible yellow highlight near the top of the page.\n *\n * @constant {Object}\n * @property {string} mode - Highlight mode (only 'quads' supported)\n * @property {Array<Object>} quads - Default rectangular regions\n * @property {Object} style - Default styling\n */\nexport const HIGHLIGHT_DEFAULTS = {\n mode: 'quads',\n quads: [{ x: 0.1, y: 0.1, w: 0.8, h: 0.05 }],\n style: { color: 'rgba(255, 255, 0, 0.3)' }\n};\n\n/**\n * Default values for text annotations\n *\n * Creates a visible text box in the top-left with placeholder content.\n *\n * @constant {Object}\n * @property {string} content - Placeholder text\n * @property {number} x - Normalized x position (10% from left)\n * @property {number} y - Normalized y position (10% from top)\n * @property {number} w - Normalized width (30% of page width)\n * @property {number} h - Normalized height (10% of page height)\n * @property {Object} style - Default styling with white background and black text\n */\nexport const TEXT_DEFAULTS = {\n content: '[No content]',\n x: 0.1,\n y: 0.1,\n w: 0.3,\n h: 0.1,\n style: {\n bg: 'rgba(255, 255, 255, 0.9)',\n color: '#000000'\n }\n};\n\n/**\n * Default values for underline annotations\n *\n * Creates a visible blue underline near the top of the page.\n *\n * @constant {Object}\n * @property {Array<Object>} quads - Default rectangular regions to underline\n * @property {Object} style - Default styling with blue color\n */\nexport const UNDERLINE_DEFAULTS = {\n quads: [{ x: 0.1, y: 0.1, w: 0.8, h: 0.05 }],\n style: { color: 'rgba(0, 0, 255, 0.8)' }\n};\n\n/**\n * Default values for arrow annotations\n *\n * Creates a diagonal arrow from top-left to bottom-right area.\n *\n * @constant {Object}\n * @property {number} from_x - Source x position\n * @property {number} from_y - Source y position\n * @property {number} to_x - Target x position\n * @property {number} to_y - Target y position\n * @property {Object} style - Default styling with red color\n */\nexport const ARROW_DEFAULTS = {\n from_x: 0.2,\n from_y: 0.2,\n to_x: 0.8,\n to_y: 0.8,\n style: { color: 'rgba(255, 0, 0, 0.8)' }\n};\n\n/**\n * Default values for circle annotations\n *\n * Creates a small orange ellipse centered on the page.\n *\n * @constant {Object}\n * @property {number} cx - Center x position\n * @property {number} cy - Center y position\n * @property {number} rx - Horizontal radius\n * @property {number} ry - Vertical radius\n * @property {Object} style - Default styling with orange color\n */\nexport const CIRCLE_DEFAULTS = {\n cx: 0.5,\n cy: 0.5,\n rx: 0.1,\n ry: 0.1,\n style: { color: 'rgba(255, 165, 0, 0.8)' }\n};\n"],"names":["BASE_DEFAULTS","HIGHLIGHT_DEFAULTS","TEXT_DEFAULTS","UNDERLINE_DEFAULTS","ARROW_DEFAULTS","CIRCLE_DEFAULTS"],"mappings":"AAiBY,MAACA,IAAgB;AAAA,EAC3B,MAAM;AAAA,EACN,OAAO;AAAA,EACP,KAAK;AACP,GAYaC,IAAqB;AAAA,EAChC,MAAM;AAAA,EACN,OAAO,CAAC,EAAE,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM;AAAA,EAC3C,OAAO,EAAE,OAAO,yBAAwB;AAC1C,GAeaC,IAAgB;AAAA,EAC3B,SAAS;AAAA,EACT,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,OAAO;AAAA,IACL,IAAI;AAAA,IACJ,OAAO;AAAA,EACX;AACA,GAWaC,IAAqB;AAAA,EAChC,OAAO,CAAC,EAAE,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM;AAAA,EAC3C,OAAO,EAAE,OAAO,uBAAsB;AACxC,GAcaC,IAAiB;AAAA,EAC5B,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO,EAAE,OAAO,uBAAsB;AACxC,GAcaC,IAAkB;AAAA,EAC7B,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO,EAAE,OAAO,yBAAwB;AAC1C;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=JSON.parse(`{"0":{"width":0.5,"paths":[{"points":[[0.25,0],[0.1,0],[0,0.15],[0,0.85],[0.1,1],[0.4,1],[0.5,0.85],[0.5,0.15],[0.4,0],[0.25,0]]}]},"1":{"width":0.3,"paths":[{"points":[[0,0.2],[0.15,0],[0.15,1]]},{"points":[[0,1],[0.3,1]]}],"pathTiming":"sequential"},"2":{"width":0.5,"paths":[{"points":[[0,0.15],[0.1,0],[0.4,0],[0.5,0.15],[0.5,0.35],[0,1],[0.5,1]]}]},"3":{"width":0.5,"paths":[{"points":[[0,0.1],[0.15,0],[0.35,0],[0.5,0.15],[0.5,0.35],[0.35,0.5],[0.15,0.5]]},{"points":[[0.15,0.5],[0.35,0.5],[0.5,0.65],[0.5,0.85],[0.35,1],[0.15,1],[0,0.9]]}],"pathTiming":"sequential"},"4":{"width":0.5,"paths":[{"points":[[0.4,0],[0,0.7],[0.5,0.7]]},{"points":[[0.4,0],[0.4,1]]}],"pathTiming":"sequential"},"5":{"width":0.5,"paths":[{"points":[[0.5,0],[0,0],[0,0.45],[0.3,0.45],[0.5,0.6],[0.5,0.85],[0.35,1],[0.15,1],[0,0.9]]}]},"6":{"width":0.5,"paths":[{"points":[[0.4,0],[0.15,0],[0,0.2],[0,0.85],[0.15,1],[0.35,1],[0.5,0.85],[0.5,0.6],[0.35,0.45],[0.15,0.45],[0,0.6]]}]},"7":{"width":0.5,"paths":[{"points":[[0,0],[0.5,0],[0.2,1]]}]},"8":{"width":0.5,"paths":[{"points":[[0.25,0.5],[0.1,0.5],[0,0.4],[0,0.15],[0.1,0],[0.4,0],[0.5,0.15],[0.5,0.4],[0.4,0.5],[0.25,0.5]]},{"points":[[0.25,0.5],[0.4,0.5],[0.5,0.6],[0.5,0.85],[0.4,1],[0.1,1],[0,0.85],[0,0.6],[0.1,0.5],[0.25,0.5]]}],"pathTiming":"sequential"},"9":{"width":0.5,"paths":[{"points":[[0.5,0.4],[0.35,0.55],[0.15,0.55],[0,0.4],[0,0.15],[0.15,0],[0.35,0],[0.5,0.15],[0.5,0.8],[0.35,1],[0.1,1]]}]},"A":{"width":0.7,"paths":[{"points":[[0,1],[0.35,0],[0.7,1]]},{"points":[[0.12,0.65],[0.58,0.65]]}],"pathTiming":"sequential"},"B":{"width":0.6,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0,0],[0.4,0],[0.55,0.1],[0.55,0.4],[0.4,0.5],[0,0.5]]},{"points":[[0,0.5],[0.45,0.5],[0.6,0.6],[0.6,0.9],[0.45,1],[0,1]]}],"pathTiming":"sequential"},"C":{"width":0.6,"paths":[{"points":[[0.6,0.15],[0.45,0],[0.15,0],[0,0.15],[0,0.85],[0.15,1],[0.45,1],[0.6,0.85]]}]},"D":{"width":0.6,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0,0],[0.35,0],[0.55,0.15],[0.6,0.5],[0.55,0.85],[0.35,1],[0,1]]}],"pathTiming":"sequential"},"E":{"width":0.55,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0,0],[0.55,0]]},{"points":[[0,0.5],[0.4,0.5]]},{"points":[[0,1],[0.55,1]]}],"pathTiming":"sequential"},"F":{"width":0.5,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0,0],[0.5,0]]},{"points":[[0,0.5],[0.35,0.5]]}],"pathTiming":"sequential"},"G":{"width":0.65,"paths":[{"points":[[0.65,0.15],[0.5,0],[0.15,0],[0,0.15],[0,0.85],[0.15,1],[0.5,1],[0.65,0.85],[0.65,0.55]]},{"points":[[0.35,0.55],[0.65,0.55]]}],"pathTiming":"sequential"},"H":{"width":0.6,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0,0.5],[0.6,0.5]]},{"points":[[0.6,0],[0.6,1]]}],"pathTiming":"sequential"},"I":{"width":0.35,"paths":[{"points":[[0,0],[0.35,0]]},{"points":[[0.175,0],[0.175,1]]},{"points":[[0,1],[0.35,1]]}],"pathTiming":"sequential"},"J":{"width":0.45,"paths":[{"points":[[0.1,0],[0.45,0]]},{"points":[[0.3,0],[0.3,0.85],[0.2,1],[0.08,1],[0,0.9]]}],"pathTiming":"sequential"},"K":{"width":0.6,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0.6,0],[0,0.55]]},{"points":[[0.2,0.4],[0.6,1]]}],"pathTiming":"sequential"},"L":{"width":0.5,"paths":[{"points":[[0,0],[0,1],[0.5,1]]}]},"M":{"width":0.75,"paths":[{"points":[[0,1],[0,0],[0.375,0.6],[0.75,0],[0.75,1]]}]},"N":{"width":0.6,"paths":[{"points":[[0,1],[0,0],[0.6,1],[0.6,0]]}]},"O":{"width":0.65,"paths":[{"points":[[0.325,0],[0.15,0],[0,0.15],[0,0.85],[0.15,1],[0.5,1],[0.65,0.85],[0.65,0.15],[0.5,0],[0.325,0]]}]},"P":{"width":0.55,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0,0],[0.4,0],[0.55,0.12],[0.55,0.38],[0.4,0.5],[0,0.5]]}],"pathTiming":"sequential"},"Q":{"width":0.65,"paths":[{"points":[[0.325,0],[0.15,0],[0,0.15],[0,0.85],[0.15,1],[0.5,1],[0.65,0.85],[0.65,0.15],[0.5,0],[0.325,0]]},{"points":[[0.4,0.75],[0.65,1.05]]}],"pathTiming":"sequential"},"R":{"width":0.6,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0,0],[0.4,0],[0.55,0.12],[0.55,0.38],[0.4,0.5],[0,0.5]]},{"points":[[0.3,0.5],[0.6,1]]}],"pathTiming":"sequential"},"S":{"width":0.55,"paths":[{"points":[[0.55,0.12],[0.4,0],[0.15,0],[0,0.12],[0,0.38],[0.15,0.5],[0.4,0.5],[0.55,0.62],[0.55,0.88],[0.4,1],[0.15,1],[0,0.88]]}]},"T":{"width":0.55,"paths":[{"points":[[0,0],[0.55,0]]},{"points":[[0.275,0],[0.275,1]]}],"pathTiming":"sequential"},"U":{"width":0.6,"paths":[{"points":[[0,0],[0,0.85],[0.15,1],[0.45,1],[0.6,0.85],[0.6,0]]}]},"V":{"width":0.65,"paths":[{"points":[[0,0],[0.325,1],[0.65,0]]}]},"W":{"width":0.85,"paths":[{"points":[[0,0],[0.2,1],[0.425,0.4],[0.65,1],[0.85,0]]}]},"X":{"width":0.6,"paths":[{"points":[[0,0],[0.6,1]]},{"points":[[0.6,0],[0,1]]}],"pathTiming":"sequential"},"Y":{"width":0.6,"paths":[{"points":[[0,0],[0.3,0.5]]},{"points":[[0.6,0],[0.3,0.5],[0.3,1]]}],"pathTiming":"sequential"},"Z":{"width":0.55,"paths":[{"points":[[0,0],[0.55,0],[0,1],[0.55,1]]}]},"a":{"width":0.5,"paths":[{"points":[[0.5,0.4],[0.5,1]]},{"points":[[0.5,0.55],[0.35,0.4],[0.15,0.4],[0,0.55],[0,0.85],[0.15,1],[0.35,1],[0.5,0.85]]}],"pathTiming":"sequential"},"b":{"width":0.5,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0,0.55],[0.15,0.4],[0.35,0.4],[0.5,0.55],[0.5,0.85],[0.35,1],[0.15,1],[0,0.85]]}],"pathTiming":"sequential"},"c":{"width":0.45,"paths":[{"points":[[0.45,0.5],[0.3,0.4],[0.15,0.4],[0,0.55],[0,0.85],[0.15,1],[0.3,1],[0.45,0.9]]}]},"d":{"width":0.5,"paths":[{"points":[[0.5,0],[0.5,1]]},{"points":[[0.5,0.55],[0.35,0.4],[0.15,0.4],[0,0.55],[0,0.85],[0.15,1],[0.35,1],[0.5,0.85]]}],"pathTiming":"sequential"},"e":{"width":0.45,"paths":[{"points":[[0,0.7],[0.45,0.7],[0.45,0.55],[0.3,0.4],[0.15,0.4],[0,0.55],[0,0.85],[0.15,1],[0.3,1],[0.45,0.9]]}]},"f":{"width":0.35,"paths":[{"points":[[0.35,0.1],[0.25,0],[0.15,0],[0.1,0.1],[0.1,1]]},{"points":[[0,0.4],[0.3,0.4]]}],"pathTiming":"sequential"},"g":{"width":0.5,"paths":[{"points":[[0.5,0.4],[0.5,1.15],[0.35,1.3],[0.15,1.3],[0,1.15]]},{"points":[[0.5,0.55],[0.35,0.4],[0.15,0.4],[0,0.55],[0,0.85],[0.15,1],[0.35,1],[0.5,0.85]]}],"pathTiming":"sequential"},"h":{"width":0.45,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0,0.55],[0.15,0.4],[0.3,0.4],[0.45,0.55],[0.45,1]]}],"pathTiming":"sequential"},"i":{"width":0.15,"paths":[{"points":[[0.075,0.2],[0.075,0.25]]},{"points":[[0.075,0.4],[0.075,1]]}],"pathTiming":"sequential"},"j":{"width":0.2,"paths":[{"points":[[0.15,0.2],[0.15,0.25]]},{"points":[[0.15,0.4],[0.15,1.15],[0.05,1.3],[0,1.3]]}],"pathTiming":"sequential"},"k":{"width":0.45,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0.45,0.4],[0,0.7]]},{"points":[[0.15,0.6],[0.45,1]]}],"pathTiming":"sequential"},"l":{"width":0.15,"paths":[{"points":[[0.075,0],[0.075,1]]}]},"m":{"width":0.7,"paths":[{"points":[[0,0.4],[0,1]]},{"points":[[0,0.55],[0.1,0.4],[0.25,0.4],[0.35,0.55],[0.35,1]]},{"points":[[0.35,0.55],[0.45,0.4],[0.6,0.4],[0.7,0.55],[0.7,1]]}],"pathTiming":"sequential"},"n":{"width":0.45,"paths":[{"points":[[0,0.4],[0,1]]},{"points":[[0,0.55],[0.15,0.4],[0.3,0.4],[0.45,0.55],[0.45,1]]}],"pathTiming":"sequential"},"o":{"width":0.5,"paths":[{"points":[[0.25,0.4],[0.1,0.4],[0,0.55],[0,0.85],[0.1,1],[0.4,1],[0.5,0.85],[0.5,0.55],[0.4,0.4],[0.25,0.4]]}]},"p":{"width":0.5,"paths":[{"points":[[0,0.4],[0,1.3]]},{"points":[[0,0.55],[0.15,0.4],[0.35,0.4],[0.5,0.55],[0.5,0.85],[0.35,1],[0.15,1],[0,0.85]]}],"pathTiming":"sequential"},"q":{"width":0.5,"paths":[{"points":[[0.5,0.4],[0.5,1.3]]},{"points":[[0.5,0.55],[0.35,0.4],[0.15,0.4],[0,0.55],[0,0.85],[0.15,1],[0.35,1],[0.5,0.85]]}],"pathTiming":"sequential"},"r":{"width":0.3,"paths":[{"points":[[0,0.4],[0,1]]},{"points":[[0,0.55],[0.1,0.4],[0.3,0.4]]}],"pathTiming":"sequential"},"s":{"width":0.4,"paths":[{"points":[[0.4,0.5],[0.3,0.4],[0.1,0.4],[0,0.5],[0,0.6],[0.1,0.7],[0.3,0.7],[0.4,0.8],[0.4,0.9],[0.3,1],[0.1,1],[0,0.9]]}]},"t":{"width":0.3,"paths":[{"points":[[0.1,0.15],[0.1,0.9],[0.2,1],[0.3,1]]},{"points":[[0,0.4],[0.25,0.4]]}],"pathTiming":"sequential"},"u":{"width":0.45,"paths":[{"points":[[0,0.4],[0,0.85],[0.15,1],[0.3,1],[0.45,0.85]]},{"points":[[0.45,0.4],[0.45,1]]}],"pathTiming":"sequential"},"v":{"width":0.45,"paths":[{"points":[[0,0.4],[0.225,1],[0.45,0.4]]}]},"w":{"width":0.65,"paths":[{"points":[[0,0.4],[0.15,1],[0.325,0.6],[0.5,1],[0.65,0.4]]}]},"x":{"width":0.4,"paths":[{"points":[[0,0.4],[0.4,1]]},{"points":[[0.4,0.4],[0,1]]}],"pathTiming":"sequential"},"y":{"width":0.45,"paths":[{"points":[[0,0.4],[0.225,0.85]]},{"points":[[0.45,0.4],[0.15,1],[0.05,1.2],[0,1.3]]}],"pathTiming":"sequential"},"z":{"width":0.4,"paths":[{"points":[[0,0.4],[0.4,0.4],[0,1],[0.4,1]]}]},".":{"width":0.12,"paths":[{"points":[[0.06,0.9],[0.06,0.92],[0.06,0.95],[0.06,1]]}]},",":{"width":0.12,"paths":[{"points":[[0.08,0.9],[0.06,1],[0,1.15]]}]},"!":{"width":0.12,"paths":[{"points":[[0.06,0],[0.06,0.7]]},{"points":[[0.06,0.9],[0.06,0.92],[0.06,0.95],[0.06,1]]}],"pathTiming":"sequential"},"?":{"width":0.45,"paths":[{"points":[[0,0.15],[0.1,0],[0.35,0],[0.45,0.15],[0.45,0.35],[0.3,0.5],[0.225,0.5],[0.225,0.7]]},{"points":[[0.225,0.9],[0.225,0.92],[0.225,0.95],[0.225,1]]}],"pathTiming":"sequential"},"'":{"width":0.1,"paths":[{"points":[[0.05,0],[0.05,0.1],[0.05,0.2]]}]},"\\"":{"width":0.25,"paths":[{"points":[[0.05,0],[0.05,0.1],[0.05,0.2]]},{"points":[[0.2,0],[0.2,0.1],[0.2,0.2]]}],"pathTiming":"parallel"},"-":{"width":0.3,"paths":[{"points":[[0,0.5],[0.1,0.5],[0.2,0.5],[0.3,0.5]]}]},"_":{"width":0.5,"paths":[{"points":[[0,1.05],[0.25,1.05],[0.5,1.05]]}]},":":{"width":0.12,"paths":[{"points":[[0.06,0.45],[0.06,0.48],[0.06,0.5]]},{"points":[[0.06,0.9],[0.06,0.93],[0.06,0.96],[0.06,1]]}],"pathTiming":"sequential"},";":{"width":0.12,"paths":[{"points":[[0.06,0.45],[0.06,0.48],[0.06,0.5]]},{"points":[[0.08,0.9],[0.06,1],[0,1.15]]}],"pathTiming":"sequential"},"(":{"width":0.25,"paths":[{"points":[[0.25,-0.1],[0.1,0.1],[0,0.35],[0,0.65],[0.1,0.9],[0.25,1.1]]}]},")":{"width":0.25,"paths":[{"points":[[0,-0.1],[0.15,0.1],[0.25,0.35],[0.25,0.65],[0.15,0.9],[0,1.1]]}]},"/":{"width":0.4,"paths":[{"points":[[0.4,-0.1],[0.2,0.5],[0,1.1]]}]},"+":{"width":0.45,"paths":[{"points":[[0.225,0.3],[0.225,0.7]]},{"points":[[0,0.5],[0.45,0.5]]}],"pathTiming":"sequential"},"=":{"width":0.45,"paths":[{"points":[[0,0.4],[0.45,0.4]]},{"points":[[0,0.6],[0.45,0.6]]}],"pathTiming":"sequential"}," ":{"width":0.3,"paths":[]}}`),i={glyphs:t};exports.default=i;exports.glyphs=t;
2
+ //# sourceMappingURL=index26.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index26.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ const t = /* @__PURE__ */ JSON.parse(`{"0":{"width":0.5,"paths":[{"points":[[0.25,0],[0.1,0],[0,0.15],[0,0.85],[0.1,1],[0.4,1],[0.5,0.85],[0.5,0.15],[0.4,0],[0.25,0]]}]},"1":{"width":0.3,"paths":[{"points":[[0,0.2],[0.15,0],[0.15,1]]},{"points":[[0,1],[0.3,1]]}],"pathTiming":"sequential"},"2":{"width":0.5,"paths":[{"points":[[0,0.15],[0.1,0],[0.4,0],[0.5,0.15],[0.5,0.35],[0,1],[0.5,1]]}]},"3":{"width":0.5,"paths":[{"points":[[0,0.1],[0.15,0],[0.35,0],[0.5,0.15],[0.5,0.35],[0.35,0.5],[0.15,0.5]]},{"points":[[0.15,0.5],[0.35,0.5],[0.5,0.65],[0.5,0.85],[0.35,1],[0.15,1],[0,0.9]]}],"pathTiming":"sequential"},"4":{"width":0.5,"paths":[{"points":[[0.4,0],[0,0.7],[0.5,0.7]]},{"points":[[0.4,0],[0.4,1]]}],"pathTiming":"sequential"},"5":{"width":0.5,"paths":[{"points":[[0.5,0],[0,0],[0,0.45],[0.3,0.45],[0.5,0.6],[0.5,0.85],[0.35,1],[0.15,1],[0,0.9]]}]},"6":{"width":0.5,"paths":[{"points":[[0.4,0],[0.15,0],[0,0.2],[0,0.85],[0.15,1],[0.35,1],[0.5,0.85],[0.5,0.6],[0.35,0.45],[0.15,0.45],[0,0.6]]}]},"7":{"width":0.5,"paths":[{"points":[[0,0],[0.5,0],[0.2,1]]}]},"8":{"width":0.5,"paths":[{"points":[[0.25,0.5],[0.1,0.5],[0,0.4],[0,0.15],[0.1,0],[0.4,0],[0.5,0.15],[0.5,0.4],[0.4,0.5],[0.25,0.5]]},{"points":[[0.25,0.5],[0.4,0.5],[0.5,0.6],[0.5,0.85],[0.4,1],[0.1,1],[0,0.85],[0,0.6],[0.1,0.5],[0.25,0.5]]}],"pathTiming":"sequential"},"9":{"width":0.5,"paths":[{"points":[[0.5,0.4],[0.35,0.55],[0.15,0.55],[0,0.4],[0,0.15],[0.15,0],[0.35,0],[0.5,0.15],[0.5,0.8],[0.35,1],[0.1,1]]}]},"A":{"width":0.7,"paths":[{"points":[[0,1],[0.35,0],[0.7,1]]},{"points":[[0.12,0.65],[0.58,0.65]]}],"pathTiming":"sequential"},"B":{"width":0.6,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0,0],[0.4,0],[0.55,0.1],[0.55,0.4],[0.4,0.5],[0,0.5]]},{"points":[[0,0.5],[0.45,0.5],[0.6,0.6],[0.6,0.9],[0.45,1],[0,1]]}],"pathTiming":"sequential"},"C":{"width":0.6,"paths":[{"points":[[0.6,0.15],[0.45,0],[0.15,0],[0,0.15],[0,0.85],[0.15,1],[0.45,1],[0.6,0.85]]}]},"D":{"width":0.6,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0,0],[0.35,0],[0.55,0.15],[0.6,0.5],[0.55,0.85],[0.35,1],[0,1]]}],"pathTiming":"sequential"},"E":{"width":0.55,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0,0],[0.55,0]]},{"points":[[0,0.5],[0.4,0.5]]},{"points":[[0,1],[0.55,1]]}],"pathTiming":"sequential"},"F":{"width":0.5,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0,0],[0.5,0]]},{"points":[[0,0.5],[0.35,0.5]]}],"pathTiming":"sequential"},"G":{"width":0.65,"paths":[{"points":[[0.65,0.15],[0.5,0],[0.15,0],[0,0.15],[0,0.85],[0.15,1],[0.5,1],[0.65,0.85],[0.65,0.55]]},{"points":[[0.35,0.55],[0.65,0.55]]}],"pathTiming":"sequential"},"H":{"width":0.6,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0,0.5],[0.6,0.5]]},{"points":[[0.6,0],[0.6,1]]}],"pathTiming":"sequential"},"I":{"width":0.35,"paths":[{"points":[[0,0],[0.35,0]]},{"points":[[0.175,0],[0.175,1]]},{"points":[[0,1],[0.35,1]]}],"pathTiming":"sequential"},"J":{"width":0.45,"paths":[{"points":[[0.1,0],[0.45,0]]},{"points":[[0.3,0],[0.3,0.85],[0.2,1],[0.08,1],[0,0.9]]}],"pathTiming":"sequential"},"K":{"width":0.6,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0.6,0],[0,0.55]]},{"points":[[0.2,0.4],[0.6,1]]}],"pathTiming":"sequential"},"L":{"width":0.5,"paths":[{"points":[[0,0],[0,1],[0.5,1]]}]},"M":{"width":0.75,"paths":[{"points":[[0,1],[0,0],[0.375,0.6],[0.75,0],[0.75,1]]}]},"N":{"width":0.6,"paths":[{"points":[[0,1],[0,0],[0.6,1],[0.6,0]]}]},"O":{"width":0.65,"paths":[{"points":[[0.325,0],[0.15,0],[0,0.15],[0,0.85],[0.15,1],[0.5,1],[0.65,0.85],[0.65,0.15],[0.5,0],[0.325,0]]}]},"P":{"width":0.55,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0,0],[0.4,0],[0.55,0.12],[0.55,0.38],[0.4,0.5],[0,0.5]]}],"pathTiming":"sequential"},"Q":{"width":0.65,"paths":[{"points":[[0.325,0],[0.15,0],[0,0.15],[0,0.85],[0.15,1],[0.5,1],[0.65,0.85],[0.65,0.15],[0.5,0],[0.325,0]]},{"points":[[0.4,0.75],[0.65,1.05]]}],"pathTiming":"sequential"},"R":{"width":0.6,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0,0],[0.4,0],[0.55,0.12],[0.55,0.38],[0.4,0.5],[0,0.5]]},{"points":[[0.3,0.5],[0.6,1]]}],"pathTiming":"sequential"},"S":{"width":0.55,"paths":[{"points":[[0.55,0.12],[0.4,0],[0.15,0],[0,0.12],[0,0.38],[0.15,0.5],[0.4,0.5],[0.55,0.62],[0.55,0.88],[0.4,1],[0.15,1],[0,0.88]]}]},"T":{"width":0.55,"paths":[{"points":[[0,0],[0.55,0]]},{"points":[[0.275,0],[0.275,1]]}],"pathTiming":"sequential"},"U":{"width":0.6,"paths":[{"points":[[0,0],[0,0.85],[0.15,1],[0.45,1],[0.6,0.85],[0.6,0]]}]},"V":{"width":0.65,"paths":[{"points":[[0,0],[0.325,1],[0.65,0]]}]},"W":{"width":0.85,"paths":[{"points":[[0,0],[0.2,1],[0.425,0.4],[0.65,1],[0.85,0]]}]},"X":{"width":0.6,"paths":[{"points":[[0,0],[0.6,1]]},{"points":[[0.6,0],[0,1]]}],"pathTiming":"sequential"},"Y":{"width":0.6,"paths":[{"points":[[0,0],[0.3,0.5]]},{"points":[[0.6,0],[0.3,0.5],[0.3,1]]}],"pathTiming":"sequential"},"Z":{"width":0.55,"paths":[{"points":[[0,0],[0.55,0],[0,1],[0.55,1]]}]},"a":{"width":0.5,"paths":[{"points":[[0.5,0.4],[0.5,1]]},{"points":[[0.5,0.55],[0.35,0.4],[0.15,0.4],[0,0.55],[0,0.85],[0.15,1],[0.35,1],[0.5,0.85]]}],"pathTiming":"sequential"},"b":{"width":0.5,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0,0.55],[0.15,0.4],[0.35,0.4],[0.5,0.55],[0.5,0.85],[0.35,1],[0.15,1],[0,0.85]]}],"pathTiming":"sequential"},"c":{"width":0.45,"paths":[{"points":[[0.45,0.5],[0.3,0.4],[0.15,0.4],[0,0.55],[0,0.85],[0.15,1],[0.3,1],[0.45,0.9]]}]},"d":{"width":0.5,"paths":[{"points":[[0.5,0],[0.5,1]]},{"points":[[0.5,0.55],[0.35,0.4],[0.15,0.4],[0,0.55],[0,0.85],[0.15,1],[0.35,1],[0.5,0.85]]}],"pathTiming":"sequential"},"e":{"width":0.45,"paths":[{"points":[[0,0.7],[0.45,0.7],[0.45,0.55],[0.3,0.4],[0.15,0.4],[0,0.55],[0,0.85],[0.15,1],[0.3,1],[0.45,0.9]]}]},"f":{"width":0.35,"paths":[{"points":[[0.35,0.1],[0.25,0],[0.15,0],[0.1,0.1],[0.1,1]]},{"points":[[0,0.4],[0.3,0.4]]}],"pathTiming":"sequential"},"g":{"width":0.5,"paths":[{"points":[[0.5,0.4],[0.5,1.15],[0.35,1.3],[0.15,1.3],[0,1.15]]},{"points":[[0.5,0.55],[0.35,0.4],[0.15,0.4],[0,0.55],[0,0.85],[0.15,1],[0.35,1],[0.5,0.85]]}],"pathTiming":"sequential"},"h":{"width":0.45,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0,0.55],[0.15,0.4],[0.3,0.4],[0.45,0.55],[0.45,1]]}],"pathTiming":"sequential"},"i":{"width":0.15,"paths":[{"points":[[0.075,0.2],[0.075,0.25]]},{"points":[[0.075,0.4],[0.075,1]]}],"pathTiming":"sequential"},"j":{"width":0.2,"paths":[{"points":[[0.15,0.2],[0.15,0.25]]},{"points":[[0.15,0.4],[0.15,1.15],[0.05,1.3],[0,1.3]]}],"pathTiming":"sequential"},"k":{"width":0.45,"paths":[{"points":[[0,0],[0,1]]},{"points":[[0.45,0.4],[0,0.7]]},{"points":[[0.15,0.6],[0.45,1]]}],"pathTiming":"sequential"},"l":{"width":0.15,"paths":[{"points":[[0.075,0],[0.075,1]]}]},"m":{"width":0.7,"paths":[{"points":[[0,0.4],[0,1]]},{"points":[[0,0.55],[0.1,0.4],[0.25,0.4],[0.35,0.55],[0.35,1]]},{"points":[[0.35,0.55],[0.45,0.4],[0.6,0.4],[0.7,0.55],[0.7,1]]}],"pathTiming":"sequential"},"n":{"width":0.45,"paths":[{"points":[[0,0.4],[0,1]]},{"points":[[0,0.55],[0.15,0.4],[0.3,0.4],[0.45,0.55],[0.45,1]]}],"pathTiming":"sequential"},"o":{"width":0.5,"paths":[{"points":[[0.25,0.4],[0.1,0.4],[0,0.55],[0,0.85],[0.1,1],[0.4,1],[0.5,0.85],[0.5,0.55],[0.4,0.4],[0.25,0.4]]}]},"p":{"width":0.5,"paths":[{"points":[[0,0.4],[0,1.3]]},{"points":[[0,0.55],[0.15,0.4],[0.35,0.4],[0.5,0.55],[0.5,0.85],[0.35,1],[0.15,1],[0,0.85]]}],"pathTiming":"sequential"},"q":{"width":0.5,"paths":[{"points":[[0.5,0.4],[0.5,1.3]]},{"points":[[0.5,0.55],[0.35,0.4],[0.15,0.4],[0,0.55],[0,0.85],[0.15,1],[0.35,1],[0.5,0.85]]}],"pathTiming":"sequential"},"r":{"width":0.3,"paths":[{"points":[[0,0.4],[0,1]]},{"points":[[0,0.55],[0.1,0.4],[0.3,0.4]]}],"pathTiming":"sequential"},"s":{"width":0.4,"paths":[{"points":[[0.4,0.5],[0.3,0.4],[0.1,0.4],[0,0.5],[0,0.6],[0.1,0.7],[0.3,0.7],[0.4,0.8],[0.4,0.9],[0.3,1],[0.1,1],[0,0.9]]}]},"t":{"width":0.3,"paths":[{"points":[[0.1,0.15],[0.1,0.9],[0.2,1],[0.3,1]]},{"points":[[0,0.4],[0.25,0.4]]}],"pathTiming":"sequential"},"u":{"width":0.45,"paths":[{"points":[[0,0.4],[0,0.85],[0.15,1],[0.3,1],[0.45,0.85]]},{"points":[[0.45,0.4],[0.45,1]]}],"pathTiming":"sequential"},"v":{"width":0.45,"paths":[{"points":[[0,0.4],[0.225,1],[0.45,0.4]]}]},"w":{"width":0.65,"paths":[{"points":[[0,0.4],[0.15,1],[0.325,0.6],[0.5,1],[0.65,0.4]]}]},"x":{"width":0.4,"paths":[{"points":[[0,0.4],[0.4,1]]},{"points":[[0.4,0.4],[0,1]]}],"pathTiming":"sequential"},"y":{"width":0.45,"paths":[{"points":[[0,0.4],[0.225,0.85]]},{"points":[[0.45,0.4],[0.15,1],[0.05,1.2],[0,1.3]]}],"pathTiming":"sequential"},"z":{"width":0.4,"paths":[{"points":[[0,0.4],[0.4,0.4],[0,1],[0.4,1]]}]},".":{"width":0.12,"paths":[{"points":[[0.06,0.9],[0.06,0.92],[0.06,0.95],[0.06,1]]}]},",":{"width":0.12,"paths":[{"points":[[0.08,0.9],[0.06,1],[0,1.15]]}]},"!":{"width":0.12,"paths":[{"points":[[0.06,0],[0.06,0.7]]},{"points":[[0.06,0.9],[0.06,0.92],[0.06,0.95],[0.06,1]]}],"pathTiming":"sequential"},"?":{"width":0.45,"paths":[{"points":[[0,0.15],[0.1,0],[0.35,0],[0.45,0.15],[0.45,0.35],[0.3,0.5],[0.225,0.5],[0.225,0.7]]},{"points":[[0.225,0.9],[0.225,0.92],[0.225,0.95],[0.225,1]]}],"pathTiming":"sequential"},"'":{"width":0.1,"paths":[{"points":[[0.05,0],[0.05,0.1],[0.05,0.2]]}]},"\\"":{"width":0.25,"paths":[{"points":[[0.05,0],[0.05,0.1],[0.05,0.2]]},{"points":[[0.2,0],[0.2,0.1],[0.2,0.2]]}],"pathTiming":"parallel"},"-":{"width":0.3,"paths":[{"points":[[0,0.5],[0.1,0.5],[0.2,0.5],[0.3,0.5]]}]},"_":{"width":0.5,"paths":[{"points":[[0,1.05],[0.25,1.05],[0.5,1.05]]}]},":":{"width":0.12,"paths":[{"points":[[0.06,0.45],[0.06,0.48],[0.06,0.5]]},{"points":[[0.06,0.9],[0.06,0.93],[0.06,0.96],[0.06,1]]}],"pathTiming":"sequential"},";":{"width":0.12,"paths":[{"points":[[0.06,0.45],[0.06,0.48],[0.06,0.5]]},{"points":[[0.08,0.9],[0.06,1],[0,1.15]]}],"pathTiming":"sequential"},"(":{"width":0.25,"paths":[{"points":[[0.25,-0.1],[0.1,0.1],[0,0.35],[0,0.65],[0.1,0.9],[0.25,1.1]]}]},")":{"width":0.25,"paths":[{"points":[[0,-0.1],[0.15,0.1],[0.25,0.35],[0.25,0.65],[0.15,0.9],[0,1.1]]}]},"/":{"width":0.4,"paths":[{"points":[[0.4,-0.1],[0.2,0.5],[0,1.1]]}]},"+":{"width":0.45,"paths":[{"points":[[0.225,0.3],[0.225,0.7]]},{"points":[[0,0.5],[0.45,0.5]]}],"pathTiming":"sequential"},"=":{"width":0.45,"paths":[{"points":[[0,0.4],[0.45,0.4]]},{"points":[[0,0.6],[0.45,0.6]]}],"pathTiming":"sequential"}," ":{"width":0.3,"paths":[]}}`), i = {
2
+ glyphs: t
3
+ };
4
+ export {
5
+ i as default,
6
+ t as glyphs
7
+ };
8
+ //# sourceMappingURL=index26.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index26.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(t="anno"){const n=Date.now().toString(36),e=Math.random().toString(36).substring(2,9);return`${t}-${n}${e}`}exports.generateId=o;
2
+ //# sourceMappingURL=index27.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index27.cjs","sources":["../src/utils/idGenerator.js"],"sourcesContent":["/**\n * ID Generator Utility\n *\n * Generates unique IDs for annotations.\n *\n * @module utils/idGenerator\n */\n\n/**\n * Generate a unique ID for an annotation\n *\n * @param {string} [prefix='anno'] - ID prefix (e.g., 'highlight', 'text', 'ink')\n * @returns {string} Unique annotation ID\n * @example\n * ```javascript\n * const id = generateId('highlight');\n * // Returns: \"highlight-1234567890abc\"\n * ```\n */\nexport function generateId(prefix = 'anno') {\n const timestamp = Date.now().toString(36);\n const random = Math.random().toString(36).substring(2, 9);\n return `${prefix}-${timestamp}${random}`;\n}\n"],"names":["generateId","prefix","timestamp","random"],"mappings":"gFAmBO,SAASA,EAAWC,EAAS,OAAQ,CAC1C,MAAMC,EAAY,KAAK,IAAG,EAAG,SAAS,EAAE,EAClCC,EAAS,KAAK,SAAS,SAAS,EAAE,EAAE,UAAU,EAAG,CAAC,EACxD,MAAO,GAAGF,CAAM,IAAIC,CAAS,GAAGC,CAAM,EACxC"}
@@ -0,0 +1,8 @@
1
+ function r(t = "anno") {
2
+ const n = Date.now().toString(36), o = Math.random().toString(36).substring(2, 9);
3
+ return `${t}-${n}${o}`;
4
+ }
5
+ export {
6
+ r as generateId
7
+ };
8
+ //# sourceMappingURL=index27.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index27.js","sources":["../src/utils/idGenerator.js"],"sourcesContent":["/**\n * ID Generator Utility\n *\n * Generates unique IDs for annotations.\n *\n * @module utils/idGenerator\n */\n\n/**\n * Generate a unique ID for an annotation\n *\n * @param {string} [prefix='anno'] - ID prefix (e.g., 'highlight', 'text', 'ink')\n * @returns {string} Unique annotation ID\n * @example\n * ```javascript\n * const id = generateId('highlight');\n * // Returns: \"highlight-1234567890abc\"\n * ```\n */\nexport function generateId(prefix = 'anno') {\n const timestamp = Date.now().toString(36);\n const random = Math.random().toString(36).substring(2, 9);\n return `${prefix}-${timestamp}${random}`;\n}\n"],"names":["generateId","prefix","timestamp","random"],"mappings":"AAmBO,SAASA,EAAWC,IAAS,QAAQ;AAC1C,QAAMC,IAAY,KAAK,IAAG,EAAG,SAAS,EAAE,GAClCC,IAAS,KAAK,SAAS,SAAS,EAAE,EAAE,UAAU,GAAG,CAAC;AACxD,SAAO,GAAGF,CAAM,IAAIC,CAAS,GAAGC,CAAM;AACxC;"}
package/dist/index5.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const k=require("./index6.cjs"),P=require("./index14.cjs"),m=require("./index13.cjs"),C={pen:{jitter:{amplitude:1,frequency:.08},pressure:{taperIn:.15,taperOut:.2},wobble:{amplitude:1.5,frequency:.05}},highlight:{color:"rgba(255, 255, 0, 0.3)",width:24,lineCap:"butt",jitter:{amplitude:0}},text:{color:"rgba(220, 20, 60, 1.0)",width:2,fontSize:16,lineCap:"round",jitter:{amplitude:0},pressure:{taperIn:0,taperOut:0}}};class y{constructor(t,r={}){if(!t||!(t instanceof HTMLCanvasElement))throw new Error("StrokeRenderer: canvas must be a valid HTMLCanvasElement");this.canvas=t,this.ctx=t.getContext("2d"),this.config=k.deepMerge(C,r),this.strokes=[],this.viewport={width:0,height:0},this.converters={highlight:m.highlightToStrokes,text:P.textToStrokes}}registerConverter(t,r){if(typeof r!="function")throw new Error("StrokeRenderer.registerConverter: converter must be a function");this.converters[t]=r}setViewport(t,r){this.viewport={width:t,height:r};const i=window.devicePixelRatio||1;this.canvas.width=t*i,this.canvas.height=r*i,this.canvas.style.width=`${t}px`,this.canvas.style.height=`${r}px`,this.ctx.setTransform(i,0,0,i,0,0)}setAnnotations(t,r=null){if(!Array.isArray(t)){console.warn("StrokeRenderer.setAnnotations: annotations must be an array"),this.strokes=[];return}const i=r!==null?t.filter(e=>e.page===r):t;this.strokes=i.flatMap(e=>{const o=this.converters[e.type];if(!o)return console.warn(`StrokeRenderer: Unknown annotation type "${e.type}"`),[];const n=this._resolveStyle(e);return o(e,n)})}setStrokes(t){if(!Array.isArray(t)){console.warn("StrokeRenderer.setStrokes: strokes must be an array"),this.strokes=[];return}this.strokes=t}render(t){const{ctx:r,viewport:i,strokes:e}=this;r.clearRect(0,0,i.width,i.height);for(const o of e){if(t<o.start)continue;const n=o.end-o.start,h=t-o.start,s=n>0?Math.min(1,h/n):1;this._drawStroke(o,s)}}clear(){this.ctx.clearRect(0,0,this.viewport.width,this.viewport.height)}destroy(){this.strokes=[],this.ctx=null,this.canvas=null,this.config=null,this.converters=null}_resolveStyle(t){const{type:r,style:i}=t;let e={...this.config.pen};return this.config[r]&&(e=k.deepMerge(e,this.config[r])),i&&(e=k.deepMerge(e,i)),e}_interpolatePoint(t,r,i){return[t[0]+(r[0]-t[0])*i,t[1]+(r[1]-t[1])*i]}_interpolatePressures(t,r,i){const e=t.slice(0,r+1);if(r<t.length-1&&i>0){const o=t[r],n=t[r+1];e.push(o+(n-o)*i)}return e}_drawStroke(t,r){const{ctx:i}=this,{points:e,color:o,width:n,lineCap:h,pressures:s,uniformScale:g,baseX:l,baseY:c}=t;if(!e||e.length<2)return;if(i.strokeStyle=o||"rgba(0, 0, 0, 0.5)",i.lineCap=h||"round",i.lineJoin="round",r>=1){s&&s.length>=e.length?this._drawVariableWidthStroke(e,n,s,g,l,c):this._drawConstantWidthStroke(e,n,g,l,c);return}const a=e.length-1,d=r*a,u=Math.floor(d),p=d-u,f=e.slice(0,u+1);if(u<a&&p>0){const w=e[u],v=e[u+1];f.push(this._interpolatePoint(w,v,p))}if(!(f.length<2))if(s&&s.length>=e.length){const w=this._interpolatePressures(s,u,p);this._drawVariableWidthStroke(f,n,w,g,l,c)}else this._drawConstantWidthStroke(f,n,g,l,c)}_drawConstantWidthStroke(t,r,i=!1,e=null,o=null){const{ctx:n,viewport:h}=this;n.lineWidth=r||2,n.beginPath();const s=i&&e!==null&&o!==null;for(let g=0;g<t.length;g++){const[l,c]=t[g];let a,d;s?(a=e*h.width+l*h.height,d=o*h.height+c*h.height):i?(a=l*h.height,d=c*h.height):(a=l*h.width,d=c*h.height),g===0?n.moveTo(a,d):n.lineTo(a,d)}n.stroke()}_drawVariableWidthStroke(t,r,i,e=!1,o=null,n=null){const{ctx:h,viewport:s}=this,g=e&&o!==null&&n!==null;for(let l=1;l<t.length;l++){const[c,a]=t[l-1],[d,u]=t[l];let p,f,w,v;g?(p=o*s.width+c*s.height,f=n*s.height+a*s.height,w=o*s.width+d*s.height,v=n*s.height+u*s.height):e?(p=c*s.height,f=a*s.height,w=d*s.height,v=u*s.height):(p=c*s.width,f=a*s.height,w=d*s.width,v=u*s.height);const S=i[l-1]||1,x=i[l]||1,_=(S+x)/2,b=Math.max(.5,r*_);h.lineWidth=b,h.beginPath(),h.moveTo(p,f),h.lineTo(w,v),h.stroke()}}}exports.StrokeRenderer=y;exports.default=y;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("./index6.cjs"),P=require("./index17.cjs"),C=require("./index16.cjs"),T=require("./index15.cjs"),m=require("./index14.cjs"),M=require("./index13.cjs"),R={pen:{jitter:{amplitude:1,frequency:.08},pressure:{taperIn:.15,taperOut:.2},wobble:{amplitude:1.5,frequency:.05}},highlight:{color:"rgba(255, 255, 0, 0.3)",width:24,lineCap:"butt",jitter:{amplitude:0}},text:{color:"rgba(220, 20, 60, 1.0)",width:2,fontSize:16,lineCap:"round",jitter:{amplitude:0},pressure:{taperIn:0,taperOut:0}},underline:{color:"rgba(0, 0, 255, 0.8)",width:2,lineCap:"round"},arrow:{color:"rgba(255, 0, 0, 0.8)",width:2,lineCap:"round"},circle:{color:"rgba(255, 165, 0, 0.8)",width:3,lineCap:"round"}};class S{constructor(t,r={}){if(!t||!(t instanceof HTMLCanvasElement))throw new Error("StrokeRenderer: canvas must be a valid HTMLCanvasElement");this.canvas=t,this.ctx=t.getContext("2d"),this.config=v.deepMerge(R,r),this.strokes=[],this.viewport={width:0,height:0},this.converters={highlight:M.highlightToStrokes,text:m.textToStrokes,underline:T.underlineToStrokes,arrow:C.arrowToStrokes,circle:P.circleToStrokes}}registerConverter(t,r){if(typeof r!="function")throw new Error("StrokeRenderer.registerConverter: converter must be a function");this.converters[t]=r}setViewport(t,r){this.viewport={width:t,height:r};const i=window.devicePixelRatio||1;this.canvas.width=t*i,this.canvas.height=r*i,this.canvas.style.width=`${t}px`,this.canvas.style.height=`${r}px`,this.ctx.setTransform(i,0,0,i,0,0)}setAnnotations(t,r=null){if(!Array.isArray(t)){console.warn("StrokeRenderer.setAnnotations: annotations must be an array"),this.strokes=[];return}const i=r!==null?t.filter(e=>e.page===r):t;this.strokes=i.flatMap(e=>{const n=this.converters[e.type];if(!n)return console.warn(`StrokeRenderer: Unknown annotation type "${e.type}"`),[];const o=this._resolveStyle(e);return n(e,o)})}setStrokes(t){if(!Array.isArray(t)){console.warn("StrokeRenderer.setStrokes: strokes must be an array"),this.strokes=[];return}this.strokes=t}render(t){const{ctx:r,viewport:i,strokes:e}=this;r.clearRect(0,0,i.width,i.height);for(const n of e){if(t<n.start)continue;const o=n.end-n.start,h=t-n.start,s=o>0?Math.min(1,h/o):1;this._drawStroke(n,s)}}clear(){this.ctx.clearRect(0,0,this.viewport.width,this.viewport.height)}destroy(){this.strokes=[],this.ctx=null,this.canvas=null,this.config=null,this.converters=null}_resolveStyle(t){const{type:r,style:i}=t;let e={...this.config.pen};return this.config[r]&&(e=v.deepMerge(e,this.config[r])),i&&(e=v.deepMerge(e,i)),e}_interpolatePoint(t,r,i){return[t[0]+(r[0]-t[0])*i,t[1]+(r[1]-t[1])*i]}_interpolatePressures(t,r,i){const e=t.slice(0,r+1);if(r<t.length-1&&i>0){const n=t[r],o=t[r+1];e.push(n+(o-n)*i)}return e}_drawStroke(t,r){const{ctx:i}=this,{points:e,color:n,width:o,lineCap:h,pressures:s,uniformScale:u,baseX:l,baseY:c}=t;if(!e||e.length<2)return;if(i.strokeStyle=n||"rgba(0, 0, 0, 0.5)",i.lineCap=h||"round",i.lineJoin="round",r>=1){s&&s.length>=e.length?this._drawVariableWidthStroke(e,o,s,u,l,c):this._drawConstantWidthStroke(e,o,u,l,c);return}const a=e.length-1,d=r*a,g=Math.floor(d),w=d-g,p=e.slice(0,g+1);if(g<a&&w>0){const f=e[g],k=e[g+1];p.push(this._interpolatePoint(f,k,w))}if(!(p.length<2))if(s&&s.length>=e.length){const f=this._interpolatePressures(s,g,w);this._drawVariableWidthStroke(p,o,f,u,l,c)}else this._drawConstantWidthStroke(p,o,u,l,c)}_drawConstantWidthStroke(t,r,i=!1,e=null,n=null){const{ctx:o,viewport:h}=this;o.lineWidth=r||2,o.beginPath();const s=i&&e!==null&&n!==null;for(let u=0;u<t.length;u++){const[l,c]=t[u];let a,d;s?(a=e*h.width+l*h.height,d=n*h.height+c*h.height):i?(a=l*h.height,d=c*h.height):(a=l*h.width,d=c*h.height),u===0?o.moveTo(a,d):o.lineTo(a,d)}o.stroke()}_drawVariableWidthStroke(t,r,i,e=!1,n=null,o=null){const{ctx:h,viewport:s}=this,u=e&&n!==null&&o!==null;for(let l=1;l<t.length;l++){const[c,a]=t[l-1],[d,g]=t[l];let w,p,f,k;u?(w=n*s.width+c*s.height,p=o*s.height+a*s.height,f=n*s.width+d*s.height,k=o*s.height+g*s.height):e?(w=c*s.height,p=a*s.height,f=d*s.height,k=g*s.height):(w=c*s.width,p=a*s.height,f=d*s.width,k=g*s.height);const y=i[l-1]||1,x=i[l]||1,b=(y+x)/2,_=Math.max(.5,r*b);h.lineWidth=_,h.beginPath(),h.moveTo(w,p),h.lineTo(f,k),h.stroke()}}}exports.StrokeRenderer=S;exports.default=S;
2
2
  //# sourceMappingURL=index5.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index5.cjs","sources":["../src/renderer/StrokeRenderer.js"],"sourcesContent":["/**\n * StrokeRenderer - Unified canvas-based annotation renderer\n *\n * Single entry point for rendering annotations as strokes on canvas.\n * Handles conversion from annotations to strokes and progressive rendering.\n *\n * @module renderer/StrokeRenderer\n */\n\nimport { highlightToStrokes, textToStrokes } from '../converters/index.js';\nimport { deepMerge } from '../pen/effects.js';\n\n/**\n * Default configuration\n */\nconst DEFAULT_CONFIG = {\n pen: {\n jitter: { amplitude: 1.0, frequency: 0.08 },\n pressure: { taperIn: 0.15, taperOut: 0.20 },\n wobble: { amplitude: 1.5, frequency: 0.05 }\n },\n highlight: {\n color: 'rgba(255, 255, 0, 0.3)',\n width: 24,\n lineCap: 'butt',\n jitter: { amplitude: 0 }\n },\n text: {\n color: 'rgba(220, 20, 60, 1.0)',\n width: 2,\n fontSize: 16,\n lineCap: 'round',\n jitter: { amplitude: 0 },\n pressure: { taperIn: 0, taperOut: 0 }\n }\n};\n\n/**\n * StrokeRenderer class\n *\n * Converts annotations to strokes and renders them progressively on canvas.\n *\n * @class\n * @example\n * const renderer = new StrokeRenderer(canvas, {\n * highlight: { color: 'rgba(0, 255, 200, 0.4)' }\n * });\n * renderer.setViewport(800, 600);\n * renderer.setAnnotations(annotations);\n * renderer.render(1.5); // Render at t=1.5 seconds\n */\nclass StrokeRenderer {\n /**\n * Create StrokeRenderer instance\n *\n * @param {HTMLCanvasElement} canvas - Canvas element for rendering\n * @param {Object} [config={}] - Configuration overrides\n * @param {Object} [config.pen] - Global pen settings\n * @param {Object} [config.highlight] - Highlight type settings\n * @param {Object} [config.text] - Text type settings\n */\n constructor(canvas, config = {}) {\n if (!canvas || !(canvas instanceof HTMLCanvasElement)) {\n throw new Error('StrokeRenderer: canvas must be a valid HTMLCanvasElement');\n }\n\n this.canvas = canvas;\n this.ctx = canvas.getContext('2d');\n this.config = deepMerge(DEFAULT_CONFIG, config);\n this.strokes = [];\n this.viewport = { width: 0, height: 0 };\n\n // Register built-in converters\n this.converters = {\n highlight: highlightToStrokes,\n text: textToStrokes\n };\n }\n\n /**\n * Register a custom converter for a new annotation type\n *\n * @param {string} type - Annotation type name\n * @param {Function} converter - Converter function (annotation, style) => strokes[]\n */\n registerConverter(type, converter) {\n if (typeof converter !== 'function') {\n throw new Error('StrokeRenderer.registerConverter: converter must be a function');\n }\n this.converters[type] = converter;\n }\n\n /**\n * Set viewport dimensions and configure canvas\n *\n * Handles high-DPI displays by scaling the canvas buffer.\n *\n * @param {number} width - Viewport width in CSS pixels\n * @param {number} height - Viewport height in CSS pixels\n */\n setViewport(width, height) {\n this.viewport = { width, height };\n\n const dpr = window.devicePixelRatio || 1;\n\n // Set canvas buffer size (high-res)\n this.canvas.width = width * dpr;\n this.canvas.height = height * dpr;\n\n // Set canvas display size (CSS)\n this.canvas.style.width = `${width}px`;\n this.canvas.style.height = `${height}px`;\n\n // Scale context for high-DPI\n this.ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n }\n\n /**\n * Set annotations and convert them to strokes\n *\n * Clears existing strokes and converts all annotations.\n *\n * @param {Array} annotations - Array of annotation objects\n * @param {number} [page] - Optional page filter (only convert annotations for this page)\n */\n setAnnotations(annotations, page = null) {\n if (!Array.isArray(annotations)) {\n console.warn('StrokeRenderer.setAnnotations: annotations must be an array');\n this.strokes = [];\n return;\n }\n\n // Filter by page if specified\n const filtered = page !== null\n ? annotations.filter(a => a.page === page)\n : annotations;\n\n // Convert each annotation to strokes\n this.strokes = filtered.flatMap(annotation => {\n const converter = this.converters[annotation.type];\n\n if (!converter) {\n console.warn(`StrokeRenderer: Unknown annotation type \"${annotation.type}\"`);\n return [];\n }\n\n // Resolve style: pen → type → annotation.style\n const style = this._resolveStyle(annotation);\n\n return converter(annotation, style);\n });\n }\n\n /**\n * Set pre-converted strokes directly\n *\n * Bypasses conversion, useful when strokes come from external source.\n *\n * @param {Array} strokes - Array of stroke command objects\n */\n setStrokes(strokes) {\n if (!Array.isArray(strokes)) {\n console.warn('StrokeRenderer.setStrokes: strokes must be an array');\n this.strokes = [];\n return;\n }\n this.strokes = strokes;\n }\n\n /**\n * Render strokes at the given time\n *\n * Clears canvas and draws all visible strokes with appropriate progress.\n *\n * @param {number} time - Current time in seconds\n */\n render(time) {\n const { ctx, viewport, strokes } = this;\n\n // Clear canvas\n ctx.clearRect(0, 0, viewport.width, viewport.height);\n\n // Draw each stroke\n for (const stroke of strokes) {\n // Skip if not started yet\n if (time < stroke.start) {\n continue;\n }\n\n // Calculate progress\n const duration = stroke.end - stroke.start;\n const elapsed = time - stroke.start;\n const progress = duration > 0 ? Math.min(1, elapsed / duration) : 1;\n\n this._drawStroke(stroke, progress);\n }\n }\n\n /**\n * Clear the canvas\n */\n clear() {\n this.ctx.clearRect(0, 0, this.viewport.width, this.viewport.height);\n }\n\n /**\n * Destroy the renderer and release resources\n */\n destroy() {\n this.strokes = [];\n this.ctx = null;\n this.canvas = null;\n this.config = null;\n this.converters = null;\n }\n\n /**\n * Resolve style for an annotation\n *\n * Merges: pen config → type config → annotation.style\n *\n * @private\n * @param {Object} annotation - Annotation object\n * @returns {Object} Resolved style object\n */\n _resolveStyle(annotation) {\n const { type, style: annotationStyle } = annotation;\n\n // Start with pen config (global)\n let resolved = { ...this.config.pen };\n\n // Merge type config\n if (this.config[type]) {\n resolved = deepMerge(resolved, this.config[type]);\n }\n\n // Merge annotation-level style\n if (annotationStyle) {\n resolved = deepMerge(resolved, annotationStyle);\n }\n\n return resolved;\n }\n\n /**\n * Linearly interpolate between two points\n *\n * @private\n * @param {Array} p1 - Start point [x, y]\n * @param {Array} p2 - End point [x, y]\n * @param {number} t - Interpolation factor (0-1)\n * @returns {Array} Interpolated point [x, y]\n */\n _interpolatePoint(p1, p2, t) {\n return [\n p1[0] + (p2[0] - p1[0]) * t,\n p1[1] + (p2[1] - p1[1]) * t\n ];\n }\n\n /**\n * Get pressure values for visible points including interpolated final\n *\n * @private\n * @param {Array} pressures - Full pressure array\n * @param {number} lastCompleteIndex - Index of last complete point\n * @param {number} segmentProgress - Progress within current segment (0-1)\n * @returns {Array} Pressure values for visible points\n */\n _interpolatePressures(pressures, lastCompleteIndex, segmentProgress) {\n const visiblePressures = pressures.slice(0, lastCompleteIndex + 1);\n\n if (lastCompleteIndex < pressures.length - 1 && segmentProgress > 0) {\n const p1 = pressures[lastCompleteIndex];\n const p2 = pressures[lastCompleteIndex + 1];\n visiblePressures.push(p1 + (p2 - p1) * segmentProgress);\n }\n\n return visiblePressures;\n }\n\n /**\n * Draw a single stroke with progress\n *\n * Uses endpoint interpolation for smooth progressive rendering.\n *\n * @private\n * @param {Object} stroke - Stroke command object\n * @param {number} progress - Progress from 0 to 1\n */\n _drawStroke(stroke, progress) {\n const { ctx } = this;\n const { points, color, width, lineCap, pressures, uniformScale, baseX, baseY } = stroke;\n\n if (!points || points.length < 2) return;\n\n // Configure stroke style\n ctx.strokeStyle = color || 'rgba(0, 0, 0, 0.5)';\n ctx.lineCap = lineCap || 'round';\n ctx.lineJoin = 'round';\n\n // Fast path: full stroke, no interpolation needed\n if (progress >= 1) {\n if (pressures && pressures.length >= points.length) {\n this._drawVariableWidthStroke(points, width, pressures, uniformScale, baseX, baseY);\n } else {\n this._drawConstantWidthStroke(points, width, uniformScale, baseX, baseY);\n }\n return;\n }\n\n // Calculate segment position for interpolation\n const totalSegments = points.length - 1;\n const progressAlongPath = progress * totalSegments;\n const lastCompleteIndex = Math.floor(progressAlongPath);\n const segmentProgress = progressAlongPath - lastCompleteIndex;\n\n // Build visible points array with complete points\n const visiblePoints = points.slice(0, lastCompleteIndex + 1);\n\n // Interpolate final point if mid-segment\n if (lastCompleteIndex < totalSegments && segmentProgress > 0) {\n const p1 = points[lastCompleteIndex];\n const p2 = points[lastCompleteIndex + 1];\n visiblePoints.push(this._interpolatePoint(p1, p2, segmentProgress));\n }\n\n // Need at least 2 points to draw a line\n if (visiblePoints.length < 2) return;\n\n // Draw with variable width if pressures provided\n if (pressures && pressures.length >= points.length) {\n const visiblePressures = this._interpolatePressures(\n pressures, lastCompleteIndex, segmentProgress\n );\n this._drawVariableWidthStroke(visiblePoints, width, visiblePressures, uniformScale, baseX, baseY);\n } else {\n this._drawConstantWidthStroke(visiblePoints, width, uniformScale, baseX, baseY);\n }\n }\n\n /**\n * Draw stroke with constant width\n *\n * @private\n * @param {Array} points - Array of [x, y] coordinates (normalized or offset)\n * @param {number} width - Stroke width in pixels\n * @param {boolean} [uniformScale=false] - Use uniform scaling to preserve aspect ratio\n * @param {number} [baseX] - Base X position in width-normalized coords (for uniformScale with offset points)\n * @param {number} [baseY] - Base Y position in height-normalized coords (for uniformScale with offset points)\n */\n _drawConstantWidthStroke(points, width, uniformScale = false, baseX = null, baseY = null) {\n const { ctx, viewport } = this;\n\n ctx.lineWidth = width || 2;\n ctx.beginPath();\n\n // When uniformScale is true and baseX/baseY provided, points are offsets from base position\n // Base position is in mixed coords (X: width-normalized, Y: height-normalized)\n // Offsets are in uniform space (both scaled by viewport.height)\n const hasBasePosition = uniformScale && baseX !== null && baseY !== null;\n\n for (let i = 0; i < points.length; i++) {\n const [coordX, coordY] = points[i];\n let px, py;\n\n if (hasBasePosition) {\n // Base position in pixels + uniform-scaled offset\n px = baseX * viewport.width + coordX * viewport.height;\n py = baseY * viewport.height + coordY * viewport.height;\n } else if (uniformScale) {\n // Legacy: full coordinates in uniform space\n px = coordX * viewport.height;\n py = coordY * viewport.height;\n } else {\n // Standard: X scaled by width, Y by height\n px = coordX * viewport.width;\n py = coordY * viewport.height;\n }\n\n if (i === 0) {\n ctx.moveTo(px, py);\n } else {\n ctx.lineTo(px, py);\n }\n }\n\n ctx.stroke();\n }\n\n /**\n * Draw stroke with variable width based on pressure\n *\n * @private\n * @param {Array} points - Array of [x, y] coordinates (normalized or offset)\n * @param {number} baseWidth - Base stroke width in pixels\n * @param {Array} pressures - Pressure values (0-1) per point\n * @param {boolean} [uniformScale=false] - Use uniform scaling to preserve aspect ratio\n * @param {number} [baseX] - Base X position in width-normalized coords (for uniformScale with offset points)\n * @param {number} [baseY] - Base Y position in height-normalized coords (for uniformScale with offset points)\n */\n _drawVariableWidthStroke(points, baseWidth, pressures, uniformScale = false, baseX = null, baseY = null) {\n const { ctx, viewport } = this;\n\n // When uniformScale is true and baseX/baseY provided, points are offsets from base position\n const hasBasePosition = uniformScale && baseX !== null && baseY !== null;\n\n for (let i = 1; i < points.length; i++) {\n const [c1x, c1y] = points[i - 1];\n const [c2x, c2y] = points[i];\n\n let px1, py1, px2, py2;\n\n if (hasBasePosition) {\n // Base position in pixels + uniform-scaled offset\n px1 = baseX * viewport.width + c1x * viewport.height;\n py1 = baseY * viewport.height + c1y * viewport.height;\n px2 = baseX * viewport.width + c2x * viewport.height;\n py2 = baseY * viewport.height + c2y * viewport.height;\n } else if (uniformScale) {\n // Legacy: full coordinates in uniform space\n px1 = c1x * viewport.height;\n py1 = c1y * viewport.height;\n px2 = c2x * viewport.height;\n py2 = c2y * viewport.height;\n } else {\n // Standard: X scaled by width, Y by height\n px1 = c1x * viewport.width;\n py1 = c1y * viewport.height;\n px2 = c2x * viewport.width;\n py2 = c2y * viewport.height;\n }\n\n // Average pressure between two points\n const p1 = pressures[i - 1] || 1;\n const p2 = pressures[i] || 1;\n const avgPressure = (p1 + p2) / 2;\n\n // Apply pressure to width (min 0.5)\n const width = Math.max(0.5, baseWidth * avgPressure);\n\n ctx.lineWidth = width;\n ctx.beginPath();\n ctx.moveTo(px1, py1);\n ctx.lineTo(px2, py2);\n ctx.stroke();\n }\n }\n}\n\nexport { StrokeRenderer };\nexport default StrokeRenderer;\n"],"names":["DEFAULT_CONFIG","StrokeRenderer","canvas","config","deepMerge","highlightToStrokes","textToStrokes","type","converter","width","height","dpr","annotations","page","filtered","a","annotation","style","strokes","time","ctx","viewport","stroke","duration","elapsed","progress","annotationStyle","resolved","p1","p2","t","pressures","lastCompleteIndex","segmentProgress","visiblePressures","points","color","lineCap","uniformScale","baseX","baseY","totalSegments","progressAlongPath","visiblePoints","hasBasePosition","i","coordX","coordY","px","py","baseWidth","c1x","c1y","c2x","c2y","px1","py1","px2","py2","avgPressure"],"mappings":"kMAeMA,EAAiB,CACrB,IAAK,CACH,OAAQ,CAAE,UAAW,EAAK,UAAW,GAAI,EACzC,SAAU,CAAE,QAAS,IAAM,SAAU,EAAI,EACzC,OA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Unified canvas-based annotation renderer\n *\n * Single entry point for rendering annotations as strokes on canvas.\n * Handles conversion from annotations to strokes and progressive rendering.\n *\n * @module renderer/StrokeRenderer\n */\n\nimport {\n highlightToStrokes,\n textToStrokes,\n underlineToStrokes,\n arrowToStrokes,\n circleToStrokes\n} from '../converters/index.js';\nimport { deepMerge } from '../pen/effects.js';\n\n/**\n * Default configuration\n */\nconst DEFAULT_CONFIG = {\n pen: {\n jitter: { amplitude: 1.0, frequency: 0.08 },\n pressure: { taperIn: 0.15, taperOut: 0.20 },\n wobble: { amplitude: 1.5, frequency: 0.05 }\n },\n highlight: {\n color: 'rgba(255, 255, 0, 0.3)',\n width: 24,\n lineCap: 'butt',\n jitter: { amplitude: 0 }\n },\n text: {\n color: 'rgba(220, 20, 60, 1.0)',\n width: 2,\n fontSize: 16,\n lineCap: 'round',\n jitter: { amplitude: 0 },\n pressure: { taperIn: 0, taperOut: 0 }\n },\n underline: {\n color: 'rgba(0, 0, 255, 0.8)',\n width: 2,\n lineCap: 'round'\n },\n arrow: {\n color: 'rgba(255, 0, 0, 0.8)',\n width: 2,\n lineCap: 'round'\n },\n circle: {\n color: 'rgba(255, 165, 0, 0.8)',\n width: 3,\n lineCap: 'round'\n }\n};\n\n/**\n * StrokeRenderer class\n *\n * Converts annotations to strokes and renders them progressively on canvas.\n *\n * @class\n * @example\n * const renderer = new StrokeRenderer(canvas, {\n * highlight: { color: 'rgba(0, 255, 200, 0.4)' }\n * });\n * renderer.setViewport(800, 600);\n * renderer.setAnnotations(annotations);\n * renderer.render(1.5); // Render at t=1.5 seconds\n */\nclass StrokeRenderer {\n /**\n * Create StrokeRenderer instance\n *\n * @param {HTMLCanvasElement} canvas - Canvas element for rendering\n * @param {Object} [config={}] - Configuration overrides\n * @param {Object} [config.pen] - Global pen settings\n * @param {Object} [config.highlight] - Highlight type settings\n * @param {Object} [config.text] - Text type settings\n */\n constructor(canvas, config = {}) {\n if (!canvas || !(canvas instanceof HTMLCanvasElement)) {\n throw new Error('StrokeRenderer: canvas must be a valid HTMLCanvasElement');\n }\n\n this.canvas = canvas;\n this.ctx = canvas.getContext('2d');\n this.config = deepMerge(DEFAULT_CONFIG, config);\n this.strokes = [];\n this.viewport = { width: 0, height: 0 };\n\n // Register built-in converters\n this.converters = {\n highlight: highlightToStrokes,\n text: textToStrokes,\n underline: underlineToStrokes,\n arrow: arrowToStrokes,\n circle: circleToStrokes\n };\n }\n\n /**\n * Register a custom converter for a new annotation type\n *\n * @param {string} type - Annotation type name\n * @param {Function} converter - Converter function (annotation, style) => strokes[]\n */\n registerConverter(type, converter) {\n if (typeof converter !== 'function') {\n throw new Error('StrokeRenderer.registerConverter: converter must be a function');\n }\n this.converters[type] = converter;\n }\n\n /**\n * Set viewport dimensions and configure canvas\n *\n * Handles high-DPI displays by scaling the canvas buffer.\n *\n * @param {number} width - Viewport width in CSS pixels\n * @param {number} height - Viewport height in CSS pixels\n */\n setViewport(width, height) {\n this.viewport = { width, height };\n\n const dpr = window.devicePixelRatio || 1;\n\n // Set canvas buffer size (high-res)\n this.canvas.width = width * dpr;\n this.canvas.height = height * dpr;\n\n // Set canvas display size (CSS)\n this.canvas.style.width = `${width}px`;\n this.canvas.style.height = `${height}px`;\n\n // Scale context for high-DPI\n this.ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n }\n\n /**\n * Set annotations and convert them to strokes\n *\n * Clears existing strokes and converts all annotations.\n *\n * @param {Array} annotations - Array of annotation objects\n * @param {number} [page] - Optional page filter (only convert annotations for this page)\n */\n setAnnotations(annotations, page = null) {\n if (!Array.isArray(annotations)) {\n console.warn('StrokeRenderer.setAnnotations: annotations must be an array');\n this.strokes = [];\n return;\n }\n\n // Filter by page if specified\n const filtered = page !== null\n ? annotations.filter(a => a.page === page)\n : annotations;\n\n // Convert each annotation to strokes\n this.strokes = filtered.flatMap(annotation => {\n const converter = this.converters[annotation.type];\n\n if (!converter) {\n console.warn(`StrokeRenderer: Unknown annotation type \"${annotation.type}\"`);\n return [];\n }\n\n // Resolve style: pen → type → annotation.style\n const style = this._resolveStyle(annotation);\n\n return converter(annotation, style);\n });\n }\n\n /**\n * Set pre-converted strokes directly\n *\n * Bypasses conversion, useful when strokes come from external source.\n *\n * @param {Array} strokes - Array of stroke command objects\n */\n setStrokes(strokes) {\n if (!Array.isArray(strokes)) {\n console.warn('StrokeRenderer.setStrokes: strokes must be an array');\n this.strokes = [];\n return;\n }\n this.strokes = strokes;\n }\n\n /**\n * Render strokes at the given time\n *\n * Clears canvas and draws all visible strokes with appropriate progress.\n *\n * @param {number} time - Current time in seconds\n */\n render(time) {\n const { ctx, viewport, strokes } = this;\n\n // Clear canvas\n ctx.clearRect(0, 0, viewport.width, viewport.height);\n\n // Draw each stroke\n for (const stroke of strokes) {\n // Skip if not started yet\n if (time < stroke.start) {\n continue;\n }\n\n // Calculate progress\n const duration = stroke.end - stroke.start;\n const elapsed = time - stroke.start;\n const progress = duration > 0 ? Math.min(1, elapsed / duration) : 1;\n\n this._drawStroke(stroke, progress);\n }\n }\n\n /**\n * Clear the canvas\n */\n clear() {\n this.ctx.clearRect(0, 0, this.viewport.width, this.viewport.height);\n }\n\n /**\n * Destroy the renderer and release resources\n */\n destroy() {\n this.strokes = [];\n this.ctx = null;\n this.canvas = null;\n this.config = null;\n this.converters = null;\n }\n\n /**\n * Resolve style for an annotation\n *\n * Merges: pen config → type config → annotation.style\n *\n * @private\n * @param {Object} annotation - Annotation object\n * @returns {Object} Resolved style object\n */\n _resolveStyle(annotation) {\n const { type, style: annotationStyle } = annotation;\n\n // Start with pen config (global)\n let resolved = { ...this.config.pen };\n\n // Merge type config\n if (this.config[type]) {\n resolved = deepMerge(resolved, this.config[type]);\n }\n\n // Merge annotation-level style\n if (annotationStyle) {\n resolved = deepMerge(resolved, annotationStyle);\n }\n\n return resolved;\n }\n\n /**\n * Linearly interpolate between two points\n *\n * @private\n * @param {Array} p1 - Start point [x, y]\n * @param {Array} p2 - End point [x, y]\n * @param {number} t - Interpolation factor (0-1)\n * @returns {Array} Interpolated point [x, y]\n */\n _interpolatePoint(p1, p2, t) {\n return [\n p1[0] + (p2[0] - p1[0]) * t,\n p1[1] + (p2[1] - p1[1]) * t\n ];\n }\n\n /**\n * Get pressure values for visible points including interpolated final\n *\n * @private\n * @param {Array} pressures - Full pressure array\n * @param {number} lastCompleteIndex - Index of last complete point\n * @param {number} segmentProgress - Progress within current segment (0-1)\n * @returns {Array} Pressure values for visible points\n */\n _interpolatePressures(pressures, lastCompleteIndex, segmentProgress) {\n const visiblePressures = pressures.slice(0, lastCompleteIndex + 1);\n\n if (lastCompleteIndex < pressures.length - 1 && segmentProgress > 0) {\n const p1 = pressures[lastCompleteIndex];\n const p2 = pressures[lastCompleteIndex + 1];\n visiblePressures.push(p1 + (p2 - p1) * segmentProgress);\n }\n\n return visiblePressures;\n }\n\n /**\n * Draw a single stroke with progress\n *\n * Uses endpoint interpolation for smooth progressive rendering.\n *\n * @private\n * @param {Object} stroke - Stroke command object\n * @param {number} progress - Progress from 0 to 1\n */\n _drawStroke(stroke, progress) {\n const { ctx } = this;\n const { points, color, width, lineCap, pressures, uniformScale, baseX, baseY } = stroke;\n\n if (!points || points.length < 2) return;\n\n // Configure stroke style\n ctx.strokeStyle = color || 'rgba(0, 0, 0, 0.5)';\n ctx.lineCap = lineCap || 'round';\n ctx.lineJoin = 'round';\n\n // Fast path: full stroke, no interpolation needed\n if (progress >= 1) {\n if (pressures && pressures.length >= points.length) {\n this._drawVariableWidthStroke(points, width, pressures, uniformScale, baseX, baseY);\n } else {\n this._drawConstantWidthStroke(points, width, uniformScale, baseX, baseY);\n }\n return;\n }\n\n // Calculate segment position for interpolation\n const totalSegments = points.length - 1;\n const progressAlongPath = progress * totalSegments;\n const lastCompleteIndex = Math.floor(progressAlongPath);\n const segmentProgress = progressAlongPath - lastCompleteIndex;\n\n // Build visible points array with complete points\n const visiblePoints = points.slice(0, lastCompleteIndex + 1);\n\n // Interpolate final point if mid-segment\n if (lastCompleteIndex < totalSegments && segmentProgress > 0) {\n const p1 = points[lastCompleteIndex];\n const p2 = points[lastCompleteIndex + 1];\n visiblePoints.push(this._interpolatePoint(p1, p2, segmentProgress));\n }\n\n // Need at least 2 points to draw a line\n if (visiblePoints.length < 2) return;\n\n // Draw with variable width if pressures provided\n if (pressures && pressures.length >= points.length) {\n const visiblePressures = this._interpolatePressures(\n pressures, lastCompleteIndex, segmentProgress\n );\n this._drawVariableWidthStroke(visiblePoints, width, visiblePressures, uniformScale, baseX, baseY);\n } else {\n this._drawConstantWidthStroke(visiblePoints, width, uniformScale, baseX, baseY);\n }\n }\n\n /**\n * Draw stroke with constant width\n *\n * @private\n * @param {Array} points - Array of [x, y] coordinates (normalized or offset)\n * @param {number} width - Stroke width in pixels\n * @param {boolean} [uniformScale=false] - Use uniform scaling to preserve aspect ratio\n * @param {number} [baseX] - Base X position in width-normalized coords (for uniformScale with offset points)\n * @param {number} [baseY] - Base Y position in height-normalized coords (for uniformScale with offset points)\n */\n _drawConstantWidthStroke(points, width, uniformScale = false, baseX = null, baseY = null) {\n const { ctx, viewport } = this;\n\n ctx.lineWidth = width || 2;\n ctx.beginPath();\n\n // When uniformScale is true and baseX/baseY provided, points are offsets from base position\n // Base position is in mixed coords (X: width-normalized, Y: height-normalized)\n // Offsets are in uniform space (both scaled by viewport.height)\n const hasBasePosition = uniformScale && baseX !== null && baseY !== null;\n\n for (let i = 0; i < points.length; i++) {\n const [coordX, coordY] = points[i];\n let px, py;\n\n if (hasBasePosition) {\n // Base position in pixels + uniform-scaled offset\n px = baseX * viewport.width + coordX * viewport.height;\n py = baseY * viewport.height + coordY * viewport.height;\n } else if (uniformScale) {\n // Legacy: full coordinates in uniform space\n px = coordX * viewport.height;\n py = coordY * viewport.height;\n } else {\n // Standard: X scaled by width, Y by height\n px = coordX * viewport.width;\n py = coordY * viewport.height;\n }\n\n if (i === 0) {\n ctx.moveTo(px, py);\n } else {\n ctx.lineTo(px, py);\n }\n }\n\n ctx.stroke();\n }\n\n /**\n * Draw stroke with variable width based on pressure\n *\n * @private\n * @param {Array} points - Array of [x, y] coordinates (normalized or offset)\n * @param {number} baseWidth - Base stroke width in pixels\n * @param {Array} pressures - Pressure values (0-1) per point\n * @param {boolean} [uniformScale=false] - Use uniform scaling to preserve aspect ratio\n * @param {number} [baseX] - Base X position in width-normalized coords (for uniformScale with offset points)\n * @param {number} [baseY] - Base Y position in height-normalized coords (for uniformScale with offset points)\n */\n _drawVariableWidthStroke(points, baseWidth, pressures, uniformScale = false, baseX = null, baseY = null) {\n const { ctx, viewport } = this;\n\n // When uniformScale is true and baseX/baseY provided, points are offsets from base position\n const hasBasePosition = uniformScale && baseX !== null && baseY !== null;\n\n for (let i = 1; i < points.length; i++) {\n const [c1x, c1y] = points[i - 1];\n const [c2x, c2y] = points[i];\n\n let px1, py1, px2, py2;\n\n if (hasBasePosition) {\n // Base position in pixels + uniform-scaled offset\n px1 = baseX * viewport.width + c1x * viewport.height;\n py1 = baseY * viewport.height + c1y * viewport.height;\n px2 = baseX * viewport.width + c2x * viewport.height;\n py2 = baseY * viewport.height + c2y * viewport.height;\n } else if (uniformScale) {\n // Legacy: full coordinates in uniform space\n px1 = c1x * viewport.height;\n py1 = c1y * viewport.height;\n px2 = c2x * viewport.height;\n py2 = c2y * viewport.height;\n } else {\n // Standard: X scaled by width, Y by height\n px1 = c1x * viewport.width;\n py1 = c1y * viewport.height;\n px2 = c2x * viewport.width;\n py2 = c2y * viewport.height;\n }\n\n // Average pressure between two points\n const p1 = pressures[i - 1] || 1;\n const p2 = pressures[i] || 1;\n const avgPressure = (p1 + p2) / 2;\n\n // Apply pressure to width (min 0.5)\n const width = Math.max(0.5, baseWidth * avgPressure);\n\n ctx.lineWidth = width;\n ctx.beginPath();\n ctx.moveTo(px1, py1);\n ctx.lineTo(px2, py2);\n ctx.stroke();\n }\n }\n}\n\nexport { StrokeRenderer };\nexport default StrokeRenderer;\n"],"names":["DEFAULT_CONFIG","StrokeRenderer","canvas","config","deepMerge","highlightToStrokes","textToStrokes","underlineToStrokes","arrowToStrokes","circleToStrokes","type","converter","width","height","dpr","annotations","page","filtered","a","annotation","style","strokes","time","ctx","viewport","stroke","duration","elapsed","progress","annotationStyle","resolved","p1","p2","t","pressures","lastCompleteIndex","segmentProgress","visiblePressures","points","color","lineCap","uniformScale","baseX","baseY","totalSegments","progressAlongPath","visiblePoints","hasBasePosition","i","coordX","coordY","px","py","baseWidth","c1x","c1y","c2x","c2y","px1","py1","px2","py2","avgPressure"],"mappings":"mRAqBMA,EAAiB,CACrB,IAAK,CACH,OAAQ,CAAE,UAAW,EAAK,UAAW,GAAI,EACzC,SAAU,CAAE,QAAS,IAAM,SAAU,EAAI,EACzC,OAAQ,CAAE,UAAW,IAAK,UAAW,GAAI,CAC7C,EACE,UAAW,CACT,MAAO,yBACP,MAAO,GACP,QAAS,OACT,OAAQ,CAAE,UAAW,CAAC,CAC1B,EACE,KAAM,CACJ,MAAO,yBACP,MAAO,EACP,SAAU,GACV,QAAS,QACT,OAAQ,CAAE,UAAW,CAAC,EACtB,SAAU,CAAE,QAAS,EAAG,SAAU,CAAC,CACvC,EACE,UAAW,CACT,MAAO,uBACP,MAAO,EACP,QAAS,OACb,EACE,MAAO,CACL,MAAO,uBACP,MAAO,EACP,QAAS,OACb,EACE,OAAQ,CACN,MAAO,yBACP,MAAO,EACP,QAAS,OACb,CACA,EAgBA,MAAMC,CAAe,CAUnB,YAAYC,EAAQC,EAAS,GAAI,CAC/B,GAAI,CAACD,GAAU,EAAEA,aAAkB,mBACjC,MAAM,IAAI,MAAM,0DAA0D,EAG5E,KAAK,OAASA,EACd,KAAK,IAAMA,EAAO,WAAW,IAAI,EACjC,KAAK,OAASE,YAAUJ,EAAgBG,CAAM,EAC9C,KAAK,QAAU,CAAA,EACf,KAAK,SAAW,CAAE,MAAO,EAAG,OAAQ,CAAC,EAGrC,KAAK,WAAa,CAChB,UAAWE,EAAAA,mBACX,KAAMC,EAAAA,cACN,UAAWC,EAAAA,mBACX,MAAOC,EAAAA,eACP,O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M9B,EAAS,OACrBmC,EAAMJ,EAAM/B,EAAS,OACrBoC,EAAMJ,EAAMhC,EAAS,OACrBqC,EAAMJ,EAAMjC,EAAS,SAGrBkC,EAAMJ,EAAM9B,EAAS,MACrBmC,EAAMJ,EAAM/B,EAAS,OACrBoC,EAAMJ,EAAMhC,EAAS,MACrBqC,EAAMJ,EAAMjC,EAAS,QAIvB,MAAMO,EAAKG,EAAUc,EAAI,CAAC,GAAK,EACzBhB,EAAKE,EAAUc,CAAC,GAAK,EACrBc,GAAe/B,EAAKC,GAAM,EAG1BpB,EAAQ,KAAK,IAAI,GAAKyC,EAAYS,CAAW,EAEnDvC,EAAI,UAAYX,EAChBW,EAAI,UAAS,EACbA,EAAI,OAAOmC,EAAKC,CAAG,EACnBpC,EAAI,OAAOqC,EAAKC,CAAG,EACnBtC,EAAI,OAAM,CACZ,CACF,CACF"}
package/dist/index5.js CHANGED
@@ -1,7 +1,10 @@
1
- import { deepMerge as k } from "./index6.js";
2
- import { textToStrokes as _ } from "./index14.js";
3
- import { highlightToStrokes as b } from "./index13.js";
4
- const P = {
1
+ import { deepMerge as v } from "./index6.js";
2
+ import { circleToStrokes as b } from "./index17.js";
3
+ import { arrowToStrokes as _ } from "./index16.js";
4
+ import { underlineToStrokes as C } from "./index15.js";
5
+ import { textToStrokes as P } from "./index14.js";
6
+ import { highlightToStrokes as T } from "./index13.js";
7
+ const R = {
5
8
  pen: {
6
9
  jitter: { amplitude: 1, frequency: 0.08 },
7
10
  pressure: { taperIn: 0.15, taperOut: 0.2 },
@@ -20,9 +23,24 @@ const P = {
20
23
  lineCap: "round",
21
24
  jitter: { amplitude: 0 },
22
25
  pressure: { taperIn: 0, taperOut: 0 }
26
+ },
27
+ underline: {
28
+ color: "rgba(0, 0, 255, 0.8)",
29
+ width: 2,
30
+ lineCap: "round"
31
+ },
32
+ arrow: {
33
+ color: "rgba(255, 0, 0, 0.8)",
34
+ width: 2,
35
+ lineCap: "round"
36
+ },
37
+ circle: {
38
+ color: "rgba(255, 165, 0, 0.8)",
39
+ width: 3,
40
+ lineCap: "round"
23
41
  }
24
42
  };
25
- class W {
43
+ class O {
26
44
  /**
27
45
  * Create StrokeRenderer instance
28
46
  *
@@ -35,9 +53,12 @@ class W {
35
53
  constructor(t, r = {}) {
36
54
  if (!t || !(t instanceof HTMLCanvasElement))
37
55
  throw new Error("StrokeRenderer: canvas must be a valid HTMLCanvasElement");
38
- this.canvas = t, this.ctx = t.getContext("2d"), this.config = k(P, r), this.strokes = [], this.viewport = { width: 0, height: 0 }, this.converters = {
39
- highlight: b,
40
- text: _
56
+ this.canvas = t, this.ctx = t.getContext("2d"), this.config = v(R, r), this.strokes = [], this.viewport = { width: 0, height: 0 }, this.converters = {
57
+ highlight: T,
58
+ text: P,
59
+ underline: C,
60
+ arrow: _,
61
+ circle: b
41
62
  };
42
63
  }
43
64
  /**
@@ -82,8 +103,8 @@ class W {
82
103
  const n = this.converters[e.type];
83
104
  if (!n)
84
105
  return console.warn(`StrokeRenderer: Unknown annotation type "${e.type}"`), [];
85
- const o = this._resolveStyle(e);
86
- return n(e, o);
106
+ const s = this._resolveStyle(e);
107
+ return n(e, s);
87
108
  });
88
109
  }
89
110
  /**
@@ -113,8 +134,8 @@ class W {
113
134
  for (const n of e) {
114
135
  if (t < n.start)
115
136
  continue;
116
- const o = n.end - n.start, h = t - n.start, s = o > 0 ? Math.min(1, h / o) : 1;
117
- this._drawStroke(n, s);
137
+ const s = n.end - n.start, h = t - n.start, o = s > 0 ? Math.min(1, h / s) : 1;
138
+ this._drawStroke(n, o);
118
139
  }
119
140
  }
120
141
  /**
@@ -141,7 +162,7 @@ class W {
141
162
  _resolveStyle(t) {
142
163
  const { type: r, style: i } = t;
143
164
  let e = { ...this.config.pen };
144
- return this.config[r] && (e = k(e, this.config[r])), i && (e = k(e, i)), e;
165
+ return this.config[r] && (e = v(e, this.config[r])), i && (e = v(e, i)), e;
145
166
  }
146
167
  /**
147
168
  * Linearly interpolate between two points
@@ -170,8 +191,8 @@ class W {
170
191
  _interpolatePressures(t, r, i) {
171
192
  const e = t.slice(0, r + 1);
172
193
  if (r < t.length - 1 && i > 0) {
173
- const n = t[r], o = t[r + 1];
174
- e.push(n + (o - n) * i);
194
+ const n = t[r], s = t[r + 1];
195
+ e.push(n + (s - n) * i);
175
196
  }
176
197
  return e;
177
198
  }
@@ -185,27 +206,27 @@ class W {
185
206
  * @param {number} progress - Progress from 0 to 1
186
207
  */
187
208
  _drawStroke(t, r) {
188
- const { ctx: i } = this, { points: e, color: n, width: o, lineCap: h, pressures: s, uniformScale: g, baseX: l, baseY: a } = t;
209
+ const { ctx: i } = this, { points: e, color: n, width: s, lineCap: h, pressures: o, uniformScale: g, baseX: l, baseY: a } = t;
189
210
  if (!e || e.length < 2) return;
190
211
  if (i.strokeStyle = n || "rgba(0, 0, 0, 0.5)", i.lineCap = h || "round", i.lineJoin = "round", r >= 1) {
191
- s && s.length >= e.length ? this._drawVariableWidthStroke(e, o, s, g, l, a) : this._drawConstantWidthStroke(e, o, g, l, a);
212
+ o && o.length >= e.length ? this._drawVariableWidthStroke(e, s, o, g, l, a) : this._drawConstantWidthStroke(e, s, g, l, a);
192
213
  return;
193
214
  }
194
215
  const c = e.length - 1, d = r * c, u = Math.floor(d), f = d - u, p = e.slice(0, u + 1);
195
216
  if (u < c && f > 0) {
196
- const w = e[u], v = e[u + 1];
197
- p.push(this._interpolatePoint(w, v, f));
217
+ const w = e[u], k = e[u + 1];
218
+ p.push(this._interpolatePoint(w, k, f));
198
219
  }
199
220
  if (!(p.length < 2))
200
- if (s && s.length >= e.length) {
221
+ if (o && o.length >= e.length) {
201
222
  const w = this._interpolatePressures(
202
- s,
223
+ o,
203
224
  u,
204
225
  f
205
226
  );
206
- this._drawVariableWidthStroke(p, o, w, g, l, a);
227
+ this._drawVariableWidthStroke(p, s, w, g, l, a);
207
228
  } else
208
- this._drawConstantWidthStroke(p, o, g, l, a);
229
+ this._drawConstantWidthStroke(p, s, g, l, a);
209
230
  }
210
231
  /**
211
232
  * Draw stroke with constant width
@@ -218,15 +239,15 @@ class W {
218
239
  * @param {number} [baseY] - Base Y position in height-normalized coords (for uniformScale with offset points)
219
240
  */
220
241
  _drawConstantWidthStroke(t, r, i = !1, e = null, n = null) {
221
- const { ctx: o, viewport: h } = this;
222
- o.lineWidth = r || 2, o.beginPath();
223
- const s = i && e !== null && n !== null;
242
+ const { ctx: s, viewport: h } = this;
243
+ s.lineWidth = r || 2, s.beginPath();
244
+ const o = i && e !== null && n !== null;
224
245
  for (let g = 0; g < t.length; g++) {
225
246
  const [l, a] = t[g];
226
247
  let c, d;
227
- s ? (c = e * h.width + l * h.height, d = n * h.height + a * h.height) : i ? (c = l * h.height, d = a * h.height) : (c = l * h.width, d = a * h.height), g === 0 ? o.moveTo(c, d) : o.lineTo(c, d);
248
+ o ? (c = e * h.width + l * h.height, d = n * h.height + a * h.height) : i ? (c = l * h.height, d = a * h.height) : (c = l * h.width, d = a * h.height), g === 0 ? s.moveTo(c, d) : s.lineTo(c, d);
228
249
  }
229
- o.stroke();
250
+ s.stroke();
230
251
  }
231
252
  /**
232
253
  * Draw stroke with variable width based on pressure
@@ -239,19 +260,19 @@ class W {
239
260
  * @param {number} [baseX] - Base X position in width-normalized coords (for uniformScale with offset points)
240
261
  * @param {number} [baseY] - Base Y position in height-normalized coords (for uniformScale with offset points)
241
262
  */
242
- _drawVariableWidthStroke(t, r, i, e = !1, n = null, o = null) {
243
- const { ctx: h, viewport: s } = this, g = e && n !== null && o !== null;
263
+ _drawVariableWidthStroke(t, r, i, e = !1, n = null, s = null) {
264
+ const { ctx: h, viewport: o } = this, g = e && n !== null && s !== null;
244
265
  for (let l = 1; l < t.length; l++) {
245
266
  const [a, c] = t[l - 1], [d, u] = t[l];
246
- let f, p, w, v;
247
- g ? (f = n * s.width + a * s.height, p = o * s.height + c * s.height, w = n * s.width + d * s.height, v = o * s.height + u * s.height) : e ? (f = a * s.height, p = c * s.height, w = d * s.height, v = u * s.height) : (f = a * s.width, p = c * s.height, w = d * s.width, v = u * s.height);
248
- const y = i[l - 1] || 1, S = i[l] || 1, x = (y + S) / 2, m = Math.max(0.5, r * x);
249
- h.lineWidth = m, h.beginPath(), h.moveTo(f, p), h.lineTo(w, v), h.stroke();
267
+ let f, p, w, k;
268
+ g ? (f = n * o.width + a * o.height, p = s * o.height + c * o.height, w = n * o.width + d * o.height, k = s * o.height + u * o.height) : e ? (f = a * o.height, p = c * o.height, w = d * o.height, k = u * o.height) : (f = a * o.width, p = c * o.height, w = d * o.width, k = u * o.height);
269
+ const y = i[l - 1] || 1, S = i[l] || 1, m = (y + S) / 2, x = Math.max(0.5, r * m);
270
+ h.lineWidth = x, h.beginPath(), h.moveTo(f, p), h.lineTo(w, k), h.stroke();
250
271
  }
251
272
  }
252
273
  }
253
274
  export {
254
- W as StrokeRenderer,
255
- W as default
275
+ O as StrokeRenderer,
276
+ O as default
256
277
  };
257
278
  //# sourceMappingURL=index5.js.map