etiquetas.js 1.0.0-alpha.10 → 1.0.0-alpha.12

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.
@@ -87,8 +87,9 @@ var __asyncGenerator = (__this, __arguments, generator) => {
87
87
  return generator = generator.apply(__this, __arguments), it2[__knownSymbol("asyncIterator")] = () => it2, method("next"), method("throw"), method("return"), it2;
88
88
  };
89
89
  var __forAwait = (obj, it2, method) => (it2 = obj[__knownSymbol("asyncIterator")]) ? it2.call(obj) : (obj = obj[__knownSymbol("iterator")](), it2 = {}, method = (key, fn) => (fn = obj[key]) && (it2[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it2);
90
- var _Util_static, getExtremumOnCurve_fn, getExtremum_fn, _regex, _toolbar, _colorPicker, _editor, _buttons, _altText, _comment, _signatureDescriptionButton, _l10nRemove, _EditorToolbar_static, pointerDown_fn, _EditorToolbar_instances, focusIn_fn, focusOut_fn, addListenersToElement_fn, divider_get, _buttons2, _toolbar2, _uiManager, _HighlightToolbar_instances, render_fn, getLastPoint_fn, addHighlightButton_fn, _id, _baseId, _id2, _cache, _ImageManager_instances, get_fn, _commands, _locked, _maxSize, _position, _KeyboardManager_instances, serialize_fn, _abortController, _activeEditor, _allEditors, _allLayers, _altTextManager, _annotationStorage, _changedExistingAnnotations, _commandManager, _commentManager, _copyPasteAC, _currentDrawingSession, _currentPageIndex, _deletedAnnotationsElementIds, _draggingEditors, _editorTypes, _editorsToRescale, _enableHighlightFloatingButton, _enableUpdatedAddImage, _enableNewAltTextWhenAddingImage, _filterFactory, _focusMainContainerTimeoutId, _focusManagerAC, _highlightColors, _highlightWhenShiftUp, _highlightToolbar, _idManager, _isEnabled, _isWaiting, _keyboardManagerAC, _lastActiveElement, _mainHighlightColorPicker, _missingCanvases, _mlManager, _mode, _selectedEditors, _selectedTextNode, _signatureManager, _pageColors, _showAllStates, _previousStates, _translation, _translationTimeoutId, _container, _viewer, _viewerAlert, _updateModeCapability, _AnnotationEditorUIManager_instances, getAnchorElementForSelection_fn, getLayerForTextLayer_fn, displayHighlightToolbar_fn, selectionChange_fn, onSelectEnd_fn, addSelectionListener_fn, addFocusManager_fn, removeFocusManager_fn, addKeyboardManager_fn, removeKeyboardManager_fn, addCopyPasteListeners_fn, removeCopyPasteListeners_fn, addDragAndDropListeners_fn, dispatchUpdateStates_fn, dispatchUpdateUI_fn, enableAll_fn, disableAll_fn, addEditorToLayer_fn, lastSelectedEditor_get, isEmpty_fn, selectEditors_fn, _altText2, _altTextDecorative, _altTextButton, _altTextButtonLabel, _altTextTooltip, _altTextTooltipTimeout, _altTextWasFromKeyBoard, _badge, _editor2, _guessedText, _textWithDisclaimer, _useNewAltTextFlow, _l10nNewButton, _AltText_instances, label_get, setState_fn, _commentButton, _commentWasFromKeyBoard, _editor3, _initialText, _text, _date, _deleted, _container2, _isPinching, _isPinchingStopped, _isPinchingDisabled, _onPinchStart, _onPinching, _onPinchEnd, _pointerDownAC, _signal, _touchInfo, _touchManagerAC, _touchMoveAC, _TouchManager_instances, onTouchStart_fn, onTouchMove_fn, onTouchEnd_fn, _accessibilityData, _allResizerDivs, _altText3, _comment2, _disabled, _dragPointerId, _dragPointerType, _keepAspectRatio, _resizersDiv, _lastPointerCoords, _savedDimensions, _focusAC, _focusedResizerName, _hasBeenClicked, _initialRect, _isEditing, _isInEditMode, _isResizerEnabledForKeyboard, _moveInDOMTimeout, _prevDragX, _prevDragY, _telemetryTimeouts, _touchManager, _isDraggable, _zIndex, _AnnotationEditor_instances, translate_fn, _AnnotationEditor_static, rotatePoint_fn, getRotationMatrix_fn, createResizers_fn, resizerPointerdown_fn, resize_fn, addResizeToUndoStack_fn, resizerPointermove_fn, touchPinchStartCallback_fn, touchPinchCallback_fn, touchPinchEndCallback_fn, selectOnPointerEvent_fn, setUpDragSession_fn, addFocusListeners_fn, resizerKeydown_fn, resizerBlur_fn, resizerFocus_fn, setResizerTabIndex_fn, stopResizing_fn, _modified, _modifiedIds, _storage, _AnnotationStorage_instances, setModified_fn, _serializable, _systemFonts, _listeners, _deferred, _messageAC, _MessageHandler_instances, onMessage_fn, createStreamSink_fn, processStreamMessage_fn, deleteStreamController_fn, _enableHWA, _baseUrl, __cache, __defs, _docId, _document, __hcmCache, _id3, _DOMFilterFactory_instances, cache_get, hcmCache_get, defs_get, createTables_fn, createUrl_fn, addLuminosityConversion_fn, addGrayConversion_fn, createFilter_fn, appendFeFunc_fn, addTransferMapConversion_fn, addTransferMapAlphaConversion_fn, getRGB_fn, _CanvasGraphics_instances, restoreInitialState_fn, drawFilter_fn, getScaledPath_fn, _port, _src, _map, _data, _isDisplay, _isPrint, _userSet, _visible, _cachedGetHash, _groups, _initialHash, _order, _OptionalContentConfig_instances, evaluateVisibilityExpression_fn, _objs, _PDFObjects_instances, ensureObj_fn, _g, _capability, _container3, _disableProcessItems, _fontInspectorEnabled, _lang, _layoutTextParams, _pageHeight, _pageWidth, _reader, _rootContainer, _rotation, _scale, _styleCache, _textContentItemsStr, _textContentSource, _textDivs, _textDivProperties, _transform, _ascentCache, _canvasContexts, _canvasCtxFonts, _minFontSize, _pendingTextLayers, _TextLayer_instances, processItems_fn, appendText_fn, layout_fn, _TextLayer_static, getCtx_fn, ensureCtxFont_fn, ensureMinFontSizeComputed_fn, getAscent_fn, _docId2, _capability2, _progressiveDoneListeners, _progressiveReadListeners, _progressListeners, _rangeListeners, _pendingCleanup, _PDFPageProxy_instances, tryCleanup_fn, _capability3, _messageHandler, _port2, _webWorker, _fakeWorkerId, _isWorkerDisabled, _workerPorts, _PDFWorker_instances, resolve_fn, initializeFromPort_fn, initialize_fn, setupFakeWorker_fn, _PDFWorker_static, mainThreadWorkerMessageHandler_get, _methodPromises, _pageCache, _pagePromises, _pageRefCache, _passwordCapability, _WorkerTransport_instances, cacheSimpleMethod_fn, _internalRenderTask, _rAF, _canvasInUse, _button, _buttonSwatch, _defaultColor, _dropdown, _dropdownWasFromKeyboard, _isMainColorPicker, _editor4, _eventBus, _openDropdownAC, _uiManager2, _l10nColor, _ColorPicker_instances, getDropdownRoot_fn, colorSelect_fn, keyDown_fn, openDropdown_fn, pointerDown_fn2, isDropdownVisible_get, _input, _editor5, _uiManager3, _l10nColor2, _updates, _hasBorder, _popupElement, _AnnotationElement_instances, setRectEdited_fn, _LinkAnnotationElement_instances, setInternalLink_fn, bindAttachment_fn, bindSetOCGState_fn, _boundKeyDown, _boundHide, _boundShow, _boundToggle, _color, _container4, _contentsObj, _dateObj, _elements, _parent, _parentRect, _pinned, _popup, _popupAbortController, _position2, _rect, _richText, _titleObj, _updates2, _wasVisible, _PopupElement_instances, addEventListeners_fn, html_get, fontSize_get, fontColor_get, makePopupContent_fn, keyDown_fn2, setPosition_fn, toggle_fn, show_fn, hide_fn, _line, _square, _circle, _polyline, _polylinesGroupElement, _polylines, _InkAnnotationElement_instances, getTransform_fn, _trigger, _FileAttachmentAnnotationElement_instances, download_fn, _accessibilityManager, _annotationCanvasMap, _editableAnnotations, _structTreeLayer, _AnnotationLayer_instances, appendElement_fn, setAnnotationCanvasMap_fn, _color2, _content, _editorDivId, _editModeAC, _fontSize, _FreeTextEditor_instances, updateFontSize_fn, updateColor_fn, extractText_fn, setEditorDimensions_fn, _FreeTextEditor_static, getNodeContent_fn, setContent_fn, serializeContent_fn, deserializeContent_fn, hasElementChanged_fn, _box, _bottom, _innerMargin, _isLTR, _top, _last, _lastX, _lastY, _min, _min_dist, _scaleFactor, _thickness, _points, _MIN_DIST, _MIN_DIFF, _MIN, _FreeDrawOutliner_instances, getLastCoords_fn, toSVGPathTwoPoints_fn, toSVGPathStart_fn, toSVGPathEnd_fn, getOutlineTwoPoints_fn, getOutlineStart_fn, getOutlineEnd_fn, _box2, _bbox, _innerMargin2, _isLTR2, _points2, _scaleFactor2, _outline, _FreeDrawOutline_instances, computeMinMax_fn, _box3, _lastPoint, _verticalEdges, _intervals, _HighlightOutliner_instances, getOutlines_fn, binarySearch_fn, insert_fn, remove_fn, breakEdge_fn, _box4, _outlines, _anchorNode, _anchorOffset, _boxes, _clipPathId, _colorPicker2, _focusOutlines, _focusNode, _focusOffset, _highlightDiv, _highlightOutlines, _id4, _isFreeHighlight, _lastPoint2, _opacity, _outlineId, _text2, _thickness2, _methodOfCreation, _HighlightEditor_instances, createOutlines_fn, createFreeOutlines_fn, updateColor_fn2, updateThickness_fn, changeThickness_fn, cleanDrawLayer_fn, addToDrawLayer_fn, _HighlightEditor_static, rotateBbox_fn, keydown_fn, setCaret_fn, getRotation_fn, serializeBoxes_fn, serializeOutlines_fn, highlightMove_fn, endHighlight_fn, hasElementChanged_fn2, _svgProperties, _drawOutlines, _mustBeCommitted, _currentDraw, _currentDrawingAC, _currentDrawingOptions, _currentPointerId, _currentPointerType, _currentPointerIds, _currentMoveTimestamp, _DrawingEditor_instances, createDrawOutlines_fn, createDrawing_fn, cleanDrawLayer_fn2, addToDrawLayer_fn2, convertToParentSpace_fn, convertToDrawSpace_fn, updateBbox_fn, rotateBox_fn, _last2, _line2, _lines, _rotation2, _thickness3, _points3, _lastSVGPath, _lastIndex, _outlines2, _parentWidth, _parentHeight, _InkDrawOutliner_instances, normalizePoint_fn, _bbox2, _currentRotation, _innerMargin3, _lines2, _parentWidth2, _parentHeight2, _parentScale, _rotation3, _thickness4, _InkDrawOutline_instances, getMarginComponents_fn, getBBoxWithNoMargin_fn, computeBbox_fn, updateThickness_fn2, _InkEditor_instances, hasElementChanged_fn3, _PARAMETERS, _SignatureExtractor_static, neighborIndexToId_fn, _neighborIdToIndex, clockwiseNonZero_fn, counterClockwiseNonZero_fn, findContours_fn, douglasPeuckerHelper_fn, douglasPeucker_fn, bilateralFilter_fn, getHistogram_fn, toUint8_fn, guessThreshold_fn, getGrayPixels_fn, _isExtracted, _description, _signatureData, _signatureUUID, _bitmap, _bitmapId, _bitmapPromise, _bitmapUrl, _bitmapFile, _bitmapFileName, _canvas3, _missingCanvas, _resizeTimeoutId, _isSvg, _hasBeenAddedInUndoStack, _StampEditor_instances, getBitmapFetched_fn, getBitmapDone_fn, getBitmap_fn, createCanvas_fn, scaleBitmap_fn, drawBitmap_fn, serializeBitmap_fn, hasElementChanged_fn4, _accessibilityManager2, _allowClick, _annotationLayer, _clickAC, _editorFocusTimeoutId, _editors, _hadPointerDown, _isDisabling, _isEnabling, _drawingAC, _focusedElement, _textLayer, _textSelectionAC, _textLayerDblClickAC, _lastPointerDownTimestamp, _uiManager4, _editorTypes2, _AnnotationEditorLayer_instances, textLayerPointerDown_fn, currentEditorType_get, createNewEditor_fn, getCenterPoint_fn, cleanup_fn, _parent2, _mapping, _toUpdate, _id5, _DrawLayer_static, setBox_fn, _DrawLayer_instances, createSVG_fn, createClipPath_fn, updateProperties_fn;
90
+ var _Util_static, getExtremumOnCurve_fn, getExtremum_fn, _regex, _toolbar, _colorPicker, _editor, _buttons, _altText, _comment, _signatureDescriptionButton, _l10nRemove, _EditorToolbar_static, pointerDown_fn, _EditorToolbar_instances, focusIn_fn, focusOut_fn, addListenersToElement_fn, divider_get, _buttons2, _toolbar2, _uiManager, _FloatingToolbar_instances, render_fn, getLastPoint_fn, makeButton_fn, _id, _baseId, _id2, _cache, _ImageManager_instances, get_fn, _commands, _locked, _maxSize, _position, _KeyboardManager_instances, serialize_fn, _abortController, _activeEditor, _allEditableAnnotations, _allEditors, _allLayers, _altTextManager, _annotationStorage, _changedExistingAnnotations, _commandManager, _commentManager, _copyPasteAC, _currentDrawingSession, _currentPageIndex, _deletedAnnotationsElementIds, _draggingEditors, _editorTypes, _editorsToRescale, _enableHighlightFloatingButton, _enableUpdatedAddImage, _enableNewAltTextWhenAddingImage, _filterFactory, _focusMainContainerTimeoutId, _focusManagerAC, _highlightColors, _highlightWhenShiftUp, _floatingToolbar, _idManager, _isEnabled, _isPointerDown, _isWaiting, _keyboardManagerAC, _lastActiveElement, _mainHighlightColorPicker, _missingCanvases, _mlManager, _mode, _selectedEditors, _selectedTextNode, _signatureManager, _pageColors, _showAllStates, _pdfDocument, _previousStates, _translation, _translationTimeoutId, _container, _viewer, _viewerAlert, _updateModeCapability, _AnnotationEditorUIManager_instances, getAnchorElementForSelection_fn, getLayerForTextLayer_fn, displayFloatingToolbar_fn, selectionChange_fn, onSelectEnd_fn, addSelectionListener_fn, addFocusManager_fn, removeFocusManager_fn, addKeyboardManager_fn, removeKeyboardManager_fn, addCopyPasteListeners_fn, removeCopyPasteListeners_fn, addDragAndDropListeners_fn, dispatchUpdateStates_fn, dispatchUpdateUI_fn, enableAll_fn, disableAll_fn, addEditorToLayer_fn, lastSelectedEditor_get, isEmpty_fn, selectEditors_fn, _altText2, _altTextDecorative, _altTextButton, _altTextButtonLabel, _altTextTooltip, _altTextTooltipTimeout, _altTextWasFromKeyBoard, _badge, _editor2, _guessedText, _textWithDisclaimer, _useNewAltTextFlow, _l10nNewButton, _AltText_instances, label_get, setState_fn, _commentButton, _commentWasFromKeyBoard, _editor3, _initialText, _text, _date, _deleted, _container2, _isPinching, _isPinchingStopped, _isPinchingDisabled, _onPinchStart, _onPinching, _onPinchEnd, _pointerDownAC, _signal, _touchInfo, _touchManagerAC, _touchMoveAC, _TouchManager_instances, onTouchStart_fn, onTouchMove_fn, onTouchEnd_fn, _accessibilityData, _allResizerDivs, _altText3, _comment2, _disabled, _dragPointerId, _dragPointerType, _keepAspectRatio, _resizersDiv, _lastPointerCoords, _savedDimensions, _focusAC, _focusedResizerName, _hasBeenClicked, _initialRect, _isEditing, _isInEditMode, _isResizerEnabledForKeyboard, _moveInDOMTimeout, _prevDragX, _prevDragY, _telemetryTimeouts, _touchManager, _isDraggable, _zIndex, _AnnotationEditor_instances, translate_fn, _AnnotationEditor_static, rotatePoint_fn, getRotationMatrix_fn, createResizers_fn, resizerPointerdown_fn, resize_fn, addResizeToUndoStack_fn, resizerPointermove_fn, touchPinchStartCallback_fn, touchPinchCallback_fn, touchPinchEndCallback_fn, selectOnPointerEvent_fn, setUpDragSession_fn, addFocusListeners_fn, resizerKeydown_fn, resizerBlur_fn, resizerFocus_fn, setResizerTabIndex_fn, stopResizing_fn, _modified, _modifiedIds, _storage, _AnnotationStorage_instances, setModified_fn, _serializable, _systemFonts, _listeners, _deferred, _messageAC, _MessageHandler_instances, onMessage_fn, createStreamSink_fn, processStreamMessage_fn, deleteStreamController_fn, _enableHWA, _baseUrl, __cache, __defs, _docId, _document, __hcmCache, _id3, _DOMFilterFactory_instances, cache_get, hcmCache_get, defs_get, createTables_fn, createUrl_fn, addLuminosityConversion_fn, addGrayConversion_fn, createFilter_fn, appendFeFunc_fn, addTransferMapConversion_fn, addTransferMapAlphaConversion_fn, getRGB_fn, _simple, _incremental, _namedDependencies, _savesStack, _markedContentStack, _baseTransformStack, _clipBox, _pendingBBox, _pendingBBoxIdx, _pendingDependencies, _operations, _fontBBoxTrustworthy, _canvasWidth, _canvasHeight, _dependencyTracker, _opIdx, _nestingLevel, _outerDependencies, _savesLevel, _CanvasGraphics_instances, restoreInitialState_fn, drawFilter_fn, getScaledPath_fn, _port, _src, _map, _data, _isDisplay, _isPrint, _userSet, _visible, _cachedGetHash, _groups, _initialHash, _order, _OptionalContentConfig_instances, evaluateVisibilityExpression_fn, _objs, _PDFObjects_instances, ensureObj_fn, _g, _capability, _container3, _disableProcessItems, _fontInspectorEnabled, _lang, _layoutTextParams, _pageHeight, _pageWidth, _reader, _rootContainer, _rotation, _scale, _styleCache, _textContentItemsStr, _textContentSource, _textDivs, _textDivProperties, _transform, _ascentCache, _canvasContexts, _canvasCtxFonts, _minFontSize, _pendingTextLayers, _TextLayer_instances, processItems_fn, appendText_fn, layout_fn, _TextLayer_static, getCtx_fn, ensureCtxFont_fn, ensureMinFontSizeComputed_fn, getAscent_fn, _docId2, _capability2, _progressiveDoneListeners, _progressiveReadListeners, _progressListeners, _rangeListeners, _pendingCleanup, _PDFPageProxy_instances, tryCleanup_fn, _capability3, _messageHandler, _port2, _webWorker, _fakeWorkerId, _isWorkerDisabled, _workerPorts, _PDFWorker_instances, resolve_fn, initializeFromPort_fn, initialize_fn, setupFakeWorker_fn, _PDFWorker_static, mainThreadWorkerMessageHandler_get, _methodPromises, _pageCache, _pagePromises, _pageRefCache, _passwordCapability, _WorkerTransport_instances, cacheSimpleMethod_fn, _internalRenderTask, _rAF, _canvasInUse, _button, _buttonSwatch, _defaultColor, _dropdown, _dropdownWasFromKeyboard, _isMainColorPicker, _editor4, _eventBus, _openDropdownAC, _uiManager2, _l10nColor, _ColorPicker_instances, getDropdownRoot_fn, colorSelect_fn, keyDown_fn, openDropdown_fn, pointerDown_fn2, isDropdownVisible_get, _input, _editor5, _uiManager3, _l10nColor2, _updates, _hasBorder, _popupElement, _AnnotationElement_instances, changeLightness_fn, setRectEdited_fn, _LinkAnnotationElement_instances, setInternalLink_fn, bindAttachment_fn, bindSetOCGState_fn, _boundKeyDown, _boundHide, _boundShow, _boundToggle, _color, _container4, _contentsObj, _dateObj, _elements, _eventBus2, _parent, _parentRect, _pinned, _popup, _popupAbortController, _position2, _commentButton2, _commentButtonPosition, _commentButtonColor, _rect, _richText, _titleObj, _updates2, _wasVisible, _PopupElement_instances, addEventListeners_fn, setCommentButtonPosition_fn, renderCommentButton_fn, html_get, fontSize_get, fontColor_get, makePopupContent_fn, keyDown_fn2, setPosition_fn, toggle_fn, show_fn, hide_fn, _line, _square, _circle, _polyline, _polylinesGroupElement, _polylines, _InkAnnotationElement_instances, getTransform_fn, _trigger, _FileAttachmentAnnotationElement_instances, download_fn, _accessibilityManager, _annotationCanvasMap, _editableAnnotations, _structTreeLayer, _AnnotationLayer_instances, appendElement_fn, setAnnotationCanvasMap_fn, _color2, _content, _editorDivId, _editModeAC, _fontSize, _FreeTextEditor_instances, updateFontSize_fn, updateColor_fn, extractText_fn, setEditorDimensions_fn, _FreeTextEditor_static, getNodeContent_fn, setContent_fn, serializeContent_fn, deserializeContent_fn, hasElementChanged_fn, _box, _bottom, _innerMargin, _isLTR, _top, _last, _lastX, _lastY, _min, _min_dist, _scaleFactor, _thickness, _points, _MIN_DIST, _MIN_DIFF, _MIN, _FreeDrawOutliner_instances, getLastCoords_fn, toSVGPathTwoPoints_fn, toSVGPathStart_fn, toSVGPathEnd_fn, getOutlineTwoPoints_fn, getOutlineStart_fn, getOutlineEnd_fn, _box2, _bbox, _innerMargin2, _isLTR2, _points2, _scaleFactor2, _outline, _FreeDrawOutline_instances, computeMinMax_fn, _box3, _lastPoint, _verticalEdges, _intervals, _HighlightOutliner_instances, getOutlines_fn, binarySearch_fn, insert_fn, remove_fn, breakEdge_fn, _box4, _outlines, _anchorNode, _anchorOffset, _boxes, _clipPathId, _colorPicker2, _focusOutlines, _focusNode, _focusOffset, _highlightDiv, _highlightOutlines, _id4, _isFreeHighlight, _lastPoint2, _opacity, _outlineId, _text2, _thickness2, _methodOfCreation, _HighlightEditor_instances, createOutlines_fn, createFreeOutlines_fn, updateColor_fn2, updateThickness_fn, changeThickness_fn, cleanDrawLayer_fn, addToDrawLayer_fn, _HighlightEditor_static, rotateBbox_fn, keydown_fn, setCaret_fn, getRotation_fn, serializeBoxes_fn, serializeOutlines_fn, highlightMove_fn, endHighlight_fn, hasElementChanged_fn2, _svgProperties, _drawOutlines, _mustBeCommitted, _currentDraw, _currentDrawingAC, _currentDrawingOptions, _currentPointerId, _currentPointerType, _currentPointerIds, _currentMoveTimestamp, _DrawingEditor_instances, createDrawOutlines_fn, createDrawing_fn, cleanDrawLayer_fn2, addToDrawLayer_fn2, convertToParentSpace_fn, convertToDrawSpace_fn, updateBbox_fn, rotateBox_fn, _last2, _line2, _lines, _rotation2, _thickness3, _points3, _lastSVGPath, _lastIndex, _outlines2, _parentWidth, _parentHeight, _InkDrawOutliner_instances, normalizePoint_fn, _bbox2, _currentRotation, _innerMargin3, _lines2, _parentWidth2, _parentHeight2, _parentScale, _rotation3, _thickness4, _InkDrawOutline_instances, getMarginComponents_fn, getBBoxWithNoMargin_fn, computeBbox_fn, updateThickness_fn2, _InkEditor_instances, hasElementChanged_fn3, _PARAMETERS, _SignatureExtractor_static, neighborIndexToId_fn, _neighborIdToIndex, clockwiseNonZero_fn, counterClockwiseNonZero_fn, findContours_fn, douglasPeuckerHelper_fn, douglasPeucker_fn, bilateralFilter_fn, getHistogram_fn, toUint8_fn, guessThreshold_fn, getGrayPixels_fn, _isExtracted, _description, _signatureData, _signatureUUID, _bitmap, _bitmapId, _bitmapPromise, _bitmapUrl, _bitmapFile, _bitmapFileName, _canvas3, _missingCanvas, _resizeTimeoutId, _isSvg, _hasBeenAddedInUndoStack, _StampEditor_instances, getBitmapFetched_fn, getBitmapDone_fn, getBitmap_fn, createCanvas_fn, scaleBitmap_fn, drawBitmap_fn, serializeBitmap_fn, hasElementChanged_fn4, _accessibilityManager2, _allowClick, _annotationLayer, _clickAC, _editorFocusTimeoutId, _editors, _hadPointerDown, _isDisabling, _isEnabling, _drawingAC, _focusedElement, _textLayer, _textSelectionAC, _textLayerDblClickAC, _lastPointerDownTimestamp, _uiManager4, _editorTypes2, _AnnotationEditorLayer_instances, textLayerPointerDown_fn, currentEditorType_get, createNewEditor_fn, getCenterPoint_fn, cleanup_fn, _parent2, _mapping, _toUpdate, _id5, _DrawLayer_static, setBox_fn, _DrawLayer_instances, createSVG_fn, createClipPath_fn, updateProperties_fn;
91
91
  import axios from "axios";
92
+ import require$$0 from "react";
92
93
  const API_BASE_URL = "https://db33.dev.dinabox.net/api";
93
94
  const apiClient = axios.create({
94
95
  baseURL: API_BASE_URL,
@@ -11529,7 +11530,7 @@ function(t2) {
11529
11530
  */
11530
11531
  function(t2) {
11531
11532
  function e2() {
11532
- return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-BNBDSL51.js")).catch(function(t3) {
11533
+ return (n.canvg ? Promise.resolve(n.canvg) : import("./index.es-D9tZR_eO.js")).catch(function(t3) {
11533
11534
  return Promise.reject(new Error("Could not load canvg: " + t3));
11534
11535
  }).then(function(t3) {
11535
11536
  return t3.default ? t3.default : t3;
@@ -12991,7 +12992,7 @@ lodash.exports;
12991
12992
  var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
12992
12993
  var coreJsData = context["__core-js_shared__"];
12993
12994
  var funcToString = funcProto.toString;
12994
- var hasOwnProperty2 = objectProto.hasOwnProperty;
12995
+ var hasOwnProperty = objectProto.hasOwnProperty;
12995
12996
  var idCounter = 0;
12996
12997
  var maskSrcKey = function() {
12997
12998
  var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
@@ -13001,7 +13002,7 @@ lodash.exports;
13001
13002
  var objectCtorString = funcToString.call(Object2);
13002
13003
  var oldDash = root._;
13003
13004
  var reIsNative = RegExp2(
13004
- "^" + funcToString.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
13005
+ "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
13005
13006
  );
13006
13007
  var Buffer2 = moduleExports ? context.Buffer : undefined$1, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined$1, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined$1, symIterator = Symbol2 ? Symbol2.iterator : undefined$1, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined$1;
13007
13008
  var defineProperty = function() {
@@ -13024,7 +13025,7 @@ lodash.exports;
13024
13025
  if (value instanceof LodashWrapper) {
13025
13026
  return value;
13026
13027
  }
13027
- if (hasOwnProperty2.call(value, "__wrapped__")) {
13028
+ if (hasOwnProperty.call(value, "__wrapped__")) {
13028
13029
  return wrapperClone(value);
13029
13030
  }
13030
13031
  }
@@ -13185,11 +13186,11 @@ lodash.exports;
13185
13186
  var result2 = data[key];
13186
13187
  return result2 === HASH_UNDEFINED ? undefined$1 : result2;
13187
13188
  }
13188
- return hasOwnProperty2.call(data, key) ? data[key] : undefined$1;
13189
+ return hasOwnProperty.call(data, key) ? data[key] : undefined$1;
13189
13190
  }
13190
13191
  function hashHas(key) {
13191
13192
  var data = this.__data__;
13192
- return nativeCreate ? data[key] !== undefined$1 : hasOwnProperty2.call(data, key);
13193
+ return nativeCreate ? data[key] !== undefined$1 : hasOwnProperty.call(data, key);
13193
13194
  }
13194
13195
  function hashSet(key, value) {
13195
13196
  var data = this.__data__;
@@ -13346,7 +13347,7 @@ lodash.exports;
13346
13347
  function arrayLikeKeys(value, inherited) {
13347
13348
  var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length;
13348
13349
  for (var key in value) {
13349
- if ((inherited || hasOwnProperty2.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
13350
+ if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
13350
13351
  (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
13351
13352
  isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
13352
13353
  isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
@@ -13373,7 +13374,7 @@ lodash.exports;
13373
13374
  }
13374
13375
  function assignValue(object2, key, value) {
13375
13376
  var objValue = object2[key];
13376
- if (!(hasOwnProperty2.call(object2, key) && eq(objValue, value)) || value === undefined$1 && !(key in object2)) {
13377
+ if (!(hasOwnProperty.call(object2, key) && eq(objValue, value)) || value === undefined$1 && !(key in object2)) {
13377
13378
  baseAssignValue(object2, key, value);
13378
13379
  }
13379
13380
  }
@@ -13648,7 +13649,7 @@ lodash.exports;
13648
13649
  return value > other;
13649
13650
  }
13650
13651
  function baseHas(object2, key) {
13651
- return object2 != null && hasOwnProperty2.call(object2, key);
13652
+ return object2 != null && hasOwnProperty.call(object2, key);
13652
13653
  }
13653
13654
  function baseHasIn(object2, key) {
13654
13655
  return object2 != null && key in Object2(object2);
@@ -13735,7 +13736,7 @@ lodash.exports;
13735
13736
  return objIsArr || isTypedArray(object2) ? equalArrays(object2, other, bitmask, customizer, equalFunc, stack) : equalByTag(object2, other, objTag, bitmask, customizer, equalFunc, stack);
13736
13737
  }
13737
13738
  if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
13738
- var objIsWrapped = objIsObj && hasOwnProperty2.call(object2, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty2.call(other, "__wrapped__");
13739
+ var objIsWrapped = objIsObj && hasOwnProperty.call(object2, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
13739
13740
  if (objIsWrapped || othIsWrapped) {
13740
13741
  var objUnwrapped = objIsWrapped ? object2.value() : object2, othUnwrapped = othIsWrapped ? other.value() : other;
13741
13742
  stack || (stack = new Stack());
@@ -13816,7 +13817,7 @@ lodash.exports;
13816
13817
  }
13817
13818
  var result2 = [];
13818
13819
  for (var key in Object2(object2)) {
13819
- if (hasOwnProperty2.call(object2, key) && key != "constructor") {
13820
+ if (hasOwnProperty.call(object2, key) && key != "constructor") {
13820
13821
  result2.push(key);
13821
13822
  }
13822
13823
  }
@@ -13828,7 +13829,7 @@ lodash.exports;
13828
13829
  }
13829
13830
  var isProto = isPrototype(object2), result2 = [];
13830
13831
  for (var key in object2) {
13831
- if (!(key == "constructor" && (isProto || !hasOwnProperty2.call(object2, key)))) {
13832
+ if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object2, key)))) {
13832
13833
  result2.push(key);
13833
13834
  }
13834
13835
  }
@@ -14771,7 +14772,7 @@ lodash.exports;
14771
14772
  return func(number);
14772
14773
  };
14773
14774
  }
14774
- var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop2 : function(values3) {
14775
+ var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop : function(values3) {
14775
14776
  return new Set2(values3);
14776
14777
  };
14777
14778
  function createToPairs(keysFunc) {
@@ -14841,7 +14842,7 @@ lodash.exports;
14841
14842
  return setWrapToString(setter(result2, newData), func, bitmask);
14842
14843
  }
14843
14844
  function customDefaultsAssignIn(objValue, srcValue, key, object2) {
14844
- if (objValue === undefined$1 || eq(objValue, objectProto[key]) && !hasOwnProperty2.call(object2, key)) {
14845
+ if (objValue === undefined$1 || eq(objValue, objectProto[key]) && !hasOwnProperty.call(object2, key)) {
14845
14846
  return srcValue;
14846
14847
  }
14847
14848
  return objValue;
@@ -14954,7 +14955,7 @@ lodash.exports;
14954
14955
  var index = objLength;
14955
14956
  while (index--) {
14956
14957
  var key = objProps[index];
14957
- if (!(isPartial ? key in other : hasOwnProperty2.call(other, key))) {
14958
+ if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
14958
14959
  return false;
14959
14960
  }
14960
14961
  }
@@ -14998,11 +14999,11 @@ lodash.exports;
14998
14999
  function getAllKeysIn(object2) {
14999
15000
  return baseGetAllKeys(object2, keysIn, getSymbolsIn);
15000
15001
  }
15001
- var getData = !metaMap ? noop2 : function(func) {
15002
+ var getData = !metaMap ? noop : function(func) {
15002
15003
  return metaMap.get(func);
15003
15004
  };
15004
15005
  function getFuncName(func) {
15005
- var result2 = func.name + "", array = realNames[result2], length = hasOwnProperty2.call(realNames, result2) ? array.length : 0;
15006
+ var result2 = func.name + "", array = realNames[result2], length = hasOwnProperty.call(realNames, result2) ? array.length : 0;
15006
15007
  while (length--) {
15007
15008
  var data = array[length], otherFunc = data.func;
15008
15009
  if (otherFunc == null || otherFunc == func) {
@@ -15012,7 +15013,7 @@ lodash.exports;
15012
15013
  return result2;
15013
15014
  }
15014
15015
  function getHolder(func) {
15015
- var object2 = hasOwnProperty2.call(lodash2, "placeholder") ? lodash2 : func;
15016
+ var object2 = hasOwnProperty.call(lodash2, "placeholder") ? lodash2 : func;
15016
15017
  return object2.placeholder;
15017
15018
  }
15018
15019
  function getIteratee() {
@@ -15037,7 +15038,7 @@ lodash.exports;
15037
15038
  return baseIsNative(value) ? value : undefined$1;
15038
15039
  }
15039
15040
  function getRawTag(value) {
15040
- var isOwn = hasOwnProperty2.call(value, symToStringTag), tag = value[symToStringTag];
15041
+ var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
15041
15042
  try {
15042
15043
  value[symToStringTag] = undefined$1;
15043
15044
  var unmasked = true;
@@ -15134,7 +15135,7 @@ lodash.exports;
15134
15135
  }
15135
15136
  function initCloneArray(array) {
15136
15137
  var length = array.length, result2 = new array.constructor(length);
15137
- if (length && typeof array[0] == "string" && hasOwnProperty2.call(array, "index")) {
15138
+ if (length && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) {
15138
15139
  result2.index = array.index;
15139
15140
  result2.input = array.input;
15140
15141
  }
@@ -15905,7 +15906,7 @@ lodash.exports;
15905
15906
  return baseWrapperValue(this.__wrapped__, this.__actions__);
15906
15907
  }
15907
15908
  var countBy = createAggregator(function(result2, value, key) {
15908
- if (hasOwnProperty2.call(result2, key)) {
15909
+ if (hasOwnProperty.call(result2, key)) {
15909
15910
  ++result2[key];
15910
15911
  } else {
15911
15912
  baseAssignValue(result2, key, 1);
@@ -15943,7 +15944,7 @@ lodash.exports;
15943
15944
  return func(collection, getIteratee(iteratee2, 3));
15944
15945
  }
15945
15946
  var groupBy2 = createAggregator(function(result2, value, key) {
15946
- if (hasOwnProperty2.call(result2, key)) {
15947
+ if (hasOwnProperty.call(result2, key)) {
15947
15948
  result2[key].push(value);
15948
15949
  } else {
15949
15950
  baseAssignValue(result2, key, [value]);
@@ -16340,7 +16341,7 @@ lodash.exports;
16340
16341
  var isArguments = baseIsArguments(/* @__PURE__ */ function() {
16341
16342
  return arguments;
16342
16343
  }()) ? baseIsArguments : function(value) {
16343
- return isObjectLike(value) && hasOwnProperty2.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
16344
+ return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
16344
16345
  };
16345
16346
  var isArray = Array2.isArray;
16346
16347
  var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
@@ -16373,7 +16374,7 @@ lodash.exports;
16373
16374
  return !baseKeys(value).length;
16374
16375
  }
16375
16376
  for (var key in value) {
16376
- if (hasOwnProperty2.call(value, key)) {
16377
+ if (hasOwnProperty.call(value, key)) {
16377
16378
  return false;
16378
16379
  }
16379
16380
  }
@@ -16451,7 +16452,7 @@ lodash.exports;
16451
16452
  if (proto === null) {
16452
16453
  return true;
16453
16454
  }
16454
- var Ctor = hasOwnProperty2.call(proto, "constructor") && proto.constructor;
16455
+ var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
16455
16456
  return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
16456
16457
  }
16457
16458
  var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
@@ -16543,7 +16544,7 @@ lodash.exports;
16543
16544
  return;
16544
16545
  }
16545
16546
  for (var key in source) {
16546
- if (hasOwnProperty2.call(source, key)) {
16547
+ if (hasOwnProperty.call(source, key)) {
16547
16548
  assignValue(object2, key, source[key]);
16548
16549
  }
16549
16550
  }
@@ -16578,7 +16579,7 @@ lodash.exports;
16578
16579
  while (++propsIndex < propsLength) {
16579
16580
  var key = props[propsIndex];
16580
16581
  var value = object2[key];
16581
- if (value === undefined$1 || eq(value, objectProto[key]) && !hasOwnProperty2.call(object2, key)) {
16582
+ if (value === undefined$1 || eq(value, objectProto[key]) && !hasOwnProperty.call(object2, key)) {
16582
16583
  object2[key] = source[key];
16583
16584
  }
16584
16585
  }
@@ -16633,7 +16634,7 @@ lodash.exports;
16633
16634
  if (value != null && typeof value.toString != "function") {
16634
16635
  value = nativeObjectToString.call(value);
16635
16636
  }
16636
- if (hasOwnProperty2.call(result2, value)) {
16637
+ if (hasOwnProperty.call(result2, value)) {
16637
16638
  result2[value].push(key);
16638
16639
  } else {
16639
16640
  result2[value] = [key];
@@ -16948,7 +16949,7 @@ lodash.exports;
16948
16949
  (options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$",
16949
16950
  "g"
16950
16951
  );
16951
- var sourceURL = "//# sourceURL=" + (hasOwnProperty2.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
16952
+ var sourceURL = "//# sourceURL=" + (hasOwnProperty.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
16952
16953
  string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
16953
16954
  interpolateValue || (interpolateValue = esTemplateValue);
16954
16955
  source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
@@ -16967,7 +16968,7 @@ lodash.exports;
16967
16968
  return match;
16968
16969
  });
16969
16970
  source += "';\n";
16970
- var variable = hasOwnProperty2.call(options, "variable") && options.variable;
16971
+ var variable = hasOwnProperty.call(options, "variable") && options.variable;
16971
16972
  if (!variable) {
16972
16973
  source = "with (obj) {\n" + source + "\n}\n";
16973
16974
  } else if (reForbiddenIdentifierChars.test(variable)) {
@@ -17186,7 +17187,7 @@ lodash.exports;
17186
17187
  }
17187
17188
  return this;
17188
17189
  }
17189
- function noop2() {
17190
+ function noop() {
17190
17191
  }
17191
17192
  function nthArg(n2) {
17192
17193
  n2 = toInteger(n2);
@@ -17541,7 +17542,7 @@ lodash.exports;
17541
17542
  lodash2.multiply = multiply;
17542
17543
  lodash2.nth = nth;
17543
17544
  lodash2.noConflict = noConflict;
17544
- lodash2.noop = noop2;
17545
+ lodash2.noop = noop;
17545
17546
  lodash2.now = now;
17546
17547
  lodash2.pad = pad;
17547
17548
  lodash2.padEnd = padEnd;
@@ -17594,7 +17595,7 @@ lodash.exports;
17594
17595
  mixin(lodash2, function() {
17595
17596
  var source = {};
17596
17597
  baseForOwn(lodash2, function(func, methodName) {
17597
- if (!hasOwnProperty2.call(lodash2.prototype, methodName)) {
17598
+ if (!hasOwnProperty.call(lodash2.prototype, methodName)) {
17598
17599
  source[methodName] = func;
17599
17600
  }
17600
17601
  });
@@ -17734,7 +17735,7 @@ lodash.exports;
17734
17735
  var lodashFunc = lodash2[methodName];
17735
17736
  if (lodashFunc) {
17736
17737
  var key = lodashFunc.name + "";
17737
- if (!hasOwnProperty2.call(realNames, key)) {
17738
+ if (!hasOwnProperty.call(realNames, key)) {
17738
17739
  realNames[key] = [];
17739
17740
  }
17740
17741
  realNames[key].push({ "name": methodName, "func": lodashFunc });
@@ -26536,7 +26537,7 @@ function validateInput(global2, document2, current) {
26536
26537
  }
26537
26538
  }
26538
26539
  }
26539
- function assign$2(target, s2, s1, s22, s3) {
26540
+ function assign$1(target, s2, s1, s22, s3) {
26540
26541
  if (target == null) {
26541
26542
  throw new TypeError("Cannot convert undefined or null to object");
26542
26543
  }
@@ -26558,7 +26559,7 @@ function parseInput(d2, current) {
26558
26559
  var document2 = doc.getDocumentOptions();
26559
26560
  var global2 = doc.getGlobalOptions();
26560
26561
  validateInput(global2, document2, current);
26561
- var options = assign$2({}, global2, document2, current);
26562
+ var options = assign$1({}, global2, document2, current);
26562
26563
  var win;
26563
26564
  if (typeof window !== "undefined") {
26564
26565
  win = window;
@@ -26583,13 +26584,13 @@ function parseStyles(gInput, dInput, cInput) {
26583
26584
  var global_1 = gInput[prop2];
26584
26585
  var document_1 = dInput[prop2];
26585
26586
  var current = cInput[prop2];
26586
- styleOptions.columnStyles = assign$2({}, global_1, document_1, current);
26587
+ styleOptions.columnStyles = assign$1({}, global_1, document_1, current);
26587
26588
  } else {
26588
26589
  var allOptions = [gInput, dInput, cInput];
26589
26590
  var styles = allOptions.map(function(opts) {
26590
26591
  return opts[prop2] || {};
26591
26592
  });
26592
- styleOptions[prop2] = assign$2({}, styles[0], styles[1], styles[2]);
26593
+ styleOptions[prop2] = assign$1({}, styles[0], styles[1], styles[2]);
26593
26594
  }
26594
26595
  };
26595
26596
  for (var _i = 0, _a2 = Object.keys(styleOptions); _i < _a2.length; _i++) {
@@ -27351,13 +27352,13 @@ function cellStyles(sectionName, column, rowIndex, themeName, styles, scaleFacto
27351
27352
  } else if (sectionName === "foot") {
27352
27353
  sectionStyles = styles.footStyles;
27353
27354
  }
27354
- var otherStyles = assign$2({}, theme.table, theme[sectionName], styles.styles, sectionStyles);
27355
+ var otherStyles = assign$1({}, theme.table, theme[sectionName], styles.styles, sectionStyles);
27355
27356
  var columnStyles = styles.columnStyles[column.dataKey] || styles.columnStyles[column.index] || {};
27356
27357
  var colStyles = sectionName === "body" ? columnStyles : {};
27357
- var rowStyles = sectionName === "body" && rowIndex % 2 === 0 ? assign$2({}, theme.alternateRow, styles.alternateRowStyles) : {};
27358
+ var rowStyles = sectionName === "body" && rowIndex % 2 === 0 ? assign$1({}, theme.alternateRow, styles.alternateRowStyles) : {};
27358
27359
  var defaultStyle = defaultStyles(scaleFactor);
27359
- var themeStyles = assign$2({}, defaultStyle, otherStyles, rowStyles, colStyles);
27360
- return assign$2(themeStyles, cellInputStyles);
27360
+ var themeStyles = assign$1({}, defaultStyle, otherStyles, rowStyles, colStyles);
27361
+ return assign$1(themeStyles, cellInputStyles);
27361
27362
  }
27362
27363
  function getColumnsCanFitInPage(doc, table, config) {
27363
27364
  var _a2;
@@ -27436,7 +27437,7 @@ function drawTable(jsPDFDoc, table) {
27436
27437
  cursor.y = margin.top;
27437
27438
  }
27438
27439
  table.callWillDrawPageHooks(doc, cursor);
27439
- var startPos = assign$2({}, cursor);
27440
+ var startPos = assign$1({}, cursor);
27440
27441
  table.startPageNumber = doc.pageNumber();
27441
27442
  if (settings.horizontalPageBreak) {
27442
27443
  printTableWithHorizontalPageBreak(doc, table, startPos, cursor);
@@ -27569,7 +27570,7 @@ function modifyRowToFit(row, remainingPageSpace, table, doc) {
27569
27570
  cell.text = [cell.text];
27570
27571
  }
27571
27572
  var remainderCell = new Cell(cell.raw, cell.styles, cell.section);
27572
- remainderCell = assign$2(remainderCell, cell);
27573
+ remainderCell = assign$1(remainderCell, cell);
27573
27574
  remainderCell.text = [];
27574
27575
  var remainingLineCount = getRemainingLineCount(cell, remainingPageSpace, doc);
27575
27576
  if (cell.text.length > remainingLineCount) {
@@ -27915,7 +27916,7 @@ function generateTableSVG(items, options = {}) {
27915
27916
  height = 100,
27916
27917
  cellPadding = 5,
27917
27918
  fontSize: fontSize2 = 12,
27918
- headerColor = "#f0f0f0",
27919
+ headerColor = "#000000",
27919
27920
  borderColor = "#000000"
27920
27921
  } = options;
27921
27922
  const headers = ["ID", "Nome", "Qtd", "Dimensões"];
@@ -28406,13 +28407,39 @@ const makeBarCode = (mainObject) => {
28406
28407
  const variableManager = new VariableManager();
28407
28408
  let bar = v2.originBarcode === "PERSONALIZADO" ? variableManager.processTemplate(v2.customBarcode, extendedData.variableProps) || "null" : variableManager.processTemplate(v2.originBarcode, extendedData.variableProps);
28408
28409
  if (!bar.includes("null") && bar.length > 0) {
28410
+ const aspectRatio = vWidth / vHeight;
28409
28411
  let canvas2 = document$2.createElement("canvas");
28410
- canvas2.width = 400;
28411
- canvas2.height = 200;
28412
+ let canvasWidth, canvasHeight;
28413
+ if (aspectRatio > 5) {
28414
+ canvasWidth = 5e3;
28415
+ canvasHeight = Math.round(5e3 / aspectRatio);
28416
+ canvasHeight = Math.max(canvasHeight, 300);
28417
+ } else if (aspectRatio < 0.2) {
28418
+ canvasHeight = 5e3;
28419
+ canvasWidth = Math.round(5e3 * aspectRatio);
28420
+ canvasWidth = Math.max(canvasWidth, 300);
28421
+ } else {
28422
+ canvasHeight = 1e3;
28423
+ canvasWidth = Math.round(1e3 * aspectRatio);
28424
+ }
28425
+ canvas2.width = canvasWidth;
28426
+ canvas2.height = canvasHeight;
28412
28427
  let px = width * y2 + (verticalSpace * y2 + marginLeft2) + vLeft;
28413
28428
  let py = height * x2 + (horizontalSpace * x2 + marginTop2) + vTop;
28414
28429
  try {
28415
- JsBarcode$1(canvas2, bar);
28430
+ const barWidth = Math.max(1, Math.min(3, canvasWidth / 100));
28431
+ JsBarcode$1(canvas2, bar, {
28432
+ format: v2.barcodeFormat || "CODE128",
28433
+ width: barWidth,
28434
+ // Largura adaptativa das barras
28435
+ height: canvasHeight * 0.8,
28436
+ // Altura proporcional ao canvas
28437
+ displayValue: false,
28438
+ // Não mostrar valor do código (texto escondido)
28439
+ margin: Math.max(canvasHeight * 0.1, 10),
28440
+ // Margem proporcional com mínimo
28441
+ background: "#ffffff"
28442
+ });
28416
28443
  } catch (error) {
28417
28444
  console.error("Erro ao gerar código de barras:", error);
28418
28445
  canvas2 = document$2.createElement("canvas");
@@ -28444,26 +28471,23 @@ const makeBarCode = (mainObject) => {
28444
28471
  };
28445
28472
  const makeLamination$1 = (mainObject) => {
28446
28473
  const {
28474
+ v: v2,
28447
28475
  width,
28448
- height,
28449
- x: x2,
28450
- y: y2,
28451
28476
  verticalSpace,
28452
28477
  horizontalSpace,
28453
- marginTop: marginTop2,
28454
- marginLeft: marginLeft2,
28478
+ vHeight,
28455
28479
  vLeft,
28480
+ vWidth,
28456
28481
  vTop,
28482
+ marginLeft: marginLeft2,
28483
+ marginTop: marginTop2,
28484
+ height,
28485
+ x: x2,
28486
+ y: y2,
28457
28487
  pdfInstance,
28458
- vHeight,
28459
- vWidth,
28460
- partList,
28461
- indexLabel,
28462
- v: v2,
28463
28488
  vl,
28464
28489
  actualData
28465
28490
  } = mainObject;
28466
- console.log("actualData =>", actualData);
28467
28491
  let edgeData, materialId;
28468
28492
  if (actualData && actualData.edges) {
28469
28493
  edgeData = {
@@ -28822,7 +28846,7 @@ function insertFiguresToPdf(_e) {
28822
28846
  theme: "grid",
28823
28847
  // Estilo da tabela
28824
28848
  styles: {
28825
- fontSize: 4,
28849
+ fontSize: 8,
28826
28850
  cellPadding: 0.5,
28827
28851
  // lineHeight: 0.6,
28828
28852
  minCellHeight: 1.8
@@ -28838,19 +28862,11 @@ function insertFiguresToPdf(_e) {
28838
28862
  tableWidth: vWidth,
28839
28863
  rowPageBreak: "avoid",
28840
28864
  pageBreak: "auto",
28841
- showHead: "firstPage"
28842
- /* didDrawPage: function(data) {
28843
- // Quando nova página for criada, redefine Y mas mantém a mesma margem esquerda
28844
- data.settings.margin.top = 0.5;
28845
- data.cursor.y = 0.5;
28846
- },
28847
- columnStyles: {
28848
- // Definição de larguras específicas para colunas
28849
- 0: { cellWidth: vWidth * 0.15 }, // ID - 15%
28850
- 1: { cellWidth: vWidth * 0.4 }, // Nome - 40%
28851
- 2: { cellWidth: vWidth * 0.1 }, // Qtd - 10%
28852
- 3: { cellWidth: vWidth * 0.35 } // Dimensões - 35%
28853
- }*/
28865
+ showHead: "firstPage",
28866
+ didDrawPage: function(data) {
28867
+ data.settings.margin.top = 0;
28868
+ data.cursor.y = 0;
28869
+ }
28854
28870
  });
28855
28871
  } catch (tableError) {
28856
28872
  console.error("Erro ao criar tabela automatizada:", tableError);
@@ -29433,446 +29449,7 @@ const createStoreImpl = (createState) => {
29433
29449
  return api;
29434
29450
  };
29435
29451
  const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
29436
- var react = { exports: {} };
29437
- var react_production = {};
29438
- /**
29439
- * @license React
29440
- * react.production.js
29441
- *
29442
- * Copyright (c) Meta Platforms, Inc. and affiliates.
29443
- *
29444
- * This source code is licensed under the MIT license found in the
29445
- * LICENSE file in the root directory of this source tree.
29446
- */
29447
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
29448
- function getIteratorFn(maybeIterable) {
29449
- if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
29450
- maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
29451
- return "function" === typeof maybeIterable ? maybeIterable : null;
29452
- }
29453
- var ReactNoopUpdateQueue = {
29454
- isMounted: function() {
29455
- return false;
29456
- },
29457
- enqueueForceUpdate: function() {
29458
- },
29459
- enqueueReplaceState: function() {
29460
- },
29461
- enqueueSetState: function() {
29462
- }
29463
- }, assign$1 = Object.assign, emptyObject = {};
29464
- function Component(props, context, updater) {
29465
- this.props = props;
29466
- this.context = context;
29467
- this.refs = emptyObject;
29468
- this.updater = updater || ReactNoopUpdateQueue;
29469
- }
29470
- Component.prototype.isReactComponent = {};
29471
- Component.prototype.setState = function(partialState, callback) {
29472
- if ("object" !== typeof partialState && "function" !== typeof partialState && null != partialState)
29473
- throw Error(
29474
- "takes an object of state variables to update or a function which returns an object of state variables."
29475
- );
29476
- this.updater.enqueueSetState(this, partialState, callback, "setState");
29477
- };
29478
- Component.prototype.forceUpdate = function(callback) {
29479
- this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
29480
- };
29481
- function ComponentDummy() {
29482
- }
29483
- ComponentDummy.prototype = Component.prototype;
29484
- function PureComponent(props, context, updater) {
29485
- this.props = props;
29486
- this.context = context;
29487
- this.refs = emptyObject;
29488
- this.updater = updater || ReactNoopUpdateQueue;
29489
- }
29490
- var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
29491
- pureComponentPrototype.constructor = PureComponent;
29492
- assign$1(pureComponentPrototype, Component.prototype);
29493
- pureComponentPrototype.isPureReactComponent = true;
29494
- var isArrayImpl = Array.isArray, ReactSharedInternals = { H: null, A: null, T: null, S: null, V: null }, hasOwnProperty = Object.prototype.hasOwnProperty;
29495
- function ReactElement(type, key, self2, source, owner, props) {
29496
- self2 = props.ref;
29497
- return {
29498
- $$typeof: REACT_ELEMENT_TYPE,
29499
- type,
29500
- key,
29501
- ref: void 0 !== self2 ? self2 : null,
29502
- props
29503
- };
29504
- }
29505
- function cloneAndReplaceKey(oldElement, newKey) {
29506
- return ReactElement(
29507
- oldElement.type,
29508
- newKey,
29509
- void 0,
29510
- void 0,
29511
- void 0,
29512
- oldElement.props
29513
- );
29514
- }
29515
- function isValidElement(object2) {
29516
- return "object" === typeof object2 && null !== object2 && object2.$$typeof === REACT_ELEMENT_TYPE;
29517
- }
29518
- function escape$1(key) {
29519
- var escaperLookup = { "=": "=0", ":": "=2" };
29520
- return "$" + key.replace(/[=:]/g, function(match) {
29521
- return escaperLookup[match];
29522
- });
29523
- }
29524
- var userProvidedKeyEscapeRegex = /\/+/g;
29525
- function getElementKey(element, index) {
29526
- return "object" === typeof element && null !== element && null != element.key ? escape$1("" + element.key) : index.toString(36);
29527
- }
29528
- function noop$1() {
29529
- }
29530
- function resolveThenable(thenable) {
29531
- switch (thenable.status) {
29532
- case "fulfilled":
29533
- return thenable.value;
29534
- case "rejected":
29535
- throw thenable.reason;
29536
- default:
29537
- switch ("string" === typeof thenable.status ? thenable.then(noop$1, noop$1) : (thenable.status = "pending", thenable.then(
29538
- function(fulfilledValue) {
29539
- "pending" === thenable.status && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
29540
- },
29541
- function(error) {
29542
- "pending" === thenable.status && (thenable.status = "rejected", thenable.reason = error);
29543
- }
29544
- )), thenable.status) {
29545
- case "fulfilled":
29546
- return thenable.value;
29547
- case "rejected":
29548
- throw thenable.reason;
29549
- }
29550
- }
29551
- throw thenable;
29552
- }
29553
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
29554
- var type = typeof children;
29555
- if ("undefined" === type || "boolean" === type) children = null;
29556
- var invokeCallback = false;
29557
- if (null === children) invokeCallback = true;
29558
- else
29559
- switch (type) {
29560
- case "bigint":
29561
- case "string":
29562
- case "number":
29563
- invokeCallback = true;
29564
- break;
29565
- case "object":
29566
- switch (children.$$typeof) {
29567
- case REACT_ELEMENT_TYPE:
29568
- case REACT_PORTAL_TYPE:
29569
- invokeCallback = true;
29570
- break;
29571
- case REACT_LAZY_TYPE:
29572
- return invokeCallback = children._init, mapIntoArray(
29573
- invokeCallback(children._payload),
29574
- array,
29575
- escapedPrefix,
29576
- nameSoFar,
29577
- callback
29578
- );
29579
- }
29580
- }
29581
- if (invokeCallback)
29582
- return callback = callback(children), invokeCallback = "" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar, isArrayImpl(callback) ? (escapedPrefix = "", null != invokeCallback && (escapedPrefix = invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c2) {
29583
- return c2;
29584
- })) : null != callback && (isValidElement(callback) && (callback = cloneAndReplaceKey(
29585
- callback,
29586
- escapedPrefix + (null == callback.key || children && children.key === callback.key ? "" : ("" + callback.key).replace(
29587
- userProvidedKeyEscapeRegex,
29588
- "$&/"
29589
- ) + "/") + invokeCallback
29590
- )), array.push(callback)), 1;
29591
- invokeCallback = 0;
29592
- var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
29593
- if (isArrayImpl(children))
29594
- for (var i = 0; i < children.length; i++)
29595
- nameSoFar = children[i], type = nextNamePrefix + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(
29596
- nameSoFar,
29597
- array,
29598
- escapedPrefix,
29599
- type,
29600
- callback
29601
- );
29602
- else if (i = getIteratorFn(children), "function" === typeof i)
29603
- for (children = i.call(children), i = 0; !(nameSoFar = children.next()).done; )
29604
- nameSoFar = nameSoFar.value, type = nextNamePrefix + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(
29605
- nameSoFar,
29606
- array,
29607
- escapedPrefix,
29608
- type,
29609
- callback
29610
- );
29611
- else if ("object" === type) {
29612
- if ("function" === typeof children.then)
29613
- return mapIntoArray(
29614
- resolveThenable(children),
29615
- array,
29616
- escapedPrefix,
29617
- nameSoFar,
29618
- callback
29619
- );
29620
- array = String(children);
29621
- throw Error(
29622
- "Objects are not valid as a React child (found: " + ("[object Object]" === array ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead."
29623
- );
29624
- }
29625
- return invokeCallback;
29626
- }
29627
- function mapChildren(children, func, context) {
29628
- if (null == children) return children;
29629
- var result = [], count = 0;
29630
- mapIntoArray(children, result, "", "", function(child) {
29631
- return func.call(context, child, count++);
29632
- });
29633
- return result;
29634
- }
29635
- function lazyInitializer(payload) {
29636
- if (-1 === payload._status) {
29637
- var ctor = payload._result;
29638
- ctor = ctor();
29639
- ctor.then(
29640
- function(moduleObject) {
29641
- if (0 === payload._status || -1 === payload._status)
29642
- payload._status = 1, payload._result = moduleObject;
29643
- },
29644
- function(error) {
29645
- if (0 === payload._status || -1 === payload._status)
29646
- payload._status = 2, payload._result = error;
29647
- }
29648
- );
29649
- -1 === payload._status && (payload._status = 0, payload._result = ctor);
29650
- }
29651
- if (1 === payload._status) return payload._result.default;
29652
- throw payload._result;
29653
- }
29654
- var reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
29655
- if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
29656
- var event = new window.ErrorEvent("error", {
29657
- bubbles: true,
29658
- cancelable: true,
29659
- message: "object" === typeof error && null !== error && "string" === typeof error.message ? String(error.message) : String(error),
29660
- error
29661
- });
29662
- if (!window.dispatchEvent(event)) return;
29663
- } else if ("object" === typeof process && "function" === typeof process.emit) {
29664
- process.emit("uncaughtException", error);
29665
- return;
29666
- }
29667
- console.error(error);
29668
- };
29669
- function noop() {
29670
- }
29671
- react_production.Children = {
29672
- map: mapChildren,
29673
- forEach: function(children, forEachFunc, forEachContext) {
29674
- mapChildren(
29675
- children,
29676
- function() {
29677
- forEachFunc.apply(this, arguments);
29678
- },
29679
- forEachContext
29680
- );
29681
- },
29682
- count: function(children) {
29683
- var n2 = 0;
29684
- mapChildren(children, function() {
29685
- n2++;
29686
- });
29687
- return n2;
29688
- },
29689
- toArray: function(children) {
29690
- return mapChildren(children, function(child) {
29691
- return child;
29692
- }) || [];
29693
- },
29694
- only: function(children) {
29695
- if (!isValidElement(children))
29696
- throw Error(
29697
- "React.Children.only expected to receive a single React element child."
29698
- );
29699
- return children;
29700
- }
29701
- };
29702
- react_production.Component = Component;
29703
- react_production.Fragment = REACT_FRAGMENT_TYPE;
29704
- react_production.Profiler = REACT_PROFILER_TYPE;
29705
- react_production.PureComponent = PureComponent;
29706
- react_production.StrictMode = REACT_STRICT_MODE_TYPE;
29707
- react_production.Suspense = REACT_SUSPENSE_TYPE;
29708
- react_production.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
29709
- react_production.__COMPILER_RUNTIME = {
29710
- __proto__: null,
29711
- c: function(size) {
29712
- return ReactSharedInternals.H.useMemoCache(size);
29713
- }
29714
- };
29715
- react_production.cache = function(fn) {
29716
- return function() {
29717
- return fn.apply(null, arguments);
29718
- };
29719
- };
29720
- react_production.cloneElement = function(element, config, children) {
29721
- if (null === element || void 0 === element)
29722
- throw Error(
29723
- "The argument must be a React element, but you passed " + element + "."
29724
- );
29725
- var props = assign$1({}, element.props), key = element.key, owner = void 0;
29726
- if (null != config)
29727
- for (propName in void 0 !== config.ref && (owner = void 0), void 0 !== config.key && (key = "" + config.key), config)
29728
- !hasOwnProperty.call(config, propName) || "key" === propName || "__self" === propName || "__source" === propName || "ref" === propName && void 0 === config.ref || (props[propName] = config[propName]);
29729
- var propName = arguments.length - 2;
29730
- if (1 === propName) props.children = children;
29731
- else if (1 < propName) {
29732
- for (var childArray = Array(propName), i = 0; i < propName; i++)
29733
- childArray[i] = arguments[i + 2];
29734
- props.children = childArray;
29735
- }
29736
- return ReactElement(element.type, key, void 0, void 0, owner, props);
29737
- };
29738
- react_production.createContext = function(defaultValue) {
29739
- defaultValue = {
29740
- $$typeof: REACT_CONTEXT_TYPE,
29741
- _currentValue: defaultValue,
29742
- _currentValue2: defaultValue,
29743
- _threadCount: 0,
29744
- Provider: null,
29745
- Consumer: null
29746
- };
29747
- defaultValue.Provider = defaultValue;
29748
- defaultValue.Consumer = {
29749
- $$typeof: REACT_CONSUMER_TYPE,
29750
- _context: defaultValue
29751
- };
29752
- return defaultValue;
29753
- };
29754
- react_production.createElement = function(type, config, children) {
29755
- var propName, props = {}, key = null;
29756
- if (null != config)
29757
- for (propName in void 0 !== config.key && (key = "" + config.key), config)
29758
- hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (props[propName] = config[propName]);
29759
- var childrenLength = arguments.length - 2;
29760
- if (1 === childrenLength) props.children = children;
29761
- else if (1 < childrenLength) {
29762
- for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
29763
- childArray[i] = arguments[i + 2];
29764
- props.children = childArray;
29765
- }
29766
- if (type && type.defaultProps)
29767
- for (propName in childrenLength = type.defaultProps, childrenLength)
29768
- void 0 === props[propName] && (props[propName] = childrenLength[propName]);
29769
- return ReactElement(type, key, void 0, void 0, null, props);
29770
- };
29771
- react_production.createRef = function() {
29772
- return { current: null };
29773
- };
29774
- react_production.forwardRef = function(render2) {
29775
- return { $$typeof: REACT_FORWARD_REF_TYPE, render: render2 };
29776
- };
29777
- react_production.isValidElement = isValidElement;
29778
- react_production.lazy = function(ctor) {
29779
- return {
29780
- $$typeof: REACT_LAZY_TYPE,
29781
- _payload: { _status: -1, _result: ctor },
29782
- _init: lazyInitializer
29783
- };
29784
- };
29785
- react_production.memo = function(type, compare) {
29786
- return {
29787
- $$typeof: REACT_MEMO_TYPE,
29788
- type,
29789
- compare: void 0 === compare ? null : compare
29790
- };
29791
- };
29792
- react_production.startTransition = function(scope) {
29793
- var prevTransition = ReactSharedInternals.T, currentTransition = {};
29794
- ReactSharedInternals.T = currentTransition;
29795
- try {
29796
- var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
29797
- null !== onStartTransitionFinish && onStartTransitionFinish(currentTransition, returnValue);
29798
- "object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && returnValue.then(noop, reportGlobalError);
29799
- } catch (error) {
29800
- reportGlobalError(error);
29801
- } finally {
29802
- ReactSharedInternals.T = prevTransition;
29803
- }
29804
- };
29805
- react_production.unstable_useCacheRefresh = function() {
29806
- return ReactSharedInternals.H.useCacheRefresh();
29807
- };
29808
- react_production.use = function(usable) {
29809
- return ReactSharedInternals.H.use(usable);
29810
- };
29811
- react_production.useActionState = function(action, initialState2, permalink) {
29812
- return ReactSharedInternals.H.useActionState(action, initialState2, permalink);
29813
- };
29814
- react_production.useCallback = function(callback, deps) {
29815
- return ReactSharedInternals.H.useCallback(callback, deps);
29816
- };
29817
- react_production.useContext = function(Context2) {
29818
- return ReactSharedInternals.H.useContext(Context2);
29819
- };
29820
- react_production.useDebugValue = function() {
29821
- };
29822
- react_production.useDeferredValue = function(value, initialValue) {
29823
- return ReactSharedInternals.H.useDeferredValue(value, initialValue);
29824
- };
29825
- react_production.useEffect = function(create2, createDeps, update) {
29826
- var dispatcher = ReactSharedInternals.H;
29827
- if ("function" === typeof update)
29828
- throw Error(
29829
- "useEffect CRUD overload is not enabled in this build of React."
29830
- );
29831
- return dispatcher.useEffect(create2, createDeps);
29832
- };
29833
- react_production.useId = function() {
29834
- return ReactSharedInternals.H.useId();
29835
- };
29836
- react_production.useImperativeHandle = function(ref, create2, deps) {
29837
- return ReactSharedInternals.H.useImperativeHandle(ref, create2, deps);
29838
- };
29839
- react_production.useInsertionEffect = function(create2, deps) {
29840
- return ReactSharedInternals.H.useInsertionEffect(create2, deps);
29841
- };
29842
- react_production.useLayoutEffect = function(create2, deps) {
29843
- return ReactSharedInternals.H.useLayoutEffect(create2, deps);
29844
- };
29845
- react_production.useMemo = function(create2, deps) {
29846
- return ReactSharedInternals.H.useMemo(create2, deps);
29847
- };
29848
- react_production.useOptimistic = function(passthrough, reducer2) {
29849
- return ReactSharedInternals.H.useOptimistic(passthrough, reducer2);
29850
- };
29851
- react_production.useReducer = function(reducer2, initialArg, init2) {
29852
- return ReactSharedInternals.H.useReducer(reducer2, initialArg, init2);
29853
- };
29854
- react_production.useRef = function(initialValue) {
29855
- return ReactSharedInternals.H.useRef(initialValue);
29856
- };
29857
- react_production.useState = function(initialState2) {
29858
- return ReactSharedInternals.H.useState(initialState2);
29859
- };
29860
- react_production.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
29861
- return ReactSharedInternals.H.useSyncExternalStore(
29862
- subscribe,
29863
- getSnapshot,
29864
- getServerSnapshot
29865
- );
29866
- };
29867
- react_production.useTransition = function() {
29868
- return ReactSharedInternals.H.useTransition();
29869
- };
29870
- react_production.version = "19.1.0";
29871
- {
29872
- react.exports = react_production;
29873
- }
29874
- var reactExports = react.exports;
29875
- const ReactExports = /* @__PURE__ */ getDefaultExportFromCjs(reactExports);
29452
+ const ReactExports = {};
29876
29453
  var withSelector = { exports: {} };
29877
29454
  var withSelector_production = {};
29878
29455
  var shim$2 = { exports: {} };
@@ -29886,7 +29463,7 @@ var useSyncExternalStoreShim_production = {};
29886
29463
  * This source code is licensed under the MIT license found in the
29887
29464
  * LICENSE file in the root directory of this source tree.
29888
29465
  */
29889
- var React$1 = reactExports;
29466
+ var React$1 = require$$0;
29890
29467
  function is$1(x2, y2) {
29891
29468
  return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
29892
29469
  }
@@ -29941,7 +29518,7 @@ var shimExports = shim$2.exports;
29941
29518
  * This source code is licensed under the MIT license found in the
29942
29519
  * LICENSE file in the root directory of this source tree.
29943
29520
  */
29944
- var React = reactExports, shim = shimExports;
29521
+ var React = require$$0, shim = shimExports;
29945
29522
  function is(x2, y2) {
29946
29523
  return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
29947
29524
  }
@@ -30142,6 +29719,7 @@ const AnnotationEditorType = {
30142
29719
  HIGHLIGHT: 9,
30143
29720
  STAMP: 13,
30144
29721
  INK: 15,
29722
+ POPUP: 16,
30145
29723
  SIGNATURE: 101,
30146
29724
  COMMENT: 102
30147
29725
  };
@@ -30530,6 +30108,9 @@ class Util {
30530
30108
  static makeHexColor(r, g2, b2) {
30531
30109
  return `#${hexNumbers[r]}${hexNumbers[g2]}${hexNumbers[b2]}`;
30532
30110
  }
30111
+ static domMatrixToTransform(dm) {
30112
+ return [dm.a, dm.b, dm.c, dm.d, dm.e, dm.f];
30113
+ }
30533
30114
  static scaleMinMax(transform2, minMax) {
30534
30115
  let temp;
30535
30116
  if (transform2[0]) {
@@ -30577,6 +30158,9 @@ class Util {
30577
30158
  static transform(m1, m2) {
30578
30159
  return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
30579
30160
  }
30161
+ static multiplyByDOMMatrix(m2, md) {
30162
+ return [m2[0] * md.a + m2[2] * md.b, m2[1] * md.a + m2[3] * md.b, m2[0] * md.c + m2[2] * md.d, m2[1] * md.c + m2[3] * md.d, m2[0] * md.e + m2[2] * md.f + m2[4], m2[1] * md.e + m2[3] * md.f + m2[5]];
30163
+ }
30580
30164
  static applyTransform(p2, m2, pos = 0) {
30581
30165
  const p0 = p2[pos];
30582
30166
  const p1 = p2[pos + 1];
@@ -31345,12 +30929,14 @@ const _EditorToolbar = class _EditorToolbar {
31345
30929
  editToolbar.classList.add("editToolbar", "hidden");
31346
30930
  editToolbar.setAttribute("role", "toolbar");
31347
30931
  const signal = __privateGet(this, _editor)._uiManager._signal;
31348
- editToolbar.addEventListener("contextmenu", noContextMenu, {
31349
- signal
31350
- });
31351
- editToolbar.addEventListener("pointerdown", __privateMethod(_EditorToolbar, _EditorToolbar_static, pointerDown_fn), {
31352
- signal
31353
- });
30932
+ if (signal instanceof AbortSignal && !signal.aborted) {
30933
+ editToolbar.addEventListener("contextmenu", noContextMenu, {
30934
+ signal
30935
+ });
30936
+ editToolbar.addEventListener("pointerdown", __privateMethod(_EditorToolbar, _EditorToolbar_static, pointerDown_fn), {
30937
+ signal
30938
+ });
30939
+ }
31354
30940
  const buttons = __privateSet(this, _buttons, document.createElement("div"));
31355
30941
  buttons.className = "buttons";
31356
30942
  editToolbar.append(buttons);
@@ -31385,15 +30971,16 @@ const _EditorToolbar = class _EditorToolbar {
31385
30971
  _uiManager: _uiManager5
31386
30972
  } = __privateGet(this, _editor);
31387
30973
  const button = document.createElement("button");
31388
- button.className = "delete";
30974
+ button.classList.add("basic", "deleteButton");
31389
30975
  button.tabIndex = 0;
31390
30976
  button.setAttribute("data-l10n-id", __privateGet(_EditorToolbar, _l10nRemove)[editorType]);
31391
- __privateMethod(this, _EditorToolbar_instances, addListenersToElement_fn).call(this, button);
31392
- button.addEventListener("click", (e2) => {
31393
- _uiManager5.delete();
31394
- }, {
31395
- signal: _uiManager5._signal
31396
- });
30977
+ if (__privateMethod(this, _EditorToolbar_instances, addListenersToElement_fn).call(this, button)) {
30978
+ button.addEventListener("click", (e2) => {
30979
+ _uiManager5.delete();
30980
+ }, {
30981
+ signal: _uiManager5._signal
30982
+ });
30983
+ }
31397
30984
  __privateGet(this, _buttons).append(button);
31398
30985
  }
31399
30986
  addAltText(altText) {
@@ -31413,7 +31000,7 @@ const _EditorToolbar = class _EditorToolbar {
31413
31000
  return;
31414
31001
  }
31415
31002
  __privateMethod(this, _EditorToolbar_instances, addListenersToElement_fn).call(this, button);
31416
- __privateGet(this, _buttons).prepend(button, __privateGet(this, _EditorToolbar_instances, divider_get));
31003
+ __privateGet(this, _buttons).append(button, __privateGet(this, _EditorToolbar_instances, divider_get));
31417
31004
  __privateSet(this, _comment, comment);
31418
31005
  comment.toolbar = this;
31419
31006
  }
@@ -31489,6 +31076,9 @@ focusOut_fn = function(e2) {
31489
31076
  };
31490
31077
  addListenersToElement_fn = function(element) {
31491
31078
  const signal = __privateGet(this, _editor)._uiManager._signal;
31079
+ if (!(signal instanceof AbortSignal) || signal.aborted) {
31080
+ return false;
31081
+ }
31492
31082
  element.addEventListener("focusin", __privateMethod(this, _EditorToolbar_instances, focusIn_fn).bind(this), {
31493
31083
  capture: true,
31494
31084
  signal
@@ -31500,6 +31090,7 @@ addListenersToElement_fn = function(element) {
31500
31090
  element.addEventListener("contextmenu", noContextMenu, {
31501
31091
  signal
31502
31092
  });
31093
+ return true;
31503
31094
  };
31504
31095
  divider_get = function() {
31505
31096
  const divider = document.createElement("div");
@@ -31509,19 +31100,19 @@ divider_get = function() {
31509
31100
  __privateAdd(_EditorToolbar, _EditorToolbar_static);
31510
31101
  __privateAdd(_EditorToolbar, _l10nRemove, null);
31511
31102
  let EditorToolbar = _EditorToolbar;
31512
- class HighlightToolbar {
31103
+ class FloatingToolbar {
31513
31104
  constructor(uiManager) {
31514
- __privateAdd(this, _HighlightToolbar_instances);
31105
+ __privateAdd(this, _FloatingToolbar_instances);
31515
31106
  __privateAdd(this, _buttons2, null);
31516
31107
  __privateAdd(this, _toolbar2, null);
31517
31108
  __privateAdd(this, _uiManager);
31518
31109
  __privateSet(this, _uiManager, uiManager);
31519
31110
  }
31520
31111
  show(parent, boxes, isLTR) {
31521
- const [x2, y2] = __privateMethod(this, _HighlightToolbar_instances, getLastPoint_fn).call(this, boxes, isLTR);
31112
+ const [x2, y2] = __privateMethod(this, _FloatingToolbar_instances, getLastPoint_fn).call(this, boxes, isLTR);
31522
31113
  const {
31523
31114
  style
31524
- } = __privateGet(this, _toolbar2) || __privateSet(this, _toolbar2, __privateMethod(this, _HighlightToolbar_instances, render_fn).call(this));
31115
+ } = __privateGet(this, _toolbar2) || __privateSet(this, _toolbar2, __privateMethod(this, _FloatingToolbar_instances, render_fn).call(this));
31525
31116
  parent.append(__privateGet(this, _toolbar2));
31526
31117
  style.insetInlineEnd = `${100 * x2}%`;
31527
31118
  style.top = `calc(${100 * y2}% + var(--editor-toolbar-vert-offset))`;
@@ -31533,18 +31124,28 @@ class HighlightToolbar {
31533
31124
  _buttons2 = new WeakMap();
31534
31125
  _toolbar2 = new WeakMap();
31535
31126
  _uiManager = new WeakMap();
31536
- _HighlightToolbar_instances = new WeakSet();
31127
+ _FloatingToolbar_instances = new WeakSet();
31537
31128
  render_fn = function() {
31538
31129
  const editToolbar = __privateSet(this, _toolbar2, document.createElement("div"));
31539
31130
  editToolbar.className = "editToolbar";
31540
31131
  editToolbar.setAttribute("role", "toolbar");
31541
- editToolbar.addEventListener("contextmenu", noContextMenu, {
31542
- signal: __privateGet(this, _uiManager)._signal
31543
- });
31132
+ const signal = __privateGet(this, _uiManager)._signal;
31133
+ if (signal instanceof AbortSignal && !signal.aborted) {
31134
+ editToolbar.addEventListener("contextmenu", noContextMenu, {
31135
+ signal
31136
+ });
31137
+ }
31544
31138
  const buttons = __privateSet(this, _buttons2, document.createElement("div"));
31545
31139
  buttons.className = "buttons";
31546
31140
  editToolbar.append(buttons);
31547
- __privateMethod(this, _HighlightToolbar_instances, addHighlightButton_fn).call(this);
31141
+ if (__privateGet(this, _uiManager).hasCommentManager()) {
31142
+ __privateMethod(this, _FloatingToolbar_instances, makeButton_fn).call(this, "commentButton", `pdfjs-comment-floating-button`, "pdfjs-comment-floating-button-label", () => {
31143
+ __privateGet(this, _uiManager).commentSelection("floating_button");
31144
+ });
31145
+ }
31146
+ __privateMethod(this, _FloatingToolbar_instances, makeButton_fn).call(this, "highlightButton", `pdfjs-highlight-floating-button1`, "pdfjs-highlight-floating-button-label", () => {
31147
+ __privateGet(this, _uiManager).highlightSelection("floating_button");
31148
+ });
31548
31149
  return editToolbar;
31549
31150
  };
31550
31151
  getLastPoint_fn = function(boxes, isLTR) {
@@ -31571,24 +31172,24 @@ getLastPoint_fn = function(boxes, isLTR) {
31571
31172
  }
31572
31173
  return [isLTR ? 1 - lastX : lastX, lastY];
31573
31174
  };
31574
- addHighlightButton_fn = function() {
31175
+ makeButton_fn = function(buttonClass, l10nId, labelL10nId, clickHandler) {
31575
31176
  const button = document.createElement("button");
31576
- button.className = "highlightButton";
31177
+ button.classList.add("basic", buttonClass);
31577
31178
  button.tabIndex = 0;
31578
- button.setAttribute("data-l10n-id", `pdfjs-highlight-floating-button1`);
31179
+ button.setAttribute("data-l10n-id", l10nId);
31579
31180
  const span = document.createElement("span");
31580
31181
  button.append(span);
31581
31182
  span.className = "visuallyHidden";
31582
- span.setAttribute("data-l10n-id", "pdfjs-highlight-floating-button-label");
31183
+ span.setAttribute("data-l10n-id", labelL10nId);
31583
31184
  const signal = __privateGet(this, _uiManager)._signal;
31584
- button.addEventListener("contextmenu", noContextMenu, {
31585
- signal
31586
- });
31587
- button.addEventListener("click", () => {
31588
- __privateGet(this, _uiManager).highlightSelection("floating_button");
31589
- }, {
31590
- signal
31591
- });
31185
+ if (signal instanceof AbortSignal && !signal.aborted) {
31186
+ button.addEventListener("contextmenu", noContextMenu, {
31187
+ signal
31188
+ });
31189
+ button.addEventListener("click", clickHandler, {
31190
+ signal
31191
+ });
31192
+ }
31592
31193
  __privateGet(this, _buttons2).append(button);
31593
31194
  };
31594
31195
  function bindEvents(obj, element, names) {
@@ -32006,6 +31607,7 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32006
31607
  __privateAdd(this, _AnnotationEditorUIManager_instances);
32007
31608
  __privateAdd(this, _abortController, new AbortController());
32008
31609
  __privateAdd(this, _activeEditor, null);
31610
+ __privateAdd(this, _allEditableAnnotations, null);
32009
31611
  __privateAdd(this, _allEditors, /* @__PURE__ */ new Map());
32010
31612
  __privateAdd(this, _allLayers, /* @__PURE__ */ new Map());
32011
31613
  __privateAdd(this, _altTextManager, null);
@@ -32029,9 +31631,10 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32029
31631
  __privateAdd(this, _focusManagerAC, null);
32030
31632
  __privateAdd(this, _highlightColors, null);
32031
31633
  __privateAdd(this, _highlightWhenShiftUp, false);
32032
- __privateAdd(this, _highlightToolbar, null);
31634
+ __privateAdd(this, _floatingToolbar, null);
32033
31635
  __privateAdd(this, _idManager, new IdManager());
32034
31636
  __privateAdd(this, _isEnabled, false);
31637
+ __privateAdd(this, _isPointerDown, false);
32035
31638
  __privateAdd(this, _isWaiting, false);
32036
31639
  __privateAdd(this, _keyboardManagerAC, null);
32037
31640
  __privateAdd(this, _lastActiveElement, null);
@@ -32044,6 +31647,7 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32044
31647
  __privateAdd(this, _signatureManager, null);
32045
31648
  __privateAdd(this, _pageColors, null);
32046
31649
  __privateAdd(this, _showAllStates, null);
31650
+ __privateAdd(this, _pdfDocument, null);
32047
31651
  __privateAdd(this, _previousStates, {
32048
31652
  isEditing: false,
32049
31653
  isEmpty: true,
@@ -32065,6 +31669,7 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32065
31669
  __privateSet(this, _altTextManager, altTextManager);
32066
31670
  __privateSet(this, _commentManager, commentManager);
32067
31671
  __privateSet(this, _signatureManager, signatureManager);
31672
+ __privateSet(this, _pdfDocument, pdfDocument);
32068
31673
  this._eventBus = eventBus;
32069
31674
  eventBus._on("editingaction", this.onEditingAction.bind(this), {
32070
31675
  signal
@@ -32084,6 +31689,18 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32084
31689
  eventBus._on("switchannotationeditorparams", (evt) => this.updateParams(evt.type, evt.value), {
32085
31690
  signal
32086
31691
  });
31692
+ window.addEventListener("pointerdown", () => {
31693
+ __privateSet(this, _isPointerDown, true);
31694
+ }, {
31695
+ capture: true,
31696
+ signal
31697
+ });
31698
+ window.addEventListener("pointerup", () => {
31699
+ __privateSet(this, _isPointerDown, false);
31700
+ }, {
31701
+ capture: true,
31702
+ signal
31703
+ });
32087
31704
  __privateMethod(this, _AnnotationEditorUIManager_instances, addSelectionListener_fn).call(this);
32088
31705
  __privateMethod(this, _AnnotationEditorUIManager_instances, addDragAndDropListeners_fn).call(this);
32089
31706
  __privateMethod(this, _AnnotationEditorUIManager_instances, addKeyboardManager_fn).call(this);
@@ -32181,10 +31798,11 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32181
31798
  (_d = __privateGet(this, _altTextManager)) == null ? void 0 : _d.destroy();
32182
31799
  (_e = __privateGet(this, _commentManager)) == null ? void 0 : _e.destroy();
32183
31800
  (_f = __privateGet(this, _signatureManager)) == null ? void 0 : _f.destroy();
32184
- (_g2 = __privateGet(this, _highlightToolbar)) == null ? void 0 : _g2.hide();
32185
- __privateSet(this, _highlightToolbar, null);
31801
+ (_g2 = __privateGet(this, _floatingToolbar)) == null ? void 0 : _g2.hide();
31802
+ __privateSet(this, _floatingToolbar, null);
32186
31803
  (_h = __privateGet(this, _mainHighlightColorPicker)) == null ? void 0 : _h.destroy();
32187
31804
  __privateSet(this, _mainHighlightColorPicker, null);
31805
+ __privateSet(this, _allEditableAnnotations, null);
32188
31806
  if (__privateGet(this, _focusMainContainerTimeoutId)) {
32189
31807
  clearTimeout(__privateGet(this, _focusMainContainerTimeoutId));
32190
31808
  __privateSet(this, _focusMainContainerTimeoutId, null);
@@ -32194,6 +31812,7 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32194
31812
  __privateSet(this, _translationTimeoutId, null);
32195
31813
  }
32196
31814
  (_i = this._editorUndoBar) == null ? void 0 : _i.destroy();
31815
+ __privateSet(this, _pdfDocument, null);
32197
31816
  }
32198
31817
  combinedSignal(ac) {
32199
31818
  return AbortSignal.any([this._signal, ac.signal]);
@@ -32362,7 +31981,7 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32362
31981
  this.commitOrRemove();
32363
31982
  this.viewParameters.rotation = pagesRotation;
32364
31983
  }
32365
- highlightSelection(methodOfCreation = "") {
31984
+ highlightSelection(methodOfCreation = "", comment = false) {
32366
31985
  const selection = document.getSelection();
32367
31986
  if (!selection || selection.isCollapsed) {
32368
31987
  return;
@@ -32384,7 +32003,7 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32384
32003
  const layer = __privateMethod(this, _AnnotationEditorUIManager_instances, getLayerForTextLayer_fn).call(this, textLayer);
32385
32004
  const isNoneMode = __privateGet(this, _mode) === AnnotationEditorType.NONE;
32386
32005
  const callback = () => {
32387
- layer == null ? void 0 : layer.createAndAddNewEditor({
32006
+ const editor = layer == null ? void 0 : layer.createAndAddNewEditor({
32388
32007
  x: 0,
32389
32008
  y: 0
32390
32009
  }, false, {
@@ -32399,6 +32018,9 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32399
32018
  if (isNoneMode) {
32400
32019
  this.showAllEditors("highlight", true, true);
32401
32020
  }
32021
+ if (comment) {
32022
+ editor == null ? void 0 : editor.editComment();
32023
+ }
32402
32024
  };
32403
32025
  if (isNoneMode) {
32404
32026
  this.switchToMode(AnnotationEditorType.HIGHLIGHT, callback);
@@ -32406,6 +32028,9 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32406
32028
  }
32407
32029
  callback();
32408
32030
  }
32031
+ commentSelection(methodOfCreation = "") {
32032
+ this.highlightSelection(methodOfCreation, true);
32033
+ }
32409
32034
  addToAnnotationStorage(editor) {
32410
32035
  if (!editor.isEmpty() && __privateGet(this, _annotationStorage) && !__privateGet(this, _annotationStorage).has(editor.id)) {
32411
32036
  __privateGet(this, _annotationStorage).setValue(editor.id, editor);
@@ -32601,6 +32226,9 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32601
32226
  case "highlightSelection":
32602
32227
  this.highlightSelection("context_menu");
32603
32228
  break;
32229
+ case "commentSelection":
32230
+ this.commentSelection("context_menu");
32231
+ break;
32604
32232
  }
32605
32233
  }
32606
32234
  setEditingState(isEditing) {
@@ -32657,7 +32285,7 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32657
32285
  }
32658
32286
  updateMode(mode, editId = null, isFromKeyboard = false, mustEnterInEditMode = false, editComment = false) {
32659
32287
  return __async(this, null, function* () {
32660
- var _a2, _b2, _c;
32288
+ var _a2, _b2, _c, _d, _e;
32661
32289
  if (__privateGet(this, _mode) === mode) {
32662
32290
  return;
32663
32291
  }
@@ -32669,16 +32297,23 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
32669
32297
  }
32670
32298
  __privateSet(this, _updateModeCapability, Promise.withResolvers());
32671
32299
  (_a2 = __privateGet(this, _currentDrawingSession)) == null ? void 0 : _a2.commitOrRemove();
32300
+ if (__privateGet(this, _mode) === AnnotationEditorType.POPUP) {
32301
+ (_b2 = __privateGet(this, _commentManager)) == null ? void 0 : _b2.hideSidebar();
32302
+ }
32672
32303
  __privateSet(this, _mode, mode);
32673
32304
  if (mode === AnnotationEditorType.NONE) {
32674
32305
  this.setEditingState(false);
32675
32306
  __privateMethod(this, _AnnotationEditorUIManager_instances, disableAll_fn).call(this);
32676
- (_b2 = this._editorUndoBar) == null ? void 0 : _b2.hide();
32307
+ (_c = this._editorUndoBar) == null ? void 0 : _c.hide();
32677
32308
  __privateGet(this, _updateModeCapability).resolve();
32678
32309
  return;
32679
32310
  }
32680
32311
  if (mode === AnnotationEditorType.SIGNATURE) {
32681
- yield (_c = __privateGet(this, _signatureManager)) == null ? void 0 : _c.loadSignatures();
32312
+ yield (_d = __privateGet(this, _signatureManager)) == null ? void 0 : _d.loadSignatures();
32313
+ }
32314
+ if (mode === AnnotationEditorType.POPUP) {
32315
+ __privateGet(this, _allEditableAnnotations) || __privateSet(this, _allEditableAnnotations, yield __privateGet(this, _pdfDocument).getAnnotationsByType(new Set(__privateGet(this, _editorTypes).map((editorClass) => editorClass._editorType))));
32316
+ (_e = __privateGet(this, _commentManager)) == null ? void 0 : _e.showSidebar(__privateGet(this, _allEditableAnnotations));
32682
32317
  }
32683
32318
  this.setEditingState(true);
32684
32319
  yield __privateMethod(this, _AnnotationEditorUIManager_instances, enableAll_fn).call(this);
@@ -33258,6 +32893,7 @@ const _AnnotationEditorUIManager = class _AnnotationEditorUIManager {
33258
32893
  };
33259
32894
  _abortController = new WeakMap();
33260
32895
  _activeEditor = new WeakMap();
32896
+ _allEditableAnnotations = new WeakMap();
33261
32897
  _allEditors = new WeakMap();
33262
32898
  _allLayers = new WeakMap();
33263
32899
  _altTextManager = new WeakMap();
@@ -33280,9 +32916,10 @@ _focusMainContainerTimeoutId = new WeakMap();
33280
32916
  _focusManagerAC = new WeakMap();
33281
32917
  _highlightColors = new WeakMap();
33282
32918
  _highlightWhenShiftUp = new WeakMap();
33283
- _highlightToolbar = new WeakMap();
32919
+ _floatingToolbar = new WeakMap();
33284
32920
  _idManager = new WeakMap();
33285
32921
  _isEnabled = new WeakMap();
32922
+ _isPointerDown = new WeakMap();
33286
32923
  _isWaiting = new WeakMap();
33287
32924
  _keyboardManagerAC = new WeakMap();
33288
32925
  _lastActiveElement = new WeakMap();
@@ -33295,6 +32932,7 @@ _selectedTextNode = new WeakMap();
33295
32932
  _signatureManager = new WeakMap();
33296
32933
  _pageColors = new WeakMap();
33297
32934
  _showAllStates = new WeakMap();
32935
+ _pdfDocument = new WeakMap();
33298
32936
  _previousStates = new WeakMap();
33299
32937
  _translation = new WeakMap();
33300
32938
  _translationTimeoutId = new WeakMap();
@@ -33322,7 +32960,7 @@ getLayerForTextLayer_fn = function(textLayer) {
33322
32960
  }
33323
32961
  return null;
33324
32962
  };
33325
- displayHighlightToolbar_fn = function() {
32963
+ displayFloatingToolbar_fn = function() {
33326
32964
  const selection = document.getSelection();
33327
32965
  if (!selection || selection.isCollapsed) {
33328
32966
  return;
@@ -33333,15 +32971,15 @@ displayHighlightToolbar_fn = function() {
33333
32971
  if (!boxes) {
33334
32972
  return;
33335
32973
  }
33336
- __privateGet(this, _highlightToolbar) || __privateSet(this, _highlightToolbar, new HighlightToolbar(this));
33337
- __privateGet(this, _highlightToolbar).show(textLayer, boxes, this.direction === "ltr");
32974
+ __privateGet(this, _floatingToolbar) || __privateSet(this, _floatingToolbar, new FloatingToolbar(this));
32975
+ __privateGet(this, _floatingToolbar).show(textLayer, boxes, this.direction === "ltr");
33338
32976
  };
33339
32977
  selectionChange_fn = function() {
33340
32978
  var _a2, _b2, _c;
33341
32979
  const selection = document.getSelection();
33342
32980
  if (!selection || selection.isCollapsed) {
33343
32981
  if (__privateGet(this, _selectedTextNode)) {
33344
- (_a2 = __privateGet(this, _highlightToolbar)) == null ? void 0 : _a2.hide();
32982
+ (_a2 = __privateGet(this, _floatingToolbar)) == null ? void 0 : _a2.hide();
33345
32983
  __privateSet(this, _selectedTextNode, null);
33346
32984
  __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateStates_fn).call(this, {
33347
32985
  hasSelectedText: false
@@ -33359,7 +32997,7 @@ selectionChange_fn = function() {
33359
32997
  const textLayer = anchorElement.closest(".textLayer");
33360
32998
  if (!textLayer) {
33361
32999
  if (__privateGet(this, _selectedTextNode)) {
33362
- (_b2 = __privateGet(this, _highlightToolbar)) == null ? void 0 : _b2.hide();
33000
+ (_b2 = __privateGet(this, _floatingToolbar)) == null ? void 0 : _b2.hide();
33363
33001
  __privateSet(this, _selectedTextNode, null);
33364
33002
  __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateStates_fn).call(this, {
33365
33003
  hasSelectedText: false
@@ -33367,7 +33005,7 @@ selectionChange_fn = function() {
33367
33005
  }
33368
33006
  return;
33369
33007
  }
33370
- (_c = __privateGet(this, _highlightToolbar)) == null ? void 0 : _c.hide();
33008
+ (_c = __privateGet(this, _floatingToolbar)) == null ? void 0 : _c.hide();
33371
33009
  __privateSet(this, _selectedTextNode, anchorNode);
33372
33010
  __privateMethod(this, _AnnotationEditorUIManager_instances, dispatchUpdateStates_fn).call(this, {
33373
33011
  hasSelectedText: true
@@ -33382,31 +33020,36 @@ selectionChange_fn = function() {
33382
33020
  if (!this.isShiftKeyDown) {
33383
33021
  const activeLayer = __privateGet(this, _mode) === AnnotationEditorType.HIGHLIGHT ? __privateMethod(this, _AnnotationEditorUIManager_instances, getLayerForTextLayer_fn).call(this, textLayer) : null;
33384
33022
  activeLayer == null ? void 0 : activeLayer.toggleDrawing();
33385
- const ac = new AbortController();
33386
- const signal = this.combinedSignal(ac);
33387
- const pointerup = (e2) => {
33388
- if (e2.type === "pointerup" && e2.button !== 0) {
33389
- return;
33390
- }
33391
- ac.abort();
33023
+ if (__privateGet(this, _isPointerDown)) {
33024
+ const ac = new AbortController();
33025
+ const signal = this.combinedSignal(ac);
33026
+ const pointerup = (e2) => {
33027
+ if (e2.type === "pointerup" && e2.button !== 0) {
33028
+ return;
33029
+ }
33030
+ ac.abort();
33031
+ activeLayer == null ? void 0 : activeLayer.toggleDrawing(true);
33032
+ if (e2.type === "pointerup") {
33033
+ __privateMethod(this, _AnnotationEditorUIManager_instances, onSelectEnd_fn).call(this, "main_toolbar");
33034
+ }
33035
+ };
33036
+ window.addEventListener("pointerup", pointerup, {
33037
+ signal
33038
+ });
33039
+ window.addEventListener("blur", pointerup, {
33040
+ signal
33041
+ });
33042
+ } else {
33392
33043
  activeLayer == null ? void 0 : activeLayer.toggleDrawing(true);
33393
- if (e2.type === "pointerup") {
33394
- __privateMethod(this, _AnnotationEditorUIManager_instances, onSelectEnd_fn).call(this, "main_toolbar");
33395
- }
33396
- };
33397
- window.addEventListener("pointerup", pointerup, {
33398
- signal
33399
- });
33400
- window.addEventListener("blur", pointerup, {
33401
- signal
33402
- });
33044
+ __privateMethod(this, _AnnotationEditorUIManager_instances, onSelectEnd_fn).call(this, "main_toolbar");
33045
+ }
33403
33046
  }
33404
33047
  };
33405
33048
  onSelectEnd_fn = function(methodOfCreation = "") {
33406
33049
  if (__privateGet(this, _mode) === AnnotationEditorType.HIGHLIGHT) {
33407
33050
  this.highlightSelection(methodOfCreation);
33408
33051
  } else if (__privateGet(this, _enableHighlightFloatingButton)) {
33409
- __privateMethod(this, _AnnotationEditorUIManager_instances, displayHighlightToolbar_fn).call(this);
33052
+ __privateMethod(this, _AnnotationEditorUIManager_instances, displayFloatingToolbar_fn).call(this);
33410
33053
  }
33411
33054
  };
33412
33055
  addSelectionListener_fn = function() {
@@ -33880,6 +33523,9 @@ class Comment {
33880
33523
  comment.tabIndex = "0";
33881
33524
  comment.setAttribute("data-l10n-id", "pdfjs-editor-edit-comment-button");
33882
33525
  const signal = __privateGet(this, _editor3)._uiManager._signal;
33526
+ if (!(signal instanceof AbortSignal) || signal.aborted) {
33527
+ return comment;
33528
+ }
33883
33529
  comment.addEventListener("contextmenu", noContextMenu, {
33884
33530
  signal
33885
33531
  });
@@ -34632,7 +34278,6 @@ const _AnnotationEditor = class _AnnotationEditor {
34632
34278
  }
34633
34279
  this._editToolbar = new EditorToolbar(this);
34634
34280
  this.div.append(this._editToolbar.render());
34635
- this._editToolbar.addButton("comment", this.addCommentButton());
34636
34281
  const {
34637
34282
  toolbarButtons
34638
34283
  } = this;
@@ -34641,6 +34286,7 @@ const _AnnotationEditor = class _AnnotationEditor {
34641
34286
  yield this._editToolbar.addButton(name, tool);
34642
34287
  }
34643
34288
  }
34289
+ this._editToolbar.addButton("comment", this.addCommentButton());
34644
34290
  this._editToolbar.addButton("delete");
34645
34291
  return this._editToolbar;
34646
34292
  });
@@ -34752,9 +34398,18 @@ const _AnnotationEditor = class _AnnotationEditor {
34752
34398
  }
34753
34399
  addComment(serialized) {
34754
34400
  if (this.hasEditedComment) {
34401
+ const DEFAULT_POPUP_WIDTH = 180;
34402
+ const DEFAULT_POPUP_HEIGHT = 100;
34403
+ const [, , , trY] = serialized.rect;
34404
+ const [pageWidth] = this.pageDimensions;
34405
+ const [pageX] = this.pageTranslation;
34406
+ const blX = pageX + pageWidth + 1;
34407
+ const blY = trY - DEFAULT_POPUP_HEIGHT;
34408
+ const trX = blX + DEFAULT_POPUP_WIDTH;
34755
34409
  serialized.popup = {
34756
34410
  contents: this.comment.text,
34757
- deleted: this.comment.deleted
34411
+ deleted: this.comment.deleted,
34412
+ rect: [blX, blY, trX, trY]
34758
34413
  };
34759
34414
  }
34760
34415
  }
@@ -34871,6 +34526,9 @@ const _AnnotationEditor = class _AnnotationEditor {
34871
34526
  throw new Error("Invalid rotation");
34872
34527
  }
34873
34528
  }
34529
+ getPDFRect() {
34530
+ return this.getRect(0, 0);
34531
+ }
34874
34532
  onceAdded(focus) {
34875
34533
  }
34876
34534
  isEmpty() {
@@ -35225,6 +34883,10 @@ const _AnnotationEditor = class _AnnotationEditor {
35225
34883
  __privateSet(this, _disabled, true);
35226
34884
  }
35227
34885
  renderAnnotationElement(annotation) {
34886
+ if (this.deleted) {
34887
+ annotation.hide();
34888
+ return null;
34889
+ }
35228
34890
  let content2 = annotation.container.querySelector(".annotationContent");
35229
34891
  if (!content2) {
35230
34892
  content2 = document.createElement("div");
@@ -37319,6 +36981,493 @@ class NodeWasmFactory extends BaseWasmFactory {
37319
36981
  });
37320
36982
  }
37321
36983
  }
36984
+ const FORCED_DEPENDENCY_LABEL = "__forcedDependency";
36985
+ class CanvasDependencyTracker {
36986
+ constructor(canvas2) {
36987
+ __privateAdd(this, _simple, {
36988
+ __proto__: null
36989
+ });
36990
+ __privateAdd(this, _incremental, {
36991
+ __proto__: null,
36992
+ transform: [],
36993
+ moveText: [],
36994
+ sameLineText: [],
36995
+ [FORCED_DEPENDENCY_LABEL]: []
36996
+ });
36997
+ __privateAdd(this, _namedDependencies, /* @__PURE__ */ new Map());
36998
+ __privateAdd(this, _savesStack, []);
36999
+ __privateAdd(this, _markedContentStack, []);
37000
+ __privateAdd(this, _baseTransformStack, [[1, 0, 0, 1, 0, 0]]);
37001
+ __privateAdd(this, _clipBox, [-Infinity, -Infinity, Infinity, Infinity]);
37002
+ __privateAdd(this, _pendingBBox, new Float64Array([Infinity, Infinity, -Infinity, -Infinity]));
37003
+ __privateAdd(this, _pendingBBoxIdx, -1);
37004
+ __privateAdd(this, _pendingDependencies, /* @__PURE__ */ new Set());
37005
+ __privateAdd(this, _operations, /* @__PURE__ */ new Map());
37006
+ __privateAdd(this, _fontBBoxTrustworthy, /* @__PURE__ */ new Map());
37007
+ __privateAdd(this, _canvasWidth);
37008
+ __privateAdd(this, _canvasHeight);
37009
+ __privateSet(this, _canvasWidth, canvas2.width);
37010
+ __privateSet(this, _canvasHeight, canvas2.height);
37011
+ }
37012
+ save(opIdx) {
37013
+ __privateSet(this, _simple, {
37014
+ __proto__: __privateGet(this, _simple)
37015
+ });
37016
+ __privateSet(this, _incremental, {
37017
+ __proto__: __privateGet(this, _incremental),
37018
+ transform: {
37019
+ __proto__: __privateGet(this, _incremental).transform
37020
+ },
37021
+ moveText: {
37022
+ __proto__: __privateGet(this, _incremental).moveText
37023
+ },
37024
+ sameLineText: {
37025
+ __proto__: __privateGet(this, _incremental).sameLineText
37026
+ },
37027
+ [FORCED_DEPENDENCY_LABEL]: {
37028
+ __proto__: __privateGet(this, _incremental)[FORCED_DEPENDENCY_LABEL]
37029
+ }
37030
+ });
37031
+ __privateSet(this, _clipBox, {
37032
+ __proto__: __privateGet(this, _clipBox)
37033
+ });
37034
+ __privateGet(this, _savesStack).push([opIdx, null]);
37035
+ return this;
37036
+ }
37037
+ restore(opIdx) {
37038
+ const previous = Object.getPrototypeOf(__privateGet(this, _simple));
37039
+ if (previous === null) {
37040
+ return this;
37041
+ }
37042
+ __privateSet(this, _simple, previous);
37043
+ __privateSet(this, _incremental, Object.getPrototypeOf(__privateGet(this, _incremental)));
37044
+ __privateSet(this, _clipBox, Object.getPrototypeOf(__privateGet(this, _clipBox)));
37045
+ const lastPair = __privateGet(this, _savesStack).pop();
37046
+ if (lastPair !== void 0) {
37047
+ lastPair[1] = opIdx;
37048
+ }
37049
+ return this;
37050
+ }
37051
+ recordOpenMarker(idx) {
37052
+ __privateGet(this, _savesStack).push([idx, null]);
37053
+ return this;
37054
+ }
37055
+ getOpenMarker() {
37056
+ if (__privateGet(this, _savesStack).length === 0) {
37057
+ return null;
37058
+ }
37059
+ return __privateGet(this, _savesStack).at(-1)[0];
37060
+ }
37061
+ recordCloseMarker(idx) {
37062
+ const lastPair = __privateGet(this, _savesStack).pop();
37063
+ if (lastPair !== void 0) {
37064
+ lastPair[1] = idx;
37065
+ }
37066
+ return this;
37067
+ }
37068
+ beginMarkedContent(opIdx) {
37069
+ __privateGet(this, _markedContentStack).push([opIdx, null]);
37070
+ return this;
37071
+ }
37072
+ endMarkedContent(opIdx) {
37073
+ const lastPair = __privateGet(this, _markedContentStack).pop();
37074
+ if (lastPair !== void 0) {
37075
+ lastPair[1] = opIdx;
37076
+ }
37077
+ return this;
37078
+ }
37079
+ pushBaseTransform(ctx) {
37080
+ __privateGet(this, _baseTransformStack).push(Util.multiplyByDOMMatrix(__privateGet(this, _baseTransformStack).at(-1), ctx.getTransform()));
37081
+ return this;
37082
+ }
37083
+ popBaseTransform() {
37084
+ if (__privateGet(this, _baseTransformStack).length > 1) {
37085
+ __privateGet(this, _baseTransformStack).pop();
37086
+ }
37087
+ return this;
37088
+ }
37089
+ recordSimpleData(name, idx) {
37090
+ __privateGet(this, _simple)[name] = idx;
37091
+ return this;
37092
+ }
37093
+ recordIncrementalData(name, idx) {
37094
+ __privateGet(this, _incremental)[name].push(idx);
37095
+ return this;
37096
+ }
37097
+ resetIncrementalData(name, idx) {
37098
+ __privateGet(this, _incremental)[name].length = 0;
37099
+ return this;
37100
+ }
37101
+ recordNamedData(name, idx) {
37102
+ __privateGet(this, _namedDependencies).set(name, idx);
37103
+ return this;
37104
+ }
37105
+ recordFutureForcedDependency(name, idx) {
37106
+ this.recordIncrementalData(FORCED_DEPENDENCY_LABEL, idx);
37107
+ return this;
37108
+ }
37109
+ inheritSimpleDataAsFutureForcedDependencies(names) {
37110
+ for (const name of names) {
37111
+ if (name in __privateGet(this, _simple)) {
37112
+ this.recordFutureForcedDependency(name, __privateGet(this, _simple)[name]);
37113
+ }
37114
+ }
37115
+ return this;
37116
+ }
37117
+ inheritPendingDependenciesAsFutureForcedDependencies() {
37118
+ for (const dep of __privateGet(this, _pendingDependencies)) {
37119
+ this.recordFutureForcedDependency(FORCED_DEPENDENCY_LABEL, dep);
37120
+ }
37121
+ return this;
37122
+ }
37123
+ resetBBox(idx) {
37124
+ __privateSet(this, _pendingBBoxIdx, idx);
37125
+ __privateGet(this, _pendingBBox)[0] = Infinity;
37126
+ __privateGet(this, _pendingBBox)[1] = Infinity;
37127
+ __privateGet(this, _pendingBBox)[2] = -Infinity;
37128
+ __privateGet(this, _pendingBBox)[3] = -Infinity;
37129
+ return this;
37130
+ }
37131
+ get hasPendingBBox() {
37132
+ return __privateGet(this, _pendingBBoxIdx) !== -1;
37133
+ }
37134
+ recordClipBox(idx, ctx, minX, maxX, minY, maxY) {
37135
+ const transform2 = Util.multiplyByDOMMatrix(__privateGet(this, _baseTransformStack).at(-1), ctx.getTransform());
37136
+ const clipBox = [Infinity, Infinity, -Infinity, -Infinity];
37137
+ Util.axialAlignedBoundingBox([minX, minY, maxX, maxY], transform2, clipBox);
37138
+ const intersection = Util.intersect(__privateGet(this, _clipBox), clipBox);
37139
+ if (intersection) {
37140
+ __privateGet(this, _clipBox)[0] = intersection[0];
37141
+ __privateGet(this, _clipBox)[1] = intersection[1];
37142
+ __privateGet(this, _clipBox)[2] = intersection[2];
37143
+ __privateGet(this, _clipBox)[3] = intersection[3];
37144
+ } else {
37145
+ __privateGet(this, _clipBox)[0] = __privateGet(this, _clipBox)[1] = Infinity;
37146
+ __privateGet(this, _clipBox)[2] = __privateGet(this, _clipBox)[3] = -Infinity;
37147
+ }
37148
+ return this;
37149
+ }
37150
+ recordBBox(idx, ctx, minX, maxX, minY, maxY) {
37151
+ const clipBox = __privateGet(this, _clipBox);
37152
+ if (clipBox[0] === Infinity) {
37153
+ return this;
37154
+ }
37155
+ const transform2 = Util.multiplyByDOMMatrix(__privateGet(this, _baseTransformStack).at(-1), ctx.getTransform());
37156
+ if (clipBox[0] === -Infinity) {
37157
+ Util.axialAlignedBoundingBox([minX, minY, maxX, maxY], transform2, __privateGet(this, _pendingBBox));
37158
+ return this;
37159
+ }
37160
+ const bbox = [Infinity, Infinity, -Infinity, -Infinity];
37161
+ Util.axialAlignedBoundingBox([minX, minY, maxX, maxY], transform2, bbox);
37162
+ __privateGet(this, _pendingBBox)[0] = Math.min(__privateGet(this, _pendingBBox)[0], Math.max(bbox[0], clipBox[0]));
37163
+ __privateGet(this, _pendingBBox)[1] = Math.min(__privateGet(this, _pendingBBox)[1], Math.max(bbox[1], clipBox[1]));
37164
+ __privateGet(this, _pendingBBox)[2] = Math.max(__privateGet(this, _pendingBBox)[2], Math.min(bbox[2], clipBox[2]));
37165
+ __privateGet(this, _pendingBBox)[3] = Math.max(__privateGet(this, _pendingBBox)[3], Math.min(bbox[3], clipBox[3]));
37166
+ return this;
37167
+ }
37168
+ recordCharacterBBox(idx, ctx, font, scale = 1, x2 = 0, y2 = 0, getMeasure) {
37169
+ const fontBBox = font.bbox;
37170
+ let isBBoxTrustworthy;
37171
+ let computedBBox;
37172
+ if (fontBBox) {
37173
+ isBBoxTrustworthy = fontBBox[2] !== fontBBox[0] && fontBBox[3] !== fontBBox[1] && __privateGet(this, _fontBBoxTrustworthy).get(font);
37174
+ if (isBBoxTrustworthy !== false) {
37175
+ computedBBox = [0, 0, 0, 0];
37176
+ Util.axialAlignedBoundingBox(fontBBox, font.fontMatrix, computedBBox);
37177
+ if (scale !== 1 || x2 !== 0 || y2 !== 0) {
37178
+ Util.scaleMinMax([scale, 0, 0, -scale, x2, y2], computedBBox);
37179
+ }
37180
+ if (isBBoxTrustworthy) {
37181
+ return this.recordBBox(idx, ctx, computedBBox[0], computedBBox[2], computedBBox[1], computedBBox[3]);
37182
+ }
37183
+ }
37184
+ }
37185
+ if (!getMeasure) {
37186
+ return this.recordFullPageBBox(idx);
37187
+ }
37188
+ const measure = getMeasure();
37189
+ if (fontBBox && computedBBox && isBBoxTrustworthy === void 0) {
37190
+ isBBoxTrustworthy = computedBBox[0] <= x2 - measure.actualBoundingBoxLeft && computedBBox[2] >= x2 + measure.actualBoundingBoxRight && computedBBox[1] <= y2 - measure.actualBoundingBoxAscent && computedBBox[3] >= y2 + measure.actualBoundingBoxDescent;
37191
+ __privateGet(this, _fontBBoxTrustworthy).set(font, isBBoxTrustworthy);
37192
+ if (isBBoxTrustworthy) {
37193
+ return this.recordBBox(idx, ctx, computedBBox[0], computedBBox[2], computedBBox[1], computedBBox[3]);
37194
+ }
37195
+ }
37196
+ return this.recordBBox(idx, ctx, x2 - measure.actualBoundingBoxLeft, x2 + measure.actualBoundingBoxRight, y2 - measure.actualBoundingBoxAscent, y2 + measure.actualBoundingBoxDescent);
37197
+ }
37198
+ recordFullPageBBox(idx) {
37199
+ __privateGet(this, _pendingBBox)[0] = Math.max(0, __privateGet(this, _clipBox)[0]);
37200
+ __privateGet(this, _pendingBBox)[1] = Math.max(0, __privateGet(this, _clipBox)[1]);
37201
+ __privateGet(this, _pendingBBox)[2] = Math.min(__privateGet(this, _canvasWidth), __privateGet(this, _clipBox)[2]);
37202
+ __privateGet(this, _pendingBBox)[3] = Math.min(__privateGet(this, _canvasHeight), __privateGet(this, _clipBox)[3]);
37203
+ return this;
37204
+ }
37205
+ getSimpleIndex(dependencyName) {
37206
+ return __privateGet(this, _simple)[dependencyName];
37207
+ }
37208
+ recordDependencies(idx, dependencyNames) {
37209
+ const pendingDependencies = __privateGet(this, _pendingDependencies);
37210
+ const simple = __privateGet(this, _simple);
37211
+ const incremental = __privateGet(this, _incremental);
37212
+ for (const name of dependencyNames) {
37213
+ if (name in __privateGet(this, _simple)) {
37214
+ pendingDependencies.add(simple[name]);
37215
+ } else if (name in incremental) {
37216
+ incremental[name].forEach(pendingDependencies.add, pendingDependencies);
37217
+ }
37218
+ }
37219
+ return this;
37220
+ }
37221
+ copyDependenciesFromIncrementalOperation(idx, name) {
37222
+ const operations = __privateGet(this, _operations);
37223
+ const pendingDependencies = __privateGet(this, _pendingDependencies);
37224
+ for (const depIdx of __privateGet(this, _incremental)[name]) {
37225
+ operations.get(depIdx).dependencies.forEach(pendingDependencies.add, pendingDependencies.add(depIdx));
37226
+ }
37227
+ return this;
37228
+ }
37229
+ recordNamedDependency(idx, name) {
37230
+ if (__privateGet(this, _namedDependencies).has(name)) {
37231
+ __privateGet(this, _pendingDependencies).add(__privateGet(this, _namedDependencies).get(name));
37232
+ }
37233
+ return this;
37234
+ }
37235
+ recordOperation(idx, preserveBbox = false) {
37236
+ this.recordDependencies(idx, [FORCED_DEPENDENCY_LABEL]);
37237
+ const dependencies = new Set(__privateGet(this, _pendingDependencies));
37238
+ const pairs = __privateGet(this, _savesStack).concat(__privateGet(this, _markedContentStack));
37239
+ const bbox = __privateGet(this, _pendingBBoxIdx) === idx ? {
37240
+ minX: __privateGet(this, _pendingBBox)[0],
37241
+ minY: __privateGet(this, _pendingBBox)[1],
37242
+ maxX: __privateGet(this, _pendingBBox)[2],
37243
+ maxY: __privateGet(this, _pendingBBox)[3]
37244
+ } : null;
37245
+ __privateGet(this, _operations).set(idx, {
37246
+ bbox,
37247
+ pairs,
37248
+ dependencies
37249
+ });
37250
+ if (!preserveBbox) {
37251
+ __privateSet(this, _pendingBBoxIdx, -1);
37252
+ }
37253
+ __privateGet(this, _pendingDependencies).clear();
37254
+ return this;
37255
+ }
37256
+ bboxToClipBoxDropOperation(idx) {
37257
+ if (__privateGet(this, _pendingBBoxIdx) !== -1) {
37258
+ __privateSet(this, _pendingBBoxIdx, -1);
37259
+ __privateGet(this, _clipBox)[0] = Math.max(__privateGet(this, _clipBox)[0], __privateGet(this, _pendingBBox)[0]);
37260
+ __privateGet(this, _clipBox)[1] = Math.max(__privateGet(this, _clipBox)[1], __privateGet(this, _pendingBBox)[1]);
37261
+ __privateGet(this, _clipBox)[2] = Math.min(__privateGet(this, _clipBox)[2], __privateGet(this, _pendingBBox)[2]);
37262
+ __privateGet(this, _clipBox)[3] = Math.min(__privateGet(this, _clipBox)[3], __privateGet(this, _pendingBBox)[3]);
37263
+ }
37264
+ __privateGet(this, _pendingDependencies).clear();
37265
+ return this;
37266
+ }
37267
+ _takePendingDependencies() {
37268
+ const pendingDependencies = __privateGet(this, _pendingDependencies);
37269
+ __privateSet(this, _pendingDependencies, /* @__PURE__ */ new Set());
37270
+ return pendingDependencies;
37271
+ }
37272
+ _extractOperation(idx) {
37273
+ const operation = __privateGet(this, _operations).get(idx);
37274
+ __privateGet(this, _operations).delete(idx);
37275
+ return operation;
37276
+ }
37277
+ _pushPendingDependencies(dependencies) {
37278
+ for (const dep of dependencies) {
37279
+ __privateGet(this, _pendingDependencies).add(dep);
37280
+ }
37281
+ }
37282
+ take() {
37283
+ __privateGet(this, _fontBBoxTrustworthy).clear();
37284
+ return Array.from(__privateGet(this, _operations), ([idx, {
37285
+ bbox,
37286
+ pairs,
37287
+ dependencies
37288
+ }]) => {
37289
+ var _a2, _b2, _c, _d;
37290
+ pairs.forEach((pair) => pair.forEach(dependencies.add, dependencies));
37291
+ dependencies.delete(idx);
37292
+ return {
37293
+ minX: ((_a2 = bbox == null ? void 0 : bbox.minX) != null ? _a2 : 0) / __privateGet(this, _canvasWidth),
37294
+ maxX: ((_b2 = bbox == null ? void 0 : bbox.maxX) != null ? _b2 : __privateGet(this, _canvasWidth)) / __privateGet(this, _canvasWidth),
37295
+ minY: ((_c = bbox == null ? void 0 : bbox.minY) != null ? _c : 0) / __privateGet(this, _canvasHeight),
37296
+ maxY: ((_d = bbox == null ? void 0 : bbox.maxY) != null ? _d : __privateGet(this, _canvasHeight)) / __privateGet(this, _canvasHeight),
37297
+ dependencies: Array.from(dependencies).sort((a2, b2) => a2 - b2),
37298
+ idx
37299
+ };
37300
+ });
37301
+ }
37302
+ }
37303
+ _simple = new WeakMap();
37304
+ _incremental = new WeakMap();
37305
+ _namedDependencies = new WeakMap();
37306
+ _savesStack = new WeakMap();
37307
+ _markedContentStack = new WeakMap();
37308
+ _baseTransformStack = new WeakMap();
37309
+ _clipBox = new WeakMap();
37310
+ _pendingBBox = new WeakMap();
37311
+ _pendingBBoxIdx = new WeakMap();
37312
+ _pendingDependencies = new WeakMap();
37313
+ _operations = new WeakMap();
37314
+ _fontBBoxTrustworthy = new WeakMap();
37315
+ _canvasWidth = new WeakMap();
37316
+ _canvasHeight = new WeakMap();
37317
+ const _CanvasNestedDependencyTracker = class _CanvasNestedDependencyTracker {
37318
+ constructor(dependencyTracker, opIdx) {
37319
+ __privateAdd(this, _dependencyTracker);
37320
+ __privateAdd(this, _opIdx);
37321
+ __privateAdd(this, _nestingLevel, 0);
37322
+ __privateAdd(this, _outerDependencies);
37323
+ __privateAdd(this, _savesLevel, 0);
37324
+ if (dependencyTracker instanceof _CanvasNestedDependencyTracker) {
37325
+ return dependencyTracker;
37326
+ }
37327
+ __privateSet(this, _dependencyTracker, dependencyTracker);
37328
+ __privateSet(this, _outerDependencies, dependencyTracker._takePendingDependencies());
37329
+ __privateSet(this, _opIdx, opIdx);
37330
+ }
37331
+ save(opIdx) {
37332
+ __privateWrapper(this, _savesLevel)._++;
37333
+ __privateGet(this, _dependencyTracker).save(__privateGet(this, _opIdx));
37334
+ return this;
37335
+ }
37336
+ restore(opIdx) {
37337
+ if (__privateGet(this, _savesLevel) > 0) {
37338
+ __privateGet(this, _dependencyTracker).restore(__privateGet(this, _opIdx));
37339
+ __privateWrapper(this, _savesLevel)._--;
37340
+ }
37341
+ return this;
37342
+ }
37343
+ recordOpenMarker(idx) {
37344
+ __privateWrapper(this, _nestingLevel)._++;
37345
+ return this;
37346
+ }
37347
+ getOpenMarker() {
37348
+ return __privateGet(this, _nestingLevel) > 0 ? __privateGet(this, _opIdx) : __privateGet(this, _dependencyTracker).getOpenMarker();
37349
+ }
37350
+ recordCloseMarker(idx) {
37351
+ __privateWrapper(this, _nestingLevel)._--;
37352
+ return this;
37353
+ }
37354
+ beginMarkedContent(opIdx) {
37355
+ return this;
37356
+ }
37357
+ endMarkedContent(opIdx) {
37358
+ return this;
37359
+ }
37360
+ pushBaseTransform(ctx) {
37361
+ __privateGet(this, _dependencyTracker).pushBaseTransform(ctx);
37362
+ return this;
37363
+ }
37364
+ popBaseTransform() {
37365
+ __privateGet(this, _dependencyTracker).popBaseTransform();
37366
+ return this;
37367
+ }
37368
+ recordSimpleData(name, idx) {
37369
+ __privateGet(this, _dependencyTracker).recordSimpleData(name, __privateGet(this, _opIdx));
37370
+ return this;
37371
+ }
37372
+ recordIncrementalData(name, idx) {
37373
+ __privateGet(this, _dependencyTracker).recordIncrementalData(name, __privateGet(this, _opIdx));
37374
+ return this;
37375
+ }
37376
+ resetIncrementalData(name, idx) {
37377
+ __privateGet(this, _dependencyTracker).resetIncrementalData(name, __privateGet(this, _opIdx));
37378
+ return this;
37379
+ }
37380
+ recordNamedData(name, idx) {
37381
+ return this;
37382
+ }
37383
+ recordFutureForcedDependency(name, idx) {
37384
+ __privateGet(this, _dependencyTracker).recordFutureForcedDependency(name, __privateGet(this, _opIdx));
37385
+ return this;
37386
+ }
37387
+ inheritSimpleDataAsFutureForcedDependencies(names) {
37388
+ __privateGet(this, _dependencyTracker).inheritSimpleDataAsFutureForcedDependencies(names);
37389
+ return this;
37390
+ }
37391
+ inheritPendingDependenciesAsFutureForcedDependencies() {
37392
+ __privateGet(this, _dependencyTracker).inheritPendingDependenciesAsFutureForcedDependencies();
37393
+ return this;
37394
+ }
37395
+ resetBBox(idx) {
37396
+ if (!__privateGet(this, _dependencyTracker).hasPendingBBox) {
37397
+ __privateGet(this, _dependencyTracker).resetBBox(__privateGet(this, _opIdx));
37398
+ }
37399
+ return this;
37400
+ }
37401
+ get hasPendingBBox() {
37402
+ return __privateGet(this, _dependencyTracker).hasPendingBBox;
37403
+ }
37404
+ recordClipBox(idx, ctx, minX, maxX, minY, maxY) {
37405
+ __privateGet(this, _dependencyTracker).recordClipBox(__privateGet(this, _opIdx), ctx, minX, maxX, minY, maxY);
37406
+ return this;
37407
+ }
37408
+ recordBBox(idx, ctx, minX, maxX, minY, maxY) {
37409
+ __privateGet(this, _dependencyTracker).recordBBox(__privateGet(this, _opIdx), ctx, minX, maxX, minY, maxY);
37410
+ return this;
37411
+ }
37412
+ recordCharacterBBox(idx, ctx, font, scale, x2, y2, getMeasure) {
37413
+ __privateGet(this, _dependencyTracker).recordCharacterBBox(__privateGet(this, _opIdx), ctx, font, scale, x2, y2, getMeasure);
37414
+ return this;
37415
+ }
37416
+ recordFullPageBBox(idx) {
37417
+ __privateGet(this, _dependencyTracker).recordFullPageBBox(__privateGet(this, _opIdx));
37418
+ return this;
37419
+ }
37420
+ getSimpleIndex(dependencyName) {
37421
+ return __privateGet(this, _dependencyTracker).getSimpleIndex(dependencyName);
37422
+ }
37423
+ recordDependencies(idx, dependencyNames) {
37424
+ __privateGet(this, _dependencyTracker).recordDependencies(__privateGet(this, _opIdx), dependencyNames);
37425
+ return this;
37426
+ }
37427
+ copyDependenciesFromIncrementalOperation(idx, name) {
37428
+ __privateGet(this, _dependencyTracker).copyDependenciesFromIncrementalOperation(__privateGet(this, _opIdx), name);
37429
+ return this;
37430
+ }
37431
+ recordNamedDependency(idx, name) {
37432
+ __privateGet(this, _dependencyTracker).recordNamedDependency(__privateGet(this, _opIdx), name);
37433
+ return this;
37434
+ }
37435
+ recordOperation(idx) {
37436
+ __privateGet(this, _dependencyTracker).recordOperation(__privateGet(this, _opIdx), true);
37437
+ const operation = __privateGet(this, _dependencyTracker)._extractOperation(__privateGet(this, _opIdx));
37438
+ for (const depIdx of operation.dependencies) {
37439
+ __privateGet(this, _outerDependencies).add(depIdx);
37440
+ }
37441
+ __privateGet(this, _outerDependencies).delete(__privateGet(this, _opIdx));
37442
+ __privateGet(this, _outerDependencies).delete(null);
37443
+ return this;
37444
+ }
37445
+ bboxToClipBoxDropOperation(idx) {
37446
+ __privateGet(this, _dependencyTracker).bboxToClipBoxDropOperation(__privateGet(this, _opIdx));
37447
+ return this;
37448
+ }
37449
+ recordNestedDependencies() {
37450
+ __privateGet(this, _dependencyTracker)._pushPendingDependencies(__privateGet(this, _outerDependencies));
37451
+ }
37452
+ take() {
37453
+ throw new Error("Unreachable");
37454
+ }
37455
+ };
37456
+ _dependencyTracker = new WeakMap();
37457
+ _opIdx = new WeakMap();
37458
+ _nestingLevel = new WeakMap();
37459
+ _outerDependencies = new WeakMap();
37460
+ _savesLevel = new WeakMap();
37461
+ let CanvasNestedDependencyTracker = _CanvasNestedDependencyTracker;
37462
+ const Dependencies = {
37463
+ stroke: ["path", "transform", "filter", "strokeColor", "strokeAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "dash"],
37464
+ fill: ["path", "transform", "filter", "fillColor", "fillAlpha", "globalCompositeOperation", "SMask"],
37465
+ imageXObject: ["transform", "SMask", "filter", "fillAlpha", "strokeAlpha", "globalCompositeOperation"],
37466
+ rawFillPath: ["filter", "fillColor", "fillAlpha"],
37467
+ showText: ["transform", "leading", "charSpacing", "wordSpacing", "hScale", "textRise", "moveText", "textMatrix", "font", "filter", "fillColor", "textRenderingMode", "SMask", "fillAlpha", "strokeAlpha", "globalCompositeOperation"],
37468
+ transform: ["transform"],
37469
+ transformAndFill: ["transform", "fillColor"]
37470
+ };
37322
37471
  const PathType = {
37323
37472
  FILL: "Fill",
37324
37473
  STROKE: "Stroke",
@@ -37637,6 +37786,7 @@ const _TilingPattern = class _TilingPattern {
37637
37786
  this.baseTransform = baseTransform;
37638
37787
  }
37639
37788
  createPatternCanvas(owner) {
37789
+ var _a2, _b2, _c, _d;
37640
37790
  const {
37641
37791
  bbox,
37642
37792
  operatorList,
@@ -37684,12 +37834,14 @@ const _TilingPattern = class _TilingPattern {
37684
37834
  graphics.groupLevel = owner.groupLevel;
37685
37835
  this.setFillAndStrokeStyleToContext(graphics, paintType, color2);
37686
37836
  tmpCtx.translate(-dimx.scale * x0, -dimy.scale * y0);
37687
- graphics.transform(dimx.scale, 0, 0, dimy.scale, 0, 0);
37837
+ graphics.transform(0, dimx.scale, 0, 0, dimy.scale, 0, 0);
37688
37838
  tmpCtx.save();
37839
+ (_a2 = graphics.dependencyTracker) == null ? void 0 : _a2.save();
37689
37840
  this.clipBbox(graphics, x0, y0, x1, y1);
37690
37841
  graphics.baseTransform = getCurrentTransform(graphics.ctx);
37691
37842
  graphics.executeOperatorList(operatorList);
37692
37843
  graphics.endDrawing();
37844
+ (_d = (_b2 = graphics.dependencyTracker) == null ? void 0 : (_c = _b2.restore()).recordNestedDependencies) == null ? void 0 : _d.call(_c);
37693
37845
  tmpCtx.restore();
37694
37846
  if (redrawHorizontally || redrawVertically) {
37695
37847
  const image2 = tmpCanvas.canvas;
@@ -38000,7 +38152,7 @@ function drawImageAtIntegerCoords(ctx, srcImg, srcX, srcY, srcW, srcH, destX, de
38000
38152
  return [scaleX * destW, scaleY * destH];
38001
38153
  }
38002
38154
  class CanvasExtraState {
38003
- constructor(width, height) {
38155
+ constructor(width, height, preInit) {
38004
38156
  __publicField(this, "alphaIsShape", false);
38005
38157
  __publicField(this, "fontSize", 0);
38006
38158
  __publicField(this, "fontSizeScale", 1);
@@ -38026,6 +38178,7 @@ class CanvasExtraState {
38026
38178
  __publicField(this, "lineWidth", 1);
38027
38179
  __publicField(this, "activeSMask", null);
38028
38180
  __publicField(this, "transferMaps", "none");
38181
+ preInit == null ? void 0 : preInit(this);
38029
38182
  this.clipBox = new Float32Array([0, 0, width, height]);
38030
38183
  this.minMax = MIN_MAX_INIT.slice();
38031
38184
  }
@@ -38234,7 +38387,7 @@ const _CanvasGraphics = class _CanvasGraphics {
38234
38387
  constructor(canvasCtx, commonObjs, objs, canvasFactory, filterFactory, {
38235
38388
  optionalContentConfig,
38236
38389
  markedContentStack = null
38237
- }, annotationCanvasMap, pageColors) {
38390
+ }, annotationCanvasMap, pageColors, dependencyTracker) {
38238
38391
  __privateAdd(this, _CanvasGraphics_instances);
38239
38392
  this.ctx = canvasCtx;
38240
38393
  this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);
@@ -38268,9 +38421,12 @@ const _CanvasGraphics = class _CanvasGraphics {
38268
38421
  this._cachedScaleForStroking = [-1, 0];
38269
38422
  this._cachedGetSinglePixelWidth = null;
38270
38423
  this._cachedBitmapsMap = /* @__PURE__ */ new Map();
38424
+ this.dependencyTracker = dependencyTracker != null ? dependencyTracker : null;
38271
38425
  }
38272
- getObject(data, fallback = null) {
38426
+ getObject(opIdx, data, fallback = null) {
38427
+ var _a2;
38273
38428
  if (typeof data === "string") {
38429
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordNamedDependency(opIdx, data);
38274
38430
  return data.startsWith("g_") ? this.commonObjs.get(data) : this.objs.get(data);
38275
38431
  }
38276
38432
  return fallback;
@@ -38306,7 +38462,8 @@ const _CanvasGraphics = class _CanvasGraphics {
38306
38462
  this.viewportScale = viewport.scale;
38307
38463
  this.baseTransform = getCurrentTransform(this.ctx);
38308
38464
  }
38309
- executeOperatorList(operatorList, executionStartIdx, continueCallback, stepper) {
38465
+ executeOperatorList(operatorList, executionStartIdx, continueCallback, stepper, filteredOperationIndexes) {
38466
+ var _a2, _b2;
38310
38467
  const argsArray = operatorList.argsArray;
38311
38468
  const fnArray = operatorList.fnArray;
38312
38469
  let i = executionStartIdx || 0;
@@ -38319,21 +38476,29 @@ const _CanvasGraphics = class _CanvasGraphics {
38319
38476
  let steps = 0;
38320
38477
  const commonObjs = this.commonObjs;
38321
38478
  const objs = this.objs;
38322
- let fnId;
38479
+ let fnId, fnArgs;
38323
38480
  while (true) {
38324
38481
  if (stepper !== void 0 && i === stepper.nextBreakPoint) {
38325
38482
  stepper.breakIt(i, continueCallback);
38326
38483
  return i;
38327
38484
  }
38328
- fnId = fnArray[i];
38329
- if (fnId !== OPS.dependency) {
38330
- this[fnId].apply(this, argsArray[i]);
38331
- } else {
38332
- for (const depObjId of argsArray[i]) {
38333
- const objsPool = depObjId.startsWith("g_") ? commonObjs : objs;
38334
- if (!objsPool.has(depObjId)) {
38335
- objsPool.get(depObjId, continueCallback);
38336
- return i;
38485
+ if (!filteredOperationIndexes || filteredOperationIndexes.has(i)) {
38486
+ fnId = fnArray[i];
38487
+ fnArgs = (_a2 = argsArray[i]) != null ? _a2 : null;
38488
+ if (fnId !== OPS.dependency) {
38489
+ if (fnArgs === null) {
38490
+ this[fnId](i);
38491
+ } else {
38492
+ this[fnId](i, ...fnArgs);
38493
+ }
38494
+ } else {
38495
+ for (const depObjId of fnArgs) {
38496
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordNamedData(depObjId, i);
38497
+ const objsPool = depObjId.startsWith("g_") ? commonObjs : objs;
38498
+ if (!objsPool.has(depObjId)) {
38499
+ objsPool.get(depObjId, continueCallback);
38500
+ return i;
38501
+ }
38337
38502
  }
38338
38503
  }
38339
38504
  }
@@ -38399,7 +38564,8 @@ const _CanvasGraphics = class _CanvasGraphics {
38399
38564
  paintHeight
38400
38565
  };
38401
38566
  }
38402
- _createMaskCanvas(img) {
38567
+ _createMaskCanvas(opIdx, img) {
38568
+ var _a2, _b2;
38403
38569
  const ctx = this.ctx;
38404
38570
  const {
38405
38571
  width,
@@ -38421,6 +38587,7 @@ const _CanvasGraphics = class _CanvasGraphics {
38421
38587
  if (cachedImage && !isPatternFill) {
38422
38588
  const offsetX2 = Math.round(Math.min(currentTransform[0], currentTransform[2]) + currentTransform[4]);
38423
38589
  const offsetY2 = Math.round(Math.min(currentTransform[1], currentTransform[3]) + currentTransform[5]);
38590
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordDependencies(opIdx, Dependencies.transformAndFill);
38424
38591
  return {
38425
38592
  canvas: cachedImage,
38426
38593
  offsetX: offsetX2,
@@ -38463,81 +38630,98 @@ const _CanvasGraphics = class _CanvasGraphics {
38463
38630
  this.cachedCanvases.delete("fillCanvas");
38464
38631
  cache.set(cacheKey, fillCanvas.canvas);
38465
38632
  }
38633
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordDependencies(opIdx, Dependencies.transformAndFill);
38466
38634
  return {
38467
38635
  canvas: fillCanvas.canvas,
38468
38636
  offsetX: Math.round(offsetX),
38469
38637
  offsetY: Math.round(offsetY)
38470
38638
  };
38471
38639
  }
38472
- setLineWidth(width) {
38640
+ setLineWidth(opIdx, width) {
38641
+ var _a2;
38642
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("lineWidth", opIdx);
38473
38643
  if (width !== this.current.lineWidth) {
38474
38644
  this._cachedScaleForStroking[0] = -1;
38475
38645
  }
38476
38646
  this.current.lineWidth = width;
38477
38647
  this.ctx.lineWidth = width;
38478
38648
  }
38479
- setLineCap(style) {
38649
+ setLineCap(opIdx, style) {
38650
+ var _a2;
38651
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("lineCap", opIdx);
38480
38652
  this.ctx.lineCap = LINE_CAP_STYLES[style];
38481
38653
  }
38482
- setLineJoin(style) {
38654
+ setLineJoin(opIdx, style) {
38655
+ var _a2;
38656
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("lineJoin", opIdx);
38483
38657
  this.ctx.lineJoin = LINE_JOIN_STYLES[style];
38484
38658
  }
38485
- setMiterLimit(limit) {
38659
+ setMiterLimit(opIdx, limit) {
38660
+ var _a2;
38661
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("miterLimit", opIdx);
38486
38662
  this.ctx.miterLimit = limit;
38487
38663
  }
38488
- setDash(dashArray, dashPhase) {
38664
+ setDash(opIdx, dashArray, dashPhase) {
38665
+ var _a2;
38666
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("dash", opIdx);
38489
38667
  const ctx = this.ctx;
38490
38668
  if (ctx.setLineDash !== void 0) {
38491
38669
  ctx.setLineDash(dashArray);
38492
38670
  ctx.lineDashOffset = dashPhase;
38493
38671
  }
38494
38672
  }
38495
- setRenderingIntent(intent) {
38673
+ setRenderingIntent(opIdx, intent) {
38496
38674
  }
38497
- setFlatness(flatness) {
38675
+ setFlatness(opIdx, flatness) {
38498
38676
  }
38499
- setGState(states) {
38677
+ setGState(opIdx, states) {
38678
+ var _a2, _b2, _c, _d, _e;
38500
38679
  for (const [key, value] of states) {
38501
38680
  switch (key) {
38502
38681
  case "LW":
38503
- this.setLineWidth(value);
38682
+ this.setLineWidth(opIdx, value);
38504
38683
  break;
38505
38684
  case "LC":
38506
- this.setLineCap(value);
38685
+ this.setLineCap(opIdx, value);
38507
38686
  break;
38508
38687
  case "LJ":
38509
- this.setLineJoin(value);
38688
+ this.setLineJoin(opIdx, value);
38510
38689
  break;
38511
38690
  case "ML":
38512
- this.setMiterLimit(value);
38691
+ this.setMiterLimit(opIdx, value);
38513
38692
  break;
38514
38693
  case "D":
38515
- this.setDash(value[0], value[1]);
38694
+ this.setDash(opIdx, value[0], value[1]);
38516
38695
  break;
38517
38696
  case "RI":
38518
- this.setRenderingIntent(value);
38697
+ this.setRenderingIntent(opIdx, value);
38519
38698
  break;
38520
38699
  case "FL":
38521
- this.setFlatness(value);
38700
+ this.setFlatness(opIdx, value);
38522
38701
  break;
38523
38702
  case "Font":
38524
- this.setFont(value[0], value[1]);
38703
+ this.setFont(opIdx, value[0], value[1]);
38525
38704
  break;
38526
38705
  case "CA":
38706
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("strokeAlpha", opIdx);
38527
38707
  this.current.strokeAlpha = value;
38528
38708
  break;
38529
38709
  case "ca":
38710
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordSimpleData("fillAlpha", opIdx);
38530
38711
  this.ctx.globalAlpha = this.current.fillAlpha = value;
38531
38712
  break;
38532
38713
  case "BM":
38714
+ (_c = this.dependencyTracker) == null ? void 0 : _c.recordSimpleData("globalCompositeOperation", opIdx);
38533
38715
  this.ctx.globalCompositeOperation = value;
38534
38716
  break;
38535
38717
  case "SMask":
38718
+ (_d = this.dependencyTracker) == null ? void 0 : _d.recordSimpleData("SMask", opIdx);
38536
38719
  this.current.activeSMask = value ? this.tempSMask : null;
38537
38720
  this.tempSMask = null;
38538
38721
  this.checkSMaskState();
38539
38722
  break;
38540
38723
  case "TR":
38724
+ (_e = this.dependencyTracker) == null ? void 0 : _e.recordSimpleData("filter", opIdx);
38541
38725
  this.ctx.filter = this.current.transferMaps = this.filterFactory.addFilter(value);
38542
38726
  break;
38543
38727
  }
@@ -38554,7 +38738,7 @@ const _CanvasGraphics = class _CanvasGraphics {
38554
38738
  this.endSMaskMode();
38555
38739
  }
38556
38740
  }
38557
- beginSMaskMode() {
38741
+ beginSMaskMode(opIdx) {
38558
38742
  if (this.inSMaskMode) {
38559
38743
  throw new Error("beginSMaskMode called while already in smask mode");
38560
38744
  }
@@ -38567,7 +38751,7 @@ const _CanvasGraphics = class _CanvasGraphics {
38567
38751
  ctx.setTransform(this.suspendedCtx.getTransform());
38568
38752
  copyCtxState(this.suspendedCtx, ctx);
38569
38753
  mirrorContextOperations(ctx, this.suspendedCtx);
38570
- this.setGState([["BM", "source-over"]]);
38754
+ this.setGState(opIdx, [["BM", "source-over"]]);
38571
38755
  }
38572
38756
  endSMaskMode() {
38573
38757
  if (!this.inSMaskMode) {
@@ -38657,7 +38841,8 @@ const _CanvasGraphics = class _CanvasGraphics {
38657
38841
  layerCtx.drawImage(maskCanvas, maskX, maskY, width, height, layerOffsetX, layerOffsetY, width, height);
38658
38842
  layerCtx.restore();
38659
38843
  }
38660
- save() {
38844
+ save(opIdx) {
38845
+ var _a2;
38661
38846
  if (this.inSMaskMode) {
38662
38847
  copyCtxState(this.ctx, this.suspendedCtx);
38663
38848
  }
@@ -38665,8 +38850,11 @@ const _CanvasGraphics = class _CanvasGraphics {
38665
38850
  const old = this.current;
38666
38851
  this.stateStack.push(old);
38667
38852
  this.current = old.clone();
38853
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.save(opIdx);
38668
38854
  }
38669
- restore() {
38855
+ restore(opIdx) {
38856
+ var _a2;
38857
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.restore(opIdx);
38670
38858
  if (this.stateStack.length === 0) {
38671
38859
  if (this.inSMaskMode) {
38672
38860
  this.endSMaskMode();
@@ -38683,18 +38871,24 @@ const _CanvasGraphics = class _CanvasGraphics {
38683
38871
  this._cachedScaleForStroking[0] = -1;
38684
38872
  this._cachedGetSinglePixelWidth = null;
38685
38873
  }
38686
- transform(a2, b2, c2, d2, e2, f2) {
38874
+ transform(opIdx, a2, b2, c2, d2, e2, f2) {
38875
+ var _a2;
38876
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordIncrementalData("transform", opIdx);
38687
38877
  this.ctx.transform(a2, b2, c2, d2, e2, f2);
38688
38878
  this._cachedScaleForStroking[0] = -1;
38689
38879
  this._cachedGetSinglePixelWidth = null;
38690
38880
  }
38691
- constructPath(op, data, minMax) {
38881
+ constructPath(opIdx, op, data, minMax) {
38692
38882
  let [path] = data;
38693
38883
  if (!minMax) {
38694
38884
  path || (path = data[0] = new Path2D());
38695
- this[op](path);
38885
+ this[op](opIdx, path);
38696
38886
  return;
38697
38887
  }
38888
+ if (this.dependencyTracker !== null) {
38889
+ const outerExtraSize = op === OPS.stroke ? this.current.lineWidth / 2 : 0;
38890
+ this.dependencyTracker.resetBBox(opIdx).recordBBox(opIdx, this.ctx, minMax[0] - outerExtraSize, minMax[2] + outerExtraSize, minMax[1] - outerExtraSize, minMax[3] + outerExtraSize).recordDependencies(opIdx, ["transform"]);
38891
+ }
38698
38892
  if (!(path instanceof Path2D)) {
38699
38893
  const path2d = data[0] = new Path2D();
38700
38894
  for (let i = 0, ii = path.length; i < ii; ) {
@@ -38719,12 +38913,14 @@ const _CanvasGraphics = class _CanvasGraphics {
38719
38913
  path = path2d;
38720
38914
  }
38721
38915
  Util.axialAlignedBoundingBox(minMax, getCurrentTransform(this.ctx), this.current.minMax);
38722
- this[op](path);
38916
+ this[op](opIdx, path);
38917
+ this._pathStartIdx = opIdx;
38723
38918
  }
38724
- closePath() {
38919
+ closePath(opIdx) {
38725
38920
  this.ctx.closePath();
38726
38921
  }
38727
- stroke(path, consumePath = true) {
38922
+ stroke(opIdx, path, consumePath = true) {
38923
+ var _a2;
38728
38924
  const ctx = this.ctx;
38729
38925
  const strokeColor = this.current.strokeColor;
38730
38926
  ctx.globalAlpha = this.current.strokeAlpha;
@@ -38744,21 +38940,24 @@ const _CanvasGraphics = class _CanvasGraphics {
38744
38940
  this.rescaleAndStroke(path, true);
38745
38941
  }
38746
38942
  }
38943
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordDependencies(opIdx, Dependencies.stroke);
38747
38944
  if (consumePath) {
38748
- this.consumePath(path, this.current.getClippedPathBoundingBox(PathType.STROKE, getCurrentTransform(this.ctx)));
38945
+ this.consumePath(opIdx, path, this.current.getClippedPathBoundingBox(PathType.STROKE, getCurrentTransform(this.ctx)));
38749
38946
  }
38750
38947
  ctx.globalAlpha = this.current.fillAlpha;
38751
38948
  }
38752
- closeStroke(path) {
38753
- this.stroke(path);
38949
+ closeStroke(opIdx, path) {
38950
+ this.stroke(opIdx, path);
38754
38951
  }
38755
- fill(path, consumePath = true) {
38952
+ fill(opIdx, path, consumePath = true) {
38953
+ var _a2, _b2, _c;
38756
38954
  const ctx = this.ctx;
38757
38955
  const fillColor = this.current.fillColor;
38758
38956
  const isPatternFill = this.current.patternFill;
38759
38957
  let needRestore = false;
38760
38958
  if (isPatternFill) {
38761
38959
  const baseTransform = fillColor.isModifyingCurrentTransform() ? ctx.getTransform() : null;
38960
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.save(opIdx);
38762
38961
  ctx.save();
38763
38962
  ctx.fillStyle = fillColor.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.FILL);
38764
38963
  if (baseTransform) {
@@ -38777,88 +38976,115 @@ const _CanvasGraphics = class _CanvasGraphics {
38777
38976
  ctx.fill(path);
38778
38977
  }
38779
38978
  }
38979
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordDependencies(opIdx, Dependencies.fill);
38780
38980
  if (needRestore) {
38781
38981
  ctx.restore();
38982
+ (_c = this.dependencyTracker) == null ? void 0 : _c.restore(opIdx);
38782
38983
  }
38783
38984
  if (consumePath) {
38784
- this.consumePath(path, intersect);
38985
+ this.consumePath(opIdx, path, intersect);
38785
38986
  }
38786
38987
  }
38787
- eoFill(path) {
38988
+ eoFill(opIdx, path) {
38788
38989
  this.pendingEOFill = true;
38789
- this.fill(path);
38990
+ this.fill(opIdx, path);
38790
38991
  }
38791
- fillStroke(path) {
38792
- this.fill(path, false);
38793
- this.stroke(path, false);
38794
- this.consumePath(path);
38992
+ fillStroke(opIdx, path) {
38993
+ this.fill(opIdx, path, false);
38994
+ this.stroke(opIdx, path, false);
38995
+ this.consumePath(opIdx, path);
38795
38996
  }
38796
- eoFillStroke(path) {
38997
+ eoFillStroke(opIdx, path) {
38797
38998
  this.pendingEOFill = true;
38798
- this.fillStroke(path);
38999
+ this.fillStroke(opIdx, path);
38799
39000
  }
38800
- closeFillStroke(path) {
38801
- this.fillStroke(path);
39001
+ closeFillStroke(opIdx, path) {
39002
+ this.fillStroke(opIdx, path);
38802
39003
  }
38803
- closeEOFillStroke(path) {
39004
+ closeEOFillStroke(opIdx, path) {
38804
39005
  this.pendingEOFill = true;
38805
- this.fillStroke(path);
39006
+ this.fillStroke(opIdx, path);
38806
39007
  }
38807
- endPath(path) {
38808
- this.consumePath(path);
39008
+ endPath(opIdx, path) {
39009
+ this.consumePath(opIdx, path);
38809
39010
  }
38810
- rawFillPath(path) {
39011
+ rawFillPath(opIdx, path) {
39012
+ var _a2;
38811
39013
  this.ctx.fill(path);
39014
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordDependencies(opIdx, Dependencies.rawFillPath).recordOperation(opIdx);
38812
39015
  }
38813
- clip() {
39016
+ clip(opIdx) {
39017
+ var _a2;
39018
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordFutureForcedDependency("clipMode", opIdx);
38814
39019
  this.pendingClip = NORMAL_CLIP;
38815
39020
  }
38816
- eoClip() {
39021
+ eoClip(opIdx) {
39022
+ var _a2;
39023
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordFutureForcedDependency("clipMode", opIdx);
38817
39024
  this.pendingClip = EO_CLIP;
38818
39025
  }
38819
- beginText() {
39026
+ beginText(opIdx) {
39027
+ var _a2;
38820
39028
  this.current.textMatrix = null;
38821
39029
  this.current.textMatrixScale = 1;
38822
39030
  this.current.x = this.current.lineX = 0;
38823
39031
  this.current.y = this.current.lineY = 0;
39032
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordOpenMarker(opIdx).resetIncrementalData("sameLineText").resetIncrementalData("moveText", opIdx);
38824
39033
  }
38825
- endText() {
39034
+ endText(opIdx) {
38826
39035
  const paths = this.pendingTextPaths;
38827
39036
  const ctx = this.ctx;
38828
- if (paths === void 0) {
38829
- return;
39037
+ if (this.dependencyTracker) {
39038
+ const {
39039
+ dependencyTracker
39040
+ } = this;
39041
+ if (paths !== void 0) {
39042
+ dependencyTracker.recordFutureForcedDependency("textClip", dependencyTracker.getOpenMarker()).recordFutureForcedDependency("textClip", opIdx);
39043
+ }
39044
+ dependencyTracker.recordCloseMarker(opIdx);
38830
39045
  }
38831
- const newPath = new Path2D();
38832
- const invTransf = ctx.getTransform().invertSelf();
38833
- for (const {
38834
- transform: transform2,
38835
- x: x2,
38836
- y: y2,
38837
- fontSize: fontSize2,
38838
- path
38839
- } of paths) {
38840
- if (!path) {
38841
- continue;
39046
+ if (paths !== void 0) {
39047
+ const newPath = new Path2D();
39048
+ const invTransf = ctx.getTransform().invertSelf();
39049
+ for (const {
39050
+ transform: transform2,
39051
+ x: x2,
39052
+ y: y2,
39053
+ fontSize: fontSize2,
39054
+ path
39055
+ } of paths) {
39056
+ if (!path) {
39057
+ continue;
39058
+ }
39059
+ newPath.addPath(path, new DOMMatrix(transform2).preMultiplySelf(invTransf).translate(x2, y2).scale(fontSize2, -fontSize2));
38842
39060
  }
38843
- newPath.addPath(path, new DOMMatrix(transform2).preMultiplySelf(invTransf).translate(x2, y2).scale(fontSize2, -fontSize2));
39061
+ ctx.clip(newPath);
38844
39062
  }
38845
- ctx.clip(newPath);
38846
39063
  delete this.pendingTextPaths;
38847
39064
  }
38848
- setCharSpacing(spacing) {
39065
+ setCharSpacing(opIdx, spacing) {
39066
+ var _a2;
39067
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("charSpacing", opIdx);
38849
39068
  this.current.charSpacing = spacing;
38850
39069
  }
38851
- setWordSpacing(spacing) {
39070
+ setWordSpacing(opIdx, spacing) {
39071
+ var _a2;
39072
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("wordSpacing", opIdx);
38852
39073
  this.current.wordSpacing = spacing;
38853
39074
  }
38854
- setHScale(scale) {
39075
+ setHScale(opIdx, scale) {
39076
+ var _a2;
39077
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("hScale", opIdx);
38855
39078
  this.current.textHScale = scale / 100;
38856
39079
  }
38857
- setLeading(leading) {
39080
+ setLeading(opIdx, leading) {
39081
+ var _a2;
39082
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("leading", opIdx);
38858
39083
  this.current.leading = -leading;
38859
39084
  }
38860
- setFont(fontRefName, size) {
38861
- var _a2;
39085
+ setFont(opIdx, fontRefName, size) {
39086
+ var _a2, _b2;
39087
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("font", opIdx).recordNamedDependency(opIdx, fontRefName);
38862
39088
  const fontObj = this.commonObjs.get(fontRefName);
38863
39089
  const current = this.current;
38864
39090
  if (!fontObj) {
@@ -38880,7 +39106,7 @@ const _CanvasGraphics = class _CanvasGraphics {
38880
39106
  return;
38881
39107
  }
38882
39108
  const name = fontObj.loadedName || "sans-serif";
38883
- const typeface = ((_a2 = fontObj.systemFontInfo) == null ? void 0 : _a2.css) || `"${name}", ${fontObj.fallbackName}`;
39109
+ const typeface = ((_b2 = fontObj.systemFontInfo) == null ? void 0 : _b2.css) || `"${name}", ${fontObj.fallbackName}`;
38884
39110
  let bold = "normal";
38885
39111
  if (fontObj.black) {
38886
39112
  bold = "900";
@@ -38897,21 +39123,29 @@ const _CanvasGraphics = class _CanvasGraphics {
38897
39123
  this.current.fontSizeScale = size / browserFontSize;
38898
39124
  this.ctx.font = `${italic} ${bold} ${browserFontSize}px ${typeface}`;
38899
39125
  }
38900
- setTextRenderingMode(mode) {
39126
+ setTextRenderingMode(opIdx, mode) {
39127
+ var _a2;
39128
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("textRenderingMode", opIdx);
38901
39129
  this.current.textRenderingMode = mode;
38902
39130
  }
38903
- setTextRise(rise) {
39131
+ setTextRise(opIdx, rise) {
39132
+ var _a2;
39133
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("textRise", opIdx);
38904
39134
  this.current.textRise = rise;
38905
39135
  }
38906
- moveText(x2, y2) {
39136
+ moveText(opIdx, x2, y2) {
39137
+ var _a2;
39138
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.resetIncrementalData("sameLineText").recordIncrementalData("moveText", opIdx);
38907
39139
  this.current.x = this.current.lineX += x2;
38908
39140
  this.current.y = this.current.lineY += y2;
38909
39141
  }
38910
- setLeadingMoveText(x2, y2) {
38911
- this.setLeading(-y2);
38912
- this.moveText(x2, y2);
39142
+ setLeadingMoveText(opIdx, x2, y2) {
39143
+ this.setLeading(opIdx, -y2);
39144
+ this.moveText(opIdx, x2, y2);
38913
39145
  }
38914
- setTextMatrix(matrix2) {
39146
+ setTextMatrix(opIdx, matrix2) {
39147
+ var _a2;
39148
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("textMatrix", opIdx);
38915
39149
  const {
38916
39150
  current
38917
39151
  } = this;
@@ -38920,10 +39154,13 @@ const _CanvasGraphics = class _CanvasGraphics {
38920
39154
  current.x = current.lineX = 0;
38921
39155
  current.y = current.lineY = 0;
38922
39156
  }
38923
- nextLine() {
38924
- this.moveText(0, this.current.leading);
39157
+ nextLine(opIdx) {
39158
+ var _a2, _b2;
39159
+ this.moveText(opIdx, 0, this.current.leading);
39160
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordIncrementalData("moveText", (_a2 = this.dependencyTracker.getSimpleIndex("leading")) != null ? _a2 : opIdx);
38925
39161
  }
38926
- paintChar(character, x2, y2, patternFillTransform, patternStrokeTransform) {
39162
+ paintChar(opIdx, character, x2, y2, patternFillTransform, patternStrokeTransform) {
39163
+ var _a2, _b2, _c, _d;
38927
39164
  const ctx = this.ctx;
38928
39165
  const current = this.current;
38929
39166
  const font = current.font;
@@ -38941,12 +39178,14 @@ const _CanvasGraphics = class _CanvasGraphics {
38941
39178
  ctx.save();
38942
39179
  ctx.translate(x2, y2);
38943
39180
  ctx.scale(fontSize2, -fontSize2);
39181
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordCharacterBBox(opIdx, ctx, font);
38944
39182
  let currentTransform;
38945
39183
  if (fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
38946
39184
  if (patternFillTransform) {
38947
39185
  currentTransform = ctx.getTransform();
38948
39186
  ctx.setTransform(...patternFillTransform);
38949
- ctx.fill(__privateMethod(this, _CanvasGraphics_instances, getScaledPath_fn).call(this, path, currentTransform, patternFillTransform));
39187
+ const scaledPath = __privateMethod(this, _CanvasGraphics_instances, getScaledPath_fn).call(this, path, currentTransform, patternFillTransform);
39188
+ ctx.fill(scaledPath);
38950
39189
  } else {
38951
39190
  ctx.fill(path);
38952
39191
  }
@@ -38975,8 +39214,12 @@ const _CanvasGraphics = class _CanvasGraphics {
38975
39214
  } else {
38976
39215
  if (fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
38977
39216
  ctx.fillText(character, x2, y2);
39217
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordCharacterBBox(opIdx, ctx, font, fontSize2, x2, y2, () => ctx.measureText(character));
38978
39218
  }
38979
39219
  if (fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
39220
+ if (this.dependencyTracker) {
39221
+ (_c = this.dependencyTracker) == null ? void 0 : _c.recordCharacterBBox(opIdx, ctx, font, fontSize2, x2, y2, () => ctx.measureText(character)).recordDependencies(opIdx, Dependencies.stroke);
39222
+ }
38980
39223
  ctx.strokeText(character, x2, y2);
38981
39224
  }
38982
39225
  }
@@ -38989,6 +39232,7 @@ const _CanvasGraphics = class _CanvasGraphics {
38989
39232
  fontSize: fontSize2,
38990
39233
  path
38991
39234
  });
39235
+ (_d = this.dependencyTracker) == null ? void 0 : _d.recordCharacterBBox(opIdx, ctx, font, fontSize2, x2, y2);
38992
39236
  }
38993
39237
  }
38994
39238
  get isFontSubpixelAAEnabled() {
@@ -39007,14 +39251,24 @@ const _CanvasGraphics = class _CanvasGraphics {
39007
39251
  }
39008
39252
  return shadow(this, "isFontSubpixelAAEnabled", enabled);
39009
39253
  }
39010
- showText(glyphs) {
39254
+ showText(opIdx, glyphs) {
39255
+ var _a2, _b2, _c, _d;
39256
+ if (this.dependencyTracker) {
39257
+ this.dependencyTracker.recordDependencies(opIdx, Dependencies.showText).copyDependenciesFromIncrementalOperation(opIdx, "sameLineText").resetBBox(opIdx);
39258
+ if (this.current.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG) {
39259
+ this.dependencyTracker.recordFutureForcedDependency("textClip", opIdx).inheritPendingDependenciesAsFutureForcedDependencies();
39260
+ }
39261
+ }
39011
39262
  const current = this.current;
39012
39263
  const font = current.font;
39013
39264
  if (font.isType3Font) {
39014
- return this.showType3Text(glyphs);
39265
+ this.showType3Text(opIdx, glyphs);
39266
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordOperation(opIdx).recordIncrementalData("sameLineText", opIdx);
39267
+ return void 0;
39015
39268
  }
39016
39269
  const fontSize2 = current.fontSize;
39017
39270
  if (fontSize2 === 0) {
39271
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordOperation(opIdx);
39018
39272
  return void 0;
39019
39273
  }
39020
39274
  const ctx = this.ctx;
@@ -39076,7 +39330,12 @@ const _CanvasGraphics = class _CanvasGraphics {
39076
39330
  chars2.push(glyph.unicode);
39077
39331
  width += glyph.width;
39078
39332
  }
39079
- ctx.fillText(chars2.join(""), 0, 0);
39333
+ const joinedChars = chars2.join("");
39334
+ ctx.fillText(joinedChars, 0, 0);
39335
+ if (this.dependencyTracker !== null) {
39336
+ const measure = ctx.measureText(joinedChars);
39337
+ this.dependencyTracker.recordBBox(opIdx, this.ctx, -measure.actualBoundingBoxLeft, measure.actualBoundingBoxRight, -measure.actualBoundingBoxAscent, measure.actualBoundingBoxDescent).recordOperation(opIdx).recordIncrementalData("sameLineText", opIdx);
39338
+ }
39080
39339
  current.x += width * widthAdvanceScale * textHScale;
39081
39340
  ctx.restore();
39082
39341
  this.compose();
@@ -39106,8 +39365,10 @@ const _CanvasGraphics = class _CanvasGraphics {
39106
39365
  scaledX = x2 / fontSizeScale;
39107
39366
  scaledY = 0;
39108
39367
  }
39368
+ let measure;
39109
39369
  if (font.remeasure && width > 0) {
39110
- const measuredWidth = ctx.measureText(character).width * 1e3 / fontSize2 * fontSizeScale;
39370
+ measure = ctx.measureText(character);
39371
+ const measuredWidth = measure.width * 1e3 / fontSize2 * fontSizeScale;
39111
39372
  if (width < measuredWidth && this.isFontSubpixelAAEnabled) {
39112
39373
  const characterScaleX = width / measuredWidth;
39113
39374
  restoreNeeded = true;
@@ -39121,12 +39382,15 @@ const _CanvasGraphics = class _CanvasGraphics {
39121
39382
  if (this.contentVisible && (glyph.isInFont || font.missingFile)) {
39122
39383
  if (simpleFillText && !accent) {
39123
39384
  ctx.fillText(character, scaledX, scaledY);
39385
+ (_c = this.dependencyTracker) == null ? void 0 : _c.recordCharacterBBox(opIdx, ctx, measure ? {
39386
+ bbox: null
39387
+ } : font, fontSize2 / fontSizeScale, scaledX, scaledY, () => measure != null ? measure : ctx.measureText(character));
39124
39388
  } else {
39125
- this.paintChar(character, scaledX, scaledY, patternFillTransform, patternStrokeTransform);
39389
+ this.paintChar(opIdx, character, scaledX, scaledY, patternFillTransform, patternStrokeTransform);
39126
39390
  if (accent) {
39127
39391
  const scaledAccentX = scaledX + fontSize2 * accent.offset.x / fontSizeScale;
39128
39392
  const scaledAccentY = scaledY - fontSize2 * accent.offset.y / fontSizeScale;
39129
- this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY, patternFillTransform, patternStrokeTransform);
39393
+ this.paintChar(opIdx, accent.fontChar, scaledAccentX, scaledAccentY, patternFillTransform, patternStrokeTransform);
39130
39394
  }
39131
39395
  }
39132
39396
  }
@@ -39143,9 +39407,10 @@ const _CanvasGraphics = class _CanvasGraphics {
39143
39407
  }
39144
39408
  ctx.restore();
39145
39409
  this.compose();
39410
+ (_d = this.dependencyTracker) == null ? void 0 : _d.recordOperation(opIdx).recordIncrementalData("sameLineText", opIdx);
39146
39411
  return void 0;
39147
39412
  }
39148
- showType3Text(glyphs) {
39413
+ showType3Text(opIdx, glyphs) {
39149
39414
  const ctx = this.ctx;
39150
39415
  const current = this.current;
39151
39416
  const font = current.font;
@@ -39170,6 +39435,8 @@ const _CanvasGraphics = class _CanvasGraphics {
39170
39435
  }
39171
39436
  ctx.translate(current.x, current.y + current.textRise);
39172
39437
  ctx.scale(textHScale, fontDirection);
39438
+ const dependencyTracker = this.dependencyTracker;
39439
+ this.dependencyTracker = dependencyTracker ? new CanvasNestedDependencyTracker(dependencyTracker, opIdx) : null;
39173
39440
  for (i = 0; i < glyphsLength; ++i) {
39174
39441
  glyph = glyphs[i];
39175
39442
  if (typeof glyph === "number") {
@@ -39196,16 +39463,22 @@ const _CanvasGraphics = class _CanvasGraphics {
39196
39463
  current.x += width * textHScale;
39197
39464
  }
39198
39465
  ctx.restore();
39466
+ if (dependencyTracker) {
39467
+ this.dependencyTracker.recordNestedDependencies();
39468
+ this.dependencyTracker = dependencyTracker;
39469
+ }
39199
39470
  }
39200
- setCharWidth(xWidth, yWidth) {
39471
+ setCharWidth(opIdx, xWidth, yWidth) {
39201
39472
  }
39202
- setCharWidthAndBounds(xWidth, yWidth, llx, lly, urx, ury) {
39473
+ setCharWidthAndBounds(opIdx, xWidth, yWidth, llx, lly, urx, ury) {
39474
+ var _a2;
39203
39475
  const clip = new Path2D();
39204
39476
  clip.rect(llx, lly, urx - llx, ury - lly);
39205
39477
  this.ctx.clip(clip);
39206
- this.endPath();
39478
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordBBox(opIdx, this.ctx, llx, urx, lly, ury).recordClipBox(opIdx, this.ctx, llx, urx, lly, ury);
39479
+ this.endPath(opIdx);
39207
39480
  }
39208
- getColorN_Pattern(IR) {
39481
+ getColorN_Pattern(opIdx, IR) {
39209
39482
  let pattern;
39210
39483
  if (IR[0] === "TilingPattern") {
39211
39484
  const baseTransform = this.baseTransform || getCurrentTransform(this.ctx);
@@ -39213,44 +39486,56 @@ const _CanvasGraphics = class _CanvasGraphics {
39213
39486
  createCanvasGraphics: (ctx) => new _CanvasGraphics(ctx, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, {
39214
39487
  optionalContentConfig: this.optionalContentConfig,
39215
39488
  markedContentStack: this.markedContentStack
39216
- })
39489
+ }, void 0, void 0, this.dependencyTracker ? new CanvasNestedDependencyTracker(this.dependencyTracker, opIdx) : null)
39217
39490
  };
39218
39491
  pattern = new TilingPattern(IR, this.ctx, canvasGraphicsFactory, baseTransform);
39219
39492
  } else {
39220
- pattern = this._getPattern(IR[1], IR[2]);
39493
+ pattern = this._getPattern(opIdx, IR[1], IR[2]);
39221
39494
  }
39222
39495
  return pattern;
39223
39496
  }
39224
- setStrokeColorN() {
39225
- this.current.strokeColor = this.getColorN_Pattern(arguments);
39497
+ setStrokeColorN(opIdx, ...args) {
39498
+ var _a2;
39499
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("strokeColor", opIdx);
39500
+ this.current.strokeColor = this.getColorN_Pattern(opIdx, args);
39226
39501
  this.current.patternStroke = true;
39227
39502
  }
39228
- setFillColorN() {
39229
- this.current.fillColor = this.getColorN_Pattern(arguments);
39503
+ setFillColorN(opIdx, ...args) {
39504
+ var _a2;
39505
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("fillColor", opIdx);
39506
+ this.current.fillColor = this.getColorN_Pattern(opIdx, args);
39230
39507
  this.current.patternFill = true;
39231
39508
  }
39232
- setStrokeRGBColor(color2) {
39509
+ setStrokeRGBColor(opIdx, color2) {
39510
+ var _a2;
39511
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("strokeColor", opIdx);
39233
39512
  this.ctx.strokeStyle = this.current.strokeColor = color2;
39234
39513
  this.current.patternStroke = false;
39235
39514
  }
39236
- setStrokeTransparent() {
39515
+ setStrokeTransparent(opIdx) {
39516
+ var _a2;
39517
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("strokeColor", opIdx);
39237
39518
  this.ctx.strokeStyle = this.current.strokeColor = "transparent";
39238
39519
  this.current.patternStroke = false;
39239
39520
  }
39240
- setFillRGBColor(color2) {
39521
+ setFillRGBColor(opIdx, color2) {
39522
+ var _a2;
39523
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("fillColor", opIdx);
39241
39524
  this.ctx.fillStyle = this.current.fillColor = color2;
39242
39525
  this.current.patternFill = false;
39243
39526
  }
39244
- setFillTransparent() {
39527
+ setFillTransparent(opIdx) {
39528
+ var _a2;
39529
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordSimpleData("fillColor", opIdx);
39245
39530
  this.ctx.fillStyle = this.current.fillColor = "transparent";
39246
39531
  this.current.patternFill = false;
39247
39532
  }
39248
- _getPattern(objId, matrix2 = null) {
39533
+ _getPattern(opIdx, objId, matrix2 = null) {
39249
39534
  let pattern;
39250
39535
  if (this.cachedPatterns.has(objId)) {
39251
39536
  pattern = this.cachedPatterns.get(objId);
39252
39537
  } else {
39253
- pattern = getShadingPattern(this.getObject(objId));
39538
+ pattern = getShadingPattern(this.getObject(opIdx, objId));
39254
39539
  this.cachedPatterns.set(objId, pattern);
39255
39540
  }
39256
39541
  if (matrix2) {
@@ -39258,13 +39543,14 @@ const _CanvasGraphics = class _CanvasGraphics {
39258
39543
  }
39259
39544
  return pattern;
39260
39545
  }
39261
- shadingFill(objId) {
39546
+ shadingFill(opIdx, objId) {
39547
+ var _a2;
39262
39548
  if (!this.contentVisible) {
39263
39549
  return;
39264
39550
  }
39265
39551
  const ctx = this.ctx;
39266
- this.save();
39267
- const pattern = this._getPattern(objId);
39552
+ this.save(opIdx);
39553
+ const pattern = this._getPattern(opIdx, objId);
39268
39554
  ctx.fillStyle = pattern.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.SHADING);
39269
39555
  const inv = getCurrentTransformInverse(ctx);
39270
39556
  if (inv) {
@@ -39279,8 +39565,9 @@ const _CanvasGraphics = class _CanvasGraphics {
39279
39565
  } else {
39280
39566
  this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10);
39281
39567
  }
39568
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.resetBBox(opIdx).recordFullPageBBox(opIdx).recordDependencies(opIdx, Dependencies.transform).recordDependencies(opIdx, Dependencies.fill).recordOperation(opIdx);
39282
39569
  this.compose(this.current.getClippedPathBoundingBox());
39283
- this.restore();
39570
+ this.restore(opIdx);
39284
39571
  }
39285
39572
  beginInlineImage() {
39286
39573
  unreachable("Should not call beginInlineImage");
@@ -39288,14 +39575,15 @@ const _CanvasGraphics = class _CanvasGraphics {
39288
39575
  beginImageData() {
39289
39576
  unreachable("Should not call beginImageData");
39290
39577
  }
39291
- paintFormXObjectBegin(matrix2, bbox) {
39578
+ paintFormXObjectBegin(opIdx, matrix2, bbox) {
39579
+ var _a2;
39292
39580
  if (!this.contentVisible) {
39293
39581
  return;
39294
39582
  }
39295
- this.save();
39583
+ this.save(opIdx);
39296
39584
  this.baseTransformStack.push(this.baseTransform);
39297
39585
  if (matrix2) {
39298
- this.transform(...matrix2);
39586
+ this.transform(opIdx, ...matrix2);
39299
39587
  }
39300
39588
  this.baseTransform = getCurrentTransform(this.ctx);
39301
39589
  if (bbox) {
@@ -39304,21 +39592,23 @@ const _CanvasGraphics = class _CanvasGraphics {
39304
39592
  const clip = new Path2D();
39305
39593
  clip.rect(x0, y0, x1 - x0, y1 - y0);
39306
39594
  this.ctx.clip(clip);
39307
- this.endPath();
39595
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.recordClipBox(opIdx, this.ctx, x0, x1, y0, y1);
39596
+ this.endPath(opIdx);
39308
39597
  }
39309
39598
  }
39310
- paintFormXObjectEnd() {
39599
+ paintFormXObjectEnd(opIdx) {
39311
39600
  if (!this.contentVisible) {
39312
39601
  return;
39313
39602
  }
39314
- this.restore();
39603
+ this.restore(opIdx);
39315
39604
  this.baseTransform = this.baseTransformStack.pop();
39316
39605
  }
39317
- beginGroup(group) {
39606
+ beginGroup(opIdx, group) {
39607
+ var _a2;
39318
39608
  if (!this.contentVisible) {
39319
39609
  return;
39320
39610
  }
39321
- this.save();
39611
+ this.save(opIdx);
39322
39612
  if (this.inSMaskMode) {
39323
39613
  this.endSMaskMode();
39324
39614
  this.current.activeSMask = null;
@@ -39374,18 +39664,21 @@ const _CanvasGraphics = class _CanvasGraphics {
39374
39664
  transferMap: group.smask.transferMap || null,
39375
39665
  startTransformInverse: null
39376
39666
  });
39377
- } else {
39667
+ }
39668
+ if (!group.smask || this.dependencyTracker) {
39378
39669
  currentCtx.setTransform(1, 0, 0, 1, 0, 0);
39379
39670
  currentCtx.translate(offsetX, offsetY);
39380
39671
  currentCtx.save();
39381
39672
  }
39382
39673
  copyCtxState(currentCtx, groupCtx);
39383
39674
  this.ctx = groupCtx;
39384
- this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]);
39675
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha", "strokeAlpha", "globalCompositeOperation"]).pushBaseTransform(currentCtx);
39676
+ this.setGState(opIdx, [["BM", "source-over"], ["ca", 1], ["CA", 1]]);
39385
39677
  this.groupStack.push(currentCtx);
39386
39678
  this.groupLevel++;
39387
39679
  }
39388
- endGroup(group) {
39680
+ endGroup(opIdx, group) {
39681
+ var _a2;
39389
39682
  if (!this.contentVisible) {
39390
39683
  return;
39391
39684
  }
@@ -39394,13 +39687,17 @@ const _CanvasGraphics = class _CanvasGraphics {
39394
39687
  const ctx = this.groupStack.pop();
39395
39688
  this.ctx = ctx;
39396
39689
  this.ctx.imageSmoothingEnabled = false;
39690
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.popBaseTransform();
39397
39691
  if (group.smask) {
39398
39692
  this.tempSMask = this.smaskStack.pop();
39399
- this.restore();
39693
+ this.restore(opIdx);
39694
+ if (this.dependencyTracker) {
39695
+ this.ctx.restore();
39696
+ }
39400
39697
  } else {
39401
39698
  this.ctx.restore();
39402
39699
  const currentMtx = getCurrentTransform(this.ctx);
39403
- this.restore();
39700
+ this.restore(opIdx);
39404
39701
  this.ctx.save();
39405
39702
  this.ctx.setTransform(...currentMtx);
39406
39703
  const dirtyBox = MIN_MAX_INIT.slice();
@@ -39410,11 +39707,11 @@ const _CanvasGraphics = class _CanvasGraphics {
39410
39707
  this.compose(dirtyBox);
39411
39708
  }
39412
39709
  }
39413
- beginAnnotation(id, rect, transform2, matrix2, hasOwnCanvas) {
39710
+ beginAnnotation(opIdx, id, rect, transform2, matrix2, hasOwnCanvas) {
39414
39711
  __privateMethod(this, _CanvasGraphics_instances, restoreInitialState_fn).call(this);
39415
39712
  resetCtxToDefault(this.ctx);
39416
39713
  this.ctx.save();
39417
- this.save();
39714
+ this.save(opIdx);
39418
39715
  if (this.baseTransform) {
39419
39716
  this.ctx.setTransform(...this.baseTransform);
39420
39717
  }
@@ -39448,17 +39745,17 @@ const _CanvasGraphics = class _CanvasGraphics {
39448
39745
  resetCtxToDefault(this.ctx);
39449
39746
  } else {
39450
39747
  resetCtxToDefault(this.ctx);
39451
- this.endPath();
39748
+ this.endPath(opIdx);
39452
39749
  const clip = new Path2D();
39453
39750
  clip.rect(rect[0], rect[1], width, height);
39454
39751
  this.ctx.clip(clip);
39455
39752
  }
39456
39753
  }
39457
39754
  this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);
39458
- this.transform(...transform2);
39459
- this.transform(...matrix2);
39755
+ this.transform(opIdx, ...transform2);
39756
+ this.transform(opIdx, ...matrix2);
39460
39757
  }
39461
- endAnnotation() {
39758
+ endAnnotation(opIdx) {
39462
39759
  if (this.annotationCanvas) {
39463
39760
  this.ctx.restore();
39464
39761
  __privateMethod(this, _CanvasGraphics_instances, drawFilter_fn).call(this);
@@ -39467,47 +39764,55 @@ const _CanvasGraphics = class _CanvasGraphics {
39467
39764
  delete this.annotationCanvas;
39468
39765
  }
39469
39766
  }
39470
- paintImageMaskXObject(img) {
39767
+ paintImageMaskXObject(opIdx, img) {
39768
+ var _a2;
39471
39769
  if (!this.contentVisible) {
39472
39770
  return;
39473
39771
  }
39474
39772
  const count = img.count;
39475
- img = this.getObject(img.data, img);
39773
+ img = this.getObject(opIdx, img.data, img);
39476
39774
  img.count = count;
39477
39775
  const ctx = this.ctx;
39478
- const mask = this._createMaskCanvas(img);
39776
+ const mask = this._createMaskCanvas(opIdx, img);
39479
39777
  const maskCanvas = mask.canvas;
39480
39778
  ctx.save();
39481
39779
  ctx.setTransform(1, 0, 0, 1, 0, 0);
39482
39780
  ctx.drawImage(maskCanvas, mask.offsetX, mask.offsetY);
39781
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.resetBBox(opIdx).recordBBox(opIdx, this.ctx, mask.offsetX, mask.offsetX + maskCanvas.width, mask.offsetY, mask.offsetY + maskCanvas.height).recordOperation(opIdx);
39483
39782
  ctx.restore();
39484
39783
  this.compose();
39485
39784
  }
39486
- paintImageMaskXObjectRepeat(img, scaleX, skewX = 0, skewY = 0, scaleY, positions) {
39785
+ paintImageMaskXObjectRepeat(opIdx, img, scaleX, skewX = 0, skewY = 0, scaleY, positions) {
39786
+ var _a2, _b2, _c;
39487
39787
  if (!this.contentVisible) {
39488
39788
  return;
39489
39789
  }
39490
- img = this.getObject(img.data, img);
39790
+ img = this.getObject(opIdx, img.data, img);
39491
39791
  const ctx = this.ctx;
39492
39792
  ctx.save();
39493
39793
  const currentTransform = getCurrentTransform(ctx);
39494
39794
  ctx.transform(scaleX, skewX, skewY, scaleY, 0, 0);
39495
- const mask = this._createMaskCanvas(img);
39795
+ const mask = this._createMaskCanvas(opIdx, img);
39496
39796
  ctx.setTransform(1, 0, 0, 1, mask.offsetX - currentTransform[4], mask.offsetY - currentTransform[5]);
39797
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.resetBBox(opIdx);
39497
39798
  for (let i = 0, ii = positions.length; i < ii; i += 2) {
39498
39799
  const trans = Util.transform(currentTransform, [scaleX, skewX, skewY, scaleY, positions[i], positions[i + 1]]);
39499
39800
  ctx.drawImage(mask.canvas, trans[4], trans[5]);
39801
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordBBox(opIdx, this.ctx, trans[4], trans[4] + mask.canvas.width, trans[5], trans[5] + mask.canvas.height);
39500
39802
  }
39501
39803
  ctx.restore();
39502
39804
  this.compose();
39805
+ (_c = this.dependencyTracker) == null ? void 0 : _c.recordOperation(opIdx);
39503
39806
  }
39504
- paintImageMaskXObjectGroup(images) {
39807
+ paintImageMaskXObjectGroup(opIdx, images) {
39808
+ var _a2, _b2, _c;
39505
39809
  if (!this.contentVisible) {
39506
39810
  return;
39507
39811
  }
39508
39812
  const ctx = this.ctx;
39509
39813
  const fillColor = this.current.fillColor;
39510
39814
  const isPatternFill = this.current.patternFill;
39815
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.resetBBox(opIdx).recordDependencies(opIdx, Dependencies.transformAndFill);
39511
39816
  for (const image2 of images) {
39512
39817
  const {
39513
39818
  data,
@@ -39518,7 +39823,7 @@ const _CanvasGraphics = class _CanvasGraphics {
39518
39823
  const maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height);
39519
39824
  const maskCtx = maskCanvas.context;
39520
39825
  maskCtx.save();
39521
- const img = this.getObject(data, image2);
39826
+ const img = this.getObject(opIdx, data, image2);
39522
39827
  putBinaryImageMask(maskCtx, img);
39523
39828
  maskCtx.globalCompositeOperation = "source-in";
39524
39829
  maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this, getCurrentTransformInverse(ctx), PathType.FILL) : fillColor;
@@ -39528,26 +39833,28 @@ const _CanvasGraphics = class _CanvasGraphics {
39528
39833
  ctx.transform(...transform2);
39529
39834
  ctx.scale(1, -1);
39530
39835
  drawImageAtIntegerCoords(ctx, maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1);
39836
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordBBox(opIdx, ctx, 0, width, 0, height);
39531
39837
  ctx.restore();
39532
39838
  }
39533
39839
  this.compose();
39840
+ (_c = this.dependencyTracker) == null ? void 0 : _c.recordOperation(opIdx);
39534
39841
  }
39535
- paintImageXObject(objId) {
39842
+ paintImageXObject(opIdx, objId) {
39536
39843
  if (!this.contentVisible) {
39537
39844
  return;
39538
39845
  }
39539
- const imgData = this.getObject(objId);
39846
+ const imgData = this.getObject(opIdx, objId);
39540
39847
  if (!imgData) {
39541
39848
  warn("Dependent image isn't ready yet");
39542
39849
  return;
39543
39850
  }
39544
- this.paintInlineImageXObject(imgData);
39851
+ this.paintInlineImageXObject(opIdx, imgData);
39545
39852
  }
39546
- paintImageXObjectRepeat(objId, scaleX, scaleY, positions) {
39853
+ paintImageXObjectRepeat(opIdx, objId, scaleX, scaleY, positions) {
39547
39854
  if (!this.contentVisible) {
39548
39855
  return;
39549
39856
  }
39550
- const imgData = this.getObject(objId);
39857
+ const imgData = this.getObject(opIdx, objId);
39551
39858
  if (!imgData) {
39552
39859
  warn("Dependent image isn't ready yet");
39553
39860
  return;
@@ -39564,7 +39871,7 @@ const _CanvasGraphics = class _CanvasGraphics {
39564
39871
  h: height
39565
39872
  });
39566
39873
  }
39567
- this.paintInlineImageXObjectGroup(imgData, map);
39874
+ this.paintInlineImageXObjectGroup(opIdx, imgData, map);
39568
39875
  }
39569
39876
  applyTransferMapsToCanvas(ctx) {
39570
39877
  if (this.current.transferMaps !== "none") {
@@ -39590,14 +39897,15 @@ const _CanvasGraphics = class _CanvasGraphics {
39590
39897
  tmpCtx.filter = "none";
39591
39898
  return tmpCanvas.canvas;
39592
39899
  }
39593
- paintInlineImageXObject(imgData) {
39900
+ paintInlineImageXObject(opIdx, imgData) {
39901
+ var _a2;
39594
39902
  if (!this.contentVisible) {
39595
39903
  return;
39596
39904
  }
39597
39905
  const width = imgData.width;
39598
39906
  const height = imgData.height;
39599
39907
  const ctx = this.ctx;
39600
- this.save();
39908
+ this.save(opIdx);
39601
39909
  const {
39602
39910
  filter
39603
39911
  } = ctx;
@@ -39618,11 +39926,13 @@ const _CanvasGraphics = class _CanvasGraphics {
39618
39926
  }
39619
39927
  const scaled = this._scaleImage(imgToPaint, getCurrentTransformInverse(ctx));
39620
39928
  ctx.imageSmoothingEnabled = getImageSmoothingEnabled(getCurrentTransform(ctx), imgData.interpolate);
39929
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.resetBBox(opIdx).recordBBox(opIdx, ctx, 0, width, -height, 0).recordDependencies(opIdx, Dependencies.imageXObject).recordOperation(opIdx);
39621
39930
  drawImageAtIntegerCoords(ctx, scaled.img, 0, 0, scaled.paintWidth, scaled.paintHeight, 0, -height, width, height);
39622
39931
  this.compose();
39623
- this.restore();
39932
+ this.restore(opIdx);
39624
39933
  }
39625
- paintInlineImageXObjectGroup(imgData, map) {
39934
+ paintInlineImageXObjectGroup(opIdx, imgData, map) {
39935
+ var _a2, _b2, _c;
39626
39936
  if (!this.contentVisible) {
39627
39937
  return;
39628
39938
  }
@@ -39638,32 +39948,41 @@ const _CanvasGraphics = class _CanvasGraphics {
39638
39948
  putBinaryImageData(tmpCtx, imgData);
39639
39949
  imgToPaint = this.applyTransferMapsToCanvas(tmpCtx);
39640
39950
  }
39951
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.resetBBox(opIdx);
39641
39952
  for (const entry of map) {
39642
39953
  ctx.save();
39643
39954
  ctx.transform(...entry.transform);
39644
39955
  ctx.scale(1, -1);
39645
39956
  drawImageAtIntegerCoords(ctx, imgToPaint, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1);
39957
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordBBox(opIdx, ctx, 0, 1, -1, 0);
39646
39958
  ctx.restore();
39647
39959
  }
39960
+ (_c = this.dependencyTracker) == null ? void 0 : _c.recordOperation(opIdx);
39648
39961
  this.compose();
39649
39962
  }
39650
- paintSolidColorImageMask() {
39963
+ paintSolidColorImageMask(opIdx) {
39964
+ var _a2;
39651
39965
  if (!this.contentVisible) {
39652
39966
  return;
39653
39967
  }
39968
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.resetBBox(opIdx).recordBBox(opIdx, this.ctx, 0, 1, 0, 1).recordDependencies(opIdx, Dependencies.fill).recordOperation(opIdx);
39654
39969
  this.ctx.fillRect(0, 0, 1, 1);
39655
39970
  this.compose();
39656
39971
  }
39657
- markPoint(tag) {
39972
+ markPoint(opIdx, tag) {
39658
39973
  }
39659
- markPointProps(tag, properties) {
39974
+ markPointProps(opIdx, tag, properties) {
39660
39975
  }
39661
- beginMarkedContent(tag) {
39976
+ beginMarkedContent(opIdx, tag) {
39977
+ var _a2;
39978
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.beginMarkedContent(opIdx);
39662
39979
  this.markedContentStack.push({
39663
39980
  visible: true
39664
39981
  });
39665
39982
  }
39666
- beginMarkedContentProps(tag, properties) {
39983
+ beginMarkedContentProps(opIdx, tag, properties) {
39984
+ var _a2;
39985
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.beginMarkedContent(opIdx);
39667
39986
  if (tag === "OC") {
39668
39987
  this.markedContentStack.push({
39669
39988
  visible: this.optionalContentConfig.isVisible(properties)
@@ -39675,15 +39994,18 @@ const _CanvasGraphics = class _CanvasGraphics {
39675
39994
  }
39676
39995
  this.contentVisible = this.isContentVisible();
39677
39996
  }
39678
- endMarkedContent() {
39997
+ endMarkedContent(opIdx) {
39998
+ var _a2;
39999
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.endMarkedContent(opIdx);
39679
40000
  this.markedContentStack.pop();
39680
40001
  this.contentVisible = this.isContentVisible();
39681
40002
  }
39682
- beginCompat() {
40003
+ beginCompat(opIdx) {
39683
40004
  }
39684
- endCompat() {
40005
+ endCompat(opIdx) {
39685
40006
  }
39686
- consumePath(path, clipBox) {
40007
+ consumePath(opIdx, path, clipBox) {
40008
+ var _a2, _b2;
39687
40009
  const isEmpty = this.current.isEmptyClip();
39688
40010
  if (this.pendingClip) {
39689
40011
  this.current.updateClipFromPath();
@@ -39701,6 +40023,9 @@ const _CanvasGraphics = class _CanvasGraphics {
39701
40023
  }
39702
40024
  }
39703
40025
  this.pendingClip = null;
40026
+ (_a2 = this.dependencyTracker) == null ? void 0 : _a2.bboxToClipBoxDropOperation(opIdx).recordFutureForcedDependency("clipPath", opIdx);
40027
+ } else {
40028
+ (_b2 = this.dependencyTracker) == null ? void 0 : _b2.recordOperation(opIdx);
39704
40029
  }
39705
40030
  this.current.startNewPathAndClipBox(this.current.clipBox);
39706
40031
  }
@@ -42075,7 +42400,7 @@ function getDocument(src = {}) {
42075
42400
  }
42076
42401
  const docParams = {
42077
42402
  docId,
42078
- apiVersion: "5.4.54",
42403
+ apiVersion: "5.4.149",
42079
42404
  data,
42080
42405
  password,
42081
42406
  disableAutoFetch,
@@ -42316,6 +42641,9 @@ class PDFDocumentProxy {
42316
42641
  getAttachments() {
42317
42642
  return this._transport.getAttachments();
42318
42643
  }
42644
+ getAnnotationsByType(types, pageIndexesToSkip) {
42645
+ return this._transport.getAnnotationsByType(types, pageIndexesToSkip);
42646
+ }
42319
42647
  getJSActions() {
42320
42648
  return this._transport.getDocJSActions();
42321
42649
  }
@@ -42386,6 +42714,7 @@ class PDFPageProxy {
42386
42714
  this.objs = new PDFObjects();
42387
42715
  this._intentStates = /* @__PURE__ */ new Map();
42388
42716
  this.destroyed = false;
42717
+ this.recordedGroups = null;
42389
42718
  }
42390
42719
  get pageNumber() {
42391
42720
  return this._pageIndex + 1;
@@ -42454,9 +42783,11 @@ class PDFPageProxy {
42454
42783
  annotationCanvasMap = null,
42455
42784
  pageColors = null,
42456
42785
  printAnnotationStorage = null,
42457
- isEditing = false
42786
+ isEditing = false,
42787
+ recordOperations = false,
42788
+ filteredOperationIndexes = null
42458
42789
  }) {
42459
- var _a2, _b2;
42790
+ var _a2, _b2, _c;
42460
42791
  (_a2 = this._stats) == null ? void 0 : _a2.time("Overall");
42461
42792
  const intentArgs = this._transport.getRenderingIntent(intent, annotationMode, printAnnotationStorage, isEditing);
42462
42793
  const {
@@ -42486,9 +42817,21 @@ class PDFPageProxy {
42486
42817
  (_b2 = this._stats) == null ? void 0 : _b2.time("Page Request");
42487
42818
  this._pumpOperatorList(intentArgs);
42488
42819
  }
42820
+ const shouldRecordOperations = !this.recordedGroups && (recordOperations || this._pdfBug && ((_c = globalThis.StepperManager) == null ? void 0 : _c.enabled));
42489
42821
  const complete = (error) => {
42490
- var _a3;
42822
+ var _a3, _b3, _c2;
42491
42823
  intentState.renderTasks.delete(internalRenderTask);
42824
+ if (shouldRecordOperations) {
42825
+ const recordedGroups = (_a3 = internalRenderTask.gfx) == null ? void 0 : _a3.dependencyTracker.take();
42826
+ if (recordedGroups) {
42827
+ (_b3 = internalRenderTask.stepper) == null ? void 0 : _b3.setOperatorGroups(recordedGroups);
42828
+ if (recordOperations) {
42829
+ this.recordedGroups = recordedGroups;
42830
+ }
42831
+ } else if (recordOperations) {
42832
+ this.recordedGroups = [];
42833
+ }
42834
+ }
42492
42835
  if (intentPrint) {
42493
42836
  __privateSet(this, _pendingCleanup, true);
42494
42837
  }
@@ -42505,7 +42848,7 @@ class PDFPageProxy {
42505
42848
  if (this._stats) {
42506
42849
  this._stats.timeEnd("Rendering");
42507
42850
  this._stats.timeEnd("Overall");
42508
- if ((_a3 = globalThis.Stats) == null ? void 0 : _a3.enabled) {
42851
+ if ((_c2 = globalThis.Stats) == null ? void 0 : _c2.enabled) {
42509
42852
  globalThis.Stats.add(this.pageNumber, this._stats);
42510
42853
  }
42511
42854
  }
@@ -42515,6 +42858,7 @@ class PDFPageProxy {
42515
42858
  params: {
42516
42859
  canvas: canvas2,
42517
42860
  canvasContext,
42861
+ dependencyTracker: shouldRecordOperations ? new CanvasDependencyTracker(canvas2) : null,
42518
42862
  viewport,
42519
42863
  transform: transform2,
42520
42864
  background
@@ -42529,7 +42873,8 @@ class PDFPageProxy {
42529
42873
  useRequestAnimationFrame: !intentPrint,
42530
42874
  pdfBug: this._pdfBug,
42531
42875
  pageColors,
42532
- enableHWA: this._transport.enableHWA
42876
+ enableHWA: this._transport.enableHWA,
42877
+ filteredOperationIndexes
42533
42878
  });
42534
42879
  (intentState.renderTasks || (intentState.renderTasks = /* @__PURE__ */ new Set())).add(internalRenderTask);
42535
42880
  const renderTask = internalRenderTask.task;
@@ -43498,6 +43843,12 @@ class WorkerTransport {
43498
43843
  getAttachments() {
43499
43844
  return this.messageHandler.sendWithPromise("GetAttachments", null);
43500
43845
  }
43846
+ getAnnotationsByType(types, pageIndexesToSkip) {
43847
+ return this.messageHandler.sendWithPromise("GetAnnotationsByType", {
43848
+ types,
43849
+ pageIndexesToSkip
43850
+ });
43851
+ }
43501
43852
  getDocJSActions() {
43502
43853
  return __privateMethod(this, _WorkerTransport_instances, cacheSimpleMethod_fn).call(this, "GetDocJSActions");
43503
43854
  }
@@ -43626,7 +43977,8 @@ const _InternalRenderTask = class _InternalRenderTask {
43626
43977
  useRequestAnimationFrame = false,
43627
43978
  pdfBug = false,
43628
43979
  pageColors = null,
43629
- enableHWA = false
43980
+ enableHWA = false,
43981
+ filteredOperationIndexes = null
43630
43982
  }) {
43631
43983
  __privateAdd(this, _rAF, null);
43632
43984
  this.callback = callback;
@@ -43655,6 +44007,8 @@ const _InternalRenderTask = class _InternalRenderTask {
43655
44007
  this._canvas = params.canvas;
43656
44008
  this._canvasContext = params.canvas ? null : params.canvasContext;
43657
44009
  this._enableHWA = enableHWA;
44010
+ this._dependencyTracker = params.dependencyTracker;
44011
+ this._filteredOperationIndexes = filteredOperationIndexes;
43658
44012
  }
43659
44013
  get completed() {
43660
44014
  return this.capability.promise.catch(function() {
@@ -43682,7 +44036,8 @@ const _InternalRenderTask = class _InternalRenderTask {
43682
44036
  const {
43683
44037
  viewport,
43684
44038
  transform: transform2,
43685
- background
44039
+ background,
44040
+ dependencyTracker
43686
44041
  } = this.params;
43687
44042
  const canvasContext = this._canvasContext || this._canvas.getContext("2d", {
43688
44043
  alpha: false,
@@ -43690,7 +44045,7 @@ const _InternalRenderTask = class _InternalRenderTask {
43690
44045
  });
43691
44046
  this.gfx = new CanvasGraphics(canvasContext, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, {
43692
44047
  optionalContentConfig
43693
- }, this.annotationCanvasMap, this.pageColors);
44048
+ }, this.annotationCanvasMap, this.pageColors, dependencyTracker);
43694
44049
  this.gfx.beginDrawing({
43695
44050
  transform: transform2,
43696
44051
  viewport,
@@ -43753,7 +44108,7 @@ const _InternalRenderTask = class _InternalRenderTask {
43753
44108
  if (this.cancelled) {
43754
44109
  return;
43755
44110
  }
43756
- this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList, this.operatorListIdx, this._continueBound, this.stepper);
44111
+ this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList, this.operatorListIdx, this._continueBound, this.stepper, this._filteredOperationIndexes);
43757
44112
  if (this.operatorListIdx === this.operatorList.argsArray.length) {
43758
44113
  this.running = false;
43759
44114
  if (this.operatorList.lastChunk) {
@@ -43769,8 +44124,8 @@ _rAF = new WeakMap();
43769
44124
  _canvasInUse = new WeakMap();
43770
44125
  __privateAdd(_InternalRenderTask, _canvasInUse, /* @__PURE__ */ new WeakSet());
43771
44126
  let InternalRenderTask = _InternalRenderTask;
43772
- const version = "5.4.54";
43773
- const build = "295fb3ec4";
44127
+ const version = "5.4.149";
44128
+ const build = "9e2e9e209";
43774
44129
  const _ColorPicker = class _ColorPicker {
43775
44130
  constructor({
43776
44131
  editor = null,
@@ -44457,6 +44812,7 @@ const _AnnotationElement = class _AnnotationElement {
44457
44812
  this.renderForms = parameters.renderForms;
44458
44813
  this.svgFactory = parameters.svgFactory;
44459
44814
  this.annotationStorage = parameters.annotationStorage;
44815
+ this.enableComment = parameters.enableComment;
44460
44816
  this.enableScripting = parameters.enableScripting;
44461
44817
  this.hasJSActions = parameters.hasJSActions;
44462
44818
  this._fieldObjects = parameters.fieldObjects;
@@ -44480,6 +44836,61 @@ const _AnnotationElement = class _AnnotationElement {
44480
44836
  get hasPopupData() {
44481
44837
  return _AnnotationElement._hasPopupData(this.data);
44482
44838
  }
44839
+ get hasCommentButton() {
44840
+ return this.enableComment && this._isEditable && this.hasPopupElement;
44841
+ }
44842
+ get commentButtonPosition() {
44843
+ const {
44844
+ quadPoints,
44845
+ rect
44846
+ } = this.data;
44847
+ let maxX = -Infinity;
44848
+ let maxY = -Infinity;
44849
+ if ((quadPoints == null ? void 0 : quadPoints.length) >= 8) {
44850
+ for (let i = 0; i < quadPoints.length; i += 8) {
44851
+ if (quadPoints[i + 1] > maxY) {
44852
+ maxY = quadPoints[i + 1];
44853
+ maxX = quadPoints[i + 2];
44854
+ } else if (quadPoints[i + 1] === maxY) {
44855
+ maxX = Math.max(maxX, quadPoints[i + 2]);
44856
+ }
44857
+ }
44858
+ return [maxX, maxY];
44859
+ }
44860
+ if (rect) {
44861
+ return [rect[2], rect[3]];
44862
+ }
44863
+ return null;
44864
+ }
44865
+ get commentButtonColor() {
44866
+ var _a2;
44867
+ if (!this.data.color) {
44868
+ return null;
44869
+ }
44870
+ const [r, g2, b2] = this.data.color;
44871
+ const opacity2 = (_a2 = this.data.opacity) != null ? _a2 : 1;
44872
+ const oppositeOpacity = 255 * (1 - opacity2);
44873
+ return __privateMethod(this, _AnnotationElement_instances, changeLightness_fn).call(this, Math.min(r + oppositeOpacity, 255), Math.min(g2 + oppositeOpacity, 255), Math.min(b2 + oppositeOpacity, 255));
44874
+ }
44875
+ _normalizePoint(point) {
44876
+ const {
44877
+ page: {
44878
+ view
44879
+ },
44880
+ viewport: {
44881
+ rawDims: {
44882
+ pageWidth,
44883
+ pageHeight,
44884
+ pageX,
44885
+ pageY
44886
+ }
44887
+ }
44888
+ } = this.parent;
44889
+ point[1] = view[3] - point[1] + view[1];
44890
+ point[0] = 100 * (point[0] - pageX) / pageWidth;
44891
+ point[1] = 100 * (point[1] - pageY) / pageHeight;
44892
+ return point;
44893
+ }
44483
44894
  updateEdited(params) {
44484
44895
  var _a2;
44485
44896
  if (!this.container) {
@@ -44537,7 +44948,8 @@ const _AnnotationElement = class _AnnotationElement {
44537
44948
  const {
44538
44949
  style
44539
44950
  } = container;
44540
- style.zIndex = this.parent.zIndex++;
44951
+ style.zIndex = this.parent.zIndex;
44952
+ this.parent.zIndex += 2;
44541
44953
  if (data.alternativeText) {
44542
44954
  container.title = data.alternativeText;
44543
44955
  }
@@ -44958,6 +45370,30 @@ _updates = new WeakMap();
44958
45370
  _hasBorder = new WeakMap();
44959
45371
  _popupElement = new WeakMap();
44960
45372
  _AnnotationElement_instances = new WeakSet();
45373
+ changeLightness_fn = function(r, g2, b2) {
45374
+ r /= 255;
45375
+ g2 /= 255;
45376
+ b2 /= 255;
45377
+ const max2 = Math.max(r, g2, b2);
45378
+ const min = Math.min(r, g2, b2);
45379
+ const l2 = (max2 + min) / 2;
45380
+ const newL = ((1 + Math.sqrt(l2)) / 2 * 100).toFixed(2);
45381
+ if (max2 === min) {
45382
+ return `hsl(0, 0%, ${newL}%)`;
45383
+ }
45384
+ const d2 = max2 - min;
45385
+ let h2;
45386
+ if (max2 === r) {
45387
+ h2 = (g2 - b2) / d2 + (g2 < b2 ? 6 : 0);
45388
+ } else if (max2 === g2) {
45389
+ h2 = (b2 - r) / d2 + 2;
45390
+ } else {
45391
+ h2 = (r - g2) / d2 + 4;
45392
+ }
45393
+ h2 = (h2 * 60).toFixed(2);
45394
+ const s2 = (d2 / (1 - Math.abs(2 * l2 - 1)) * 100).toFixed(2);
45395
+ return `hsl(${h2}, ${s2}%, ${newL}%)`;
45396
+ };
44961
45397
  setRectEdited_fn = function(rect) {
44962
45398
  const {
44963
45399
  container: {
@@ -46164,7 +46600,8 @@ class PopupAnnotationElement extends AnnotationElement {
46164
46600
  parentRect: this.data.parentRect || null,
46165
46601
  parent: this.parent,
46166
46602
  elements: this.elements,
46167
- open: this.data.open
46603
+ open: this.data.open,
46604
+ eventBus: this.linkService.eventBus
46168
46605
  });
46169
46606
  const elementIds = [];
46170
46607
  for (const element of this.elements) {
@@ -46189,7 +46626,8 @@ class PopupElement {
46189
46626
  parent,
46190
46627
  rect,
46191
46628
  parentRect,
46192
- open: open2
46629
+ open: open2,
46630
+ eventBus = null
46193
46631
  }) {
46194
46632
  __privateAdd(this, _PopupElement_instances);
46195
46633
  __privateAdd(this, _boundKeyDown, __privateMethod(this, _PopupElement_instances, keyDown_fn2).bind(this));
@@ -46201,12 +46639,16 @@ class PopupElement {
46201
46639
  __privateAdd(this, _contentsObj, null);
46202
46640
  __privateAdd(this, _dateObj, null);
46203
46641
  __privateAdd(this, _elements, null);
46642
+ __privateAdd(this, _eventBus2, null);
46204
46643
  __privateAdd(this, _parent, null);
46205
46644
  __privateAdd(this, _parentRect, null);
46206
46645
  __privateAdd(this, _pinned, false);
46207
46646
  __privateAdd(this, _popup, null);
46208
46647
  __privateAdd(this, _popupAbortController, null);
46209
46648
  __privateAdd(this, _position2, null);
46649
+ __privateAdd(this, _commentButton2, null);
46650
+ __privateAdd(this, _commentButtonPosition, null);
46651
+ __privateAdd(this, _commentButtonColor, null);
46210
46652
  __privateAdd(this, _rect, null);
46211
46653
  __privateAdd(this, _richText, null);
46212
46654
  __privateAdd(this, _titleObj, null);
@@ -46221,6 +46663,7 @@ class PopupElement {
46221
46663
  __privateSet(this, _rect, rect);
46222
46664
  __privateSet(this, _parentRect, parentRect);
46223
46665
  __privateSet(this, _elements, elements);
46666
+ __privateSet(this, _eventBus2, eventBus);
46224
46667
  __privateSet(this, _dateObj, PDFDateString.toDateObject(modificationDate));
46225
46668
  this.trigger = elements.flatMap((e2) => e2.getElementsToTriggerPopup());
46226
46669
  __privateMethod(this, _PopupElement_instances, addEventListeners_fn).call(this);
@@ -46376,12 +46819,16 @@ _container4 = new WeakMap();
46376
46819
  _contentsObj = new WeakMap();
46377
46820
  _dateObj = new WeakMap();
46378
46821
  _elements = new WeakMap();
46822
+ _eventBus2 = new WeakMap();
46379
46823
  _parent = new WeakMap();
46380
46824
  _parentRect = new WeakMap();
46381
46825
  _pinned = new WeakMap();
46382
46826
  _popup = new WeakMap();
46383
46827
  _popupAbortController = new WeakMap();
46384
46828
  _position2 = new WeakMap();
46829
+ _commentButton2 = new WeakMap();
46830
+ _commentButtonPosition = new WeakMap();
46831
+ _commentButtonColor = new WeakMap();
46385
46832
  _rect = new WeakMap();
46386
46833
  _richText = new WeakMap();
46387
46834
  _titleObj = new WeakMap();
@@ -46414,6 +46861,66 @@ addEventListeners_fn = function() {
46414
46861
  signal
46415
46862
  });
46416
46863
  }
46864
+ __privateMethod(this, _PopupElement_instances, renderCommentButton_fn).call(this);
46865
+ };
46866
+ setCommentButtonPosition_fn = function() {
46867
+ const element = __privateGet(this, _elements).find((e2) => e2.hasCommentButton);
46868
+ if (!element) {
46869
+ return;
46870
+ }
46871
+ __privateSet(this, _commentButtonPosition, element._normalizePoint(element.commentButtonPosition));
46872
+ __privateSet(this, _commentButtonColor, element.commentButtonColor);
46873
+ };
46874
+ renderCommentButton_fn = function() {
46875
+ if (__privateGet(this, _commentButton2)) {
46876
+ return;
46877
+ }
46878
+ if (!__privateGet(this, _commentButtonPosition)) {
46879
+ __privateMethod(this, _PopupElement_instances, setCommentButtonPosition_fn).call(this);
46880
+ }
46881
+ if (!__privateGet(this, _commentButtonPosition)) {
46882
+ return;
46883
+ }
46884
+ const button = __privateSet(this, _commentButton2, document.createElement("button"));
46885
+ button.className = "annotationCommentButton";
46886
+ const parentContainer = __privateGet(this, _elements)[0].container;
46887
+ button.style.zIndex = parentContainer.style.zIndex + 1;
46888
+ button.tabIndex = 0;
46889
+ const {
46890
+ signal
46891
+ } = __privateGet(this, _popupAbortController);
46892
+ button.addEventListener("hover", __privateGet(this, _boundToggle), {
46893
+ signal
46894
+ });
46895
+ button.addEventListener("keydown", __privateGet(this, _boundKeyDown), {
46896
+ signal
46897
+ });
46898
+ button.addEventListener("click", () => {
46899
+ var _a2;
46900
+ const [{
46901
+ data: {
46902
+ id: editId
46903
+ },
46904
+ annotationEditorType: mode
46905
+ }] = __privateGet(this, _elements);
46906
+ (_a2 = __privateGet(this, _eventBus2)) == null ? void 0 : _a2.dispatch("switchannotationeditormode", {
46907
+ source: this,
46908
+ editId,
46909
+ mode,
46910
+ editComment: true
46911
+ });
46912
+ }, {
46913
+ signal
46914
+ });
46915
+ const {
46916
+ style
46917
+ } = button;
46918
+ style.left = `calc(${__privateGet(this, _commentButtonPosition)[0]}%)`;
46919
+ style.top = `calc(${__privateGet(this, _commentButtonPosition)[1]}% - var(--comment-button-dim))`;
46920
+ if (__privateGet(this, _commentButtonColor)) {
46921
+ style.backgroundColor = __privateGet(this, _commentButtonColor);
46922
+ }
46923
+ parentContainer.after(button);
46417
46924
  };
46418
46925
  html_get = function() {
46419
46926
  const richText = __privateGet(this, _richText);
@@ -46848,6 +47355,33 @@ class InkAnnotationElement extends AnnotationElement {
46848
47355
  addHighlightArea() {
46849
47356
  this.container.classList.add("highlightArea");
46850
47357
  }
47358
+ get commentButtonPosition() {
47359
+ const {
47360
+ inkLists,
47361
+ rect
47362
+ } = this.data;
47363
+ if ((inkLists == null ? void 0 : inkLists.length) >= 1) {
47364
+ let maxX = -Infinity;
47365
+ let maxY = -Infinity;
47366
+ for (const inkList of inkLists) {
47367
+ for (let i = 0, ii = inkList.length; i < ii; i += 2) {
47368
+ if (inkList[i + 1] > maxY) {
47369
+ maxY = inkList[i + 1];
47370
+ maxX = inkList[i];
47371
+ } else if (inkList[i + 1] === maxY) {
47372
+ maxX = Math.max(maxX, inkList[i]);
47373
+ }
47374
+ }
47375
+ }
47376
+ if (maxX !== Infinity) {
47377
+ return [maxX, maxY];
47378
+ }
47379
+ }
47380
+ if (rect) {
47381
+ return [rect[2], rect[3]];
47382
+ }
47383
+ return null;
47384
+ }
46851
47385
  }
46852
47386
  _polylinesGroupElement = new WeakMap();
46853
47387
  _polylines = new WeakMap();
@@ -47121,6 +47655,7 @@ const _AnnotationLayer = class _AnnotationLayer {
47121
47655
  renderForms: params.renderForms !== false,
47122
47656
  svgFactory: new DOMSVGFactory(),
47123
47657
  annotationStorage: params.annotationStorage || new AnnotationStorage(),
47658
+ enableComment: params.enableComment === true,
47124
47659
  enableScripting: params.enableScripting === true,
47125
47660
  hasJSActions: params.hasJSActions,
47126
47661
  fieldObjects: params.fieldObjects,
@@ -47690,6 +48225,10 @@ const _FreeTextEditor = class _FreeTextEditor extends AnnotationEditor {
47690
48225
  get contentDiv() {
47691
48226
  return this.editorDiv;
47692
48227
  }
48228
+ getPDFRect() {
48229
+ const padding = _FreeTextEditor._internalPadding * this.parentScale;
48230
+ return this.getRect(padding, padding);
48231
+ }
47693
48232
  static deserialize(data, parent, uiManager) {
47694
48233
  return __async(this, null, function* () {
47695
48234
  var _a2;
@@ -47752,8 +48291,7 @@ const _FreeTextEditor = class _FreeTextEditor extends AnnotationEditor {
47752
48291
  if (this.deleted) {
47753
48292
  return this.serializeDeleted();
47754
48293
  }
47755
- const padding = _FreeTextEditor._internalPadding * this.parentScale;
47756
- const rect = this.getRect(padding, padding);
48294
+ const rect = this.getPDFRect();
47757
48295
  const color2 = AnnotationEditor._colorManager.convert(this.isAttachedToDOM ? getComputedStyle(this.editorDiv).color : __privateGet(this, _color2));
47758
48296
  const serialized = {
47759
48297
  annotationType: AnnotationEditorType.FREETEXT,
@@ -47778,6 +48316,9 @@ const _FreeTextEditor = class _FreeTextEditor extends AnnotationEditor {
47778
48316
  }
47779
48317
  renderAnnotationElement(annotation) {
47780
48318
  const content2 = super.renderAnnotationElement(annotation);
48319
+ if (!content2) {
48320
+ return null;
48321
+ }
47781
48322
  const {
47782
48323
  style
47783
48324
  } = content2;
@@ -47789,9 +48330,8 @@ const _FreeTextEditor = class _FreeTextEditor extends AnnotationEditor {
47789
48330
  div.append(line ? document.createTextNode(line) : document.createElement("br"));
47790
48331
  content2.append(div);
47791
48332
  }
47792
- const padding = _FreeTextEditor._internalPadding * this.parentScale;
47793
48333
  const params = {
47794
- rect: this.getRect(padding, padding)
48334
+ rect: this.getPDFRect()
47795
48335
  };
47796
48336
  params.popup = this.hasEditedComment ? this.comment : {
47797
48337
  text: __privateGet(this, _content)
@@ -49139,7 +49679,7 @@ const _HighlightEditor = class _HighlightEditor extends AnnotationEditor {
49139
49679
  if (this.deleted) {
49140
49680
  return this.serializeDeleted();
49141
49681
  }
49142
- const rect = this.getRect(0, 0);
49682
+ const rect = this.getPDFRect();
49143
49683
  const color2 = AnnotationEditor._colorManager.convert(this._uiManager.getNonHCMColor(this.color));
49144
49684
  const serialized = {
49145
49685
  annotationType: AnnotationEditorType.HIGHLIGHT,
@@ -49161,8 +49701,12 @@ const _HighlightEditor = class _HighlightEditor extends AnnotationEditor {
49161
49701
  return serialized;
49162
49702
  }
49163
49703
  renderAnnotationElement(annotation) {
49704
+ if (this.deleted) {
49705
+ annotation.hide();
49706
+ return null;
49707
+ }
49164
49708
  const params = {
49165
- rect: this.getRect(0, 0)
49709
+ rect: this.getPDFRect()
49166
49710
  };
49167
49711
  if (this.hasEditedComment) {
49168
49712
  params.popup = this.comment;
@@ -49992,7 +50536,7 @@ const _DrawingEditor = class _DrawingEditor extends AnnotationEditor {
49992
50536
  }
49993
50537
  renderAnnotationElement(annotation) {
49994
50538
  annotation.updateEdited({
49995
- rect: this.getRect(0, 0)
50539
+ rect: this.getPDFRect()
49996
50540
  });
49997
50541
  return null;
49998
50542
  }
@@ -51028,6 +51572,10 @@ const _InkEditor = class _InkEditor extends DrawingEditor {
51028
51572
  return serialized;
51029
51573
  }
51030
51574
  renderAnnotationElement(annotation) {
51575
+ if (this.deleted) {
51576
+ annotation.hide();
51577
+ return null;
51578
+ }
51031
51579
  const {
51032
51580
  points,
51033
51581
  rect
@@ -52469,7 +53017,7 @@ const _StampEditor = class _StampEditor extends AnnotationEditor {
52469
53017
  annotationType: AnnotationEditorType.STAMP,
52470
53018
  bitmapId: __privateGet(this, _bitmapId),
52471
53019
  pageIndex: this.pageIndex,
52472
- rect: this.getRect(0, 0),
53020
+ rect: this.getPDFRect(),
52473
53021
  rotation: this.rotation,
52474
53022
  isSvg: __privateGet(this, _isSvg),
52475
53023
  structTreeParentId: this._structTreeParentId
@@ -52525,8 +53073,12 @@ const _StampEditor = class _StampEditor extends AnnotationEditor {
52525
53073
  return serialized;
52526
53074
  }
52527
53075
  renderAnnotationElement(annotation) {
53076
+ if (this.deleted) {
53077
+ annotation.hide();
53078
+ return null;
53079
+ }
52528
53080
  const params = {
52529
- rect: this.getRect(0, 0)
53081
+ rect: this.getPDFRect()
52530
53082
  };
52531
53083
  if (this.hasEditedComment) {
52532
53084
  params.popup = this.comment;
@@ -57994,7 +58546,7 @@ const convertPdfToImages = (_0, ..._1) => __async(void 0, [_0, ..._1], function*
57994
58546
  console.log(`🔄 Convertendo PDF para imagens: ${pageCount} páginas`);
57995
58547
  for (let pageNum = 1; pageNum <= pageCount; pageNum++) {
57996
58548
  const page = yield pdf.getPage(pageNum);
57997
- const viewport = page.getViewport({ scale });
58549
+ const viewport = page.getViewport({ scale: 5 });
57998
58550
  const canvas2 = document.createElement("canvas");
57999
58551
  const context = canvas2.getContext("2d");
58000
58552
  canvas2.height = viewport.height;
@@ -59419,4 +59971,4 @@ export {
59419
59971
  sendToPrinter as y,
59420
59972
  validateLabelData as z
59421
59973
  };
59422
- //# sourceMappingURL=index-BOlnSrKc.js.map
59974
+ //# sourceMappingURL=index-ByX7GCn9.js.map