web-annotation-renderer 0.4.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.
package/dist/index14.js CHANGED
@@ -1,59 +1,81 @@
1
- import { applyJitter as j, applyPressure as b } from "./index6.js";
2
- import l from "./index23.js";
3
- function E(n) {
4
- return l.glyphs && l.glyphs[n] ? l.glyphs[n] : n === " " ? { strokes: [], width: 0.3 } : null;
1
+ import { applyPressure as q } from "./index6.js";
2
+ import w from "./index23.js";
3
+ function v(t, n = 2) {
4
+ if (t.length < 2 || n < 1)
5
+ return t;
6
+ const e = [];
7
+ for (let r = 0; r < t.length - 1; r++) {
8
+ const [a, o] = t[r], [g, S] = t[r + 1];
9
+ e.push([a, o]);
10
+ for (let s = 1; s <= n; s++) {
11
+ const h = s / (n + 1);
12
+ e.push([a + (g - a) * h, o + (S - o) * h]);
13
+ }
14
+ }
15
+ return e.push(t[t.length - 1]), e;
16
+ }
17
+ function y(t) {
18
+ return w.glyphs && w.glyphs[t] ? w.glyphs[t] : t === " " ? { paths: [], width: 0.35 } : null;
5
19
  }
6
- function F(n, t, i, e, u) {
7
- return n.map(([r, p]) => [
8
- t + r * e * u,
9
- i + p * e
10
- ]);
20
+ function G(t, n, e) {
21
+ return t.map(([r, a]) => [(n + r) * e, a * e]);
11
22
  }
12
- function X(n, t) {
13
- const {
14
- id: i,
15
- start: e,
16
- end: u,
17
- content: r,
18
- x: p,
19
- y: x,
20
- fontSize: z
21
- } = n;
22
- if (!r || r.length === 0)
23
+ function B(t, n) {
24
+ const { id: e, start: r, end: a, content: o, x: g, y: S, fontSize: s } = t;
25
+ if (!o || o.length === 0)
23
26
  return [];
24
- const d = [], D = u - e, a = (z || t.fontSize || 16) / 1e3;
25
- let h = p;
26
- const C = r.length, k = D / C;
27
- for (let o = 0; o < r.length; o++) {
28
- const I = r[o], f = E(I);
29
- if (!f) {
30
- h += a * 0.5;
27
+ const h = [], I = a - r, T = s || n.fontSize || 16, C = n.subdivisions ?? 2, $ = T / 1e3;
28
+ let u = 0;
29
+ const E = o.length, m = I / E;
30
+ for (let c = 0; c < o.length; c++) {
31
+ const F = o[c], l = y(F);
32
+ if (!l) {
33
+ u += 0.5 + 0.18;
34
+ continue;
35
+ }
36
+ const P = l.width || 0.5, p = l.paths || [], O = l.pathTiming || "sequential";
37
+ if (p.length === 0) {
38
+ u += P + 0.18;
31
39
  continue;
32
40
  }
33
- const g = f.width || 0.8, S = f.strokes || [], m = e + o * k, P = m + k;
34
- for (let s = 0; s < S.length; s++) {
35
- const $ = S[s].points || [];
36
- if ($.length < 2) continue;
37
- let c = F($, h, x, a, g);
38
- t.jitter?.amplitude > 0 && (c = j(c, t.jitter, `${i}-${o}-${s}`));
39
- let w = null;
40
- (t.pressure?.taperIn > 0 || t.pressure?.taperOut > 0) && (w = b(c, t.pressure)), d.push({
41
- id: `${i}-${o}-${s}`,
42
- points: c,
43
- start: m,
44
- end: P,
45
- color: t.color || "rgba(220, 20, 60, 1.0)",
46
- width: t.width || 2,
47
- lineCap: t.lineCap || "round",
48
- pressures: w
41
+ const x = r + c * m, X = x + m, j = p.length;
42
+ for (let i = 0; i < p.length; i++) {
43
+ let f = p[i].points || [];
44
+ if (f.length < 2) continue;
45
+ C > 0 && (f = v(f, C));
46
+ let b = G(f, u, $), k = null;
47
+ (n.pressure?.taperIn > 0 || n.pressure?.taperOut > 0) && (k = q(b, n.pressure));
48
+ let d, D;
49
+ if (O === "parallel")
50
+ d = x, D = X;
51
+ else {
52
+ const z = m / j;
53
+ d = x + i * z, D = d + z;
54
+ }
55
+ h.push({
56
+ id: `${e}-${c}-${i}`,
57
+ points: b,
58
+ // Offset coordinates from baseX/baseY (uniform space)
59
+ baseX: g,
60
+ // Base X position (width-normalized page coords)
61
+ baseY: S,
62
+ // Base Y position (height-normalized page coords)
63
+ start: d,
64
+ end: D,
65
+ color: n.color || "rgba(220, 20, 60, 1.0)",
66
+ width: n.width || 2,
67
+ lineCap: n.lineCap || "round",
68
+ pressures: k,
69
+ uniformScale: !0
70
+ // Preserve aspect ratio when rendering
49
71
  });
50
72
  }
51
- h += a * g + a * 0.1;
73
+ u += P + 0.18;
52
74
  }
53
- return d;
75
+ return h;
54
76
  }
55
77
  export {
56
- X as default,
57
- X as textToStrokes
78
+ B as default,
79
+ B as textToStrokes
58
80
  };
59
81
  //# sourceMappingURL=index14.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index14.js","sources":["../src/converters/text.js"],"sourcesContent":["/**\n * Text Converter - Converts text annotations to stroke commands\n *\n * Transforms text content into stroke paths for each character,\n * looking up glyphs from the stroke library.\n *\n * @module converters/text\n */\n\nimport { applyJitter, applyPressure } from '../pen/effects.js';\nimport latinStrokes from '../strokes/latin.json';\n\n/**\n * Looks up character strokes from the stroke library\n *\n * @param {string} char - Single character to look up\n * @returns {Object|null} Character data with strokes and width, or null if not found\n */\nfunction lookupCharacter(char) {\n // Check Latin library\n if (latinStrokes.glyphs && latinStrokes.glyphs[char]) {\n return latinStrokes.glyphs[char];\n }\n\n // Space character - return empty with width\n if (char === ' ') {\n return { strokes: [], width: 0.3 };\n }\n\n // Fallback: return null (character will be skipped)\n return null;\n}\n\n/**\n * Transforms stroke points from glyph space to target position\n *\n * Glyph points are in 0-1 normalized space within the glyph's bounding box.\n * This transforms them to the target position on the page.\n *\n * @param {Array<[number, number]>} points - Glyph points in 0-1 space\n * @param {number} x - Target X position (normalized page coordinates)\n * @param {number} y - Target Y position (normalized page coordinates)\n * @param {number} scale - Scale factor based on fontSize\n * @param {number} charWidth - Character width for positioning\n * @returns {Array<[number, number]>} Transformed points\n */\nfunction transformPoints(points, x, y, scale, charWidth) {\n return points.map(([px, py]) => [\n x + px * scale * charWidth,\n y + py * scale\n ]);\n}\n\n/**\n * Converts a text annotation to stroke commands\n *\n * Each character in the content becomes one or more strokes.\n * Characters are staggered in timing to create a writing effect.\n *\n * @param {Object} annotation - Text annotation object\n * @param {string} annotation.id - Unique identifier\n * @param {number} annotation.start - Start time in seconds\n * @param {number} annotation.end - End time in seconds\n * @param {string} annotation.content - Text content to render\n * @param {number} annotation.x - X position (normalized 0-1)\n * @param {number} annotation.y - Y position (normalized 0-1)\n * @param {number} [annotation.fontSize=16] - Font size in pixels\n * @param {Object} [annotation.style] - Optional style overrides\n * @param {Object} style - Resolved style configuration\n * @param {string} style.color - Stroke color\n * @param {number} style.width - Stroke width in pixels\n * @param {number} [style.fontSize=16] - Default font size\n * @param {string} [style.lineCap='round'] - Line cap style\n * @param {Object} [style.jitter] - Jitter configuration\n * @param {Object} [style.pressure] - Pressure configuration\n * @returns {Array<Object>} Array of stroke commands\n */\nexport function textToStrokes(annotation, style) {\n const {\n id,\n start,\n end,\n content,\n x,\n y,\n fontSize: annotFontSize\n } = annotation;\n\n if (!content || content.length === 0) {\n return [];\n }\n\n const strokes = [];\n const totalDuration = end - start;\n const fontSize = annotFontSize || style.fontSize || 16;\n\n // Scale factor: convert fontSize (pixels) to normalized coordinates\n // Assuming a reference viewport of ~1000px, adjust as needed\n const scale = fontSize / 1000;\n\n // Track current X position for character placement\n let currentX = x;\n\n // Calculate timing per character\n const charCount = content.length;\n const charDuration = totalDuration / charCount;\n\n for (let charIndex = 0; charIndex < content.length; charIndex++) {\n const char = content[charIndex];\n const charData = lookupCharacter(char);\n\n if (!charData) {\n // Skip unknown characters, but advance position\n currentX += scale * 0.5;\n continue;\n }\n\n const charWidth = charData.width || 0.8;\n const charStrokes = charData.strokes || [];\n\n // Calculate timing for this character\n const charStart = start + charIndex * charDuration;\n const charEnd = charStart + charDuration;\n\n // Process each stroke in the character\n for (let strokeIndex = 0; strokeIndex < charStrokes.length; strokeIndex++) {\n const strokeData = charStrokes[strokeIndex];\n const rawPoints = strokeData.points || [];\n\n if (rawPoints.length < 2) continue;\n\n // Transform points to target position\n let points = transformPoints(rawPoints, currentX, y, scale, charWidth);\n\n // Apply jitter if configured\n if (style.jitter?.amplitude > 0) {\n points = applyJitter(points, style.jitter, `${id}-${charIndex}-${strokeIndex}`);\n }\n\n // Calculate pressure values if configured\n let pressures = null;\n if (style.pressure?.taperIn > 0 || style.pressure?.taperOut > 0) {\n pressures = applyPressure(points, style.pressure);\n }\n\n strokes.push({\n id: `${id}-${charIndex}-${strokeIndex}`,\n points,\n start: charStart,\n end: charEnd,\n color: style.color || 'rgba(220, 20, 60, 1.0)',\n width: style.width || 2,\n lineCap: style.lineCap || 'round',\n pressures\n });\n }\n\n // Advance X position for next character\n currentX += scale * charWidth + scale * 0.1; // Add small spacing\n }\n\n return strokes;\n}\n\nexport default textToStrokes;\n"],"names":["lookupCharacter","char","latinStrokes","transformPoints","points","x","y","scale","charWidth","px","py","textToStrokes","annotation","style","id","start","end","content","annotFontSize","strokes","totalDuration","currentX","charCount","charDuration","charIndex","charData","charStrokes","charStart","charEnd","strokeIndex","rawPoints","applyJitter","pressures","applyPressure"],"mappings":";;AAkBA,SAASA,EAAgBC,GAAM;AAE7B,SAAIC,EAAa,UAAUA,EAAa,OAAOD,CAAI,IAC1CC,EAAa,OAAOD,CAAI,IAI7BA,MAAS,MACJ,EAAE,SAAS,IAAI,OAAO,IAAG,IAI3B;AACT;AAeA,SAASE,EAAgBC,GAAQC,GAAGC,GAAGC,GAAOC,GAAW;AACvD,SAAOJ,EAAO,IAAI,CAAC,CAACK,GAAIC,CAAE,MAAM;AAAA,IAC9BL,IAAII,IAAKF,IAAQC;AAAA,IACjBF,IAAII,IAAKH;AAAA,EACb,CAAG;AACH;AA0BO,SAASI,EAAcC,GAAYC,GAAO;AAC/C,QAAM;AAAA,IACJ,IAAAC;AAAA,IACA,OAAAC;AAAA,IACA,KAAAC;AAAA,IACA,SAAAC;AAAA,IACA,GAAAZ;AAAA,IACA,GAAAC;AAAA,IACA,UAAUY;AAAA,EACd,IAAMN;AAEJ,MAAI,CAACK,KAAWA,EAAQ,WAAW;AACjC,WAAO,CAAA;AAGT,QAAME,IAAU,CAAA,GACVC,IAAgBJ,IAAMD,GAKtBR,KAJWW,KAAiBL,EAA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sources":["../src/converters/text.js"],"sourcesContent":["/**\n * Text Converter - Converts text annotations to stroke commands\n *\n * Transforms text content into stroke paths for each character,\n * using single-stroke font glyphs for smooth writing animation.\n *\n * @module converters/text\n */\n\nimport { applyPressure } from \"../pen/effects.js\";\nimport singleStrokeFont from \"../strokes/single-stroke.json\";\n\n/**\n * Subdivide a path by adding intermediate points between existing points.\n * This creates smoother interpolation during progressive rendering.\n *\n * @param {Array<[number, number]>} points - Original path points\n * @param {number} subdivisions - Number of points to add between each pair (default: 2)\n * @returns {Array<[number, number]>} Subdivided path with more points\n */\nfunction subdividePath(points, subdivisions = 2) {\n if (points.length < 2 || subdivisions < 1) {\n return points;\n }\n\n const result = [];\n\n for (let i = 0; i < points.length - 1; i++) {\n const [x1, y1] = points[i];\n const [x2, y2] = points[i + 1];\n\n // Add the start point\n result.push([x1, y1]);\n\n // Add intermediate points\n for (let j = 1; j <= subdivisions; j++) {\n const t = j / (subdivisions + 1);\n result.push([x1 + (x2 - x1) * t, y1 + (y2 - y1) * t]);\n }\n }\n\n // Add the final point\n result.push(points[points.length - 1]);\n\n return result;\n}\n\n/**\n * Looks up character glyph from the single-stroke font library\n *\n * @param {string} char - Single character to look up\n * @returns {Object|null} Character data with paths and width, or null if not found\n */\nfunction lookupCharacter(char) {\n // Check single-stroke font library\n if (singleStrokeFont.glyphs && singleStrokeFont.glyphs[char]) {\n return singleStrokeFont.glyphs[char];\n }\n\n // Space character - return empty with width\n if (char === \" \") {\n return { paths: [], width: 0.35 };\n }\n\n // Fallback: return null (character will be skipped)\n return null;\n}\n\n/**\n * Scales glyph points by fontSize scale factor\n *\n * Glyph points are in normalized space where:\n * - X is 0 to charWidth (already scaled within the glyph)\n * - Y is 0 to ~1.0 (baseline at 0.8, cap height at 0)\n *\n * This scales them to the target size, but does NOT add the base position.\n * The base position is stored separately to allow correct rendering with\n * mixed coordinate systems (position in page coords, offsets in uniform space).\n *\n * @param {Array<[number, number]>} points - Glyph points in normalized space\n * @param {number} offsetX - X offset from base position (character offset within text)\n * @param {number} scale - Scale factor based on fontSize\n * @returns {Array<[number, number]>} Scaled offset points (not absolute positions)\n */\nfunction scaleGlyphPoints(points, offsetX, scale) {\n // Scale points and add character offset (in uniform space)\n return points.map(([px, py]) => [(offsetX + px) * scale, py * scale]);\n}\n\n/**\n * Converts a text annotation to stroke commands\n *\n * Each character in the content becomes one or more strokes.\n * Characters are staggered in timing to create a writing effect.\n * Multi-path characters (like 'i', 'j', '!') use pathTiming to\n * control whether paths are drawn sequentially or in parallel.\n *\n * @param {Object} annotation - Text annotation object\n * @param {string} annotation.id - Unique identifier\n * @param {number} annotation.start - Start time in seconds\n * @param {number} annotation.end - End time in seconds\n * @param {string} annotation.content - Text content to render\n * @param {number} annotation.x - X position (normalized 0-1)\n * @param {number} annotation.y - Y position (normalized 0-1)\n * @param {number} [annotation.fontSize=16] - Font size in pixels\n * @param {Object} [annotation.style] - Optional style overrides\n * @param {Object} style - Resolved style configuration\n * @param {string} style.color - Stroke color\n * @param {number} style.width - Stroke width in pixels\n * @param {number} [style.fontSize=16] - Default font size\n * @param {string} [style.lineCap='round'] - Line cap style\n * @param {Object} [style.jitter] - Jitter configuration\n * @param {Object} [style.pressure] - Pressure configuration\n * @param {number} [style.subdivisions=2] - Path subdivision level\n * @returns {Array<Object>} Array of stroke commands\n */\nexport function textToStrokes(annotation, style) {\n const { id, start, end, content, x, y, fontSize: annotFontSize } = annotation;\n\n if (!content || content.length === 0) {\n return [];\n }\n\n const strokes = [];\n const totalDuration = end - start;\n const fontSize = annotFontSize || style.fontSize || 16;\n const subdivisions = style.subdivisions ?? 2;\n\n // Scale factor: convert fontSize (pixels) to normalized coordinates\n // Assuming a reference viewport of ~1000px\n const scale = fontSize / 1000;\n\n // Track character offset from base position (in glyph units, not page coords)\n let charOffsetX = 0;\n\n // Calculate timing per character\n const charCount = content.length;\n const charDuration = totalDuration / charCount;\n\n for (let charIndex = 0; charIndex < content.length; charIndex++) {\n const char = content[charIndex];\n const charData = lookupCharacter(char);\n\n if (!charData) {\n // Skip unknown characters, but advance position with default width\n charOffsetX += 0.5 + 0.18; // default width + spacing (in glyph units)\n continue;\n }\n\n const charWidth = charData.width || 0.5;\n const charPaths = charData.paths || [];\n const pathTiming = charData.pathTiming || \"sequential\";\n\n // Skip if no paths (e.g., space character)\n if (charPaths.length === 0) {\n charOffsetX += charWidth + 0.18;\n continue;\n }\n\n // Calculate timing for this character's paths\n const charStart = start + charIndex * charDuration;\n const charEnd = charStart + charDuration;\n\n // Determine path timing based on pathTiming mode\n const pathCount = charPaths.length;\n\n for (let pathIndex = 0; pathIndex < charPaths.length; pathIndex++) {\n const pathData = charPaths[pathIndex];\n let rawPoints = pathData.points || [];\n\n if (rawPoints.length < 2) continue;\n\n // Apply path subdivision for smoother interpolation\n if (subdivisions > 0) {\n rawPoints = subdividePath(rawPoints, subdivisions);\n }\n\n // Scale glyph points (offset coordinates, not absolute)\n let points = scaleGlyphPoints(rawPoints, charOffsetX, scale);\n\n // Calculate pressure values if configured\n let pressures = null;\n if (style.pressure?.taperIn > 0 || style.pressure?.taperOut > 0) {\n pressures = applyPressure(points, style.pressure);\n }\n\n // Calculate path timing based on pathTiming mode\n let pathStart, pathEnd;\n\n if (pathTiming === \"parallel\") {\n // All paths drawn simultaneously during character duration\n pathStart = charStart;\n pathEnd = charEnd;\n } else {\n // Sequential: each path gets a portion of character duration\n const pathDuration = charDuration / pathCount;\n pathStart = charStart + pathIndex * pathDuration;\n pathEnd = pathStart + pathDuration;\n }\n\n strokes.push({\n id: `${id}-${charIndex}-${pathIndex}`,\n points, // Offset coordinates from baseX/baseY (uniform space)\n baseX: x, // Base X position (width-normalized page coords)\n baseY: y, // Base Y position (height-normalized page coords)\n start: pathStart,\n end: pathEnd,\n color: style.color || \"rgba(220, 20, 60, 1.0)\",\n width: style.width || 2,\n lineCap: style.lineCap || \"round\",\n pressures,\n uniformScale: true, // Preserve aspect ratio when rendering\n });\n }\n\n // Advance offset for next character (in glyph units)\n charOffsetX += charWidth + 0.18; // Add small spacing\n }\n\n return strokes;\n}\n\nexport default textToStrokes;\n"],"names":["subdividePath","points","subdivisions","result","i","x1","y1","x2","y2","j","t","lookupCharacter","char","singleStrokeFont","scaleGlyphPoints","offsetX","scale","px","py","textToStrokes","annotation","style","id","start","end","content","x","y","annotFontSize","strokes","totalDuration","fontSize","charOffsetX","charCount","charDuration","charIndex","charData","charWidth","charPaths","pathTiming","charStart","charEnd","pathCount","pathIndex","rawPoints","pressures","applyPressure","pathStart","pathEnd","pathDuration"],"mappings":";;AAoBA,SAASA,EAAcC,GAAQC,IAAe,GAAG;AAC/C,MAAID,EAAO,SAAS,KAAKC,IAAe;AACtC,WAAOD;AAGT,QAAME,IAAS,CAAA;AAEf,WAASC,IAAI,GAAGA,IAAIH,EAAO,SAAS,GAAGG,KAAK;AAC1C,UAAM,CAACC,GAAIC,CAAE,IAAIL,EAAOG,CAAC,GACnB,CAACG,GAAIC,CAAE,IAAIP,EAAOG,IAAI,CAAC;AAG7B,IAAAD,EAAO,KAAK,CAACE,GAAIC,CAAE,CAAC;AAGpB,aAASG,IAAI,GAAGA,KAAKP,GAAcO,KAAK;AACtC,YAAMC,IAAID,KAAKP,IAAe;AAC9B,MAAAC,EAAO,KAAK,CAACE,KAAME,IAAKF,KAAMK,GAAGJ,KAAME,IAAKF,KAAMI,CAAC,CAAC;AAAA,IACtD;AAAA,EACF;AAGA,SAAAP,EAAO,KAAKF,EAAOA,EAAO,SAAS,CAAC,CAAC,GAE9BE;AACT;AAQA,SAASQ,EAAgBC,GAAM;AAE7B,SAAIC,EAAiB,UAAUA,EAAiB,OAAOD,CAAI,IAClDC,EAAiB,OAAOD,CAAI,IAIjCA,MAAS,MACJ,EAAE,OAAO,IAAI,OAAO,KAAI,IAI1B;AACT;AAkBA,SAASE,EAAiBb,GAAQc,GAASC,GAAO;AAEhD,SAAOf,EAAO,IAAI,CAAC,CAACgB,GAAIC,CAAE,MAAM,EAAEH,IAAUE,KAAMD,GAAOE,IAAK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oB,EAAM,QAAQ;AAIlD,UAAI0B,GAAWC;AAEf,UAAIT,MAAe;AAEjB,QAAAQ,IAAYP,GACZQ,IAAUP;AAAA,WACL;AAEL,cAAMQ,IAAef,IAAeQ;AACpC,QAAAK,IAAYP,IAAYG,IAAYM,GACpCD,IAAUD,IAAYE;AAAA,MACxB;AAEA,MAAApB,EAAQ,KAAK;AAAA,QACX,IAAI,GAAGP,CAAE,IAAIa,CAAS,IAAIQ,CAAS;AAAA,QACnC,QAAA1C;AAAA;AAAA,QACA,OAAOyB;AAAA;AAAA,QACP,OAAOC;AAAA;AAAA,QACP,OAAOoB;AAAA,QACP,KAAKC;AAAA,QACL,OAAO3B,EAAM,SAAS;AAAA,QACtB,OAAOA,EAAM,SAAS;AAAA,QACtB,SAASA,EAAM,WAAW;AAAA,QAC1B,WAAAwB;AAAA,QACA,cAAc;AAAA;AAAA,MACtB,CAAO;AAAA,IACH;AAGA,IAAAb,KAAeK,IAAY;AAAA,EAC7B;AAEA,SAAOR;AACT;"}
package/dist/index2.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index3.cjs"),s=require("./index4.cjs"),i=require("./index5.cjs"),o=require("./index6.cjs");class a{constructor(e){if(!e||typeof e!="object")throw new Error("AnnotationRenderer: config object is required");if(!e.container||!(e.container instanceof HTMLElement))throw new Error("AnnotationRenderer: config.container must be a valid DOM element");if(!e.canvasElement||!(e.canvasElement instanceof HTMLCanvasElement))throw new Error("AnnotationRenderer: config.canvasElement must be a valid canvas element");this.config=e,this.canvasElement=e.canvasElement,this.container=e.container,this.pdfRenderer=new n.PDFRenderer,this.strokeCanvas=this._createStrokeCanvas(),this.strokeRenderer=new i.StrokeRenderer(this.strokeCanvas,e.strokeConfig||{}),this.timelineSync=new s.TimelineSync,this.currentPage=e.initialPage||1,this.currentScale=e.initialScale||1,this.annotations=e.annotations||[],this.pageCount=0,this.currentViewport=null,this.pdfUrl=null,this.timelineSync.subscribe(t=>{this.strokeRenderer.render(t)}),e.pdfUrl&&this.loadPDF(e.pdfUrl).catch(t=>{console.error("AnnotationRenderer: Failed to auto-load PDF:",t)})}_createStrokeCanvas(){const e=document.createElement("canvas");return e.className="stroke-canvas",e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.pointerEvents="none",e.style.zIndex="10",this.container.appendChild(e),e}async loadPDF(e){try{if(!e||typeof e!="string")return{success:!1,error:"Invalid PDF URL provided"};const t=await this.pdfRenderer.loadDocument(e);return t.success?(this.pdfUrl=e,this.pageCount=t.pageCount,{success:!0,pageCount:t.pageCount}):t}catch(t){return console.error("AnnotationRenderer.loadPDF: Error loading PDF:",t),{success:!1,error:`Failed to load PDF: ${t.message}`}}}async setPage(e){try{if(typeof e!="number"||e<1)return{success:!1,error:"Invalid page number"};if(this.pageCount>0&&e>this.pageCount)return{success:!1,error:`Page ${e} exceeds document page count (${this.pageCount})`};this.pdfRenderer.cancelRender();const t=await this.pdfRenderer.renderPage(e,this.canvasElement,this.currentScale);if(t.success){this.currentPage=e,this.currentViewport=t.viewport,this.strokeRenderer.setViewport(t.viewport.width,t.viewport.height),this.strokeRenderer.setAnnotations(this.annotations,e);const r=this.timelineSync.getCurrentTime();return this.strokeRenderer.render(r),{success:!0,viewport:t.viewport}}return t}catch(t){return console.error("AnnotationRenderer.setPage: Error rendering page:",t),{success:!1,error:`Failed to render page: ${t.message}`}}}async setScale(e){try{return typeof e!="number"||e<=0?{success:!1,error:"Invalid scale value (must be positive number)"}:(this.currentScale=e,await this.setPage(this.currentPage))}catch(t){return console.error("AnnotationRenderer.setScale: Error changing scale:",t),{success:!1,error:`Failed to change scale: ${t.message}`}}}setAnnotations(e){Array.isArray(e)||(console.warn("AnnotationRenderer.setAnnotations: annotations must be an array"),e=[]),this.annotations=e,this.strokeRenderer.setAnnotations(e,this.currentPage);const t=this.timelineSync.getCurrentTime();this.strokeRenderer.render(t)}setStrokes(e){this.strokeRenderer.setStrokes(e);const t=this.timelineSync.getCurrentTime();this.strokeRenderer.render(t)}setTime(e){if(typeof e!="number"){console.warn("AnnotationRenderer.setTime: timestamp must be a number");return}this.timelineSync.setTime(e)}updateStrokeConfig(e){if(!e||typeof e!="object")return;this.strokeRenderer.config=o.deepMerge(this.strokeRenderer.config,e),this.strokeRenderer.setAnnotations(this.annotations,this.currentPage);const t=this.timelineSync.getCurrentTime();this.strokeRenderer.render(t)}getState(){return{page:this.currentPage,scale:this.currentScale,annotations:this.annotations,pageCount:this.pageCount,time:this.timelineSync.getCurrentTime(),viewport:this.currentViewport,pdfUrl:this.pdfUrl}}destroy(){this.pdfRenderer&&this.pdfRenderer.destroy(),this.strokeRenderer&&this.strokeRenderer.destroy(),this.timelineSync&&this.timelineSync.destroy(),this.strokeCanvas&&this.strokeCanvas.parentNode&&this.strokeCanvas.parentNode.removeChild(this.strokeCanvas),this.pdfRenderer=null,this.strokeRenderer=null,this.timelineSync=null,this.strokeCanvas=null,this.config=null,this.canvasElement=null,this.container=null,this.annotations=[],this.currentPage=0,this.currentScale=1,this.pageCount=0,this.currentViewport=null,this.pdfUrl=null}}exports.AnnotationRenderer=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index3.cjs"),s=require("./index4.cjs"),i=require("./index5.cjs"),o=require("./index6.cjs");class a{constructor(e){if(!e||typeof e!="object")throw new Error("AnnotationRenderer: config object is required");if(!e.container||!(e.container instanceof HTMLElement))throw new Error("AnnotationRenderer: config.container must be a valid DOM element");if(!e.canvasElement||!(e.canvasElement instanceof HTMLCanvasElement))throw new Error("AnnotationRenderer: config.canvasElement must be a valid canvas element");this.config=e,this.canvasElement=e.canvasElement,this.container=e.container,this.pdfRenderer=new n.PDFRenderer,this.strokeCanvas=this._createStrokeCanvas(),this.strokeRenderer=new i.StrokeRenderer(this.strokeCanvas,e.strokeConfig||{}),this.timelineSync=new s.TimelineSync,this.currentPage=e.initialPage||1,this.currentScale=e.initialScale||1,this.annotations=e.annotations||[],this.pageCount=0,this.currentViewport=null,this.pdfUrl=null,this.timelineSync.subscribe(t=>{this.strokeRenderer.render(t)}),e.pdfUrl&&this.loadPDF(e.pdfUrl).catch(t=>{console.error("AnnotationRenderer: Failed to auto-load PDF:",t)})}_createStrokeCanvas(){const e=document.createElement("canvas");return e.className="stroke-canvas",e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.pointerEvents="none",e.style.zIndex="10",this.container.appendChild(e),e}async loadPDF(e){try{if(!e||typeof e!="string")return{success:!1,error:"Invalid PDF URL provided"};const t=await this.pdfRenderer.loadDocument(e);return t.success?(this.pdfUrl=e,this.pageCount=t.pageCount,{success:!0,pageCount:t.pageCount}):t}catch(t){return console.error("AnnotationRenderer.loadPDF: Error loading PDF:",t),{success:!1,error:`Failed to load PDF: ${t.message}`}}}async setPage(e){try{if(typeof e!="number"||e<1)return{success:!1,error:"Invalid page number"};if(this.pageCount>0&&e>this.pageCount)return{success:!1,error:`Page ${e} exceeds document page count (${this.pageCount})`};this.pdfRenderer.cancelRender();const t=await this.pdfRenderer.renderPage(e,this.canvasElement,this.currentScale);if(t.success){this.currentPage=e,this.currentViewport=t.viewport,this.strokeRenderer.setViewport(t.viewport.width,t.viewport.height),this.strokeRenderer.setAnnotations(this.annotations,e);const r=this.timelineSync.getCurrentTime();return this.strokeRenderer.render(r),{success:!0,viewport:t.viewport}}return t}catch(t){return console.error("AnnotationRenderer.setPage: Error rendering page:",t),{success:!1,error:`Failed to render page: ${t.message}`}}}async setScale(e){try{return typeof e!="number"||e<=0?{success:!1,error:"Invalid scale value (must be positive number)"}:(this.currentScale=e,await this.setPage(this.currentPage))}catch(t){return console.error("AnnotationRenderer.setScale: Error changing scale:",t),{success:!1,error:`Failed to change scale: ${t.message}`}}}setAnnotations(e){Array.isArray(e)||(console.warn("AnnotationRenderer.setAnnotations: annotations must be an array"),e=[]),this.annotations=e,this.strokeRenderer.setAnnotations(e,this.currentPage);const t=this.timelineSync.getCurrentTime();this.strokeRenderer.render(t)}setStrokes(e){this.strokeRenderer.setStrokes(e);const t=this.timelineSync.getCurrentTime();this.strokeRenderer.render(t)}setTime(e){if(typeof e!="number"){console.warn("AnnotationRenderer.setTime: timestamp must be a number");return}this.timelineSync.setTime(e)}startContinuousSync(e){this.timelineSync.startContinuousSync(e)}stopContinuousSync(){this.timelineSync.stopContinuousSync()}isContinuousSyncActive(){return this.timelineSync.isRunning}updateStrokeConfig(e){if(!e||typeof e!="object")return;this.strokeRenderer.config=o.deepMerge(this.strokeRenderer.config,e),this.strokeRenderer.setAnnotations(this.annotations,this.currentPage);const t=this.timelineSync.getCurrentTime();this.strokeRenderer.render(t)}getState(){return{page:this.currentPage,scale:this.currentScale,annotations:this.annotations,pageCount:this.pageCount,time:this.timelineSync.getCurrentTime(),viewport:this.currentViewport,pdfUrl:this.pdfUrl}}destroy(){this.pdfRenderer&&this.pdfRenderer.destroy(),this.strokeRenderer&&this.strokeRenderer.destroy(),this.timelineSync&&this.timelineSync.destroy(),this.strokeCanvas&&this.strokeCanvas.parentNode&&this.strokeCanvas.parentNode.removeChild(this.strokeCanvas),this.pdfRenderer=null,this.strokeRenderer=null,this.timelineSync=null,this.strokeCanvas=null,this.config=null,this.canvasElement=null,this.container=null,this.annotations=[],this.currentPage=0,this.currentScale=1,this.pageCount=0,this.currentViewport=null,this.pdfUrl=null}}exports.AnnotationRenderer=a;
2
2
  //# sourceMappingURL=index2.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index2.cjs","sources":["../src/core/AnnotationRenderer.js"],"sourcesContent":["/**\n * AnnotationRenderer - Main facade for PDF annotation rendering engine\n *\n * Orchestrates PDFRenderer, StrokeRenderer, and TimelineSync subsystems.\n * Provides the primary public API for rendering PDFs with timeline-synchronized\n * annotations. Framework-agnostic core that can be wrapped by React/Vue adapters.\n *\n * @module core/AnnotationRenderer\n */\n\nimport { PDFRenderer } from './PDFRenderer.js';\nimport { TimelineSync } from './TimelineSync.js';\nimport { StrokeRenderer } from '../renderer/StrokeRenderer.js';\nimport { deepMerge } from '../pen/effects.js';\n\n/**\n * AnnotationRenderer class\n *\n * Main engine that coordinates PDF rendering, stroke-based annotation rendering,\n * and timeline synchronization. Provides simple imperative API for consumers.\n *\n * @class\n * @example\n * const renderer = new AnnotationRenderer({\n * container: document.getElementById('container'),\n * canvasElement: document.getElementById('pdf-canvas')\n * });\n *\n * await renderer.loadPDF('/path/to/doc.pdf');\n * await renderer.setPage(1);\n * renderer.setAnnotations(annotationData);\n * renderer.setTime(3.5);\n */\nexport class AnnotationRenderer {\n /**\n * Create AnnotationRenderer instance\n *\n * @param {Object} config - Configuration object\n * @param {HTMLElement} config.container - DOM element for annotation canvas\n * @param {HTMLCanvasElement} config.canvasElement - Canvas element for PDF rendering\n * @param {string} [config.pdfUrl] - PDF URL to load immediately\n * @param {number} [config.initialPage=1] - Initial page number\n * @param {number} [config.initialScale=1.0] - Initial scale factor\n * @param {Array} [config.annotations=[]] - Initial annotation data\n * @param {Object} [config.strokeConfig] - StrokeRenderer configuration\n * @throws {Error} If config is invalid or required elements are missing\n */\n constructor(config) {\n if (!config || typeof config !== 'object') {\n throw new Error('AnnotationRenderer: config object is required');\n }\n\n if (!config.container || !(config.container instanceof HTMLElement)) {\n throw new Error('AnnotationRenderer: config.container must be a valid DOM element');\n }\n\n if (!config.canvasElement || !(config.canvasElement instanceof HTMLCanvasElement)) {\n throw new Error('AnnotationRenderer: config.canvasElement must be a valid canvas element');\n }\n\n this.config = config;\n this.canvasElement = config.canvasElement;\n this.container = config.container;\n\n // Initialize PDFRenderer\n this.pdfRenderer = new PDFRenderer();\n\n // Create stroke canvas and StrokeRenderer\n this.strokeCanvas = this._createStrokeCanvas();\n this.strokeRenderer = new StrokeRenderer(this.strokeCanvas, config.strokeConfig || {});\n\n // Initialize TimelineSync\n this.timelineSync = new TimelineSync();\n\n // State\n this.currentPage = config.initialPage || 1;\n this.currentScale = config.initialScale || 1.0;\n this.annotations = config.annotations || [];\n this.pageCount = 0;\n this.currentViewport = null;\n this.pdfUrl = null;\n\n // Wire up timeline to render\n this.timelineSync.subscribe((time) => {\n this.strokeRenderer.render(time);\n });\n\n // Auto-load PDF if provided\n if (config.pdfUrl) {\n this.loadPDF(config.pdfUrl).catch(err => {\n console.error('AnnotationRenderer: Failed to auto-load PDF:', err);\n });\n }\n }\n\n /**\n * Create stroke canvas overlay\n *\n * @private\n * @returns {HTMLCanvasElement} Stroke canvas element\n */\n _createStrokeCanvas() {\n const canvas = document.createElement('canvas');\n canvas.className = 'stroke-canvas';\n canvas.style.position = 'absolute';\n canvas.style.top = '0';\n canvas.style.left = '0';\n canvas.style.pointerEvents = 'none';\n canvas.style.zIndex = '10';\n this.container.appendChild(canvas);\n return canvas;\n }\n\n /**\n * Load PDF document from URL\n *\n * @param {string} url - URL or path to PDF file\n * @returns {Promise<Object>} Load result with success status and page count\n */\n async loadPDF(url) {\n try {\n if (!url || typeof url !== 'string') {\n return { success: false, error: 'Invalid PDF URL provided' };\n }\n\n const result = await this.pdfRenderer.loadDocument(url);\n\n if (result.success) {\n this.pdfUrl = url;\n this.pageCount = result.pageCount;\n return { success: true, pageCount: result.pageCount };\n }\n\n return result;\n } catch (err) {\n console.error('AnnotationRenderer.loadPDF: Error loading PDF:', err);\n return { success: false, error: `Failed to load PDF: ${err.message}` };\n }\n }\n\n /**\n * Navigate to specific page and render it\n *\n * @param {number} pageNum - Page number (1-indexed)\n * @returns {Promise<Object>} Render result with viewport information\n */\n async setPage(pageNum) {\n try {\n if (typeof pageNum !== 'number' || pageNum < 1) {\n return { success: false, error: 'Invalid page number' };\n }\n\n if (this.pageCount > 0 && pageNum > this.pageCount) {\n return { success: false, error: `Page ${pageNum} exceeds document page count (${this.pageCount})` };\n }\n\n this.pdfRenderer.cancelRender();\n\n const result = await this.pdfRenderer.renderPage(\n pageNum,\n this.canvasElement,\n this.currentScale\n );\n\n if (result.success) {\n this.currentPage = pageNum;\n this.currentViewport = result.viewport;\n\n // Update StrokeRenderer viewport\n this.strokeRenderer.setViewport(result.viewport.width, result.viewport.height);\n\n // Re-set annotations for new page\n this.strokeRenderer.setAnnotations(this.annotations, pageNum);\n\n // Render at current time\n const currentTime = this.timelineSync.getCurrentTime();\n this.strokeRenderer.render(currentTime);\n\n return { success: true, viewport: result.viewport };\n }\n\n return result;\n } catch (err) {\n console.error('AnnotationRenderer.setPage: Error rendering page:', err);\n return { success: false, error: `Failed to render page: ${err.message}` };\n }\n }\n\n /**\n * Change zoom scale and re-render current page\n *\n * @param {number} scale - Scale factor (e.g., 1.0, 1.5, 2.0)\n * @returns {Promise<Object>} Render result with viewport information\n */\n async setScale(scale) {\n try {\n if (typeof scale !== 'number' || scale <= 0) {\n return { success: false, error: 'Invalid scale value (must be positive number)' };\n }\n\n this.currentScale = scale;\n return await this.setPage(this.currentPage);\n } catch (err) {\n console.error('AnnotationRenderer.setScale: Error changing scale:', err);\n return { success: false, error: `Failed to change scale: ${err.message}` };\n }\n }\n\n /**\n * Update annotation data for rendering\n *\n * @param {Array} annotations - Complete annotation array (all pages, all types)\n */\n setAnnotations(annotations) {\n if (!Array.isArray(annotations)) {\n console.warn('AnnotationRenderer.setAnnotations: annotations must be an array');\n annotations = [];\n }\n\n this.annotations = annotations;\n this.strokeRenderer.setAnnotations(annotations, this.currentPage);\n\n // Render at current time\n const currentTime = this.timelineSync.getCurrentTime();\n this.strokeRenderer.render(currentTime);\n }\n\n /**\n * Set pre-converted strokes directly\n *\n * Bypasses annotation conversion, useful for stroke commands from backend.\n *\n * @param {Array} strokes - Array of stroke command objects\n */\n setStrokes(strokes) {\n this.strokeRenderer.setStrokes(strokes);\n\n const currentTime = this.timelineSync.getCurrentTime();\n this.strokeRenderer.render(currentTime);\n }\n\n /**\n * Update timeline position for animation\n *\n * @param {number} timestamp - Current timeline position in seconds\n */\n setTime(timestamp) {\n if (typeof timestamp !== 'number') {\n console.warn('AnnotationRenderer.setTime: timestamp must be a number');\n return;\n }\n\n this.timelineSync.setTime(timestamp);\n }\n\n /**\n * Update stroke rendering configuration at runtime\n *\n * Merges new config with existing and re-renders annotations.\n * Used for live preview of pen style changes.\n *\n * @param {Object} newConfig - New stroke configuration to merge\n */\n updateStrokeConfig(newConfig) {\n if (!newConfig || typeof newConfig !== 'object') {\n return;\n }\n\n // Merge new config into existing\n this.strokeRenderer.config = deepMerge(this.strokeRenderer.config, newConfig);\n\n // Re-convert annotations with new style and render\n this.strokeRenderer.setAnnotations(this.annotations, this.currentPage);\n const currentTime = this.timelineSync.getCurrentTime();\n this.strokeRenderer.render(currentTime);\n }\n\n /**\n * Get current engine state snapshot\n *\n * @returns {Object} Current state\n */\n getState() {\n return {\n page: this.currentPage,\n scale: this.currentScale,\n annotations: this.annotations,\n pageCount: this.pageCount,\n time: this.timelineSync.getCurrentTime(),\n viewport: this.currentViewport,\n pdfUrl: this.pdfUrl\n };\n }\n\n /**\n * Clean up all resources and subsystems\n */\n destroy() {\n if (this.pdfRenderer) {\n this.pdfRenderer.destroy();\n }\n\n if (this.strokeRenderer) {\n this.strokeRenderer.destroy();\n }\n\n if (this.timelineSync) {\n this.timelineSync.destroy();\n }\n\n if (this.strokeCanvas && this.strokeCanvas.parentNode) {\n this.strokeCanvas.parentNode.removeChild(this.strokeCanvas);\n }\n\n this.pdfRenderer = null;\n this.strokeRenderer = null;\n this.timelineSync = null;\n this.strokeCanvas = null;\n this.config = null;\n this.canvasElement = null;\n this.container = null;\n this.annotations = [];\n this.currentPage = 0;\n this.currentScale = 1.0;\n this.pageCount = 0;\n this.currentViewport = null;\n this.pdfUrl = null;\n }\n}\n"],"names":["AnnotationRenderer","config","PDFRenderer","StrokeRenderer","TimelineSync","time","err","canvas","url","result","pageNum","currentTime","scale","annotations","strokes","timestamp","newConfig","deepMerge"],"mappings":"8LAiCO,MAAMA,CAAmB,CAc9B,YAAYC,EAAQ,CAClB,GAAI,CAACA,GAAU,OAAOA,GAAW,SAC/B,MAAM,IAAI,MAAM,+CAA+C,EAGjE,GAAI,CAACA,EAAO,WAAa,EAAEA,EAAO,qBAAqB,aAC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nB,KAAK,aAAe,EACpB,KAAK,UAAY,EACjB,KAAK,gBAAkB,KACvB,KAAK,OAAS,IAChB,CACF"}
1
+ {"version":3,"file":"index2.cjs","sources":["../src/core/AnnotationRenderer.js"],"sourcesContent":["/**\n * AnnotationRenderer - Main facade for PDF annotation rendering engine\n *\n * Orchestrates PDFRenderer, StrokeRenderer, and TimelineSync subsystems.\n * Provides the primary public API for rendering PDFs with timeline-synchronized\n * annotations. Framework-agnostic core that can be wrapped by React/Vue adapters.\n *\n * @module core/AnnotationRenderer\n */\n\nimport { PDFRenderer } from './PDFRenderer.js';\nimport { TimelineSync } from './TimelineSync.js';\nimport { StrokeRenderer } from '../renderer/StrokeRenderer.js';\nimport { deepMerge } from '../pen/effects.js';\n\n/**\n * AnnotationRenderer class\n *\n * Main engine that coordinates PDF rendering, stroke-based annotation rendering,\n * and timeline synchronization. Provides simple imperative API for consumers.\n *\n * @class\n * @example\n * const renderer = new AnnotationRenderer({\n * container: document.getElementById('container'),\n * canvasElement: document.getElementById('pdf-canvas')\n * });\n *\n * await renderer.loadPDF('/path/to/doc.pdf');\n * await renderer.setPage(1);\n * renderer.setAnnotations(annotationData);\n * renderer.setTime(3.5);\n */\nexport class AnnotationRenderer {\n /**\n * Create AnnotationRenderer instance\n *\n * @param {Object} config - Configuration object\n * @param {HTMLElement} config.container - DOM element for annotation canvas\n * @param {HTMLCanvasElement} config.canvasElement - Canvas element for PDF rendering\n * @param {string} [config.pdfUrl] - PDF URL to load immediately\n * @param {number} [config.initialPage=1] - Initial page number\n * @param {number} [config.initialScale=1.0] - Initial scale factor\n * @param {Array} [config.annotations=[]] - Initial annotation data\n * @param {Object} [config.strokeConfig] - StrokeRenderer configuration\n * @throws {Error} If config is invalid or required elements are missing\n */\n constructor(config) {\n if (!config || typeof config !== 'object') {\n throw new Error('AnnotationRenderer: config object is required');\n }\n\n if (!config.container || !(config.container instanceof HTMLElement)) {\n throw new Error('AnnotationRenderer: config.container must be a valid DOM element');\n }\n\n if (!config.canvasElement || !(config.canvasElement instanceof HTMLCanvasElement)) {\n throw new Error('AnnotationRenderer: config.canvasElement must be a valid canvas element');\n }\n\n this.config = config;\n this.canvasElement = config.canvasElement;\n this.container = config.container;\n\n // Initialize PDFRenderer\n this.pdfRenderer = new PDFRenderer();\n\n // Create stroke canvas and StrokeRenderer\n this.strokeCanvas = this._createStrokeCanvas();\n this.strokeRenderer = new StrokeRenderer(this.strokeCanvas, config.strokeConfig || {});\n\n // Initialize TimelineSync\n this.timelineSync = new TimelineSync();\n\n // State\n this.currentPage = config.initialPage || 1;\n this.currentScale = config.initialScale || 1.0;\n this.annotations = config.annotations || [];\n this.pageCount = 0;\n this.currentViewport = null;\n this.pdfUrl = null;\n\n // Wire up timeline to render\n this.timelineSync.subscribe((time) => {\n this.strokeRenderer.render(time);\n });\n\n // Auto-load PDF if provided\n if (config.pdfUrl) {\n this.loadPDF(config.pdfUrl).catch(err => {\n console.error('AnnotationRenderer: Failed to auto-load PDF:', err);\n });\n }\n }\n\n /**\n * Create stroke canvas overlay\n *\n * @private\n * @returns {HTMLCanvasElement} Stroke canvas element\n */\n _createStrokeCanvas() {\n const canvas = document.createElement('canvas');\n canvas.className = 'stroke-canvas';\n canvas.style.position = 'absolute';\n canvas.style.top = '0';\n canvas.style.left = '0';\n canvas.style.pointerEvents = 'none';\n canvas.style.zIndex = '10';\n this.container.appendChild(canvas);\n return canvas;\n }\n\n /**\n * Load PDF document from URL\n *\n * @param {string} url - URL or path to PDF file\n * @returns {Promise<Object>} Load result with success status and page count\n */\n async loadPDF(url) {\n try {\n if (!url || typeof url !== 'string') {\n return { success: false, error: 'Invalid PDF URL provided' };\n }\n\n const result = await this.pdfRenderer.loadDocument(url);\n\n if (result.success) {\n this.pdfUrl = url;\n this.pageCount = result.pageCount;\n return { success: true, pageCount: result.pageCount };\n }\n\n return result;\n } catch (err) {\n console.error('AnnotationRenderer.loadPDF: Error loading PDF:', err);\n return { success: false, error: `Failed to load PDF: ${err.message}` };\n }\n }\n\n /**\n * Navigate to specific page and render it\n *\n * @param {number} pageNum - Page number (1-indexed)\n * @returns {Promise<Object>} Render result with viewport information\n */\n async setPage(pageNum) {\n try {\n if (typeof pageNum !== 'number' || pageNum < 1) {\n return { success: false, error: 'Invalid page number' };\n }\n\n if (this.pageCount > 0 && pageNum > this.pageCount) {\n return { success: false, error: `Page ${pageNum} exceeds document page count (${this.pageCount})` };\n }\n\n this.pdfRenderer.cancelRender();\n\n const result = await this.pdfRenderer.renderPage(\n pageNum,\n this.canvasElement,\n this.currentScale\n );\n\n if (result.success) {\n this.currentPage = pageNum;\n this.currentViewport = result.viewport;\n\n // Update StrokeRenderer viewport\n this.strokeRenderer.setViewport(result.viewport.width, result.viewport.height);\n\n // Re-set annotations for new page\n this.strokeRenderer.setAnnotations(this.annotations, pageNum);\n\n // Render at current time\n const currentTime = this.timelineSync.getCurrentTime();\n this.strokeRenderer.render(currentTime);\n\n return { success: true, viewport: result.viewport };\n }\n\n return result;\n } catch (err) {\n console.error('AnnotationRenderer.setPage: Error rendering page:', err);\n return { success: false, error: `Failed to render page: ${err.message}` };\n }\n }\n\n /**\n * Change zoom scale and re-render current page\n *\n * @param {number} scale - Scale factor (e.g., 1.0, 1.5, 2.0)\n * @returns {Promise<Object>} Render result with viewport information\n */\n async setScale(scale) {\n try {\n if (typeof scale !== 'number' || scale <= 0) {\n return { success: false, error: 'Invalid scale value (must be positive number)' };\n }\n\n this.currentScale = scale;\n return await this.setPage(this.currentPage);\n } catch (err) {\n console.error('AnnotationRenderer.setScale: Error changing scale:', err);\n return { success: false, error: `Failed to change scale: ${err.message}` };\n }\n }\n\n /**\n * Update annotation data for rendering\n *\n * @param {Array} annotations - Complete annotation array (all pages, all types)\n */\n setAnnotations(annotations) {\n if (!Array.isArray(annotations)) {\n console.warn('AnnotationRenderer.setAnnotations: annotations must be an array');\n annotations = [];\n }\n\n this.annotations = annotations;\n this.strokeRenderer.setAnnotations(annotations, this.currentPage);\n\n // Render at current time\n const currentTime = this.timelineSync.getCurrentTime();\n this.strokeRenderer.render(currentTime);\n }\n\n /**\n * Set pre-converted strokes directly\n *\n * Bypasses annotation conversion, useful for stroke commands from backend.\n *\n * @param {Array} strokes - Array of stroke command objects\n */\n setStrokes(strokes) {\n this.strokeRenderer.setStrokes(strokes);\n\n const currentTime = this.timelineSync.getCurrentTime();\n this.strokeRenderer.render(currentTime);\n }\n\n /**\n * Update timeline position for animation\n *\n * @param {number} timestamp - Current timeline position in seconds\n */\n setTime(timestamp) {\n if (typeof timestamp !== 'number') {\n console.warn('AnnotationRenderer.setTime: timestamp must be a number');\n return;\n }\n\n this.timelineSync.setTime(timestamp);\n }\n\n /**\n * Start continuous timeline synchronization using requestAnimationFrame\n *\n * Polls the provided function at ~60fps for smooth animation.\n * Use this for audio/video synchronization instead of setTime().\n *\n * @param {Function} getTimeFunction - Function that returns current time in seconds\n * @example\n * const audio = document.getElementById('audio');\n * renderer.startContinuousSync(() => audio.currentTime);\n */\n startContinuousSync(getTimeFunction) {\n this.timelineSync.startContinuousSync(getTimeFunction);\n }\n\n /**\n * Stop continuous timeline synchronization\n *\n * Call this when audio/video stops or component unmounts.\n */\n stopContinuousSync() {\n this.timelineSync.stopContinuousSync();\n }\n\n /**\n * Check if continuous sync is currently active\n *\n * @returns {boolean} True if continuous sync is running\n */\n isContinuousSyncActive() {\n return this.timelineSync.isRunning;\n }\n\n /**\n * Update stroke rendering configuration at runtime\n *\n * Merges new config with existing and re-renders annotations.\n * Used for live preview of pen style changes.\n *\n * @param {Object} newConfig - New stroke configuration to merge\n */\n updateStrokeConfig(newConfig) {\n if (!newConfig || typeof newConfig !== 'object') {\n return;\n }\n\n // Merge new config into existing\n this.strokeRenderer.config = deepMerge(this.strokeRenderer.config, newConfig);\n\n // Re-convert annotations with new style and render\n this.strokeRenderer.setAnnotations(this.annotations, this.currentPage);\n const currentTime = this.timelineSync.getCurrentTime();\n this.strokeRenderer.render(currentTime);\n }\n\n /**\n * Get current engine state snapshot\n *\n * @returns {Object} Current state\n */\n getState() {\n return {\n page: this.currentPage,\n scale: this.currentScale,\n annotations: this.annotations,\n pageCount: this.pageCount,\n time: this.timelineSync.getCurrentTime(),\n viewport: this.currentViewport,\n pdfUrl: this.pdfUrl\n };\n }\n\n /**\n * Clean up all resources and subsystems\n */\n destroy() {\n if (this.pdfRenderer) {\n this.pdfRenderer.destroy();\n }\n\n if (this.strokeRenderer) {\n this.strokeRenderer.destroy();\n }\n\n if (this.timelineSync) {\n this.timelineSync.destroy();\n }\n\n if (this.strokeCanvas && this.strokeCanvas.parentNode) {\n this.strokeCanvas.parentNode.removeChild(this.strokeCanvas);\n }\n\n this.pdfRenderer = null;\n this.strokeRenderer = null;\n this.timelineSync = null;\n this.strokeCanvas = null;\n this.config = null;\n this.canvasElement = null;\n this.container = null;\n this.annotations = [];\n this.currentPage = 0;\n this.currentScale = 1.0;\n this.pageCount = 0;\n this.currentViewport = null;\n this.pdfUrl = null;\n }\n}\n"],"names":["AnnotationRenderer","config","PDFRenderer","StrokeRenderer","TimelineSync","time","err","canvas","url","result","pageNum","currentTime","scale","annotations","strokes","timestamp","getTimeFunction","newConfig","deepMerge"],"mappings":"8LAiCO,MAAMA,CAAmB,CAc9B,YAAYC,EAAQ,CAClB,GAAI,CAACA,GAAU,OAAOA,GAAW,SAC/B,MAAM,IAAI,MAAM,+CAA+C,EAGjE,GAAI,CAACA,EAAO,WAAa,EAAEA,EAAO,qBAAqB,aACrD,MAAM,IAAI,MAAM,kEAAkE,EAGpF,GAAI,CAACA,EAAO,eAAiB,EAAEA,EAAO,yBAAyB,mBAC7D,MAAM,IAAI,MAAM,yEAAyE,EAG3F,KAAK,OAASA,EACd,KAAK,cAAgBA,EAAO,cAC5B,KAAK,UAAYA,EAAO,UAGxB,KAAK,YAAc,IAAIC,cAGvB,KAAK,aAAe,KAAK,oBAAmB,EAC5C,KAAK,eAAiB,IAAIC,iBAAe,KAAK,aAAcF,EAAO,cAAgB,EAAE,EAGrF,KAAK,aAAe,IAAIG,e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,OAAOA,GAAc,SAAU,CACjC,QAAQ,KAAK,wDAAwD,EACrE,MACF,CAEA,KAAK,aAAa,QAAQA,CAAS,CACrC,CAaA,oBAAoBC,EAAiB,CACnC,KAAK,aAAa,oBAAoBA,CAAe,CACvD,CAOA,oBAAqB,CACnB,KAAK,aAAa,mBAAkB,CACtC,CAOA,wBAAyB,CACvB,OAAO,KAAK,aAAa,SAC3B,CAUA,mBAAmBC,EAAW,CAC5B,GAAI,CAACA,GAAa,OAAOA,GAAc,SACrC,OAIF,KAAK,eAAe,OAASC,EAAAA,UAAU,KAAK,eAAe,OAAQD,CAAS,EAG5E,KAAK,eAAe,eAAe,KAAK,YAAa,KAAK,WAAW,EACrE,MAAMN,EAAc,KAAK,aAAa,eAAc,EACpD,KAAK,eAAe,OAAOA,CAAW,CACxC,CAOA,UAAW,CACT,MAAO,CACL,KAAM,KAAK,YACX,MAAO,KAAK,aACZ,YAAa,KAAK,YAClB,UAAW,KAAK,UAChB,KAAM,KAAK,aAAa,eAAc,EACtC,SAAU,KAAK,gBACf,OAAQ,KAAK,MACnB,CACE,CAKA,SAAU,CACJ,KAAK,aACP,KAAK,YAAY,QAAO,EAGtB,KAAK,gBACP,KAAK,eAAe,QAAO,EAGzB,KAAK,cACP,KAAK,aAAa,QAAO,EAGvB,KAAK,cAAgB,KAAK,aAAa,YACzC,KAAK,aAAa,WAAW,YAAY,KAAK,YAAY,EAG5D,KAAK,YAAc,KACnB,KAAK,eAAiB,KACtB,KAAK,aAAe,KACpB,KAAK,aAAe,KACpB,KAAK,OAAS,KACd,KAAK,cAAgB,KACrB,KAAK,UAAY,KACjB,KAAK,YAAc,CAAA,EACnB,KAAK,YAAc,EACnB,KAAK,aAAe,EACpB,KAAK,UAAY,EACjB,KAAK,gBAAkB,KACvB,KAAK,OAAS,IAChB,CACF"}
package/dist/index2.js CHANGED
@@ -2,7 +2,7 @@ import { PDFRenderer as n } from "./index3.js";
2
2
  import { TimelineSync as s } from "./index4.js";
3
3
  import { StrokeRenderer as i } from "./index5.js";
4
4
  import { deepMerge as o } from "./index6.js";
5
- class u {
5
+ class d {
6
6
  /**
7
7
  * Create AnnotationRenderer instance
8
8
  *
@@ -130,6 +130,36 @@ class u {
130
130
  }
131
131
  this.timelineSync.setTime(e);
132
132
  }
133
+ /**
134
+ * Start continuous timeline synchronization using requestAnimationFrame
135
+ *
136
+ * Polls the provided function at ~60fps for smooth animation.
137
+ * Use this for audio/video synchronization instead of setTime().
138
+ *
139
+ * @param {Function} getTimeFunction - Function that returns current time in seconds
140
+ * @example
141
+ * const audio = document.getElementById('audio');
142
+ * renderer.startContinuousSync(() => audio.currentTime);
143
+ */
144
+ startContinuousSync(e) {
145
+ this.timelineSync.startContinuousSync(e);
146
+ }
147
+ /**
148
+ * Stop continuous timeline synchronization
149
+ *
150
+ * Call this when audio/video stops or component unmounts.
151
+ */
152
+ stopContinuousSync() {
153
+ this.timelineSync.stopContinuousSync();
154
+ }
155
+ /**
156
+ * Check if continuous sync is currently active
157
+ *
158
+ * @returns {boolean} True if continuous sync is running
159
+ */
160
+ isContinuousSyncActive() {
161
+ return this.timelineSync.isRunning;
162
+ }
133
163
  /**
134
164
  * Update stroke rendering configuration at runtime
135
165
  *
@@ -169,6 +199,6 @@ class u {
169
199
  }
170
200
  }
171
201
  export {
172
- u as AnnotationRenderer
202
+ d as AnnotationRenderer
173
203
  };
174
204
  //# sourceMappingURL=index2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index2.js","sources":["../src/core/AnnotationRenderer.js"],"sourcesContent":["/**\n * AnnotationRenderer - Main facade for PDF annotation rendering engine\n *\n * Orchestrates PDFRenderer, StrokeRenderer, and TimelineSync subsystems.\n * Provides the primary public API for rendering PDFs with timeline-synchronized\n * annotations. Framework-agnostic core that can be wrapped by React/Vue adapters.\n *\n * @module core/AnnotationRenderer\n */\n\nimport { PDFRenderer } from './PDFRenderer.js';\nimport { TimelineSync } from './TimelineSync.js';\nimport { StrokeRenderer } from '../renderer/StrokeRenderer.js';\nimport { deepMerge } from '../pen/effects.js';\n\n/**\n * AnnotationRenderer class\n *\n * Main engine that coordinates PDF rendering, stroke-based annotation rendering,\n * and timeline synchronization. Provides simple imperative API for consumers.\n *\n * @class\n * @example\n * const renderer = new AnnotationRenderer({\n * container: document.getElementById('container'),\n * canvasElement: document.getElementById('pdf-canvas')\n * });\n *\n * await renderer.loadPDF('/path/to/doc.pdf');\n * await renderer.setPage(1);\n * renderer.setAnnotations(annotationData);\n * renderer.setTime(3.5);\n */\nexport class AnnotationRenderer {\n /**\n * Create AnnotationRenderer instance\n *\n * @param {Object} config - Configuration object\n * @param {HTMLElement} config.container - DOM element for annotation canvas\n * @param {HTMLCanvasElement} config.canvasElement - Canvas element for PDF rendering\n * @param {string} [config.pdfUrl] - PDF URL to load immediately\n * @param {number} [config.initialPage=1] - Initial page number\n * @param {number} [config.initialScale=1.0] - Initial scale factor\n * @param {Array} [config.annotations=[]] - Initial annotation data\n * @param {Object} [config.strokeConfig] - StrokeRenderer configuration\n * @throws {Error} If config is invalid or required elements are missing\n */\n constructor(config) {\n if (!config || typeof config !== 'object') {\n throw new Error('AnnotationRenderer: config object is required');\n }\n\n if (!config.container || !(config.container instanceof HTMLElement)) {\n throw new Error('AnnotationRenderer: config.container must be a valid DOM element');\n }\n\n if (!config.canvasElement || !(config.canvasElement instanceof HTMLCanvasElement)) {\n throw new Error('AnnotationRenderer: config.canvasElement must be a valid canvas element');\n }\n\n this.config = config;\n this.canvasElement = config.canvasElement;\n this.container = config.container;\n\n // Initialize PDFRenderer\n this.pdfRenderer = new PDFRenderer();\n\n // Create stroke canvas and StrokeRenderer\n this.strokeCanvas = this._createStrokeCanvas();\n this.strokeRenderer = new StrokeRenderer(this.strokeCanvas, config.strokeConfig || {});\n\n // Initialize TimelineSync\n this.timelineSync = new TimelineSync();\n\n // State\n this.currentPage = config.initialPage || 1;\n this.currentScale = config.initialScale || 1.0;\n this.annotations = config.annotations || [];\n this.pageCount = 0;\n this.currentViewport = null;\n this.pdfUrl = null;\n\n // Wire up timeline to render\n this.timelineSync.subscribe((time) => {\n this.strokeRenderer.render(time);\n });\n\n // Auto-load PDF if provided\n if (config.pdfUrl) {\n this.loadPDF(config.pdfUrl).catch(err => {\n console.error('AnnotationRenderer: Failed to auto-load PDF:', err);\n });\n }\n }\n\n /**\n * Create stroke canvas overlay\n *\n * @private\n * @returns {HTMLCanvasElement} Stroke canvas element\n */\n _createStrokeCanvas() {\n const canvas = document.createElement('canvas');\n canvas.className = 'stroke-canvas';\n canvas.style.position = 'absolute';\n canvas.style.top = '0';\n canvas.style.left = '0';\n canvas.style.pointerEvents = 'none';\n canvas.style.zIndex = '10';\n this.container.appendChild(canvas);\n return canvas;\n }\n\n /**\n * Load PDF document from URL\n *\n * @param {string} url - URL or path to PDF file\n * @returns {Promise<Object>} Load result with success status and page count\n */\n async loadPDF(url) {\n try {\n if (!url || typeof url !== 'string') {\n return { success: false, error: 'Invalid PDF URL provided' };\n }\n\n const result = await this.pdfRenderer.loadDocument(url);\n\n if (result.success) {\n this.pdfUrl = url;\n this.pageCount = result.pageCount;\n return { success: true, pageCount: result.pageCount };\n }\n\n return result;\n } catch (err) {\n console.error('AnnotationRenderer.loadPDF: Error loading PDF:', err);\n return { success: false, error: `Failed to load PDF: ${err.message}` };\n }\n }\n\n /**\n * Navigate to specific page and render it\n *\n * @param {number} pageNum - Page number (1-indexed)\n * @returns {Promise<Object>} Render result with viewport information\n */\n async setPage(pageNum) {\n try {\n if (typeof pageNum !== 'number' || pageNum < 1) {\n return { success: false, error: 'Invalid page number' };\n }\n\n if (this.pageCount > 0 && pageNum > this.pageCount) {\n return { success: false, error: `Page ${pageNum} exceeds document page count (${this.pageCount})` };\n }\n\n this.pdfRenderer.cancelRender();\n\n const result = await this.pdfRenderer.renderPage(\n pageNum,\n this.canvasElement,\n this.currentScale\n );\n\n if (result.success) {\n this.currentPage = pageNum;\n this.currentViewport = result.viewport;\n\n // Update StrokeRenderer viewport\n this.strokeRenderer.setViewport(result.viewport.width, result.viewport.height);\n\n // Re-set annotations for new page\n this.strokeRenderer.setAnnotations(this.annotations, pageNum);\n\n // Render at current time\n const currentTime = this.timelineSync.getCurrentTime();\n this.strokeRenderer.render(currentTime);\n\n return { success: true, viewport: result.viewport };\n }\n\n return result;\n } catch (err) {\n console.error('AnnotationRenderer.setPage: Error rendering page:', err);\n return { success: false, error: `Failed to render page: ${err.message}` };\n }\n }\n\n /**\n * Change zoom scale and re-render current page\n *\n * @param {number} scale - Scale factor (e.g., 1.0, 1.5, 2.0)\n * @returns {Promise<Object>} Render result with viewport information\n */\n async setScale(scale) {\n try {\n if (typeof scale !== 'number' || scale <= 0) {\n return { success: false, error: 'Invalid scale value (must be positive number)' };\n }\n\n this.currentScale = scale;\n return await this.setPage(this.currentPage);\n } catch (err) {\n console.error('AnnotationRenderer.setScale: Error changing scale:', err);\n return { success: false, error: `Failed to change scale: ${err.message}` };\n }\n }\n\n /**\n * Update annotation data for rendering\n *\n * @param {Array} annotations - Complete annotation array (all pages, all types)\n */\n setAnnotations(annotations) {\n if (!Array.isArray(annotations)) {\n console.warn('AnnotationRenderer.setAnnotations: annotations must be an array');\n annotations = [];\n }\n\n this.annotations = annotations;\n this.strokeRenderer.setAnnotations(annotations, this.currentPage);\n\n // Render at current time\n const currentTime = this.timelineSync.getCurrentTime();\n this.strokeRenderer.render(currentTime);\n }\n\n /**\n * Set pre-converted strokes directly\n *\n * Bypasses annotation conversion, useful for stroke commands from backend.\n *\n * @param {Array} strokes - Array of stroke command objects\n */\n setStrokes(strokes) {\n this.strokeRenderer.setStrokes(strokes);\n\n const currentTime = this.timelineSync.getCurrentTime();\n this.strokeRenderer.render(currentTime);\n }\n\n /**\n * Update timeline position for animation\n *\n * @param {number} timestamp - Current timeline position in seconds\n */\n setTime(timestamp) {\n if (typeof timestamp !== 'number') {\n console.warn('AnnotationRenderer.setTime: timestamp must be a number');\n return;\n }\n\n this.timelineSync.setTime(timestamp);\n }\n\n /**\n * Update stroke rendering configuration at runtime\n *\n * Merges new config with existing and re-renders annotations.\n * Used for live preview of pen style changes.\n *\n * @param {Object} newConfig - New stroke configuration to merge\n */\n updateStrokeConfig(newConfig) {\n if (!newConfig || typeof newConfig !== 'object') {\n return;\n }\n\n // Merge new config into existing\n this.strokeRenderer.config = deepMerge(this.strokeRenderer.config, newConfig);\n\n // Re-convert annotations with new style and render\n this.strokeRenderer.setAnnotations(this.annotations, this.currentPage);\n const currentTime = this.timelineSync.getCurrentTime();\n this.strokeRenderer.render(currentTime);\n }\n\n /**\n * Get current engine state snapshot\n *\n * @returns {Object} Current state\n */\n getState() {\n return {\n page: this.currentPage,\n scale: this.currentScale,\n annotations: this.annotations,\n pageCount: this.pageCount,\n time: this.timelineSync.getCurrentTime(),\n viewport: this.currentViewport,\n pdfUrl: this.pdfUrl\n };\n }\n\n /**\n * Clean up all resources and subsystems\n */\n destroy() {\n if (this.pdfRenderer) {\n this.pdfRenderer.destroy();\n }\n\n if (this.strokeRenderer) {\n this.strokeRenderer.destroy();\n }\n\n if (this.timelineSync) {\n this.timelineSync.destroy();\n }\n\n if (this.strokeCanvas && this.strokeCanvas.parentNode) {\n this.strokeCanvas.parentNode.removeChild(this.strokeCanvas);\n }\n\n this.pdfRenderer = null;\n this.strokeRenderer = null;\n this.timelineSync = null;\n this.strokeCanvas = null;\n this.config = null;\n this.canvasElement = null;\n this.container = null;\n this.annotations = [];\n this.currentPage = 0;\n this.currentScale = 1.0;\n this.pageCount = 0;\n this.currentViewport = null;\n this.pdfUrl = null;\n }\n}\n"],"names":["AnnotationRenderer","config","PDFRenderer","StrokeRenderer","TimelineSync","time","err","canvas","url","result","pageNum","currentTime","scale","annotations","strokes","timestamp","newConfig","deepMerge"],"mappings":";;;;AAiCO,MAAMA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAc9B,YAAYC,GAAQ;AAClB,QAAI,CAACA,KAAU,OAAOA,KAAW;A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,KAAK,aAAa,eAAc;AACpD,SAAK,eAAe,OAAOA,CAAW;AAAA,EACxC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,WAAW;AACT,WAAO;AAAA,MACL,MAAM,KAAK;AAAA,MACX,OAAO,KAAK;AAAA,MACZ,aAAa,KAAK;AAAA,MAClB,WAAW,KAAK;AAAA,MAChB,MAAM,KAAK,aAAa,eAAc;AAAA,MACtC,UAAU,KAAK;AAAA,MACf,QAAQ,KAAK;AAAA,IACnB;AAAA,EACE;AAAA;AAAA;AAAA;AAAA,EAKA,UAAU;AACR,IAAI,KAAK,eACP,KAAK,YAAY,QAAO,GAGtB,KAAK,kBACP,KAAK,eAAe,QAAO,GAGzB,KAAK,gBACP,KAAK,aAAa,QAAO,GAGvB,KAAK,gBAAgB,KAAK,aAAa,cACzC,KAAK,aAAa,WAAW,YAAY,KAAK,YAAY,GAG5D,KAAK,cAAc,MACnB,KAAK,iBAAiB,MACtB,KAAK,eAAe,MACpB,KAAK,eAAe,MACpB,KAAK,SAAS,MACd,KAAK,gBAAgB,MACrB,KAAK,YAAY,MACjB,KAAK,cAAc,CAAA,GACnB,KAAK,cAAc,GACnB,KAAK,eAAe,GACpB,KAAK,YAAY,GACjB,KAAK,kBAAkB,MACvB,KAAK,SAAS;AAAA,EAChB;AACF;"}
1
+ {"version":3,"file":"index2.js","sources":["../src/core/AnnotationRenderer.js"],"sourcesContent":["/**\n * AnnotationRenderer - Main facade for PDF annotation rendering engine\n *\n * Orchestrates PDFRenderer, StrokeRenderer, and TimelineSync subsystems.\n * Provides the primary public API for rendering PDFs with timeline-synchronized\n * annotations. Framework-agnostic core that can be wrapped by React/Vue adapters.\n *\n * @module core/AnnotationRenderer\n */\n\nimport { PDFRenderer } from './PDFRenderer.js';\nimport { TimelineSync } from './TimelineSync.js';\nimport { StrokeRenderer } from '../renderer/StrokeRenderer.js';\nimport { deepMerge } from '../pen/effects.js';\n\n/**\n * AnnotationRenderer class\n *\n * Main engine that coordinates PDF rendering, stroke-based annotation rendering,\n * and timeline synchronization. Provides simple imperative API for consumers.\n *\n * @class\n * @example\n * const renderer = new AnnotationRenderer({\n * container: document.getElementById('container'),\n * canvasElement: document.getElementById('pdf-canvas')\n * });\n *\n * await renderer.loadPDF('/path/to/doc.pdf');\n * await renderer.setPage(1);\n * renderer.setAnnotations(annotationData);\n * renderer.setTime(3.5);\n */\nexport class AnnotationRenderer {\n /**\n * Create AnnotationRenderer instance\n *\n * @param {Object} config - Configuration object\n * @param {HTMLElement} config.container - DOM element for annotation canvas\n * @param {HTMLCanvasElement} config.canvasElement - Canvas element for PDF rendering\n * @param {string} [config.pdfUrl] - PDF URL to load immediately\n * @param {number} [config.initialPage=1] - Initial page number\n * @param {number} [config.initialScale=1.0] - Initial scale factor\n * @param {Array} [config.annotations=[]] - Initial annotation data\n * @param {Object} [config.strokeConfig] - StrokeRenderer configuration\n * @throws {Error} If config is invalid or required elements are missing\n */\n constructor(config) {\n if (!config || typeof config !== 'object') {\n throw new Error('AnnotationRenderer: config object is required');\n }\n\n if (!config.container || !(config.container instanceof HTMLElement)) {\n throw new Error('AnnotationRenderer: config.container must be a valid DOM element');\n }\n\n if (!config.canvasElement || !(config.canvasElement instanceof HTMLCanvasElement)) {\n throw new Error('AnnotationRenderer: config.canvasElement must be a valid canvas element');\n }\n\n this.config = config;\n this.canvasElement = config.canvasElement;\n this.container = config.container;\n\n // Initialize PDFRenderer\n this.pdfRenderer = new PDFRenderer();\n\n // Create stroke canvas and StrokeRenderer\n this.strokeCanvas = this._createStrokeCanvas();\n this.strokeRenderer = new StrokeRenderer(this.strokeCanvas, config.strokeConfig || {});\n\n // Initialize TimelineSync\n this.timelineSync = new TimelineSync();\n\n // State\n this.currentPage = config.initialPage || 1;\n this.currentScale = config.initialScale || 1.0;\n this.annotations = config.annotations || [];\n this.pageCount = 0;\n this.currentViewport = null;\n this.pdfUrl = null;\n\n // Wire up timeline to render\n this.timelineSync.subscribe((time) => {\n this.strokeRenderer.render(time);\n });\n\n // Auto-load PDF if provided\n if (config.pdfUrl) {\n this.loadPDF(config.pdfUrl).catch(err => {\n console.error('AnnotationRenderer: Failed to auto-load PDF:', err);\n });\n }\n }\n\n /**\n * Create stroke canvas overlay\n *\n * @private\n * @returns {HTMLCanvasElement} Stroke canvas element\n */\n _createStrokeCanvas() {\n const canvas = document.createElement('canvas');\n canvas.className = 'stroke-canvas';\n canvas.style.position = 'absolute';\n canvas.style.top = '0';\n canvas.style.left = '0';\n canvas.style.pointerEvents = 'none';\n canvas.style.zIndex = '10';\n this.container.appendChild(canvas);\n return canvas;\n }\n\n /**\n * Load PDF document from URL\n *\n * @param {string} url - URL or path to PDF file\n * @returns {Promise<Object>} Load result with success status and page count\n */\n async loadPDF(url) {\n try {\n if (!url || typeof url !== 'string') {\n return { success: false, error: 'Invalid PDF URL provided' };\n }\n\n const result = await this.pdfRenderer.loadDocument(url);\n\n if (result.success) {\n this.pdfUrl = url;\n this.pageCount = result.pageCount;\n return { success: true, pageCount: result.pageCount };\n }\n\n return result;\n } catch (err) {\n console.error('AnnotationRenderer.loadPDF: Error loading PDF:', err);\n return { success: false, error: `Failed to load PDF: ${err.message}` };\n }\n }\n\n /**\n * Navigate to specific page and render it\n *\n * @param {number} pageNum - Page number (1-indexed)\n * @returns {Promise<Object>} Render result with viewport information\n */\n async setPage(pageNum) {\n try {\n if (typeof pageNum !== 'number' || pageNum < 1) {\n return { success: false, error: 'Invalid page number' };\n }\n\n if (this.pageCount > 0 && pageNum > this.pageCount) {\n return { success: false, error: `Page ${pageNum} exceeds document page count (${this.pageCount})` };\n }\n\n this.pdfRenderer.cancelRender();\n\n const result = await this.pdfRenderer.renderPage(\n pageNum,\n this.canvasElement,\n this.currentScale\n );\n\n if (result.success) {\n this.currentPage = pageNum;\n this.currentViewport = result.viewport;\n\n // Update StrokeRenderer viewport\n this.strokeRenderer.setViewport(result.viewport.width, result.viewport.height);\n\n // Re-set annotations for new page\n this.strokeRenderer.setAnnotations(this.annotations, pageNum);\n\n // Render at current time\n const currentTime = this.timelineSync.getCurrentTime();\n this.strokeRenderer.render(currentTime);\n\n return { success: true, viewport: result.viewport };\n }\n\n return result;\n } catch (err) {\n console.error('AnnotationRenderer.setPage: Error rendering page:', err);\n return { success: false, error: `Failed to render page: ${err.message}` };\n }\n }\n\n /**\n * Change zoom scale and re-render current page\n *\n * @param {number} scale - Scale factor (e.g., 1.0, 1.5, 2.0)\n * @returns {Promise<Object>} Render result with viewport information\n */\n async setScale(scale) {\n try {\n if (typeof scale !== 'number' || scale <= 0) {\n return { success: false, error: 'Invalid scale value (must be positive number)' };\n }\n\n this.currentScale = scale;\n return await this.setPage(this.currentPage);\n } catch (err) {\n console.error('AnnotationRenderer.setScale: Error changing scale:', err);\n return { success: false, error: `Failed to change scale: ${err.message}` };\n }\n }\n\n /**\n * Update annotation data for rendering\n *\n * @param {Array} annotations - Complete annotation array (all pages, all types)\n */\n setAnnotations(annotations) {\n if (!Array.isArray(annotations)) {\n console.warn('AnnotationRenderer.setAnnotations: annotations must be an array');\n annotations = [];\n }\n\n this.annotations = annotations;\n this.strokeRenderer.setAnnotations(annotations, this.currentPage);\n\n // Render at current time\n const currentTime = this.timelineSync.getCurrentTime();\n this.strokeRenderer.render(currentTime);\n }\n\n /**\n * Set pre-converted strokes directly\n *\n * Bypasses annotation conversion, useful for stroke commands from backend.\n *\n * @param {Array} strokes - Array of stroke command objects\n */\n setStrokes(strokes) {\n this.strokeRenderer.setStrokes(strokes);\n\n const currentTime = this.timelineSync.getCurrentTime();\n this.strokeRenderer.render(currentTime);\n }\n\n /**\n * Update timeline position for animation\n *\n * @param {number} timestamp - Current timeline position in seconds\n */\n setTime(timestamp) {\n if (typeof timestamp !== 'number') {\n console.warn('AnnotationRenderer.setTime: timestamp must be a number');\n return;\n }\n\n this.timelineSync.setTime(timestamp);\n }\n\n /**\n * Start continuous timeline synchronization using requestAnimationFrame\n *\n * Polls the provided function at ~60fps for smooth animation.\n * Use this for audio/video synchronization instead of setTime().\n *\n * @param {Function} getTimeFunction - Function that returns current time in seconds\n * @example\n * const audio = document.getElementById('audio');\n * renderer.startContinuousSync(() => audio.currentTime);\n */\n startContinuousSync(getTimeFunction) {\n this.timelineSync.startContinuousSync(getTimeFunction);\n }\n\n /**\n * Stop continuous timeline synchronization\n *\n * Call this when audio/video stops or component unmounts.\n */\n stopContinuousSync() {\n this.timelineSync.stopContinuousSync();\n }\n\n /**\n * Check if continuous sync is currently active\n *\n * @returns {boolean} True if continuous sync is running\n */\n isContinuousSyncActive() {\n return this.timelineSync.isRunning;\n }\n\n /**\n * Update stroke rendering configuration at runtime\n *\n * Merges new config with existing and re-renders annotations.\n * Used for live preview of pen style changes.\n *\n * @param {Object} newConfig - New stroke configuration to merge\n */\n updateStrokeConfig(newConfig) {\n if (!newConfig || typeof newConfig !== 'object') {\n return;\n }\n\n // Merge new config into existing\n this.strokeRenderer.config = deepMerge(this.strokeRenderer.config, newConfig);\n\n // Re-convert annotations with new style and render\n this.strokeRenderer.setAnnotations(this.annotations, this.currentPage);\n const currentTime = this.timelineSync.getCurrentTime();\n this.strokeRenderer.render(currentTime);\n }\n\n /**\n * Get current engine state snapshot\n *\n * @returns {Object} Current state\n */\n getState() {\n return {\n page: this.currentPage,\n scale: this.currentScale,\n annotations: this.annotations,\n pageCount: this.pageCount,\n time: this.timelineSync.getCurrentTime(),\n viewport: this.currentViewport,\n pdfUrl: this.pdfUrl\n };\n }\n\n /**\n * Clean up all resources and subsystems\n */\n destroy() {\n if (this.pdfRenderer) {\n this.pdfRenderer.destroy();\n }\n\n if (this.strokeRenderer) {\n this.strokeRenderer.destroy();\n }\n\n if (this.timelineSync) {\n this.timelineSync.destroy();\n }\n\n if (this.strokeCanvas && this.strokeCanvas.parentNode) {\n this.strokeCanvas.parentNode.removeChild(this.strokeCanvas);\n }\n\n this.pdfRenderer = null;\n this.strokeRenderer = null;\n this.timelineSync = null;\n this.strokeCanvas = null;\n this.config = null;\n this.canvasElement = null;\n this.container = null;\n this.annotations = [];\n this.currentPage = 0;\n this.currentScale = 1.0;\n this.pageCount = 0;\n this.currentViewport = null;\n this.pdfUrl = null;\n }\n}\n"],"names":["AnnotationRenderer","config","PDFRenderer","StrokeRenderer","TimelineSync","time","err","canvas","url","result","pageNum","currentTime","scale","annotations","strokes","timestamp","getTimeFunction","newConfig","deepMerge"],"mappings":";;;;AAiCO,MAAMA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAc9B,YAAYC,GAAQ;AAClB,QAAI,CAACA,KAAU,OAAOA,KAAW;AAC/B,YAAM,IAAI,MAAM,+CAA+C;AAGjE,QAAI,CAACA,EAAO,aAAa,EAAEA,EAAO,qBAAqB;AACrD,YAAM,IAAI,MAAM,kEAAkE;AAGpF,QAAI,CAACA,EAAO,iBAAiB,EAAEA,EAAO,yBAAyB;AAC7D,YAAM,IAAI,MAAM,yEAAyE;AAG3F,SAAK,SAASA,GACd,KAAK,gBAAgBA,EAAO,eAC5B,KAAK,YAAYA,EAAO,WAGxB,KAAK,cAAc,IAAIC,EAAW,GAGlC,KAAK,eAAe,KAAK,oBAAmB,GAC5C,KAAK,iBAAiB,IAAIC,EAAe,KAAK,cAAcF,EAAO,gBAAgB,EAAE,GAGrF,KAAK,eAAe,IAAIG,EAAY,GAGpC,KAAK,cAAcH,EAAO,eAAe,GACzC,KAAK,eAAeA,EAAO,gBAAgB,GAC3C,KAAK,cAAcA,EAAO,eAAe,CAAA,GACzC,KAAK,YAAY,GACjB,KAAK,kBAAkB,MACvB,KAAK,SAAS,MAGd,KAAK,aAAa,UAAU,CAACI,MAAS;AACpC,WAAK,eAAe,OAAOA,CAAI;AAAA,IACjC,CAAC,GAGGJ,EAAO,UACT,KAAK,QAAQA,EAAO,MAAM,EAAE,MAAM,CAAAK,MAAO;AACvC,cAAQ,MAAM,gDAAgDA,CAAG;AAAA,IACnE,CAAC;AAAA,EAEL;AAAA;AAAA;AAAA;AAA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YAAY,KAAK,YAAY,GAG5D,KAAK,cAAc,MACnB,KAAK,iBAAiB,MACtB,KAAK,eAAe,MACpB,KAAK,eAAe,MACpB,KAAK,SAAS,MACd,KAAK,gBAAgB,MACrB,KAAK,YAAY,MACjB,KAAK,cAAc,CAAA,GACnB,KAAK,cAAc,GACnB,KAAK,eAAe,GACpB,KAAK,YAAY,GACjB,KAAK,kBAAkB,MACvB,KAAK,SAAS;AAAA,EAChB;AACF;"}
package/dist/index23.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={0:{width:.6,strokes:[{points:[[.3,0],[.1,.05],[0,.2],[0,.8],[.1,.95],[.3,1],[.5,.95],[.6,.8],[.6,.2],[.5,.05],[.3,0]]}]},1:{width:.4,strokes:[{points:[[.1,.2],[.25,0],[.25,1]]}]},2:{width:.6,strokes:[{points:[[0,.15],[.15,0],[.45,0],[.6,.15],[.6,.35],[0,1],[.6,1]]}]},3:{width:.6,strokes:[{points:[[0,.1],[.2,0],[.45,0],[.6,.15],[.6,.35],[.45,.5],[.2,.5]]},{points:[[.2,.5],[.45,.5],[.6,.65],[.6,.85],[.45,1],[.2,1],[0,.9]]}]},4:{width:.6,strokes:[{points:[[.45,0],[0,.7],[.6,.7]]},{points:[[.45,0],[.45,1]]}]},5:{width:.6,strokes:[{points:[[.55,0],[.05,0],[0,.45],[.3,.4],[.5,.5],[.6,.7],[.5,.9],[.3,1],[0,.9]]}]},6:{width:.6,strokes:[{points:[[.5,0],[.2,0],[0,.3],[0,.8],[.15,1],[.45,1],[.6,.85],[.6,.6],[.45,.45],[.15,.45],[0,.6]]}]},7:{width:.6,strokes:[{points:[[0,0],[.6,0],[.2,1]]}]},8:{width:.6,strokes:[{points:[[.3,.5],[.1,.45],[0,.3],[.05,.1],[.2,0],[.4,0],[.55,.1],[.6,.3],[.5,.45],[.3,.5]]},{points:[[.3,.5],[.1,.55],[0,.7],[0,.85],[.15,1],[.45,1],[.6,.85],[.6,.7],[.5,.55],[.3,.5]]}]},9:{width:.6,strokes:[{points:[[.6,.4],[.45,.55],[.15,.55],[0,.4],[0,.15],[.15,0],[.45,0],[.6,.2],[.6,.7],[.4,1],[.1,1]]}]},A:{width:.8,strokes:[{points:[[0,1],[.4,0],[.8,1]]},{points:[[.15,.6],[.65,.6]]}]},B:{width:.7,strokes:[{points:[[0,0],[0,1]]},{points:[[0,0],[.5,0],[.7,.1],[.7,.4],[.5,.5],[0,.5]]},{points:[[0,.5],[.5,.5],[.7,.6],[.7,.9],[.5,1],[0,1]]}]},C:{width:.7,strokes:[{points:[[.7,.2],[.5,0],[.2,0],[0,.2],[0,.8],[.2,1],[.5,1],[.7,.8]]}]},D:{width:.7,strokes:[{points:[[0,0],[0,1]]},{points:[[0,0],[.4,0],[.7,.2],[.7,.8],[.4,1],[0,1]]}]},E:{width:.6,strokes:[{points:[[0,0],[0,1]]},{points:[[0,0],[.6,0]]},{points:[[0,.5],[.5,.5]]},{points:[[0,1],[.6,1]]}]},F:{width:.6,strokes:[{points:[[0,0],[0,1]]},{points:[[0,0],[.6,0]]},{points:[[0,.5],[.5,.5]]}]},G:{width:.7,strokes:[{points:[[.7,.2],[.5,0],[.2,0],[0,.2],[0,.8],[.2,1],[.5,1],[.7,.8],[.7,.5],[.4,.5]]}]},H:{width:.7,strokes:[{points:[[0,0],[0,1]]},{points:[[.7,0],[.7,1]]},{points:[[0,.5],[.7,.5]]}]},I:{width:.3,strokes:[{points:[[.15,0],[.15,1]]}]},J:{width:.5,strokes:[{points:[[.5,0],[.5,.8],[.3,1],[.1,.9]]}]},K:{width:.7,strokes:[{points:[[0,0],[0,1]]},{points:[[.7,0],[0,.5]]},{points:[[.2,.4],[.7,1]]}]},L:{width:.6,strokes:[{points:[[0,0],[0,1],[.6,1]]}]},M:{width:.9,strokes:[{points:[[0,1],[0,0],[.45,.6],[.9,0],[.9,1]]}]},N:{width:.7,strokes:[{points:[[0,1],[0,0],[.7,1],[.7,0]]}]},O:{width:.8,strokes:[{points:[[.4,0],[.1,0],[0,.2],[0,.8],[.1,1],[.7,1],[.8,.8],[.8,.2],[.7,0],[.4,0]]}]},P:{width:.7,strokes:[{points:[[0,0],[0,1]]},{points:[[0,0],[.5,0],[.7,.1],[.7,.4],[.5,.5],[0,.5]]}]},Q:{width:.8,strokes:[{points:[[.4,0],[.1,0],[0,.2],[0,.8],[.1,1],[.7,1],[.8,.8],[.8,.2],[.7,0],[.4,0]]},{points:[[.5,.7],[.8,1]]}]},R:{width:.7,strokes:[{points:[[0,0],[0,1]]},{points:[[0,0],[.5,0],[.7,.1],[.7,.4],[.5,.5],[0,.5]]},{points:[[.4,.5],[.7,1]]}]},S:{width:.7,strokes:[{points:[[.7,.1],[.5,0],[.2,0],[0,.15],[0,.35],[.2,.5],[.5,.5],[.7,.65],[.7,.85],[.5,1],[.2,1],[0,.9]]}]},T:{width:.7,strokes:[{points:[[0,0],[.7,0]]},{points:[[.35,0],[.35,1]]}]},U:{width:.7,strokes:[{points:[[0,0],[0,.8],[.2,1],[.5,1],[.7,.8],[.7,0]]}]},V:{width:.8,strokes:[{points:[[0,0],[.4,1],[.8,0]]}]},W:{width:1,strokes:[{points:[[0,0],[.2,1],[.5,.5],[.8,1],[1,0]]}]},X:{width:.7,strokes:[{points:[[0,0],[.7,1]]},{points:[[.7,0],[0,1]]}]},Y:{width:.7,strokes:[{points:[[0,0],[.35,.5],[.35,1]]},{points:[[.7,0],[.35,.5]]}]},Z:{width:.7,strokes:[{points:[[0,0],[.7,0],[0,1],[.7,1]]}]},a:{width:.6,strokes:[{points:[[.5,.4],[.3,.4],[.1,.5],[0,.7],[.1,.9],[.3,1],[.5,.9],[.6,.7],[.6,.4],[.6,1]]}]},b:{width:.6,strokes:[{points:[[0,0],[0,1]]},{points:[[0,.4],[.3,.4],[.5,.5],[.6,.7],[.5,.9],[.3,1],[0,1]]}]},c:{width:.5,strokes:[{points:[[.5,.5],[.3,.4],[.1,.5],[0,.7],[.1,.9],[.3,1],[.5,.9]]}]},d:{width:.6,strokes:[{points:[[.6,0],[.6,1]]},{points:[[.6,.4],[.3,.4],[.1,.5],[0,.7],[.1,.9],[.3,1],[.6,1]]}]},e:{width:.6,strokes:[{points:[[0,.7],[.6,.7],[.6,.5],[.4,.4],[.2,.4],[0,.6],[0,.8],[.2,1],[.5,1],[.6,.9]]}]},f:{width:.4,strokes:[{points:[[.4,.1],[.3,0],[.15,0],[.1,.1],[.1,1]]},{points:[[0,.4],[.35,.4]]}]},g:{width:.6,strokes:[{points:[[.6,.4],[.6,1.2],[.4,1.3],[.2,1.2]]},{points:[[.6,.4],[.3,.4],[.1,.5],[0,.7],[.1,.9],[.3,1],[.6,1]]}]},h:{width:.6,strokes:[{points:[[0,0],[0,1]]},{points:[[0,.5],[.3,.4],[.5,.5],[.6,.6],[.6,1]]}]},i:{width:.25,strokes:[{points:[[.12,.4],[.12,1]]},{points:[[.12,.15],[.12,.2]]}]},j:{width:.3,strokes:[{points:[[.2,.4],[.2,1.1],[.1,1.2],[0,1.1]]},{points:[[.2,.15],[.2,.2]]}]},k:{width:.5,strokes:[{points:[[0,0],[0,1]]},{points:[[.5,.4],[0,.7]]},{points:[[.15,.6],[.5,1]]}]},l:{width:.25,strokes:[{points:[[.12,0],[.12,1]]}]},m:{width:.9,strokes:[{points:[[0,.4],[0,1]]},{points:[[0,.5],[.2,.4],[.35,.5],[.4,.6],[.4,1]]},{points:[[.4,.5],[.6,.4],[.75,.5],[.8,.6],[.8,1]]}]},n:{width:.6,strokes:[{points:[[0,.4],[0,1]]},{points:[[0,.5],[.3,.4],[.5,.5],[.6,.6],[.6,1]]}]},o:{width:.6,strokes:[{points:[[.3,.4],[.1,.45],[0,.6],[0,.85],[.1,.95],[.3,1],[.5,.95],[.6,.85],[.6,.6],[.5,.45],[.3,.4]]}]},p:{width:.6,strokes:[{points:[[0,.4],[0,1.3]]},{points:[[0,.4],[.3,.4],[.5,.5],[.6,.7],[.5,.9],[.3,1],[0,1]]}]},q:{width:.6,strokes:[{points:[[.6,.4],[.6,1.3]]},{points:[[.6,.4],[.3,.4],[.1,.5],[0,.7],[.1,.9],[.3,1],[.6,1]]}]},r:{width:.4,strokes:[{points:[[0,.4],[0,1]]},{points:[[0,.6],[.2,.45],[.4,.4]]}]},s:{width:.5,strokes:[{points:[[.5,.5],[.3,.4],[.1,.45],[0,.55],[.1,.65],[.4,.75],[.5,.85],[.4,.95],[.2,1],[0,.95]]}]},t:{width:.4,strokes:[{points:[[.15,.1],[.15,.9],[.25,1],[.4,.95]]},{points:[[0,.4],[.35,.4]]}]},u:{width:.6,strokes:[{points:[[0,.4],[0,.85],[.15,1],[.4,1],[.6,.85],[.6,.4]]},{points:[[.6,.85],[.6,1]]}]},v:{width:.6,strokes:[{points:[[0,.4],[.3,1],[.6,.4]]}]},w:{width:.8,strokes:[{points:[[0,.4],[.15,1],[.4,.6],[.65,1],[.8,.4]]}]},x:{width:.5,strokes:[{points:[[0,.4],[.5,1]]},{points:[[.5,.4],[0,1]]}]},y:{width:.6,strokes:[{points:[[0,.4],[.3,.85]]},{points:[[.6,.4],[.2,1.2],[0,1.25]]}]},z:{width:.5,strokes:[{points:[[0,.4],[.5,.4],[0,1],[.5,1]]}]},"!":{width:.2,strokes:[{points:[[.1,0],[.1,.7]]},{points:[[.1,.9],[.1,1]]}]},"?":{width:.5,strokes:[{points:[[0,.15],[.15,0],[.35,0],[.5,.15],[.5,.35],[.25,.55],[.25,.7]]},{points:[[.25,.9],[.25,1]]}]},".":{width:.2,strokes:[{points:[[.1,.95],[.1,1]]}]},",":{width:.2,strokes:[{points:[[.1,.9],[.05,1.1]]}]},":":{width:.2,strokes:[{points:[[.1,.4],[.1,.45]]},{points:[[.1,.9],[.1,.95]]}]},";":{width:.2,strokes:[{points:[[.1,.4],[.1,.45]]},{points:[[.1,.9],[.05,1.1]]}]},"-":{width:.4,strokes:[{points:[[0,.5],[.4,.5]]}]},"'":{width:.15,strokes:[{points:[[.075,0],[.075,.2]]}]},'"':{width:.3,strokes:[{points:[[.05,0],[.05,.2]]},{points:[[.2,0],[.2,.2]]}]},"(":{width:.3,strokes:[{points:[[.25,0],[.1,.2],[0,.5],[.1,.8],[.25,1]]}]},")":{width:.3,strokes:[{points:[[.05,0],[.2,.2],[.3,.5],[.2,.8],[.05,1]]}]}},s={glyphs:t};exports.default=s;exports.glyphs=t;
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
2
  //# sourceMappingURL=index23.cjs.map
package/dist/index23.js CHANGED
@@ -1,8 +1,8 @@
1
- const t = { 0: { width: 0.6, strokes: [{ points: [[0.3, 0], [0.1, 0.05], [0, 0.2], [0, 0.8], [0.1, 0.95], [0.3, 1], [0.5, 0.95], [0.6, 0.8], [0.6, 0.2], [0.5, 0.05], [0.3, 0]] }] }, 1: { width: 0.4, strokes: [{ points: [[0.1, 0.2], [0.25, 0], [0.25, 1]] }] }, 2: { width: 0.6, strokes: [{ points: [[0, 0.15], [0.15, 0], [0.45, 0], [0.6, 0.15], [0.6, 0.35], [0, 1], [0.6, 1]] }] }, 3: { width: 0.6, strokes: [{ points: [[0, 0.1], [0.2, 0], [0.45, 0], [0.6, 0.15], [0.6, 0.35], [0.45, 0.5], [0.2, 0.5]] }, { points: [[0.2, 0.5], [0.45, 0.5], [0.6, 0.65], [0.6, 0.85], [0.45, 1], [0.2, 1], [0, 0.9]] }] }, 4: { width: 0.6, strokes: [{ points: [[0.45, 0], [0, 0.7], [0.6, 0.7]] }, { points: [[0.45, 0], [0.45, 1]] }] }, 5: { width: 0.6, strokes: [{ points: [[0.55, 0], [0.05, 0], [0, 0.45], [0.3, 0.4], [0.5, 0.5], [0.6, 0.7], [0.5, 0.9], [0.3, 1], [0, 0.9]] }] }, 6: { width: 0.6, strokes: [{ points: [[0.5, 0], [0.2, 0], [0, 0.3], [0, 0.8], [0.15, 1], [0.45, 1], [0.6, 0.85], [0.6, 0.6], [0.45, 0.45], [0.15, 0.45], [0, 0.6]] }] }, 7: { width: 0.6, strokes: [{ points: [[0, 0], [0.6, 0], [0.2, 1]] }] }, 8: { width: 0.6, strokes: [{ points: [[0.3, 0.5], [0.1, 0.45], [0, 0.3], [0.05, 0.1], [0.2, 0], [0.4, 0], [0.55, 0.1], [0.6, 0.3], [0.5, 0.45], [0.3, 0.5]] }, { points: [[0.3, 0.5], [0.1, 0.55], [0, 0.7], [0, 0.85], [0.15, 1], [0.45, 1], [0.6, 0.85], [0.6, 0.7], [0.5, 0.55], [0.3, 0.5]] }] }, 9: { width: 0.6, strokes: [{ points: [[0.6, 0.4], [0.45, 0.55], [0.15, 0.55], [0, 0.4], [0, 0.15], [0.15, 0], [0.45, 0], [0.6, 0.2], [0.6, 0.7], [0.4, 1], [0.1, 1]] }] }, A: { width: 0.8, strokes: [{ points: [[0, 1], [0.4, 0], [0.8, 1]] }, { points: [[0.15, 0.6], [0.65, 0.6]] }] }, B: { width: 0.7, strokes: [{ points: [[0, 0], [0, 1]] }, { points: [[0, 0], [0.5, 0], [0.7, 0.1], [0.7, 0.4], [0.5, 0.5], [0, 0.5]] }, { points: [[0, 0.5], [0.5, 0.5], [0.7, 0.6], [0.7, 0.9], [0.5, 1], [0, 1]] }] }, C: { width: 0.7, strokes: [{ points: [[0.7, 0.2], [0.5, 0], [0.2, 0], [0, 0.2], [0, 0.8], [0.2, 1], [0.5, 1], [0.7, 0.8]] }] }, D: { width: 0.7, strokes: [{ points: [[0, 0], [0, 1]] }, { points: [[0, 0], [0.4, 0], [0.7, 0.2], [0.7, 0.8], [0.4, 1], [0, 1]] }] }, E: { width: 0.6, strokes: [{ points: [[0, 0], [0, 1]] }, { points: [[0, 0], [0.6, 0]] }, { points: [[0, 0.5], [0.5, 0.5]] }, { points: [[0, 1], [0.6, 1]] }] }, F: { width: 0.6, strokes: [{ points: [[0, 0], [0, 1]] }, { points: [[0, 0], [0.6, 0]] }, { points: [[0, 0.5], [0.5, 0.5]] }] }, G: { width: 0.7, strokes: [{ points: [[0.7, 0.2], [0.5, 0], [0.2, 0], [0, 0.2], [0, 0.8], [0.2, 1], [0.5, 1], [0.7, 0.8], [0.7, 0.5], [0.4, 0.5]] }] }, H: { width: 0.7, strokes: [{ points: [[0, 0], [0, 1]] }, { points: [[0.7, 0], [0.7, 1]] }, { points: [[0, 0.5], [0.7, 0.5]] }] }, I: { width: 0.3, strokes: [{ points: [[0.15, 0], [0.15, 1]] }] }, J: { width: 0.5, strokes: [{ points: [[0.5, 0], [0.5, 0.8], [0.3, 1], [0.1, 0.9]] }] }, K: { width: 0.7, strokes: [{ points: [[0, 0], [0, 1]] }, { points: [[0.7, 0], [0, 0.5]] }, { points: [[0.2, 0.4], [0.7, 1]] }] }, L: { width: 0.6, strokes: [{ points: [[0, 0], [0, 1], [0.6, 1]] }] }, M: { width: 0.9, strokes: [{ points: [[0, 1], [0, 0], [0.45, 0.6], [0.9, 0], [0.9, 1]] }] }, N: { width: 0.7, strokes: [{ points: [[0, 1], [0, 0], [0.7, 1], [0.7, 0]] }] }, O: { width: 0.8, strokes: [{ points: [[0.4, 0], [0.1, 0], [0, 0.2], [0, 0.8], [0.1, 1], [0.7, 1], [0.8, 0.8], [0.8, 0.2], [0.7, 0], [0.4, 0]] }] }, P: { width: 0.7, strokes: [{ points: [[0, 0], [0, 1]] }, { points: [[0, 0], [0.5, 0], [0.7, 0.1], [0.7, 0.4], [0.5, 0.5], [0, 0.5]] }] }, Q: { width: 0.8, strokes: [{ points: [[0.4, 0], [0.1, 0], [0, 0.2], [0, 0.8], [0.1, 1], [0.7, 1], [0.8, 0.8], [0.8, 0.2], [0.7, 0], [0.4, 0]] }, { points: [[0.5, 0.7], [0.8, 1]] }] }, R: { width: 0.7, strokes: [{ points: [[0, 0], [0, 1]] }, { points: [[0, 0], [0.5, 0], [0.7, 0.1], [0.7, 0.4], [0.5, 0.5], [0, 0.5]] }, { points: [[0.4, 0.5], [0.7, 1]] }] }, S: { width: 0.7, strokes: [{ points: [[0.7, 0.1], [0.5, 0], [0.2, 0], [0, 0.15], [0, 0.35], [0.2, 0.5], [0.5, 0.5], [0.7, 0.65], [0.7, 0.85], [0.5, 1], [0.2, 1], [0, 0.9]] }] }, T: { width: 0.7, strokes: [{ points: [[0, 0], [0.7, 0]] }, { points: [[0.35, 0], [0.35, 1]] }] }, U: { width: 0.7, strokes: [{ points: [[0, 0], [0, 0.8], [0.2, 1], [0.5, 1], [0.7, 0.8], [0.7, 0]] }] }, V: { width: 0.8, strokes: [{ points: [[0, 0], [0.4, 1], [0.8, 0]] }] }, W: { width: 1, strokes: [{ points: [[0, 0], [0.2, 1], [0.5, 0.5], [0.8, 1], [1, 0]] }] }, X: { width: 0.7, strokes: [{ points: [[0, 0], [0.7, 1]] }, { points: [[0.7, 0], [0, 1]] }] }, Y: { width: 0.7, strokes: [{ points: [[0, 0], [0.35, 0.5], [0.35, 1]] }, { points: [[0.7, 0], [0.35, 0.5]] }] }, Z: { width: 0.7, strokes: [{ points: [[0, 0], [0.7, 0], [0, 1], [0.7, 1]] }] }, a: { width: 0.6, strokes: [{ points: [[0.5, 0.4], [0.3, 0.4], [0.1, 0.5], [0, 0.7], [0.1, 0.9], [0.3, 1], [0.5, 0.9], [0.6, 0.7], [0.6, 0.4], [0.6, 1]] }] }, b: { width: 0.6, strokes: [{ points: [[0, 0], [0, 1]] }, { points: [[0, 0.4], [0.3, 0.4], [0.5, 0.5], [0.6, 0.7], [0.5, 0.9], [0.3, 1], [0, 1]] }] }, c: { width: 0.5, strokes: [{ points: [[0.5, 0.5], [0.3, 0.4], [0.1, 0.5], [0, 0.7], [0.1, 0.9], [0.3, 1], [0.5, 0.9]] }] }, d: { width: 0.6, strokes: [{ points: [[0.6, 0], [0.6, 1]] }, { points: [[0.6, 0.4], [0.3, 0.4], [0.1, 0.5], [0, 0.7], [0.1, 0.9], [0.3, 1], [0.6, 1]] }] }, e: { width: 0.6, strokes: [{ points: [[0, 0.7], [0.6, 0.7], [0.6, 0.5], [0.4, 0.4], [0.2, 0.4], [0, 0.6], [0, 0.8], [0.2, 1], [0.5, 1], [0.6, 0.9]] }] }, f: { width: 0.4, strokes: [{ points: [[0.4, 0.1], [0.3, 0], [0.15, 0], [0.1, 0.1], [0.1, 1]] }, { points: [[0, 0.4], [0.35, 0.4]] }] }, g: { width: 0.6, strokes: [{ points: [[0.6, 0.4], [0.6, 1.2], [0.4, 1.3], [0.2, 1.2]] }, { points: [[0.6, 0.4], [0.3, 0.4], [0.1, 0.5], [0, 0.7], [0.1, 0.9], [0.3, 1], [0.6, 1]] }] }, h: { width: 0.6, strokes: [{ points: [[0, 0], [0, 1]] }, { points: [[0, 0.5], [0.3, 0.4], [0.5, 0.5], [0.6, 0.6], [0.6, 1]] }] }, i: { width: 0.25, strokes: [{ points: [[0.12, 0.4], [0.12, 1]] }, { points: [[0.12, 0.15], [0.12, 0.2]] }] }, j: { width: 0.3, strokes: [{ points: [[0.2, 0.4], [0.2, 1.1], [0.1, 1.2], [0, 1.1]] }, { points: [[0.2, 0.15], [0.2, 0.2]] }] }, k: { width: 0.5, strokes: [{ points: [[0, 0], [0, 1]] }, { points: [[0.5, 0.4], [0, 0.7]] }, { points: [[0.15, 0.6], [0.5, 1]] }] }, l: { width: 0.25, strokes: [{ points: [[0.12, 0], [0.12, 1]] }] }, m: { width: 0.9, strokes: [{ points: [[0, 0.4], [0, 1]] }, { points: [[0, 0.5], [0.2, 0.4], [0.35, 0.5], [0.4, 0.6], [0.4, 1]] }, { points: [[0.4, 0.5], [0.6, 0.4], [0.75, 0.5], [0.8, 0.6], [0.8, 1]] }] }, n: { width: 0.6, strokes: [{ points: [[0, 0.4], [0, 1]] }, { points: [[0, 0.5], [0.3, 0.4], [0.5, 0.5], [0.6, 0.6], [0.6, 1]] }] }, o: { width: 0.6, strokes: [{ points: [[0.3, 0.4], [0.1, 0.45], [0, 0.6], [0, 0.85], [0.1, 0.95], [0.3, 1], [0.5, 0.95], [0.6, 0.85], [0.6, 0.6], [0.5, 0.45], [0.3, 0.4]] }] }, p: { width: 0.6, strokes: [{ points: [[0, 0.4], [0, 1.3]] }, { points: [[0, 0.4], [0.3, 0.4], [0.5, 0.5], [0.6, 0.7], [0.5, 0.9], [0.3, 1], [0, 1]] }] }, q: { width: 0.6, strokes: [{ points: [[0.6, 0.4], [0.6, 1.3]] }, { points: [[0.6, 0.4], [0.3, 0.4], [0.1, 0.5], [0, 0.7], [0.1, 0.9], [0.3, 1], [0.6, 1]] }] }, r: { width: 0.4, strokes: [{ points: [[0, 0.4], [0, 1]] }, { points: [[0, 0.6], [0.2, 0.45], [0.4, 0.4]] }] }, s: { width: 0.5, strokes: [{ points: [[0.5, 0.5], [0.3, 0.4], [0.1, 0.45], [0, 0.55], [0.1, 0.65], [0.4, 0.75], [0.5, 0.85], [0.4, 0.95], [0.2, 1], [0, 0.95]] }] }, t: { width: 0.4, strokes: [{ points: [[0.15, 0.1], [0.15, 0.9], [0.25, 1], [0.4, 0.95]] }, { points: [[0, 0.4], [0.35, 0.4]] }] }, u: { width: 0.6, strokes: [{ points: [[0, 0.4], [0, 0.85], [0.15, 1], [0.4, 1], [0.6, 0.85], [0.6, 0.4]] }, { points: [[0.6, 0.85], [0.6, 1]] }] }, v: { width: 0.6, strokes: [{ points: [[0, 0.4], [0.3, 1], [0.6, 0.4]] }] }, w: { width: 0.8, strokes: [{ points: [[0, 0.4], [0.15, 1], [0.4, 0.6], [0.65, 1], [0.8, 0.4]] }] }, x: { width: 0.5, strokes: [{ points: [[0, 0.4], [0.5, 1]] }, { points: [[0.5, 0.4], [0, 1]] }] }, y: { width: 0.6, strokes: [{ points: [[0, 0.4], [0.3, 0.85]] }, { points: [[0.6, 0.4], [0.2, 1.2], [0, 1.25]] }] }, z: { width: 0.5, strokes: [{ points: [[0, 0.4], [0.5, 0.4], [0, 1], [0.5, 1]] }] }, "!": { width: 0.2, strokes: [{ points: [[0.1, 0], [0.1, 0.7]] }, { points: [[0.1, 0.9], [0.1, 1]] }] }, "?": { width: 0.5, strokes: [{ points: [[0, 0.15], [0.15, 0], [0.35, 0], [0.5, 0.15], [0.5, 0.35], [0.25, 0.55], [0.25, 0.7]] }, { points: [[0.25, 0.9], [0.25, 1]] }] }, ".": { width: 0.2, strokes: [{ points: [[0.1, 0.95], [0.1, 1]] }] }, ",": { width: 0.2, strokes: [{ points: [[0.1, 0.9], [0.05, 1.1]] }] }, ":": { width: 0.2, strokes: [{ points: [[0.1, 0.4], [0.1, 0.45]] }, { points: [[0.1, 0.9], [0.1, 0.95]] }] }, ";": { width: 0.2, strokes: [{ points: [[0.1, 0.4], [0.1, 0.45]] }, { points: [[0.1, 0.9], [0.05, 1.1]] }] }, "-": { width: 0.4, strokes: [{ points: [[0, 0.5], [0.4, 0.5]] }] }, "'": { width: 0.15, strokes: [{ points: [[0.075, 0], [0.075, 0.2]] }] }, '"': { width: 0.3, strokes: [{ points: [[0.05, 0], [0.05, 0.2]] }, { points: [[0.2, 0], [0.2, 0.2]] }] }, "(": { width: 0.3, strokes: [{ points: [[0.25, 0], [0.1, 0.2], [0, 0.5], [0.1, 0.8], [0.25, 1]] }] }, ")": { width: 0.3, strokes: [{ points: [[0.05, 0], [0.2, 0.2], [0.3, 0.5], [0.2, 0.8], [0.05, 1]] }] } }, s = {
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
2
  glyphs: t
3
3
  };
4
4
  export {
5
- s as default,
5
+ i as default,
6
6
  t as glyphs
7
7
  };
8
8
  //# sourceMappingURL=index23.js.map
package/dist/index5.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("./index6.cjs"),S=require("./index14.cjs"),x=require("./index13.cjs"),b={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"}};class u{constructor(t,o={}){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=d.deepMerge(b,o),this.strokes=[],this.viewport={width:0,height:0},this.converters={highlight:x.highlightToStrokes,text:S.textToStrokes}}registerConverter(t,o){if(typeof o!="function")throw new Error("StrokeRenderer.registerConverter: converter must be a function");this.converters[t]=o}setViewport(t,o){this.viewport={width:t,height:o};const e=window.devicePixelRatio||1;this.canvas.width=t*e,this.canvas.height=o*e,this.canvas.style.width=`${t}px`,this.canvas.style.height=`${o}px`,this.ctx.setTransform(e,0,0,e,0,0)}setAnnotations(t,o=null){if(!Array.isArray(t)){console.warn("StrokeRenderer.setAnnotations: annotations must be an array"),this.strokes=[];return}const e=o!==null?t.filter(r=>r.page===o):t;this.strokes=e.flatMap(r=>{const s=this.converters[r.type];if(!s)return console.warn(`StrokeRenderer: Unknown annotation type "${r.type}"`),[];const i=this._resolveStyle(r);return s(r,i)})}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:o,viewport:e,strokes:r}=this;o.clearRect(0,0,e.width,e.height);for(const s of r){if(t<s.start)continue;const i=s.end-s.start,n=t-s.start,h=i>0?Math.min(1,n/i):1;this._drawStroke(s,h)}}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:o,style:e}=t;let r={...this.config.pen};return this.config[o]&&(r=d.deepMerge(r,this.config[o])),e&&(r=d.deepMerge(r,e)),r}_drawStroke(t,o){const{ctx:e,viewport:r}=this,{points:s,color:i,width:n,lineCap:h,pressures:c}=t;if(!s||s.length<2)return;const a=Math.max(2,Math.floor(s.length*o)),l=s.slice(0,a);e.strokeStyle=i||"rgba(0, 0, 0, 0.5)",e.lineCap=h||"round",e.lineJoin="round",c&&c.length>=l.length?this._drawVariableWidthStroke(l,n,c.slice(0,a)):this._drawConstantWidthStroke(l,n)}_drawConstantWidthStroke(t,o){const{ctx:e,viewport:r}=this;e.lineWidth=o||2,e.beginPath();for(let s=0;s<t.length;s++){const[i,n]=t[s],h=i*r.width,c=n*r.height;s===0?e.moveTo(h,c):e.lineTo(h,c)}e.stroke()}_drawVariableWidthStroke(t,o,e){const{ctx:r,viewport:s}=this;for(let i=1;i<t.length;i++){const[n,h]=t[i-1],[c,a]=t[i],l=n*s.width,p=h*s.height,g=c*s.width,f=a*s.height,w=e[i-1]||1,v=e[i]||1,k=(w+v)/2,y=Math.max(.5,o*k);r.lineWidth=y,r.beginPath(),r.moveTo(l,p),r.lineTo(g,f),r.stroke()}}}exports.StrokeRenderer=u;exports.default=u;
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;
2
2
  //# sourceMappingURL=index5.cjs.map