@vertexvis/doc-viewer 0.24.5-canary.8

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.
Files changed (73) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/doc-viewer.cjs.js +27 -0
  3. package/dist/cjs/index-DY-_Uhw6.js +1914 -0
  4. package/dist/cjs/index.cjs.js +5 -0
  5. package/dist/cjs/loader.cjs.js +15 -0
  6. package/dist/cjs/vertex-document-viewer.cjs.entry.js +34272 -0
  7. package/dist/collection/__mocks__/pdfjs-mock.js +33 -0
  8. package/dist/collection/__setup__/polyfills.js +28 -0
  9. package/dist/collection/__setup__/resize-observer.js +13 -0
  10. package/dist/collection/collection-manifest.json +14 -0
  11. package/dist/collection/components/document-viewer/document-viewer.css +26 -0
  12. package/dist/collection/components/document-viewer/document-viewer.js +556 -0
  13. package/dist/collection/index.js +5 -0
  14. package/dist/collection/lib/config.js +1 -0
  15. package/dist/collection/lib/document/api.js +97 -0
  16. package/dist/collection/lib/document/layers/controller.js +41 -0
  17. package/dist/collection/lib/document/layers/index.js +5 -0
  18. package/dist/collection/lib/document/layers/types.js +9 -0
  19. package/dist/collection/lib/document/provider.js +1 -0
  20. package/dist/collection/lib/document/renderer.js +22 -0
  21. package/dist/collection/lib/dom.js +6 -0
  22. package/dist/collection/lib/index.js +4 -0
  23. package/dist/collection/lib/interactions/pan-interaction-handler.js +67 -0
  24. package/dist/collection/lib/pdf/pdfjs-api.js +67 -0
  25. package/dist/collection/lib/pdf/pdfjs-provider.js +12 -0
  26. package/dist/collection/lib/pdf/pdfjs-renderer.js +77 -0
  27. package/dist/collection/lib/types/loadableResource.js +18 -0
  28. package/dist/collection/polyfill/index.js +7 -0
  29. package/dist/collection/polyfill/resize-observer.js +9 -0
  30. package/dist/collection/testing/mock-document-api.js +19 -0
  31. package/dist/components/index.d.ts +35 -0
  32. package/dist/components/index.js +4 -0
  33. package/dist/components/p-DRNDkVQa.js +4 -0
  34. package/dist/components/vertex-document-viewer.d.ts +11 -0
  35. package/dist/components/vertex-document-viewer.js +39 -0
  36. package/dist/doc-viewer/doc-viewer.css +1 -0
  37. package/dist/doc-viewer/doc-viewer.esm.js +4 -0
  38. package/dist/doc-viewer/index.esm.js +3 -0
  39. package/dist/doc-viewer/p-Ct6uMP9a.js +5 -0
  40. package/dist/doc-viewer/p-b8e2846a.entry.js +39 -0
  41. package/dist/esm/doc-viewer.js +23 -0
  42. package/dist/esm/index-Ct6uMP9a.js +1886 -0
  43. package/dist/esm/index.js +3 -0
  44. package/dist/esm/loader.js +13 -0
  45. package/dist/esm/vertex-document-viewer.entry.js +34251 -0
  46. package/dist/index.cjs.js +1 -0
  47. package/dist/index.js +1 -0
  48. package/dist/types/__mocks__/pdfjs-mock.d.ts +30 -0
  49. package/dist/types/__setup__/polyfills.d.ts +1 -0
  50. package/dist/types/__setup__/resize-observer.d.ts +1 -0
  51. package/dist/types/components/document-viewer/document-viewer.d.ts +132 -0
  52. package/dist/types/components.d.ts +176 -0
  53. package/dist/types/index.d.ts +2 -0
  54. package/dist/types/lib/config.d.ts +8 -0
  55. package/dist/types/lib/document/api.d.ts +51 -0
  56. package/dist/types/lib/document/layers/controller.d.ts +24 -0
  57. package/dist/types/lib/document/layers/index.d.ts +2 -0
  58. package/dist/types/lib/document/layers/types.d.ts +15 -0
  59. package/dist/types/lib/document/provider.d.ts +16 -0
  60. package/dist/types/lib/document/renderer.d.ts +16 -0
  61. package/dist/types/lib/dom.d.ts +1 -0
  62. package/dist/types/lib/index.d.ts +1 -0
  63. package/dist/types/lib/interactions/pan-interaction-handler.d.ts +16 -0
  64. package/dist/types/lib/pdf/pdfjs-api.d.ts +19 -0
  65. package/dist/types/lib/pdf/pdfjs-provider.d.ts +10 -0
  66. package/dist/types/lib/pdf/pdfjs-renderer.d.ts +11 -0
  67. package/dist/types/lib/types/loadableResource.d.ts +11 -0
  68. package/dist/types/polyfill/index.d.ts +1 -0
  69. package/dist/types/polyfill/resize-observer.d.ts +1 -0
  70. package/dist/types/stencil-public-runtime.d.ts +1860 -0
  71. package/dist/types/testing/mock-document-api.d.ts +14 -0
  72. package/package.json +96 -0
  73. package/readme.md +17 -0
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,97 @@
1
+ /*!
2
+ * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
+ */
4
+ import { Dimensions, Point } from "@vertexvis/geometry";
5
+ import { EventDispatcher } from "@vertexvis/utils";
6
+ export const MAX_ZOOM_PERCENTAGE = 600;
7
+ export const MIN_ZOOM_PERCENTAGE = 10;
8
+ /**
9
+ * Base class for all document APIs. This class provides implementations for
10
+ * operations common to all document types, such as viewport changes and loading
11
+ * of pages.
12
+ */
13
+ export class DocumentApi {
14
+ constructor(defaultState) {
15
+ this.defaultState = defaultState;
16
+ this.stateChanged = new EventDispatcher();
17
+ this.state = defaultState;
18
+ }
19
+ updateState(state) {
20
+ this.state = { ...this.defaultState, ...this.state, ...state };
21
+ this.stateChanged.emit(this.state);
22
+ }
23
+ onStateChanged(listener) {
24
+ return this.stateChanged.on(listener);
25
+ }
26
+ async updateViewport(viewport) {
27
+ if (this.state.viewport == null || !Dimensions.isEqual(this.state.viewport, viewport)) {
28
+ this.updateState({ viewport });
29
+ }
30
+ }
31
+ /**
32
+ * Updates the pan offset for this API, and emits new state with the updated
33
+ * offset.
34
+ *
35
+ * This method will be bounded to the visible portion of the document to ensure
36
+ * at least a portion of the document is always visible, and the `canvas` does not
37
+ * appear blank.
38
+ *
39
+ * @param delta The delta to pan the document by.
40
+ */
41
+ async panByDelta(delta) {
42
+ const panOffset = this.constrainPanOffset(Point.add(this.state.panOffset, delta), this.state.zoomPercentage);
43
+ this.updateState({ panOffset });
44
+ }
45
+ /**
46
+ * Updates the zoom percentage for this API, and emits new state with the updated
47
+ * percentage and adjusted pan offset.
48
+ *
49
+ * This method will automatically adjust existing offsets to maintain the
50
+ * same center point of the document where possible.
51
+ *
52
+ * @param percentage The zoom percentage to set.
53
+ */
54
+ async zoomTo(percentage) {
55
+ const { viewport, zoomPercentage, panOffset } = this.state;
56
+ if (viewport != null) {
57
+ const constrainedZoom = Math.min(Math.max(MIN_ZOOM_PERCENTAGE, percentage), MAX_ZOOM_PERCENTAGE);
58
+ const zoomRatio = constrainedZoom / zoomPercentage;
59
+ // Scale the current pan offset relative to the updated zoom percentage to maintain the same center point.
60
+ // To do this, the center point of the viewport is scaled inversely to the zoom ratio to adjust the center point
61
+ // up and to the left when zooming in, and down and to the right when zooming out. This accounts for the underlying
62
+ // document becoming larger and needing to offset the content less for the same center point, or vice versa for
63
+ // zooming out causing the document to become smaller.
64
+ const scaledOffset = Point.add(Point.scaleProportional(Dimensions.center(viewport), 1 - zoomRatio), Point.scaleProportional(panOffset, zoomRatio));
65
+ const constrainedOffset = this.constrainPanOffset(scaledOffset, constrainedZoom);
66
+ this.updateState({ zoomPercentage: constrainedZoom, panOffset: constrainedOffset });
67
+ }
68
+ else {
69
+ throw new Error('Viewport is not defined. Unable to perform zoom operation.');
70
+ }
71
+ }
72
+ constrainPanOffset(offset, zoomPercentage) {
73
+ const { viewport, contentDimensions } = this.state;
74
+ if (viewport != null && contentDimensions != null) {
75
+ // Scale the viewport by the device pixel ratio to ensure that documents are rendered sharply on all devices.
76
+ const scaledViewport = Dimensions.scale(window.devicePixelRatio, window.devicePixelRatio, viewport);
77
+ // Constrain the offset based on the original content dimensions to prevent scenarios where
78
+ // content winds up rendered outside of the viewport (i.e. the viewport shows as blank).
79
+ const baseScale = Math.min(scaledViewport.width / contentDimensions.width, scaledViewport.height / contentDimensions.height);
80
+ const renderedWidth = contentDimensions.width * baseScale * (zoomPercentage / 100);
81
+ const renderedHeight = contentDimensions.height * baseScale * (zoomPercentage / 100);
82
+ // Minimum values for the offset of the underlying content to keep it visible in the viewport.
83
+ // In the case of a document with dimensions of { width: 100, height: 100 } and a viewport of { width: 50, height: 50 },
84
+ // the minimum offset would be { x: -25, y: -25 }. Using this minimum offset, the viewport is "placed"
85
+ // in the bottom right corner of the viewport, by shifting the content underneath up and to the left.
86
+ const minimumOffsetX = Math.min(0, scaledViewport.width - renderedWidth);
87
+ const minimumOffsetY = Math.min(0, scaledViewport.height - renderedHeight);
88
+ // Maximum values for the offset of the underlying content to keep it visible in the viewport.
89
+ // These values will always be 0, as this represents "placing" the viewport in the top left corner
90
+ // of the document.
91
+ const maximumOffsetX = 0;
92
+ const maximumOffsetY = 0;
93
+ return Point.create(Math.max(minimumOffsetX, Math.min(maximumOffsetX, offset.x)), Math.max(minimumOffsetY, Math.min(maximumOffsetY, offset.y)));
94
+ }
95
+ return offset;
96
+ }
97
+ }
@@ -0,0 +1,41 @@
1
+ /*!
2
+ * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
+ */
4
+ import { apiSupportsLayers } from "./types";
5
+ export class DocumentLayersController {
6
+ constructor(api) {
7
+ this.apiSupportsLayers = false;
8
+ if (apiSupportsLayers(api)) {
9
+ this.apiSupportsLayers = true;
10
+ this.api = api;
11
+ }
12
+ }
13
+ /**
14
+ * Returns a boolean indicating whether the document supports layers.
15
+ */
16
+ get enabled() {
17
+ return this.apiSupportsLayers;
18
+ }
19
+ /**
20
+ * Retrieves the layers of the document.
21
+ *
22
+ * @throws {Error} if the loaded document does not support layers.
23
+ */
24
+ async getLayers() {
25
+ return this.getApi().getLayers();
26
+ }
27
+ /**
28
+ * Sets the visibility of a layer by ID.
29
+ *
30
+ * @throws {Error} if the loaded document does not support layers.
31
+ */
32
+ async setLayerVisibility(id, visible) {
33
+ return this.getApi().setLayerVisibility(id, visible);
34
+ }
35
+ getApi() {
36
+ if (this.api == null) {
37
+ throw new Error('The current document does not support layers.');
38
+ }
39
+ return this.api;
40
+ }
41
+ }
@@ -0,0 +1,5 @@
1
+ /*!
2
+ * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
+ */
4
+ export * from './controller';
5
+ export * from './types';
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
+ */
4
+ /**
5
+ * Returns a boolean indicating whether the provided document API supports layers.
6
+ */
7
+ export function apiSupportsLayers(api) {
8
+ return api != null && typeof api.getLayers === 'function' && typeof api.setLayerVisibility === 'function';
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ /*!
2
+ * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
+ */
4
+ import { EventDispatcher } from "@vertexvis/utils";
5
+ /**
6
+ * A renderer that is responsible for listening to state changes in a `DocumentApi`
7
+ * and rendering resulting images to the provided canvas element.
8
+ */
9
+ export class DocumentRenderer {
10
+ constructor(api, canvas) {
11
+ this.api = api;
12
+ this.canvas = canvas;
13
+ this.pageLoaded = new EventDispatcher();
14
+ this.pageDrawn = new EventDispatcher();
15
+ }
16
+ onPageLoaded(listener) {
17
+ return this.pageLoaded.on(listener);
18
+ }
19
+ onPageDrawn(listener) {
20
+ return this.pageDrawn.on(listener);
21
+ }
22
+ }
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
+ */
4
+ export function getElementBoundingClientRect(element) {
5
+ return element.getBoundingClientRect();
6
+ }
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
+ */
4
+ export * from './config';
@@ -0,0 +1,67 @@
1
+ /*!
2
+ * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
+ */
4
+ import { Point } from "@vertexvis/geometry";
5
+ const DRAG_PIXEL_THRESHOLD = 2;
6
+ export class PanInteractionHandler {
7
+ constructor(element, api) {
8
+ this.element = element;
9
+ this.api = api;
10
+ this.isDragging = false;
11
+ this.handlePointerDown = this.handlePointerDown.bind(this);
12
+ this.handlePointerMove = this.handlePointerMove.bind(this);
13
+ this.handlePointerUp = this.handlePointerUp.bind(this);
14
+ this.handleWheel = this.handleWheel.bind(this);
15
+ this.element.addEventListener('pointerdown', this.handlePointerDown);
16
+ this.element.addEventListener('wheel', this.handleWheel);
17
+ window.addEventListener('wheel', this.handleWheel);
18
+ }
19
+ dispose() {
20
+ this.element.removeEventListener('pointerdown', this.handlePointerDown);
21
+ this.element.removeEventListener('wheel', this.handleWheel);
22
+ this.removeWindowListeners();
23
+ }
24
+ handleWheel(event) {
25
+ event.preventDefault();
26
+ const deltaX = -event.deltaX / 2;
27
+ const deltaY = -event.deltaY / 2;
28
+ if (deltaX !== 0 || deltaY !== 0) {
29
+ this.api.panByDelta(Point.create(deltaX, deltaY));
30
+ }
31
+ }
32
+ handlePointerDown(event) {
33
+ if (event.button !== 0) {
34
+ return;
35
+ }
36
+ event.preventDefault();
37
+ this.downPosition = Point.create(event.clientX, event.clientY);
38
+ this.lastPosition = this.downPosition;
39
+ this.isDragging = false;
40
+ window.addEventListener('pointermove', this.handlePointerMove);
41
+ window.addEventListener('pointerup', this.handlePointerUp);
42
+ }
43
+ handlePointerMove(event) {
44
+ if (this.lastPosition == null || this.downPosition == null) {
45
+ return;
46
+ }
47
+ const currentPosition = Point.create(event.clientX, event.clientY);
48
+ if (!this.isDragging && Point.distance(currentPosition, this.downPosition) < DRAG_PIXEL_THRESHOLD) {
49
+ return;
50
+ }
51
+ this.isDragging = true;
52
+ const delta = Point.subtract(currentPosition, this.lastPosition);
53
+ this.lastPosition = currentPosition;
54
+ this.api.panByDelta(delta);
55
+ }
56
+ handlePointerUp() {
57
+ this.lastPosition = undefined;
58
+ this.downPosition = undefined;
59
+ this.isDragging = false;
60
+ this.removeWindowListeners();
61
+ }
62
+ removeWindowListeners() {
63
+ window.removeEventListener('pointermove', this.handlePointerMove);
64
+ window.removeEventListener('pointerup', this.handlePointerUp);
65
+ window.removeEventListener('wheel', this.handleWheel);
66
+ }
67
+ }
@@ -0,0 +1,67 @@
1
+ /*!
2
+ * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
+ */
4
+ import { Dimensions, Point } from "@vertexvis/geometry";
5
+ import * as pdfjs from "pdfjs-dist/legacy/build/pdf.mjs";
6
+ import { DocumentApi } from "../document/api";
7
+ import { fromUri } from "../types/loadableResource";
8
+ export class PdfJsApi extends DocumentApi {
9
+ constructor(config) {
10
+ var _a;
11
+ super({
12
+ panOffset: Point.create(0, 0),
13
+ zoomPercentage: 100,
14
+ });
15
+ this.config = config;
16
+ pdfjs.GlobalWorkerOptions.workerSrc = (_a = config === null || config === void 0 ? void 0 : config.pdfJs.workerSrc) !== null && _a !== void 0 ? _a : './assets/pdf.worker.min.mjs';
17
+ }
18
+ dispose() {
19
+ var _a;
20
+ (_a = this.state.document) === null || _a === void 0 ? void 0 : _a.destroy();
21
+ }
22
+ async load(uri) {
23
+ const resource = fromUri(uri);
24
+ if (resource.resource.type === 'url') {
25
+ const document = await pdfjs.getDocument(resource.resource.url).promise;
26
+ const optionalContentConfig = await document.getOptionalContentConfig();
27
+ this.updateState({
28
+ document,
29
+ totalPageCount: document.numPages,
30
+ optionalContentConfig,
31
+ layers: Array.from(optionalContentConfig).map(([id, group]) => { var _a; return ({ id, name: (_a = group.name) !== null && _a !== void 0 ? _a : id, visible: group.visible }); }),
32
+ });
33
+ }
34
+ else {
35
+ throw new Error('Invalid resource URI provided. Expected a URL to retrieve a PDF.');
36
+ }
37
+ }
38
+ async loadPage(pageNumber) {
39
+ var _a, _b;
40
+ const totalPageCount = (_a = this.state.totalPageCount) !== null && _a !== void 0 ? _a : 1;
41
+ if (pageNumber <= 0) {
42
+ throw new Error(`Unable to load page ${pageNumber}. The provided page number must be greater than 0.`);
43
+ }
44
+ else if (pageNumber > totalPageCount) {
45
+ throw new Error(`Unable to load page ${pageNumber}. The document only has ${totalPageCount} page(s).`);
46
+ }
47
+ const page = await ((_b = this.state.document) === null || _b === void 0 ? void 0 : _b.getPage(pageNumber));
48
+ const baseViewport = page === null || page === void 0 ? void 0 : page.getViewport({ scale: 1 });
49
+ const contentDimensions = baseViewport != null ? Dimensions.create(baseViewport.width, baseViewport.height) : undefined;
50
+ this.updateState({ loadedPageNumber: pageNumber, contentDimensions, panOffset: Point.create(0, 0) });
51
+ }
52
+ getLayers() {
53
+ var _a;
54
+ return (_a = this.state.layers) !== null && _a !== void 0 ? _a : [];
55
+ }
56
+ setLayerVisibility(id, visible) {
57
+ const { optionalContentConfig } = this.state;
58
+ if (optionalContentConfig == null) {
59
+ throw new Error('No document has been loaded. Unable to set layer visibility.');
60
+ }
61
+ optionalContentConfig.setVisibility(id, visible);
62
+ this.updateState({
63
+ optionalContentConfig,
64
+ layers: Array.from(optionalContentConfig).map(([id, group]) => { var _a; return ({ id, name: (_a = group.name) !== null && _a !== void 0 ? _a : id, visible: group.visible }); }),
65
+ });
66
+ }
67
+ }
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
+ */
4
+ import { PdfJsApi } from "./pdfjs-api";
5
+ import { PdfJsRenderer } from "./pdfjs-renderer";
6
+ export class PdfJsProvider {
7
+ create(canvas, config) {
8
+ const api = new PdfJsApi(config);
9
+ const renderer = new PdfJsRenderer(api, canvas);
10
+ return { api, renderer };
11
+ }
12
+ }
@@ -0,0 +1,77 @@
1
+ /*!
2
+ * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
+ */
4
+ import { Dimensions } from "@vertexvis/geometry";
5
+ import { DocumentRenderer } from "../document/renderer";
6
+ export class PdfJsRenderer extends DocumentRenderer {
7
+ constructor(api, canvas) {
8
+ super(api, canvas);
9
+ this.state = { pages: {}, rendering: false };
10
+ // Render pages using an offscreen canvas to avoid flickering that can occur for
11
+ // PDFs with annotations.
12
+ this.offscreenCanvas = document.createElement('canvas');
13
+ this.handleStateChanged = this.handleStateChanged.bind(this);
14
+ this.stateChangedDisposable = this.api.onStateChanged(this.handleStateChanged);
15
+ }
16
+ dispose() {
17
+ this.stateChangedDisposable.dispose();
18
+ }
19
+ async handleStateChanged(state) {
20
+ await this.renderPage(state);
21
+ }
22
+ async renderPage(state) {
23
+ const { document, loadedPageNumber, viewport, panOffset, zoomPercentage, optionalContentConfig } = state;
24
+ if (this.state.rendering) {
25
+ this.state.pendingStateChange = state;
26
+ return;
27
+ }
28
+ if (document != null && loadedPageNumber != null) {
29
+ this.state.rendering = true;
30
+ if (this.state.pages[loadedPageNumber] == null) {
31
+ this.state.pages[loadedPageNumber] = await document.getPage(loadedPageNumber);
32
+ }
33
+ const page = this.state.pages[loadedPageNumber];
34
+ const dimensions = viewport !== null && viewport !== void 0 ? viewport : Dimensions.create(0, 0);
35
+ const scaledDimensions = Dimensions.scale(window.devicePixelRatio, window.devicePixelRatio, dimensions);
36
+ const baseViewport = page.getViewport({ scale: 1 });
37
+ const scaleX = scaledDimensions.width / baseViewport.width;
38
+ const scaleY = scaledDimensions.height / baseViewport.height;
39
+ const baseScale = Math.max(0.1, Math.min(scaleX, scaleY));
40
+ // If the zoom percentage or viewport dimensions result in a situation where the content
41
+ // has been scaled down to a point where the horizontal dimension is smaller than the viewport,
42
+ // adjust the current panOffset by the difference between the viewport width and the scaled width.
43
+ // This ensures that the content is always centered in the viewport horizontally.
44
+ const effectiveScale = baseScale * (zoomPercentage / 100);
45
+ const scaledWidth = baseViewport.width * effectiveScale;
46
+ const centerOffsetX = Math.max(0, (scaledDimensions.width - scaledWidth) / 2);
47
+ const scaled = page.getViewport({
48
+ scale: effectiveScale,
49
+ offsetX: panOffset.x + centerOffsetX,
50
+ offsetY: panOffset.y,
51
+ });
52
+ this.offscreenCanvas.width = this.canvas.width;
53
+ this.offscreenCanvas.height = this.canvas.height;
54
+ await page.render({
55
+ canvas: this.offscreenCanvas,
56
+ viewport: scaled,
57
+ intent: 'display',
58
+ optionalContentConfigPromise: optionalContentConfig != null ? Promise.resolve(optionalContentConfig) : undefined,
59
+ }).promise;
60
+ // Emit an event before the page is drawn, then draw the page to the canvas on the next
61
+ // animation frame. This allows for more accurate synchronization of external content with the canvas.
62
+ this.pageLoaded.emit(state);
63
+ await new Promise(resolve => {
64
+ window.requestAnimationFrame(() => {
65
+ const ctx = this.canvas.getContext('2d');
66
+ if (ctx != null) {
67
+ ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
68
+ ctx.drawImage(this.offscreenCanvas, 0, 0);
69
+ }
70
+ resolve();
71
+ });
72
+ });
73
+ this.pageDrawn.emit(state);
74
+ this.state.rendering = false;
75
+ }
76
+ }
77
+ }
@@ -0,0 +1,18 @@
1
+ /*!
2
+ * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
+ */
4
+ export function fromUri(uri) {
5
+ const isUrl = uri.startsWith('http');
6
+ if (isUrl) {
7
+ return fromUrl(uri);
8
+ }
9
+ throw new Error(`Invalid URI. Provided URI must be a valid URL or URN.`);
10
+ }
11
+ export function fromUrl(url) {
12
+ return {
13
+ resource: {
14
+ type: 'url',
15
+ url,
16
+ },
17
+ };
18
+ }
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
+ */
4
+ import resizeObserver from "./resize-observer";
5
+ export default function () {
6
+ resizeObserver();
7
+ }
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
+ */
4
+ import { install } from "resize-observer";
5
+ export default function () {
6
+ if (typeof ResizeObserver === 'undefined') {
7
+ install();
8
+ }
9
+ }
@@ -0,0 +1,19 @@
1
+ /*!
2
+ * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
+ */
4
+ import { DocumentApi } from "../lib/document/api";
5
+ export const mockPanByDelta = jest.fn();
6
+ export const mockZoomTo = jest.fn();
7
+ export const mockDispose = jest.fn();
8
+ export const mockLoad = jest.fn();
9
+ export const mockLoadPage = jest.fn();
10
+ export class MockDocumentApi extends DocumentApi {
11
+ constructor(initialState) {
12
+ super(initialState);
13
+ this.panByDelta = mockPanByDelta.mockImplementation((delta) => super.panByDelta(delta));
14
+ this.zoomTo = mockZoomTo.mockImplementation((percentage) => super.zoomTo(percentage));
15
+ this.dispose = mockDispose;
16
+ this.load = mockLoad;
17
+ this.loadPage = mockLoadPage;
18
+ }
19
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Get the base path to where the assets can be found. Use "setAssetPath(path)"
3
+ * if the path needs to be customized.
4
+ */
5
+ export declare const getAssetPath: (path: string) => string;
6
+
7
+ /**
8
+ * Used to manually set the base path where assets can be found.
9
+ * If the script is used as "module", it's recommended to use "import.meta.url",
10
+ * such as "setAssetPath(import.meta.url)". Other options include
11
+ * "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
12
+ * dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
13
+ * But do note that this configuration depends on how your script is bundled, or lack of
14
+ * bundling, and where your assets can be loaded from. Additionally custom bundling
15
+ * will have to ensure the static assets are copied to its build directory.
16
+ */
17
+ export declare const setAssetPath: (path: string) => void;
18
+
19
+ /**
20
+ * Used to specify a nonce value that corresponds with an application's CSP.
21
+ * When set, the nonce will be added to all dynamically created script and style tags at runtime.
22
+ * Alternatively, the nonce value can be set on a meta tag in the DOM head
23
+ * (<meta name="csp-nonce" content="{ nonce value here }" />) which
24
+ * will result in the same behavior.
25
+ */
26
+ export declare const setNonce: (nonce: string) => void
27
+
28
+ export interface SetPlatformOptions {
29
+ raf?: (c: FrameRequestCallback) => number;
30
+ ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
31
+ rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
32
+ }
33
+ export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
34
+
35
+ export * from '../types';
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
+ */
4
+ import{g as t}from"./p-DRNDkVQa.js";export{a as getAssetPath,r as render,s as setAssetPath,b as setNonce,c as setPlatformOptions}from"./p-DRNDkVQa.js";t();
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
3
+ */
4
+ var e,t,n={},r={},o={};function l(){return e||(e=1,Object.defineProperty(o,"__esModule",{value:!0}),o.ContentRect=function(e){if("getBBox"in e){var t=e.getBBox();return Object.freeze({height:t.height,left:0,top:0,width:t.width})}var n=window.getComputedStyle(e);return Object.freeze({height:parseFloat(n.height||"0"),left:parseFloat(n.paddingLeft||"0"),top:parseFloat(n.paddingTop||"0"),width:parseFloat(n.width||"0")})}),o}var i,f,s={},c=function(){if(f)return n;f=1,Object.defineProperty(n,"__esModule",{value:!0});var e=function(){if(t)return r;t=1,Object.defineProperty(r,"__esModule",{value:!0});var e=l(),n=function(){function t(e){this.target=e,this.$$broadcastWidth=this.$$broadcastHeight=0}return Object.defineProperty(t.prototype,"broadcastWidth",{get:function(){return this.$$broadcastWidth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"broadcastHeight",{get:function(){return this.$$broadcastHeight},enumerable:!0,configurable:!0}),t.prototype.isActive=function(){var t=e.ContentRect(this.target);return!!t&&(t.width!==this.broadcastWidth||t.height!==this.broadcastHeight)},t}();return r.ResizeObservation=n,r}(),o=function(){if(i)return s;i=1,Object.defineProperty(s,"__esModule",{value:!0});var e=l();return s.ResizeObserverEntry=function(t){this.target=t,this.contentRect=e.ContentRect(t)},s}(),c=[],u=function(){function t(e){this.$$observationTargets=[],this.$$activeTargets=[],this.$$skippedTargets=[];var t=function(e){return void 0===e?"Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.":"function"!=typeof e?"Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.":void 0}(e);if(t)throw TypeError(t);this.$$callback=e}return t.prototype.observe=function(t){var n,r=d("observe",t);if(r)throw TypeError(r);p(this.$$observationTargets,t)>=0||(this.$$observationTargets.push(new e.ResizeObservation(t)),c.indexOf(n=this)<0&&(c.push(n),g()))},t.prototype.unobserve=function(e){var t=d("unobserve",e);if(t)throw TypeError(t);var n=p(this.$$observationTargets,e);n<0||(this.$$observationTargets.splice(n,1),0===this.$$observationTargets.length&&a(this))},t.prototype.disconnect=function(){this.$$observationTargets=[],this.$$activeTargets=[],a(this)},t}();function a(e){var t=c.indexOf(e);t>=0&&(c.splice(t,1),y())}function d(e,t){return void 0===t?"Failed to execute '"+e+"' on 'ResizeObserver': 1 argument required, but only 0 present.":t&&t.nodeType===window.Node.ELEMENT_NODE?void 0:"Failed to execute '"+e+"' on 'ResizeObserver': parameter 1 is not of type 'Element'."}function p(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1}n.ResizeObserver=u;var b,h=function(e){c.forEach((function(t){t.$$activeTargets=[],t.$$skippedTargets=[],t.$$observationTargets.forEach((function(n){n.isActive()&&(m(n.target)>e?t.$$activeTargets.push(n):t.$$skippedTargets.push(n))}))}))},v=function(){var e=1/0;return c.forEach((function(t){if(t.$$activeTargets.length){var n=[];t.$$activeTargets.forEach((function(t){var r=new o.ResizeObserverEntry(t.target);n.push(r),t.$$broadcastWidth=r.contentRect.width,t.$$broadcastHeight=r.contentRect.height;var l=m(t.target);l<e&&(e=l)})),t.$$callback(n,t),t.$$activeTargets=[]}})),e},m=function(e){for(var t=0;e.parentNode;)e=e.parentNode,t+=1;return t},g=function(){b||w()},w=function(){b=window.requestAnimationFrame((function(){(function(){var e,t=0;for(h(t);c.some((function(e){return!!e.$$activeTargets.length}));)t=v(),h(t);c.some((function(e){return!!e.$$skippedTargets.length}))&&(e=new window.ErrorEvent("ResizeLoopError",{message:"ResizeObserver loop completed with undelivered notifications."}),window.dispatchEvent(e))})(),w()}))},y=function(){b&&!c.some((function(e){return!!e.$$observationTargets.length}))&&(window.cancelAnimationFrame(b),b=void 0)};return n.install=function(){return window.ResizeObserver=u},n}();const u=function(){"undefined"==typeof ResizeObserver&&c.install()}||(()=>{}),a=":root{--white:#ffffff;--black:#000000}:root{--neutral-050:#fafafa;--neutral-100:#f5f5f5;--neutral-200:#eeeeee;--neutral-300:#e0e0e0;--neutral-400:#bdbdbd;--neutral-500:#9e9e9e;--neutral-600:#757575;--neutral-700:#616161;--neutral-800:#444444;--neutral-900:#212121}:root{--red-050:#fff7f7;--red-100:#ffefef;--red-200:#ffe0e0;--red-300:#ffb3b3;--red-400:#ff4d4d;--red-500:#ff0000;--red-600:#eb0000;--red-700:#d90000;--red-800:#c40000;--red-900:#990000}:root{--orange-050:#fffcf7;--orange-100:#fff9ef;--orange-200:#fff3e0;--orange-300:#ffe0b3;--orange-400:#ffb84d;--orange-500:#ff9900;--orange-600:#ff8400;--orange-700:#ff7300;--orange-800:#e05d00;--orange-900:#993b00}:root{--yellow-050:#fffef7;--yellow-100:#fffdef;--yellow-200:#fffbe0;--yellow-300:#fff5b3;--yellow-400:#ffee6e;--yellow-500:#ffe600;--yellow-600:#ffd300;--yellow-700:#ffc500;--yellow-800:#cc8f00;--yellow-900:#995c00}:root{--green-050:#f7fdf7;--green-100:#effcef;--green-200:#e0f9e0;--green-300:#b3f0b3;--green-400:#4ddb4d;--green-500:#00cc00;--green-600:#00c000;--green-700:#00ad00;--green-800:#008000;--green-900:#004d00}:root{--teal-050:#f8fdfc;--teal-100:#f1fbfa;--teal-200:#e4f7f5;--teal-300:#bcece7;--teal-400:#62d2c7;--teal-500:#1fbeaf;--teal-600:#17af9f;--teal-700:#0a9986;--teal-800:#07705f;--teal-900:#054d43}:root{--blue-050:#f7fcfd;--blue-100:#eff9fc;--blue-200:#e0f3f9;--blue-300:#b3e0f0;--blue-400:#4db8db;--blue-500:#0099cc;--blue-600:#0086c0;--blue-700:#006bad;--blue-800:#004f80;--blue-900:#002f4d}:root{--purple-050:#fdf9fc;--purple-100:#faf2f8;--purple-200:#f6e6f2;--purple-300:#e9c2e0;--purple-400:#cb70b6;--purple-500:#b43296;--purple-600:#a42683;--purple-700:#8c1368;--purple-800:#66124b;--purple-900:#4d0b39}:root{--x-axis-color:#ea3324;--y-axis-color:#4faf32;--z-axis-color:#0000ff;--two-axes-color:#e0e0e0}:root{--padding-1:0.25em;--padding-2:0.5em;--padding-3:0.75em;--padding-4:1em;--padding-5:1.25em;--padding-6:1.5em;--padding-7:1.75em;--padding-8:2em;--abs-padding-1:0.25rem;--abs-padding-2:0.5rem;--abs-padding-3:0.75rem;--abs-padding-4:1rem;--abs-padding-5:1.25rem;--abs-padding-6:1.5rem;--abs-padding-7:1.75rem;--abs-padding-8:2rem}";function d(e,t,n){const r="undefined"!=typeof HTMLElement?HTMLElement.prototype:null;for(;e&&e!==r;){const r=Object.getOwnPropertyDescriptor(e,t);if(r&&(!n||r.get))return r;e=Object.getPrototypeOf(e)}}var p,b=(e,t)=>{var n;Object.entries(null!=(n=t.o.t)?n:{}).map((([n,[r]])=>{if(31&r||32&r){const r=e[n],o=d(Object.getPrototypeOf(e),n,!0)||Object.getOwnPropertyDescriptor(e,n);o&&Object.defineProperty(e,n,{get(){return o.get.call(this)},set(e){o.set.call(this,e)},configurable:!0,enumerable:!0}),t.l.has(n)?e[n]=t.l.get(n):void 0!==r&&(e[n]=r)}}))},h=e=>{if(e.__stencil__getHostRef)return e.__stencil__getHostRef()},v=(e,t)=>t in e,m=(e,t)=>(0,console.error)(e,t),g=new Map,w="undefined"!=typeof window?window:{},y=w.HTMLElement||class{},$={i:0,u:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,r)=>e.addEventListener(t,n,r),rel:(e,t,n,r)=>e.removeEventListener(t,n,r),ce:(e,t)=>new CustomEvent(e,t)},O=(()=>{try{return!!w.document.adoptedStyleSheets&&(new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync)}catch(e){}return!1})(),j=!!O&&(()=>!!w.document&&Object.getOwnPropertyDescriptor(w.document.adoptedStyleSheets,"length").writable)(),S=!1,M=[],E=[],x=(e,t)=>n=>{e.push(n),S||(S=!0,t&&4&$.i?R(k):$.raf(k))},_=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){m(e)}e.length=0},k=()=>{_(M),_(E),(S=M.length>0)&&$.raf(k)},R=e=>Promise.resolve(undefined).then(e),F=x(E,!0),z=e=>{const t=new URL(e,$.u);return t.origin!==w.location.origin?t.href:t.pathname},C=e=>$.u=e;function A(){var e;const t=this.attachShadow({mode:"open"});if(void 0===p&&(p=null!=(e=function(e){if(!O)return;const t=new CSSStyleSheet;return t.replaceSync(e),t}(a))?e:null),p)j?t.adoptedStyleSheets.push(p):t.adoptedStyleSheets=[...t.adoptedStyleSheets,p];else if(!O){const e=document.createElement("style");e.innerHTML=a,t.prepend(e)}}var L,H=new WeakMap,N=e=>"sc-"+e.p,T=e=>"object"==(e=typeof e)||"function"===e,D=(e,t,...n)=>{let r=null,o=null,l=!1,i=!1;const f=[],s=t=>{for(let n=0;n<t.length;n++)r=t[n],Array.isArray(r)?s(r):null!=r&&"boolean"!=typeof r&&((l="function"!=typeof e&&!T(r))&&(r=String(r)),l&&i?f[f.length-1].h+=r:f.push(l?P(null,r):r),i=l)};if(s(n),t){t.key&&(o=t.key);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}const c=P(e,null);return c.v=t,f.length>0&&(c.m=f),c.$=o,c},P=(e,t)=>({i:0,O:e,h:null!=t?t:null,j:null,m:null,v:null,$:null}),U={},W=(e,t)=>null==e||T(e)?e:2&t?"string"==typeof e?parseFloat(e):"number"==typeof e?e:NaN:1&t?String(e):e,q=(e,t)=>{const n=e;return{emit:e=>V(n,t,{bubbles:!0,composed:!0,cancelable:!0,detail:e})}},V=(e,t,n)=>{const r=$.ce(t,n);return e.dispatchEvent(r),r},B=(e,t,n,r,o,l)=>{if(n===r)return;let i=v(e,t),f=t.toLowerCase();if("class"===t){const t=e.classList,o=Z(n);let l=Z(r);t.remove(...o.filter((e=>e&&!l.includes(e)))),t.add(...l.filter((e=>e&&!o.includes(e))))}else if("key"===t);else if("ref"===t)r&&se(r,e);else if(e.__lookupSetter__(t)||"o"!==t[0]||"n"!==t[1]){if("a"===t[0]&&t.startsWith("attr:")){const n=t.slice(5);let o;{const t=h(e);if(t&&t.o&&t.o.t){const e=t.o.t[n];e&&e[1]&&(o=e[1])}}return o||(o=n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),void(null==r||!1===r?!1===r&&""!==e.getAttribute(o)||e.removeAttribute(o):e.setAttribute(o,!0===r?"":r))}if("p"===t[0]&&t.startsWith("prop:")){const n=t.slice(5);try{e[n]=r}catch(e){}return}{const f=T(r);if((i||f&&null!==r)&&!o)try{if(e.tagName.includes("-"))e[t]!==r&&(e[t]=r);else{const o=null==r?"":r;"list"===t?i=!1:null!=n&&e[t]===o||("function"==typeof e.__lookupSetter__(t)?e[t]=o:e.setAttribute(t,o))}}catch(e){}null==r||!1===r?!1===r&&""!==e.getAttribute(t)||e.removeAttribute(t):(!i||4&l||o)&&!f&&1===e.nodeType&&e.setAttribute(t,r=!0===r?"":r)}}else if(t="-"===t[2]?t.slice(3):v(w,f)?f.slice(2):f[2]+t.slice(3),n||r){const o=t.endsWith(G);t=t.replace(I,""),n&&$.rel(e,t,n,o),r&&$.ael(e,t,r,o)}},Y=/\s/,Z=e=>("object"==typeof e&&e&&"baseVal"in e&&(e=e.baseVal),e&&"string"==typeof e?e.split(Y):[]),G="Capture",I=new RegExp(G+"$"),J=(e,t,n)=>{const r=11===t.j.nodeType&&t.j.host?t.j.host:t.j,o=e&&e.v||{},l=t.v||{};for(const e of K(Object.keys(o)))e in l||B(r,e,o[e],void 0,n,t.i);for(const e of K(Object.keys(l)))B(r,e,o[e],l[e],n,t.i)};function K(e){return e.includes("ref")?[...e.filter((e=>"ref"!==e)),"ref"]:e}var Q=!1,X=!1,ee=[],te=[],ne=(e,t,n)=>{const r=t.m[n];let o,l,i=0;if(!w.document)throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");if(o=r.j=w.document.createElement(r.O),J(null,r,X),r.m){const t="template"===r.O?o.content:o;for(i=0;i<r.m.length;++i)l=ne(e,r,i),l&&t.appendChild(l)}return o["s-hn"]=L,o},re=(e,t,n,r,o,l)=>{let i,f=e;for(f.shadowRoot&&f.tagName===L&&(f=f.shadowRoot),"template"===n.O&&(f=f.content);o<=l;++o)r[o]&&(i=ne(null,n,o),i&&(r[o].j=i,ce(f,i,t)))},oe=(e,t,n)=>{for(let r=t;r<=n;++r){const t=e[r];if(t){const e=t.j;fe(t),e&&e.remove()}}},le=(e,t,n=!1)=>e.O===t.O&&(n?(n&&!e.$&&t.$&&(e.$=t.$),!0):e.$===t.$),ie=(e,t,n=!1)=>{const r=t.j=e.j,o=e.m,l=t.m;"slot"!==t.O||Q||e.S!==t.S&&(t.j["s-sn"]=t.S||"",(e=>{$.i|=1;const t=e.closest(L.toLowerCase());if(null!=t){const n=Array.from(t.__childNodes||t.childNodes).find((e=>e["s-cr"])),r=Array.from(e.__childNodes||e.childNodes);for(const e of n?r.reverse():r)null!=e["s-sh"]&&(ce(t,e,null!=n?n:null),e["s-sh"]=void 0)}$.i&=-2})(t.j.parentElement)),J(e,t,X),null!==o&&null!==l?((e,t,n,r,o=!1)=>{let l,i,f=0,s=0,c=0,u=0,a=t.length-1,d=t[0],p=t[a],b=r.length-1,h=r[0],v=r[b];const m="template"===n.O?e.content:e;for(;f<=a&&s<=b;)if(null==d)d=t[++f];else if(null==p)p=t[--a];else if(null==h)h=r[++s];else if(null==v)v=r[--b];else if(le(d,h,o))ie(d,h,o),d=t[++f],h=r[++s];else if(le(p,v,o))ie(p,v,o),p=t[--a],v=r[--b];else if(le(d,v,o))ie(d,v,o),ce(m,d.j,p.j.nextSibling),d=t[++f],v=r[--b];else if(le(p,h,o))ie(p,h,o),ce(m,p.j,d.j),p=t[--a],h=r[++s];else{for(c=-1,u=f;u<=a;++u)if(t[u]&&null!==t[u].$&&t[u].$===h.$){c=u;break}c>=0?(i=t[c],i.O!==h.O?l=ne(t&&t[s],n,c):(ie(i,h,o),t[c]=void 0,l=i.j),h=r[++s]):(l=ne(t&&t[s],n,s),h=r[++s]),l&&ce(d.j.parentNode,l,d.j)}f>a?re(e,null==r[b+1]?null:r[b+1].j,n,r,s,b):s>b&&oe(t,f,a)})(r,o,t,l,n):null!==l?re(r,null,t,l,0,l.length-1):!n&&null!==o&&oe(o,0,o.length-1)},fe=e=>{e.v&&e.v.ref&&ee.push((()=>e.v.ref(null))),e.m&&e.m.map(fe)},se=(e,t)=>{te.push((()=>e(t)))},ce=(e,t,n)=>e.__insertBefore?e.__insertBefore(t,n):null==e?void 0:e.insertBefore(t,n),ue=(e,t,n=!1)=>{const r=e.$hostElement$,o=e.o,l=e.M||P(null,null);var i;const f=(i=t)&&i.O===U?t:D(null,null,t);if(L=r.tagName,o._&&(f.v=f.v||{},o._.forEach((([e,t])=>{f.v[t]=r[e]}))),n&&f.v)for(const e of Object.keys(f.v))r.hasAttribute(e)&&!["key","ref","style","class"].includes(e)&&(f.v[e]=r[e]);f.O=null,f.i|=4,e.M=f,f.j=l.j=r.shadowRoot||r,Q=!(!(1&o.i)||128&o.i),ie(l,f,n),ee.forEach((e=>e())),ee.length=0,te.forEach((e=>e())),te.length=0},ae=(e,t)=>{if(t&&!e.k&&t["s-p"]){const n=t["s-p"].push(new Promise((r=>e.k=()=>{t["s-p"].splice(n-1,1),r()})))}},de=(e,t)=>{if(e.i|=16,4&e.i)return void(e.i|=512);ae(e,e.R);const n=()=>pe(e,t);if(!t)return F(n);queueMicrotask((()=>{n()}))},pe=(e,t)=>{const n=e.$hostElement$,r=n;if(!r)throw new Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let o;return o=ye(r,t?"componentWillLoad":"componentWillUpdate",void 0,n),o=be(o,(()=>ye(r,"componentWillRender",void 0,n))),be(o,(()=>ve(e,r,t)))},be=(e,t)=>he(e)?e.then(t).catch((e=>{console.error(e),t()})):t(),he=e=>e instanceof Promise||e&&e.then&&"function"==typeof e.then,ve=async(e,t,n)=>{var r;const o=e.$hostElement$,l=o["s-rc"];n&&(e=>{const t=e.o,n=e.$hostElement$,r=t.i,o=((e,t)=>{var n,r,o;const l=N(t),i=g.get(l);if(!w.document)return l;if(e=11===e.nodeType?e:w.document,i)if("string"==typeof i){let o,f=H.get(e=e.head||e);if(f||H.set(e,f=new Set),!f.has(l)){o=w.document.createElement("style"),o.textContent=i;const s=null!=(n=$.F)?n:function(){var e,t,n;return null!=(n=null==(t=null==(e=w.document.head)?void 0:e.querySelector('meta[name="csp-nonce"]'))?void 0:t.getAttribute("content"))?n:void 0}();if(null!=s&&o.setAttribute("nonce",s),!(1&t.i))if("HEAD"===e.nodeName){const t=e.querySelectorAll("link[rel=preconnect]"),n=t.length>0?t[t.length-1].nextSibling:e.querySelector("style");e.insertBefore(o,(null==n?void 0:n.parentNode)===e?n:null)}else if("host"in e)if(O){const t=new(null!=(r=e.defaultView)?r:e.ownerDocument.defaultView).CSSStyleSheet;t.replaceSync(i),j?e.adoptedStyleSheets.unshift(t):e.adoptedStyleSheets=[t,...e.adoptedStyleSheets]}else{const t=e.querySelector("style");t?t.textContent=i+t.textContent:e.prepend(o)}else e.append(o);1&t.i&&e.insertBefore(o,null),4&t.i&&(o.textContent+="slot-fb{display:contents}slot-fb[hidden]{display:none}"),f&&f.add(l)}}else{let t=H.get(e);if(t||H.set(e,t=new Set),!t.has(l)){const n=null!=(o=e.defaultView)?o:e.ownerDocument.defaultView;let r;if(i.constructor===n.CSSStyleSheet)r=i;else{r=new n.CSSStyleSheet;for(let e=0;e<i.cssRules.length;e++)r.insertRule(i.cssRules[e].cssText,e)}j?e.adoptedStyleSheets.push(r):e.adoptedStyleSheets=[...e.adoptedStyleSheets,r],t.add(l)}}return l})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&r&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);me(e,t,o,n),l&&(l.map((e=>e())),o["s-rc"]=void 0);{const t=null!=(r=o["s-p"])?r:[],n=()=>ge(e);0===t.length?n():(Promise.all(t).then(n).catch(n),e.i|=4,t.length=0)}},me=(e,t,n,r)=>{try{t=t.render(),e.i&=-17,e.i|=2,ue(e,t,r)}catch(t){m(t,e.$hostElement$)}return null},ge=e=>{const t=e.$hostElement$,n=t,r=e.R;ye(n,"componentDidRender",void 0,t),64&e.i?ye(n,"componentDidUpdate",void 0,t):(e.i|=64,$e(t),ye(n,"componentDidLoad",void 0,t),e.C(t),r||we()),e.k&&(e.k(),e.k=void 0),512&e.i&&R((()=>de(e,!1))),e.i&=-517},we=()=>{R((()=>V(w,"appload",{detail:{namespace:"doc-viewer"}})))},ye=(e,t,n,r)=>{if(e&&e[t])try{return e[t](n)}catch(e){m(e,r)}},$e=e=>e.classList.add("hydrated"),Oe=(e,t,n,r)=>{const o=h(e);if(!o)return;const l=e,i=o.l.get(t),f=o.i,s=l;n=W(n,r.t[t][0]);const c=Number.isNaN(i)&&Number.isNaN(n);if(n!==i&&!c){if(o.l.set(t,n),r.A){const e=r.A[t];e&&e.map((e=>{try{const[[r,l]]=Object.entries(e);(128&f||1&l)&&(s?s[r](n,i,t):o.L.push((()=>{o.H[r](n,i,t)})))}catch(e){m(e,l)}}))}if(2&f){if(s.componentShouldUpdate&&!1===s.componentShouldUpdate(n,i,t)&&!(16&f))return;16&f||de(o,!1)}}},je=(e,t)=>{var n,r;const o=e.prototype;{e.watchers&&!t.A&&(t.A=e.watchers),e.deserializers&&!t.N&&(t.N=e.deserializers),e.serializers&&!t.T&&(t.T=e.serializers);const l=Object.entries(null!=(n=t.t)?n:{});l.map((([e,[n]])=>{if(31&n||32&n){const{get:r,set:l}=d(o,e)||{};r&&(t.t[e][0]|=2048),l&&(t.t[e][0]|=4096),Object.defineProperty(o,e,{get(){return r?r.apply(this):(t=e,h(this).l.get(t));var t},configurable:!0,enumerable:!0}),Object.defineProperty(o,e,{set(r){const o=h(this);if(o){if(l)return void 0===(32&n?this[e]:o.$hostElement$[e])&&o.l.get(e)&&(r=o.l.get(e)),l.apply(this,[W(r,n)]),void Oe(this,e,r=32&n?this[e]:o.$hostElement$[e],t);Oe(this,e,r,t)}}})}}));{const n=new Map;o.attributeChangedCallback=function(e,r,i){$.jmp((()=>{var f;const s=n.get(e),c=h(this);if(this.hasOwnProperty(s),o.hasOwnProperty(s)&&"number"==typeof this[s]&&this[s]==i)return;if(null==s){const n=null==c?void 0:c.i;if(c&&n&&!(8&n)&&i!==r){const o=this,l=null==(f=t.A)?void 0:f[e];null==l||l.forEach((t=>{const[[l,f]]=Object.entries(t);null!=o[l]&&(128&n||1&f)&&o[l].call(o,i,r,e)}))}return}const u=l.find((([e])=>e===s));u&&4&u[1][0]&&(i=null!==i&&"false"!==i);const a=Object.getOwnPropertyDescriptor(o,s);i==this[s]||a.get&&!a.set||(this[s]=i)}))},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(r=t.A)?r:{}),...l.filter((([e,t])=>31&t[0])).map((([e,r])=>{var o;const l=r[1]||e;return n.set(l,e),512&r[0]&&(null==(o=t._)||o.push([e,l])),l}))]))}}return e},Se=(e,t)=>{const n={i:t[0],p:t[1]};try{n.t=t[2],n.A=e.A,n.N=e.N,n.T=e.T,n._=[];const r=e.prototype.connectedCallback,o=e.prototype.disconnectedCallback;return Object.assign(e.prototype,{__hasHostListenerAttached:!1,__registerHost(){((e,t)=>{const n={i:0,$hostElement$:e,o:t,l:new Map,D:new Map};n.P=new Promise((e=>n.C=e)),e["s-p"]=[],e["s-rc"]=[];const r=n;e.__stencil__getHostRef=()=>r,512&t.i&&b(e,n)})(this,n)},connectedCallback(){if(!this.__hasHostListenerAttached){if(!h(this))return;this.__hasHostListenerAttached=!0}(e=>{if(!(1&$.i)){const t=h(e);if(!t)return;const n=t.o,r=()=>{};if(1&t.i)(null==t?void 0:t.H)||(null==t?void 0:t.P)&&t.P.then((()=>{}));else{t.i|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){ae(t,t.R=n);break}}n.t&&Object.entries(n.t).map((([t,[n]])=>{if(31&n&&Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n)=>{let r;try{if(!(32&t.i)&&(t.i|=32,r=e.constructor,customElements.whenDefined(e.localName).then((()=>t.i|=128)),r&&r.style)){let e;"string"==typeof r.style&&(e=r.style);const t=N(n);if(!g.has(t)){const r=()=>{};((e,t,n)=>{let r=g.get(e);O&&n?(r=r||new CSSStyleSheet,"string"==typeof r?r=t:r.replaceSync(t)):r=t,g.set(e,r)})(t,e,!!(1&n.i)),r()}}const o=t.R,l=()=>de(t,!0);o&&o["s-rc"]?o["s-rc"].push(l):l()}catch(n){m(n,e),t.k&&(t.k(),t.k=void 0),t.C&&t.C(e)}})(e,t,n)}r()}})(this),r&&r.call(this)},disconnectedCallback(){(async e=>{1&$.i||h(e),H.has(e)&&H.delete(e),e.shadowRoot&&H.has(e.shadowRoot)&&H.delete(e.shadowRoot)})(this),o&&o.call(this)},__attachShadow(){if(this.shadowRoot){if("open"!==this.shadowRoot.mode)throw new Error(`Unable to re-use existing shadow root for ${n.p}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else A.call(this,n)}}),Object.defineProperty(e,"is",{value:n.p,configurable:!0}),je(e,n)}catch(t){return m(t),e}},Me=e=>$.F=e,Ee=e=>Object.assign($,e);function xe(e,t){ue({o:{i:0,p:t.tagName},$hostElement$:t},e)}function _e(e){return e}export{y as H,z as a,Me as b,Ee as c,q as d,U as e,u as g,D as h,Se as p,xe as r,C as s,_e as t}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface VertexDocumentViewer extends Components.VertexDocumentViewer, HTMLElement {}
4
+ export const VertexDocumentViewer: {
5
+ prototype: VertexDocumentViewer;
6
+ new (): VertexDocumentViewer;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;