@epam/ai-dial-quotations 1.2.0-dev.50 → 1.2.0-dev.58
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/index.js +73 -58
- package/package.json +3 -3
- package/utils/annotation.d.ts +26 -3
- package/utils/annotation.d.ts.map +1 -1
package/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var T = {
|
|
|
15
15
|
switcher: "_switcher_1kph1_13",
|
|
16
16
|
sourceName: "_sourceName_1kph1_17"
|
|
17
17
|
}, D = ({ group: r, activeIndex: a, onIndexChange: o, onPreview: d, onOpenInBrowser: p, headerIcon: g, labels: y, typography: b, colors: x }) => {
|
|
18
|
-
let S = r.annotations.length, C = r.annotations[a] ?? r.primaryAnnotation, w = S > 1, D = r.primaryAnnotation.body?.source?.attachment?.type, O = d == null || D === e.HTML || D === e.XHTML, k = b?.sourceNameClassName ?? "dial-tiny-text", A = b?.titleClassName ?? "dial-body-semi-text", j = b?.quoteClassName ?? "dial-small-text", M = b?.quoteStrongClassName ?? "dial-small-semi-text", N = b?.switcherClassName ?? "dial-tiny-text",
|
|
18
|
+
let S = r.annotations.length, C = r.annotations[a] ?? r.primaryAnnotation, w = S > 1, D = r.primaryAnnotation.body?.source?.attachment?.type, O = d == null || D === e.HTML || D === e.XHTML, k = b?.sourceNameClassName ?? "dial-tiny-text", A = b?.titleClassName ?? "dial-body-semi-text", j = b?.quoteClassName ?? "dial-small-text", M = b?.quoteStrongClassName ?? "dial-small-semi-text", N = b?.switcherClassName ?? "dial-tiny-text", ee = n({
|
|
19
19
|
"--cc-card-bg": x?.cardBackground,
|
|
20
20
|
"--cc-quote-text": x?.quoteText,
|
|
21
21
|
"--cc-title-text": x?.titleText,
|
|
@@ -26,7 +26,7 @@ var T = {
|
|
|
26
26
|
role: "dialog",
|
|
27
27
|
"aria-modal": "true",
|
|
28
28
|
"aria-label": y.ariaLabel,
|
|
29
|
-
style:
|
|
29
|
+
style: ee,
|
|
30
30
|
className: i("flex w-[400px] flex-col gap-3 rounded-lg p-4 shadow-lg", E.card, T.citationCard),
|
|
31
31
|
children: [
|
|
32
32
|
/* @__PURE__ */ v("div", {
|
|
@@ -148,7 +148,7 @@ var T = {
|
|
|
148
148
|
labelClassName: l
|
|
149
149
|
})
|
|
150
150
|
});
|
|
151
|
-
},
|
|
151
|
+
}, ee = (e) => {
|
|
152
152
|
let t = e.trim();
|
|
153
153
|
if (!t.startsWith("|") || !t.endsWith("|") || /[\r\n]/.test(t)) return;
|
|
154
154
|
let n = [], r = "";
|
|
@@ -157,11 +157,11 @@ var T = {
|
|
|
157
157
|
i === "\\" && a != null && /[!-/:-@[-`{-~]/.test(a) ? (r += a, e += 1) : i === "|" ? (n.push(r.trim()), r = "") : r += i;
|
|
158
158
|
}
|
|
159
159
|
if (!(r !== "" || n.length < 2 || n.every((e) => e === "" || /^:?-{3,}:?$/.test(e)))) return n;
|
|
160
|
-
},
|
|
160
|
+
}, te = (e) => {
|
|
161
161
|
if (e.type !== "docx_text_anchor" && e.type !== "pptx_text_anchor") return;
|
|
162
162
|
let { text: t, occurrence: n, slide: r } = e;
|
|
163
163
|
if (typeof t != "string" || typeof n != "number" || !Number.isSafeInteger(n) || n < 1) return;
|
|
164
|
-
let i =
|
|
164
|
+
let i = ee(t);
|
|
165
165
|
if (i != null) {
|
|
166
166
|
if (e.type === "docx_text_anchor") return {
|
|
167
167
|
type: "docx_text_anchor",
|
|
@@ -175,13 +175,13 @@ var T = {
|
|
|
175
175
|
slide: r
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
|
-
},
|
|
178
|
+
}, ne = {
|
|
179
179
|
backgroundColor: "transparent",
|
|
180
180
|
borderColor: "var(--stroke-accent, #1D4ED8)",
|
|
181
181
|
borderWidth: "2px",
|
|
182
182
|
opacity: .5,
|
|
183
183
|
hoverOpacity: .5
|
|
184
|
-
},
|
|
184
|
+
}, re = (e) => {
|
|
185
185
|
if (typeof e != "object" || !e) return;
|
|
186
186
|
let t = e, { lt: n, wh: r } = t;
|
|
187
187
|
if (Array.isArray(n) && Array.isArray(r) && n.length >= 2 && r.length >= 2) {
|
|
@@ -200,7 +200,7 @@ var T = {
|
|
|
200
200
|
x2: i + o,
|
|
201
201
|
y2: a + s
|
|
202
202
|
};
|
|
203
|
-
},
|
|
203
|
+
}, P = (e) => {
|
|
204
204
|
if (!r(e)) return;
|
|
205
205
|
let t = e, n;
|
|
206
206
|
if (t.type === "pdf_bbox") {
|
|
@@ -211,7 +211,7 @@ var T = {
|
|
|
211
211
|
x2: i,
|
|
212
212
|
y2: a
|
|
213
213
|
});
|
|
214
|
-
} else t.type === "pdf_region" && (n =
|
|
214
|
+
} else t.type === "pdf_region" && (n = re(t.bbox));
|
|
215
215
|
if (n == null) return;
|
|
216
216
|
let i = t.page;
|
|
217
217
|
if (!(typeof i != "number" || !Number.isInteger(i) || i < 1) && [
|
|
@@ -226,48 +226,63 @@ var T = {
|
|
|
226
226
|
x2: n.x2,
|
|
227
227
|
y2: n.y2
|
|
228
228
|
};
|
|
229
|
-
},
|
|
229
|
+
}, F = (e) => typeof e != "object" || !e ? String(e) : Array.isArray(e) ? `[${e.map(F).join(",")}]` : `{${Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t)).map(([e, t]) => `${e}=${F(t)}`).join(",")}}`, ie = (e) => {
|
|
230
|
+
let t = 5381;
|
|
231
|
+
for (let n = 0; n < e.length; n += 1) t = t * 33 + e.charCodeAt(n) | 0;
|
|
232
|
+
return (t >>> 0).toString(36);
|
|
233
|
+
}, ae = (e) => {
|
|
234
|
+
let t = e.body?.selector;
|
|
235
|
+
if (t == null) return;
|
|
236
|
+
let n = (Array.isArray(t) ? t : [t]).flatMap((e) => {
|
|
237
|
+
let t = P(e);
|
|
238
|
+
return t == null ? [] : [t];
|
|
239
|
+
}), r = H(e);
|
|
240
|
+
if (!(n.length === 0 && r.length === 0)) return F([n, r]);
|
|
241
|
+
}, oe = (e) => {
|
|
242
|
+
let t = e.target?.selector, n = t?.type === "html_tag" ? t.id : void 0, r = typeof n == "string" ? n : void 0, i = ae(e);
|
|
243
|
+
if (!(r == null && i == null)) return ie(`${r ?? ""}|${i ?? ""}`);
|
|
244
|
+
}, se = (e) => e.flatMap((e, t) => {
|
|
230
245
|
let n = e.body?.selector;
|
|
231
246
|
if (n == null) return [];
|
|
232
247
|
let i = (Array.isArray(n) ? n : [n]).flatMap((e) => {
|
|
233
248
|
if (!r(e)) return [];
|
|
234
|
-
let t =
|
|
249
|
+
let t = P(e);
|
|
235
250
|
return t == null ? [] : [t];
|
|
236
251
|
});
|
|
237
252
|
return i.length === 0 ? [] : [{
|
|
238
|
-
id:
|
|
253
|
+
id: I(e, t),
|
|
239
254
|
bboxes: i,
|
|
240
|
-
style:
|
|
255
|
+
style: ne
|
|
241
256
|
}];
|
|
242
|
-
}),
|
|
257
|
+
}), I = (e, t) => e.index == null ? oe(e) ?? String(t) : String(e.index), ce = (e) => {
|
|
243
258
|
let t = e.body?.selector;
|
|
244
259
|
if (t == null) return;
|
|
245
260
|
let n = Array.isArray(t) ? t : [t];
|
|
246
261
|
for (let e of n) {
|
|
247
262
|
if (!r(e)) continue;
|
|
248
|
-
let t =
|
|
263
|
+
let t = P(e);
|
|
249
264
|
if (t != null) return t.page;
|
|
250
265
|
}
|
|
251
|
-
},
|
|
266
|
+
}, L = (e) => {
|
|
252
267
|
let t = e.custom_content?.annotations;
|
|
253
268
|
if (t?.length) return t.filter((e) => e != null && e.body?.source?.attachment?.url != null).map(a);
|
|
254
269
|
let n = e.custom_fields;
|
|
255
270
|
if (typeof n != "object" || !n) return [];
|
|
256
271
|
let r = n.annotations;
|
|
257
272
|
return !Array.isArray(r) || r.length === 0 ? [] : o(r, e.custom_content?.attachments ?? []).map(a);
|
|
258
|
-
},
|
|
273
|
+
}, R = (e) => {
|
|
259
274
|
if (e.type !== "docx_text_range") return !1;
|
|
260
275
|
let t = e;
|
|
261
276
|
return typeof t.story == "string" && Array.isArray(t.path) && t.path.every((e) => typeof e == "number") && typeof t.start == "number" && typeof t.end == "number" && typeof t.text == "string";
|
|
262
|
-
},
|
|
277
|
+
}, z = (e) => {
|
|
263
278
|
if (e.type !== "pptx_text_range") return !1;
|
|
264
279
|
let t = e;
|
|
265
280
|
return typeof t.slide == "number" && typeof t.shape_id == "string" && typeof t.start == "number" && typeof t.end == "number" && typeof t.text == "string";
|
|
266
|
-
},
|
|
281
|
+
}, B = (e) => typeof e == "object" && !!e && typeof e.row == "number" && typeof e.col == "number", V = (e) => {
|
|
267
282
|
if (e.type !== "excel_rc_range") return !1;
|
|
268
283
|
let t = e;
|
|
269
|
-
return typeof t.sheet == "string" &&
|
|
270
|
-
},
|
|
284
|
+
return typeof t.sheet == "string" && B(t.start) && (t.end === void 0 || t.end === null || B(t.end));
|
|
285
|
+
}, le = (e) => {
|
|
271
286
|
let { story: t, path: n, start: r, end: i, text: a } = e;
|
|
272
287
|
if (!(!n.every((e) => Number.isInteger(e)) || !Number.isInteger(r) || !Number.isInteger(i) || r < 0 || i < r)) return {
|
|
273
288
|
type: "docx_text_range",
|
|
@@ -277,7 +292,7 @@ var T = {
|
|
|
277
292
|
endExclusive: i,
|
|
278
293
|
text: a
|
|
279
294
|
};
|
|
280
|
-
},
|
|
295
|
+
}, ue = (e) => {
|
|
281
296
|
let { slide: t, shape_id: n, start: r, end: i, text: a } = e;
|
|
282
297
|
if (!(!Number.isInteger(t) || t < 1 || !Number.isInteger(r) || !Number.isInteger(i) || r < 0 || i < r)) return {
|
|
283
298
|
type: "pptx_text_range",
|
|
@@ -287,7 +302,7 @@ var T = {
|
|
|
287
302
|
endExclusive: i,
|
|
288
303
|
text: a
|
|
289
304
|
};
|
|
290
|
-
},
|
|
305
|
+
}, de = (e) => {
|
|
291
306
|
let { sheet: t, start: n, end: r } = e;
|
|
292
307
|
if (!(t.length === 0 || !Number.isInteger(n.row) || !Number.isInteger(n.col) || n.row < 1 || n.col < 1)) {
|
|
293
308
|
if (r == null) return {
|
|
@@ -302,30 +317,30 @@ var T = {
|
|
|
302
317
|
end: r
|
|
303
318
|
};
|
|
304
319
|
}
|
|
305
|
-
},
|
|
320
|
+
}, H = (e) => {
|
|
306
321
|
let t = e.body?.selector;
|
|
307
322
|
return t == null ? [] : (Array.isArray(t) ? t : [t]).flatMap((e) => {
|
|
308
323
|
if (!r(e)) return [];
|
|
309
|
-
if (
|
|
310
|
-
let t =
|
|
324
|
+
if (R(e)) {
|
|
325
|
+
let t = le(e);
|
|
311
326
|
return t ? [t] : [];
|
|
312
327
|
}
|
|
313
|
-
if (
|
|
314
|
-
let t =
|
|
328
|
+
if (z(e)) {
|
|
329
|
+
let t = ue(e);
|
|
315
330
|
return t ? [t] : [];
|
|
316
331
|
}
|
|
317
|
-
if (
|
|
318
|
-
let t =
|
|
332
|
+
if (V(e)) {
|
|
333
|
+
let t = de(e);
|
|
319
334
|
return t ? [t] : [];
|
|
320
335
|
}
|
|
321
|
-
let t =
|
|
336
|
+
let t = te(e);
|
|
322
337
|
return t ? [t] : [];
|
|
323
338
|
});
|
|
324
|
-
},
|
|
339
|
+
}, fe = (e, t) => C(() => t ? [] : L(e), [t, e]), pe = {
|
|
325
340
|
openOwnerKey: null,
|
|
326
341
|
activeIndexByGroup: {}
|
|
327
|
-
},
|
|
328
|
-
let [e, t] = w(
|
|
342
|
+
}, me = () => {
|
|
343
|
+
let [e, t] = w(pe), n = b((e) => {
|
|
329
344
|
t((t) => ({
|
|
330
345
|
...t,
|
|
331
346
|
openOwnerKey: e
|
|
@@ -356,7 +371,7 @@ var T = {
|
|
|
356
371
|
i,
|
|
357
372
|
e
|
|
358
373
|
]);
|
|
359
|
-
},
|
|
374
|
+
}, he = /⟦C(\d+)⟧/g, U = (e, t) => {
|
|
360
375
|
let n = t.map((e, t) => ({
|
|
361
376
|
g: e,
|
|
362
377
|
idx: t
|
|
@@ -369,9 +384,9 @@ var T = {
|
|
|
369
384
|
}).sort((e, t) => t.pos - e.pos), r = e;
|
|
370
385
|
for (let { idx: e, pos: t } of n) r = `${r.slice(0, t)}⟦C${e}⟧${r.slice(t)}`;
|
|
371
386
|
return r;
|
|
372
|
-
},
|
|
387
|
+
}, ge = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>/g, _e = /^<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>$/, ve = /<cit\s+data-id=(?:"[^"]+"|'[^']+')\s*>\s*<\/cit>|<\/?cit\b[^>]*>|<\/?cit\b[^>]*$/gi, ye = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), W = (e) => e.replace(ve, (e) => _e.test(e) ? e : ye(e)), G = (e) => W(e).replace(ge, ""), K = (e, t) => {
|
|
373
388
|
if (typeof e == "string") {
|
|
374
|
-
let n = e.split(
|
|
389
|
+
let n = e.split(he);
|
|
375
390
|
if (n.length === 1) return e;
|
|
376
391
|
let r = [];
|
|
377
392
|
return n.forEach((e, n) => {
|
|
@@ -379,18 +394,18 @@ var T = {
|
|
|
379
394
|
}), r;
|
|
380
395
|
}
|
|
381
396
|
return Array.isArray(e) ? e.flatMap((e) => {
|
|
382
|
-
let n =
|
|
397
|
+
let n = K(e, t);
|
|
383
398
|
return Array.isArray(n) ? n : [n];
|
|
384
399
|
}) : e;
|
|
385
|
-
},
|
|
400
|
+
}, be = (e) => {
|
|
386
401
|
let t = e.primaryAnnotation.target?.selector;
|
|
387
402
|
return t?.type === "html_tag" ? t.id : void 0;
|
|
388
|
-
},
|
|
403
|
+
}, xe = (e, t) => /* @__PURE__ */ v(g, { children: [
|
|
389
404
|
e == null ? "<cit>" : `<cit data-id="${e}">`,
|
|
390
405
|
t,
|
|
391
406
|
"</cit>"
|
|
392
|
-
] }),
|
|
393
|
-
let { onPreview: o, onOpenInBrowser: s, buildLabels: c } = n, l = C(() => r ?
|
|
407
|
+
] }), Se = (e, t, n, r = !1, a = !1) => {
|
|
408
|
+
let { onPreview: o, onOpenInBrowser: s, buildLabels: c } = n, l = C(() => r ? G(e) : W(t.length > 0 ? U(e, t) : e), [
|
|
394
409
|
e,
|
|
395
410
|
t,
|
|
396
411
|
r
|
|
@@ -400,7 +415,7 @@ var T = {
|
|
|
400
415
|
markdownComponents: C(() => {
|
|
401
416
|
let e = /* @__PURE__ */ new Map();
|
|
402
417
|
for (let n of t) {
|
|
403
|
-
let t =
|
|
418
|
+
let t = be(n);
|
|
404
419
|
t != null && e.set(t, n);
|
|
405
420
|
}
|
|
406
421
|
let n = (e) => {
|
|
@@ -417,19 +432,19 @@ var T = {
|
|
|
417
432
|
return r ? n(r) : null;
|
|
418
433
|
}, l = { cit: (t) => {
|
|
419
434
|
let r = t["data-id"] == null ? void 0 : e.get(t["data-id"]);
|
|
420
|
-
return r ? n(r) :
|
|
435
|
+
return r ? n(r) : xe(t["data-id"], t.children);
|
|
421
436
|
} };
|
|
422
437
|
return t.length === 0 ? u ? l : {} : {
|
|
423
438
|
...l,
|
|
424
439
|
p: ({ children: e, ...t }) => /* @__PURE__ */ _("p", {
|
|
425
440
|
...t,
|
|
426
441
|
className: i(a ? "dial-small-paragraph-text" : "dial-body-paragraph-text", "mb-3 [overflow-wrap:anywhere] [text-wrap:pretty] last:mb-0"),
|
|
427
|
-
children:
|
|
442
|
+
children: K(e, r)
|
|
428
443
|
}),
|
|
429
444
|
li: ({ children: e, ...t }) => /* @__PURE__ */ _("li", {
|
|
430
445
|
...t,
|
|
431
446
|
className: "mb-1.5 last:mb-0",
|
|
432
|
-
children:
|
|
447
|
+
children: K(e, r)
|
|
433
448
|
})
|
|
434
449
|
};
|
|
435
450
|
}, [
|
|
@@ -441,26 +456,26 @@ var T = {
|
|
|
441
456
|
u
|
|
442
457
|
])
|
|
443
458
|
};
|
|
444
|
-
},
|
|
459
|
+
}, q = (e) => {
|
|
445
460
|
try {
|
|
446
461
|
return decodeURIComponent(e);
|
|
447
462
|
} catch {
|
|
448
463
|
return e;
|
|
449
464
|
}
|
|
450
|
-
},
|
|
465
|
+
}, Ce = (e) => {
|
|
451
466
|
try {
|
|
452
467
|
let t = new URL(e);
|
|
453
|
-
return t.pathname.split("/").map((e) =>
|
|
468
|
+
return t.pathname.split("/").map((e) => q(e)).filter(Boolean).at(-1) ?? t.hostname;
|
|
454
469
|
} catch {
|
|
455
|
-
return e.split("/").map((e) =>
|
|
470
|
+
return e.split("/").map((e) => q(e)).filter(Boolean).at(-1) ?? e;
|
|
456
471
|
}
|
|
457
|
-
}, J = (e, t) => e.body?.source?.attachment?.title ??
|
|
472
|
+
}, J = (e, t) => e.body?.source?.attachment?.title ?? Ce(t), Y = (e) => {
|
|
458
473
|
let t = e.target?.selector;
|
|
459
474
|
return t?.type === "html_tag" ? t : void 0;
|
|
460
|
-
},
|
|
475
|
+
}, we = (e) => Y(e) != null, X = (e) => {
|
|
461
476
|
let t = /* @__PURE__ */ new Map();
|
|
462
477
|
for (let n of e) {
|
|
463
|
-
if (
|
|
478
|
+
if (we(n)) continue;
|
|
464
479
|
let e = n.body?.source?.attachment?.url;
|
|
465
480
|
if (e == null) continue;
|
|
466
481
|
let r = t.get(e);
|
|
@@ -490,16 +505,16 @@ var T = {
|
|
|
490
505
|
});
|
|
491
506
|
}
|
|
492
507
|
return Array.from(t.values());
|
|
493
|
-
},
|
|
508
|
+
}, Te = (e) => [...Z(e), ...X(e)], Ee = (e, t) => {
|
|
494
509
|
let n = e.body?.source?.attachment?.url;
|
|
495
510
|
return n == null || !t.includes(e) ? [e] : t.filter((e) => e.body?.source?.attachment?.url === n);
|
|
496
|
-
}, Q = (e) => e.url == null && e.reference_url != null,
|
|
497
|
-
let t =
|
|
511
|
+
}, Q = (e) => e.url == null && e.reference_url != null, De = /^(.*\.pdf)(?:#page=(\d+))?$/i, $ = (e) => {
|
|
512
|
+
let t = De.exec(e);
|
|
498
513
|
return t ? {
|
|
499
514
|
baseUrl: t[1],
|
|
500
515
|
page: t[2] == null ? null : Number(t[2])
|
|
501
516
|
} : null;
|
|
502
|
-
},
|
|
517
|
+
}, Oe = (t) => X((t ?? []).filter(Q).map((t) => {
|
|
503
518
|
let n = t.reference_url, r = $(n) != null;
|
|
504
519
|
return { body: {
|
|
505
520
|
quote: t.data,
|
|
@@ -514,4 +529,4 @@ var T = {
|
|
|
514
529
|
} };
|
|
515
530
|
}));
|
|
516
531
|
//#endregion
|
|
517
|
-
export { D as CitationCard, A as CitationCardProvider, N as CitationDropdown, O as CitationMarker, T as QUOTATIONS_CLASS,
|
|
532
|
+
export { D as CitationCard, A as CitationCardProvider, N as CitationDropdown, O as CitationMarker, T as QUOTATIONS_CLASS, I as annotationHighlightId, H as annotationToOfficeHighlightLocations, se as annotationsToPdfHighlights, Ee as gatherSameSourceAnnotations, ce as getAnnotationPdfPage, Oe as getReferenceAttachmentGroups, Te as groupAnnotations, Z as groupAnnotationsByCitId, X as groupAnnotationsBySource, U as injectCitationSentinels, R as isDocxRangeSelector, V as isExcelRcRangeSelector, z as isPptxRangeSelector, Q as isReferenceOnlyAttachment, $ as parsePdfPageReference, K as replaceSentinelsInChildren, L as resolveMessageAnnotations, G as stripCitTagsWhileStreaming, fe as useAnnotations, me as useCitationCard, j as useCitationCardContext, Se as useCitationMarkdownComponents };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-quotations",
|
|
3
3
|
"description": "Citation and annotation components, hooks, and utilities for AI DIAL conversations",
|
|
4
|
-
"version": "1.2.0-dev.
|
|
4
|
+
"version": "1.2.0-dev.58",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": "^19.2.8",
|
|
26
|
-
"@epam/ai-dial-chat-shared": "1.2.0-dev.
|
|
27
|
-
"@epam/ai-dial-ui-kit": "^0.15.0-dev.
|
|
26
|
+
"@epam/ai-dial-chat-shared": "1.2.0-dev.58",
|
|
27
|
+
"@epam/ai-dial-ui-kit": "^0.15.0-dev.9"
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
package/utils/annotation.d.ts
CHANGED
|
@@ -5,11 +5,34 @@ import { OfficeHighlightLocation } from '../models/office-highlight';
|
|
|
5
5
|
* Maps a list of annotations to `InputHighlightData` entries for the PDF viewer.
|
|
6
6
|
* Recognizes `pdf_bbox` selectors and both `pdf_region` coordinate forms
|
|
7
7
|
* (`lt`/`wh` and legacy `left`/`top`/`width`/`height`); annotations whose
|
|
8
|
-
* `body.selector` contains none of these are skipped. The highlight `id`
|
|
9
|
-
* `
|
|
8
|
+
* `body.selector` contains none of these are skipped. The highlight `id` comes
|
|
9
|
+
* from `annotationHighlightId`, so it identifies the annotation itself rather
|
|
10
|
+
* than its position in this particular input list.
|
|
10
11
|
*/
|
|
11
12
|
export declare const annotationsToPdfHighlights: (annotations: Annotation[]) => InputHighlightData[];
|
|
12
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Returns a stable string ID for a given annotation, matching the IDs
|
|
15
|
+
* `annotationsToPdfHighlights` produces (it calls this function) and the ones
|
|
16
|
+
* the Office highlight path assigns.
|
|
17
|
+
*
|
|
18
|
+
* Resolved in order:
|
|
19
|
+
* 1. `annotation.index` when the wire supplied one — already unique within the
|
|
20
|
+
* message, and short.
|
|
21
|
+
* 2. Otherwise an id derived from the annotation's own identity: its `cit` tag
|
|
22
|
+
* id plus a digest of its selectors. Two annotations differing in either
|
|
23
|
+
* part get different ids; two agreeing in both describe the same cited
|
|
24
|
+
* region and may share one.
|
|
25
|
+
* 3. Otherwise `fallbackIndex` — the annotation's position in the caller's
|
|
26
|
+
* list, for an annotation carrying neither an index, a `cit` id, nor a
|
|
27
|
+
* recognised selector.
|
|
28
|
+
*
|
|
29
|
+
* The id is opaque: compare it, never parse it. A position-derived id is not
|
|
30
|
+
* unique beyond the list it came from, which is why it is the last resort — a
|
|
31
|
+
* caller gathering one citation group at a time would otherwise give every
|
|
32
|
+
* single-annotation group the same id, and the canvas could not tell two
|
|
33
|
+
* citations of one document apart (issue #8907). Ids are never persisted and
|
|
34
|
+
* never sent over the wire.
|
|
35
|
+
*/
|
|
13
36
|
export declare const annotationHighlightId: (annotation: Annotation, fallbackIndex: number) => string;
|
|
14
37
|
/**
|
|
15
38
|
* Returns the first positive integer PDF page in the annotation's body selectors,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotation.d.ts","sourceRoot":"","sources":["../../src/utils/annotation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,OAAO,EACP,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAMnC,OAAO,KAAK,EAGV,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"annotation.d.ts","sourceRoot":"","sources":["../../src/utils/annotation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,OAAO,EACP,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAMnC,OAAO,KAAK,EAGV,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAgL1E;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,GACrC,aAAa,UAAU,EAAE,KACxB,kBAAkB,EAoBjB,CAAC;AAEL;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,qBAAqB,GAChC,YAAY,UAAU,EACtB,eAAe,MAAM,KACpB,MAG+D,CAAC;AAEnE;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAC/B,YAAY,UAAU,KACrB,MAAM,GAAG,SAWX,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GAAI,SAAS,OAAO,KAAG,UAAU,EAoBtE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,kBAAkB,KAC3B,QAAQ,IAAI,iBAWd,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,kBAAkB,KAC3B,QAAQ,IAAI,iBAUd,CAAC;AAUF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GACjC,UAAU,kBAAkB,KAC3B,QAAQ,IAAI,oBAQd,CAAC;AA8FF;;;;GAIG;AACH,eAAO,MAAM,oCAAoC,GAC/C,YAAY,UAAU,KACrB,uBAAuB,EAuBzB,CAAC"}
|