web-annotation-renderer 0.3.0 → 0.5.0

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 (96) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +49 -42
  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 +172 -17
  8. package/dist/index10.js.map +1 -1
  9. package/dist/index11.cjs +1 -1
  10. package/dist/index11.cjs.map +1 -1
  11. package/dist/index11.js +13 -20
  12. package/dist/index11.js.map +1 -1
  13. package/dist/index12.cjs +1 -1
  14. package/dist/index12.cjs.map +1 -1
  15. package/dist/index12.js +167 -124
  16. package/dist/index12.js.map +1 -1
  17. package/dist/index13.cjs +1 -1
  18. package/dist/index13.cjs.map +1 -1
  19. package/dist/index13.js +29 -198
  20. package/dist/index13.js.map +1 -1
  21. package/dist/index14.cjs +1 -1
  22. package/dist/index14.cjs.map +1 -1
  23. package/dist/index14.js +78 -15
  24. package/dist/index14.js.map +1 -1
  25. package/dist/index15.cjs +1 -1
  26. package/dist/index15.cjs.map +1 -1
  27. package/dist/index15.js +115 -120
  28. package/dist/index15.js.map +1 -1
  29. package/dist/index16.cjs +1 -1
  30. package/dist/index16.cjs.map +1 -1
  31. package/dist/index16.js +100 -212
  32. package/dist/index16.js.map +1 -1
  33. package/dist/index17.cjs +1 -1
  34. package/dist/index17.cjs.map +1 -1
  35. package/dist/index17.js +55 -37
  36. package/dist/index17.js.map +1 -1
  37. package/dist/index18.cjs +1 -1
  38. package/dist/index18.cjs.map +1 -1
  39. package/dist/index18.js +139 -35
  40. package/dist/index18.js.map +1 -1
  41. package/dist/index19.cjs +1 -1
  42. package/dist/index19.cjs.map +1 -1
  43. package/dist/index19.js +37 -37
  44. package/dist/index19.js.map +1 -1
  45. package/dist/index2.cjs +1 -1
  46. package/dist/index2.cjs.map +1 -1
  47. package/dist/index2.js +95 -73
  48. package/dist/index2.js.map +1 -1
  49. package/dist/index20.cjs +1 -1
  50. package/dist/index20.cjs.map +1 -1
  51. package/dist/index20.js +29 -39
  52. package/dist/index20.js.map +1 -1
  53. package/dist/index21.cjs +1 -1
  54. package/dist/index21.cjs.map +1 -1
  55. package/dist/index21.js +38 -32
  56. package/dist/index21.js.map +1 -1
  57. package/dist/index22.cjs +1 -1
  58. package/dist/index22.cjs.map +1 -1
  59. package/dist/index22.js +22 -5
  60. package/dist/index22.js.map +1 -1
  61. package/dist/index23.cjs +2 -0
  62. package/dist/index23.cjs.map +1 -0
  63. package/dist/index23.js +8 -0
  64. package/dist/index23.js.map +1 -0
  65. package/dist/index24.cjs +2 -0
  66. package/dist/index24.cjs.map +1 -0
  67. package/dist/index24.js +8 -0
  68. package/dist/index24.js.map +1 -0
  69. package/dist/index3.cjs +1 -1
  70. package/dist/index3.cjs.map +1 -1
  71. package/dist/index3.js +1 -1
  72. package/dist/index4.cjs +1 -1
  73. package/dist/index4.cjs.map +1 -1
  74. package/dist/index4.js +72 -71
  75. package/dist/index4.js.map +1 -1
  76. package/dist/index5.cjs +1 -1
  77. package/dist/index5.cjs.map +1 -1
  78. package/dist/index5.js +217 -65
  79. package/dist/index5.js.map +1 -1
  80. package/dist/index6.cjs +1 -1
  81. package/dist/index6.cjs.map +1 -1
  82. package/dist/index6.js +60 -114
  83. package/dist/index6.js.map +1 -1
  84. package/dist/index7.cjs +1 -1
  85. package/dist/index7.cjs.map +1 -1
  86. package/dist/index7.js +19 -91
  87. package/dist/index7.js.map +1 -1
  88. package/dist/index8.cjs +1 -1
  89. package/dist/index8.cjs.map +1 -1
  90. package/dist/index8.js +19 -105
  91. package/dist/index8.js.map +1 -1
  92. package/dist/index9.cjs +1 -1
  93. package/dist/index9.cjs.map +1 -1
  94. package/dist/index9.js +123 -98
  95. package/dist/index9.js.map +1 -1
  96. package/package.json +4 -3
package/dist/index21.js CHANGED
@@ -1,35 +1,41 @@
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
- }, s = {
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
- }, e = {
20
- strokes: [{
21
- color: "#1f2937",
22
- size: 3,
23
- points: [
24
- { t: 0, x: 0.1, y: 0.1 },
25
- { t: 1, x: 0.2, y: 0.2 }
26
- ]
27
- }]
28
- };
1
+ import { generateId as o } from "./index24.js";
2
+ function i(e) {
3
+ if (!e.content || typeof e.content != "string" || e.content.trim().length === 0)
4
+ throw new Error("Text annotation requires non-empty content");
5
+ if (typeof e.x != "number" || e.x < 0 || e.x > 1)
6
+ throw new Error("Text annotation x position must be between 0 and 1");
7
+ if (typeof e.y != "number" || e.y < 0 || e.y > 1)
8
+ throw new Error("Text annotation y position must be between 0 and 1");
9
+ if (typeof e.w != "number" || e.w < 0 || e.w > 1)
10
+ throw new Error("Text annotation width (w) must be between 0 and 1");
11
+ if (typeof e.h != "number" || e.h < 0 || e.h > 1)
12
+ throw new Error("Text annotation height (h) must be between 0 and 1");
13
+ if (!e.page || typeof e.page != "number" || e.page < 1)
14
+ throw new Error("Text annotation requires a valid page number (>= 1)");
15
+ if (!e.sentence_ref || typeof e.sentence_ref != "string")
16
+ throw new Error("Text annotation requires a sentence_ref for timing");
17
+ const t = e.textColor || "#1f2937", n = e.bgColor || "transparent";
18
+ return {
19
+ id: o("text"),
20
+ type: "text",
21
+ // Type name is 'text', not 'text_annotation'
22
+ page: e.page,
23
+ content: e.content.trim(),
24
+ x: e.x,
25
+ // Direct properties, not in position object
26
+ y: e.y,
27
+ w: e.w,
28
+ h: e.h,
29
+ style: {
30
+ // Colors wrapped in style object
31
+ bg: n,
32
+ color: t
33
+ },
34
+ sentence_ref: e.sentence_ref
35
+ // Note: start/end will be added during timing sync phase
36
+ };
37
+ }
29
38
  export {
30
- o as BASE_DEFAULTS,
31
- t as HIGHLIGHT_DEFAULTS,
32
- e as INK_DEFAULTS,
33
- s as TEXT_DEFAULTS
39
+ i as createText
34
40
  };
35
41
  //# sourceMappingURL=index21.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index21.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 ink annotations\n *\n * Creates a visible diagonal line in dark gray.\n *\n * @constant {Object}\n * @property {Array<Object>} strokes - Default stroke with two points\n */\nexport const INK_DEFAULTS = {\n strokes: [{\n color: '#1f2937',\n size: 3,\n points: [\n { t: 0, x: 0.1, y: 0.1 },\n { t: 1, x: 0.2, y: 0.2 }\n ]\n }]\n};\n"],"names":["BASE_DEFAULTS","HIGHLIGHT_DEFAULTS","TEXT_DEFAULTS","INK_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,GAUaC,IAAe;AAAA,EAC1B,SAAS,CAAC;AAAA,IACR,OAAO;AAAA,IACP,MAAM;AAAA,IACN,QAAQ;AAAA,MACN,EAAE,GAAG,GAAG,GAAG,KAAK,GAAG,IAAG;AAAA,MACtB,EAAE,GAAG,GAAG,GAAG,KAAK,GAAG,IAAG;AAAA,IAC5B;AAAA,EACA,CAAG;AACH;"}
1
+ {"version":3,"file":"index21.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;"}
package/dist/index22.cjs CHANGED
@@ -1,2 +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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t={page:1,start:0,end:0},o={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"}};exports.BASE_DEFAULTS=t;exports.HIGHLIGHT_DEFAULTS=o;exports.TEXT_DEFAULTS=e;
2
2
  //# sourceMappingURL=index22.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index22.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"}
1
+ {"version":3,"file":"index22.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"],"names":["BASE_DEFAULTS","HIGHLIGHT_DEFAULTS","TEXT_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"}
package/dist/index22.js CHANGED
@@ -1,8 +1,25 @@
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
- }
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
+ }, e = {
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
+ };
5
20
  export {
6
- r as generateId
21
+ o as BASE_DEFAULTS,
22
+ t as HIGHLIGHT_DEFAULTS,
23
+ e as TEXT_DEFAULTS
7
24
  };
8
25
  //# sourceMappingURL=index22.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index22.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":"index22.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"],"names":["BASE_DEFAULTS","HIGHLIGHT_DEFAULTS","TEXT_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;"}
@@ -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=index23.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index23.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=index23.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index23.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=index24.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index24.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=index24.js.map
@@ -0,0 +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;"}
package/dist/index3.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("pdfjs-dist"),l=require("./index11.cjs");function d(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const r in n)if(r!=="default"){const t=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,t.get?t:{enumerable:!0,get:()=>n[r]})}}return e.default=n,Object.freeze(e)}const u=d(i);class f{constructor(){this.pdfDoc=null,this.renderTask=null}async loadDocument(e){try{if(!e||typeof e!="string")return{success:!1,error:"Invalid PDF URL provided"};const t=await u.getDocument(e).promise;return this.pdfDoc=t,{success:!0,pageCount:t.numPages}}catch(r){return console.error("PDF loading error:",r),{success:!1,error:`Failed to load PDF: ${r.message}`}}}async renderPage(e,r,t){try{if(!this.pdfDoc)return{success:!1,error:"No PDF document loaded"};if(!r||!(r instanceof HTMLCanvasElement))return{success:!1,error:"Invalid canvas element provided"};if(e<1||e>this.pdfDoc.numPages)return{success:!1,error:`Invalid page number: ${e}. Document has ${this.pdfDoc.numPages} pages.`};this.renderTask&&(this.renderTask.cancel(),this.renderTask=null);const s=await this.pdfDoc.getPage(e),o=l.calculateViewport(s,t);r.width=o.width,r.height=o.height;const c=r.getContext("2d");if(!c)return{success:!1,error:"Failed to get canvas 2d context"};const a={canvasContext:c,viewport:o};return this.renderTask=s.render(a),await this.renderTask.promise,this.renderTask=null,{success:!0,viewport:o}}catch(s){return s.name==="RenderingCancelledException"?(console.log("Rendering cancelled"),{success:!1,error:"Rendering was cancelled"}):(console.error("Page rendering error:",s),{success:!1,error:`Failed to render page: ${s.message}`})}finally{this.renderTask=null}}getPageCount(){return this.pdfDoc?this.pdfDoc.numPages:0}cancelRender(){if(this.renderTask)try{this.renderTask.cancel()}catch(e){console.log("Render cancellation error (ignored):",e)}finally{this.renderTask=null}}destroy(){this.cancelRender(),this.pdfDoc&&(this.pdfDoc=null),this.renderTask=null}}exports.PDFRenderer=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("pdfjs-dist"),l=require("./index8.cjs");function d(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const r in n)if(r!=="default"){const t=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,t.get?t:{enumerable:!0,get:()=>n[r]})}}return e.default=n,Object.freeze(e)}const u=d(i);class f{constructor(){this.pdfDoc=null,this.renderTask=null}async loadDocument(e){try{if(!e||typeof e!="string")return{success:!1,error:"Invalid PDF URL provided"};const t=await u.getDocument(e).promise;return this.pdfDoc=t,{success:!0,pageCount:t.numPages}}catch(r){return console.error("PDF loading error:",r),{success:!1,error:`Failed to load PDF: ${r.message}`}}}async renderPage(e,r,t){try{if(!this.pdfDoc)return{success:!1,error:"No PDF document loaded"};if(!r||!(r instanceof HTMLCanvasElement))return{success:!1,error:"Invalid canvas element provided"};if(e<1||e>this.pdfDoc.numPages)return{success:!1,error:`Invalid page number: ${e}. Document has ${this.pdfDoc.numPages} pages.`};this.renderTask&&(this.renderTask.cancel(),this.renderTask=null);const s=await this.pdfDoc.getPage(e),o=l.calculateViewport(s,t);r.width=o.width,r.height=o.height;const c=r.getContext("2d");if(!c)return{success:!1,error:"Failed to get canvas 2d context"};const a={canvasContext:c,viewport:o};return this.renderTask=s.render(a),await this.renderTask.promise,this.renderTask=null,{success:!0,viewport:o}}catch(s){return s.name==="RenderingCancelledException"?(console.log("Rendering cancelled"),{success:!1,error:"Rendering was cancelled"}):(console.error("Page rendering error:",s),{success:!1,error:`Failed to render page: ${s.message}`})}finally{this.renderTask=null}}getPageCount(){return this.pdfDoc?this.pdfDoc.numPages:0}cancelRender(){if(this.renderTask)try{this.renderTask.cancel()}catch(e){console.log("Render cancellation error (ignored):",e)}finally{this.renderTask=null}}destroy(){this.cancelRender(),this.pdfDoc&&(this.pdfDoc=null),this.renderTask=null}}exports.PDFRenderer=f;
2
2
  //# sourceMappingURL=index3.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index3.cjs","sources":["../src/core/PDFRenderer.js"],"sourcesContent":["/**\n * PDFRenderer - Framework-agnostic PDF rendering subsystem\n *\n * This module encapsulates all pdf.js operations including document loading,\n * page rendering, viewport calculations, and rendering task management.\n *\n * @module core/PDFRenderer\n */\n\nimport * as pdfjsLib from \"pdfjs-dist\";\nimport { calculateViewport } from \"../utils/viewportUtils.js\";\n\n/**\n * PDFRenderer class\n *\n * Provides framework-agnostic PDF rendering capabilities.\n * Abstracts pdf.js complexity and provides clean interface for engine.\n *\n * @class\n * @example\n * const renderer = new PDFRenderer();\n * await renderer.loadDocument('/path/to/doc.pdf');\n * const result = await renderer.renderPage(1, canvasElement, 1.5);\n */\nexport class PDFRenderer {\n constructor() {\n /**\n * @private\n * @type {PDFDocumentProxy|null}\n */\n this.pdfDoc = null;\n\n /**\n * @private\n * @type {RenderTask|null}\n */\n this.renderTask = null;\n }\n\n /**\n * Load PDF document from URL\n *\n * @param {string} url - URL or path to PDF file\n * @returns {Promise<{success: boolean, pageCount?: number, error?: string}>}\n */\n async loadDocument(url) {\n try {\n if (!url || typeof url !== \"string\") {\n return {\n success: false,\n error: \"Invalid PDF URL provided\",\n };\n }\n\n const loadingTask = pdfjsLib.getDocument(url);\n const pdf = await loadingTask.promise;\n\n this.pdfDoc = pdf;\n\n return {\n success: true,\n pageCount: pdf.numPages,\n };\n } catch (err) {\n console.error(\"PDF loading error:\", err);\n return {\n success: false,\n error: `Failed to load PDF: ${err.message}`,\n };\n }\n }\n\n /**\n * Render PDF page to canvas element\n *\n * @param {number} pageNum - Page number (1-indexed)\n * @param {HTMLCanvasElement} canvas - Canvas element to render to\n * @param {number} scale - Scale factor for rendering\n * @returns {Promise<{success: boolean, viewport?: Object, error?: string}>}\n */\n async renderPage(pageNum, canvas, scale) {\n try {\n if (!this.pdfDoc) {\n return {\n success: false,\n error: \"No PDF document loaded\",\n };\n }\n\n if (!canvas || !(canvas instanceof HTMLCanvasElement)) {\n return {\n success: false,\n error: \"Invalid canvas element provided\",\n };\n }\n\n if (pageNum < 1 || pageNum > this.pdfDoc.numPages) {\n return {\n success: false,\n error: `Invalid page number: ${pageNum}. Document has ${this.pdfDoc.numPages} pages.`,\n };\n }\n\n // Cancel any in-progress rendering\n if (this.renderTask) {\n this.renderTask.cancel();\n this.renderTask = null;\n }\n\n const page = await this.pdfDoc.getPage(pageNum);\n const viewport = calculateViewport(page, scale);\n\n canvas.width = viewport.width;\n canvas.height = viewport.height;\n\n const context = canvas.getContext(\"2d\");\n if (!context) {\n return {\n success: false,\n error: \"Failed to get canvas 2d context\",\n };\n }\n\n const renderContext = {\n canvasContext: context,\n viewport: viewport,\n };\n\n this.renderTask = page.render(renderContext);\n await this.renderTask.promise;\n\n this.renderTask = null;\n\n return {\n success: true,\n viewport: viewport,\n };\n } catch (err) {\n if (err.name === \"RenderingCancelledException\") {\n console.log(\"Rendering cancelled\");\n return {\n success: false,\n error: \"Rendering was cancelled\",\n };\n }\n\n console.error(\"Page rendering error:\", err);\n return {\n success: false,\n error: `Failed to render page: ${err.message}`,\n };\n } finally {\n this.renderTask = null;\n }\n }\n\n /**\n * Get total number of pages in loaded PDF\n *\n * @returns {number} Page count, or 0 if no document loaded\n */\n getPageCount() {\n return this.pdfDoc ? this.pdfDoc.numPages : 0;\n }\n\n /**\n * Cancel current rendering task if active\n *\n * @returns {void}\n */\n cancelRender() {\n if (this.renderTask) {\n try {\n this.renderTask.cancel();\n } catch (err) {\n console.log(\"Render cancellation error (ignored):\", err);\n } finally {\n this.renderTask = null;\n }\n }\n }\n\n /**\n * Clean up resources and release references\n *\n * @returns {void}\n */\n destroy() {\n this.cancelRender();\n\n if (this.pdfDoc) {\n this.pdfDoc = null;\n }\n\n this.renderTask = null;\n }\n}\n"],"names":["PDFRenderer","url","pdf","pdfjsLib","err","pageNum","canvas","scale","page","viewport","calculateViewport","context","renderContext"],"mappings":"maAwBO,MAAMA,CAAY,CACvB,aAAc,CAKZ,KAAK,OAAS,KAMd,KAAK,WAAa,IACpB,CAQA,MAAM,aAAaC,EAAK,CACtB,GAAI,CACF,GAAI,CAACA,GAAO,OAAOA,GAAQ,SACzB,MAAO,CACL,QAAS,GACT,MAAO,0BACjB,EAIM,MAAMC,EAAM,MADQC,EAAS,YAAYF,CAAG,EACd,QAE9B,YAAK,OAASC,EAEP,CACL,QAAS,GACT,UAAWA,EAAI,QACvB,CACI,OAASE,EAAK,CACZ,eAAQ,MAAM,qBAAsBA,CAAG,EAChC,CACL,QAAS,GACT,MAAO,uBAAuBA,EAAI,OAAO,EACjD,CACI,CACF,CAUA,MAAM,WAAWC,EAASC,EAAQC,EAAO,CACvC,GAAI,CACF,GAAI,CAAC,KAAK,OACR,MAAO,CACL,QAAS,GACT,MAAO,wBACjB,EAGM,GAAI,CAACD,GAAU,EAAEA,aAAkB,mBACjC,MAAO,CACL,QAAS,GACT,MAAO,iCACjB,EAGM,GAAID,EAAU,GAAKA,EAAU,KAAK,OAAO,SACvC,MAAO,CACL,QAAS,GACT,MAAO,wBAAwBA,CAAO,kBAAkB,KAAK,OAAO,QAAQ,SACtF,EAIU,KAAK,aACP,KAAK,WAAW,OAAM,EACtB,KAAK,WAAa,MAGpB,MAAMG,EAAO,MAAM,KAAK,OAAO,QAAQH,CAAO,EACxCI,EAAWC,EAAAA,kBAAkBF,EAAMD,CAAK,EAE9CD,EAAO,MAAQG,EAAS,MACxBH,EAAO,OAASG,EAAS,OAEzB,MAAME,EAAUL,EAAO,WAAW,IAAI,EACtC,GAAI,CAACK,EACH,MAAO,CACL,QAAS,GACT,MAAO,iCACjB,EAGM,MAAMC,EAAgB,CACpB,cAAeD,EACf,SAAUF,CAClB,EAEM,YAAK,WAAaD,EAAK,OAAOI,CAAa,EAC3C,MAAM,KAAK,WAAW,QAEtB,KAAK,WAAa,KAEX,CACL,QAAS,GACT,SAAUH,CAClB,CACI,OAASL,EAAK,CACZ,OAAIA,EAAI,OAAS,+BACf,QAAQ,IAAI,qBAAqB,EAC1B,CACL,QAAS,GACT,MAAO,yBACjB,IAGM,QAAQ,MAAM,wBAAyBA,CAAG,EACnC,CACL,QAAS,GACT,MAAO,0BAA0BA,EAAI,OAAO,EACpD,EACI,QAAC,CACC,KAAK,WAAa,IACpB,CACF,CAOA,cAAe,CACb,OAAO,KAAK,OAAS,KAAK,OAAO,SAAW,CAC9C,CAOA,cAAe,CACb,GAAI,KAAK,WACP,GAAI,CACF,KAAK,WAAW,OAAM,CACxB,OAASA,EAAK,CACZ,QAAQ,IAAI,uCAAwCA,CAAG,CACzD,QAAC,CACC,KAAK,WAAa,IACpB,CAEJ,CAOA,SAAU,CACR,KAAK,aAAY,EAEb,KAAK,SACP,KAAK,OAAS,MAGhB,KAAK,WAAa,IACpB,CACF"}
1
+ {"version":3,"file":"index3.cjs","sources":["../src/core/PDFRenderer.js"],"sourcesContent":["/**\n * PDFRenderer - Framework-agnostic PDF rendering subsystem\n *\n * This module encapsulates all pdf.js operations including document loading,\n * page rendering, viewport calculations, and rendering task management.\n *\n * @module core/PDFRenderer\n */\n\nimport * as pdfjsLib from \"pdfjs-dist\";\nimport { calculateViewport } from \"../utils/viewportUtils.js\";\n\n/**\n * PDFRenderer class\n *\n * Provides framework-agnostic PDF rendering capabilities.\n * Abstracts pdf.js complexity and provides clean interface for engine.\n *\n * @class\n * @example\n * const renderer = new PDFRenderer();\n * await renderer.loadDocument('/path/to/doc.pdf');\n * const result = await renderer.renderPage(1, canvasElement, 1.5);\n */\nexport class PDFRenderer {\n constructor() {\n /**\n * @private\n * @type {PDFDocumentProxy|null}\n */\n this.pdfDoc = null;\n\n /**\n * @private\n * @type {RenderTask|null}\n */\n this.renderTask = null;\n }\n\n /**\n * Load PDF document from URL\n *\n * @param {string} url - URL or path to PDF file\n * @returns {Promise<{success: boolean, pageCount?: number, error?: string}>}\n */\n async loadDocument(url) {\n try {\n if (!url || typeof url !== \"string\") {\n return {\n success: false,\n error: \"Invalid PDF URL provided\",\n };\n }\n\n const loadingTask = pdfjsLib.getDocument(url);\n const pdf = await loadingTask.promise;\n\n this.pdfDoc = pdf;\n\n return {\n success: true,\n pageCount: pdf.numPages,\n };\n } catch (err) {\n console.error(\"PDF loading error:\", err);\n return {\n success: false,\n error: `Failed to load PDF: ${err.message}`,\n };\n }\n }\n\n /**\n * Render PDF page to canvas element\n *\n * @param {number} pageNum - Page number (1-indexed)\n * @param {HTMLCanvasElement} canvas - Canvas element to render to\n * @param {number} scale - Scale factor for rendering\n * @returns {Promise<{success: boolean, viewport?: Object, error?: string}>}\n */\n async renderPage(pageNum, canvas, scale) {\n try {\n if (!this.pdfDoc) {\n return {\n success: false,\n error: \"No PDF document loaded\",\n };\n }\n\n if (!canvas || !(canvas instanceof HTMLCanvasElement)) {\n return {\n success: false,\n error: \"Invalid canvas element provided\",\n };\n }\n\n if (pageNum < 1 || pageNum > this.pdfDoc.numPages) {\n return {\n success: false,\n error: `Invalid page number: ${pageNum}. Document has ${this.pdfDoc.numPages} pages.`,\n };\n }\n\n // Cancel any in-progress rendering\n if (this.renderTask) {\n this.renderTask.cancel();\n this.renderTask = null;\n }\n\n const page = await this.pdfDoc.getPage(pageNum);\n const viewport = calculateViewport(page, scale);\n\n canvas.width = viewport.width;\n canvas.height = viewport.height;\n\n const context = canvas.getContext(\"2d\");\n if (!context) {\n return {\n success: false,\n error: \"Failed to get canvas 2d context\",\n };\n }\n\n const renderContext = {\n canvasContext: context,\n viewport: viewport,\n };\n\n this.renderTask = page.render(renderContext);\n await this.renderTask.promise;\n\n this.renderTask = null;\n\n return {\n success: true,\n viewport: viewport,\n };\n } catch (err) {\n if (err.name === \"RenderingCancelledException\") {\n console.log(\"Rendering cancelled\");\n return {\n success: false,\n error: \"Rendering was cancelled\",\n };\n }\n\n console.error(\"Page rendering error:\", err);\n return {\n success: false,\n error: `Failed to render page: ${err.message}`,\n };\n } finally {\n this.renderTask = null;\n }\n }\n\n /**\n * Get total number of pages in loaded PDF\n *\n * @returns {number} Page count, or 0 if no document loaded\n */\n getPageCount() {\n return this.pdfDoc ? this.pdfDoc.numPages : 0;\n }\n\n /**\n * Cancel current rendering task if active\n *\n * @returns {void}\n */\n cancelRender() {\n if (this.renderTask) {\n try {\n this.renderTask.cancel();\n } catch (err) {\n console.log(\"Render cancellation error (ignored):\", err);\n } finally {\n this.renderTask = null;\n }\n }\n }\n\n /**\n * Clean up resources and release references\n *\n * @returns {void}\n */\n destroy() {\n this.cancelRender();\n\n if (this.pdfDoc) {\n this.pdfDoc = null;\n }\n\n this.renderTask = null;\n }\n}\n"],"names":["PDFRenderer","url","pdf","pdfjsLib","err","pageNum","canvas","scale","page","viewport","calculateViewport","context","renderContext"],"mappings":"kaAwBO,MAAMA,CAAY,CACvB,aAAc,CAKZ,KAAK,OAAS,KAMd,KAAK,WAAa,IACpB,CAQA,MAAM,aAAaC,EAAK,CACtB,GAAI,CACF,GAAI,CAACA,GAAO,OAAOA,GAAQ,SACzB,MAAO,CACL,QAAS,GACT,MAAO,0BACjB,EAIM,MAAMC,EAAM,MADQC,EAAS,YAAYF,CAAG,EACd,QAE9B,YAAK,OAASC,EAEP,CACL,QAAS,GACT,UAAWA,EAAI,QACvB,CACI,OAASE,EAAK,CACZ,eAAQ,MAAM,qBAAsBA,CAAG,EAChC,CACL,QAAS,GACT,MAAO,uBAAuBA,EAAI,OAAO,EACjD,CACI,CACF,CAUA,MAAM,WAAWC,EAASC,EAAQC,EAAO,CACvC,GAAI,CACF,GAAI,CAAC,KAAK,OACR,MAAO,CACL,QAAS,GACT,MAAO,wBACjB,EAGM,GAAI,CAACD,GAAU,EAAEA,aAAkB,mBACjC,MAAO,CACL,QAAS,GACT,MAAO,iCACjB,EAGM,GAAID,EAAU,GAAKA,EAAU,KAAK,OAAO,SACvC,MAAO,CACL,QAAS,GACT,MAAO,wBAAwBA,CAAO,kBAAkB,KAAK,OAAO,QAAQ,SACtF,EAIU,KAAK,aACP,KAAK,WAAW,OAAM,EACtB,KAAK,WAAa,MAGpB,MAAMG,EAAO,MAAM,KAAK,OAAO,QAAQH,CAAO,EACxCI,EAAWC,EAAAA,kBAAkBF,EAAMD,CAAK,EAE9CD,EAAO,MAAQG,EAAS,MACxBH,EAAO,OAASG,EAAS,OAEzB,MAAME,EAAUL,EAAO,WAAW,IAAI,EACtC,GAAI,CAACK,EACH,MAAO,CACL,QAAS,GACT,MAAO,iCACjB,EAGM,MAAMC,EAAgB,CACpB,cAAeD,EACf,SAAUF,CAClB,EAEM,YAAK,WAAaD,EAAK,OAAOI,CAAa,EAC3C,MAAM,KAAK,WAAW,QAEtB,KAAK,WAAa,KAEX,CACL,QAAS,GACT,SAAUH,CAClB,CACI,OAASL,EAAK,CACZ,OAAIA,EAAI,OAAS,+BACf,QAAQ,IAAI,qBAAqB,EAC1B,CACL,QAAS,GACT,MAAO,yBACjB,IAGM,QAAQ,MAAM,wBAAyBA,CAAG,EACnC,CACL,QAAS,GACT,MAAO,0BAA0BA,EAAI,OAAO,EACpD,EACI,QAAC,CACC,KAAK,WAAa,IACpB,CACF,CAOA,cAAe,CACb,OAAO,KAAK,OAAS,KAAK,OAAO,SAAW,CAC9C,CAOA,cAAe,CACb,GAAI,KAAK,WACP,GAAI,CACF,KAAK,WAAW,OAAM,CACxB,OAASA,EAAK,CACZ,QAAQ,IAAI,uCAAwCA,CAAG,CACzD,QAAC,CACC,KAAK,WAAa,IACpB,CAEJ,CAOA,SAAU,CACR,KAAK,aAAY,EAEb,KAAK,SACP,KAAK,OAAS,MAGhB,KAAK,WAAa,IACpB,CACF"}
package/dist/index3.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as c from "pdfjs-dist";
2
- import { calculateViewport as i } from "./index11.js";
2
+ import { calculateViewport as i } from "./index8.js";
3
3
  class u {
4
4
  constructor() {
5
5
  this.pdfDoc = null, this.renderTask = null;
package/dist/index4.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index7.cjs"),l=require("./index8.cjs"),o=require("./index9.cjs");class y{constructor(e,t){if(!e||!(e instanceof HTMLElement))throw new Error("LayerManager: containerElement must be a valid DOM element");if(!t||typeof t!="object")throw new Error("LayerManager: viewport must be a valid object");if(typeof t.width!="number"||typeof t.height!="number")throw new Error("LayerManager: viewport must have width and height properties");this.container=e,this.currentPage=null,this.currentViewport=t,this.allAnnotations=[],this.layers={highlight:new h.default(e,t),text:new l.default(e,t),drawing:new o.default(e,t)}}setAnnotations(e,t){if(Array.isArray(e)||(console.warn("LayerManager.setAnnotations: annotations must be an array"),e=[]),typeof t!="number"||t<1){console.warn("LayerManager.setAnnotations: invalid page number");return}this.allAnnotations=e,this.currentPage=t;const i=e.filter(r=>r.page===t),n=i.filter(r=>r.type==="highlight"),s=i.filter(r=>r.type==="text"),a=i.filter(r=>r.type==="ink");this.layers.highlight.setAnnotations(n),this.layers.text.setAnnotations(s),this.layers.drawing.setAnnotations(a),this.layers.highlight.render(),this.layers.text.render(),this.layers.drawing.render()}setViewport(e){if(!e||typeof e!="object"){console.warn("LayerManager.setViewport: invalid viewport object");return}this.currentViewport=e,this.layers.highlight.setViewport(e),this.layers.text.setViewport(e),this.layers.drawing.setViewport(e),this.layers.highlight.render(),this.layers.text.render(),this.layers.drawing.render()}updateTimeline(e){if(typeof e!="number"){console.warn("LayerManager.updateTimeline: timestamp must be a number");return}this.layers.highlight.updateTime(e),this.layers.text.updateTime(e),this.layers.drawing.updateTime(e)}destroy(){this.layers&&(this.layers.highlight.destroy(),this.layers.text.destroy(),this.layers.drawing.destroy(),this.layers=null),this.container=null,this.currentPage=null,this.currentViewport=null,this.allAnnotations=[]}}exports.LayerManager=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class r{constructor(){this.currentTime=0,this.subscribers=new Set,this.animationFrameId=null,this.isRunning=!1}setTime(n){n!==this.currentTime&&(this.currentTime=n,this.notifySubscribers())}getCurrentTime(){return this.currentTime}subscribe(n){if(typeof n!="function")throw new Error("TimelineSync.subscribe: callback must be a function");return this.subscribers.add(n),()=>this.unsubscribe(n)}unsubscribe(n){this.subscribers.delete(n)}startContinuousSync(n){if(typeof n!="function")throw new Error("TimelineSync.startContinuousSync: getTimeFunction must be a function");if(this.isRunning){console.warn("TimelineSync: Continuous sync already running");return}this.isRunning=!0;const i=()=>{if(this.isRunning){try{const e=n();this.setTime(e)}catch(e){console.error("TimelineSync: Error in continuous sync:",e)}this.animationFrameId=requestAnimationFrame(i)}};i()}stopContinuousSync(){this.isRunning=!1,this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}destroy(){this.stopContinuousSync(),this.subscribers.clear(),this.currentTime=0}notifySubscribers(){for(const n of this.subscribers)try{n(this.currentTime)}catch(i){console.error("TimelineSync: Subscriber callback error:",i)}}}exports.TimelineSync=r;
2
2
  //# sourceMappingURL=index4.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index4.cjs","sources":["../src/core/LayerManager.js"],"sourcesContent":["/**\n * LayerManager - Framework-agnostic layer orchestration subsystem\n *\n * This module manages annotation layer instances, routes annotations by type,\n * and coordinates viewport and timeline state across all layers.\n * Instantiates layer classes directly and manages their lifecycle.\n *\n * @module core/LayerManager\n */\n\nimport HighlightLayer from '../layers/HighlightLayer.js';\nimport TextLayer from '../layers/TextLayer.js';\nimport DrawingLayer from '../layers/DrawingLayer.js';\n\n/**\n * LayerManager class\n *\n * Orchestrates annotation layers by instantiating and managing layer instances.\n * Routes annotations to appropriate layers by type, propagates viewport changes,\n * and coordinates timeline updates. Uses Direct Instantiation Pattern for\n * framework-agnostic layer management.\n *\n * @class\n * @example\n * const viewport = { width: 800, height: 600, scale: 1.0 };\n * const manager = new LayerManager(containerElement, viewport);\n * manager.setAnnotations(annotations, 1);\n * manager.setViewport(newViewport);\n * manager.updateTimeline(5.0);\n * // Layers render automatically\n * manager.destroy();\n */\nexport class LayerManager {\n /**\n * Create LayerManager instance\n *\n * Instantiates all layer classes and manages their lifecycle.\n * Layers are created immediately and appended to container.\n *\n * @param {HTMLElement} containerElement - DOM element for layer rendering\n * @param {Object} viewport - Initial viewport dimensions\n * @param {number} viewport.width - Viewport width in pixels\n * @param {number} viewport.height - Viewport height in pixels\n * @param {number} viewport.scale - Scale factor\n * @throws {Error} If containerElement is not a valid DOM element\n * @throws {Error} If viewport is invalid or missing required properties\n */\n constructor(containerElement, viewport) {\n // Validate container element\n if (!containerElement || !(containerElement instanceof HTMLElement)) {\n throw new Error('LayerManager: containerElement must be a valid DOM element');\n }\n\n // Validate viewport\n if (!viewport || typeof viewport !== 'object') {\n throw new Error('LayerManager: viewport must be a valid object');\n }\n if (typeof viewport.width !== 'number' || typeof viewport.height !== 'number') {\n throw new Error('LayerManager: viewport must have width and height properties');\n }\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.container = containerElement;\n\n /**\n * @private\n * @type {number|null}\n */\n this.currentPage = null;\n\n /**\n * @private\n * @type {Object}\n */\n this.currentViewport = viewport;\n\n /**\n * @private\n * @type {Array}\n */\n this.allAnnotations = [];\n\n /**\n * Layer instances\n * @private\n * @type {Object}\n */\n this.layers = {\n highlight: new HighlightLayer(containerElement, viewport),\n text: new TextLayer(containerElement, viewport),\n drawing: new DrawingLayer(containerElement, viewport)\n };\n }\n\n /**\n * Set annotations and route to appropriate layers\n *\n * Filters annotations for the specified page and groups by type.\n * Passes annotations to layer instances and triggers render.\n * Layers create/update their DOM elements during render.\n *\n * @param {Array} annotations - Complete annotation array (all pages, all types)\n * @param {number} pageNum - Current page number (1-indexed)\n * @returns {void}\n */\n setAnnotations(annotations, pageNum) {\n // Validate inputs\n if (!Array.isArray(annotations)) {\n console.warn('LayerManager.setAnnotations: annotations must be an array');\n annotations = [];\n }\n\n if (typeof pageNum !== 'number' || pageNum < 1) {\n console.warn('LayerManager.setAnnotations: invalid page number');\n return;\n }\n\n // Store for reference\n this.allAnnotations = annotations;\n this.currentPage = pageNum;\n\n // Filter annotations for current page only\n const pageAnnotations = annotations.filter(a => a.page === pageNum);\n\n // Group by type\n const highlights = pageAnnotations.filter(a => a.type === 'highlight');\n const textAnnotations = pageAnnotations.filter(a => a.type === 'text');\n const inkAnnotations = pageAnnotations.filter(a => a.type === 'ink');\n\n // Pass annotations to layer instances\n this.layers.highlight.setAnnotations(highlights);\n this.layers.text.setAnnotations(textAnnotations);\n this.layers.drawing.setAnnotations(inkAnnotations);\n\n // Trigger render on all layers\n this.layers.highlight.render();\n this.layers.text.render();\n this.layers.drawing.render();\n }\n\n /**\n * Update viewport dimensions for all layers\n *\n * Propagates viewport object to all layer instances.\n * Triggers render to recalculate element positions and dimensions.\n * Viewport contains width, height, scale from PDFRenderer.\n *\n * @param {Object} viewport - Viewport object from PDFRenderer\n * @param {number} viewport.width - Viewport width in pixels\n * @param {number} viewport.height - Viewport height in pixels\n * @param {number} viewport.scale - Scale factor\n * @returns {void}\n */\n setViewport(viewport) {\n // Validate viewport\n if (!viewport || typeof viewport !== 'object') {\n console.warn('LayerManager.setViewport: invalid viewport object');\n return;\n }\n\n // Store viewport reference\n this.currentViewport = viewport;\n\n // Propagate to all layer instances\n this.layers.highlight.setViewport(viewport);\n this.layers.text.setViewport(viewport);\n this.layers.drawing.setViewport(viewport);\n\n // Trigger render on all layers (viewport change requires re-layout)\n this.layers.highlight.render();\n this.layers.text.render();\n this.layers.drawing.render();\n }\n\n /**\n * Update timeline position for all layers\n *\n * Propagates timestamp to all layer instances.\n * Layers handle their own animation updates (RAF loops, transforms, etc).\n *\n * @param {number} timestamp - Current timeline position in seconds\n * @returns {void}\n */\n updateTimeline(timestamp) {\n // Validate timestamp\n if (typeof timestamp !== 'number') {\n console.warn('LayerManager.updateTimeline: timestamp must be a number');\n return;\n }\n\n // Propagate time update to all layer instances\n this.layers.highlight.updateTime(timestamp);\n this.layers.text.updateTime(timestamp);\n this.layers.drawing.updateTime(timestamp);\n }\n\n /**\n * Clean up resources and destroy layer instances\n *\n * Calls destroy() on all layer instances to clean up DOM elements,\n * cancel animations, and release references.\n * Call before removing LayerManager instance.\n *\n * @returns {void}\n */\n destroy() {\n // Destroy all layer instances\n if (this.layers) {\n this.layers.highlight.destroy();\n this.layers.text.destroy();\n this.layers.drawing.destroy();\n this.layers = null;\n }\n\n // Clear all references\n this.container = null;\n this.currentPage = null;\n this.currentViewport = null;\n this.allAnnotations = [];\n }\n}\n"],"names":["LayerManager","containerElement","viewport","HighlightLayer","TextLayer","DrawingLayer","annotations","pageNum","pageAnnotations","a","highlights","textAnnotations","inkAnnotations","timestamp"],"mappings":"oKAgCO,MAAMA,CAAa,CAexB,YAAYC,EAAkBC,EAAU,CAEtC,GAAI,CAACD,GAAoB,EAAEA,aAA4B,aACrD,MAAM,IAAI,MAAM,4DAA4D,EAI9E,GAAI,CAACC,GAAY,OAAOA,GAAa,SACnC,MAAM,IAAI,MAAM,+CAA+C,EAEjE,GAAI,OAAOA,EAAS,OAAU,UAAY,OAAOA,EAAS,QAAW,SACnE,MAAM,IAAI,MAAM,8DAA8D,EAOhF,KAAK,UAAYD,EAMjB,KAAK,YAAc,KAMnB,KAAK,gBAAkBC,EAMvB,KAAK,eAAiB,CAAA,EAOtB,KAAK,OAAS,CACZ,UAAW,IAAIC,EAAAA,QAAeF,EAAkBC,CAAQ,EACxD,KAAM,IAAIE,EAAAA,QAAUH,EAAkBC,CAAQ,EAC9C,QAAS,IAAIG,UAAaJ,EAAkBC,CAAQ,CAC1D,CACE,CAaA,eAAeI,EAAaC,EAAS,CAOnC,GALK,MAAM,QAAQD,CAAW,IAC5B,QAAQ,KAAK,2DAA2D,EACxEA,EAAc,CAAA,GAGZ,OAAOC,GAAY,UAAYA,EAAU,EAAG,CAC9C,QAAQ,KAAK,kDAAkD,EAC/D,MACF,CAGA,KAAK,eAAiBD,EACtB,KAAK,YAAcC,EAGnB,MAAMC,EAAkBF,EAAY,OAAOG,GAAKA,EAAE,OAASF,CAAO,EAG5DG,EAAaF,EAAgB,OAAOC,GAAKA,EAAE,OAAS,WAAW,EAC/DE,EAAkBH,EAAgB,OAAOC,GAAKA,EAAE,OAAS,MAAM,EAC/DG,EAAiBJ,EAAgB,OAAOC,GAAKA,EAAE,OAAS,KAAK,EAGnE,KAAK,OAAO,UAAU,eAAeC,CAAU,EAC/C,KAAK,OAAO,KAAK,eAAeC,CAAe,EAC/C,KAAK,OAAO,QAAQ,eAAeC,CAAc,EAGjD,KAAK,OAAO,UAAU,OAAM,EAC5B,KAAK,OAAO,KAAK,OAAM,EACvB,KAAK,OAAO,QAAQ,OAAM,CAC5B,CAeA,YAAYV,EAAU,CAEpB,GAAI,CAACA,GAAY,OAAOA,GAAa,SAAU,CAC7C,QAAQ,KAAK,mDAAmD,EAChE,MACF,CAGA,KAAK,gBAAkBA,EAGvB,KAAK,OAAO,UAAU,YAAYA,CAAQ,EAC1C,KAAK,OAAO,KAAK,YAAYA,CAAQ,EACrC,KAAK,OAAO,QAAQ,YAAYA,CAAQ,EAGxC,KAAK,OAAO,UAAU,OAAM,EAC5B,KAAK,OAAO,KAAK,OAAM,EACvB,KAAK,OAAO,QAAQ,OAAM,CAC5B,CAWA,eAAeW,EAAW,CAExB,GAAI,OAAOA,GAAc,SAAU,CACjC,QAAQ,KAAK,yDAAyD,EACtE,MACF,CAGA,KAAK,OAAO,UAAU,WAAWA,CAAS,EAC1C,KAAK,OAAO,KAAK,WAAWA,CAAS,EACrC,KAAK,OAAO,QAAQ,WAAWA,CAAS,CAC1C,CAWA,SAAU,CAEJ,KAAK,SACP,KAAK,OAAO,UAAU,QAAO,EAC7B,KAAK,OAAO,KAAK,QAAO,EACxB,KAAK,OAAO,QAAQ,QAAO,EAC3B,KAAK,OAAS,MAIhB,KAAK,UAAY,KACjB,KAAK,YAAc,KACnB,KAAK,gBAAkB,KACvB,KAAK,eAAiB,CAAA,CACxB,CACF"}
1
+ {"version":3,"file":"index4.cjs","sources":["../src/core/TimelineSync.js"],"sourcesContent":["/**\n * TimelineSync - Framework-agnostic timeline synchronization subsystem\n *\n * This module manages timeline position and provides a subscriber notification\n * system for timeline updates. Supports both discrete updates (manual setTime)\n * and continuous synchronization via requestAnimationFrame for audio/video.\n *\n * @module core/TimelineSync\n */\n\n/**\n * TimelineSync class\n *\n * Provides timeline state management and pub-sub notification system.\n * Zero dependencies - pure JavaScript implementation.\n *\n * @class\n * @example\n * // Discrete mode\n * const sync = new TimelineSync();\n * sync.subscribe((time) => console.log('Time:', time));\n * sync.setTime(5.0);\n *\n * @example\n * // Continuous mode with audio\n * const audio = document.getElementById('audio');\n * sync.startContinuousSync(() => audio.currentTime);\n */\nexport class TimelineSync {\n constructor() {\n /**\n * @private\n * @type {number}\n */\n this.currentTime = 0;\n\n /**\n * @private\n * @type {Set<Function>}\n */\n this.subscribers = new Set();\n\n /**\n * @private\n * @type {number|null}\n */\n this.animationFrameId = null;\n\n /**\n * @private\n * @type {boolean}\n */\n this.isRunning = false;\n }\n\n /**\n * Set timeline position and notify subscribers if changed\n *\n * @param {number} timestamp - Timeline position in seconds\n * @returns {void}\n */\n setTime(timestamp) {\n if (timestamp === this.currentTime) {\n return;\n }\n\n this.currentTime = timestamp;\n this.notifySubscribers();\n }\n\n /**\n * Get current timeline position\n *\n * @returns {number} Current timeline position in seconds\n */\n getCurrentTime() {\n return this.currentTime;\n }\n\n /**\n * Subscribe to timeline updates\n *\n * @param {Function} callback - Function to call on timeline updates\n * @returns {Function} Unsubscribe function\n * @throws {Error} If callback is not a function\n */\n subscribe(callback) {\n if (typeof callback !== 'function') {\n throw new Error('TimelineSync.subscribe: callback must be a function');\n }\n\n this.subscribers.add(callback);\n\n return () => this.unsubscribe(callback);\n }\n\n /**\n * Unsubscribe from timeline updates\n *\n * @param {Function} callback - Callback function to remove\n * @returns {void}\n */\n unsubscribe(callback) {\n this.subscribers.delete(callback);\n }\n\n /**\n * Start continuous timeline synchronization\n *\n * @param {Function} getTimeFunction - Function that returns current time\n * @returns {void}\n * @throws {Error} If getTimeFunction is not a function\n */\n startContinuousSync(getTimeFunction) {\n if (typeof getTimeFunction !== 'function') {\n throw new Error('TimelineSync.startContinuousSync: getTimeFunction must be a function');\n }\n\n if (this.isRunning) {\n console.warn('TimelineSync: Continuous sync already running');\n return;\n }\n\n this.isRunning = true;\n\n const syncLoop = () => {\n if (!this.isRunning) {\n return;\n }\n\n try {\n const newTime = getTimeFunction();\n this.setTime(newTime);\n } catch (err) {\n console.error('TimelineSync: Error in continuous sync:', err);\n }\n\n this.animationFrameId = requestAnimationFrame(syncLoop);\n };\n\n syncLoop();\n }\n\n /**\n * Stop continuous timeline synchronization\n *\n * @returns {void}\n */\n stopContinuousSync() {\n this.isRunning = false;\n\n if (this.animationFrameId !== null) {\n cancelAnimationFrame(this.animationFrameId);\n this.animationFrameId = null;\n }\n }\n\n /**\n * Clean up resources and release references\n *\n * @returns {void}\n */\n destroy() {\n this.stopContinuousSync();\n this.subscribers.clear();\n this.currentTime = 0;\n }\n\n /**\n * Notify all subscribers of current time\n *\n * @private\n * @returns {void}\n */\n notifySubscribers() {\n for (const callback of this.subscribers) {\n try {\n callback(this.currentTime);\n } catch (err) {\n console.error('TimelineSync: Subscriber callback error:', err);\n }\n }\n }\n}\n"],"names":["TimelineSync","timestamp","callback","getTimeFunction","syncLoop","newTime","err"],"mappings":"gFA4BO,MAAMA,CAAa,CACxB,aAAc,CAKZ,KAAK,YAAc,EAMnB,KAAK,YAAc,IAAI,IAMvB,KAAK,iBAAmB,KAMxB,KAAK,UAAY,EACnB,CAQA,QAAQC,EAAW,CACbA,IAAc,KAAK,cAIvB,KAAK,YAAcA,EACnB,KAAK,kBAAiB,EACxB,CAOA,gBAAiB,CACf,OAAO,KAAK,WACd,CASA,UAAUC,EAAU,CAClB,GAAI,OAAOA,GAAa,WACtB,MAAM,IAAI,MAAM,qDAAqD,EAGvE,YAAK,YAAY,IAAIA,CAAQ,EAEtB,IAAM,KAAK,YAAYA,CAAQ,CACxC,CAQA,YAAYA,EAAU,CACpB,KAAK,YAAY,OAAOA,CAAQ,CAClC,CASA,oBAAoBC,EAAiB,CACnC,GAAI,OAAOA,GAAoB,WAC7B,MAAM,IAAI,MAAM,sEAAsE,EAGxF,GAAI,KAAK,UAAW,CAClB,QAAQ,KAAK,+CAA+C,EAC5D,MACF,CAEA,KAAK,UAAY,GAEjB,MAAMC,EAAW,IAAM,CACrB,GAAK,KAAK,UAIV,IAAI,CACF,MAAMC,EAAUF,EAAe,EAC/B,KAAK,QAAQE,CAAO,CACtB,OAASC,EAAK,CACZ,QAAQ,MAAM,0CAA2CA,CAAG,CAC9D,CAEA,KAAK,iBAAmB,sBAAsBF,CAAQ,EACxD,EAEAA,EAAQ,CACV,CAOA,oBAAqB,CACnB,KAAK,UAAY,GAEb,KAAK,mBAAqB,OAC5B,qBAAqB,KAAK,gBAAgB,EAC1C,KAAK,iBAAmB,KAE5B,CAOA,SAAU,CACR,KAAK,mBAAkB,EACvB,KAAK,YAAY,MAAK,EACtB,KAAK,YAAc,CACrB,CAQA,mBAAoB,CAClB,UAAWF,KAAY,KAAK,YAC1B,GAAI,CACFA,EAAS,KAAK,WAAW,CAC3B,OAASI,EAAK,CACZ,QAAQ,MAAM,2CAA4CA,CAAG,CAC/D,CAEJ,CACF"}