@inkbar/core 0.6.0 → 0.7.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/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as createRecordStore, $t as QuadSchema, A as TextItem, An as rectContainsPoint, At as GLOSS_FORMAT, B as PluginHistory, Bt as LineSchema, C as DocumentInfo, Cn as approxEqual, Ct as ExportedAnnotation, D as OpenOptions, Dn as quadFromRect, Dt as FreeTextSchema, E as InkStatus, En as pointsFromFlat, Et as FreeTextAnnotation, F as ImportOptions, Fn as translateQuad, Ft as InkAnnotation, G as StoreMode, Gt as NoteAnnotation, H as AnnotationChange, Ht as LoupeSchema, I as ImportResult, In as translateRect, It as InkSchema, J as deriveRect, Jt as PointSchema, K as StoreOptions, Kt as NoteIconSchema, L as exportAnnotations, Ln as unionRects, Lt as LineAnnotation, M as InkError, Mn as rectFromQuad, Mt as GLOSS_SCHEMA_ID, N as InkErrorCode, Nn as rectFromQuads, Nt as GLOSS_VERSION, O as openDocument, On as quadsFromFlat, Ot as FreeTextStyle, P as isInkError, Pn as rectsIntersect, Pt as IMAGE_DATA_URL, Q as RecordStoreOptions, Qt as PolylineSchema, R as importAnnotations, Rt as LineEnding, S as createToolStyle, Sn as applyMatrix, St as CircleSchema, T as InkDocument, Tn as multiplyMatrix, Tt as ForeignAnnotation, U as AnnotationEdit, Ut as MaskAnnotation, V as createHistory, Vt as LoupeAnnotation, W as AnnotationStore, Wt as MaskSchema, X as RecordChange, Xt as PolySchema, Y as RecordBase, Yt as PolyAnnotation, Z as RecordStore, Zt as PolygonSchema, _ as StyleGroup, _n as PdfAssets, _t as AnnotationInput, a as SignatureStore, an as SquareSchema, at as importedId, b as ToolStyle, bn as Quad, bt as AnnotationSchema, c as createInkTemplate, cn as TextMarkupAnnotation, ct as Fringe, d as createSignatureLibrary, dn as Writable, dt as cssVariableDefaults, en as RectSchema, et as EmbeddedFieldPatch, f as normaliseInk, fn as derived, ft as normalizeColor, g as ScopedToolStyle, gn as PageRotation, gt as AnnotationDocumentSchema, h as STYLE_GROUPS, hn as PageInfo, ht as AnnotationDocument, i as SignatureOptions, in as ShapeSchema, it as importEmbeddedPage, j as DocumentSource, jn as rectFromPoints, jt as GLOSS_MEDIA_TYPE, k as TextContent, kn as quadsFromRect, kt as FreeTextStyleSchema, l as createLocalSignatureStore, ln as TextMarkupSchema, lt as FringeSchema, m as CurrentStyle, mn as writable, mt as Annotation, n as SIGNATURE_INK_WIDTH, nn as RedactSchema, nt as EmbeddedTarget, o as SignatureTemplate, on as StampAnnotation, ot as pdfColorToHex, p as placeSignature, pn as readonly, pt as staticDefaults, q as createAnnotationStore, qt as NoteSchema, r as SignatureLibrary, rn as ShapeAnnotation, rt as SUPPORTED_SUBTYPES, s as createImageTemplate, sn as StampSchema, st as summarise, t as DEFAULT_SIGNATURE_WIDTH, tn as RedactAnnotation, tt as EmbeddedSummary, u as createMemorySignatureStore, un as Readable, ut as AnnotationDefaults, v as StyleKey, vn as Matrix, vt as AnnotationOfType, w as DocumentStatus, wn as invertMatrix, wt as ExportedAnnotationSchema, x as ToolStyleDeps, xn as Rect, xt as AnnotationType, y as StyleProps, yn as Point, yt as AnnotationPatch, z as History, zt as LineEndingSchema } from "./signatures-By4B40DP.mjs";
1
+ import { $ as RecordChange, $t as PolySchema, A as SearchHit, An as quadFromRect, At as FreeTextSchema, B as exportAnnotations, Bn as unionRects, Bt as LineAnnotation, C as DocumentInfo, Cn as Quad, Ct as AnnotationSchema, D as OpenOptions, Dn as invertMatrix, Dt as ExportedAnnotationSchema, E as InkStatus, En as approxEqual, Et as ExportedAnnotation, F as InkError, Fn as rectFromQuad, Ft as GLOSS_SCHEMA_ID, G as AnnotationChange, Gt as LoupeSchema, H as History, Ht as LineEndingSchema, I as InkErrorCode, In as rectFromQuads, It as GLOSS_VERSION, J as StoreMode, Jt as NoteAnnotation, K as AnnotationEdit, Kt as MaskAnnotation, L as isInkError, Ln as rectsIntersect, Lt as IMAGE_DATA_URL, M as SearchResults, Mn as quadsFromRect, Mt as FreeTextStyleSchema, N as TextContent, Nn as rectContainsPoint, Nt as GLOSS_FORMAT, O as openDocument, On as multiplyMatrix, Ot as ForeignAnnotation, P as TextItem, Pn as rectFromPoints, Pt as GLOSS_MEDIA_TYPE, Q as RecordBase, Qt as PolyAnnotation, R as ImportOptions, Rn as translateQuad, Rt as InkAnnotation, S as createToolStyle, Sn as Point, St as AnnotationPatch, T as InkDocument, Tn as applyMatrix, Tt as CircleSchema, U as PluginHistory, Ut as LineSchema, V as importAnnotations, Vt as LineEnding, W as createHistory, Wt as LoupeAnnotation, X as createAnnotationStore, Xt as NoteSchema, Y as StoreOptions, Yt as NoteIconSchema, Z as deriveRect, Zt as PointSchema, _ as StyleGroup, _n as writable, _t as Annotation, a as SignatureStore, an as RedactSchema, at as EmbeddedTarget, b as ToolStyle, bn as PdfAssets, bt as AnnotationInput, c as createInkTemplate, cn as SquareSchema, ct as importedId, d as createSignatureLibrary, dn as TextMarkupAnnotation, dt as Fringe, en as PolygonSchema, et as RecordStore, f as normaliseInk, fn as TextMarkupSchema, ft as FringeSchema, g as ScopedToolStyle, gn as readonly, gt as staticDefaults, h as STYLE_GROUPS, hn as derived, ht as normalizeColor, i as SignatureOptions, in as RedactAnnotation, it as EmbeddedSummary, j as SearchOptions, jn as quadsFromFlat, jt as FreeTextStyle, k as DocumentSource, kn as pointsFromFlat, kt as FreeTextAnnotation, l as createLocalSignatureStore, ln as StampAnnotation, lt as pdfColorToHex, m as CurrentStyle, mn as Writable, mt as cssVariableDefaults, n as SIGNATURE_INK_WIDTH, nn as QuadSchema, nt as createRecordStore, o as SignatureTemplate, on as ShapeAnnotation, ot as SUPPORTED_SUBTYPES, p as placeSignature, pn as Readable, pt as AnnotationDefaults, q as AnnotationStore, qt as MaskSchema, r as SignatureLibrary, rn as RectSchema, rt as EmbeddedFieldPatch, s as createImageTemplate, sn as ShapeSchema, st as importEmbeddedPage, t as DEFAULT_SIGNATURE_WIDTH, tn as PolylineSchema, tt as RecordStoreOptions, u as createMemorySignatureStore, un as StampSchema, ut as summarise, v as StyleKey, vn as PageInfo, vt as AnnotationDocument, w as DocumentStatus, wn as Rect, wt as AnnotationType, x as ToolStyleDeps, xn as Matrix, xt as AnnotationOfType, y as StyleProps, yn as PageRotation, yt as AnnotationDocumentSchema, z as ImportResult, zn as translateRect, zt as InkSchema } from "./signatures-CalOktkf.mjs";
2
2
  import { INTENTS, LINE_ENDINGS, NOTE_ICONS, PDF_NAME } from "gloss-format";
3
3
  import { z } from "zod";
4
4
  //#region src/model/events.d.ts
@@ -190,5 +190,5 @@ export declare function recogniseStroke(points: readonly Point[]): {
190
190
  /** The @inkbar/core version, from its package.json. */
191
191
  export declare const version: string;
192
192
  //#endregion
193
- export { Annotation, AnnotationChange, AnnotationDefaults, AnnotationDocument, AnnotationDocumentSchema, AnnotationEdit, AnnotationInput, AnnotationOfType, AnnotationPatch, AnnotationSchema, AnnotationStore, AnnotationType, CircleSchema, type CurrentStyle, DEFAULT_SIGNATURE_WIDTH, type DocumentInfo, type DocumentSource, type DocumentStatus, EmbeddedFieldPatch, EmbeddedSummary, EmbeddedTarget, ExportedAnnotation, ExportedAnnotationSchema, ForeignAnnotation, FreeTextAnnotation, FreeTextSchema, FreeTextStyle, FreeTextStyleSchema, type Fringe, FringeSchema, GLOSS_FORMAT, GLOSS_MEDIA_TYPE, GLOSS_SCHEMA_ID, GLOSS_VERSION, History, IMAGE_DATA_URL, INTENTS, type ImportOptions, type ImportResult, InkAnnotation, type InkDocument, InkError, InkErrorCode, InkSchema, type InkStatus, LINE_ENDINGS, LineAnnotation, LineEnding, LineEndingSchema, LineSchema, LoupeAnnotation, LoupeSchema, MaskAnnotation, MaskSchema, Matrix, NOTE_ICONS, NoteAnnotation, NoteIconSchema, NoteSchema, type OpenOptions, PDF_NAME, type PageInfo, type PageRotation, type PdfAssets, PluginHistory, Point, PointSchema, PolyAnnotation, PolySchema, PolygonSchema, PolylineSchema, Quad, QuadSchema, Readable, type Recognised, RecordBase, RecordChange, RecordStore, RecordStoreOptions, Rect, RectSchema, RedactAnnotation, RedactSchema, SIGNATURE_INK_WIDTH, STYLE_GROUPS, SUPPORTED_SUBTYPES, type ScopedToolStyle, ShapeAnnotation, ShapeSchema, type SignatureLibrary, type SignatureOptions, type SignatureStore, type SignatureTemplate, type SnapshotHistory, type SnapshotHistoryOptions, SquareSchema, StampAnnotation, StampSchema, StoreMode, StoreOptions, type StyleGroup, type StyleKey, type StyleProps, type TextContent, type TextItem, TextMarkupAnnotation, TextMarkupSchema, type ThreadRoot, type ToolStyle, type ToolStyleDeps, Writable, applyMatrix, approxEqual, createAnnotationStore, createHistory, createImageTemplate, createInkTemplate, createLocalSignatureStore, createMemorySignatureStore, createRecordStore, createSignatureLibrary, createToolStyle, cssVariableDefaults, deriveRect, derived, exportAnnotations, importAnnotations, importEmbeddedPage, importedId, invertMatrix, isInkError, multiplyMatrix, normaliseInk, normalizeColor, openDocument, pdfColorToHex, placeSignature, pointsFromFlat, quadFromRect, quadsFromFlat, quadsFromRect, readonly, rectContainsPoint, rectFromPoints, rectFromQuad, rectFromQuads, rectsIntersect, staticDefaults, summarise, translateQuad, translateRect, unionRects, writable };
193
+ export { Annotation, AnnotationChange, AnnotationDefaults, AnnotationDocument, AnnotationDocumentSchema, AnnotationEdit, AnnotationInput, AnnotationOfType, AnnotationPatch, AnnotationSchema, AnnotationStore, AnnotationType, CircleSchema, type CurrentStyle, DEFAULT_SIGNATURE_WIDTH, type DocumentInfo, type DocumentSource, type DocumentStatus, EmbeddedFieldPatch, EmbeddedSummary, EmbeddedTarget, ExportedAnnotation, ExportedAnnotationSchema, ForeignAnnotation, FreeTextAnnotation, FreeTextSchema, FreeTextStyle, FreeTextStyleSchema, type Fringe, FringeSchema, GLOSS_FORMAT, GLOSS_MEDIA_TYPE, GLOSS_SCHEMA_ID, GLOSS_VERSION, History, IMAGE_DATA_URL, INTENTS, type ImportOptions, type ImportResult, InkAnnotation, type InkDocument, InkError, InkErrorCode, InkSchema, type InkStatus, LINE_ENDINGS, LineAnnotation, LineEnding, LineEndingSchema, LineSchema, LoupeAnnotation, LoupeSchema, MaskAnnotation, MaskSchema, Matrix, NOTE_ICONS, NoteAnnotation, NoteIconSchema, NoteSchema, type OpenOptions, PDF_NAME, type PageInfo, type PageRotation, type PdfAssets, PluginHistory, Point, PointSchema, PolyAnnotation, PolySchema, PolygonSchema, PolylineSchema, Quad, QuadSchema, Readable, type Recognised, RecordBase, RecordChange, RecordStore, RecordStoreOptions, Rect, RectSchema, RedactAnnotation, RedactSchema, SIGNATURE_INK_WIDTH, STYLE_GROUPS, SUPPORTED_SUBTYPES, type ScopedToolStyle, type SearchHit, type SearchOptions, type SearchResults, ShapeAnnotation, ShapeSchema, type SignatureLibrary, type SignatureOptions, type SignatureStore, type SignatureTemplate, type SnapshotHistory, type SnapshotHistoryOptions, SquareSchema, StampAnnotation, StampSchema, StoreMode, StoreOptions, type StyleGroup, type StyleKey, type StyleProps, type TextContent, type TextItem, TextMarkupAnnotation, TextMarkupSchema, type ThreadRoot, type ToolStyle, type ToolStyleDeps, Writable, applyMatrix, approxEqual, createAnnotationStore, createHistory, createImageTemplate, createInkTemplate, createLocalSignatureStore, createMemorySignatureStore, createRecordStore, createSignatureLibrary, createToolStyle, cssVariableDefaults, deriveRect, derived, exportAnnotations, importAnnotations, importEmbeddedPage, importedId, invertMatrix, isInkError, multiplyMatrix, normaliseInk, normalizeColor, openDocument, pdfColorToHex, placeSignature, pointsFromFlat, quadFromRect, quadsFromFlat, quadsFromRect, readonly, rectContainsPoint, rectFromPoints, rectFromQuad, rectFromQuads, rectsIntersect, staticDefaults, summarise, translateQuad, translateRect, unionRects, writable };
194
194
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as importAnnotations, $t as derived, A as styleGroupOf, At as RectSchema, C as repliesTo, Ct as NoteIconSchema, D as STYLE_GROUPS, Dt as PolygonSchema, E as withoutReplies, Et as PolySchema, F as typesInGroup, Ft as TextMarkupSchema, Gt as isKnown, Ht as LINE_ENDINGS, It as FringeSchema, Jt as cssVariableDefaults, Kt as pdfNameSet, M as styleGroupsOf, Mt as ShapeSchema, N as supportedProps, Nt as SquareSchema, O as createToolStyle, Ot as PolylineSchema, P as toFields, Pt as StampSchema, Q as exportAnnotations, Qt as createRecordStore, S as isThreadRoot, St as MaskSchema, T as threadRoot, Tt as PointSchema, Ut as NOTE_ICONS, Vt as INTENTS, Wt as PDF_NAME, X as createAnnotationStore, Xt as staticDefaults, Y as openDocument, Yt as normalizeColor, Z as deriveRect, Zt as mergeLineRects, _n as unionRects, _t as IMAGE_DATA_URL, a as createLocalSignatureStore, an as multiplyMatrix, at as pdfColorToHex, b as isAbandonedNote, bn as isInkError, bt as LineSchema, c as normaliseInk, cn as quadsFromFlat, ct as AnnotationSchema, d as recogniseStroke, dn as rectFromPoints, dt as FreeTextSchema, en as readonly, et as createHistory, fn as rectFromQuad, ft as FreeTextStyleSchema, gn as translateRect, gt as GLOSS_VERSION, hn as translateQuad, ht as GLOSS_SCHEMA_ID, i as createInkTemplate, in as invertMatrix, it as importedId, j as styleGroupOfType, jt as RedactSchema, k as fromAnnotation, kt as QuadSchema, l as placeSignature, ln as quadsFromRect, lt as CircleSchema, mn as rectsIntersect, mt as GLOSS_MEDIA_TYPE, n as SIGNATURE_INK_WIDTH, nn as applyMatrix, nt as SUPPORTED_SUBTYPES, o as createMemorySignatureStore, on as pointsFromFlat, ot as summarise, pn as rectFromQuads, pt as GLOSS_FORMAT, qt as parsePdfDate, r as createImageTemplate, rn as approxEqual, rt as importEmbeddedPage, s as createSignatureLibrary, sn as quadFromRect, st as AnnotationDocumentSchema, t as DEFAULT_SIGNATURE_WIDTH, tn as writable, tt as isProduction, u as RECOGNISE_THRESHOLD, un as rectContainsPoint, ut as ExportedAnnotationSchema, vn as Emitter, vt as InkSchema, w as threadOf, wt as NoteSchema, x as isReply, xt as LoupeSchema, yn as InkError, yt as LineEndingSchema } from "./signatures-D68fuLlt.mjs";
1
+ import { $ as exportAnnotations, $t as createRecordStore, A as styleGroupOf, At as QuadSchema, C as repliesTo, Ct as MaskSchema, D as STYLE_GROUPS, Dt as PolySchema, E as withoutReplies, Et as PointSchema, F as typesInGroup, Ft as StampSchema, Gt as PDF_NAME, Ht as INTENTS, It as TextMarkupSchema, Jt as parsePdfDate, Kt as isKnown, Lt as FringeSchema, M as styleGroupsOf, Mt as RedactSchema, N as supportedProps, Nt as ShapeSchema, O as createToolStyle, Ot as PolygonSchema, P as toFields, Pt as SquareSchema, Q as deriveRect, Qt as mergeLineRects, S as isThreadRoot, St as LoupeSchema, T as threadRoot, Tt as NoteSchema, Ut as LINE_ENDINGS, Wt as NOTE_ICONS, Xt as normalizeColor, Y as openDocument, Yt as cssVariableDefaults, Z as createAnnotationStore, Zt as staticDefaults, _n as translateRect, _t as GLOSS_VERSION, a as createLocalSignatureStore, an as invertMatrix, at as importedId, b as isAbandonedNote, bn as InkError, bt as LineEndingSchema, c as normaliseInk, cn as quadFromRect, ct as AnnotationDocumentSchema, d as recogniseStroke, dn as rectContainsPoint, dt as ExportedAnnotationSchema, en as derived, et as importAnnotations, fn as rectFromPoints, ft as FreeTextSchema, gn as translateQuad, gt as GLOSS_SCHEMA_ID, hn as rectsIntersect, ht as GLOSS_MEDIA_TYPE, i as createInkTemplate, in as approxEqual, it as importEmbeddedPage, j as styleGroupOfType, jt as RectSchema, k as fromAnnotation, kt as PolylineSchema, l as placeSignature, ln as quadsFromFlat, lt as AnnotationSchema, mn as rectFromQuads, mt as GLOSS_FORMAT, n as SIGNATURE_INK_WIDTH, nn as writable, nt as isProduction, o as createMemorySignatureStore, on as multiplyMatrix, ot as pdfColorToHex, pn as rectFromQuad, pt as FreeTextStyleSchema, qt as pdfNameSet, r as createImageTemplate, rn as applyMatrix, rt as SUPPORTED_SUBTYPES, s as createSignatureLibrary, sn as pointsFromFlat, st as summarise, t as DEFAULT_SIGNATURE_WIDTH, tn as readonly, tt as createHistory, u as RECOGNISE_THRESHOLD, un as quadsFromRect, ut as CircleSchema, vn as unionRects, vt as IMAGE_DATA_URL, w as threadOf, wt as NoteIconSchema, x as isReply, xn as isInkError, xt as LineSchema, yn as Emitter, yt as InkSchema } from "./signatures-Do_l2IlM.mjs";
2
2
  //#region src/model/annotations/snapshot-history.ts
3
3
  const noop = () => {};
4
4
  function createSnapshotHistory(opts) {
@@ -285,7 +285,7 @@ function presentKeys(o) {
285
285
  //#endregion
286
286
  //#region src/index.ts
287
287
  /** The @inkbar/core version, from its package.json. */
288
- const version = "0.6.0";
288
+ const version = "0.7.0";
289
289
  //#endregion
290
290
  export { AnnotationDocumentSchema, AnnotationSchema, CircleSchema, DEFAULT_SIGNATURE_WIDTH, Emitter, ExportedAnnotationSchema, FreeTextSchema, FreeTextStyleSchema, FringeSchema, GLOSS_FORMAT, GLOSS_MEDIA_TYPE, GLOSS_SCHEMA_ID, GLOSS_VERSION, IMAGE_DATA_URL, INTENTS, InkError, InkSchema, LINE_ENDINGS, LineEndingSchema, LineSchema, LoupeSchema, MaskSchema, NOTE_ICONS, NoteIconSchema, NoteSchema, PDF_NAME, PointSchema, PolySchema, PolygonSchema, PolylineSchema, QuadSchema, RECOGNISE_THRESHOLD, RectSchema, RedactSchema, SIGNATURE_INK_WIDTH, STYLE_GROUPS, SUPPORTED_SUBTYPES, ShapeSchema, SquareSchema, StampSchema, TextMarkupSchema, applyMatrix, approxEqual, createAnnotationStore, createHistory, createImageTemplate, createInkTemplate, createLocalSignatureStore, createMemorySignatureStore, createRecordStore, createSignatureLibrary, createSnapshotHistory, createToolStyle, cssVariableDefaults, deriveRect, derived, exportAnnotations, fromAnnotation, importAnnotations, importEmbeddedPage, importedId, invertMatrix, isAbandonedNote, isInkError, isKnown, isReply, isThreadRoot, mergeLineRects, multiplyMatrix, normaliseInk, normalizeColor, openDocument, parsePdfDate, pdfColorToHex, pdfNameSet, placeSignature, pointsFromFlat, quadFromRect, quadsFromFlat, quadsFromRect, readonly, recogniseStroke, rectContainsPoint, rectFromPoints, rectFromQuad, rectFromQuads, rectsIntersect, repliesTo, staticDefaults, styleGroupOf, styleGroupOfType, styleGroupsOf, summarise, supportedProps, threadOf, threadRoot, toFields, translateQuad, translateRect, typesInGroup, unionRects, version, withoutReplies, writable };
291
291
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/model/annotations/snapshot-history.ts","../src/index.ts"],"sourcesContent":["import { isProduction } from '../env'\nimport { derived, writable, type Readable } from '../readable'\n\nimport type { RecordBase, RecordStore } from '../records'\nimport type { PluginHistory } from './history'\nimport type { AnnotationEdit, AnnotationStore } from './store'\nimport type { Annotation } from './types'\n\nexport interface SnapshotHistoryOptions {\n /** Proposes a list to the host. The step counts once the host applies it (seen by `observe`). */\n apply: (list: Annotation[]) => void\n /** Read on every observed change and every undo or redo. */\n enabled: () => boolean\n /** Steps kept. Default 200. */\n limit?: number | undefined\n}\n\n/**\n * Snapshot undo and redo over a host-owned annotation list, for controlled hosts. The\n * framework calls `observe` whenever the host's list changes; every change is a step. Undo and\n * redo propose an earlier list through `apply` and move the stacks only once the host applies\n * it. `canUndo` and `canRedo` report stack sizes; the framework ANDs them with its own flag.\n *\n * Tracked record stores belong to their plugins, not the host, so a step also snapshots each of\n * them. Undo and redo put records back at once (`replaceAll(list, 'history')`) and propose the\n * annotations as above; a step whose annotations did not change moves the stacks at once. A\n * record change outside a batch opens one, so the change and the host's list that follows in\n * the same macrotask are one step. A record store's `reset` takes its records out of every step\n * and drops the steps left with nothing to undo; the others still undo and redo, as in History.\n */\nexport interface SnapshotHistory extends PluginHistory {\n readonly canUndo: Readable<boolean>\n readonly canRedo: Readable<boolean>\n undo(): void\n redo(): void\n clear(): void\n /**\n * The host's current list, or `undefined` when the host does not control it. The first list\n * seeds the history; each later list that differs is a step. An `undefined` neither seeds\n * nor records, and the next list after one starts again without a step.\n */\n observe(list: readonly Annotation[] | undefined): void\n /**\n * Runs `fn` and records the host's changes that follow as one step. A framework may hand the\n * host's list back after `fn` returns, one list per proposal, so the batch stays open until\n * the current macrotask ends (`setTimeout(0)`) and then pushes a single step from the list\n * before `fn` to the latest one. Limit: an unrelated change the host makes in that same window\n * is folded into the step. Nested calls join; a throwing `fn` still closes the batch; when\n * history is disabled `fn` only runs. `fn` must be synchronous; a dev build warns when it\n * returns a promise.\n *\n * A batch opened while an earlier one is still settling closes the earlier one first, so the\n * two are two steps. An undo or redo still in flight (proposed, but not yet applied by the\n * host) when a batch opens is dropped: the host's list that follows counts toward the batch.\n * Undo and redo close a settling batch first. Calling `undo()` or `redo()` inside `fn` is not\n * supported.\n */\n batch(fn: () => void): void\n /**\n * Runs the reactions for each of the store's user edits inside a batch, so what they change\n * joins the edit's step. Undo and redo reach the store as a `replace`, which reacts to nothing.\n * The binding attaches each opened document's store. Returns a function that detaches it.\n */\n attach(store: AnnotationStore): () => void\n}\n\ntype Records = Map<RecordStore<RecordBase>, readonly RecordBase[]>\n/** The host's list and each tracked store's list at one point. */\ninterface Snapshot {\n annotations: readonly Annotation[]\n records: Records\n}\n/** An undo or redo waiting for the host, with the records as they stood before it. */\ntype Pending = { kind: 'undo' | 'redo'; target: Snapshot; records: Records }\n\nconst noop = () => {}\n\nexport function createSnapshotHistory(opts: SnapshotHistoryOptions): SnapshotHistory {\n const limit = Math.max(1, opts.limit ?? 200)\n const past = writable<Snapshot[]>([])\n const future = writable<Snapshot[]>([])\n let pending: Pending | null = null\n /** Copy of the host's list as of its last change; `undefined` before the first list. */\n let current: readonly Annotation[] | undefined\n /** Open `batch` calls, and whether the batch is waiting out the task for late observes. */\n let depth = 0\n let settling: ReturnType<typeof setTimeout> | null = null\n /** The state when the outermost batch opened; `undefined` while no list has been seen. */\n let from: Snapshot | undefined\n /** Each tracked store with its list as of the last change history saw. */\n const tracked = new Map<\n RecordStore<RecordBase>,\n { previous: readonly RecordBase[]; unsubscribe: () => void }\n >()\n const reactions = new Set<(edit: AnnotationEdit) => void>()\n /** Each attached store with its `edit` unsubscribe. */\n const attached = new Map<AnnotationStore, () => void>()\n /** Set while undo or redo puts records back, so those changes are not steps. */\n let replaying = false\n\n function records(): Records {\n return new Map([...tracked].map(([s, t]) => [s, t.previous]))\n }\n\n function state(): Snapshot | undefined {\n return current === undefined\n ? undefined\n : { annotations: current, records: records() }\n }\n\n function push(step: Snapshot): void {\n past.set([...past.get(), step].slice(-limit))\n future.set([])\n }\n\n /** Moves the stacks for an undo or redo that has landed; `prev` is the state it left. */\n function move(kind: Pending['kind'], prev: Snapshot): void {\n if (kind === 'undo') {\n past.set(past.get().slice(0, -1))\n future.set([...future.get(), prev])\n } else {\n future.set(future.get().slice(0, -1))\n past.set([...past.get(), prev])\n }\n }\n\n /**\n * After `store`'s reset: drops the steps that changed nothing but `store`, and gives every\n * remaining snapshot its new `list`, so undo and redo leave its records alone while a step\n * that also changed annotations or another store still undoes those, as in History. `was` is\n * its list just before the reset. Undo targets lose the snapshot before a dropped step, redo\n * targets the one after it.\n */\n function dropSteps(\n store: RecordStore<RecordBase>,\n was: readonly RecordBase[],\n list: readonly RecordBase[]\n ): void {\n // The state now, with the store's list from before the reset.\n const now = current && { annotations: current, records: records().set(store, was) }\n /** Whether the step from `a` to `b` changed only this store, so nothing is left of it. */\n const onlyStore = (a: Snapshot, b: Snapshot | undefined) => {\n if (!b) return false\n const x = a.records.get(store)\n const y = b.records.get(store)\n if (x === undefined || y === undefined || sameRecords(x, y)) return false\n if (!sameList(a.annotations, b.annotations)) return false\n return [...a.records].every(\n ([s, list]) => s === store || sameRecords(list, b.records.get(s) ?? list)\n )\n }\n const renewed = new Map<Snapshot, Snapshot>()\n const renew = (step: Snapshot): Snapshot => {\n const next = step.records.has(store)\n ? { ...step, records: new Map(step.records).set(store, list) }\n : step\n renewed.set(step, next)\n return next\n }\n // Oldest first, then the state now: each undo target is the snapshot before a step.\n const p = past.get()\n past.set(p.filter((step, i) => !onlyStore(step, p[i + 1] ?? now)).map(renew))\n // Next redo last: each redo target is the snapshot after a step.\n const f = future.get()\n future.set(f.filter((step, i) => !onlyStore(step, f[i + 1] ?? now)).map(renew))\n // An undo or redo in flight still lands when its target survived.\n const target = pending && renewed.get(pending.target)\n pending =\n pending && target\n ? { ...pending, target, records: new Map(pending.records).set(store, list) }\n : null\n }\n\n /** Opens the outermost batch from the current state. */\n function open(): void {\n // A batch still settling is closed first, so two batches are two steps.\n if (settling !== null) endBatch()\n // An undo or redo still in flight would be folded into this step; drop it.\n pending = null\n from = state()\n }\n\n function endBatch(): void {\n if (settling !== null) clearTimeout(settling)\n settling = null\n const start = from\n from = undefined\n if (!opts.enabled() || !start || !current) return\n const unchanged =\n sameList(current, start.annotations) &&\n [...start.records].every(([s, list]) =>\n sameRecords(list, tracked.get(s)?.previous ?? list)\n )\n if (!unchanged) push(start)\n }\n\n function batch(fn: () => void): void {\n if (!opts.enabled()) {\n fn()\n return\n }\n if (depth === 0) open()\n depth++\n try {\n const result: unknown = fn()\n if (\n result !== null &&\n typeof result === 'object' &&\n typeof (result as { then?: unknown }).then === 'function' &&\n !isProduction()\n ) {\n console.warn(\n '[inkbar] history.batch(fn): fn returned a promise. Changes after its first await are not part of the batch.'\n )\n }\n } finally {\n depth--\n if (depth === 0) settling = setTimeout(endBatch, 0)\n }\n }\n\n function clear(): void {\n past.set([])\n future.set([])\n pending = null\n from = undefined\n if (settling !== null) clearTimeout(settling)\n settling = null\n }\n\n function observe(next: readonly Annotation[] | undefined): void {\n const prev = current\n current = snapshot(next)\n if (!opts.enabled()) {\n // Steps taken while disabled are unknown to the stacks, which would undo to stale lists.\n if (past.get().length > 0 || future.get().length > 0 || pending) clear()\n return\n }\n // The first list only seeds; there is no step from or to an undefined list.\n if (next === undefined || prev === undefined) return\n // Inside a batch, or while it settles, changes only move `current`; `endBatch` pushes the step.\n if (from !== undefined) return\n // A new array with the same content is not a step, and leaves a pending step alone.\n if (sameList(next, prev)) return\n const step = pending\n pending = null\n if (step && sameList(next, step.target.annotations)) {\n move(step.kind, { annotations: prev, records: step.records })\n return\n }\n push({ annotations: prev, records: records() })\n }\n\n function propose(kind: Pending['kind'], target: Snapshot | undefined): void {\n if (!opts.enabled() || !target) return\n // The same undo or redo again before the host applies: the records were already put back,\n // so the state it leaves is the one the first call saw.\n const before =\n pending && pending.kind === kind && pending.target === target\n ? pending.records\n : records()\n replaying = true\n try {\n // Stores no longer tracked keep their records.\n for (const [s, list] of target.records) {\n const t = tracked.get(s)\n if (t && !sameRecords(t.previous, list)) s.replaceAll([...list], 'history')\n }\n } finally {\n replaying = false\n }\n // Nothing for the host to apply: the step moves now.\n if (current !== undefined && sameList(current, target.annotations)) {\n move(kind, { annotations: current, records: before })\n return\n }\n pending = { kind, target, records: before }\n opts.apply(clone(target.annotations) as Annotation[])\n }\n\n function track(store: RecordStore<RecordBase>): () => void {\n if (tracked.has(store)) return noop\n const unsubscribe = store.on('change', (change) => {\n const t = tracked.get(store)\n if (!t) return\n const list = store.list.get()\n // Our own replays (and any other history replace) never become steps.\n if (replaying || (change.kind === 'replace' && change.reason === 'history')) {\n t.previous = list\n return\n }\n if (!opts.enabled()) {\n t.previous = list\n // As in `observe`: steps taken while disabled would leave the stacks stale.\n if (past.get().length > 0 || future.get().length > 0 || pending) clear()\n return\n }\n if (change.kind === 'replace') {\n // A reset starts the store over, so no older step holding its records can be replayed.\n dropSteps(store, t.previous, list)\n t.previous = list\n from?.records.set(store, list)\n return\n }\n // On its own, a change opens a batch from the state before it, which waits out the task\n // for the host's list.\n if (from === undefined && depth === 0 && current !== undefined) {\n open()\n settling = setTimeout(endBatch, 0)\n }\n t.previous = list\n })\n tracked.set(store, { previous: store.list.get(), unsubscribe })\n // Tracked inside an open batch: the batch covers it from here.\n from?.records.set(store, store.list.get())\n return () => {\n if (tracked.get(store)?.unsubscribe !== unsubscribe) return\n unsubscribe()\n tracked.delete(store)\n from?.records.delete(store)\n }\n }\n\n return {\n canUndo: derived(past, (p) => p.length > 0),\n canRedo: derived(future, (f) => f.length > 0),\n undo: () => {\n if (from !== undefined && depth === 0) endBatch()\n propose('undo', past.get().at(-1))\n },\n redo: () => {\n if (from !== undefined && depth === 0) endBatch()\n propose('redo', future.get().at(-1))\n },\n clear,\n observe,\n batch,\n track,\n react(fn) {\n // Wrapped, so the same function added twice runs twice and each handle removes its own.\n const run = (edit: AnnotationEdit) => fn(edit)\n reactions.add(run)\n return () => {\n reactions.delete(run)\n }\n },\n attach(store) {\n if (attached.has(store)) return noop\n const off = store.on('edit', (edit) => {\n if (reactions.size === 0) return\n batch(() => {\n for (const fn of [...reactions]) fn(edit)\n })\n })\n attached.set(store, off)\n // An old handle never detaches a later attachment of the same store.\n return () => {\n if (attached.get(store) !== off) return\n attached.delete(store)\n off()\n }\n },\n }\n}\n\n/** The same records in the same order; records are frozen, so identity is enough. */\nfunction sameRecords(a: readonly RecordBase[], b: readonly RecordBase[]): boolean {\n return a === b || (a.length === b.length && a.every((x, i) => x === b[i]))\n}\n\nfunction snapshot(\n list: readonly Annotation[] | undefined\n): readonly Annotation[] | undefined {\n return list === undefined ? undefined : clone(list)\n}\n\n/** Annotations are JSON values; this also strips framework proxies and `undefined` members. */\nfunction clone<T>(value: T): T {\n return JSON.parse(JSON.stringify(value)) as T\n}\n\n/** Same annotations in the same order, compared by payload; `modifiedAt` may be re-stamped. */\nfunction sameList(a: readonly Annotation[], b: readonly Annotation[]): boolean {\n return a.length === b.length && a.every((x, i) => sameIgnoringModifiedAt(x, b[i]!))\n}\n\nfunction sameIgnoringModifiedAt(a: Annotation, b: Annotation): boolean {\n const { modifiedAt: _a, ...restA } = a\n const { modifiedAt: _b, ...restB } = b\n return deepEqual(restA, restB)\n}\n\n/** Structural equality over JSON values; keys whose value is `undefined` count as absent. */\nfunction deepEqual(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) return true\n if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null)\n return false\n if (Array.isArray(a) !== Array.isArray(b)) return false\n const ka = presentKeys(a)\n const kb = presentKeys(b)\n if (ka.length !== kb.length) return false\n return ka.every(\n (k) =>\n kb.includes(k) &&\n deepEqual((a as Record<string, unknown>)[k], (b as Record<string, unknown>)[k])\n )\n}\n\nfunction presentKeys(o: object): string[] {\n return Object.keys(o).filter((k) => (o as Record<string, unknown>)[k] !== undefined)\n}\n","/** Replaced at build time (tsdown) and in tests (vitest) with package.json's version. */\ndeclare const __INKBAR_VERSION__: string\n\n/** The @inkbar/core version, from its package.json. */\nexport const version: string = __INKBAR_VERSION__\n\nexport * from './model/errors'\nexport * from './model/events'\nexport * from './model/geometry'\nexport * from './model/readable'\nexport * from './model/records'\nexport { mergeLineRects } from './model/selection'\n\nexport { openDocument } from './model/document'\nexport type {\n DocumentInfo,\n DocumentStatus,\n InkDocument,\n InkStatus,\n OpenOptions,\n} from './model/document'\nexport type { DocumentSource } from './model/source'\nexport type { PageInfo, PageRotation } from './model/pages'\nexport type { TextContent, TextItem } from './model/text'\nexport type { PdfAssets } from './pdfjs/types'\nexport * from './model/annotations/types'\nexport { FringeSchema, type Fringe } from './model/annotations/callout'\nexport * from './model/annotations/pdf-names'\nexport * from './model/annotations/defaults'\nexport * from './model/annotations/store'\nexport * from './model/annotations/history'\nexport { createToolStyle, STYLE_GROUPS } from './model/annotations/tool-style'\nexport type {\n CurrentStyle,\n ScopedToolStyle,\n StyleGroup,\n StyleKey,\n StyleProps,\n ToolStyle,\n ToolStyleDeps,\n} from './model/annotations/tool-style'\nexport {\n fromAnnotation,\n styleGroupOf,\n styleGroupOfType,\n styleGroupsOf,\n supportedProps,\n toFields,\n typesInGroup,\n} from './model/annotations/style-map'\nexport { createSnapshotHistory } from './model/annotations/snapshot-history'\nexport type {\n SnapshotHistory,\n SnapshotHistoryOptions,\n} from './model/annotations/snapshot-history'\nexport {\n isAbandonedNote,\n isReply,\n isThreadRoot,\n repliesTo,\n threadOf,\n threadRoot,\n withoutReplies,\n} from './model/annotations/threads'\nexport type { ThreadRoot } from './model/annotations/threads'\nexport * from './model/annotations/embedded'\nexport { parsePdfDate } from './model/pdf-date'\nexport { exportAnnotations, importAnnotations } from './model/annotations/json'\nexport { recogniseStroke, RECOGNISE_THRESHOLD } from './model/recognise'\nexport type { Recognised } from './model/recognise'\nexport type { ImportOptions, ImportResult } from './model/annotations/json'\nexport {\n createImageTemplate,\n createInkTemplate,\n createLocalSignatureStore,\n createMemorySignatureStore,\n createSignatureLibrary,\n DEFAULT_SIGNATURE_WIDTH,\n normaliseInk,\n placeSignature,\n SIGNATURE_INK_WIDTH,\n} from './model/signatures'\nexport type {\n SignatureLibrary,\n SignatureOptions,\n SignatureStore,\n SignatureTemplate,\n} from './model/signatures'\n"],"mappings":";;AA2EA,MAAM,aAAa,CAAC;AAEpB,SAAgB,sBAAsB,MAA+C;CACnF,MAAM,QAAQ,KAAK,IAAI,GAAG,KAAK,SAAS,GAAG;CAC3C,MAAM,OAAO,SAAqB,CAAC,CAAC;CACpC,MAAM,SAAS,SAAqB,CAAC,CAAC;CACtC,IAAI,UAA0B;;CAE9B,IAAI;;CAEJ,IAAI,QAAQ;CACZ,IAAI,WAAiD;;CAErD,IAAI;;CAEJ,MAAM,0BAAU,IAAI,IAGlB;CACF,MAAM,4BAAY,IAAI,IAAoC;;CAE1D,MAAM,2BAAW,IAAI,IAAiC;;CAEtD,IAAI,YAAY;CAEhB,SAAS,UAAmB;EAC1B,OAAO,IAAI,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;CAC9D;CAEA,SAAS,QAA8B;EACrC,OAAO,YAAY,KAAA,IACf,KAAA,IACA;GAAE,aAAa;GAAS,SAAS,QAAQ;EAAE;CACjD;CAEA,SAAS,KAAK,MAAsB;EAClC,KAAK,IAAI,CAAC,GAAG,KAAK,IAAI,GAAG,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;EAC5C,OAAO,IAAI,CAAC,CAAC;CACf;;CAGA,SAAS,KAAK,MAAuB,MAA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AO,KAAK;AAC/B;;AAGA,SAAS,UAAU,GAAY,GAAqB;CAClD,IAAI,OAAO,GAAG,GAAG,CAAC,GAAG,OAAO;CAC5B,IAAI,OAAO,MAAM,YAAY,OAAO,MAAM,YAAY,MAAM,QAAQ,MAAM,MACxE,OAAO;CACT,IAAI,MAAM,QAAQ,CAAC,MAAM,MAAM,QAAQ,CAAC,GAAG,OAAO;CAClD,MAAM,KAAK,YAAY,CAAC;CACxB,MAAM,KAAK,YAAY,CAAC;CACxB,IAAI,GAAG,WAAW,GAAG,QAAQ,OAAO;CACpC,OAAO,GAAG,OACP,MACC,GAAG,SAAS,CAAC,KACb,UAAW,EAA8B,IAAK,EAA8B,EAAE,CAClF;AACF;AAEA,SAAS,YAAY,GAAqB;CACxC,OAAO,OAAO,KAAK,CAAC,CAAC,CAAC,QAAQ,MAAO,EAA8B,OAAO,KAAA,CAAS;AACrF;;;;ACtZA,MAAa,UAAA"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/model/annotations/snapshot-history.ts","../src/index.ts"],"sourcesContent":["import { isProduction } from '../env'\nimport { derived, writable, type Readable } from '../readable'\n\nimport type { RecordBase, RecordStore } from '../records'\nimport type { PluginHistory } from './history'\nimport type { AnnotationEdit, AnnotationStore } from './store'\nimport type { Annotation } from './types'\n\nexport interface SnapshotHistoryOptions {\n /** Proposes a list to the host. The step counts once the host applies it (seen by `observe`). */\n apply: (list: Annotation[]) => void\n /** Read on every observed change and every undo or redo. */\n enabled: () => boolean\n /** Steps kept. Default 200. */\n limit?: number | undefined\n}\n\n/**\n * Snapshot undo and redo over a host-owned annotation list, for controlled hosts. The\n * framework calls `observe` whenever the host's list changes; every change is a step. Undo and\n * redo propose an earlier list through `apply` and move the stacks only once the host applies\n * it. `canUndo` and `canRedo` report stack sizes; the framework ANDs them with its own flag.\n *\n * Tracked record stores belong to their plugins, not the host, so a step also snapshots each of\n * them. Undo and redo put records back at once (`replaceAll(list, 'history')`) and propose the\n * annotations as above; a step whose annotations did not change moves the stacks at once. A\n * record change outside a batch opens one, so the change and the host's list that follows in\n * the same macrotask are one step. A record store's `reset` takes its records out of every step\n * and drops the steps left with nothing to undo; the others still undo and redo, as in History.\n */\nexport interface SnapshotHistory extends PluginHistory {\n readonly canUndo: Readable<boolean>\n readonly canRedo: Readable<boolean>\n undo(): void\n redo(): void\n clear(): void\n /**\n * The host's current list, or `undefined` when the host does not control it. The first list\n * seeds the history; each later list that differs is a step. An `undefined` neither seeds\n * nor records, and the next list after one starts again without a step.\n */\n observe(list: readonly Annotation[] | undefined): void\n /**\n * Runs `fn` and records the host's changes that follow as one step. A framework may hand the\n * host's list back after `fn` returns, one list per proposal, so the batch stays open until\n * the current macrotask ends (`setTimeout(0)`) and then pushes a single step from the list\n * before `fn` to the latest one. Limit: an unrelated change the host makes in that same window\n * is folded into the step. Nested calls join; a throwing `fn` still closes the batch; when\n * history is disabled `fn` only runs. `fn` must be synchronous; a dev build warns when it\n * returns a promise.\n *\n * A batch opened while an earlier one is still settling closes the earlier one first, so the\n * two are two steps. An undo or redo still in flight (proposed, but not yet applied by the\n * host) when a batch opens is dropped: the host's list that follows counts toward the batch.\n * Undo and redo close a settling batch first. Calling `undo()` or `redo()` inside `fn` is not\n * supported.\n */\n batch(fn: () => void): void\n /**\n * Runs the reactions for each of the store's user edits inside a batch, so what they change\n * joins the edit's step. Undo and redo reach the store as a `replace`, which reacts to nothing.\n * The binding attaches each opened document's store. Returns a function that detaches it.\n */\n attach(store: AnnotationStore): () => void\n}\n\ntype Records = Map<RecordStore<RecordBase>, readonly RecordBase[]>\n/** The host's list and each tracked store's list at one point. */\ninterface Snapshot {\n annotations: readonly Annotation[]\n records: Records\n}\n/** An undo or redo waiting for the host, with the records as they stood before it. */\ntype Pending = { kind: 'undo' | 'redo'; target: Snapshot; records: Records }\n\nconst noop = () => {}\n\nexport function createSnapshotHistory(opts: SnapshotHistoryOptions): SnapshotHistory {\n const limit = Math.max(1, opts.limit ?? 200)\n const past = writable<Snapshot[]>([])\n const future = writable<Snapshot[]>([])\n let pending: Pending | null = null\n /** Copy of the host's list as of its last change; `undefined` before the first list. */\n let current: readonly Annotation[] | undefined\n /** Open `batch` calls, and whether the batch is waiting out the task for late observes. */\n let depth = 0\n let settling: ReturnType<typeof setTimeout> | null = null\n /** The state when the outermost batch opened; `undefined` while no list has been seen. */\n let from: Snapshot | undefined\n /** Each tracked store with its list as of the last change history saw. */\n const tracked = new Map<\n RecordStore<RecordBase>,\n { previous: readonly RecordBase[]; unsubscribe: () => void }\n >()\n const reactions = new Set<(edit: AnnotationEdit) => void>()\n /** Each attached store with its `edit` unsubscribe. */\n const attached = new Map<AnnotationStore, () => void>()\n /** Set while undo or redo puts records back, so those changes are not steps. */\n let replaying = false\n\n function records(): Records {\n return new Map([...tracked].map(([s, t]) => [s, t.previous]))\n }\n\n function state(): Snapshot | undefined {\n return current === undefined\n ? undefined\n : { annotations: current, records: records() }\n }\n\n function push(step: Snapshot): void {\n past.set([...past.get(), step].slice(-limit))\n future.set([])\n }\n\n /** Moves the stacks for an undo or redo that has landed; `prev` is the state it left. */\n function move(kind: Pending['kind'], prev: Snapshot): void {\n if (kind === 'undo') {\n past.set(past.get().slice(0, -1))\n future.set([...future.get(), prev])\n } else {\n future.set(future.get().slice(0, -1))\n past.set([...past.get(), prev])\n }\n }\n\n /**\n * After `store`'s reset: drops the steps that changed nothing but `store`, and gives every\n * remaining snapshot its new `list`, so undo and redo leave its records alone while a step\n * that also changed annotations or another store still undoes those, as in History. `was` is\n * its list just before the reset. Undo targets lose the snapshot before a dropped step, redo\n * targets the one after it.\n */\n function dropSteps(\n store: RecordStore<RecordBase>,\n was: readonly RecordBase[],\n list: readonly RecordBase[]\n ): void {\n // The state now, with the store's list from before the reset.\n const now = current && { annotations: current, records: records().set(store, was) }\n /** Whether the step from `a` to `b` changed only this store, so nothing is left of it. */\n const onlyStore = (a: Snapshot, b: Snapshot | undefined) => {\n if (!b) return false\n const x = a.records.get(store)\n const y = b.records.get(store)\n if (x === undefined || y === undefined || sameRecords(x, y)) return false\n if (!sameList(a.annotations, b.annotations)) return false\n return [...a.records].every(\n ([s, list]) => s === store || sameRecords(list, b.records.get(s) ?? list)\n )\n }\n const renewed = new Map<Snapshot, Snapshot>()\n const renew = (step: Snapshot): Snapshot => {\n const next = step.records.has(store)\n ? { ...step, records: new Map(step.records).set(store, list) }\n : step\n renewed.set(step, next)\n return next\n }\n // Oldest first, then the state now: each undo target is the snapshot before a step.\n const p = past.get()\n past.set(p.filter((step, i) => !onlyStore(step, p[i + 1] ?? now)).map(renew))\n // Next redo last: each redo target is the snapshot after a step.\n const f = future.get()\n future.set(f.filter((step, i) => !onlyStore(step, f[i + 1] ?? now)).map(renew))\n // An undo or redo in flight still lands when its target survived.\n const target = pending && renewed.get(pending.target)\n pending =\n pending && target\n ? { ...pending, target, records: new Map(pending.records).set(store, list) }\n : null\n }\n\n /** Opens the outermost batch from the current state. */\n function open(): void {\n // A batch still settling is closed first, so two batches are two steps.\n if (settling !== null) endBatch()\n // An undo or redo still in flight would be folded into this step; drop it.\n pending = null\n from = state()\n }\n\n function endBatch(): void {\n if (settling !== null) clearTimeout(settling)\n settling = null\n const start = from\n from = undefined\n if (!opts.enabled() || !start || !current) return\n const unchanged =\n sameList(current, start.annotations) &&\n [...start.records].every(([s, list]) =>\n sameRecords(list, tracked.get(s)?.previous ?? list)\n )\n if (!unchanged) push(start)\n }\n\n function batch(fn: () => void): void {\n if (!opts.enabled()) {\n fn()\n return\n }\n if (depth === 0) open()\n depth++\n try {\n const result: unknown = fn()\n if (\n result !== null &&\n typeof result === 'object' &&\n typeof (result as { then?: unknown }).then === 'function' &&\n !isProduction()\n ) {\n console.warn(\n '[inkbar] history.batch(fn): fn returned a promise. Changes after its first await are not part of the batch.'\n )\n }\n } finally {\n depth--\n if (depth === 0) settling = setTimeout(endBatch, 0)\n }\n }\n\n function clear(): void {\n past.set([])\n future.set([])\n pending = null\n from = undefined\n if (settling !== null) clearTimeout(settling)\n settling = null\n }\n\n function observe(next: readonly Annotation[] | undefined): void {\n const prev = current\n current = snapshot(next)\n if (!opts.enabled()) {\n // Steps taken while disabled are unknown to the stacks, which would undo to stale lists.\n if (past.get().length > 0 || future.get().length > 0 || pending) clear()\n return\n }\n // The first list only seeds; there is no step from or to an undefined list.\n if (next === undefined || prev === undefined) return\n // Inside a batch, or while it settles, changes only move `current`; `endBatch` pushes the step.\n if (from !== undefined) return\n // A new array with the same content is not a step, and leaves a pending step alone.\n if (sameList(next, prev)) return\n const step = pending\n pending = null\n if (step && sameList(next, step.target.annotations)) {\n move(step.kind, { annotations: prev, records: step.records })\n return\n }\n push({ annotations: prev, records: records() })\n }\n\n function propose(kind: Pending['kind'], target: Snapshot | undefined): void {\n if (!opts.enabled() || !target) return\n // The same undo or redo again before the host applies: the records were already put back,\n // so the state it leaves is the one the first call saw.\n const before =\n pending && pending.kind === kind && pending.target === target\n ? pending.records\n : records()\n replaying = true\n try {\n // Stores no longer tracked keep their records.\n for (const [s, list] of target.records) {\n const t = tracked.get(s)\n if (t && !sameRecords(t.previous, list)) s.replaceAll([...list], 'history')\n }\n } finally {\n replaying = false\n }\n // Nothing for the host to apply: the step moves now.\n if (current !== undefined && sameList(current, target.annotations)) {\n move(kind, { annotations: current, records: before })\n return\n }\n pending = { kind, target, records: before }\n opts.apply(clone(target.annotations) as Annotation[])\n }\n\n function track(store: RecordStore<RecordBase>): () => void {\n if (tracked.has(store)) return noop\n const unsubscribe = store.on('change', (change) => {\n const t = tracked.get(store)\n if (!t) return\n const list = store.list.get()\n // Our own replays (and any other history replace) never become steps.\n if (replaying || (change.kind === 'replace' && change.reason === 'history')) {\n t.previous = list\n return\n }\n if (!opts.enabled()) {\n t.previous = list\n // As in `observe`: steps taken while disabled would leave the stacks stale.\n if (past.get().length > 0 || future.get().length > 0 || pending) clear()\n return\n }\n if (change.kind === 'replace') {\n // A reset starts the store over, so no older step holding its records can be replayed.\n dropSteps(store, t.previous, list)\n t.previous = list\n from?.records.set(store, list)\n return\n }\n // On its own, a change opens a batch from the state before it, which waits out the task\n // for the host's list.\n if (from === undefined && depth === 0 && current !== undefined) {\n open()\n settling = setTimeout(endBatch, 0)\n }\n t.previous = list\n })\n tracked.set(store, { previous: store.list.get(), unsubscribe })\n // Tracked inside an open batch: the batch covers it from here.\n from?.records.set(store, store.list.get())\n return () => {\n if (tracked.get(store)?.unsubscribe !== unsubscribe) return\n unsubscribe()\n tracked.delete(store)\n from?.records.delete(store)\n }\n }\n\n return {\n canUndo: derived(past, (p) => p.length > 0),\n canRedo: derived(future, (f) => f.length > 0),\n undo: () => {\n if (from !== undefined && depth === 0) endBatch()\n propose('undo', past.get().at(-1))\n },\n redo: () => {\n if (from !== undefined && depth === 0) endBatch()\n propose('redo', future.get().at(-1))\n },\n clear,\n observe,\n batch,\n track,\n react(fn) {\n // Wrapped, so the same function added twice runs twice and each handle removes its own.\n const run = (edit: AnnotationEdit) => fn(edit)\n reactions.add(run)\n return () => {\n reactions.delete(run)\n }\n },\n attach(store) {\n if (attached.has(store)) return noop\n const off = store.on('edit', (edit) => {\n if (reactions.size === 0) return\n batch(() => {\n for (const fn of [...reactions]) fn(edit)\n })\n })\n attached.set(store, off)\n // An old handle never detaches a later attachment of the same store.\n return () => {\n if (attached.get(store) !== off) return\n attached.delete(store)\n off()\n }\n },\n }\n}\n\n/** The same records in the same order; records are frozen, so identity is enough. */\nfunction sameRecords(a: readonly RecordBase[], b: readonly RecordBase[]): boolean {\n return a === b || (a.length === b.length && a.every((x, i) => x === b[i]))\n}\n\nfunction snapshot(\n list: readonly Annotation[] | undefined\n): readonly Annotation[] | undefined {\n return list === undefined ? undefined : clone(list)\n}\n\n/** Annotations are JSON values; this also strips framework proxies and `undefined` members. */\nfunction clone<T>(value: T): T {\n return JSON.parse(JSON.stringify(value)) as T\n}\n\n/** Same annotations in the same order, compared by payload; `modifiedAt` may be re-stamped. */\nfunction sameList(a: readonly Annotation[], b: readonly Annotation[]): boolean {\n return a.length === b.length && a.every((x, i) => sameIgnoringModifiedAt(x, b[i]!))\n}\n\nfunction sameIgnoringModifiedAt(a: Annotation, b: Annotation): boolean {\n const { modifiedAt: _a, ...restA } = a\n const { modifiedAt: _b, ...restB } = b\n return deepEqual(restA, restB)\n}\n\n/** Structural equality over JSON values; keys whose value is `undefined` count as absent. */\nfunction deepEqual(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) return true\n if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null)\n return false\n if (Array.isArray(a) !== Array.isArray(b)) return false\n const ka = presentKeys(a)\n const kb = presentKeys(b)\n if (ka.length !== kb.length) return false\n return ka.every(\n (k) =>\n kb.includes(k) &&\n deepEqual((a as Record<string, unknown>)[k], (b as Record<string, unknown>)[k])\n )\n}\n\nfunction presentKeys(o: object): string[] {\n return Object.keys(o).filter((k) => (o as Record<string, unknown>)[k] !== undefined)\n}\n","/** Replaced at build time (tsdown) and in tests (vitest) with package.json's version. */\ndeclare const __INKBAR_VERSION__: string\n\n/** The @inkbar/core version, from its package.json. */\nexport const version: string = __INKBAR_VERSION__\n\nexport * from './model/errors'\nexport * from './model/events'\nexport * from './model/geometry'\nexport * from './model/readable'\nexport * from './model/records'\nexport { mergeLineRects } from './model/selection'\n\nexport { openDocument } from './model/document'\nexport type {\n DocumentInfo,\n DocumentStatus,\n InkDocument,\n InkStatus,\n OpenOptions,\n} from './model/document'\nexport type { DocumentSource } from './model/source'\nexport type { PageInfo, PageRotation } from './model/pages'\nexport type { TextContent, TextItem } from './model/text'\nexport type { SearchHit, SearchOptions, SearchResults } from './model/search'\nexport type { PdfAssets } from './pdfjs/types'\nexport * from './model/annotations/types'\nexport { FringeSchema, type Fringe } from './model/annotations/callout'\nexport * from './model/annotations/pdf-names'\nexport * from './model/annotations/defaults'\nexport * from './model/annotations/store'\nexport * from './model/annotations/history'\nexport { createToolStyle, STYLE_GROUPS } from './model/annotations/tool-style'\nexport type {\n CurrentStyle,\n ScopedToolStyle,\n StyleGroup,\n StyleKey,\n StyleProps,\n ToolStyle,\n ToolStyleDeps,\n} from './model/annotations/tool-style'\nexport {\n fromAnnotation,\n styleGroupOf,\n styleGroupOfType,\n styleGroupsOf,\n supportedProps,\n toFields,\n typesInGroup,\n} from './model/annotations/style-map'\nexport { createSnapshotHistory } from './model/annotations/snapshot-history'\nexport type {\n SnapshotHistory,\n SnapshotHistoryOptions,\n} from './model/annotations/snapshot-history'\nexport {\n isAbandonedNote,\n isReply,\n isThreadRoot,\n repliesTo,\n threadOf,\n threadRoot,\n withoutReplies,\n} from './model/annotations/threads'\nexport type { ThreadRoot } from './model/annotations/threads'\nexport * from './model/annotations/embedded'\nexport { parsePdfDate } from './model/pdf-date'\nexport { exportAnnotations, importAnnotations } from './model/annotations/json'\nexport { recogniseStroke, RECOGNISE_THRESHOLD } from './model/recognise'\nexport type { Recognised } from './model/recognise'\nexport type { ImportOptions, ImportResult } from './model/annotations/json'\nexport {\n createImageTemplate,\n createInkTemplate,\n createLocalSignatureStore,\n createMemorySignatureStore,\n createSignatureLibrary,\n DEFAULT_SIGNATURE_WIDTH,\n normaliseInk,\n placeSignature,\n SIGNATURE_INK_WIDTH,\n} from './model/signatures'\nexport type {\n SignatureLibrary,\n SignatureOptions,\n SignatureStore,\n SignatureTemplate,\n} from './model/signatures'\n"],"mappings":";;AA2EA,MAAM,aAAa,CAAC;AAEpB,SAAgB,sBAAsB,MAA+C;CACnF,MAAM,QAAQ,KAAK,IAAI,GAAG,KAAK,SAAS,GAAG;CAC3C,MAAM,OAAO,SAAqB,CAAC,CAAC;CACpC,MAAM,SAAS,SAAqB,CAAC,CAAC;CACtC,IAAI,UAA0B;;CAE9B,IAAI;;CAEJ,IAAI,QAAQ;CACZ,IAAI,WAAiD;;CAErD,IAAI;;CAEJ,MAAM,0BAAU,IAAI,IAGlB;CACF,MAAM,4BAAY,IAAI,IAAoC;;CAE1D,MAAM,2BAAW,IAAI,IAAiC;;CAEtD,IAAI,YAAY;CAEhB,SAAS,UAAmB;EAC1B,OAAO,IAAI,IAAI,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KAAA,IAAY,MAAM,IAAI;AACpD;;AAGA,SAAS,MAAS,OAAa;CAC7B,OAAO,KAAK,MAAM,KAAK,UAAU,KAAK,CAAC;AACzC;;AAGA,SAAS,SAAS,GAA0B,GAAmC;CAC7E,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,GAAG,MAAM,uBAAuB,GAAG,EAAE,EAAG,CAAC;AACpF;AAEA,SAAS,uBAAuB,GAAe,GAAwB;CACrE,MAAM,EAAE,YAAY,IAAI,GAAG,UAAU;CACrC,MAAM,EAAE,YAAY,IAAI,GAAG,UAAU;CACrC,OAAO,UAAU,OAAO,KAAK;AAC/B;;AAGA,SAAS,UAAU,GAAY,GAAqB;CAClD,IAAI,OAAO,GAAG,GAAG,CAAC,GAAG,OAAO;CAC5B,IAAI,OAAO,MAAM,YAAY,OAAO,MAAM,YAAY,MAAM,QAAQ,MAAM,MACxE,OAAO;CACT,IAAI,MAAM,QAAQ,CAAC,MAAM,MAAM,QAAQ,CAAC,GAAG,OAAO;CAClD,MAAM,KAAK,YAAY,CAAC;CACxB,MAAM,KAAK,YAAY,CAAC;CACxB,IAAI,GAAG,WAAW,GAAG,QAAQ,OAAO;CACpC,OAAO,GAAG,OACP,MACC,GAAG,SAAS,CAAC,KACb,UAAW,EAA8B,IAAK,EAA8B,EAAE,CAClF;AACF;AAEA,SAAS,YAAY,GAAqB;CACxC,OAAO,OAAO,KAAK,CAAC,CAAC,CAAC,QAAQ,MAAO,EAA8B,OAAO,KAAA,CAAS;AACrF;;;;ACtZA,MAAa,UAAA"}
@@ -2082,15 +2082,6 @@ declare class InkError extends Error {
2082
2082
  }
2083
2083
  declare function isInkError(value: unknown): value is InkError;
2084
2084
  //#endregion
2085
- //#region src/model/source.d.ts
2086
- type DocumentSource = ArrayBuffer | Uint8Array | Blob | string | {
2087
- url: string;
2088
- key: string;
2089
- } | {
2090
- data: ArrayBuffer | Uint8Array;
2091
- key: string;
2092
- };
2093
- //#endregion
2094
2085
  //#region src/model/text.d.ts
2095
2086
  interface TextItem {
2096
2087
  str: string;
@@ -2102,12 +2093,69 @@ interface TextItem {
2102
2093
  quad: Quad;
2103
2094
  /** Axis-aligned bounds of `quad`. */
2104
2095
  rect: Rect$1;
2096
+ /**
2097
+ * How far along the run each character boundary lies, as a fraction of its width: `str.length + 1`
2098
+ * entries, from 0 to 1 or a little past it. Taken from where the page draws each glyph when the
2099
+ * glyphs can be matched to the run, else measured in the run's fallback font. Absent when neither
2100
+ * works, in which case every character takes an equal share.
2101
+ */
2102
+ advances?: readonly number[];
2103
+ /**
2104
+ * Where each character's glyph ends, as a fraction of the run's width: `str.length` entries, set
2105
+ * with `advances` when they come from the page's glyphs. Kerning can pull the next character
2106
+ * back over the end of a glyph, so a glyph may end past the next boundary.
2107
+ */
2108
+ glyphEnds?: readonly number[];
2105
2109
  }
2106
2110
  interface TextContent {
2107
2111
  page: number;
2108
2112
  items: TextItem[];
2109
2113
  }
2110
2114
  //#endregion
2115
+ //#region src/model/search.d.ts
2116
+ interface SearchOptions {
2117
+ /** Defaults to false. Ignored for a `RegExp`, whose own `i` flag rules. */
2118
+ matchCase?: boolean;
2119
+ /** Requires a hit to have no letter, digit or underscore next to it. */
2120
+ wholeWord?: boolean;
2121
+ /** Page indices to search, in the order given. Defaults to every page in order. */
2122
+ pages?: readonly number[];
2123
+ signal?: AbortSignal;
2124
+ }
2125
+ interface SearchHit {
2126
+ page: number;
2127
+ /** Offsets into `pageText(page)`. */
2128
+ start: number;
2129
+ end: number;
2130
+ /** The page text the hit covers. */
2131
+ text: string;
2132
+ /** One quad per run of text the hit touches. */
2133
+ quads: Quad[];
2134
+ rect: Rect$1;
2135
+ /**
2136
+ * True when every quad is cut where the page draws its glyphs. False when some text could not
2137
+ * be matched to the page's glyphs (right-to-left or vertical text, or an unusual file) and its
2138
+ * quad is cut at estimated widths, which can fall short of the glyphs; pad those before
2139
+ * covering text with them.
2140
+ */
2141
+ exact: boolean;
2142
+ /** Up to `CONTEXT_CHARS` of page text either side of the hit, whitespace collapsed. */
2143
+ before: string;
2144
+ after: string;
2145
+ }
2146
+ interface SearchResults extends AsyncIterable<SearchHit> {
2147
+ all(): Promise<SearchHit[]>;
2148
+ }
2149
+ //#endregion
2150
+ //#region src/model/source.d.ts
2151
+ type DocumentSource = ArrayBuffer | Uint8Array | Blob | string | {
2152
+ url: string;
2153
+ key: string;
2154
+ } | {
2155
+ data: ArrayBuffer | Uint8Array;
2156
+ key: string;
2157
+ };
2158
+ //#endregion
2111
2159
  //#region src/model/document.d.ts
2112
2160
  type DocumentStatus = {
2113
2161
  state: 'loading';
@@ -2157,8 +2205,13 @@ interface InkDocument {
2157
2205
  readonly pages: readonly PageInfo[];
2158
2206
  readonly info: DocumentInfo;
2159
2207
  text(page: number): Promise<TextContent>;
2160
- /** The page's text items joined with a single space. */
2208
+ /** The page's text as search sees it: items joined the way the page reads. */
2161
2209
  pageText(page: number): Promise<string>;
2210
+ /**
2211
+ * Finds `query` in the document's text, a page at a time. A string matches ignoring case,
2212
+ * accents and quote style; a `RegExp` runs on the same normalised text.
2213
+ */
2214
+ search(query: string | RegExp, opts?: SearchOptions): SearchResults;
2162
2215
  /**
2163
2216
  * Annotations embedded in the file arrive here as `source: 'pdf'`, `locked: true` before
2164
2217
  * `ready` resolves. They stay in `list` in both modes and cannot be removed; in controlled
@@ -2362,5 +2415,5 @@ interface SignatureLibrary {
2362
2415
  }
2363
2416
  declare function createSignatureLibrary(store: SignatureStore): SignatureLibrary;
2364
2417
  //#endregion
2365
- export { createRecordStore as $, QuadSchema as $t, TextItem as A, rectContainsPoint as An, GLOSS_FORMAT$1 as At, PluginHistory as B, LineSchema as Bt, DocumentInfo as C, approxEqual as Cn, ExportedAnnotation as Ct, OpenOptions as D, quadFromRect as Dn, FreeTextSchema as Dt, InkStatus as E, pointsFromFlat as En, FreeTextAnnotation as Et, ImportOptions as F, translateQuad as Fn, InkAnnotation as Ft, StoreMode as G, NoteAnnotation as Gt, AnnotationChange as H, LoupeSchema as Ht, ImportResult as I, translateRect as In, InkSchema as It, deriveRect as J, PointSchema as Jt, StoreOptions as K, NoteIconSchema as Kt, exportAnnotations as L, unionRects as Ln, LineAnnotation as Lt, InkError as M, rectFromQuad as Mn, GLOSS_SCHEMA_ID as Mt, InkErrorCode as N, rectFromQuads as Nn, GLOSS_VERSION$1 as Nt, openDocument as O, quadsFromFlat as On, FreeTextStyle$1 as Ot, isInkError as P, rectsIntersect as Pn, IMAGE_DATA_URL as Pt, RecordStoreOptions as Q, PolylineSchema as Qt, importAnnotations as R, LineEnding$1 as Rt, createToolStyle as S, applyMatrix as Sn, CircleSchema as St, InkDocument as T, multiplyMatrix as Tn, ForeignAnnotation as Tt, AnnotationEdit as U, MaskAnnotation as Ut, createHistory as V, LoupeAnnotation as Vt, AnnotationStore as W, MaskSchema as Wt, RecordChange as X, PolySchema as Xt, RecordBase as Y, PolyAnnotation as Yt, RecordStore as Z, PolygonSchema as Zt, StyleGroup as _, PdfAssets as _n, AnnotationInput as _t, SignatureStore as a, SquareSchema as an, importedId as at, ToolStyle as b, Quad as bn, AnnotationSchema as bt, createInkTemplate as c, TextMarkupAnnotation as cn, Fringe$1 as ct, createSignatureLibrary as d, Writable as dn, cssVariableDefaults as dt, RectSchema as en, EmbeddedFieldPatch as et, normaliseInk as f, derived as fn, normalizeColor as ft, ScopedToolStyle as g, PageRotation as gn, AnnotationDocumentSchema as gt, STYLE_GROUPS as h, PageInfo as hn, AnnotationDocument as ht, SignatureOptions as i, ShapeSchema as in, importEmbeddedPage as it, DocumentSource as j, rectFromPoints as jn, GLOSS_MEDIA_TYPE as jt, TextContent as k, quadsFromRect as kn, FreeTextStyleSchema as kt, createLocalSignatureStore as l, TextMarkupSchema as ln, FringeSchema as lt, CurrentStyle as m, writable as mn, Annotation$1 as mt, SIGNATURE_INK_WIDTH as n, RedactSchema as nn, EmbeddedTarget as nt, SignatureTemplate as o, StampAnnotation as on, pdfColorToHex as ot, placeSignature as p, readonly as pn, staticDefaults as pt, createAnnotationStore as q, NoteSchema as qt, SignatureLibrary as r, ShapeAnnotation as rn, SUPPORTED_SUBTYPES as rt, createImageTemplate as s, StampSchema as sn, summarise as st, DEFAULT_SIGNATURE_WIDTH as t, RedactAnnotation as tn, EmbeddedSummary as tt, createMemorySignatureStore as u, Readable as un, AnnotationDefaults as ut, StyleKey as v, Matrix as vn, AnnotationOfType as vt, DocumentStatus as w, invertMatrix as wn, ExportedAnnotationSchema as wt, ToolStyleDeps as x, Rect$1 as xn, AnnotationType as xt, StyleProps as y, Point$1 as yn, AnnotationPatch as yt, History as z, LineEndingSchema as zt };
2366
- //# sourceMappingURL=signatures-By4B40DP.d.mts.map
2418
+ export { RecordChange as $, PolySchema as $t, SearchHit as A, quadFromRect as An, FreeTextSchema as At, exportAnnotations as B, unionRects as Bn, LineAnnotation as Bt, DocumentInfo as C, Quad as Cn, AnnotationSchema as Ct, OpenOptions as D, invertMatrix as Dn, ExportedAnnotationSchema as Dt, InkStatus as E, approxEqual as En, ExportedAnnotation as Et, InkError as F, rectFromQuad as Fn, GLOSS_SCHEMA_ID as Ft, AnnotationChange as G, LoupeSchema as Gt, History as H, LineEndingSchema as Ht, InkErrorCode as I, rectFromQuads as In, GLOSS_VERSION$1 as It, StoreMode as J, NoteAnnotation as Jt, AnnotationEdit as K, MaskAnnotation as Kt, isInkError as L, rectsIntersect as Ln, IMAGE_DATA_URL as Lt, SearchResults as M, quadsFromRect as Mn, FreeTextStyleSchema as Mt, TextContent as N, rectContainsPoint as Nn, GLOSS_FORMAT$1 as Nt, openDocument as O, multiplyMatrix as On, ForeignAnnotation as Ot, TextItem as P, rectFromPoints as Pn, GLOSS_MEDIA_TYPE as Pt, RecordBase as Q, PolyAnnotation as Qt, ImportOptions as R, translateQuad as Rn, InkAnnotation as Rt, createToolStyle as S, Point$1 as Sn, AnnotationPatch as St, InkDocument as T, applyMatrix as Tn, CircleSchema as Tt, PluginHistory as U, LineSchema as Ut, importAnnotations as V, LineEnding$1 as Vt, createHistory as W, LoupeAnnotation as Wt, createAnnotationStore as X, NoteSchema as Xt, StoreOptions as Y, NoteIconSchema as Yt, deriveRect as Z, PointSchema as Zt, StyleGroup as _, writable as _n, Annotation$1 as _t, SignatureStore as a, RedactSchema as an, EmbeddedTarget as at, ToolStyle as b, PdfAssets as bn, AnnotationInput as bt, createInkTemplate as c, SquareSchema as cn, importedId as ct, createSignatureLibrary as d, TextMarkupAnnotation as dn, Fringe$1 as dt, PolygonSchema as en, RecordStore as et, normaliseInk as f, TextMarkupSchema as fn, FringeSchema as ft, ScopedToolStyle as g, readonly as gn, staticDefaults as gt, STYLE_GROUPS as h, derived as hn, normalizeColor as ht, SignatureOptions as i, RedactAnnotation as in, EmbeddedSummary as it, SearchOptions as j, quadsFromFlat as jn, FreeTextStyle$1 as jt, DocumentSource as k, pointsFromFlat as kn, FreeTextAnnotation as kt, createLocalSignatureStore as l, StampAnnotation as ln, pdfColorToHex as lt, CurrentStyle as m, Writable as mn, cssVariableDefaults as mt, SIGNATURE_INK_WIDTH as n, QuadSchema as nn, createRecordStore as nt, SignatureTemplate as o, ShapeAnnotation as on, SUPPORTED_SUBTYPES as ot, placeSignature as p, Readable as pn, AnnotationDefaults as pt, AnnotationStore as q, MaskSchema as qt, SignatureLibrary as r, RectSchema as rn, EmbeddedFieldPatch as rt, createImageTemplate as s, ShapeSchema as sn, importEmbeddedPage as st, DEFAULT_SIGNATURE_WIDTH as t, PolylineSchema as tn, RecordStoreOptions as tt, createMemorySignatureStore as u, StampSchema as un, summarise as ut, StyleKey as v, PageInfo as vn, AnnotationDocument as vt, DocumentStatus as w, Rect$1 as wn, AnnotationType as wt, ToolStyleDeps as x, Matrix as xn, AnnotationOfType as xt, StyleProps as y, PageRotation as yn, AnnotationDocumentSchema as yt, ImportResult as z, translateRect as zn, InkSchema as zt };
2419
+ //# sourceMappingURL=signatures-CalOktkf.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signatures-CalOktkf.d.mts","names":["Point","Rect","Rect","Annotation","FreeTextStyle","LineEnding","GlossAnnotation","Fringe","Point","Fringe","Annotation","Annotation","Rect","Rect","Rect","LineEnding","Point"],"sources":["../src/model/geometry.ts","../src/pdfjs/types.ts","../src/model/pages.ts","../src/model/readable.ts","../src/model/annotations/types.ts","../src/model/annotations/defaults.ts","../src/model/annotations/callout.ts","../src/model/annotations/embedded.ts","../src/model/records.ts","../src/model/annotations/store.ts","../src/model/annotations/history.ts","../src/model/annotations/json.ts","../src/model/errors.ts","../src/model/text.ts","../src/model/search.ts","../src/model/source.ts","../src/model/document.ts","../src/model/annotations/tool-style.ts","../src/model/signatures.ts"],"mappings":";;;;;;;;UAIiBA;EACf;EACA;;;UAIeC;EACf;EACA;EACA;EACA;;;UAIe;EACf,IAAID;EACJ,IAAIA;EACJ,IAAIA;EACJ,IAAIA;;;KAIM;iBAEI,YAAY,WAAW,WAAW;iBAIlC,eAAe,GAAGA,SAAO,GAAGA,UAAQC;iBAMpC,aAAa,GAAG,OAAOA;iBAQvB,aAAa,GAAGA,SAAO;;iBAYvB,cAAc,GAAGA,SAAO;;iBAKxB,cAAc,gBAAgB,SAASA;iBAKvC,WAAW,gBAAgBA,WAASA;iBAepC,eAAe,GAAGA,QAAM,GAAGA;iBAS3B,kBAAkB,GAAGA,QAAM,GAAGD;iBAI9B,cAAc,GAAGC,QAAM,YAAY,aAAaA;iBAIhD,cAAc,GAAG,MAAM,YAAY,aAAa;iBAKhD,YAAY,GAAG,QAAQ,GAAGD,UAAQA;iBAIlC,aAAa,GAAG,SAAS;;iBAczB,eAAe,GAAG,QAAQ,GAAG,SAAS;iBAWtC,eAAe,MAAM,oBAAoBA;;iBAOzC,cAAc,MAAM,oBAAoB;;;KC3I5C,qBAAqB;KAErB,gBAAgB,MAAM;KACtB,YAAY,MAAM;;UAOb;EACf;EACA;EACA;EACA;EACA,aAAa;EACb,QAAQ;EACR,gBAAgB;EAChB;EACA;IAAgB;IAAa;;EAC7B;IAAa;IAAa;;EAC1B;EACA;EACA;EACA;EACA;;E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