@chialab/pdfjs-lib 1.0.0-alpha.19 → 1.0.0-alpha.20
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/browser/{NodeCanvasFactory-OREYUFNU.js → NodeCanvasFactory-ONRE5YYL.js} +1 -1
- package/dist/browser/{chunk-MXRUYXDD.js → chunk-ELOUEWKT.js} +16 -1
- package/dist/browser/index.js +780 -479
- package/dist/index.d.ts +2 -0
- package/dist/lib/AnnotationData.d.ts +1 -1
- package/dist/lib/CanvasGraphics.d.ts +1 -0
- package/dist/lib/Path2D.d.ts +1 -1
- package/dist/lib/Svg.d.ts +143 -0
- package/dist/lib/SvgCanvasContext.d.ts +11 -18
- package/dist/lib/TextLayer.d.ts +12 -5
- package/dist/lib/utils.d.ts +6 -0
- package/dist/node/{NodeCanvasFactory-N32SOXPQ.js → NodeCanvasFactory-YRBSQ5MH.js} +1 -1
- package/dist/node/{chunk-QCIN557M.js → chunk-3XZOTLLE.js} +15 -0
- package/dist/node/index.js +780 -479
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -32,11 +32,12 @@ import {
|
|
|
32
32
|
isValidFetchUrl,
|
|
33
33
|
makeSerializable,
|
|
34
34
|
noContextMenu,
|
|
35
|
+
parseRgbaColor,
|
|
35
36
|
rgbToHex,
|
|
36
37
|
setLayerDimensions,
|
|
37
38
|
stopEvent,
|
|
38
39
|
toDataUrl
|
|
39
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-ELOUEWKT.js";
|
|
40
41
|
import {
|
|
41
42
|
AbortException,
|
|
42
43
|
AnnotationBorderStyleType,
|
|
@@ -375,13 +376,13 @@ var _ImageManager = class _ImageManager {
|
|
|
375
376
|
async getFromUrl(url) {
|
|
376
377
|
return __privateMethod(this, _ImageManager_instances, get_fn).call(this, url, url);
|
|
377
378
|
}
|
|
378
|
-
async getFromBlob(
|
|
379
|
+
async getFromBlob(id2, blobPromise) {
|
|
379
380
|
const blob = await blobPromise;
|
|
380
|
-
return __privateMethod(this, _ImageManager_instances, get_fn).call(this,
|
|
381
|
+
return __privateMethod(this, _ImageManager_instances, get_fn).call(this, id2, blob);
|
|
381
382
|
}
|
|
382
|
-
async getFromId(
|
|
383
|
+
async getFromId(id2) {
|
|
383
384
|
__privateGet(this, _cache) || __privateSet(this, _cache, /* @__PURE__ */ new Map());
|
|
384
|
-
const data = __privateGet(this, _cache).get(
|
|
385
|
+
const data = __privateGet(this, _cache).get(id2);
|
|
385
386
|
if (!data) {
|
|
386
387
|
return null;
|
|
387
388
|
}
|
|
@@ -399,9 +400,9 @@ var _ImageManager = class _ImageManager {
|
|
|
399
400
|
}
|
|
400
401
|
return this.getFromUrl(data.url);
|
|
401
402
|
}
|
|
402
|
-
getFromCanvas(
|
|
403
|
+
getFromCanvas(id2, canvas) {
|
|
403
404
|
__privateGet(this, _cache) || __privateSet(this, _cache, /* @__PURE__ */ new Map());
|
|
404
|
-
let data = __privateGet(this, _cache).get(
|
|
405
|
+
let data = __privateGet(this, _cache).get(id2);
|
|
405
406
|
if (data?.bitmap) {
|
|
406
407
|
data.refCounter += 1;
|
|
407
408
|
return data;
|
|
@@ -415,20 +416,20 @@ var _ImageManager = class _ImageManager {
|
|
|
415
416
|
refCounter: 1,
|
|
416
417
|
isSvg: false
|
|
417
418
|
};
|
|
418
|
-
__privateGet(this, _cache).set(
|
|
419
|
+
__privateGet(this, _cache).set(id2, data);
|
|
419
420
|
__privateGet(this, _cache).set(data.id, data);
|
|
420
421
|
return data;
|
|
421
422
|
}
|
|
422
|
-
getSvgUrl(
|
|
423
|
-
const data = __privateGet(this, _cache).get(
|
|
423
|
+
getSvgUrl(id2) {
|
|
424
|
+
const data = __privateGet(this, _cache).get(id2);
|
|
424
425
|
if (!data?.isSvg) {
|
|
425
426
|
return null;
|
|
426
427
|
}
|
|
427
428
|
return data.svgUrl;
|
|
428
429
|
}
|
|
429
|
-
deleteId(
|
|
430
|
+
deleteId(id2) {
|
|
430
431
|
__privateGet(this, _cache) || __privateSet(this, _cache, /* @__PURE__ */ new Map());
|
|
431
|
-
const data = __privateGet(this, _cache).get(
|
|
432
|
+
const data = __privateGet(this, _cache).get(id2);
|
|
432
433
|
if (!data) {
|
|
433
434
|
return;
|
|
434
435
|
}
|
|
@@ -450,8 +451,8 @@ var _ImageManager = class _ImageManager {
|
|
|
450
451
|
// We must take care of having the right manager because we can copy/paste
|
|
451
452
|
// some images from other documents, hence it'd be a pity to use an id from an
|
|
452
453
|
// other manager.
|
|
453
|
-
isValidId(
|
|
454
|
-
return
|
|
454
|
+
isValidId(id2) {
|
|
455
|
+
return id2.startsWith(`image_${__privateGet(this, _baseId)}_`);
|
|
455
456
|
}
|
|
456
457
|
};
|
|
457
458
|
_baseId = new WeakMap();
|
|
@@ -1660,8 +1661,8 @@ var _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
|
|
|
1660
1661
|
* @param {string} id
|
|
1661
1662
|
* @returns {AnnotationEditor}
|
|
1662
1663
|
*/
|
|
1663
|
-
getEditor(
|
|
1664
|
-
return __privateGet(this, _allEditors).get(
|
|
1664
|
+
getEditor(id2) {
|
|
1665
|
+
return __privateGet(this, _allEditors).get(id2);
|
|
1665
1666
|
}
|
|
1666
1667
|
/**
|
|
1667
1668
|
* Add a new editor.
|
|
@@ -2158,10 +2159,10 @@ var _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
|
|
|
2158
2159
|
}
|
|
2159
2160
|
return boxes.length === 0 ? null : boxes;
|
|
2160
2161
|
}
|
|
2161
|
-
addChangedExistingAnnotation({ annotationElementId, id }) {
|
|
2162
|
+
addChangedExistingAnnotation({ annotationElementId, id: id2 }) {
|
|
2162
2163
|
(__privateGet(this, _changedExistingAnnotations) || __privateSet(this, _changedExistingAnnotations, /* @__PURE__ */ new Map())).set(
|
|
2163
2164
|
annotationElementId,
|
|
2164
|
-
|
|
2165
|
+
id2
|
|
2165
2166
|
);
|
|
2166
2167
|
}
|
|
2167
2168
|
removeChangedExistingAnnotation({ annotationElementId }) {
|
|
@@ -5185,7 +5186,7 @@ function transformPath(commands, transform) {
|
|
|
5185
5186
|
}
|
|
5186
5187
|
});
|
|
5187
5188
|
}
|
|
5188
|
-
function
|
|
5189
|
+
function getBBox(commands) {
|
|
5189
5190
|
let minX = Number.POSITIVE_INFINITY;
|
|
5190
5191
|
let minY = Number.POSITIVE_INFINITY;
|
|
5191
5192
|
let maxX = Number.NEGATIVE_INFINITY;
|
|
@@ -6502,25 +6503,25 @@ var CachedCanvases = class {
|
|
|
6502
6503
|
this.canvasFactory = canvasFactory;
|
|
6503
6504
|
this.cache = /* @__PURE__ */ Object.create(null);
|
|
6504
6505
|
}
|
|
6505
|
-
getCanvas(
|
|
6506
|
+
getCanvas(id2, width, height) {
|
|
6506
6507
|
let canvasEntry;
|
|
6507
|
-
if (this.cache[
|
|
6508
|
-
canvasEntry = this.cache[
|
|
6508
|
+
if (this.cache[id2] !== void 0) {
|
|
6509
|
+
canvasEntry = this.cache[id2];
|
|
6509
6510
|
this.canvasFactory.reset(canvasEntry, width, height);
|
|
6510
6511
|
} else {
|
|
6511
6512
|
canvasEntry = this.canvasFactory.create(width, height);
|
|
6512
|
-
this.cache[
|
|
6513
|
+
this.cache[id2] = canvasEntry;
|
|
6513
6514
|
}
|
|
6514
6515
|
return canvasEntry;
|
|
6515
6516
|
}
|
|
6516
|
-
delete(
|
|
6517
|
-
delete this.cache[
|
|
6517
|
+
delete(id2) {
|
|
6518
|
+
delete this.cache[id2];
|
|
6518
6519
|
}
|
|
6519
6520
|
clear() {
|
|
6520
|
-
for (const
|
|
6521
|
-
const canvasEntry = this.cache[
|
|
6521
|
+
for (const id2 in this.cache) {
|
|
6522
|
+
const canvasEntry = this.cache[id2];
|
|
6522
6523
|
this.canvasFactory.destroy(canvasEntry);
|
|
6523
|
-
delete this.cache[
|
|
6524
|
+
delete this.cache[id2];
|
|
6524
6525
|
}
|
|
6525
6526
|
}
|
|
6526
6527
|
};
|
|
@@ -8197,7 +8198,7 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
8197
8198
|
this.compose(dirtyBox);
|
|
8198
8199
|
}
|
|
8199
8200
|
}
|
|
8200
|
-
beginAnnotation(
|
|
8201
|
+
beginAnnotation(id2, rect, transform, matrix, hasOwnCanvas) {
|
|
8201
8202
|
__privateMethod(this, _CanvasGraphics_instances, restoreInitialState_fn).call(this);
|
|
8202
8203
|
resetCtxToDefault(this.ctx);
|
|
8203
8204
|
this.ctx.save();
|
|
@@ -8229,7 +8230,7 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
8229
8230
|
canvasHeight
|
|
8230
8231
|
);
|
|
8231
8232
|
const { canvas, context } = this.annotationCanvas;
|
|
8232
|
-
this.annotationCanvasMap.set(
|
|
8233
|
+
this.annotationCanvasMap.set(id2, canvas);
|
|
8233
8234
|
this.annotationCanvas.savedCtx = this.ctx;
|
|
8234
8235
|
this.ctx = context;
|
|
8235
8236
|
this.ctx.save();
|
|
@@ -9004,45 +9005,45 @@ var OptionalContentConfig = class {
|
|
|
9004
9005
|
return __privateMethod(this, _OptionalContentConfig_instances, evaluateVisibilityExpression_fn).call(this, group.expression);
|
|
9005
9006
|
}
|
|
9006
9007
|
if (!group.policy || group.policy === "AnyOn") {
|
|
9007
|
-
for (const
|
|
9008
|
-
if (!__privateGet(this, _groups).has(
|
|
9009
|
-
warn(`Optional content group not found: ${
|
|
9008
|
+
for (const id2 of group.ids) {
|
|
9009
|
+
if (!__privateGet(this, _groups).has(id2)) {
|
|
9010
|
+
warn(`Optional content group not found: ${id2}`);
|
|
9010
9011
|
return true;
|
|
9011
9012
|
}
|
|
9012
|
-
if (__privateGet(this, _groups).get(
|
|
9013
|
+
if (__privateGet(this, _groups).get(id2).visible) {
|
|
9013
9014
|
return true;
|
|
9014
9015
|
}
|
|
9015
9016
|
}
|
|
9016
9017
|
return false;
|
|
9017
9018
|
} else if (group.policy === "AllOn") {
|
|
9018
|
-
for (const
|
|
9019
|
-
if (!__privateGet(this, _groups).has(
|
|
9020
|
-
warn(`Optional content group not found: ${
|
|
9019
|
+
for (const id2 of group.ids) {
|
|
9020
|
+
if (!__privateGet(this, _groups).has(id2)) {
|
|
9021
|
+
warn(`Optional content group not found: ${id2}`);
|
|
9021
9022
|
return true;
|
|
9022
9023
|
}
|
|
9023
|
-
if (!__privateGet(this, _groups).get(
|
|
9024
|
+
if (!__privateGet(this, _groups).get(id2).visible) {
|
|
9024
9025
|
return false;
|
|
9025
9026
|
}
|
|
9026
9027
|
}
|
|
9027
9028
|
return true;
|
|
9028
9029
|
} else if (group.policy === "AnyOff") {
|
|
9029
|
-
for (const
|
|
9030
|
-
if (!__privateGet(this, _groups).has(
|
|
9031
|
-
warn(`Optional content group not found: ${
|
|
9030
|
+
for (const id2 of group.ids) {
|
|
9031
|
+
if (!__privateGet(this, _groups).has(id2)) {
|
|
9032
|
+
warn(`Optional content group not found: ${id2}`);
|
|
9032
9033
|
return true;
|
|
9033
9034
|
}
|
|
9034
|
-
if (!__privateGet(this, _groups).get(
|
|
9035
|
+
if (!__privateGet(this, _groups).get(id2).visible) {
|
|
9035
9036
|
return true;
|
|
9036
9037
|
}
|
|
9037
9038
|
}
|
|
9038
9039
|
return false;
|
|
9039
9040
|
} else if (group.policy === "AllOff") {
|
|
9040
|
-
for (const
|
|
9041
|
-
if (!__privateGet(this, _groups).has(
|
|
9042
|
-
warn(`Optional content group not found: ${
|
|
9041
|
+
for (const id2 of group.ids) {
|
|
9042
|
+
if (!__privateGet(this, _groups).has(id2)) {
|
|
9043
|
+
warn(`Optional content group not found: ${id2}`);
|
|
9043
9044
|
return true;
|
|
9044
9045
|
}
|
|
9045
|
-
if (__privateGet(this, _groups).get(
|
|
9046
|
+
if (__privateGet(this, _groups).get(id2).visible) {
|
|
9046
9047
|
return false;
|
|
9047
9048
|
}
|
|
9048
9049
|
}
|
|
@@ -9054,16 +9055,16 @@ var OptionalContentConfig = class {
|
|
|
9054
9055
|
warn(`Unknown group type ${group.type}.`);
|
|
9055
9056
|
return true;
|
|
9056
9057
|
}
|
|
9057
|
-
setVisibility(
|
|
9058
|
-
const group = __privateGet(this, _groups).get(
|
|
9058
|
+
setVisibility(id2, visible = true, preserveRB = true) {
|
|
9059
|
+
const group = __privateGet(this, _groups).get(id2);
|
|
9059
9060
|
if (!group) {
|
|
9060
|
-
warn(`Optional content group not found: ${
|
|
9061
|
+
warn(`Optional content group not found: ${id2}`);
|
|
9061
9062
|
return;
|
|
9062
9063
|
}
|
|
9063
9064
|
if (preserveRB && visible && group.rbGroups.length) {
|
|
9064
9065
|
for (const rbGroup of group.rbGroups) {
|
|
9065
9066
|
for (const otherId of rbGroup) {
|
|
9066
|
-
if (otherId !==
|
|
9067
|
+
if (otherId !== id2) {
|
|
9067
9068
|
__privateGet(this, _groups).get(otherId)?._setVisible(INTERNAL, false, true);
|
|
9068
9069
|
}
|
|
9069
9070
|
}
|
|
@@ -9117,16 +9118,16 @@ var OptionalContentConfig = class {
|
|
|
9117
9118
|
}
|
|
9118
9119
|
return [...__privateGet(this, _groups).keys()];
|
|
9119
9120
|
}
|
|
9120
|
-
getGroup(
|
|
9121
|
-
return __privateGet(this, _groups).get(
|
|
9121
|
+
getGroup(id2) {
|
|
9122
|
+
return __privateGet(this, _groups).get(id2) || null;
|
|
9122
9123
|
}
|
|
9123
9124
|
getHash() {
|
|
9124
9125
|
if (__privateGet(this, _cachedGetHash) !== null) {
|
|
9125
9126
|
return __privateGet(this, _cachedGetHash);
|
|
9126
9127
|
}
|
|
9127
9128
|
const hash = new MurmurHash3_64();
|
|
9128
|
-
for (const [
|
|
9129
|
-
hash.update(`${
|
|
9129
|
+
for (const [id2, group] of __privateGet(this, _groups)) {
|
|
9130
|
+
hash.update(`${id2}:${group.visible}`);
|
|
9130
9131
|
}
|
|
9131
9132
|
return __privateSet(this, _cachedGetHash, hash.hexdigest());
|
|
9132
9133
|
}
|
|
@@ -11227,8 +11228,8 @@ var PDFDocumentProxy = class {
|
|
|
11227
11228
|
* information of the given named destination, or `null` when the named
|
|
11228
11229
|
* destination is not present in the PDF file.
|
|
11229
11230
|
*/
|
|
11230
|
-
getDestination(
|
|
11231
|
-
return this._transport.getDestination(
|
|
11231
|
+
getDestination(id2) {
|
|
11232
|
+
return this._transport.getDestination(id2);
|
|
11232
11233
|
}
|
|
11233
11234
|
/**
|
|
11234
11235
|
* @returns {Promise<Array<string> | null>} A promise that is resolved with
|
|
@@ -12205,10 +12206,10 @@ setupFakeWorker_fn = function() {
|
|
|
12205
12206
|
}
|
|
12206
12207
|
const port = new LoopbackPort();
|
|
12207
12208
|
__privateSet(this, _port2, port);
|
|
12208
|
-
const
|
|
12209
|
-
const workerHandler = new MessageHandler(
|
|
12209
|
+
const id2 = `fake${__privateWrapper(_PDFWorker, _fakeWorkerId)._++}`;
|
|
12210
|
+
const workerHandler = new MessageHandler(id2 + "_worker", id2, port);
|
|
12210
12211
|
WorkerMessageHandler.setup(workerHandler, port);
|
|
12211
|
-
__privateSet(this, _messageHandler, new MessageHandler(
|
|
12212
|
+
__privateSet(this, _messageHandler, new MessageHandler(id2, id2 + "_worker", port));
|
|
12212
12213
|
__privateMethod(this, _PDFWorker_instances, resolve_fn).call(this);
|
|
12213
12214
|
}).catch((reason) => {
|
|
12214
12215
|
__privateGet(this, _capability3).reject(
|
|
@@ -12539,11 +12540,11 @@ var WorkerTransport = class {
|
|
|
12539
12540
|
const page = __privateGet(this, _pageCache).get(data.pageIndex);
|
|
12540
12541
|
page._startRenderPage(data.transparency, data.cacheKey);
|
|
12541
12542
|
});
|
|
12542
|
-
messageHandler.on("commonobj", ([
|
|
12543
|
+
messageHandler.on("commonobj", ([id2, type, exportedData]) => {
|
|
12543
12544
|
if (this.destroyed) {
|
|
12544
12545
|
return null;
|
|
12545
12546
|
}
|
|
12546
|
-
if (this.commonObjs.has(
|
|
12547
|
+
if (this.commonObjs.has(id2)) {
|
|
12547
12548
|
return null;
|
|
12548
12549
|
}
|
|
12549
12550
|
switch (type) {
|
|
@@ -12551,16 +12552,16 @@ var WorkerTransport = class {
|
|
|
12551
12552
|
if ("error" in exportedData) {
|
|
12552
12553
|
const exportedError = exportedData.error;
|
|
12553
12554
|
warn(`Error during font loading: ${exportedError}`);
|
|
12554
|
-
this.commonObjs.resolve(
|
|
12555
|
+
this.commonObjs.resolve(id2, exportedError);
|
|
12555
12556
|
break;
|
|
12556
12557
|
}
|
|
12557
12558
|
const inspectFont = this._params.pdfBug && globalThis.FontInspector?.enabled ? (font2, url) => globalThis.FontInspector.fontAdded(font2, url) : null;
|
|
12558
12559
|
const font = new FontFaceObject(exportedData, inspectFont);
|
|
12559
|
-
this.fontLoader.bind(font).catch(() => messageHandler.sendWithPromise("FontFallback", { id })).finally(() => {
|
|
12560
|
+
this.fontLoader.bind(font).catch(() => messageHandler.sendWithPromise("FontFallback", { id: id2 })).finally(() => {
|
|
12560
12561
|
if (!font.fontExtraProperties && font.data) {
|
|
12561
12562
|
font.data = null;
|
|
12562
12563
|
}
|
|
12563
|
-
this.commonObjs.resolve(
|
|
12564
|
+
this.commonObjs.resolve(id2, font);
|
|
12564
12565
|
});
|
|
12565
12566
|
break;
|
|
12566
12567
|
case "CopyLocalImage":
|
|
@@ -12574,7 +12575,7 @@ var WorkerTransport = class {
|
|
|
12574
12575
|
if (!data.dataLen) {
|
|
12575
12576
|
return null;
|
|
12576
12577
|
}
|
|
12577
|
-
this.commonObjs.resolve(
|
|
12578
|
+
this.commonObjs.resolve(id2, structuredClone(data));
|
|
12578
12579
|
return data.dataLen;
|
|
12579
12580
|
}
|
|
12580
12581
|
}
|
|
@@ -12582,19 +12583,19 @@ var WorkerTransport = class {
|
|
|
12582
12583
|
case "FontPath":
|
|
12583
12584
|
case "Image":
|
|
12584
12585
|
case "Pattern":
|
|
12585
|
-
this.commonObjs.resolve(
|
|
12586
|
+
this.commonObjs.resolve(id2, exportedData);
|
|
12586
12587
|
break;
|
|
12587
12588
|
default:
|
|
12588
12589
|
throw new Error(`Got unknown common object type ${type}`);
|
|
12589
12590
|
}
|
|
12590
12591
|
return null;
|
|
12591
12592
|
});
|
|
12592
|
-
messageHandler.on("obj", ([
|
|
12593
|
+
messageHandler.on("obj", ([id2, pageIndex, type, imageData]) => {
|
|
12593
12594
|
if (this.destroyed) {
|
|
12594
12595
|
return;
|
|
12595
12596
|
}
|
|
12596
12597
|
const pageProxy = __privateGet(this, _pageCache).get(pageIndex);
|
|
12597
|
-
if (pageProxy.objs.has(
|
|
12598
|
+
if (pageProxy.objs.has(id2)) {
|
|
12598
12599
|
return;
|
|
12599
12600
|
}
|
|
12600
12601
|
if (pageProxy._intentStates.size === 0) {
|
|
@@ -12604,7 +12605,7 @@ var WorkerTransport = class {
|
|
|
12604
12605
|
switch (type) {
|
|
12605
12606
|
case "Image":
|
|
12606
12607
|
case "Pattern":
|
|
12607
|
-
pageProxy.objs.resolve(
|
|
12608
|
+
pageProxy.objs.resolve(id2, imageData);
|
|
12608
12609
|
break;
|
|
12609
12610
|
default:
|
|
12610
12611
|
throw new Error(`Got unknown object type ${type}`);
|
|
@@ -12714,12 +12715,12 @@ var WorkerTransport = class {
|
|
|
12714
12715
|
getDestinations() {
|
|
12715
12716
|
return this.messageHandler.sendWithPromise("GetDestinations", null);
|
|
12716
12717
|
}
|
|
12717
|
-
getDestination(
|
|
12718
|
-
if (typeof
|
|
12718
|
+
getDestination(id2) {
|
|
12719
|
+
if (typeof id2 !== "string") {
|
|
12719
12720
|
return Promise.reject(new Error("Invalid destination request."));
|
|
12720
12721
|
}
|
|
12721
12722
|
return this.messageHandler.sendWithPromise("GetDestination", {
|
|
12722
|
-
id
|
|
12723
|
+
id: id2
|
|
12723
12724
|
});
|
|
12724
12725
|
}
|
|
12725
12726
|
getPageLabels() {
|
|
@@ -13094,8 +13095,8 @@ var DOMSVGFactory = class extends BaseSVGFactory {
|
|
|
13094
13095
|
|
|
13095
13096
|
// src/pdf.js/src/display/xfa_layer.js
|
|
13096
13097
|
var XfaLayer = class {
|
|
13097
|
-
static setupStorage(html,
|
|
13098
|
-
const storedData = storage.getValue(
|
|
13098
|
+
static setupStorage(html, id2, element, storage, intent) {
|
|
13099
|
+
const storedData = storage.getValue(id2, { value: null });
|
|
13099
13100
|
switch (element.name) {
|
|
13100
13101
|
case "textarea":
|
|
13101
13102
|
if (storedData.value !== null) {
|
|
@@ -13105,7 +13106,7 @@ var XfaLayer = class {
|
|
|
13105
13106
|
break;
|
|
13106
13107
|
}
|
|
13107
13108
|
html.addEventListener("input", (event) => {
|
|
13108
|
-
storage.setValue(
|
|
13109
|
+
storage.setValue(id2, { value: event.target.value });
|
|
13109
13110
|
});
|
|
13110
13111
|
break;
|
|
13111
13112
|
case "input":
|
|
@@ -13119,7 +13120,7 @@ var XfaLayer = class {
|
|
|
13119
13120
|
break;
|
|
13120
13121
|
}
|
|
13121
13122
|
html.addEventListener("change", (event) => {
|
|
13122
|
-
storage.setValue(
|
|
13123
|
+
storage.setValue(id2, {
|
|
13123
13124
|
value: event.target.checked ? event.target.getAttribute("xfaOn") : event.target.getAttribute("xfaOff")
|
|
13124
13125
|
});
|
|
13125
13126
|
});
|
|
@@ -13131,7 +13132,7 @@ var XfaLayer = class {
|
|
|
13131
13132
|
break;
|
|
13132
13133
|
}
|
|
13133
13134
|
html.addEventListener("input", (event) => {
|
|
13134
|
-
storage.setValue(
|
|
13135
|
+
storage.setValue(id2, { value: event.target.value });
|
|
13135
13136
|
});
|
|
13136
13137
|
}
|
|
13137
13138
|
break;
|
|
@@ -13149,7 +13150,7 @@ var XfaLayer = class {
|
|
|
13149
13150
|
html.addEventListener("input", (event) => {
|
|
13150
13151
|
const options = event.target.options;
|
|
13151
13152
|
const value = options.selectedIndex === -1 ? "" : options[options.selectedIndex].value;
|
|
13152
|
-
storage.setValue(
|
|
13153
|
+
storage.setValue(id2, { value });
|
|
13153
13154
|
});
|
|
13154
13155
|
break;
|
|
13155
13156
|
}
|
|
@@ -13686,8 +13687,8 @@ var _AnnotationElement = class _AnnotationElement {
|
|
|
13686
13687
|
const defs = svgFactory.createElement("defs");
|
|
13687
13688
|
svg.append(defs);
|
|
13688
13689
|
const clipPath = svgFactory.createElement("clipPath");
|
|
13689
|
-
const
|
|
13690
|
-
clipPath.setAttribute("id",
|
|
13690
|
+
const id2 = `clippath_${this.data.id}`;
|
|
13691
|
+
clipPath.setAttribute("id", id2);
|
|
13691
13692
|
clipPath.setAttribute("clipPathUnits", "objectBoundingBox");
|
|
13692
13693
|
defs.append(clipPath);
|
|
13693
13694
|
for (let i = 2, ii = quadPoints.length; i < ii; i += 8) {
|
|
@@ -13714,7 +13715,7 @@ var _AnnotationElement = class _AnnotationElement {
|
|
|
13714
13715
|
style.backgroundImage = svgBuffer.join("");
|
|
13715
13716
|
}
|
|
13716
13717
|
this.container.append(svg);
|
|
13717
|
-
this.container.style.clipPath = `url(#${
|
|
13718
|
+
this.container.style.clipPath = `url(#${id2})`;
|
|
13718
13719
|
}
|
|
13719
13720
|
/**
|
|
13720
13721
|
* Create a popup for the annotation's HTML element. This is used for
|
|
@@ -13762,36 +13763,36 @@ var _AnnotationElement = class _AnnotationElement {
|
|
|
13762
13763
|
if (this._fieldObjects) {
|
|
13763
13764
|
const fieldObj = this._fieldObjects[name];
|
|
13764
13765
|
if (fieldObj) {
|
|
13765
|
-
for (const { page, id, exportValues } of fieldObj) {
|
|
13766
|
+
for (const { page, id: id2, exportValues } of fieldObj) {
|
|
13766
13767
|
if (page === -1) {
|
|
13767
13768
|
continue;
|
|
13768
13769
|
}
|
|
13769
|
-
if (
|
|
13770
|
+
if (id2 === skipId) {
|
|
13770
13771
|
continue;
|
|
13771
13772
|
}
|
|
13772
13773
|
const exportValue = typeof exportValues === "string" ? exportValues : null;
|
|
13773
13774
|
const domElement = document.querySelector(
|
|
13774
|
-
`[data-element-id="${
|
|
13775
|
+
`[data-element-id="${id2}"]`
|
|
13775
13776
|
);
|
|
13776
13777
|
if (domElement && !GetElementsByNameSet.has(domElement)) {
|
|
13777
|
-
warn(`_getElementsByName - element not allowed: ${
|
|
13778
|
+
warn(`_getElementsByName - element not allowed: ${id2}`);
|
|
13778
13779
|
continue;
|
|
13779
13780
|
}
|
|
13780
|
-
fields.push({ id, exportValue, domElement });
|
|
13781
|
+
fields.push({ id: id2, exportValue, domElement });
|
|
13781
13782
|
}
|
|
13782
13783
|
}
|
|
13783
13784
|
return fields;
|
|
13784
13785
|
}
|
|
13785
13786
|
for (const domElement of document.getElementsByName(name)) {
|
|
13786
13787
|
const { exportValue } = domElement;
|
|
13787
|
-
const
|
|
13788
|
-
if (
|
|
13788
|
+
const id2 = domElement.getAttribute("data-element-id");
|
|
13789
|
+
if (id2 === skipId) {
|
|
13789
13790
|
continue;
|
|
13790
13791
|
}
|
|
13791
13792
|
if (!GetElementsByNameSet.has(domElement)) {
|
|
13792
13793
|
continue;
|
|
13793
13794
|
}
|
|
13794
|
-
fields.push({ id, exportValue, domElement });
|
|
13795
|
+
fields.push({ id: id2, exportValue, domElement });
|
|
13795
13796
|
}
|
|
13796
13797
|
return fields;
|
|
13797
13798
|
}
|
|
@@ -14029,8 +14030,8 @@ var LinkAnnotationElement = class extends AnnotationElement {
|
|
|
14029
14030
|
const fieldIds = new Set(resetFormRefs);
|
|
14030
14031
|
for (const fieldName of resetFormFields) {
|
|
14031
14032
|
const fields = this._fieldObjects[fieldName] || [];
|
|
14032
|
-
for (const { id } of fields) {
|
|
14033
|
-
fieldIds.add(
|
|
14033
|
+
for (const { id: id2 } of fields) {
|
|
14034
|
+
fieldIds.add(id2);
|
|
14034
14035
|
}
|
|
14035
14036
|
}
|
|
14036
14037
|
for (const fields of Object.values(this._fieldObjects)) {
|
|
@@ -14048,34 +14049,34 @@ var LinkAnnotationElement = class extends AnnotationElement {
|
|
|
14048
14049
|
const storage = this.annotationStorage;
|
|
14049
14050
|
const allIds = [];
|
|
14050
14051
|
for (const field of allFields) {
|
|
14051
|
-
const { id } = field;
|
|
14052
|
-
allIds.push(
|
|
14052
|
+
const { id: id2 } = field;
|
|
14053
|
+
allIds.push(id2);
|
|
14053
14054
|
switch (field.type) {
|
|
14054
14055
|
case "text": {
|
|
14055
14056
|
const value = field.defaultValue || "";
|
|
14056
|
-
storage.setValue(
|
|
14057
|
+
storage.setValue(id2, { value });
|
|
14057
14058
|
break;
|
|
14058
14059
|
}
|
|
14059
14060
|
case "checkbox":
|
|
14060
14061
|
case "radiobutton": {
|
|
14061
14062
|
const value = field.defaultValue === field.exportValues;
|
|
14062
|
-
storage.setValue(
|
|
14063
|
+
storage.setValue(id2, { value });
|
|
14063
14064
|
break;
|
|
14064
14065
|
}
|
|
14065
14066
|
case "combobox":
|
|
14066
14067
|
case "listbox": {
|
|
14067
14068
|
const value = field.defaultValue || "";
|
|
14068
|
-
storage.setValue(
|
|
14069
|
+
storage.setValue(id2, { value });
|
|
14069
14070
|
break;
|
|
14070
14071
|
}
|
|
14071
14072
|
default:
|
|
14072
14073
|
continue;
|
|
14073
14074
|
}
|
|
14074
|
-
const domElement = document.querySelector(`[data-element-id="${
|
|
14075
|
+
const domElement = document.querySelector(`[data-element-id="${id2}"]`);
|
|
14075
14076
|
if (!domElement) {
|
|
14076
14077
|
continue;
|
|
14077
14078
|
} else if (!GetElementsByNameSet.has(domElement)) {
|
|
14078
|
-
warn(`_bindResetFormAction - element not allowed: ${
|
|
14079
|
+
warn(`_bindResetFormAction - element not allowed: ${id2}`);
|
|
14079
14080
|
continue;
|
|
14080
14081
|
}
|
|
14081
14082
|
domElement.dispatchEvent(new Event("resetform"));
|
|
@@ -14302,15 +14303,15 @@ var TextWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14302
14303
|
}
|
|
14303
14304
|
render() {
|
|
14304
14305
|
const storage = this.annotationStorage;
|
|
14305
|
-
const
|
|
14306
|
+
const id2 = this.data.id;
|
|
14306
14307
|
this.container.classList.add("textWidgetAnnotation");
|
|
14307
14308
|
let element = null;
|
|
14308
14309
|
if (this.renderForms) {
|
|
14309
|
-
const storedData = storage.getValue(
|
|
14310
|
+
const storedData = storage.getValue(id2, {
|
|
14310
14311
|
value: this.data.fieldValue
|
|
14311
14312
|
});
|
|
14312
14313
|
let textContent = storedData.value || "";
|
|
14313
|
-
const maxLen = storage.getValue(
|
|
14314
|
+
const maxLen = storage.getValue(id2, {
|
|
14314
14315
|
charLimit: this.data.maxLen
|
|
14315
14316
|
}).charLimit;
|
|
14316
14317
|
if (maxLen && textContent.length > maxLen) {
|
|
@@ -14345,7 +14346,7 @@ var TextWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14345
14346
|
element.hidden = true;
|
|
14346
14347
|
}
|
|
14347
14348
|
GetElementsByNameSet.add(element);
|
|
14348
|
-
element.setAttribute("data-element-id",
|
|
14349
|
+
element.setAttribute("data-element-id", id2);
|
|
14349
14350
|
element.disabled = this.data.readOnly;
|
|
14350
14351
|
element.name = this.data.fieldName;
|
|
14351
14352
|
element.tabIndex = 0;
|
|
@@ -14358,7 +14359,7 @@ var TextWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14358
14359
|
element.maxLength = maxLen;
|
|
14359
14360
|
}
|
|
14360
14361
|
element.addEventListener("input", (event) => {
|
|
14361
|
-
storage.setValue(
|
|
14362
|
+
storage.setValue(id2, { value: event.target.value });
|
|
14362
14363
|
this.setPropertyOnSiblings(
|
|
14363
14364
|
element,
|
|
14364
14365
|
"value",
|
|
@@ -14399,7 +14400,7 @@ var TextWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14399
14400
|
const actions = {
|
|
14400
14401
|
value(event) {
|
|
14401
14402
|
elementData.userValue = event.detail.value ?? "";
|
|
14402
|
-
storage.setValue(
|
|
14403
|
+
storage.setValue(id2, { value: elementData.userValue.toString() });
|
|
14403
14404
|
event.target.value = elementData.userValue;
|
|
14404
14405
|
},
|
|
14405
14406
|
formattedValue(event) {
|
|
@@ -14408,7 +14409,7 @@ var TextWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14408
14409
|
if (formattedValue !== null && formattedValue !== void 0 && event.target !== document.activeElement) {
|
|
14409
14410
|
event.target.value = formattedValue;
|
|
14410
14411
|
}
|
|
14411
|
-
storage.setValue(
|
|
14412
|
+
storage.setValue(id2, {
|
|
14412
14413
|
formattedValue
|
|
14413
14414
|
});
|
|
14414
14415
|
},
|
|
@@ -14429,11 +14430,11 @@ var TextWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14429
14430
|
}
|
|
14430
14431
|
value = value.slice(0, charLimit);
|
|
14431
14432
|
target.value = elementData.userValue = value;
|
|
14432
|
-
storage.setValue(
|
|
14433
|
+
storage.setValue(id2, { value });
|
|
14433
14434
|
this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
|
|
14434
14435
|
source: this,
|
|
14435
14436
|
detail: {
|
|
14436
|
-
id,
|
|
14437
|
+
id: id2,
|
|
14437
14438
|
name: "Keystroke",
|
|
14438
14439
|
value,
|
|
14439
14440
|
willCommit: true,
|
|
@@ -14468,7 +14469,7 @@ var TextWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14468
14469
|
this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
|
|
14469
14470
|
source: this,
|
|
14470
14471
|
detail: {
|
|
14471
|
-
id,
|
|
14472
|
+
id: id2,
|
|
14472
14473
|
name: "Keystroke",
|
|
14473
14474
|
value,
|
|
14474
14475
|
willCommit: true,
|
|
@@ -14493,7 +14494,7 @@ var TextWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14493
14494
|
this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
|
|
14494
14495
|
source: this,
|
|
14495
14496
|
detail: {
|
|
14496
|
-
id,
|
|
14497
|
+
id: id2,
|
|
14497
14498
|
name: "Keystroke",
|
|
14498
14499
|
value,
|
|
14499
14500
|
willCommit: true,
|
|
@@ -14542,7 +14543,7 @@ var TextWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14542
14543
|
this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
|
|
14543
14544
|
source: this,
|
|
14544
14545
|
detail: {
|
|
14545
|
-
id,
|
|
14546
|
+
id: id2,
|
|
14546
14547
|
name: "Keystroke",
|
|
14547
14548
|
value,
|
|
14548
14549
|
change: data || "",
|
|
@@ -14604,18 +14605,18 @@ var CheckboxWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14604
14605
|
render() {
|
|
14605
14606
|
const storage = this.annotationStorage;
|
|
14606
14607
|
const data = this.data;
|
|
14607
|
-
const
|
|
14608
|
-
let value = storage.getValue(
|
|
14608
|
+
const id2 = data.id;
|
|
14609
|
+
let value = storage.getValue(id2, {
|
|
14609
14610
|
value: data.exportValue === data.fieldValue
|
|
14610
14611
|
}).value;
|
|
14611
14612
|
if (typeof value === "string") {
|
|
14612
14613
|
value = value !== "Off";
|
|
14613
|
-
storage.setValue(
|
|
14614
|
+
storage.setValue(id2, { value });
|
|
14614
14615
|
}
|
|
14615
14616
|
this.container.classList.add("buttonWidgetAnnotation", "checkBox");
|
|
14616
14617
|
const element = document.createElement("input");
|
|
14617
14618
|
GetElementsByNameSet.add(element);
|
|
14618
|
-
element.setAttribute("data-element-id",
|
|
14619
|
+
element.setAttribute("data-element-id", id2);
|
|
14619
14620
|
element.disabled = data.readOnly;
|
|
14620
14621
|
this._setRequired(element, this.data.required);
|
|
14621
14622
|
element.type = "checkbox";
|
|
@@ -14630,7 +14631,7 @@ var CheckboxWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14630
14631
|
for (const checkbox of this._getElementsByName(
|
|
14631
14632
|
name,
|
|
14632
14633
|
/* skipId = */
|
|
14633
|
-
|
|
14634
|
+
id2
|
|
14634
14635
|
)) {
|
|
14635
14636
|
const curChecked = checked && checkbox.exportValue === data.exportValue;
|
|
14636
14637
|
if (checkbox.domElement) {
|
|
@@ -14638,7 +14639,7 @@ var CheckboxWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14638
14639
|
}
|
|
14639
14640
|
storage.setValue(checkbox.id, { value: curChecked });
|
|
14640
14641
|
}
|
|
14641
|
-
storage.setValue(
|
|
14642
|
+
storage.setValue(id2, { value: checked });
|
|
14642
14643
|
});
|
|
14643
14644
|
element.addEventListener("resetform", (event) => {
|
|
14644
14645
|
const defaultValue = data.defaultFieldValue || "Off";
|
|
@@ -14649,7 +14650,7 @@ var CheckboxWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14649
14650
|
const actions = {
|
|
14650
14651
|
value(event) {
|
|
14651
14652
|
event.target.checked = event.detail.value !== "Off";
|
|
14652
|
-
storage.setValue(
|
|
14653
|
+
storage.setValue(id2, { value: event.target.checked });
|
|
14653
14654
|
}
|
|
14654
14655
|
};
|
|
14655
14656
|
this._dispatchEventFromSandbox(actions, jsEvent);
|
|
@@ -14684,26 +14685,26 @@ var RadioButtonWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14684
14685
|
this.container.classList.add("buttonWidgetAnnotation", "radioButton");
|
|
14685
14686
|
const storage = this.annotationStorage;
|
|
14686
14687
|
const data = this.data;
|
|
14687
|
-
const
|
|
14688
|
-
let value = storage.getValue(
|
|
14688
|
+
const id2 = data.id;
|
|
14689
|
+
let value = storage.getValue(id2, {
|
|
14689
14690
|
value: data.fieldValue === data.buttonValue
|
|
14690
14691
|
}).value;
|
|
14691
14692
|
if (typeof value === "string") {
|
|
14692
14693
|
value = value !== data.buttonValue;
|
|
14693
|
-
storage.setValue(
|
|
14694
|
+
storage.setValue(id2, { value });
|
|
14694
14695
|
}
|
|
14695
14696
|
if (value) {
|
|
14696
14697
|
for (const radio of this._getElementsByName(
|
|
14697
14698
|
data.fieldName,
|
|
14698
14699
|
/* skipId = */
|
|
14699
|
-
|
|
14700
|
+
id2
|
|
14700
14701
|
)) {
|
|
14701
14702
|
storage.setValue(radio.id, { value: false });
|
|
14702
14703
|
}
|
|
14703
14704
|
}
|
|
14704
14705
|
const element = document.createElement("input");
|
|
14705
14706
|
GetElementsByNameSet.add(element);
|
|
14706
|
-
element.setAttribute("data-element-id",
|
|
14707
|
+
element.setAttribute("data-element-id", id2);
|
|
14707
14708
|
element.disabled = data.readOnly;
|
|
14708
14709
|
this._setRequired(element, this.data.required);
|
|
14709
14710
|
element.type = "radio";
|
|
@@ -14717,11 +14718,11 @@ var RadioButtonWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14717
14718
|
for (const radio of this._getElementsByName(
|
|
14718
14719
|
name,
|
|
14719
14720
|
/* skipId = */
|
|
14720
|
-
|
|
14721
|
+
id2
|
|
14721
14722
|
)) {
|
|
14722
14723
|
storage.setValue(radio.id, { value: false });
|
|
14723
14724
|
}
|
|
14724
|
-
storage.setValue(
|
|
14725
|
+
storage.setValue(id2, { value: checked });
|
|
14725
14726
|
});
|
|
14726
14727
|
element.addEventListener("resetform", (event) => {
|
|
14727
14728
|
const defaultValue = data.defaultFieldValue;
|
|
@@ -14734,7 +14735,7 @@ var RadioButtonWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14734
14735
|
value: (event) => {
|
|
14735
14736
|
const checked = pdfButtonValue === event.detail.value;
|
|
14736
14737
|
for (const radio of this._getElementsByName(event.target.name)) {
|
|
14737
|
-
const curChecked = checked && radio.id ===
|
|
14738
|
+
const curChecked = checked && radio.id === id2;
|
|
14738
14739
|
if (radio.domElement) {
|
|
14739
14740
|
radio.domElement.checked = curChecked;
|
|
14740
14741
|
}
|
|
@@ -14790,13 +14791,13 @@ var ChoiceWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14790
14791
|
render() {
|
|
14791
14792
|
this.container.classList.add("choiceWidgetAnnotation");
|
|
14792
14793
|
const storage = this.annotationStorage;
|
|
14793
|
-
const
|
|
14794
|
-
const storedData = storage.getValue(
|
|
14794
|
+
const id2 = this.data.id;
|
|
14795
|
+
const storedData = storage.getValue(id2, {
|
|
14795
14796
|
value: this.data.fieldValue
|
|
14796
14797
|
});
|
|
14797
14798
|
const selectElement = document.createElement("select");
|
|
14798
14799
|
GetElementsByNameSet.add(selectElement);
|
|
14799
|
-
selectElement.setAttribute("data-element-id",
|
|
14800
|
+
selectElement.setAttribute("data-element-id", id2);
|
|
14800
14801
|
selectElement.disabled = this.data.readOnly;
|
|
14801
14802
|
this._setRequired(selectElement, this.data.required);
|
|
14802
14803
|
selectElement.name = this.data.fieldName;
|
|
@@ -14867,7 +14868,7 @@ var ChoiceWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14867
14868
|
for (const option of selectElement.options) {
|
|
14868
14869
|
option.selected = values.has(option.value);
|
|
14869
14870
|
}
|
|
14870
|
-
storage.setValue(
|
|
14871
|
+
storage.setValue(id2, {
|
|
14871
14872
|
value: getValue(
|
|
14872
14873
|
/* isExport */
|
|
14873
14874
|
true
|
|
@@ -14895,7 +14896,7 @@ var ChoiceWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14895
14896
|
options[0].selected = true;
|
|
14896
14897
|
}
|
|
14897
14898
|
}
|
|
14898
|
-
storage.setValue(
|
|
14899
|
+
storage.setValue(id2, {
|
|
14899
14900
|
value: getValue(
|
|
14900
14901
|
/* isExport */
|
|
14901
14902
|
true
|
|
@@ -14911,7 +14912,7 @@ var ChoiceWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14911
14912
|
while (selectElement.length !== 0) {
|
|
14912
14913
|
selectElement.remove(0);
|
|
14913
14914
|
}
|
|
14914
|
-
storage.setValue(
|
|
14915
|
+
storage.setValue(id2, { value: null, items: [] });
|
|
14915
14916
|
selectedValues = getValue(
|
|
14916
14917
|
/* isExport */
|
|
14917
14918
|
false
|
|
@@ -14928,7 +14929,7 @@ var ChoiceWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14928
14929
|
} else {
|
|
14929
14930
|
selectElement.append(optionElement);
|
|
14930
14931
|
}
|
|
14931
|
-
storage.setValue(
|
|
14932
|
+
storage.setValue(id2, {
|
|
14932
14933
|
value: getValue(
|
|
14933
14934
|
/* isExport */
|
|
14934
14935
|
true
|
|
@@ -14955,7 +14956,7 @@ var ChoiceWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14955
14956
|
if (selectElement.options.length > 0) {
|
|
14956
14957
|
selectElement.options[0].selected = true;
|
|
14957
14958
|
}
|
|
14958
|
-
storage.setValue(
|
|
14959
|
+
storage.setValue(id2, {
|
|
14959
14960
|
value: getValue(
|
|
14960
14961
|
/* isExport */
|
|
14961
14962
|
true
|
|
@@ -14972,7 +14973,7 @@ var ChoiceWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14972
14973
|
for (const option of event.target.options) {
|
|
14973
14974
|
option.selected = indices.has(option.index);
|
|
14974
14975
|
}
|
|
14975
|
-
storage.setValue(
|
|
14976
|
+
storage.setValue(id2, {
|
|
14976
14977
|
value: getValue(
|
|
14977
14978
|
/* isExport */
|
|
14978
14979
|
true
|
|
@@ -14998,12 +14999,12 @@ var ChoiceWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
14998
14999
|
/* isExport */
|
|
14999
15000
|
false
|
|
15000
15001
|
);
|
|
15001
|
-
storage.setValue(
|
|
15002
|
+
storage.setValue(id2, { value: exportValue });
|
|
15002
15003
|
event.preventDefault();
|
|
15003
15004
|
this.linkService.eventBus?.dispatch("dispatcheventinsandbox", {
|
|
15004
15005
|
source: this,
|
|
15005
15006
|
detail: {
|
|
15006
|
-
id,
|
|
15007
|
+
id: id2,
|
|
15007
15008
|
name: "Keystroke",
|
|
15008
15009
|
value: selectedValues,
|
|
15009
15010
|
change,
|
|
@@ -15031,7 +15032,7 @@ var ChoiceWidgetAnnotationElement = class extends WidgetAnnotationElement {
|
|
|
15031
15032
|
);
|
|
15032
15033
|
} else {
|
|
15033
15034
|
selectElement.addEventListener("input", function(event) {
|
|
15034
|
-
storage.setValue(
|
|
15035
|
+
storage.setValue(id2, { value: getValue(
|
|
15035
15036
|
/* isExport */
|
|
15036
15037
|
true
|
|
15037
15038
|
) });
|
|
@@ -15080,7 +15081,7 @@ var PopupAnnotationElement = class extends AnnotationElement {
|
|
|
15080
15081
|
}
|
|
15081
15082
|
this.container.setAttribute(
|
|
15082
15083
|
"aria-controls",
|
|
15083
|
-
elementIds.map((
|
|
15084
|
+
elementIds.map((id2) => `${AnnotationPrefix}${id2}`).join(",")
|
|
15084
15085
|
);
|
|
15085
15086
|
return this.container;
|
|
15086
15087
|
}
|
|
@@ -16062,8 +16063,8 @@ var _AnnotationLayer = class _AnnotationLayer {
|
|
|
16062
16063
|
getEditableAnnotations() {
|
|
16063
16064
|
return Array.from(__privateGet(this, _editableAnnotations).values());
|
|
16064
16065
|
}
|
|
16065
|
-
getEditableAnnotation(
|
|
16066
|
-
return __privateGet(this, _editableAnnotations).get(
|
|
16066
|
+
getEditableAnnotation(id2) {
|
|
16067
|
+
return __privateGet(this, _editableAnnotations).get(id2);
|
|
16067
16068
|
}
|
|
16068
16069
|
/**
|
|
16069
16070
|
* @private
|
|
@@ -16088,9 +16089,9 @@ _annotationCanvasMap = new WeakMap();
|
|
|
16088
16089
|
_editableAnnotations = new WeakMap();
|
|
16089
16090
|
_structTreeLayer = new WeakMap();
|
|
16090
16091
|
_AnnotationLayer_instances = new WeakSet();
|
|
16091
|
-
appendElement_fn = async function(element,
|
|
16092
|
+
appendElement_fn = async function(element, id2, popupElements) {
|
|
16092
16093
|
const contentElement = element.firstChild || element;
|
|
16093
|
-
const annotationId = contentElement.id = `${AnnotationPrefix}${
|
|
16094
|
+
const annotationId = contentElement.id = `${AnnotationPrefix}${id2}`;
|
|
16094
16095
|
const ariaAttributes = await __privateGet(this, _structTreeLayer)?.getAriaAttributes(annotationId);
|
|
16095
16096
|
if (ariaAttributes) {
|
|
16096
16097
|
for (const [key, value] of ariaAttributes) {
|
|
@@ -16115,8 +16116,8 @@ setAnnotationCanvasMap_fn = function() {
|
|
|
16115
16116
|
return;
|
|
16116
16117
|
}
|
|
16117
16118
|
const layer = this.div;
|
|
16118
|
-
for (const [
|
|
16119
|
-
const element = layer.querySelector(`[data-annotation-id="${
|
|
16119
|
+
for (const [id2, canvas] of __privateGet(this, _annotationCanvasMap)) {
|
|
16120
|
+
const element = layer.querySelector(`[data-annotation-id="${id2}"]`);
|
|
16120
16121
|
if (!element) {
|
|
16121
16122
|
continue;
|
|
16122
16123
|
}
|
|
@@ -16131,13 +16132,13 @@ setAnnotationCanvasMap_fn = function() {
|
|
|
16131
16132
|
} else {
|
|
16132
16133
|
firstChild.after(canvas);
|
|
16133
16134
|
}
|
|
16134
|
-
const editableAnnotation = __privateGet(this, _editableAnnotations).get(
|
|
16135
|
+
const editableAnnotation = __privateGet(this, _editableAnnotations).get(id2);
|
|
16135
16136
|
if (!editableAnnotation) {
|
|
16136
16137
|
continue;
|
|
16137
16138
|
}
|
|
16138
16139
|
if (editableAnnotation._hasNoCanvas) {
|
|
16139
16140
|
this._annotationEditorUIManager?.setMissingCanvas(
|
|
16140
|
-
|
|
16141
|
+
id2,
|
|
16141
16142
|
element.id,
|
|
16142
16143
|
canvas
|
|
16143
16144
|
);
|
|
@@ -16653,7 +16654,7 @@ var _FreeTextEditor = class _FreeTextEditor extends AnnotationEditor {
|
|
|
16653
16654
|
defaultAppearanceData: { fontSize, fontColor },
|
|
16654
16655
|
rect,
|
|
16655
16656
|
rotation,
|
|
16656
|
-
id,
|
|
16657
|
+
id: id2,
|
|
16657
16658
|
popupRef
|
|
16658
16659
|
},
|
|
16659
16660
|
textContent,
|
|
@@ -16674,8 +16675,8 @@ var _FreeTextEditor = class _FreeTextEditor extends AnnotationEditor {
|
|
|
16674
16675
|
pageIndex: pageNumber - 1,
|
|
16675
16676
|
rect: rect.slice(0),
|
|
16676
16677
|
rotation,
|
|
16677
|
-
annotationElementId:
|
|
16678
|
-
id,
|
|
16678
|
+
annotationElementId: id2,
|
|
16679
|
+
id: id2,
|
|
16679
16680
|
deleted: false,
|
|
16680
16681
|
popupRef
|
|
16681
16682
|
};
|
|
@@ -18482,7 +18483,7 @@ var _HighlightEditor = class _HighlightEditor extends AnnotationEditor {
|
|
|
18482
18483
|
let initialData = null;
|
|
18483
18484
|
if (data instanceof HighlightAnnotationElement) {
|
|
18484
18485
|
const {
|
|
18485
|
-
data: { quadPoints: quadPoints2, rect, rotation, id, color: color2, opacity: opacity2, popupRef },
|
|
18486
|
+
data: { quadPoints: quadPoints2, rect, rotation, id: id2, color: color2, opacity: opacity2, popupRef },
|
|
18486
18487
|
parent: {
|
|
18487
18488
|
page: { pageNumber }
|
|
18488
18489
|
}
|
|
@@ -18496,8 +18497,8 @@ var _HighlightEditor = class _HighlightEditor extends AnnotationEditor {
|
|
|
18496
18497
|
pageIndex: pageNumber - 1,
|
|
18497
18498
|
rect: rect.slice(0),
|
|
18498
18499
|
rotation,
|
|
18499
|
-
annotationElementId:
|
|
18500
|
-
id,
|
|
18500
|
+
annotationElementId: id2,
|
|
18501
|
+
id: id2,
|
|
18501
18502
|
deleted: false,
|
|
18502
18503
|
popupRef
|
|
18503
18504
|
};
|
|
@@ -18507,7 +18508,7 @@ var _HighlightEditor = class _HighlightEditor extends AnnotationEditor {
|
|
|
18507
18508
|
inkLists: inkLists2,
|
|
18508
18509
|
rect,
|
|
18509
18510
|
rotation,
|
|
18510
|
-
id,
|
|
18511
|
+
id: id2,
|
|
18511
18512
|
color: color2,
|
|
18512
18513
|
borderStyle: { rawWidth: thickness },
|
|
18513
18514
|
popupRef
|
|
@@ -18525,8 +18526,8 @@ var _HighlightEditor = class _HighlightEditor extends AnnotationEditor {
|
|
|
18525
18526
|
pageIndex: pageNumber - 1,
|
|
18526
18527
|
rect: rect.slice(0),
|
|
18527
18528
|
rotation,
|
|
18528
|
-
annotationElementId:
|
|
18529
|
-
id,
|
|
18529
|
+
annotationElementId: id2,
|
|
18530
|
+
id: id2,
|
|
18530
18531
|
deleted: false,
|
|
18531
18532
|
popupRef
|
|
18532
18533
|
};
|
|
@@ -18574,7 +18575,7 @@ var _HighlightEditor = class _HighlightEditor extends AnnotationEditor {
|
|
|
18574
18575
|
point.y = pageHeight - (points[i + 1] - pageY);
|
|
18575
18576
|
outliner.add(point);
|
|
18576
18577
|
}
|
|
18577
|
-
const { id, clipPathId } = parent.drawLayer.draw(
|
|
18578
|
+
const { id: id2, clipPathId } = parent.drawLayer.draw(
|
|
18578
18579
|
{
|
|
18579
18580
|
bbox: [0, 0, 1, 1],
|
|
18580
18581
|
root: {
|
|
@@ -18597,7 +18598,7 @@ var _HighlightEditor = class _HighlightEditor extends AnnotationEditor {
|
|
|
18597
18598
|
);
|
|
18598
18599
|
__privateMethod(_c = editor, _HighlightEditor_instances, createFreeOutlines_fn).call(_c, {
|
|
18599
18600
|
highlightOutlines: outliner.getOutlines(),
|
|
18600
|
-
highlightId:
|
|
18601
|
+
highlightId: id2,
|
|
18601
18602
|
clipPathId
|
|
18602
18603
|
});
|
|
18603
18604
|
__privateMethod(_d = editor, _HighlightEditor_instances, addToDrawLayer_fn).call(_d);
|
|
@@ -19652,7 +19653,7 @@ createDrawOutlines_fn = function({ drawOutlines, drawId, drawingOptions }) {
|
|
|
19652
19653
|
__privateMethod(this, _DrawingEditor_instances, updateBbox_fn).call(this, drawOutlines.box);
|
|
19653
19654
|
};
|
|
19654
19655
|
createDrawing_fn = function(drawOutlines, parent) {
|
|
19655
|
-
const { id } = parent.drawLayer.draw(
|
|
19656
|
+
const { id: id2 } = parent.drawLayer.draw(
|
|
19656
19657
|
_DrawingEditor._mergeSVGProperties(
|
|
19657
19658
|
this._drawingOptions.toSVGProperties(),
|
|
19658
19659
|
drawOutlines.defaultSVGProperties
|
|
@@ -19662,7 +19663,7 @@ createDrawing_fn = function(drawOutlines, parent) {
|
|
|
19662
19663
|
/* hasClip = */
|
|
19663
19664
|
false
|
|
19664
19665
|
);
|
|
19665
|
-
return
|
|
19666
|
+
return id2;
|
|
19666
19667
|
};
|
|
19667
19668
|
cleanDrawLayer_fn2 = function() {
|
|
19668
19669
|
if (this._drawId === null || !this.parent) {
|
|
@@ -20646,7 +20647,7 @@ var _InkEditor = class _InkEditor extends DrawingEditor {
|
|
|
20646
20647
|
inkLists,
|
|
20647
20648
|
rect,
|
|
20648
20649
|
rotation,
|
|
20649
|
-
id,
|
|
20650
|
+
id: id2,
|
|
20650
20651
|
color,
|
|
20651
20652
|
opacity,
|
|
20652
20653
|
borderStyle: { rawWidth: thickness },
|
|
@@ -20666,8 +20667,8 @@ var _InkEditor = class _InkEditor extends DrawingEditor {
|
|
|
20666
20667
|
pageIndex: pageNumber - 1,
|
|
20667
20668
|
rect: rect.slice(0),
|
|
20668
20669
|
rotation,
|
|
20669
|
-
annotationElementId:
|
|
20670
|
-
id,
|
|
20670
|
+
annotationElementId: id2,
|
|
20671
|
+
id: id2,
|
|
20671
20672
|
deleted: false,
|
|
20672
20673
|
popupRef
|
|
20673
20674
|
};
|
|
@@ -21064,9 +21065,9 @@ neighborIndexToId_fn = function(i0, j0, i, j) {
|
|
|
21064
21065
|
};
|
|
21065
21066
|
_neighborIdToIndex = new WeakMap();
|
|
21066
21067
|
clockwiseNonZero_fn = function(buf, width, i0, j0, i, j, offset) {
|
|
21067
|
-
const
|
|
21068
|
+
const id2 = __privateMethod(this, _SignatureExtractor_static, neighborIndexToId_fn).call(this, i0, j0, i, j);
|
|
21068
21069
|
for (let k = 0; k < 8; k++) {
|
|
21069
|
-
const kk = (-k +
|
|
21070
|
+
const kk = (-k + id2 - offset + 16) % 8;
|
|
21070
21071
|
const shiftI = __privateGet(this, _neighborIdToIndex)[2 * kk];
|
|
21071
21072
|
const shiftJ = __privateGet(this, _neighborIdToIndex)[2 * kk + 1];
|
|
21072
21073
|
if (buf[(i0 + shiftI) * width + (j0 + shiftJ)] !== 0) {
|
|
@@ -21076,9 +21077,9 @@ clockwiseNonZero_fn = function(buf, width, i0, j0, i, j, offset) {
|
|
|
21076
21077
|
return -1;
|
|
21077
21078
|
};
|
|
21078
21079
|
counterClockwiseNonZero_fn = function(buf, width, i0, j0, i, j, offset) {
|
|
21079
|
-
const
|
|
21080
|
+
const id2 = __privateMethod(this, _SignatureExtractor_static, neighborIndexToId_fn).call(this, i0, j0, i, j);
|
|
21080
21081
|
for (let k = 0; k < 8; k++) {
|
|
21081
|
-
const kk = (k +
|
|
21082
|
+
const kk = (k + id2 + offset + 16) % 8;
|
|
21082
21083
|
const shiftI = __privateGet(this, _neighborIdToIndex)[2 * kk];
|
|
21083
21084
|
const shiftJ = __privateGet(this, _neighborIdToIndex)[2 * kk + 1];
|
|
21084
21085
|
if (buf[(i0 + shiftI) * width + (j0 + shiftJ)] !== 0) {
|
|
@@ -22102,7 +22103,7 @@ var StampEditor = class extends AnnotationEditor {
|
|
|
22102
22103
|
let missingCanvas = false;
|
|
22103
22104
|
if (data instanceof StampAnnotationElement) {
|
|
22104
22105
|
const {
|
|
22105
|
-
data: { rect: rect2, rotation, id, structParent, popupRef },
|
|
22106
|
+
data: { rect: rect2, rotation, id: id2, structParent, popupRef },
|
|
22106
22107
|
container,
|
|
22107
22108
|
parent: {
|
|
22108
22109
|
page: { pageNumber }
|
|
@@ -22121,7 +22122,7 @@ var StampEditor = class extends AnnotationEditor {
|
|
|
22121
22122
|
missingCanvas = true;
|
|
22122
22123
|
data._hasNoCanvas = true;
|
|
22123
22124
|
}
|
|
22124
|
-
const altText = (await parent._structTree.getAriaAttributes(`${AnnotationPrefix}${
|
|
22125
|
+
const altText = (await parent._structTree.getAriaAttributes(`${AnnotationPrefix}${id2}`))?.get("aria-label") || "";
|
|
22125
22126
|
initialData = data = {
|
|
22126
22127
|
annotationType: AnnotationEditorType.STAMP,
|
|
22127
22128
|
bitmapId: bitmapId2,
|
|
@@ -22129,8 +22130,8 @@ var StampEditor = class extends AnnotationEditor {
|
|
|
22129
22130
|
pageIndex: pageNumber - 1,
|
|
22130
22131
|
rect: rect2.slice(0),
|
|
22131
22132
|
rotation,
|
|
22132
|
-
annotationElementId:
|
|
22133
|
-
id,
|
|
22133
|
+
annotationElementId: id2,
|
|
22134
|
+
id: id2,
|
|
22134
22135
|
deleted: false,
|
|
22135
22136
|
accessibilityData: {
|
|
22136
22137
|
decorative: false,
|
|
@@ -22735,18 +22736,18 @@ var _AnnotationEditorLayer = class _AnnotationEditorLayer {
|
|
|
22735
22736
|
if (!this.div.contains(elements[0])) {
|
|
22736
22737
|
return;
|
|
22737
22738
|
}
|
|
22738
|
-
let
|
|
22739
|
+
let id2;
|
|
22739
22740
|
const regex = new RegExp(`^${AnnotationEditorPrefix}[0-9]+$`);
|
|
22740
22741
|
for (const element of elements) {
|
|
22741
22742
|
if (regex.test(element.id)) {
|
|
22742
|
-
|
|
22743
|
+
id2 = element.id;
|
|
22743
22744
|
break;
|
|
22744
22745
|
}
|
|
22745
22746
|
}
|
|
22746
|
-
if (!
|
|
22747
|
+
if (!id2) {
|
|
22747
22748
|
return;
|
|
22748
22749
|
}
|
|
22749
|
-
const editor = __privateGet(this, _editors).get(
|
|
22750
|
+
const editor = __privateGet(this, _editors).get(id2);
|
|
22750
22751
|
if (editor?.annotationElementId === null) {
|
|
22751
22752
|
e.stopPropagation();
|
|
22752
22753
|
e.preventDefault();
|
|
@@ -22775,18 +22776,18 @@ var _AnnotationEditorLayer = class _AnnotationEditorLayer {
|
|
|
22775
22776
|
if (__privateGet(this, _annotationLayer)) {
|
|
22776
22777
|
const editables = __privateGet(this, _annotationLayer).getEditableAnnotations();
|
|
22777
22778
|
for (const editable of editables) {
|
|
22778
|
-
const { id } = editable.data;
|
|
22779
|
-
if (__privateGet(this, _uiManager3).isDeletedAnnotationElement(
|
|
22779
|
+
const { id: id2 } = editable.data;
|
|
22780
|
+
if (__privateGet(this, _uiManager3).isDeletedAnnotationElement(id2)) {
|
|
22780
22781
|
continue;
|
|
22781
22782
|
}
|
|
22782
|
-
let editor = resetAnnotations.get(
|
|
22783
|
+
let editor = resetAnnotations.get(id2);
|
|
22783
22784
|
if (editor) {
|
|
22784
22785
|
editor.resetAnnotationElement(editable);
|
|
22785
22786
|
editor.show(false);
|
|
22786
22787
|
editable.show();
|
|
22787
22788
|
continue;
|
|
22788
22789
|
}
|
|
22789
|
-
editor = changedAnnotations.get(
|
|
22790
|
+
editor = changedAnnotations.get(id2);
|
|
22790
22791
|
if (editor) {
|
|
22791
22792
|
__privateGet(this, _uiManager3).addChangedExistingAnnotation(editor);
|
|
22792
22793
|
if (editor.renderAnnotationElement(editable)) {
|
|
@@ -22808,8 +22809,8 @@ var _AnnotationEditorLayer = class _AnnotationEditorLayer {
|
|
|
22808
22809
|
this.toggleAnnotationLayerPointerEvents(true);
|
|
22809
22810
|
__privateSet(this, _isDisabling, false);
|
|
22810
22811
|
}
|
|
22811
|
-
getEditableAnnotation(
|
|
22812
|
-
return __privateGet(this, _annotationLayer)?.getEditableAnnotation(
|
|
22812
|
+
getEditableAnnotation(id2) {
|
|
22813
|
+
return __privateGet(this, _annotationLayer)?.getEditableAnnotation(id2) || null;
|
|
22813
22814
|
}
|
|
22814
22815
|
/**
|
|
22815
22816
|
* Set the current editor.
|
|
@@ -23007,10 +23008,10 @@ var _AnnotationEditorLayer = class _AnnotationEditorLayer {
|
|
|
23007
23008
|
this.updateToolbar(options);
|
|
23008
23009
|
await __privateGet(this, _uiManager3).updateMode(options.mode);
|
|
23009
23010
|
const { offsetX, offsetY } = __privateMethod(this, _AnnotationEditorLayer_instances, getCenterPoint_fn).call(this);
|
|
23010
|
-
const
|
|
23011
|
+
const id2 = this.getNextId();
|
|
23011
23012
|
const editor = __privateMethod(this, _AnnotationEditorLayer_instances, createNewEditor_fn).call(this, {
|
|
23012
23013
|
parent: this,
|
|
23013
|
-
id,
|
|
23014
|
+
id: id2,
|
|
23014
23015
|
x: offsetX,
|
|
23015
23016
|
y: offsetY,
|
|
23016
23017
|
uiManager: __privateGet(this, _uiManager3),
|
|
@@ -23037,10 +23038,10 @@ var _AnnotationEditorLayer = class _AnnotationEditorLayer {
|
|
|
23037
23038
|
* @returns {AnnotationEditor}
|
|
23038
23039
|
*/
|
|
23039
23040
|
createAndAddNewEditor(event, isCentered, data = {}) {
|
|
23040
|
-
const
|
|
23041
|
+
const id2 = this.getNextId();
|
|
23041
23042
|
const editor = __privateMethod(this, _AnnotationEditorLayer_instances, createNewEditor_fn).call(this, {
|
|
23042
23043
|
parent: this,
|
|
23043
|
-
id,
|
|
23044
|
+
id: id2,
|
|
23044
23045
|
x: event.offsetX,
|
|
23045
23046
|
y: event.offsetY,
|
|
23046
23047
|
uiManager: __privateGet(this, _uiManager3),
|
|
@@ -23407,41 +23408,41 @@ var _DrawLayer = class _DrawLayer {
|
|
|
23407
23408
|
return shadow(this, "_svgFactory", new DOMSVGFactory());
|
|
23408
23409
|
}
|
|
23409
23410
|
draw(properties, isPathUpdatable = false, hasClip = false) {
|
|
23410
|
-
const
|
|
23411
|
+
const id2 = __privateWrapper(_DrawLayer, _id4)._++;
|
|
23411
23412
|
const root = __privateMethod(this, _DrawLayer_instances, createSVG_fn).call(this);
|
|
23412
23413
|
const defs = _DrawLayer._svgFactory.createElement("defs");
|
|
23413
23414
|
root.append(defs);
|
|
23414
23415
|
const path = _DrawLayer._svgFactory.createElement("path");
|
|
23415
23416
|
defs.append(path);
|
|
23416
|
-
const pathId = `path_p${this.pageIndex}_${
|
|
23417
|
+
const pathId = `path_p${this.pageIndex}_${id2}`;
|
|
23417
23418
|
path.setAttribute("id", pathId);
|
|
23418
23419
|
path.setAttribute("vector-effect", "non-scaling-stroke");
|
|
23419
23420
|
if (isPathUpdatable) {
|
|
23420
|
-
__privateGet(this, _toUpdate).set(
|
|
23421
|
+
__privateGet(this, _toUpdate).set(id2, path);
|
|
23421
23422
|
}
|
|
23422
23423
|
const clipPathId = hasClip ? __privateMethod(this, _DrawLayer_instances, createClipPath_fn).call(this, defs, pathId) : null;
|
|
23423
23424
|
const use = _DrawLayer._svgFactory.createElement("use");
|
|
23424
23425
|
root.append(use);
|
|
23425
23426
|
use.setAttribute("href", `#${pathId}`);
|
|
23426
23427
|
this.updateProperties(root, properties);
|
|
23427
|
-
__privateGet(this, _mapping).set(
|
|
23428
|
-
return { id, clipPathId: `url(#${clipPathId})` };
|
|
23428
|
+
__privateGet(this, _mapping).set(id2, root);
|
|
23429
|
+
return { id: id2, clipPathId: `url(#${clipPathId})` };
|
|
23429
23430
|
}
|
|
23430
23431
|
drawOutline(properties, mustRemoveSelfIntersections) {
|
|
23431
|
-
const
|
|
23432
|
+
const id2 = __privateWrapper(_DrawLayer, _id4)._++;
|
|
23432
23433
|
const root = __privateMethod(this, _DrawLayer_instances, createSVG_fn).call(this);
|
|
23433
23434
|
const defs = _DrawLayer._svgFactory.createElement("defs");
|
|
23434
23435
|
root.append(defs);
|
|
23435
23436
|
const path = _DrawLayer._svgFactory.createElement("path");
|
|
23436
23437
|
defs.append(path);
|
|
23437
|
-
const pathId = `path_p${this.pageIndex}_${
|
|
23438
|
+
const pathId = `path_p${this.pageIndex}_${id2}`;
|
|
23438
23439
|
path.setAttribute("id", pathId);
|
|
23439
23440
|
path.setAttribute("vector-effect", "non-scaling-stroke");
|
|
23440
23441
|
let maskId;
|
|
23441
23442
|
if (mustRemoveSelfIntersections) {
|
|
23442
23443
|
const mask = _DrawLayer._svgFactory.createElement("mask");
|
|
23443
23444
|
defs.append(mask);
|
|
23444
|
-
maskId = `mask_p${this.pageIndex}_${
|
|
23445
|
+
maskId = `mask_p${this.pageIndex}_${id2}`;
|
|
23445
23446
|
mask.setAttribute("id", maskId);
|
|
23446
23447
|
mask.setAttribute("maskUnits", "objectBoundingBox");
|
|
23447
23448
|
const rect = _DrawLayer._svgFactory.createElement("rect");
|
|
@@ -23468,12 +23469,12 @@ var _DrawLayer = class _DrawLayer {
|
|
|
23468
23469
|
use1.classList.add("mainOutline");
|
|
23469
23470
|
use2.classList.add("secondaryOutline");
|
|
23470
23471
|
this.updateProperties(root, properties);
|
|
23471
|
-
__privateGet(this, _mapping).set(
|
|
23472
|
-
return
|
|
23472
|
+
__privateGet(this, _mapping).set(id2, root);
|
|
23473
|
+
return id2;
|
|
23473
23474
|
}
|
|
23474
|
-
finalizeDraw(
|
|
23475
|
-
__privateGet(this, _toUpdate).delete(
|
|
23476
|
-
this.updateProperties(
|
|
23475
|
+
finalizeDraw(id2, properties) {
|
|
23476
|
+
__privateGet(this, _toUpdate).delete(id2);
|
|
23477
|
+
this.updateProperties(id2, properties);
|
|
23477
23478
|
}
|
|
23478
23479
|
updateProperties(elementOrId, properties) {
|
|
23479
23480
|
var _a2;
|
|
@@ -23503,25 +23504,25 @@ var _DrawLayer = class _DrawLayer {
|
|
|
23503
23504
|
__privateMethod(this, _DrawLayer_instances, updateProperties_fn).call(this, pathElement, path);
|
|
23504
23505
|
}
|
|
23505
23506
|
}
|
|
23506
|
-
updateParent(
|
|
23507
|
+
updateParent(id2, layer) {
|
|
23507
23508
|
if (layer === this) {
|
|
23508
23509
|
return;
|
|
23509
23510
|
}
|
|
23510
|
-
const root = __privateGet(this, _mapping).get(
|
|
23511
|
+
const root = __privateGet(this, _mapping).get(id2);
|
|
23511
23512
|
if (!root) {
|
|
23512
23513
|
return;
|
|
23513
23514
|
}
|
|
23514
23515
|
__privateGet(layer, _parent2).append(root);
|
|
23515
|
-
__privateGet(this, _mapping).delete(
|
|
23516
|
-
__privateGet(layer, _mapping).set(
|
|
23516
|
+
__privateGet(this, _mapping).delete(id2);
|
|
23517
|
+
__privateGet(layer, _mapping).set(id2, root);
|
|
23517
23518
|
}
|
|
23518
|
-
remove(
|
|
23519
|
-
__privateGet(this, _toUpdate).delete(
|
|
23519
|
+
remove(id2) {
|
|
23520
|
+
__privateGet(this, _toUpdate).delete(id2);
|
|
23520
23521
|
if (__privateGet(this, _parent2) === null) {
|
|
23521
23522
|
return;
|
|
23522
23523
|
}
|
|
23523
|
-
__privateGet(this, _mapping).get(
|
|
23524
|
-
__privateGet(this, _mapping).delete(
|
|
23524
|
+
__privateGet(this, _mapping).get(id2).remove();
|
|
23525
|
+
__privateGet(this, _mapping).delete(id2);
|
|
23525
23526
|
}
|
|
23526
23527
|
destroy() {
|
|
23527
23528
|
__privateSet(this, _parent2, null);
|
|
@@ -23670,15 +23671,93 @@ var AnnotationOperatorsList = class {
|
|
|
23670
23671
|
* @param id The id of the annotation.
|
|
23671
23672
|
* @return The list of operators for the given annotation id.
|
|
23672
23673
|
*/
|
|
23673
|
-
get(
|
|
23674
|
-
return this.map.get(
|
|
23674
|
+
get(id2) {
|
|
23675
|
+
return this.map.get(id2) ?? [];
|
|
23675
23676
|
}
|
|
23676
23677
|
};
|
|
23677
23678
|
|
|
23678
|
-
// src/lib/
|
|
23679
|
-
function
|
|
23680
|
-
|
|
23681
|
-
|
|
23679
|
+
// src/lib/Svg.ts
|
|
23680
|
+
function isSvgElement(node) {
|
|
23681
|
+
return "children" in node;
|
|
23682
|
+
}
|
|
23683
|
+
function isSvgPath(node) {
|
|
23684
|
+
return node.tag === "path";
|
|
23685
|
+
}
|
|
23686
|
+
function isSvgImage(node) {
|
|
23687
|
+
return node.tag === "image";
|
|
23688
|
+
}
|
|
23689
|
+
function isSvgMarkedContent(node) {
|
|
23690
|
+
return node.tag === "use" && "type" in node.attrs;
|
|
23691
|
+
}
|
|
23692
|
+
function isSvgRoot(node) {
|
|
23693
|
+
return node.tag === "svg";
|
|
23694
|
+
}
|
|
23695
|
+
function id(type, id2 = null, scope) {
|
|
23696
|
+
return [type, scope, id2 ?? crypto.randomUUID()].filter(Boolean).join("_");
|
|
23697
|
+
}
|
|
23698
|
+
function findSvgNode(root, matcher) {
|
|
23699
|
+
for (const child of root.children) {
|
|
23700
|
+
if (typeof child === "string") {
|
|
23701
|
+
continue;
|
|
23702
|
+
}
|
|
23703
|
+
if (matcher(child)) {
|
|
23704
|
+
return child;
|
|
23705
|
+
}
|
|
23706
|
+
if (isSvgElement(child)) {
|
|
23707
|
+
const result = findSvgNode(child, matcher);
|
|
23708
|
+
if (result) {
|
|
23709
|
+
return result;
|
|
23710
|
+
}
|
|
23711
|
+
}
|
|
23712
|
+
}
|
|
23713
|
+
return null;
|
|
23714
|
+
}
|
|
23715
|
+
function parseNumberList(input) {
|
|
23716
|
+
return input.trim().replace(/[\s,]+/g, " ").split(" ").filter(Boolean).map(Number);
|
|
23717
|
+
}
|
|
23718
|
+
function parseTransform(input) {
|
|
23719
|
+
if (!input) {
|
|
23720
|
+
return new DOMMatrix();
|
|
23721
|
+
}
|
|
23722
|
+
const result = new DOMMatrix();
|
|
23723
|
+
const regex = /([a-zA-Z]+)\s*\(([^)]*)\)/g;
|
|
23724
|
+
let match = regex.exec(input);
|
|
23725
|
+
while (match) {
|
|
23726
|
+
const k = match[1];
|
|
23727
|
+
const nums = parseNumberList(match[2]);
|
|
23728
|
+
let t = new DOMMatrix();
|
|
23729
|
+
switch (k) {
|
|
23730
|
+
case "matrix":
|
|
23731
|
+
if (nums.length >= 6) {
|
|
23732
|
+
t = new DOMMatrix(nums);
|
|
23733
|
+
}
|
|
23734
|
+
break;
|
|
23735
|
+
case "translate":
|
|
23736
|
+
t = new DOMMatrix().translate(nums[0] || 0, nums[1] || 0);
|
|
23737
|
+
break;
|
|
23738
|
+
case "scale":
|
|
23739
|
+
t = new DOMMatrix().scale(nums[0] ?? 1, nums[1] ?? nums[0] ?? 1);
|
|
23740
|
+
break;
|
|
23741
|
+
case "rotate": {
|
|
23742
|
+
const angle = (nums[0] || 0) * Math.PI / 180;
|
|
23743
|
+
if (nums.length >= 3) {
|
|
23744
|
+
t = new DOMMatrix().translate(nums[1], nums[2]).rotate(angle).translate(-nums[1], -nums[2]);
|
|
23745
|
+
} else {
|
|
23746
|
+
t = new DOMMatrix().rotate(angle);
|
|
23747
|
+
}
|
|
23748
|
+
break;
|
|
23749
|
+
}
|
|
23750
|
+
case "skewX":
|
|
23751
|
+
t = new DOMMatrix().skewX((nums[0] || 0) * Math.PI / 180);
|
|
23752
|
+
break;
|
|
23753
|
+
case "skewY":
|
|
23754
|
+
t = new DOMMatrix().skewY((nums[0] || 0) * Math.PI / 180);
|
|
23755
|
+
break;
|
|
23756
|
+
}
|
|
23757
|
+
result.multiplySelf(t);
|
|
23758
|
+
match = regex.exec(input);
|
|
23759
|
+
}
|
|
23760
|
+
return result;
|
|
23682
23761
|
}
|
|
23683
23762
|
function matrixToTransform(matrix) {
|
|
23684
23763
|
return `matrix(${matrix.a}, ${matrix.b}, ${matrix.c}, ${matrix.d}, ${matrix.e}, ${matrix.f})`;
|
|
@@ -23705,20 +23784,6 @@ function parseFontStyle(fontString) {
|
|
|
23705
23784
|
fontFamilies: match.groups?.family ? match.groups.family.split(",").map((entry) => entry.trim().replace(/^"/, "").replace(/"$/, "")) : ["serif"]
|
|
23706
23785
|
};
|
|
23707
23786
|
}
|
|
23708
|
-
function parseRGBAColor(color) {
|
|
23709
|
-
const match = color.match(
|
|
23710
|
-
/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)$/
|
|
23711
|
-
);
|
|
23712
|
-
if (!match) {
|
|
23713
|
-
return { r: 0, g: 0, b: 0, a: 1 };
|
|
23714
|
-
}
|
|
23715
|
-
return {
|
|
23716
|
-
r: Number.parseInt(match[1], 10),
|
|
23717
|
-
g: Number.parseInt(match[2], 10),
|
|
23718
|
-
b: Number.parseInt(match[3], 10),
|
|
23719
|
-
a: match[4] ? Number.parseFloat(match[4]) : 1
|
|
23720
|
-
};
|
|
23721
|
-
}
|
|
23722
23787
|
function getTextAnchor(textAlign) {
|
|
23723
23788
|
switch (textAlign) {
|
|
23724
23789
|
case "left":
|
|
@@ -23753,6 +23818,195 @@ function getAngle(vector) {
|
|
|
23753
23818
|
}
|
|
23754
23819
|
return -Math.acos(vector[0]);
|
|
23755
23820
|
}
|
|
23821
|
+
function sampleEllipse(cx, cy, rx, ry, steps) {
|
|
23822
|
+
const pts = [];
|
|
23823
|
+
for (let i = 0; i < steps; i++) {
|
|
23824
|
+
const t = i / steps * 2 * Math.PI;
|
|
23825
|
+
pts.push({ x: cx + rx * Math.cos(t), y: cy + ry * Math.sin(t) });
|
|
23826
|
+
}
|
|
23827
|
+
pts.push({ x: cx + rx, y: cy });
|
|
23828
|
+
return pts;
|
|
23829
|
+
}
|
|
23830
|
+
function outlinePoints(node, defs = [], inheritedMatrix = new DOMMatrix()) {
|
|
23831
|
+
const transformMatrix = node.attrs.transform ? inheritedMatrix.multiply(parseTransform(node.attrs.transform)) : inheritedMatrix;
|
|
23832
|
+
const points = [];
|
|
23833
|
+
const addPoint = (p) => {
|
|
23834
|
+
const tp = transformMatrix.transformPoint(new DOMPoint(p.x, p.y));
|
|
23835
|
+
points.push({
|
|
23836
|
+
x: tp.x,
|
|
23837
|
+
y: tp.y
|
|
23838
|
+
});
|
|
23839
|
+
};
|
|
23840
|
+
switch (node.tag) {
|
|
23841
|
+
case "image":
|
|
23842
|
+
case "rect": {
|
|
23843
|
+
const x = node.attrs.x || 0;
|
|
23844
|
+
const y = node.attrs.y || 0;
|
|
23845
|
+
const w = node.attrs.width || 0;
|
|
23846
|
+
const h = node.attrs.height || 0;
|
|
23847
|
+
addPoint({ x, y });
|
|
23848
|
+
addPoint({ x: x + w, y });
|
|
23849
|
+
addPoint({ x: x + w, y: y + h });
|
|
23850
|
+
addPoint({ x, y: y + h });
|
|
23851
|
+
break;
|
|
23852
|
+
}
|
|
23853
|
+
case "line": {
|
|
23854
|
+
addPoint({
|
|
23855
|
+
x: node.attrs.x1 || 0,
|
|
23856
|
+
y: node.attrs.y1 || 0
|
|
23857
|
+
});
|
|
23858
|
+
addPoint({
|
|
23859
|
+
x: node.attrs.x2 || 0,
|
|
23860
|
+
y: node.attrs.y2 || 0
|
|
23861
|
+
});
|
|
23862
|
+
break;
|
|
23863
|
+
}
|
|
23864
|
+
case "polyline":
|
|
23865
|
+
case "polygon": {
|
|
23866
|
+
const raw = parseNumberList(node.attrs.points || "");
|
|
23867
|
+
for (let i = 0; i + 1 < raw.length; i += 2) {
|
|
23868
|
+
addPoint({ x: raw[i], y: raw[i + 1] });
|
|
23869
|
+
}
|
|
23870
|
+
break;
|
|
23871
|
+
}
|
|
23872
|
+
case "circle": {
|
|
23873
|
+
const cx = node.attrs.cx || 0;
|
|
23874
|
+
const cy = node.attrs.cy || 0;
|
|
23875
|
+
const r = node.attrs.r || 0;
|
|
23876
|
+
for (const p of sampleEllipse(
|
|
23877
|
+
cx,
|
|
23878
|
+
cy,
|
|
23879
|
+
r,
|
|
23880
|
+
r,
|
|
23881
|
+
Math.max(12, Math.ceil(r / 2))
|
|
23882
|
+
)) {
|
|
23883
|
+
addPoint(p);
|
|
23884
|
+
}
|
|
23885
|
+
break;
|
|
23886
|
+
}
|
|
23887
|
+
case "ellipse": {
|
|
23888
|
+
const cx = node.attrs.cx || 0;
|
|
23889
|
+
const cy = node.attrs.cy || 0;
|
|
23890
|
+
const rx = node.attrs.rx || 0;
|
|
23891
|
+
const ry = node.attrs.ry || 0;
|
|
23892
|
+
for (const p of sampleEllipse(
|
|
23893
|
+
cx,
|
|
23894
|
+
cy,
|
|
23895
|
+
rx,
|
|
23896
|
+
ry,
|
|
23897
|
+
Math.max(12, Math.ceil(Math.max(rx, ry) / 2))
|
|
23898
|
+
)) {
|
|
23899
|
+
addPoint(p);
|
|
23900
|
+
}
|
|
23901
|
+
break;
|
|
23902
|
+
}
|
|
23903
|
+
case "path": {
|
|
23904
|
+
const bbox = getBBox(parseCommands(node.attrs.d || ""));
|
|
23905
|
+
addPoint({ x: bbox.x, y: bbox.y });
|
|
23906
|
+
addPoint({ x: bbox.x, y: bbox.y + bbox.height });
|
|
23907
|
+
addPoint({ x: bbox.x + bbox.width, y: bbox.y });
|
|
23908
|
+
addPoint({ x: bbox.x + bbox.width, y: bbox.y + bbox.height });
|
|
23909
|
+
break;
|
|
23910
|
+
}
|
|
23911
|
+
case "g": {
|
|
23912
|
+
const boxes = (node.children || []).filter((child) => typeof child === "object").map((child) => getBBox2(child, defs, transformMatrix)).filter(Boolean);
|
|
23913
|
+
if (!boxes.length) {
|
|
23914
|
+
return [];
|
|
23915
|
+
}
|
|
23916
|
+
const x1 = Math.min(...boxes.map((b) => b.x));
|
|
23917
|
+
const y1 = Math.min(...boxes.map((b) => b.y));
|
|
23918
|
+
const x2 = Math.max(...boxes.map((b) => b.x + b.width));
|
|
23919
|
+
const y2 = Math.max(...boxes.map((b) => b.y + b.height));
|
|
23920
|
+
addPoint({ x: x1, y: y1 });
|
|
23921
|
+
addPoint({ x: x2, y: y1 });
|
|
23922
|
+
addPoint({ x: x2, y: y2 });
|
|
23923
|
+
addPoint({ x: x1, y: y2 });
|
|
23924
|
+
break;
|
|
23925
|
+
}
|
|
23926
|
+
case "use": {
|
|
23927
|
+
const href = node.attrs.href;
|
|
23928
|
+
if (!href) {
|
|
23929
|
+
break;
|
|
23930
|
+
}
|
|
23931
|
+
const id2 = href.substring(1);
|
|
23932
|
+
const def = defs.find(
|
|
23933
|
+
(d) => typeof d.attrs.id === "string" && d.attrs.id === id2
|
|
23934
|
+
);
|
|
23935
|
+
if (!def) {
|
|
23936
|
+
break;
|
|
23937
|
+
}
|
|
23938
|
+
points.push(...outlinePoints(def, defs, transformMatrix));
|
|
23939
|
+
break;
|
|
23940
|
+
}
|
|
23941
|
+
}
|
|
23942
|
+
return points;
|
|
23943
|
+
}
|
|
23944
|
+
function getBBox2(node, defs = [], inheritedMatrix = new DOMMatrix()) {
|
|
23945
|
+
const points = outlinePoints(node, defs, inheritedMatrix);
|
|
23946
|
+
if (!points || !points.length) {
|
|
23947
|
+
return null;
|
|
23948
|
+
}
|
|
23949
|
+
let minX = Number.POSITIVE_INFINITY;
|
|
23950
|
+
let minY = Number.POSITIVE_INFINITY;
|
|
23951
|
+
let maxX = Number.NEGATIVE_INFINITY;
|
|
23952
|
+
let maxY = Number.NEGATIVE_INFINITY;
|
|
23953
|
+
for (const p of points) {
|
|
23954
|
+
minX = Math.min(minX, p.x);
|
|
23955
|
+
minY = Math.min(minY, p.y);
|
|
23956
|
+
maxX = Math.max(maxX, p.x);
|
|
23957
|
+
maxY = Math.max(maxY, p.y);
|
|
23958
|
+
}
|
|
23959
|
+
if (minX === Number.POSITIVE_INFINITY) {
|
|
23960
|
+
return null;
|
|
23961
|
+
}
|
|
23962
|
+
return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };
|
|
23963
|
+
}
|
|
23964
|
+
function renderAttributes(attrs) {
|
|
23965
|
+
const result = Object.entries(attrs).filter(([, value]) => value != null).map(([key, value]) => `${key}="${value}"`).join(" ");
|
|
23966
|
+
if (result.length) {
|
|
23967
|
+
return ` ${result}`;
|
|
23968
|
+
}
|
|
23969
|
+
return "";
|
|
23970
|
+
}
|
|
23971
|
+
function renderChildren(children) {
|
|
23972
|
+
return children.map((child) => renderSvgNode(child)).join("");
|
|
23973
|
+
}
|
|
23974
|
+
function renderSvgNode(node) {
|
|
23975
|
+
if (typeof node === "string") {
|
|
23976
|
+
return node;
|
|
23977
|
+
}
|
|
23978
|
+
if (isSvgRoot(node)) {
|
|
23979
|
+
return `<svg${renderAttributes({
|
|
23980
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
23981
|
+
version: "1.1",
|
|
23982
|
+
width: `${node.attrs.width}`,
|
|
23983
|
+
height: `${node.attrs.height}`,
|
|
23984
|
+
viewBox: `0 0 ${node.attrs.width} ${node.attrs.height}`,
|
|
23985
|
+
preserveAspectRatio: "none",
|
|
23986
|
+
xmlSpace: "preserve"
|
|
23987
|
+
})}>${renderChildren(node.children)}</svg>`;
|
|
23988
|
+
}
|
|
23989
|
+
if (isSvgImage(node)) {
|
|
23990
|
+
return `<image${renderAttributes({
|
|
23991
|
+
href: node.attrs.href,
|
|
23992
|
+
width: `${node.attrs.width}`,
|
|
23993
|
+
height: `${node.attrs.height}`,
|
|
23994
|
+
transform: node.attrs.transform,
|
|
23995
|
+
preserveAspectRatio: "none"
|
|
23996
|
+
})} />`;
|
|
23997
|
+
}
|
|
23998
|
+
if (isSvgMarkedContent(node)) {
|
|
23999
|
+
return `<use${renderAttributes({
|
|
24000
|
+
href: node.attrs.href
|
|
24001
|
+
})} />`;
|
|
24002
|
+
}
|
|
24003
|
+
if (isSvgElement(node)) {
|
|
24004
|
+
return `<${node.tag}${renderAttributes(node.attrs)}>${renderChildren(node.children)}</${node.tag}>`;
|
|
24005
|
+
}
|
|
24006
|
+
return `<${node.tag}${renderAttributes(node.attrs)} />`;
|
|
24007
|
+
}
|
|
24008
|
+
|
|
24009
|
+
// src/lib/SvgCanvasContext.ts
|
|
23756
24010
|
function isCanvas(img) {
|
|
23757
24011
|
return "toDataURL" in img;
|
|
23758
24012
|
}
|
|
@@ -23809,12 +24063,6 @@ var SvgRadialGradient = class {
|
|
|
23809
24063
|
this.stops.push({ offset, color });
|
|
23810
24064
|
}
|
|
23811
24065
|
};
|
|
23812
|
-
function isSvgElement(node) {
|
|
23813
|
-
return "children" in node;
|
|
23814
|
-
}
|
|
23815
|
-
function isSvgText(node) {
|
|
23816
|
-
return "text" in node;
|
|
23817
|
-
}
|
|
23818
24066
|
var SvgCanvasContext = class {
|
|
23819
24067
|
constructor(width, height, canvas) {
|
|
23820
24068
|
__publicField(this, "_width");
|
|
@@ -23844,13 +24092,16 @@ var SvgCanvasContext = class {
|
|
|
23844
24092
|
});
|
|
23845
24093
|
__publicField(this, "_styleStack", []);
|
|
23846
24094
|
__publicField(this, "_groupStack", []);
|
|
24095
|
+
__publicField(this, "_markedStack", []);
|
|
23847
24096
|
__publicField(this, "_transformMatrixStack", []);
|
|
23848
24097
|
__publicField(this, "_root");
|
|
23849
24098
|
__publicField(this, "_defs");
|
|
23850
24099
|
__publicField(this, "_currentGroup");
|
|
23851
24100
|
__publicField(this, "_currentElement", null);
|
|
24101
|
+
__publicField(this, "_currentMarked", null);
|
|
23852
24102
|
__publicField(this, "_transformMatrix", new DOMMatrix([1, 0, 0, 1, 0, 0]));
|
|
23853
24103
|
__publicField(this, "_currentPosition", {});
|
|
24104
|
+
__publicField(this, "_parents", /* @__PURE__ */ new Map());
|
|
23854
24105
|
this._width = width;
|
|
23855
24106
|
this._height = height;
|
|
23856
24107
|
this._canvas = canvas;
|
|
@@ -23859,13 +24110,9 @@ var SvgCanvasContext = class {
|
|
|
23859
24110
|
this._root = {
|
|
23860
24111
|
tag: "svg",
|
|
23861
24112
|
attrs: {
|
|
23862
|
-
|
|
23863
|
-
|
|
23864
|
-
|
|
23865
|
-
height: `${height}`,
|
|
23866
|
-
viewBox: `0 0 ${width} ${height}`,
|
|
23867
|
-
preserveAspectRatio: "none",
|
|
23868
|
-
"xml:space": "preserve"
|
|
24113
|
+
id: id("svg" /* Root */),
|
|
24114
|
+
width,
|
|
24115
|
+
height
|
|
23869
24116
|
},
|
|
23870
24117
|
children: []
|
|
23871
24118
|
};
|
|
@@ -23875,7 +24122,7 @@ var SvgCanvasContext = class {
|
|
|
23875
24122
|
children: []
|
|
23876
24123
|
};
|
|
23877
24124
|
this._currentGroup = this._root;
|
|
23878
|
-
this.
|
|
24125
|
+
this._addNode(this._defs, this._root);
|
|
23879
24126
|
this.resetTransform();
|
|
23880
24127
|
}
|
|
23881
24128
|
get canvas() {
|
|
@@ -23979,8 +24226,8 @@ var SvgCanvasContext = class {
|
|
|
23979
24226
|
this._height = height;
|
|
23980
24227
|
this._canvas.width = width;
|
|
23981
24228
|
this._canvas.height = height;
|
|
23982
|
-
this._root.attrs.width =
|
|
23983
|
-
this._root.attrs.height =
|
|
24229
|
+
this._root.attrs.width = width;
|
|
24230
|
+
this._root.attrs.height = height;
|
|
23984
24231
|
}
|
|
23985
24232
|
save() {
|
|
23986
24233
|
this._groupStack.push(this._currentGroup);
|
|
@@ -23988,34 +24235,22 @@ var SvgCanvasContext = class {
|
|
|
23988
24235
|
this._styleStack.push(this._getStyleState());
|
|
23989
24236
|
this._transformMatrixStack.push(this.getTransform());
|
|
23990
24237
|
}
|
|
23991
|
-
clearRect(x, y, width, height) {
|
|
23992
|
-
if (x !== 0 || y !== 0 || this._width !== width || this._height !== height) {
|
|
23993
|
-
throw new Error("clearRect is not supported in SVG");
|
|
23994
|
-
}
|
|
23995
|
-
this._clearCanvas();
|
|
23996
|
-
}
|
|
23997
24238
|
restore() {
|
|
23998
|
-
|
|
23999
|
-
const group = this._groupStack.pop();
|
|
24000
|
-
if (!this._isTransformationGroup(this._currentGroup)) {
|
|
24001
|
-
group.children = group.children.filter(
|
|
24002
|
-
(child) => child !== this._currentGroup
|
|
24003
|
-
);
|
|
24004
|
-
group.children.push(...this._currentGroup.children);
|
|
24005
|
-
}
|
|
24006
|
-
this._currentGroup = group;
|
|
24007
|
-
} else {
|
|
24008
|
-
this._currentGroup = this._root;
|
|
24009
|
-
}
|
|
24239
|
+
this._currentGroup = this._groupStack.pop() ?? this._root;
|
|
24010
24240
|
if (this._styleStack.length) {
|
|
24011
|
-
|
|
24012
|
-
this._applyStyleState(state);
|
|
24241
|
+
this._applyStyleState(this._styleStack.pop());
|
|
24013
24242
|
}
|
|
24014
24243
|
if (this._transformMatrixStack.length) {
|
|
24015
24244
|
const { a, b, c, d, e, f } = this._transformMatrixStack.pop();
|
|
24016
24245
|
this.setTransform(a, b, c, d, e, f);
|
|
24017
24246
|
}
|
|
24018
24247
|
}
|
|
24248
|
+
clearRect(x, y, width, height) {
|
|
24249
|
+
if (x !== 0 || y !== 0 || this._width !== width || this._height !== height) {
|
|
24250
|
+
throw new Error("clearRect is not supported in SVG");
|
|
24251
|
+
}
|
|
24252
|
+
this._clearCanvas();
|
|
24253
|
+
}
|
|
24019
24254
|
beginPath() {
|
|
24020
24255
|
this._currentPosition = {};
|
|
24021
24256
|
this._currentElement = {
|
|
@@ -24189,19 +24424,18 @@ var SvgCanvasContext = class {
|
|
|
24189
24424
|
if (path instanceof SvgPath2D) {
|
|
24190
24425
|
const d = toCommands(path);
|
|
24191
24426
|
if (d && d !== "Z") {
|
|
24192
|
-
const parent = this._currentGroup;
|
|
24193
24427
|
const pathElement = {
|
|
24194
24428
|
tag: "path",
|
|
24195
24429
|
attrs: {
|
|
24196
24430
|
d,
|
|
24197
24431
|
fill: "none",
|
|
24198
24432
|
stroke: "none",
|
|
24199
|
-
"stroke-width": "
|
|
24433
|
+
"stroke-width": "1"
|
|
24200
24434
|
}
|
|
24201
24435
|
};
|
|
24202
24436
|
this._applyTransformation(pathElement);
|
|
24203
24437
|
this._applyStyle(pathElement, "stroke");
|
|
24204
|
-
|
|
24438
|
+
this._addNode(pathElement);
|
|
24205
24439
|
}
|
|
24206
24440
|
} else if (this._currentElement) {
|
|
24207
24441
|
this._applyStyle(this._currentElement, "stroke");
|
|
@@ -24224,7 +24458,6 @@ var SvgCanvasContext = class {
|
|
|
24224
24458
|
if (path instanceof SvgPath2D) {
|
|
24225
24459
|
const d = toCommands(path);
|
|
24226
24460
|
if (d && d !== "Z") {
|
|
24227
|
-
const parent = this._currentGroup;
|
|
24228
24461
|
const pathElement = {
|
|
24229
24462
|
tag: "path",
|
|
24230
24463
|
attrs: {
|
|
@@ -24236,7 +24469,7 @@ var SvgCanvasContext = class {
|
|
|
24236
24469
|
};
|
|
24237
24470
|
this._applyTransformation(pathElement);
|
|
24238
24471
|
this._applyStyle(pathElement, "fill");
|
|
24239
|
-
|
|
24472
|
+
this._addNode(pathElement);
|
|
24240
24473
|
}
|
|
24241
24474
|
} else if (this._currentElement) {
|
|
24242
24475
|
this._applyStyle(this._currentElement, "fill");
|
|
@@ -24250,19 +24483,18 @@ var SvgCanvasContext = class {
|
|
|
24250
24483
|
if (a === 1 && b === 0 && c === 0 && d === 1 && e === 0 && f === 0 && x === 0 && y === 0 && width === this._width && height === this._height) {
|
|
24251
24484
|
this._clearCanvas();
|
|
24252
24485
|
}
|
|
24253
|
-
const parent = this._currentGroup;
|
|
24254
24486
|
const rect = {
|
|
24255
24487
|
tag: "rect",
|
|
24256
24488
|
attrs: {
|
|
24257
|
-
x
|
|
24258
|
-
y
|
|
24259
|
-
width
|
|
24260
|
-
height
|
|
24489
|
+
x,
|
|
24490
|
+
y,
|
|
24491
|
+
width,
|
|
24492
|
+
height
|
|
24261
24493
|
}
|
|
24262
24494
|
};
|
|
24263
|
-
parent.children.push(rect);
|
|
24264
|
-
this._applyTransformation(rect);
|
|
24265
24495
|
this._applyStyle(rect, "fill");
|
|
24496
|
+
this._applyTransformation(rect);
|
|
24497
|
+
this._addNode(rect);
|
|
24266
24498
|
}
|
|
24267
24499
|
getLineDash() {
|
|
24268
24500
|
return this._currentStyle.lineDash;
|
|
@@ -24307,25 +24539,18 @@ var SvgCanvasContext = class {
|
|
|
24307
24539
|
} else {
|
|
24308
24540
|
throw new Error("Invalid number of arguments");
|
|
24309
24541
|
}
|
|
24310
|
-
const parent = this._currentGroup;
|
|
24311
24542
|
const matrix = this._transformMatrix.translate(dx, dy);
|
|
24543
|
+
const href = isCanvas(image) ? image.toDataURL() : isImage(image) ? image.src : "";
|
|
24312
24544
|
const svgImage = {
|
|
24313
24545
|
tag: "image",
|
|
24314
24546
|
attrs: {
|
|
24315
|
-
|
|
24316
|
-
|
|
24317
|
-
|
|
24547
|
+
href,
|
|
24548
|
+
width: dw,
|
|
24549
|
+
height: dh
|
|
24318
24550
|
}
|
|
24319
24551
|
};
|
|
24320
|
-
if (isCanvas(image)) {
|
|
24321
|
-
svgImage.attrs.href = image.toDataURL();
|
|
24322
|
-
} else if (isImage(image)) {
|
|
24323
|
-
svgImage.attrs.href = image.src;
|
|
24324
|
-
} else {
|
|
24325
|
-
throw new Error("Unknown image source");
|
|
24326
|
-
}
|
|
24327
24552
|
this._applyTransformation(svgImage, matrix);
|
|
24328
|
-
|
|
24553
|
+
this._addNode(svgImage);
|
|
24329
24554
|
}
|
|
24330
24555
|
createPattern(image, repetition) {
|
|
24331
24556
|
let src;
|
|
@@ -24358,19 +24583,17 @@ var SvgCanvasContext = class {
|
|
|
24358
24583
|
if (path instanceof SvgPath2D && path.commands.length === 0) {
|
|
24359
24584
|
return;
|
|
24360
24585
|
}
|
|
24361
|
-
const
|
|
24586
|
+
const clipId = id("clip" /* Clip */, null, this._root.attrs.id);
|
|
24362
24587
|
const clipPath = {
|
|
24363
24588
|
tag: "clipPath",
|
|
24364
24589
|
attrs: {
|
|
24365
|
-
id
|
|
24590
|
+
id: clipId
|
|
24366
24591
|
},
|
|
24367
24592
|
children: []
|
|
24368
24593
|
};
|
|
24369
|
-
this.
|
|
24370
|
-
const
|
|
24371
|
-
|
|
24372
|
-
clipGroup.attrs["clip-path"] = `url(#${id})`;
|
|
24373
|
-
this._currentGroup = clipGroup;
|
|
24594
|
+
this._addNode(clipPath, this._defs);
|
|
24595
|
+
const clipGroup = this._ensureTransformationGroup();
|
|
24596
|
+
clipGroup.attrs["clip-path"] = `url(#${clipId})`;
|
|
24374
24597
|
if (path instanceof SvgPath2D) {
|
|
24375
24598
|
const pathElement = {
|
|
24376
24599
|
tag: "path",
|
|
@@ -24379,13 +24602,11 @@ var SvgCanvasContext = class {
|
|
|
24379
24602
|
}
|
|
24380
24603
|
};
|
|
24381
24604
|
this._applyTransformation(pathElement);
|
|
24382
|
-
|
|
24605
|
+
this._addNode(pathElement, clipPath);
|
|
24383
24606
|
} else if (this._currentElement) {
|
|
24384
|
-
|
|
24385
|
-
group.children = group.children.filter(
|
|
24386
|
-
(node) => node !== this._currentElement
|
|
24387
|
-
);
|
|
24607
|
+
this._addNode(this._currentElement, clipPath);
|
|
24388
24608
|
}
|
|
24609
|
+
this._currentGroup = clipGroup;
|
|
24389
24610
|
}
|
|
24390
24611
|
measureText(text) {
|
|
24391
24612
|
if (!this._ctx) {
|
|
@@ -24402,18 +24623,115 @@ var SvgCanvasContext = class {
|
|
|
24402
24623
|
setTransform(a, b, c, d, e, f) {
|
|
24403
24624
|
this._transformMatrix = new DOMMatrix([a, b, c, d, e, f]);
|
|
24404
24625
|
}
|
|
24405
|
-
|
|
24406
|
-
|
|
24626
|
+
beginMarkedContent(type, props) {
|
|
24627
|
+
if (this._currentMarked) {
|
|
24628
|
+
this._markedStack.push(this._currentMarked);
|
|
24629
|
+
}
|
|
24630
|
+
let markedId = null;
|
|
24631
|
+
if (props != null) {
|
|
24632
|
+
if (typeof props === "number") {
|
|
24633
|
+
markedId = `${props}`;
|
|
24634
|
+
} else if (typeof props === "object" && typeof props.id === "number") {
|
|
24635
|
+
markedId = `${props.id}`;
|
|
24636
|
+
}
|
|
24637
|
+
}
|
|
24638
|
+
const computedId = id(
|
|
24639
|
+
"marked_content" /* MarkedContent */,
|
|
24640
|
+
markedId,
|
|
24641
|
+
this._root.attrs.id
|
|
24642
|
+
);
|
|
24643
|
+
const markedNode = {
|
|
24644
|
+
tag: "use",
|
|
24645
|
+
attrs: {
|
|
24646
|
+
href: `#${computedId}`,
|
|
24647
|
+
type,
|
|
24648
|
+
x: 0,
|
|
24649
|
+
y: 0,
|
|
24650
|
+
width: 0,
|
|
24651
|
+
height: 0
|
|
24652
|
+
}
|
|
24653
|
+
};
|
|
24654
|
+
const groupNode = {
|
|
24655
|
+
tag: "g",
|
|
24656
|
+
attrs: {
|
|
24657
|
+
id: computedId
|
|
24658
|
+
},
|
|
24659
|
+
children: []
|
|
24660
|
+
};
|
|
24661
|
+
this._addNode(groupNode, this._defs);
|
|
24662
|
+
this._currentMarked = {
|
|
24663
|
+
node: markedNode,
|
|
24664
|
+
group: groupNode,
|
|
24665
|
+
elements: []
|
|
24666
|
+
};
|
|
24667
|
+
}
|
|
24668
|
+
endMarkedContent() {
|
|
24669
|
+
if (!this._currentMarked) {
|
|
24670
|
+
return;
|
|
24671
|
+
}
|
|
24672
|
+
const bbox = getBBox2(
|
|
24673
|
+
this._currentMarked.group,
|
|
24674
|
+
this._defs.children
|
|
24675
|
+
);
|
|
24676
|
+
this._currentMarked.node.attrs = {
|
|
24677
|
+
...this._currentMarked.node.attrs,
|
|
24678
|
+
x: bbox?.x ?? 0,
|
|
24679
|
+
y: bbox?.y ?? 0,
|
|
24680
|
+
width: bbox?.width ?? 0,
|
|
24681
|
+
height: bbox?.height ?? 0
|
|
24682
|
+
};
|
|
24683
|
+
this._currentMarked = this._markedStack.pop() ?? null;
|
|
24407
24684
|
}
|
|
24408
24685
|
_ensureTransformationGroup() {
|
|
24409
|
-
const group =
|
|
24410
|
-
const newGroup = {
|
|
24686
|
+
const group = {
|
|
24411
24687
|
tag: "g",
|
|
24412
24688
|
attrs: {},
|
|
24413
24689
|
children: []
|
|
24414
24690
|
};
|
|
24415
|
-
|
|
24416
|
-
return
|
|
24691
|
+
this._addNode(group);
|
|
24692
|
+
return group;
|
|
24693
|
+
}
|
|
24694
|
+
_addNode(node, parent) {
|
|
24695
|
+
const oldParent = this._parents.get(node);
|
|
24696
|
+
if (oldParent) {
|
|
24697
|
+
oldParent.children = oldParent.children.filter((child) => child !== node);
|
|
24698
|
+
}
|
|
24699
|
+
if (parent) {
|
|
24700
|
+
parent.children.push(node);
|
|
24701
|
+
this._parents.set(node, parent);
|
|
24702
|
+
return;
|
|
24703
|
+
}
|
|
24704
|
+
if (!this._currentMarked) {
|
|
24705
|
+
this._addNode(node, this._currentGroup);
|
|
24706
|
+
return;
|
|
24707
|
+
}
|
|
24708
|
+
let group = this._currentGroup;
|
|
24709
|
+
if (this._currentMarked.elements.length === 0) {
|
|
24710
|
+
const markedStackToAdd = [this._currentMarked];
|
|
24711
|
+
let i;
|
|
24712
|
+
for (i = this._markedStack.length - 1; i >= 0; i--) {
|
|
24713
|
+
if (this._markedStack[i].elements.length !== 0) {
|
|
24714
|
+
break;
|
|
24715
|
+
}
|
|
24716
|
+
markedStackToAdd.unshift(this._markedStack[i]);
|
|
24717
|
+
}
|
|
24718
|
+
for (const marked of markedStackToAdd) {
|
|
24719
|
+
const parentMarked = this._markedStack[++i - 1];
|
|
24720
|
+
if (!parentMarked || parentMarked.elements.includes(group)) {
|
|
24721
|
+
this._addNode(marked.node, group);
|
|
24722
|
+
} else {
|
|
24723
|
+
this._addNode(marked.node, parentMarked.group);
|
|
24724
|
+
}
|
|
24725
|
+
parentMarked?.elements.push(marked.node);
|
|
24726
|
+
group = marked.group;
|
|
24727
|
+
}
|
|
24728
|
+
}
|
|
24729
|
+
if (this._currentMarked.elements.includes(group)) {
|
|
24730
|
+
this._addNode(node, group);
|
|
24731
|
+
} else {
|
|
24732
|
+
this._addNode(node, this._currentMarked.group);
|
|
24733
|
+
}
|
|
24734
|
+
this._currentMarked.elements.push(node);
|
|
24417
24735
|
}
|
|
24418
24736
|
_applyStyleState(styleState) {
|
|
24419
24737
|
Object.assign(this._currentStyle, styleState);
|
|
@@ -24440,11 +24758,10 @@ var SvgCanvasContext = class {
|
|
|
24440
24758
|
node.attrs.transform = matrixToTransform(matrix);
|
|
24441
24759
|
}
|
|
24442
24760
|
_createPatternNode(pattern, transform) {
|
|
24443
|
-
const id = `pattern_${crypto.randomUUID()}`;
|
|
24444
24761
|
return {
|
|
24445
24762
|
tag: "pattern",
|
|
24446
24763
|
attrs: {
|
|
24447
|
-
id,
|
|
24764
|
+
id: id("pattern" /* Pattern */, null, this._root.attrs.id),
|
|
24448
24765
|
width: `${pattern.width}`,
|
|
24449
24766
|
height: `${pattern.height}`,
|
|
24450
24767
|
patternTransform: transform ? matrixToTransform(transform) : void 0,
|
|
@@ -24463,12 +24780,11 @@ var SvgCanvasContext = class {
|
|
|
24463
24780
|
};
|
|
24464
24781
|
}
|
|
24465
24782
|
_createGradientNode(gradient) {
|
|
24466
|
-
const id = `pattern_${crypto.randomUUID()}`;
|
|
24467
24783
|
if (gradient instanceof SvgRadialGradient) {
|
|
24468
24784
|
return {
|
|
24469
24785
|
tag: "radialGradient",
|
|
24470
24786
|
attrs: {
|
|
24471
|
-
id,
|
|
24787
|
+
id: id("pattern" /* Pattern */, null, this._root.attrs.id),
|
|
24472
24788
|
cx: `${gradient.x1}`,
|
|
24473
24789
|
cy: `${gradient.y1}`,
|
|
24474
24790
|
r: `${gradient.r1}`,
|
|
@@ -24485,7 +24801,7 @@ var SvgCanvasContext = class {
|
|
|
24485
24801
|
}
|
|
24486
24802
|
};
|
|
24487
24803
|
if (color.startsWith("rgba(")) {
|
|
24488
|
-
const parsed =
|
|
24804
|
+
const parsed = parseRgbaColor(color);
|
|
24489
24805
|
stopElement.attrs["stop-color"] = `rgb(${parsed.r}, ${parsed.g}, ${parsed.b})`;
|
|
24490
24806
|
stopElement.attrs["stop-opacity"] = `${parsed.a ?? 1}`;
|
|
24491
24807
|
} else {
|
|
@@ -24498,7 +24814,7 @@ var SvgCanvasContext = class {
|
|
|
24498
24814
|
return {
|
|
24499
24815
|
tag: "linearGradient",
|
|
24500
24816
|
attrs: {
|
|
24501
|
-
id,
|
|
24817
|
+
id: id("pattern" /* Pattern */, null, this._root.attrs.id),
|
|
24502
24818
|
x1: `${gradient.x1}`,
|
|
24503
24819
|
x2: `${gradient.x2}`,
|
|
24504
24820
|
y1: `${gradient.y1}`,
|
|
@@ -24514,7 +24830,7 @@ var SvgCanvasContext = class {
|
|
|
24514
24830
|
}
|
|
24515
24831
|
};
|
|
24516
24832
|
if (color.startsWith("rgba(")) {
|
|
24517
|
-
const parsed =
|
|
24833
|
+
const parsed = parseRgbaColor(color);
|
|
24518
24834
|
stopElement.attrs["stop-color"] = `rgb(${parsed.r}, ${parsed.g}, ${parsed.b})`;
|
|
24519
24835
|
stopElement.attrs["stop-opacity"] = `${parsed.a ?? 1}`;
|
|
24520
24836
|
} else {
|
|
@@ -24530,24 +24846,24 @@ var SvgCanvasContext = class {
|
|
|
24530
24846
|
currentElement.attrs.opacity = `${globalAlpha}`;
|
|
24531
24847
|
}
|
|
24532
24848
|
const scale = this._getTransformScale();
|
|
24533
|
-
const commands = currentElement
|
|
24534
|
-
const transform = currentElement.attrs.transform ?
|
|
24849
|
+
const commands = isSvgPath(currentElement) ? parseCommands(currentElement.attrs.d) : [];
|
|
24850
|
+
const transform = currentElement.attrs.transform ? parseTransform(currentElement.attrs.transform) : new DOMMatrix();
|
|
24535
24851
|
if (type === "fill") {
|
|
24536
24852
|
const fillStyle = this._currentStyle.fillStyle;
|
|
24537
24853
|
if (fillStyle instanceof SvgPattern) {
|
|
24538
24854
|
const pattern = this._createPatternNode(fillStyle, fillStyle.transform);
|
|
24539
|
-
this.
|
|
24855
|
+
this._addNode(pattern, this._defs);
|
|
24540
24856
|
currentElement.attrs.fill = `url(#${pattern.attrs.id})`;
|
|
24541
24857
|
} else if (fillStyle instanceof SvgLinearGradient) {
|
|
24542
24858
|
const gradient = this._createGradientNode(fillStyle);
|
|
24543
|
-
this.
|
|
24859
|
+
this._addNode(gradient, this._defs);
|
|
24544
24860
|
currentElement.attrs.fill = `url(#${gradient.attrs.id})`;
|
|
24545
24861
|
} else if (fillStyle instanceof SvgRadialGradient) {
|
|
24546
24862
|
const gradient = this._createGradientNode(fillStyle);
|
|
24547
|
-
this.
|
|
24863
|
+
this._addNode(gradient, this._defs);
|
|
24548
24864
|
currentElement.attrs.fill = `url(#${gradient.attrs.id})`;
|
|
24549
24865
|
} else if (fillStyle.startsWith("rgba")) {
|
|
24550
|
-
const color =
|
|
24866
|
+
const color = parseRgbaColor(fillStyle);
|
|
24551
24867
|
currentElement.attrs.fill = `rgb(${color.r}, ${color.g}, ${color.b})`;
|
|
24552
24868
|
currentElement.attrs["fill-opacity"] = `${(color.a ?? 1) * globalAlpha}`;
|
|
24553
24869
|
} else {
|
|
@@ -24557,19 +24873,19 @@ var SvgCanvasContext = class {
|
|
|
24557
24873
|
const strokeStyle = this._currentStyle.strokeStyle;
|
|
24558
24874
|
if (strokeStyle instanceof SvgPattern) {
|
|
24559
24875
|
const path = transformPath(commands, transform);
|
|
24560
|
-
const bbox =
|
|
24876
|
+
const bbox = getBBox(path);
|
|
24561
24877
|
const pattern = this._createPatternNode(
|
|
24562
24878
|
strokeStyle,
|
|
24563
24879
|
new DOMMatrix([1, 0, 0, 1, Math.max(bbox.x, 0), 0])
|
|
24564
24880
|
);
|
|
24565
|
-
this.
|
|
24881
|
+
this._addNode(pattern, this._defs);
|
|
24566
24882
|
currentElement.attrs.stroke = `url(#${pattern.attrs.id})`;
|
|
24567
24883
|
} else if (strokeStyle instanceof SvgLinearGradient) {
|
|
24568
24884
|
const gradient = this._createGradientNode(strokeStyle);
|
|
24569
|
-
this.
|
|
24885
|
+
this._addNode(gradient, this._defs);
|
|
24570
24886
|
currentElement.attrs.fill = `url(#${gradient.attrs.id})`;
|
|
24571
24887
|
} else if (strokeStyle.startsWith("rgba")) {
|
|
24572
|
-
const color =
|
|
24888
|
+
const color = parseRgbaColor(strokeStyle);
|
|
24573
24889
|
currentElement.attrs.stroke = `rgb(${color.r}, ${color.g}, ${color.b})`;
|
|
24574
24890
|
currentElement.attrs["stroke-opacity"] = `${(color.a ?? 1) * globalAlpha}`;
|
|
24575
24891
|
} else {
|
|
@@ -24593,26 +24909,26 @@ var SvgCanvasContext = class {
|
|
|
24593
24909
|
}
|
|
24594
24910
|
}
|
|
24595
24911
|
_addPathCommand(command) {
|
|
24596
|
-
if (this._currentElement) {
|
|
24597
|
-
|
|
24598
|
-
|
|
24599
|
-
|
|
24600
|
-
|
|
24601
|
-
|
|
24602
|
-
} else {
|
|
24603
|
-
this._currentElement.attrs.d = command;
|
|
24604
|
-
this._currentGroup.children.push(this._currentElement);
|
|
24912
|
+
if (!this._currentElement || !isSvgPath(this._currentElement)) {
|
|
24913
|
+
throw new Error("Current element is not a valid SVG path");
|
|
24914
|
+
}
|
|
24915
|
+
if (this._currentElement.attrs.d) {
|
|
24916
|
+
if (command === "Z" && this._currentElement.attrs.d.endsWith("Z")) {
|
|
24917
|
+
return;
|
|
24605
24918
|
}
|
|
24919
|
+
this._currentElement.attrs.d += ` ${command}`;
|
|
24920
|
+
} else {
|
|
24921
|
+
this._currentElement.attrs.d = command;
|
|
24922
|
+
this._addNode(this._currentElement);
|
|
24606
24923
|
}
|
|
24607
24924
|
}
|
|
24608
24925
|
_applyText(text, x, y, action) {
|
|
24609
|
-
const parent = this._currentGroup;
|
|
24610
24926
|
const style = parseFontStyle(this._currentStyle.font);
|
|
24611
24927
|
const textElement = {
|
|
24612
24928
|
tag: "text",
|
|
24613
24929
|
attrs: {
|
|
24614
|
-
x
|
|
24615
|
-
y
|
|
24930
|
+
x,
|
|
24931
|
+
y,
|
|
24616
24932
|
"font-family": style.fontFamilies.join(", "),
|
|
24617
24933
|
"font-size": style.fontSize,
|
|
24618
24934
|
"font-style": style.fontStyle,
|
|
@@ -24622,17 +24938,18 @@ var SvgCanvasContext = class {
|
|
|
24622
24938
|
this._currentStyle.textBaseline
|
|
24623
24939
|
)
|
|
24624
24940
|
},
|
|
24625
|
-
text
|
|
24941
|
+
children: [text]
|
|
24626
24942
|
};
|
|
24627
24943
|
this._applyTransformation(textElement);
|
|
24628
24944
|
this._applyStyle(textElement, action);
|
|
24629
|
-
|
|
24945
|
+
this._addNode(textElement);
|
|
24630
24946
|
}
|
|
24631
24947
|
_clearCanvas() {
|
|
24632
24948
|
this._defs.children = [];
|
|
24633
24949
|
this._root.children = [this._defs];
|
|
24634
24950
|
this._currentGroup = this._root;
|
|
24635
24951
|
this._groupStack = [];
|
|
24952
|
+
this._parents.clear();
|
|
24636
24953
|
}
|
|
24637
24954
|
};
|
|
24638
24955
|
async function createSvgContext(width, height) {
|
|
@@ -24649,10 +24966,13 @@ async function toSvgNode(ctx) {
|
|
|
24649
24966
|
}
|
|
24650
24967
|
return ctx.getNode();
|
|
24651
24968
|
}
|
|
24969
|
+
async function toSvgString(ctx) {
|
|
24970
|
+
return renderSvgNode(await toSvgNode(ctx));
|
|
24971
|
+
}
|
|
24652
24972
|
|
|
24653
24973
|
// src/lib/PDFPageProxy.ts
|
|
24654
24974
|
async function loadNodeCanvasFactory() {
|
|
24655
|
-
const { NodeCanvasFactory: NodeCanvasFactory2 } = await import("./NodeCanvasFactory-
|
|
24975
|
+
const { NodeCanvasFactory: NodeCanvasFactory2 } = await import("./NodeCanvasFactory-ONRE5YYL.js");
|
|
24656
24976
|
return new NodeCanvasFactory2({});
|
|
24657
24977
|
}
|
|
24658
24978
|
var getAnnotations = PDFPageProxy.prototype.getAnnotations;
|
|
@@ -24696,13 +25016,8 @@ PDFPageProxy.prototype.getAnnotations = async function(params) {
|
|
|
24696
25016
|
annotation.graphics = {
|
|
24697
25017
|
tag: "svg",
|
|
24698
25018
|
attrs: {
|
|
24699
|
-
|
|
24700
|
-
|
|
24701
|
-
width: `${width}`,
|
|
24702
|
-
height: `${height}`,
|
|
24703
|
-
viewBox: `0 0 ${width * scale} ${height * scale}`,
|
|
24704
|
-
preserveAspectRatio: "none",
|
|
24705
|
-
"xml:space": "preserve"
|
|
25019
|
+
width,
|
|
25020
|
+
height
|
|
24706
25021
|
},
|
|
24707
25022
|
children: [
|
|
24708
25023
|
{
|
|
@@ -24989,6 +25304,43 @@ function isRedactAnnotation(annotation) {
|
|
|
24989
25304
|
return annotation.subtype === "Redact";
|
|
24990
25305
|
}
|
|
24991
25306
|
|
|
25307
|
+
// src/lib/CanvasGraphics.ts
|
|
25308
|
+
var {
|
|
25309
|
+
beginDrawing,
|
|
25310
|
+
beginMarkedContent,
|
|
25311
|
+
beginMarkedContentProps,
|
|
25312
|
+
endMarkedContent
|
|
25313
|
+
} = CanvasGraphics.prototype;
|
|
25314
|
+
CanvasGraphics.prototype.beginDrawing = function(options) {
|
|
25315
|
+
if (this.ctx instanceof SvgCanvasContext) {
|
|
25316
|
+
options.transparency = false;
|
|
25317
|
+
}
|
|
25318
|
+
return beginDrawing.call(this, options);
|
|
25319
|
+
};
|
|
25320
|
+
CanvasGraphics.prototype.beginMarkedContent = function(type) {
|
|
25321
|
+
beginMarkedContent.call(this, this.ctx);
|
|
25322
|
+
if (this.ctx instanceof SvgCanvasContext) {
|
|
25323
|
+
this.ctx.beginMarkedContent(type);
|
|
25324
|
+
}
|
|
25325
|
+
};
|
|
25326
|
+
CanvasGraphics.prototype.beginMarkedContentProps = function(type, props) {
|
|
25327
|
+
beginMarkedContentProps.call(this, type, props);
|
|
25328
|
+
if (this.ctx instanceof SvgCanvasContext) {
|
|
25329
|
+
this.ctx.beginMarkedContent(type, props);
|
|
25330
|
+
}
|
|
25331
|
+
};
|
|
25332
|
+
CanvasGraphics.prototype.endMarkedContent = function() {
|
|
25333
|
+
if (this.ctx instanceof SvgCanvasContext) {
|
|
25334
|
+
this.ctx.endMarkedContent();
|
|
25335
|
+
}
|
|
25336
|
+
endMarkedContent.call(this);
|
|
25337
|
+
};
|
|
25338
|
+
Object.assign(CanvasGraphics.prototype, {
|
|
25339
|
+
[OPS.beginMarkedContent]: CanvasGraphics.prototype.beginMarkedContent,
|
|
25340
|
+
[OPS.beginMarkedContentProps]: CanvasGraphics.prototype.beginMarkedContentProps,
|
|
25341
|
+
[OPS.endMarkedContent]: CanvasGraphics.prototype.endMarkedContent
|
|
25342
|
+
});
|
|
25343
|
+
|
|
24992
25344
|
// src/lib/TextLayer.ts
|
|
24993
25345
|
function isTextNode(node) {
|
|
24994
25346
|
return node.role === "text";
|
|
@@ -24996,8 +25348,8 @@ function isTextNode(node) {
|
|
|
24996
25348
|
function isAnchorNode(node) {
|
|
24997
25349
|
return node.role === "a";
|
|
24998
25350
|
}
|
|
24999
|
-
function
|
|
25000
|
-
return node.role === "
|
|
25351
|
+
function isFigureNode(node) {
|
|
25352
|
+
return node.role === "figure";
|
|
25001
25353
|
}
|
|
25002
25354
|
var MAX_TEXT_DIVS_TO_RENDER2 = 1e5;
|
|
25003
25355
|
var DEFAULT_FONT_SIZE3 = 30;
|
|
@@ -25007,17 +25359,15 @@ async function createTextLayer(page, {
|
|
|
25007
25359
|
canvasFactory,
|
|
25008
25360
|
viewport = page.getViewport({ scale: 1 }),
|
|
25009
25361
|
outputScale = 1,
|
|
25010
|
-
annotations
|
|
25362
|
+
annotations,
|
|
25363
|
+
graphics
|
|
25011
25364
|
}) {
|
|
25012
|
-
const objs = page.objs;
|
|
25013
|
-
const commonObjs = page.commonObjs;
|
|
25014
25365
|
const styleCache = {};
|
|
25015
25366
|
const ascentCache = /* @__PURE__ */ new Map();
|
|
25016
25367
|
const canvasCache = /* @__PURE__ */ new Map();
|
|
25017
25368
|
const textDivs = [];
|
|
25018
25369
|
const markedContent = /* @__PURE__ */ new Map();
|
|
25019
|
-
const [
|
|
25020
|
-
page.getOperatorList(),
|
|
25370
|
+
const [tree, contentSource] = await Promise.all([
|
|
25021
25371
|
page.getStructTree(),
|
|
25022
25372
|
page.getTextContent({ includeMarkedContent: true })
|
|
25023
25373
|
]);
|
|
@@ -25038,13 +25388,6 @@ async function createTextLayer(page, {
|
|
|
25038
25388
|
let disableProcessItems = false;
|
|
25039
25389
|
let canvasContext = null;
|
|
25040
25390
|
let container = rootContainer;
|
|
25041
|
-
const getObject = (data) => {
|
|
25042
|
-
try {
|
|
25043
|
-
return data.startsWith("g_") ? commonObjs.get(data) : objs.get(data);
|
|
25044
|
-
} catch {
|
|
25045
|
-
return null;
|
|
25046
|
-
}
|
|
25047
|
-
};
|
|
25048
25391
|
const processItems = async (items, lang) => {
|
|
25049
25392
|
if (disableProcessItems) {
|
|
25050
25393
|
return;
|
|
@@ -25229,7 +25572,7 @@ async function createTextLayer(page, {
|
|
|
25229
25572
|
ascentCache.set(fontFamily, ratio);
|
|
25230
25573
|
return ratio;
|
|
25231
25574
|
};
|
|
25232
|
-
const renderStructTreeNode =
|
|
25575
|
+
const renderStructTreeNode = (node, parent) => {
|
|
25233
25576
|
if ("role" in node) {
|
|
25234
25577
|
const role = node.role.toLowerCase();
|
|
25235
25578
|
switch (role) {
|
|
@@ -25239,17 +25582,17 @@ async function createTextLayer(page, {
|
|
|
25239
25582
|
children: []
|
|
25240
25583
|
};
|
|
25241
25584
|
parent.children.push(section);
|
|
25242
|
-
|
|
25243
|
-
|
|
25244
|
-
|
|
25585
|
+
for (const child of [...node.children]) {
|
|
25586
|
+
renderStructTreeNode(child, section);
|
|
25587
|
+
}
|
|
25245
25588
|
break;
|
|
25246
25589
|
}
|
|
25247
25590
|
case "lbl":
|
|
25248
25591
|
case "lbody":
|
|
25249
25592
|
case "span": {
|
|
25250
|
-
|
|
25251
|
-
|
|
25252
|
-
|
|
25593
|
+
for (const child of [...node.children]) {
|
|
25594
|
+
renderStructTreeNode(child, parent);
|
|
25595
|
+
}
|
|
25253
25596
|
break;
|
|
25254
25597
|
}
|
|
25255
25598
|
case "link": {
|
|
@@ -25258,9 +25601,9 @@ async function createTextLayer(page, {
|
|
|
25258
25601
|
console.warn(
|
|
25259
25602
|
`Unsupported link type: ${ref.type}`
|
|
25260
25603
|
);
|
|
25261
|
-
|
|
25262
|
-
|
|
25263
|
-
|
|
25604
|
+
for (const child of children) {
|
|
25605
|
+
renderStructTreeNode(child, parent);
|
|
25606
|
+
}
|
|
25264
25607
|
return;
|
|
25265
25608
|
}
|
|
25266
25609
|
const annotation = annotations?.find(
|
|
@@ -25268,9 +25611,9 @@ async function createTextLayer(page, {
|
|
|
25268
25611
|
);
|
|
25269
25612
|
if (!annotation) {
|
|
25270
25613
|
console.warn("Link not found", ref);
|
|
25271
|
-
|
|
25272
|
-
|
|
25273
|
-
|
|
25614
|
+
for (const child of children) {
|
|
25615
|
+
renderStructTreeNode(child, parent);
|
|
25616
|
+
}
|
|
25274
25617
|
return;
|
|
25275
25618
|
}
|
|
25276
25619
|
if (isLinkAnnotation(annotation)) {
|
|
@@ -25280,16 +25623,16 @@ async function createTextLayer(page, {
|
|
|
25280
25623
|
children: []
|
|
25281
25624
|
};
|
|
25282
25625
|
parent.children.push(anchor);
|
|
25283
|
-
|
|
25284
|
-
|
|
25285
|
-
|
|
25626
|
+
for (const child of children) {
|
|
25627
|
+
renderStructTreeNode(child, anchor);
|
|
25628
|
+
}
|
|
25286
25629
|
} else {
|
|
25287
25630
|
console.warn(
|
|
25288
25631
|
`Unsupported annotation subtype: ${annotation.subtype}`
|
|
25289
25632
|
);
|
|
25290
|
-
|
|
25291
|
-
|
|
25292
|
-
|
|
25633
|
+
for (const child of children) {
|
|
25634
|
+
renderStructTreeNode(child, parent);
|
|
25635
|
+
}
|
|
25293
25636
|
}
|
|
25294
25637
|
break;
|
|
25295
25638
|
}
|
|
@@ -25298,7 +25641,7 @@ async function createTextLayer(page, {
|
|
|
25298
25641
|
break;
|
|
25299
25642
|
}
|
|
25300
25643
|
if (node.children.length === 1 && node.children[0].role === "Table") {
|
|
25301
|
-
|
|
25644
|
+
renderStructTreeNode(node.children[0], parent);
|
|
25302
25645
|
break;
|
|
25303
25646
|
}
|
|
25304
25647
|
const paragraph = {
|
|
@@ -25306,11 +25649,9 @@ async function createTextLayer(page, {
|
|
|
25306
25649
|
children: []
|
|
25307
25650
|
};
|
|
25308
25651
|
parent.children.push(paragraph);
|
|
25309
|
-
|
|
25310
|
-
|
|
25311
|
-
|
|
25312
|
-
)
|
|
25313
|
-
);
|
|
25652
|
+
for (const child of [...node.children]) {
|
|
25653
|
+
renderStructTreeNode(child, paragraph);
|
|
25654
|
+
}
|
|
25314
25655
|
break;
|
|
25315
25656
|
}
|
|
25316
25657
|
case "l": {
|
|
@@ -25319,9 +25660,9 @@ async function createTextLayer(page, {
|
|
|
25319
25660
|
children: []
|
|
25320
25661
|
};
|
|
25321
25662
|
parent.children.push(list);
|
|
25322
|
-
|
|
25323
|
-
|
|
25324
|
-
|
|
25663
|
+
for (const child of [...node.children]) {
|
|
25664
|
+
renderStructTreeNode(child, list);
|
|
25665
|
+
}
|
|
25325
25666
|
break;
|
|
25326
25667
|
}
|
|
25327
25668
|
case "table":
|
|
@@ -25340,71 +25681,50 @@ async function createTextLayer(page, {
|
|
|
25340
25681
|
children: []
|
|
25341
25682
|
};
|
|
25342
25683
|
parent.children.push(block);
|
|
25343
|
-
|
|
25344
|
-
|
|
25345
|
-
|
|
25684
|
+
for (const child of [...node.children]) {
|
|
25685
|
+
renderStructTreeNode(child, block);
|
|
25686
|
+
}
|
|
25346
25687
|
break;
|
|
25347
25688
|
}
|
|
25348
25689
|
case "figure": {
|
|
25349
|
-
|
|
25350
|
-
|
|
25351
|
-
|
|
25352
|
-
|
|
25353
|
-
|
|
25354
|
-
|
|
25355
|
-
|
|
25356
|
-
|
|
25357
|
-
|
|
25358
|
-
|
|
25359
|
-
|
|
25360
|
-
|
|
25361
|
-
|
|
25362
|
-
|
|
25363
|
-
|
|
25364
|
-
|
|
25365
|
-
|
|
25366
|
-
if (imgData.bitmap) {
|
|
25367
|
-
canvasAndContext.context.drawImage(imgData.bitmap, 0, 0);
|
|
25368
|
-
} else if (imgData.data) {
|
|
25369
|
-
if (imgData.kind === ImageKind.RGB_24BPP) {
|
|
25370
|
-
const rgbaArray = new Uint8ClampedArray(
|
|
25371
|
-
imgData.width * imgData.height * 4
|
|
25372
|
-
);
|
|
25373
|
-
for (let i = 0, j = 0; i < imgData.data.length; i += 3, j += 4) {
|
|
25374
|
-
rgbaArray[j] = imgData.data[i];
|
|
25375
|
-
rgbaArray[j + 1] = imgData.data[i + 1];
|
|
25376
|
-
rgbaArray[j + 2] = imgData.data[i + 2];
|
|
25377
|
-
rgbaArray[j + 3] = 255;
|
|
25378
|
-
}
|
|
25379
|
-
const imageData = new ImageData(
|
|
25380
|
-
rgbaArray,
|
|
25381
|
-
imgData.width,
|
|
25382
|
-
imgData.height
|
|
25383
|
-
);
|
|
25384
|
-
canvasAndContext.context.putImageData(imageData, 0, 0);
|
|
25385
|
-
} else {
|
|
25386
|
-
const imageData = new ImageData(
|
|
25387
|
-
imgData.data,
|
|
25388
|
-
imgData.width,
|
|
25389
|
-
imgData.height
|
|
25390
|
-
);
|
|
25391
|
-
canvasAndContext.context.putImageData(imageData, 0, 0);
|
|
25392
|
-
}
|
|
25393
|
-
}
|
|
25394
|
-
const imgSrc = await toDataUrl(
|
|
25395
|
-
await canvasToData(canvasAndContext.canvas)
|
|
25396
|
-
);
|
|
25397
|
-
canvasFactory.destroy(canvasAndContext);
|
|
25398
|
-
const img = {
|
|
25399
|
-
role: "img",
|
|
25400
|
-
src: imgSrc
|
|
25401
|
-
};
|
|
25402
|
-
parent.children.push(img);
|
|
25403
|
-
})
|
|
25404
|
-
);
|
|
25690
|
+
const ids = [...node.children].filter((child) => "id" in child).map((child) => {
|
|
25691
|
+
const span = markedContent.get(child.id);
|
|
25692
|
+
if (!span) {
|
|
25693
|
+
return child.id;
|
|
25694
|
+
}
|
|
25695
|
+
if (span.parent) {
|
|
25696
|
+
span.parent.children = span.parent.children.filter(
|
|
25697
|
+
(child2) => child2 !== span.node
|
|
25698
|
+
);
|
|
25699
|
+
}
|
|
25700
|
+
return child.id;
|
|
25701
|
+
});
|
|
25702
|
+
if (graphics) {
|
|
25703
|
+
for (const markedId of ids) {
|
|
25704
|
+
const [, figureId] = markedId.split("_mc");
|
|
25705
|
+
if (!figureId) {
|
|
25706
|
+
continue;
|
|
25405
25707
|
}
|
|
25406
|
-
|
|
25407
|
-
|
|
25708
|
+
const useId = `#${id("marked_content" /* MarkedContent */, figureId, graphics.attrs.id)}`;
|
|
25709
|
+
const graphic = findSvgNode(
|
|
25710
|
+
graphics,
|
|
25711
|
+
(node2) => isSvgMarkedContent(node2) && node2.attrs.href === useId
|
|
25712
|
+
);
|
|
25713
|
+
if (!graphic) {
|
|
25714
|
+
continue;
|
|
25715
|
+
}
|
|
25716
|
+
const figure = {
|
|
25717
|
+
role: "figure",
|
|
25718
|
+
href: graphic.attrs.href,
|
|
25719
|
+
x: graphic.attrs.x || 0,
|
|
25720
|
+
y: graphic.attrs.y || 0,
|
|
25721
|
+
width: graphic.attrs.width || 0,
|
|
25722
|
+
height: graphic.attrs.height || 0,
|
|
25723
|
+
alt: node.alt
|
|
25724
|
+
};
|
|
25725
|
+
parent.children.push(figure);
|
|
25726
|
+
}
|
|
25727
|
+
}
|
|
25408
25728
|
break;
|
|
25409
25729
|
}
|
|
25410
25730
|
default: {
|
|
@@ -25413,9 +25733,9 @@ async function createTextLayer(page, {
|
|
|
25413
25733
|
children: []
|
|
25414
25734
|
};
|
|
25415
25735
|
parent.children.push(block);
|
|
25416
|
-
|
|
25417
|
-
|
|
25418
|
-
|
|
25736
|
+
for (const child of [...node.children]) {
|
|
25737
|
+
renderStructTreeNode(child, block);
|
|
25738
|
+
}
|
|
25419
25739
|
break;
|
|
25420
25740
|
}
|
|
25421
25741
|
}
|
|
@@ -25432,32 +25752,6 @@ async function createTextLayer(page, {
|
|
|
25432
25752
|
parent.children.push(span.node);
|
|
25433
25753
|
}
|
|
25434
25754
|
};
|
|
25435
|
-
const getMarkedObjects = (markedContentId) => {
|
|
25436
|
-
const results = [];
|
|
25437
|
-
let currentMarkedContent = null;
|
|
25438
|
-
for (let i = 0; i < operatorList.fnArray.length; i++) {
|
|
25439
|
-
const fnId = operatorList.fnArray[i];
|
|
25440
|
-
const args = operatorList.argsArray[i];
|
|
25441
|
-
if (fnId === OPS.endMarkedContent) {
|
|
25442
|
-
if (currentMarkedContent === markedContentId) {
|
|
25443
|
-
return results;
|
|
25444
|
-
}
|
|
25445
|
-
currentMarkedContent = null;
|
|
25446
|
-
continue;
|
|
25447
|
-
}
|
|
25448
|
-
if (fnId === OPS.beginMarkedContentProps && args?.[0] === "Figure") {
|
|
25449
|
-
currentMarkedContent = `${args[1]}`;
|
|
25450
|
-
continue;
|
|
25451
|
-
}
|
|
25452
|
-
if (currentMarkedContent !== markedContentId) {
|
|
25453
|
-
continue;
|
|
25454
|
-
}
|
|
25455
|
-
if (fnId === OPS.paintImageXObject) {
|
|
25456
|
-
results.push(args[0]);
|
|
25457
|
-
}
|
|
25458
|
-
}
|
|
25459
|
-
return results;
|
|
25460
|
-
};
|
|
25461
25755
|
await loadDefaultFonts();
|
|
25462
25756
|
const reader = textContentSource.getReader();
|
|
25463
25757
|
while (true) {
|
|
@@ -25469,9 +25763,11 @@ async function createTextLayer(page, {
|
|
|
25469
25763
|
await processItems(value.items, value.lang);
|
|
25470
25764
|
}
|
|
25471
25765
|
const root = tree?.children[0]?.children[0];
|
|
25472
|
-
|
|
25473
|
-
|
|
25474
|
-
|
|
25766
|
+
if (root?.children) {
|
|
25767
|
+
for (const child of root.children) {
|
|
25768
|
+
renderStructTreeNode(child, rootContainer);
|
|
25769
|
+
}
|
|
25770
|
+
}
|
|
25475
25771
|
ascentCache.clear();
|
|
25476
25772
|
for (const canvasAndContext of canvasCache.values()) {
|
|
25477
25773
|
canvasFactory.destroy(canvasAndContext);
|
|
@@ -25536,10 +25832,10 @@ export {
|
|
|
25536
25832
|
isChoiceWidgetAnnotation,
|
|
25537
25833
|
isCircleAnnotation,
|
|
25538
25834
|
isDataScheme,
|
|
25835
|
+
isFigureNode,
|
|
25539
25836
|
isFileAttachmentAnnotation,
|
|
25540
25837
|
isFreeTextAnnotation,
|
|
25541
25838
|
isHighlightAnnotation,
|
|
25542
|
-
isImageNode,
|
|
25543
25839
|
isInkAnnotation,
|
|
25544
25840
|
isLineAnnotation,
|
|
25545
25841
|
isLinkAnnotation,
|
|
@@ -25557,7 +25853,10 @@ export {
|
|
|
25557
25853
|
isStampAnnotation,
|
|
25558
25854
|
isStrikeOutAnnotation,
|
|
25559
25855
|
isSvgElement,
|
|
25560
|
-
|
|
25856
|
+
isSvgImage,
|
|
25857
|
+
isSvgMarkedContent,
|
|
25858
|
+
isSvgPath,
|
|
25859
|
+
isSvgRoot,
|
|
25561
25860
|
isTextAnnotation,
|
|
25562
25861
|
isTextNode,
|
|
25563
25862
|
isTextWidgetAnnotation,
|
|
@@ -25571,12 +25870,14 @@ export {
|
|
|
25571
25870
|
makeSerializable,
|
|
25572
25871
|
noContextMenu,
|
|
25573
25872
|
normalizeUnicode,
|
|
25873
|
+
parseRgbaColor,
|
|
25574
25874
|
rgbToHex,
|
|
25575
25875
|
setLayerDimensions,
|
|
25576
25876
|
shadow,
|
|
25577
25877
|
stopEvent,
|
|
25578
25878
|
toDataUrl,
|
|
25579
25879
|
toSvgNode,
|
|
25880
|
+
toSvgString,
|
|
25580
25881
|
updateUrlHash,
|
|
25581
25882
|
version
|
|
25582
25883
|
};
|