@semiont/core 0.4.20 → 0.4.22

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.js CHANGED
@@ -117,23 +117,211 @@ var PERSISTED_EVENT_TYPES = [
117
117
  ];
118
118
 
119
119
  // src/bus-protocol.ts
120
- var STREAM_COMMAND_RESULT_TYPES = [
121
- // Match flow search results for binding candidates
122
- "match:search-results",
123
- "match:search-failed",
124
- // Gather flowassembled context for reference resolution
125
- "gather:complete",
126
- "gather:failed",
127
- "gather:annotation-progress",
128
- // Mark flow — AI-assisted annotation progress
129
- "mark:progress",
130
- "mark:assist-finished",
131
- "mark:assist-failed",
132
- // Yield flow — resource generation progress
133
- "yield:progress",
134
- "yield:finished",
135
- "yield:failed"
120
+ var RESOURCE_BROADCAST_TYPES = [
121
+ // Post-unification: job:complete / job:fail carry the "job ended on
122
+ // this resource" signal that yield:finished / yield:failed used to.
123
+ // Scope them by resource so every viewer of the affected resource
124
+ // not just the initiator can react (toast, refresh, etc.).
125
+ "job:complete",
126
+ "job:fail"
136
127
  ];
128
+ var CHANNEL_SCHEMAS = {
129
+ // ── YIELD FLOW ──────────────────────────────────────────────────
130
+ "yield:created": null,
131
+ // StoredEvent
132
+ "yield:cloned": null,
133
+ "yield:updated": null,
134
+ "yield:moved": null,
135
+ "yield:representation-added": null,
136
+ "yield:representation-removed": null,
137
+ "yield:request": "YieldRequestCommand",
138
+ "yield:create": "YieldCreateCommand",
139
+ "yield:update": "YieldUpdateCommand",
140
+ "yield:mv": "YieldMvCommand",
141
+ "yield:clone": null,
142
+ // void
143
+ "yield:clone-token-requested": "YieldCloneTokenRequest",
144
+ "yield:clone-resource-requested": "YieldCloneResourceRequest",
145
+ "yield:clone-create": "YieldCloneCreateCommand",
146
+ "yield:create-ok": "YieldCreateOk",
147
+ "yield:create-failed": "CommandError",
148
+ "yield:update-ok": "YieldUpdateOk",
149
+ "yield:update-failed": null,
150
+ // YieldUpdateOk & CommandError
151
+ "yield:move-ok": "YieldMoveOk",
152
+ "yield:move-failed": null,
153
+ // { fromUri } & CommandError
154
+ "yield:clone-token-generated": null,
155
+ // { correlationId; response: CloneResourceWithTokenResponse }
156
+ "yield:clone-token-failed": null,
157
+ // { correlationId } & CommandError
158
+ "yield:clone-resource-result": null,
159
+ // { correlationId; response: GetResourceByTokenResponse }
160
+ "yield:clone-resource-failed": null,
161
+ // { correlationId } & CommandError
162
+ "yield:clone-created": "YieldCloneCreated",
163
+ "yield:clone-create-failed": null,
164
+ // { correlationId } & CommandError
165
+ // ── MARK FLOW ───────────────────────────────────────────────────
166
+ "mark:added": null,
167
+ // StoredEvent
168
+ "mark:removed": null,
169
+ "mark:body-updated": null,
170
+ "mark:entity-tag-added": null,
171
+ "mark:entity-tag-removed": null,
172
+ "mark:entity-type-added": null,
173
+ "mark:archived": null,
174
+ "mark:unarchived": null,
175
+ "mark:create-request": "MarkCreateRequest",
176
+ "mark:create": "MarkCreateCommand",
177
+ "mark:delete": "MarkDeleteCommand",
178
+ "mark:update-body": "MarkUpdateBodyCommand",
179
+ "mark:archive": "MarkArchiveCommand",
180
+ "mark:unarchive": "MarkUnarchiveCommand",
181
+ "mark:update-entity-types": "MarkUpdateEntityTypesCommand",
182
+ "mark:add-entity-type": "MarkAddEntityTypeCommand",
183
+ "mark:create-ok": "MarkCreateOk",
184
+ "mark:create-failed": "CommandError",
185
+ "mark:delete-ok": "MarkDeleteOk",
186
+ "mark:delete-failed": "CommandError",
187
+ "mark:body-update-failed": "CommandError",
188
+ "mark:entity-type-add-failed": "CommandError",
189
+ "mark:select-comment": "SelectionData",
190
+ "mark:select-tag": "SelectionData",
191
+ "mark:select-assessment": "SelectionData",
192
+ "mark:select-reference": "SelectionData",
193
+ "mark:requested": "MarkRequestedEvent",
194
+ "mark:cancel-pending": null,
195
+ // void
196
+ "mark:submit": "MarkSubmitEvent",
197
+ "mark:assist-request": "MarkAssistRequestEvent",
198
+ "mark:assist-cancelled": null,
199
+ // void
200
+ "mark:progress-dismiss": null,
201
+ // void
202
+ "mark:mode-toggled": null,
203
+ // void
204
+ "mark:selection-changed": "MarkSelectionChangedEvent",
205
+ "mark:click-changed": "MarkClickChangedEvent",
206
+ "mark:shape-changed": "MarkShapeChangedEvent",
207
+ // ── BIND FLOW ───────────────────────────────────────────────────
208
+ "bind:initiate": "BindInitiateCommand",
209
+ "bind:update-body": "BindUpdateBodyCommand",
210
+ "bind:body-updated": "BindBodyUpdated",
211
+ "bind:body-update-failed": "CommandError",
212
+ // ── MATCH FLOW ──────────────────────────────────────────────────
213
+ "match:search-requested": "MatchSearchRequest",
214
+ "match:search-results": "MatchSearchResult",
215
+ "match:search-failed": "MatchSearchFailed",
216
+ // ── GATHER FLOW ─────────────────────────────────────────────────
217
+ "gather:requested": "GatherAnnotationRequest",
218
+ "gather:complete": "GatherAnnotationComplete",
219
+ "gather:failed": null,
220
+ // { correlationId; annotationId } & CommandError
221
+ "gather:resource-requested": "GatherResourceRequest",
222
+ "gather:resource-complete": "GatherResourceComplete",
223
+ "gather:resource-failed": null,
224
+ // { correlationId; resourceId } & CommandError
225
+ "gather:summary-requested": "GatherSummaryRequest",
226
+ "gather:summary-result": null,
227
+ // { correlationId; response: Record<string, unknown> }
228
+ "gather:summary-failed": null,
229
+ // { correlationId } & CommandError
230
+ "gather:annotation-progress": "GatherProgress",
231
+ "gather:annotation-finished": "GatherAnnotationFinished",
232
+ "gather:progress": "GatherProgress",
233
+ "gather:finished": "GatherFinished",
234
+ // ── BROWSE FLOW ─────────────────────────────────────────────────
235
+ "browse:resource-requested": "BrowseResourceRequest",
236
+ "browse:resource-result": "BrowseResourceResult",
237
+ "browse:resource-failed": null,
238
+ // { correlationId } & CommandError
239
+ "browse:resources-requested": "BrowseResourcesRequest",
240
+ "browse:resources-result": "BrowseResourcesResult",
241
+ "browse:resources-failed": null,
242
+ "browse:annotations-requested": "BrowseAnnotationsRequest",
243
+ "browse:annotations-result": "BrowseAnnotationsResult",
244
+ "browse:annotations-failed": null,
245
+ "browse:annotation-requested": "BrowseAnnotationRequest",
246
+ "browse:annotation-result": "BrowseAnnotationResult",
247
+ "browse:annotation-failed": null,
248
+ "browse:events-requested": "BrowseEventsRequest",
249
+ "browse:events-result": "BrowseEventsResult",
250
+ "browse:events-failed": null,
251
+ "browse:annotation-history-requested": "BrowseAnnotationHistoryRequest",
252
+ "browse:annotation-history-result": "BrowseAnnotationHistoryResult",
253
+ "browse:annotation-history-failed": null,
254
+ "browse:annotation-context-requested": "BrowseAnnotationContextRequest",
255
+ "browse:annotation-context-result": null,
256
+ // { correlationId; response: Record<string, unknown> }
257
+ "browse:annotation-context-failed": null,
258
+ "browse:referenced-by-requested": "BrowseReferencedByRequest",
259
+ "browse:referenced-by-result": "BrowseReferencedByResult",
260
+ "browse:referenced-by-failed": null,
261
+ "browse:entity-types-requested": "BrowseEntityTypesRequest",
262
+ "browse:entity-types-result": "BrowseEntityTypesResult",
263
+ "browse:entity-types-failed": null,
264
+ "browse:directory-requested": "BrowseDirectoryRequest",
265
+ "browse:directory-result": "BrowseDirectoryResult",
266
+ "browse:directory-failed": null,
267
+ // { correlationId; path } & CommandError
268
+ "browse:click": "BrowseClickEvent",
269
+ "browse:reference-navigate": "BrowseReferenceNavigateEvent",
270
+ "browse:entity-type-clicked": "BrowseEntityTypeClickedEvent",
271
+ // ── SHELL (app-scoped UI events, fire on SemiontBrowser bus) ────
272
+ "panel:toggle": "BrowsePanelToggleEvent",
273
+ "panel:open": "BrowsePanelOpenEvent",
274
+ "panel:close": null,
275
+ // void
276
+ "shell:sidebar-toggle": null,
277
+ // void
278
+ "tabs:close": "BrowseResourceCloseEvent",
279
+ "tabs:reorder": "BrowseResourceReorderEvent",
280
+ "nav:link-clicked": "BrowseLinkClickedEvent",
281
+ "nav:push": "BrowseRouterPushEvent",
282
+ "nav:external": null,
283
+ // includes runtime `cancelFallback: () => void`
284
+ // ── BECKON FLOW ─────────────────────────────────────────────────
285
+ "beckon:hover": "BeckonHoverEvent",
286
+ "beckon:focus": "BeckonFocusEvent",
287
+ "beckon:sparkle": "BeckonSparkleEvent",
288
+ // ── JOB FLOW ────────────────────────────────────────────────────
289
+ "job:started": null,
290
+ // StoredEvent
291
+ "job:progress": null,
292
+ "job:completed": null,
293
+ "job:failed": null,
294
+ "job:start": "JobStartCommand",
295
+ "job:report-progress": "JobReportProgressCommand",
296
+ "job:complete": "JobCompleteCommand",
297
+ "job:fail": "JobFailCommand",
298
+ "job:queued": "JobQueuedEvent",
299
+ "job:cancel-requested": "JobCancelRequest",
300
+ "job:status-requested": "JobStatusRequest",
301
+ "job:create": "JobCreateCommand",
302
+ "job:claim": "JobClaimCommand",
303
+ "job:status-result": "JobStatusResult",
304
+ "job:status-failed": null,
305
+ // { correlationId } & CommandError
306
+ "job:created": "JobCreatedResult",
307
+ "job:create-failed": null,
308
+ "job:claimed": null,
309
+ // { correlationId; response: Record<string, unknown> }
310
+ "job:claim-failed": null,
311
+ // ── SETTINGS (frontend-only) ────────────────────────────────────
312
+ "settings:theme-changed": "SettingsThemeChangedEvent",
313
+ "settings:line-numbers-toggled": null,
314
+ // void
315
+ "settings:locale-changed": "SettingsLocaleChangedEvent",
316
+ "settings:hover-delay-changed": "SettingsHoverDelayChangedEvent",
317
+ // ── SSE infrastructure ──────────────────────────────────────────
318
+ "stream-connected": null,
319
+ // Record<string, never>
320
+ "replay-window-exceeded": null,
321
+ // inline payload
322
+ "bus:resume-gap": null
323
+ // inline payload
324
+ };
137
325
 
138
326
  // src/event-utils.ts
139
327
  function getAnnotationUriFromEvent(event) {
@@ -404,6 +592,32 @@ function errField(error) {
404
592
  return error;
405
593
  }
406
594
 
595
+ // src/bus-log.ts
596
+ var NODE_BUS_LOG = typeof process !== "undefined" && !!process.env?.SEMIONT_BUS_LOG;
597
+ function busLogEnabled() {
598
+ const g = globalThis;
599
+ if (g.__SEMIONT_BUS_LOG__) return true;
600
+ return NODE_BUS_LOG;
601
+ }
602
+ var traceIdProvider;
603
+ function setBusLogTraceIdProvider(fn) {
604
+ traceIdProvider = fn;
605
+ }
606
+ function busLog(op, channel, payload, scope) {
607
+ if (!busLogEnabled()) return;
608
+ const cidRaw = payload?.correlationId;
609
+ const cid = typeof cidRaw === "string" ? cidRaw.slice(0, 8) : void 0;
610
+ let traceId;
611
+ if (traceIdProvider) {
612
+ try {
613
+ traceId = traceIdProvider();
614
+ } catch {
615
+ }
616
+ }
617
+ const tag = `[bus ${op}] ${channel}` + (scope ? ` scope=${scope}` : "") + (cid ? ` cid=${cid}` : "") + (traceId ? ` trace=${traceId.slice(0, 8)}` : "");
618
+ console.debug(tag, payload);
619
+ }
620
+
407
621
  // src/annotation-utils.ts
408
622
  function findBodyItem(body, identity) {
409
623
  if (!Array.isArray(body)) {
@@ -480,7 +694,7 @@ function validateSvgMarkup(svg) {
480
694
  return null;
481
695
  }
482
696
  function assembleAnnotation(request, creator) {
483
- const newAnnotationId = generateUuid();
697
+ const newAnnotationId = annotationId(generateUuid());
484
698
  const posSelector = getTextPositionSelector(request.target.selector);
485
699
  const svgSelector = getSvgSelector(request.target.selector);
486
700
  const fragmentSelector = getFragmentSelector(request.target.selector);
@@ -540,6 +754,734 @@ function applyBodyOperations(body, operations) {
540
754
  return bodyArray;
541
755
  }
542
756
 
757
+ // src/web-annotation-utils.ts
758
+ function getBodySource(body) {
759
+ if (Array.isArray(body)) {
760
+ for (const item of body) {
761
+ if (typeof item === "object" && item !== null && "type" in item && "source" in item) {
762
+ const itemType = item.type;
763
+ const itemSource = item.source;
764
+ if (itemType === "SpecificResource" && typeof itemSource === "string") {
765
+ return itemSource;
766
+ }
767
+ }
768
+ }
769
+ return null;
770
+ }
771
+ if (typeof body === "object" && body !== null && "type" in body && "source" in body) {
772
+ const bodyType = body.type;
773
+ const bodySource = body.source;
774
+ if (bodyType === "SpecificResource" && typeof bodySource === "string") {
775
+ return bodySource;
776
+ }
777
+ }
778
+ return null;
779
+ }
780
+ function getBodyType(body) {
781
+ if (Array.isArray(body)) {
782
+ if (body.length === 0) {
783
+ return null;
784
+ }
785
+ if (typeof body[0] === "object" && body[0] !== null && "type" in body[0]) {
786
+ const firstType = body[0].type;
787
+ if (firstType === "TextualBody" || firstType === "SpecificResource") {
788
+ return firstType;
789
+ }
790
+ }
791
+ return null;
792
+ }
793
+ if (typeof body === "object" && body !== null && "type" in body) {
794
+ const bodyType = body.type;
795
+ if (bodyType === "TextualBody" || bodyType === "SpecificResource") {
796
+ return bodyType;
797
+ }
798
+ }
799
+ return null;
800
+ }
801
+ function isBodyResolved(body) {
802
+ return getBodySource(body) !== null;
803
+ }
804
+ function getTargetSource(target) {
805
+ if (typeof target === "string") {
806
+ return target;
807
+ }
808
+ return target.source;
809
+ }
810
+ function getTargetSelector(target) {
811
+ if (typeof target === "string") {
812
+ return void 0;
813
+ }
814
+ return target.selector;
815
+ }
816
+ function hasTargetSelector(target) {
817
+ return typeof target !== "string" && target.selector !== void 0;
818
+ }
819
+ function isHighlight(annotation) {
820
+ return annotation.motivation === "highlighting";
821
+ }
822
+ function isReference(annotation) {
823
+ return annotation.motivation === "linking";
824
+ }
825
+ function isAssessment(annotation) {
826
+ return annotation.motivation === "assessing";
827
+ }
828
+ function isComment(annotation) {
829
+ return annotation.motivation === "commenting";
830
+ }
831
+ function isTag(annotation) {
832
+ return annotation.motivation === "tagging";
833
+ }
834
+ function getCommentText(annotation) {
835
+ if (!isComment(annotation)) return void 0;
836
+ const body = Array.isArray(annotation.body) ? annotation.body[0] : annotation.body;
837
+ if (body && "value" in body) {
838
+ return body.value;
839
+ }
840
+ return void 0;
841
+ }
842
+ function isStubReference(annotation) {
843
+ return isReference(annotation) && !isBodyResolved(annotation.body);
844
+ }
845
+ function isResolvedReference(annotation) {
846
+ return isReference(annotation) && isBodyResolved(annotation.body);
847
+ }
848
+ function getExactText(selector) {
849
+ if (!selector) {
850
+ return "";
851
+ }
852
+ const selectors = Array.isArray(selector) ? selector : [selector];
853
+ const quoteSelector = selectors.find((s) => s.type === "TextQuoteSelector");
854
+ if (quoteSelector) {
855
+ return quoteSelector.exact;
856
+ }
857
+ return "";
858
+ }
859
+ function getAnnotationExactText(annotation) {
860
+ const selector = getTargetSelector(annotation.target);
861
+ return getExactText(selector);
862
+ }
863
+ function getPrimarySelector(selector) {
864
+ if (Array.isArray(selector)) {
865
+ if (selector.length === 0) {
866
+ throw new Error("Empty selector array");
867
+ }
868
+ const first = selector[0];
869
+ if (!first) {
870
+ throw new Error("Invalid selector array");
871
+ }
872
+ return first;
873
+ }
874
+ return selector;
875
+ }
876
+ function getTextQuoteSelector(selector) {
877
+ const selectors = Array.isArray(selector) ? selector : [selector];
878
+ const found = selectors.find((s) => s.type === "TextQuoteSelector");
879
+ if (!found) return null;
880
+ return found.type === "TextQuoteSelector" ? found : null;
881
+ }
882
+ function extractBoundingBox(svg) {
883
+ const viewBoxMatch = svg.match(/<svg[^>]*viewBox="([^"]+)"/);
884
+ if (viewBoxMatch) {
885
+ const values = viewBoxMatch[1].split(/\s+/).map(parseFloat);
886
+ if (values.length === 4 && values.every((v) => !isNaN(v))) {
887
+ return {
888
+ x: values[0],
889
+ y: values[1],
890
+ width: values[2],
891
+ height: values[3]
892
+ };
893
+ }
894
+ }
895
+ const svgTagMatch = svg.match(/<svg[^>]*>/);
896
+ if (svgTagMatch) {
897
+ const svgTag = svgTagMatch[0];
898
+ const widthMatch = svgTag.match(/width="([^"]+)"/);
899
+ const heightMatch = svgTag.match(/height="([^"]+)"/);
900
+ if (widthMatch && heightMatch) {
901
+ const width = parseFloat(widthMatch[1]);
902
+ const height = parseFloat(heightMatch[1]);
903
+ if (!isNaN(width) && !isNaN(height)) {
904
+ return { x: 0, y: 0, width, height };
905
+ }
906
+ }
907
+ }
908
+ return null;
909
+ }
910
+
911
+ // src/resource-utils.ts
912
+ function getResourceId(resource) {
913
+ if (!resource) return void 0;
914
+ return resource["@id"] || void 0;
915
+ }
916
+ function getPrimaryRepresentation(resource) {
917
+ if (!resource?.representations) return void 0;
918
+ const reps = Array.isArray(resource.representations) ? resource.representations : [resource.representations];
919
+ return reps[0];
920
+ }
921
+ function getPrimaryMediaType(resource) {
922
+ return getPrimaryRepresentation(resource)?.mediaType;
923
+ }
924
+ function getChecksum(resource) {
925
+ return getPrimaryRepresentation(resource)?.checksum;
926
+ }
927
+ function getLanguage(resource) {
928
+ return getPrimaryRepresentation(resource)?.language;
929
+ }
930
+ function getStorageUri(resource) {
931
+ return getPrimaryRepresentation(resource)?.storageUri;
932
+ }
933
+ function getCreator(resource) {
934
+ if (!resource?.wasAttributedTo) return void 0;
935
+ return Array.isArray(resource.wasAttributedTo) ? resource.wasAttributedTo[0] : resource.wasAttributedTo;
936
+ }
937
+ function getDerivedFrom(resource) {
938
+ if (!resource?.wasDerivedFrom) return void 0;
939
+ return Array.isArray(resource.wasDerivedFrom) ? resource.wasDerivedFrom[0] : resource.wasDerivedFrom;
940
+ }
941
+ function isArchived(resource) {
942
+ return resource?.archived === true;
943
+ }
944
+ function getResourceEntityTypes(resource) {
945
+ return resource?.entityTypes || [];
946
+ }
947
+ function isDraft(resource) {
948
+ return resource?.isDraft === true;
949
+ }
950
+ function getNodeEncoding(charset) {
951
+ const normalized = charset.toLowerCase().replace(/[-_]/g, "");
952
+ const charsetMap = {
953
+ "utf8": "utf8",
954
+ "iso88591": "latin1",
955
+ "latin1": "latin1",
956
+ "ascii": "ascii",
957
+ "usascii": "ascii",
958
+ "utf16le": "utf16le",
959
+ "ucs2": "ucs2",
960
+ "binary": "binary",
961
+ "windows1252": "latin1",
962
+ // Windows-1252 is a superset of Latin-1
963
+ "cp1252": "latin1"
964
+ };
965
+ return charsetMap[normalized] || "utf8";
966
+ }
967
+ function decodeRepresentation(buffer, mediaType) {
968
+ const charsetMatch = mediaType.match(/charset=([^\s;]+)/i);
969
+ const charset = (charsetMatch?.[1] || "utf-8").toLowerCase();
970
+ const encoding = getNodeEncoding(charset);
971
+ return buffer.toString(encoding);
972
+ }
973
+
974
+ // src/bridged-channels.ts
975
+ var BRIDGED_CHANNELS = [
976
+ "browse:resources-result",
977
+ "browse:resources-failed",
978
+ "browse:resource-result",
979
+ "browse:resource-failed",
980
+ "browse:annotations-result",
981
+ "browse:annotations-failed",
982
+ "browse:annotation-result",
983
+ "browse:annotation-failed",
984
+ "browse:annotation-history-result",
985
+ "browse:annotation-history-failed",
986
+ "browse:events-result",
987
+ "browse:events-failed",
988
+ "browse:referenced-by-result",
989
+ "browse:referenced-by-failed",
990
+ "browse:entity-types-result",
991
+ "browse:entity-types-failed",
992
+ "browse:directory-result",
993
+ "browse:directory-failed",
994
+ "browse:annotation-context-result",
995
+ "browse:annotation-context-failed",
996
+ "mark:delete-ok",
997
+ "mark:delete-failed",
998
+ "mark:create-ok",
999
+ "mark:create-failed",
1000
+ "match:search-results",
1001
+ "match:search-failed",
1002
+ "gather:complete",
1003
+ "gather:failed",
1004
+ "gather:annotation-progress",
1005
+ "gather:annotation-finished",
1006
+ "gather:summary-result",
1007
+ "gather:summary-failed",
1008
+ "bind:body-updated",
1009
+ "bind:body-update-failed",
1010
+ "job:report-progress",
1011
+ "job:complete",
1012
+ "job:fail",
1013
+ "job:status-result",
1014
+ "job:status-failed",
1015
+ "job:created",
1016
+ "job:create-failed",
1017
+ "job:claimed",
1018
+ "job:claim-failed",
1019
+ "yield:clone-token-generated",
1020
+ "yield:clone-token-failed",
1021
+ "yield:clone-resource-result",
1022
+ "yield:clone-resource-failed",
1023
+ "yield:clone-created",
1024
+ "yield:clone-create-failed",
1025
+ "mark:entity-type-added",
1026
+ "beckon:focus",
1027
+ "beckon:sparkle",
1028
+ "bus:resume-gap"
1029
+ ];
1030
+
1031
+ // src/fuzzy-anchor.ts
1032
+ function normalizeText(text) {
1033
+ return text.replace(/\s+/g, " ").replace(/[\u2018\u2019]/g, "'").replace(/[\u201C\u201D]/g, '"').replace(/\u2014/g, "--").replace(/\u2013/g, "-").trim();
1034
+ }
1035
+ function levenshteinDistance(str1, str2) {
1036
+ const len1 = str1.length;
1037
+ const len2 = str2.length;
1038
+ const matrix = [];
1039
+ for (let i = 0; i <= len1; i++) {
1040
+ matrix[i] = [i];
1041
+ }
1042
+ for (let j = 0; j <= len2; j++) {
1043
+ matrix[0][j] = j;
1044
+ }
1045
+ for (let i = 1; i <= len1; i++) {
1046
+ for (let j = 1; j <= len2; j++) {
1047
+ const cost = str1[i - 1] === str2[j - 1] ? 0 : 1;
1048
+ const deletion = matrix[i - 1][j] + 1;
1049
+ const insertion = matrix[i][j - 1] + 1;
1050
+ const substitution = matrix[i - 1][j - 1] + cost;
1051
+ matrix[i][j] = Math.min(deletion, insertion, substitution);
1052
+ }
1053
+ }
1054
+ return matrix[len1][len2];
1055
+ }
1056
+ function buildContentCache(content) {
1057
+ return {
1058
+ normalizedContent: normalizeText(content),
1059
+ lowerContent: content.toLowerCase()
1060
+ };
1061
+ }
1062
+ function findBestTextMatch(content, searchText, positionHint, cache) {
1063
+ const maxFuzzyDistance = Math.max(5, Math.floor(searchText.length * 0.05));
1064
+ const exactIndex = content.indexOf(searchText);
1065
+ if (exactIndex !== -1) {
1066
+ return {
1067
+ start: exactIndex,
1068
+ end: exactIndex + searchText.length,
1069
+ matchQuality: "exact"
1070
+ };
1071
+ }
1072
+ const normalizedSearch = normalizeText(searchText);
1073
+ const normalizedIndex = cache.normalizedContent.indexOf(normalizedSearch);
1074
+ if (normalizedIndex !== -1) {
1075
+ let actualPos = 0;
1076
+ let normalizedPos = 0;
1077
+ while (normalizedPos < normalizedIndex && actualPos < content.length) {
1078
+ const char = content[actualPos];
1079
+ const normalizedChar = normalizeText(char);
1080
+ if (normalizedChar) {
1081
+ normalizedPos += normalizedChar.length;
1082
+ }
1083
+ actualPos++;
1084
+ }
1085
+ return {
1086
+ start: actualPos,
1087
+ end: actualPos + searchText.length,
1088
+ matchQuality: "normalized"
1089
+ };
1090
+ }
1091
+ const lowerSearch = searchText.toLowerCase();
1092
+ const caseInsensitiveIndex = cache.lowerContent.indexOf(lowerSearch);
1093
+ if (caseInsensitiveIndex !== -1) {
1094
+ return {
1095
+ start: caseInsensitiveIndex,
1096
+ end: caseInsensitiveIndex + searchText.length,
1097
+ matchQuality: "case-insensitive"
1098
+ };
1099
+ }
1100
+ const windowSize = searchText.length;
1101
+ const searchRadius = Math.min(500, content.length);
1102
+ const searchStart = positionHint !== void 0 ? Math.max(0, positionHint - searchRadius) : 0;
1103
+ const searchEnd = positionHint !== void 0 ? Math.min(content.length, positionHint + searchRadius) : content.length;
1104
+ let bestMatch = null;
1105
+ for (let i = searchStart; i <= searchEnd - windowSize; i++) {
1106
+ const candidate = content.substring(i, i + windowSize);
1107
+ const distance = levenshteinDistance(searchText, candidate);
1108
+ if (distance <= maxFuzzyDistance) {
1109
+ if (!bestMatch || distance < bestMatch.distance) {
1110
+ bestMatch = { start: i, distance };
1111
+ }
1112
+ }
1113
+ }
1114
+ if (bestMatch) {
1115
+ return {
1116
+ start: bestMatch.start,
1117
+ end: bestMatch.start + windowSize,
1118
+ matchQuality: "fuzzy"
1119
+ };
1120
+ }
1121
+ return null;
1122
+ }
1123
+ function findTextWithContext(content, exact, prefix, suffix, positionHint, cache) {
1124
+ if (!exact) return null;
1125
+ if (positionHint !== void 0 && positionHint >= 0 && positionHint + exact.length <= content.length) {
1126
+ if (content.substring(positionHint, positionHint + exact.length) === exact) {
1127
+ return { start: positionHint, end: positionHint + exact.length };
1128
+ }
1129
+ }
1130
+ const occurrences = [];
1131
+ let index = content.indexOf(exact);
1132
+ while (index !== -1) {
1133
+ occurrences.push(index);
1134
+ index = content.indexOf(exact, index + 1);
1135
+ }
1136
+ if (occurrences.length === 0) {
1137
+ const fuzzyMatch = findBestTextMatch(content, exact, positionHint, cache);
1138
+ if (fuzzyMatch) {
1139
+ return { start: fuzzyMatch.start, end: fuzzyMatch.end };
1140
+ }
1141
+ return null;
1142
+ }
1143
+ if (occurrences.length === 1) {
1144
+ const pos2 = occurrences[0];
1145
+ return { start: pos2, end: pos2 + exact.length };
1146
+ }
1147
+ if (prefix || suffix) {
1148
+ for (const pos2 of occurrences) {
1149
+ const actualPrefixStart = Math.max(0, pos2 - (prefix?.length || 0));
1150
+ const actualPrefix = content.substring(actualPrefixStart, pos2);
1151
+ const actualSuffixEnd = Math.min(content.length, pos2 + exact.length + (suffix?.length || 0));
1152
+ const actualSuffix = content.substring(pos2 + exact.length, actualSuffixEnd);
1153
+ const prefixMatch = !prefix || actualPrefix.endsWith(prefix);
1154
+ const suffixMatch = !suffix || actualSuffix.startsWith(suffix);
1155
+ if (prefixMatch && suffixMatch) {
1156
+ return { start: pos2, end: pos2 + exact.length };
1157
+ }
1158
+ }
1159
+ for (const pos2 of occurrences) {
1160
+ const actualPrefix = content.substring(Math.max(0, pos2 - (prefix?.length || 0)), pos2);
1161
+ const actualSuffix = content.substring(pos2 + exact.length, pos2 + exact.length + (suffix?.length || 0));
1162
+ const fuzzyPrefixMatch = !prefix || actualPrefix.includes(prefix.trim());
1163
+ const fuzzySuffixMatch = !suffix || actualSuffix.includes(suffix.trim());
1164
+ if (fuzzyPrefixMatch && fuzzySuffixMatch) {
1165
+ return { start: pos2, end: pos2 + exact.length };
1166
+ }
1167
+ }
1168
+ }
1169
+ const pos = occurrences[0];
1170
+ return { start: pos, end: pos + exact.length };
1171
+ }
1172
+ function verifyPosition(content, position, expectedExact) {
1173
+ const actualText = content.substring(position.start, position.end);
1174
+ return actualText === expectedExact;
1175
+ }
1176
+
1177
+ // src/locales.ts
1178
+ var LOCALES = [
1179
+ { code: "ar", nativeName: "\u0627\u0644\u0639\u0631\u0628\u064A\u0629", englishName: "Arabic" },
1180
+ { code: "bn", nativeName: "\u09AC\u09BE\u0982\u09B2\u09BE", englishName: "Bengali" },
1181
+ { code: "cs", nativeName: "\u010Ce\u0161tina", englishName: "Czech" },
1182
+ { code: "da", nativeName: "Dansk", englishName: "Danish" },
1183
+ { code: "de", nativeName: "Deutsch", englishName: "German" },
1184
+ { code: "el", nativeName: "\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC", englishName: "Greek" },
1185
+ { code: "en", nativeName: "English", englishName: "English" },
1186
+ { code: "es", nativeName: "Espa\xF1ol", englishName: "Spanish" },
1187
+ { code: "fa", nativeName: "\u0641\u0627\u0631\u0633\u06CC", englishName: "Persian" },
1188
+ { code: "fi", nativeName: "Suomi", englishName: "Finnish" },
1189
+ { code: "fr", nativeName: "Fran\xE7ais", englishName: "French" },
1190
+ { code: "he", nativeName: "\u05E2\u05D1\u05E8\u05D9\u05EA", englishName: "Hebrew" },
1191
+ { code: "hi", nativeName: "\u0939\u093F\u0928\u094D\u0926\u0940", englishName: "Hindi" },
1192
+ { code: "id", nativeName: "Bahasa Indonesia", englishName: "Indonesian" },
1193
+ { code: "it", nativeName: "Italiano", englishName: "Italian" },
1194
+ { code: "ja", nativeName: "\u65E5\u672C\u8A9E", englishName: "Japanese" },
1195
+ { code: "ko", nativeName: "\uD55C\uAD6D\uC5B4", englishName: "Korean" },
1196
+ { code: "ms", nativeName: "Bahasa Melayu", englishName: "Malay" },
1197
+ { code: "nl", nativeName: "Nederlands", englishName: "Dutch" },
1198
+ { code: "no", nativeName: "Norsk", englishName: "Norwegian" },
1199
+ { code: "pl", nativeName: "Polski", englishName: "Polish" },
1200
+ { code: "pt", nativeName: "Portugu\xEAs", englishName: "Portuguese" },
1201
+ { code: "ro", nativeName: "Rom\xE2n\u0103", englishName: "Romanian" },
1202
+ { code: "sv", nativeName: "Svenska", englishName: "Swedish" },
1203
+ { code: "th", nativeName: "\u0E44\u0E17\u0E22", englishName: "Thai" },
1204
+ { code: "tr", nativeName: "T\xFCrk\xE7e", englishName: "Turkish" },
1205
+ { code: "uk", nativeName: "\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430", englishName: "Ukrainian" },
1206
+ { code: "vi", nativeName: "Ti\u1EBFng Vi\u1EC7t", englishName: "Vietnamese" },
1207
+ { code: "zh", nativeName: "\u4E2D\u6587", englishName: "Chinese" }
1208
+ ];
1209
+ var localeByCode = new Map(
1210
+ LOCALES.map((locale) => [locale.code.toLowerCase(), locale])
1211
+ );
1212
+ function getLocaleInfo(code) {
1213
+ if (!code) return void 0;
1214
+ return localeByCode.get(code.toLowerCase());
1215
+ }
1216
+ function getLocaleNativeName(code) {
1217
+ return getLocaleInfo(code)?.nativeName;
1218
+ }
1219
+ function getLocaleEnglishName(code) {
1220
+ return getLocaleInfo(code)?.englishName;
1221
+ }
1222
+ function formatLocaleDisplay(code) {
1223
+ if (!code) return void 0;
1224
+ const info = getLocaleInfo(code);
1225
+ if (!info) return code;
1226
+ return `${info.nativeName} (${code.toLowerCase()})`;
1227
+ }
1228
+ function getAllLocaleCodes() {
1229
+ return LOCALES.map((l) => l.code);
1230
+ }
1231
+
1232
+ // src/svg-utils.ts
1233
+ function createRectangleSvg(start, end) {
1234
+ const x = Math.min(start.x, end.x);
1235
+ const y = Math.min(start.y, end.y);
1236
+ const width = Math.abs(end.x - start.x);
1237
+ const height = Math.abs(end.y - start.y);
1238
+ return `<svg xmlns="http://www.w3.org/2000/svg"><rect x="${x}" y="${y}" width="${width}" height="${height}"/></svg>`;
1239
+ }
1240
+ function createPolygonSvg(points) {
1241
+ if (points.length < 3) {
1242
+ throw new Error("Polygon requires at least 3 points");
1243
+ }
1244
+ const pointsStr = points.map((p) => `${p.x},${p.y}`).join(" ");
1245
+ return `<svg xmlns="http://www.w3.org/2000/svg"><polygon points="${pointsStr}"/></svg>`;
1246
+ }
1247
+ function createCircleSvg(center, radius) {
1248
+ if (radius <= 0) {
1249
+ throw new Error("Circle radius must be positive");
1250
+ }
1251
+ return `<svg xmlns="http://www.w3.org/2000/svg"><circle cx="${center.x}" cy="${center.y}" r="${radius}"/></svg>`;
1252
+ }
1253
+ function parseSvgSelector(svg) {
1254
+ const rectMatch = svg.match(/<rect\s+([^>]+)\/>/);
1255
+ if (rectMatch && rectMatch[1]) {
1256
+ const attrs = rectMatch[1];
1257
+ const x = parseFloat(attrs.match(/x="([^"]+)"/)?.[1] || "0");
1258
+ const y = parseFloat(attrs.match(/y="([^"]+)"/)?.[1] || "0");
1259
+ const width = parseFloat(attrs.match(/width="([^"]+)"/)?.[1] || "0");
1260
+ const height = parseFloat(attrs.match(/height="([^"]+)"/)?.[1] || "0");
1261
+ return {
1262
+ type: "rect",
1263
+ data: { x, y, width, height }
1264
+ };
1265
+ }
1266
+ const polygonMatch = svg.match(/<polygon\s+points="([^"]+)"/);
1267
+ if (polygonMatch && polygonMatch[1]) {
1268
+ const pointsStr = polygonMatch[1];
1269
+ const points = pointsStr.split(/\s+/).map((pair) => {
1270
+ const [x, y] = pair.split(",").map(parseFloat);
1271
+ return { x, y };
1272
+ });
1273
+ return {
1274
+ type: "polygon",
1275
+ data: { points }
1276
+ };
1277
+ }
1278
+ const circleMatch = svg.match(/<circle\s+([^>]+)\/>/);
1279
+ if (circleMatch && circleMatch[1]) {
1280
+ const attrs = circleMatch[1];
1281
+ const cx = parseFloat(attrs.match(/cx="([^"]+)"/)?.[1] || "0");
1282
+ const cy = parseFloat(attrs.match(/cy="([^"]+)"/)?.[1] || "0");
1283
+ const r = parseFloat(attrs.match(/r="([^"]+)"/)?.[1] || "0");
1284
+ return {
1285
+ type: "circle",
1286
+ data: { cx, cy, r }
1287
+ };
1288
+ }
1289
+ return null;
1290
+ }
1291
+ function normalizeCoordinates(point, displayWidth, displayHeight, imageWidth, imageHeight) {
1292
+ return {
1293
+ x: point.x / displayWidth * imageWidth,
1294
+ y: point.y / displayHeight * imageHeight
1295
+ };
1296
+ }
1297
+ function scaleSvgToNative(svg, displayWidth, displayHeight, imageWidth, imageHeight) {
1298
+ const parsed = parseSvgSelector(svg);
1299
+ if (!parsed) return svg;
1300
+ const scaleX = imageWidth / displayWidth;
1301
+ const scaleY = imageHeight / displayHeight;
1302
+ switch (parsed.type) {
1303
+ case "rect": {
1304
+ const { x, y, width, height } = parsed.data;
1305
+ return createRectangleSvg(
1306
+ { x: x * scaleX, y: y * scaleY },
1307
+ { x: (x + width) * scaleX, y: (y + height) * scaleY }
1308
+ );
1309
+ }
1310
+ case "circle": {
1311
+ const { cx, cy, r } = parsed.data;
1312
+ return createCircleSvg(
1313
+ { x: cx * scaleX, y: cy * scaleY },
1314
+ r * Math.min(scaleX, scaleY)
1315
+ );
1316
+ }
1317
+ case "polygon": {
1318
+ const points = parsed.data.points.map((p) => ({
1319
+ x: p.x * scaleX,
1320
+ y: p.y * scaleY
1321
+ }));
1322
+ return createPolygonSvg(points);
1323
+ }
1324
+ }
1325
+ return svg;
1326
+ }
1327
+
1328
+ // src/text-context.ts
1329
+ function extractContext(content, start, end) {
1330
+ const CONTEXT_LENGTH = 64;
1331
+ const MAX_EXTENSION = 32;
1332
+ let prefix;
1333
+ if (start > 0) {
1334
+ let prefixStart = Math.max(0, start - CONTEXT_LENGTH);
1335
+ let extensionCount = 0;
1336
+ while (prefixStart > 0 && extensionCount < MAX_EXTENSION) {
1337
+ const char = content[prefixStart - 1];
1338
+ if (!char || /[\s.,;:!?'"()\[\]{}<>\/\\]/.test(char)) {
1339
+ break;
1340
+ }
1341
+ prefixStart--;
1342
+ extensionCount++;
1343
+ }
1344
+ prefix = content.substring(prefixStart, start);
1345
+ }
1346
+ let suffix;
1347
+ if (end < content.length) {
1348
+ let suffixEnd = Math.min(content.length, end + CONTEXT_LENGTH);
1349
+ let extensionCount = 0;
1350
+ while (suffixEnd < content.length && extensionCount < MAX_EXTENSION) {
1351
+ const char = content[suffixEnd];
1352
+ if (!char || /[\s.,;:!?'"()\[\]{}<>\/\\]/.test(char)) {
1353
+ break;
1354
+ }
1355
+ suffixEnd++;
1356
+ extensionCount++;
1357
+ }
1358
+ suffix = content.substring(end, suffixEnd);
1359
+ }
1360
+ return { prefix, suffix };
1361
+ }
1362
+ function validateAndCorrectOffsets(content, aiStart, aiEnd, exact) {
1363
+ const textAtOffset = content.substring(aiStart, aiEnd);
1364
+ if (textAtOffset === exact) {
1365
+ const context2 = extractContext(content, aiStart, aiEnd);
1366
+ return {
1367
+ start: aiStart,
1368
+ end: aiEnd,
1369
+ exact,
1370
+ prefix: context2.prefix,
1371
+ suffix: context2.suffix,
1372
+ corrected: false,
1373
+ matchQuality: "exact"
1374
+ };
1375
+ }
1376
+ const cache = buildContentCache(content);
1377
+ const match = findBestTextMatch(content, exact, aiStart, cache);
1378
+ if (!match) {
1379
+ throw new Error(
1380
+ "Cannot find acceptable match for text in content. All search strategies failed. Text may be hallucinated."
1381
+ );
1382
+ }
1383
+ const actualText = content.substring(match.start, match.end);
1384
+ const context = extractContext(content, match.start, match.end);
1385
+ return {
1386
+ start: match.start,
1387
+ end: match.end,
1388
+ exact: actualText,
1389
+ // Use actual text from document, not AI's version
1390
+ prefix: context.prefix,
1391
+ suffix: context.suffix,
1392
+ corrected: true,
1393
+ fuzzyMatched: match.matchQuality !== "exact",
1394
+ matchQuality: match.matchQuality
1395
+ };
1396
+ }
1397
+
1398
+ // src/text-encoding.ts
1399
+ function extractCharset(mediaType) {
1400
+ const charsetMatch = mediaType.match(/charset=([^\s;]+)/i);
1401
+ return (charsetMatch?.[1] || "utf-8").toLowerCase();
1402
+ }
1403
+ function decodeWithCharset(buffer, mediaType) {
1404
+ const charset = extractCharset(mediaType);
1405
+ const decoder = new TextDecoder(charset);
1406
+ return decoder.decode(buffer);
1407
+ }
1408
+
1409
+ // src/validation.ts
1410
+ var JWTTokenSchema = {
1411
+ parse(token) {
1412
+ if (typeof token !== "string") {
1413
+ throw new Error("Token must be a string");
1414
+ }
1415
+ if (!token || token.length === 0) {
1416
+ throw new Error("Token is required");
1417
+ }
1418
+ const jwtRegex = /^[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]*$/;
1419
+ if (!jwtRegex.test(token)) {
1420
+ throw new Error("Invalid JWT token format");
1421
+ }
1422
+ return token;
1423
+ },
1424
+ safeParse(token) {
1425
+ try {
1426
+ const validated = this.parse(token);
1427
+ return { success: true, data: validated };
1428
+ } catch (error) {
1429
+ return {
1430
+ success: false,
1431
+ error: error instanceof Error ? error.message : "Invalid JWT token"
1432
+ };
1433
+ }
1434
+ }
1435
+ };
1436
+ function validateData(schema, data) {
1437
+ try {
1438
+ const validated = schema.parse(data);
1439
+ return { success: true, data: validated };
1440
+ } catch (error) {
1441
+ return {
1442
+ success: false,
1443
+ error: error instanceof Error ? error.message : "Validation failed"
1444
+ };
1445
+ }
1446
+ }
1447
+ function isValidEmail(email2) {
1448
+ if (email2.length < 1 || email2.length > 255) {
1449
+ return false;
1450
+ }
1451
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
1452
+ return emailRegex.test(email2);
1453
+ }
1454
+
1455
+ // src/mime-utils.ts
1456
+ function getExtensionForMimeType(mimeType) {
1457
+ const map = {
1458
+ "text/plain": "txt",
1459
+ "text/markdown": "md",
1460
+ "image/png": "png",
1461
+ "image/jpeg": "jpg",
1462
+ "application/pdf": "pdf"
1463
+ };
1464
+ return map[mimeType] || "dat";
1465
+ }
1466
+ function isImageMimeType(mimeType) {
1467
+ return mimeType === "image/png" || mimeType === "image/jpeg";
1468
+ }
1469
+ function isTextMimeType(mimeType) {
1470
+ return mimeType === "text/plain" || mimeType === "text/markdown";
1471
+ }
1472
+ function isPdfMimeType(mimeType) {
1473
+ return mimeType === "application/pdf";
1474
+ }
1475
+ function getMimeCategory(mimeType) {
1476
+ if (isTextMimeType(mimeType)) {
1477
+ return "text";
1478
+ }
1479
+ if (isImageMimeType(mimeType) || isPdfMimeType(mimeType)) {
1480
+ return "image";
1481
+ }
1482
+ return "unsupported";
1483
+ }
1484
+
543
1485
  // src/type-guards.ts
544
1486
  function isString(value) {
545
1487
  return typeof value === "string";
@@ -635,6 +1577,9 @@ function userToAgent(user) {
635
1577
  };
636
1578
  }
637
1579
  function didToAgent(did) {
1580
+ if (!did) {
1581
+ return { type: "Person", id: "unknown", name: "unknown" };
1582
+ }
638
1583
  const parts = did.split(":");
639
1584
  const encoded = parts[parts.length - 1] || "unknown";
640
1585
  const name = decodeURIComponent(encoded);
@@ -659,11 +1604,14 @@ function deepMerge(base, override) {
659
1604
  }
660
1605
  function resolveEnvVars(obj, env) {
661
1606
  if (typeof obj === "string") {
662
- return obj.replace(/\$\{([^}]+)\}/g, (match, varName) => {
663
- if (env[varName] === void 0) {
664
- throw new Error(`Environment variable ${varName} is not set (referenced in config as ${match})`);
665
- }
666
- return env[varName];
1607
+ return obj.replace(/\$\{([^}]+)\}/g, (match, expr) => {
1608
+ const sepIdx = expr.indexOf(":-");
1609
+ const varName = sepIdx >= 0 ? expr.slice(0, sepIdx) : expr;
1610
+ const defaultValue = sepIdx >= 0 ? expr.slice(sepIdx + 2) : void 0;
1611
+ const value = env[varName];
1612
+ if (value !== void 0) return value;
1613
+ if (defaultValue !== void 0) return defaultValue;
1614
+ throw new Error(`Environment variable ${varName} is not set (referenced in config as ${match})`);
667
1615
  });
668
1616
  }
669
1617
  if (Array.isArray(obj)) {
@@ -981,6 +1929,6 @@ function getAllPlatformTypes() {
981
1929
  var CORE_TYPES_VERSION = "0.1.0";
982
1930
  var SDK_VERSION = "0.1.0";
983
1931
 
984
- export { APIError, CORE_TYPES_VERSION, CREATION_METHODS, ConfigurationError, ConflictError, EventBus, NotFoundError, PERSISTED_EVENT_TYPES, SDK_VERSION, STREAM_COMMAND_RESULT_TYPES, ScopedEventBus, ScriptError, SemiontError, UnauthorizedError, ValidationError, accessToken, annotationId, annotationUri, applyBodyOperations, assembleAnnotation, authCode, baseUrl, burstBuffer, cloneToken, createTomlConfigLoader, didToAgent, email, entityType, errField, findBodyItem, generateUuid, getAllPlatformTypes, getAnnotationUriFromEvent, getFragmentSelector, getSvgSelector, getTextPositionSelector, googleCredential, isAnnotationId, isArray, isBoolean, isDefined, isEventRelatedToAnnotation, isFunction, isNull, isNullish, isNumber, isObject, isResourceId, isStoredEvent, isString, isUndefined, isValidPlatformType, jobId, loadTomlConfig, mcpToken, parseEnvironment, refreshToken, resourceAnnotationUri, resourceId, resourceUri, searchQuery, serializePerKey, userDID, userId, userToAgent, userToDid, validateEnvironment, validateSvgMarkup };
1932
+ export { APIError, BRIDGED_CHANNELS, CHANNEL_SCHEMAS, CORE_TYPES_VERSION, CREATION_METHODS, ConfigurationError, ConflictError, EventBus, JWTTokenSchema, LOCALES, NotFoundError, PERSISTED_EVENT_TYPES, RESOURCE_BROADCAST_TYPES, SDK_VERSION, ScopedEventBus, ScriptError, SemiontError, UnauthorizedError, ValidationError, accessToken, annotationId, annotationUri, applyBodyOperations, assembleAnnotation, authCode, baseUrl, buildContentCache, burstBuffer, busLog, busLogEnabled, cloneToken, createCircleSvg, createPolygonSvg, createRectangleSvg, createTomlConfigLoader, decodeRepresentation, decodeWithCharset, didToAgent, email, entityType, errField, extractBoundingBox, extractCharset, extractContext, findBestTextMatch, findBodyItem, findTextWithContext, formatLocaleDisplay, generateUuid, getAllLocaleCodes, getAllPlatformTypes, getAnnotationExactText, getAnnotationUriFromEvent, getBodySource, getBodyType, getChecksum, getCommentText, getCreator, getDerivedFrom, getExactText, getExtensionForMimeType, getFragmentSelector, getLanguage, getLocaleEnglishName, getLocaleInfo, getLocaleNativeName, getMimeCategory, getNodeEncoding, getPrimaryMediaType, getPrimaryRepresentation, getPrimarySelector, getResourceEntityTypes, getResourceId, getStorageUri, getSvgSelector, getTargetSelector, getTargetSource, getTextPositionSelector, getTextQuoteSelector, googleCredential, hasTargetSelector, isAnnotationId, isArchived, isArray, isAssessment, isBodyResolved, isBoolean, isComment, isDefined, isDraft, isEventRelatedToAnnotation, isFunction, isHighlight, isImageMimeType, isNull, isNullish, isNumber, isObject, isPdfMimeType, isReference, isResolvedReference, isResourceId, isStoredEvent, isString, isStubReference, isTag, isTextMimeType, isUndefined, isValidEmail, isValidPlatformType, jobId, loadTomlConfig, mcpToken, normalizeCoordinates, normalizeText, parseEnvironment, parseSvgSelector, refreshToken, resourceAnnotationUri, resourceId, resourceUri, scaleSvgToNative, searchQuery, serializePerKey, setBusLogTraceIdProvider, userDID, userId, userToAgent, userToDid, validateAndCorrectOffsets, validateData, validateEnvironment, validateSvgMarkup, verifyPosition };
985
1933
  //# sourceMappingURL=index.js.map
986
1934
  //# sourceMappingURL=index.js.map